1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,310341,134449,13154,723685,611209,47238,825004,565445,685575,944307,100561,552491,462573,947716,428322,327975,594479,332389,17877,83662,547285,672895,185654,997155,659086,365332,64912,34855,579892,971351,282803,26915,164441,132628,833766,969571,931067,240814,120197,558935,292373,672746,217789,928712,190368,309491,70528,644260,450076,431237,760339,825148,862396,839997,215340,709516,962991,263545,328815,350774,875099,245104,300497,200232,788870,501388,601538,854924,719727,608444,280832,905516,783325,388923,421664,30631,275767,380199,156142,909357,666153,673364,686947,285697,634919,138981,169058,817051,286775,114291,91749,590744,12140,931708,176236,716483,997708,88096,383998,52072,36285,621380,242986,36876,752066,372844,324833,598834,694969,905775,450728,625256,900037,853696,685681,281105,548631,692745,139858,289710,583934,486661,21803,54632,441839,712968,959128,966346,691517,169797,370592,5280,148741,977430,246718,835929,544318,84143,254312,356048,496352,750588,887471,325296,980643,249662,727716,219779,899553,172905,720926,147659,410309,770337,597928,247484,937839,137638,942528,41333,635226,719459,310022,124382,623212,420361,214857,836458,353877,306431,598061,749637,534491,412876,676080,986438,957302,47887,156104,878275,137943,459350,767924,696215,58151,589866,861884,827385,449221,960708,398289,979912,526803,692286,634365,580124,63081,613634,763769,929046,59897,58213,807528,705044,818932,672965,153815,639302,71017,840208,704089,498416,954398,375886,948603,858706,616718,153039,248588,82243,879662,977116,10329,728502,712849,431713,185935,770196,503344,175736,148971,493733,374710,670437,850695,101073,507607,379668,87802,148876,832091,965602,783466,811627,61284,986258,788448,434078,486324,172311,608112,228948,633229,520219,588724,642718,576420,212649,330312,666299,558760,616672,544717,980477,333834,747711,317889,45608,610830,622417,676997,913255,167064,302797,734600,355915,732009,852847,433789,268408,390431,187058,724429,74964,946986,932193,831431,557965,631897,706263,611217,41629,105078,439621,52025,470017,542927,816467,193438,962971,499979,757864,436627,79116,705255,119843,849003,517034,518335,537537,272405,578488,243686,691079,3990,965571,131024,474456,262518,223553,717013,987247,247817,809199,379971,68105,163934,72677,200397,714401,892587,867396,880179,733327,612415,590016,166664,706964,705218,625724,118528,208193,166832,628172,t=>{"use strict";t.s(["default",()=>ez],685575);var r={value:()=>{}};function i(){for(var t,r=0,i=arguments.length,a={};r<i;++r){if(!(t=arguments[r]+"")||t in a||/[\s.]/.test(t))throw Error("illegal type: "+t);a[t]=[]}return new n(a)}function n(t){this._=t}function a(t,i,n){for(var a=0,o=t.length;a<o;++a)if(t[a].name===i){t[a]=r,t=t.slice(0,a).concat(t.slice(a+1));break}return null!=n&&t.push({name:i,value:n}),t}function o(){}function s(t){return null==t?o:function(){return this.querySelector(t)}}function l(){return[]}function u(t){return null==t?l:function(){return this.querySelectorAll(t)}}function c(t){return function(){return this.matches(t)}}function h(t){return function(r){return r.matches(t)}}n.prototype=i.prototype={constructor:n,on:function(t,r){var i,n=this._,o=(t+"").trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");if(i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),t&&!n.hasOwnProperty(t))throw Error("unknown type: "+t);return{type:t,name:r}}),s=-1,l=o.length;if(arguments.length<2){for(;++s<l;)if((i=(t=o[s]).type)&&(i=function(t,r){for(var i,n=0,a=t.length;n<a;++n)if((i=t[n]).name===r)return i.value}(n[i],t.name)))return i;return}if(null!=r&&"function"!=typeof r)throw Error("invalid callback: "+r);for(;++s<l;)if(i=(t=o[s]).type)n[i]=a(n[i],t.name,r);else if(null==r)for(i in n)n[i]=a(n[i],t.name,null);return this},copy:function(){var t={},r=this._;for(var i in r)t[i]=r[i].slice();return new n(t)},call:function(t,r){if((i=arguments.length-2)>0)for(var i,n,a=Array(i),o=0;o<i;++o)a[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw Error("unknown type: "+t);for(n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(r,a)},apply:function(t,r,i){if(!this._.hasOwnProperty(t))throw Error("unknown type: "+t);for(var n=this._[t],a=0,o=n.length;a<o;++a)n[a].value.apply(r,i)}};var f=Array.prototype.find;function d(){return this.firstElementChild}var p=Array.prototype.filter;function m(){return Array.from(this.children)}function g(t){return Array(t.length)}function y(t,r){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=r}function v(t,r,i,n,a,o){for(var s,l=0,u=r.length,c=o.length;l<c;++l)(s=r[l])?(s.__data__=o[l],n[l]=s):i[l]=new y(t,o[l]);for(;l<u;++l)(s=r[l])&&(a[l]=s)}function _(t,r,i,n,a,o,s){var l,u,c,h=new Map,f=r.length,d=o.length,p=Array(f);for(l=0;l<f;++l)(u=r[l])&&(p[l]=c=s.call(u,u.__data__,l,r)+"",h.has(c)?a[l]=u:h.set(c,u));for(l=0;l<d;++l)c=s.call(t,o[l],l,o)+"",(u=h.get(c))?(n[l]=u,u.__data__=o[l],h.delete(c)):i[l]=new y(t,o[l]);for(l=0;l<f;++l)(u=r[l])&&h.get(p[l])===u&&(a[l]=u)}function b(t){return t.__data__}function x(t,r){return t<r?-1:t>r?1:t>=r?0:NaN}y.prototype={constructor:y,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,r){return this._parent.insertBefore(t,r)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var w="http://www.w3.org/1999/xhtml";let E={svg:"http://www.w3.org/2000/svg",xhtml:w,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function T(t){var r=t+="",i=r.indexOf(":");return i>=0&&"xmlns"!==(r=t.slice(0,i))&&(t=t.slice(i+1)),E.hasOwnProperty(r)?{space:E[r],local:t}:t}function A(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function S(t,r){return t.style.getPropertyValue(r)||A(t).getComputedStyle(t,null).getPropertyValue(r)}function C(t){return t.trim().split(/^|\s+/)}function M(t){return t.classList||new D(t)}function D(t){this._node=t,this._names=C(t.getAttribute("class")||"")}function P(t,r){for(var i=M(t),n=-1,a=r.length;++n<a;)i.add(r[n])}function I(t,r){for(var i=M(t),n=-1,a=r.length;++n<a;)i.remove(r[n])}function k(){this.textContent=""}function O(){this.innerHTML=""}function N(){this.nextSibling&&this.parentNode.appendChild(this)}function L(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function R(t){var r=T(t);return(r.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var r=this.ownerDocument,i=this.namespaceURI;return i===w&&r.documentElement.namespaceURI===w?r.createElement(t):r.createElementNS(i,t)}})(r)}function F(){return null}function B(){var t=this.parentNode;t&&t.removeChild(this)}function z(){var t=this.cloneNode(!1),r=this.parentNode;return r?r.insertBefore(t,this.nextSibling):t}function j(){var t=this.cloneNode(!0),r=this.parentNode;return r?r.insertBefore(t,this.nextSibling):t}function U(t){return function(){var r=this.__on;if(r){for(var i,n=0,a=-1,o=r.length;n<o;++n)(i=r[n],t.type&&i.type!==t.type||i.name!==t.name)?r[++a]=i:this.removeEventListener(i.type,i.listener,i.options);++a?r.length=a:delete this.__on}}}function V(t,r,i){return function(){var n,a=this.__on,o=function(t){r.call(this,t,this.__data__)};if(a){for(var s=0,l=a.length;s<l;++s)if((n=a[s]).type===t.type&&n.name===t.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=o,n.options=i),n.value=r;return}}this.addEventListener(t.type,o,i),n={type:t.type,name:t.name,value:r,listener:o,options:i},a?a.push(n):this.__on=[n]}}function $(t,r,i){var n=A(t),a=n.CustomEvent;"function"==typeof a?a=new a(r,i):(a=n.document.createEvent("Event"),i?(a.initEvent(r,i.bubbles,i.cancelable),a.detail=i.detail):a.initEvent(r,!1,!1)),t.dis
1patchEvent(a)}t.s(["default",0,E,"xhtml",0,w],134449),D.prototype={add:function(t){0>this._names.indexOf(t)&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var r=this._names.indexOf(t);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}},t.s(["default",0,R],13154);var G=[null];function q(t,r){this._groups=t,this._parents=r}function H(){return new q([[document.documentElement]],G)}function W(t,r,i){t.prototype=r.prototype=i,i.constructor=t}function Z(t,r){var i=Object.create(t.prototype);for(var n in r)i[n]=r[n];return i}function Y(){}q.prototype=H.prototype={constructor:q,select:function(t){"function"!=typeof t&&(t=s(t));for(var r=this._groups,i=r.length,n=Array(i),a=0;a<i;++a)for(var o,l,u=r[a],c=u.length,h=n[a]=Array(c),f=0;f<c;++f)(o=u[f])&&(l=t.call(o,o.__data__,f,u))&&("__data__"in o&&(l.__data__=o.__data__),h[f]=l);return new q(n,this._parents)},selectAll:function(t){if("function"==typeof t){var r;r=t,t=function(){var t;return t=r.apply(this,arguments),null==t?[]:Array.isArray(t)?t:Array.from(t)}}else t=u(t);for(var i=this._groups,n=i.length,a=[],o=[],s=0;s<n;++s)for(var l,c=i[s],h=c.length,f=0;f<h;++f)(l=c[f])&&(a.push(t.call(l,l.__data__,f,c)),o.push(l));return new q(a,o)},selectChild:function(t){var r;return this.select(null==t?d:(r="function"==typeof t?t:h(t),function(){return f.call(this.children,r)}))},selectChildren:function(t){var r;return this.selectAll(null==t?m:(r="function"==typeof t?t:h(t),function(){return p.call(this.children,r)}))},filter:function(t){"function"!=typeof t&&(t=c(t));for(var r=this._groups,i=r.length,n=Array(i),a=0;a<i;++a)for(var o,s=r[a],l=s.length,u=n[a]=[],h=0;h<l;++h)(o=s[h])&&t.call(o,o.__data__,h,s)&&u.push(o);return new q(n,this._parents)},data:function(t,r){if(!arguments.length)return Array.from(this,b);var i=r?_:v,n=this._parents,a=this._groups;"function"!=typeof t&&(w=t,t=function(){return w});for(var o=a.length,s=Array(o),l=Array(o),u=Array(o),c=0;c<o;++c){var h=n[c],f=a[c],d=f.length,p="object"==typeof(x=t.call(h,h&&h.__data__,c,n))&&"length"in x?x:Array.from(x),m=p.length,g=l[c]=Array(m),y=s[c]=Array(m);i(h,f,g,y,u[c]=Array(d),p,r);for(var x,w,E,T,A=0,S=0;A<m;++A)if(E=g[A]){for(A>=S&&(S=A+1);!(T=y[S])&&++S<m;);E._next=T||null}}return(s=new q(s,n))._enter=l,s._exit=u,s},enter:function(){return new q(this._enter||this._groups.map(g),this._parents)},exit:function(){return new q(this._exit||this._groups.map(g),this._parents)},join:function(t,r,i){var n=this.enter(),a=this,o=this.exit();return"function"==typeof t?(n=t(n))&&(n=n.selection()):n=n.append(t+""),null!=r&&(a=r(a))&&(a=a.selection()),null==i?o.remove():i(o),n&&a?n.merge(a).order():a},merge:function(t){for(var r=t.selection?t.selection():t,i=this._groups,n=r._groups,a=i.length,o=n.length,s=Math.min(a,o),l=Array(a),u=0;u<s;++u)for(var c,h=i[u],f=n[u],d=h.length,p=l[u]=Array(d),m=0;m<d;++m)(c=h[m]||f[m])&&(p[m]=c);for(;u<a;++u)l[u]=i[u];return new q(l,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,r=-1,i=t.length;++r<i;)for(var n,a=t[r],o=a.length-1,s=a[o];--o>=0;)(n=a[o])&&(s&&4^n.compareDocumentPosition(s)&&s.parentNode.insertBefore(n,s),s=n);return this},sort:function(t){function r(r,i){return r&&i?t(r.__data__,i.__data__):!r-!i}t||(t=x);for(var i=this._groups,n=i.length,a=Array(n),o=0;o<n;++o){for(var s,l=i[o],u=l.length,c=a[o]=Array(u),h=0;h<u;++h)(s=l[h])&&(c[h]=s);c.sort(r)}return new q(a,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,r=0,i=t.length;r<i;++r)for(var n=t[r],a=0,o=n.length;a<o;++a){var s=n[a];if(s)return s}return null},size:function(){let t=0;for(let r of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var r=this._groups,i=0,n=r.length;i<n;++i)for(var a,o=r[i],s=0,l=o.length;s<l;++s)(a=o[s])&&t.call(a,a.__data__,s,o);return this},attr:function(t,r){var i=T(t);if(arguments.length<2){var n=this.node();return i.local?n.getAttributeNS(i.space,i.local):n.getAttribute(i)}return this.each((null==r?i.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof r?i.local?function(t,r){return function(){var i=r.apply(this,arguments);null==i?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,i)}}:function(t,r){return function(){var i=r.apply(this,arguments);null==i?this.removeAttribute(t):this.setAttribute(t,i)}}:i.local?function(t,r){return function(){this.setAttributeNS(t.space,t.local,r)}}:function(t,r){return function(){this.setAttribute(t,r)}})(i,r))},style:function(t,r,i){return arguments.length>1?this.each((null==r?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof r?function(t,r,i){return function(){var n=r.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,i)}}:function(t,r,i){return function(){this.style.setProperty(t,r,i)}})(t,r,null==i?"":i)):S(this.node(),t)},property:function(t,r){return arguments.length>1?this.each((null==r?function(t){return function(){delete this[t]}}:"function"==typeof r?function(t,r){return function(){var i=r.apply(this,arguments);null==i?delete this[t]:this[t]=i}}:function(t,r){return function(){this[t]=r}})(t,r)):this.node()[t]},classed:function(t,r){var i=C(t+"");
1if(arguments.length<2){for(var n=M(this.node()),a=-1,o=i.length;++a<o;)if(!n.contains(i[a]))return!1;return!0}return this.each(("function"==typeof r?function(t,r){return function(){(r.apply(this,arguments)?P:I)(this,t)}}:r?function(t){return function(){P(this,t)}}:function(t){return function(){I(this,t)}})(i,r))},text:function(t){return arguments.length?this.each(null==t?k:("function"==typeof t?function(t){return function(){var r=t.apply(this,arguments);this.textContent=null==r?"":r}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?O:("function"==typeof t?function(t){return function(){var r=t.apply(this,arguments);this.innerHTML=null==r?"":r}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(N)},lower:function(){return this.each(L)},append:function(t){var r="function"==typeof t?t:R(t);return this.select(function(){return this.appendChild(r.apply(this,arguments))})},insert:function(t,r){var i="function"==typeof t?t:R(t),n=null==r?F:"function"==typeof r?r:s(r);return this.select(function(){return this.insertBefore(i.apply(this,arguments),n.apply(this,arguments)||null)})},remove:function(){return this.each(B)},clone:function(t){return this.select(t?j:z)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,r,i){var n,a,o=(t+"").trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}}),s=o.length;if(arguments.length<2){var l=this.node().__on;if(l){for(var u,c=0,h=l.length;c<h;++c)for(n=0,u=l[c];n<s;++n)if((a=o[n]).type===u.type&&a.name===u.name)return u.value}return}for(l=r?V:U,n=0;n<s;++n)this.each(l(o[n],r,i));return this},dispatch:function(t,r){return this.each(("function"==typeof r?function(t,r){return function(){return $(this,t,r.apply(this,arguments))}}:function(t,r){return function(){return $(this,t,r)}})(t,r))},[Symbol.iterator]:function*(){for(var t=this._groups,r=0,i=t.length;r<i;++r)for(var n,a=t[r],o=0,s=a.length;o<s;++o)(n=a[o])&&(yield n)}},t.s(["select",0,function(t){return"string"==typeof t?new q([[document.querySelector(t)]],[document.documentElement]):new q([[t]],G)}],723685),t.s(["default",0,W,"extend",0,Z],611209);var X="\\s*([+-]?\\d+)\\s*",K="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Q="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",J=/^#([0-9a-f]{3,8})$/,ee=RegExp(`^rgb\\(${X},${X},${X}\\)$`),et=RegExp(`^rgb\\(${Q},${Q},${Q}\\)$`),er=RegExp(`^rgba\\(${X},${X},${X},${K}\\)$`),ei=RegExp(`^rgba\\(${Q},${Q},${Q},${K}\\)$`),en=RegExp(`^hsl\\(${K},${Q},${Q}\\)$`),ea=RegExp(`^hsla\\(${K},${Q},${Q},${K}\\)$`),eo={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function es(){return this.rgb().formatHex()}function el(){return this.rgb().formatRgb()}function eu(t){var r,i;return t=(t+"").trim().toLowerCase(),(r=J.exec(t))?(i=r[1].length,r=parseInt(r[1],16),6===i?ec(r):3===i?new ep(r>>8&15|r>>4&240,r>>4&15|240&r,(15&r)<<4|15&r,1):8===i?eh(r>>24&255,r>>16&255,r>>
18&255,(255&r)/255):4===i?eh(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|240&r,((15&r)<<4|15&r)/255):null):(r=ee.exec(t))?new ep(r[1],r[2],r[3],1):(r=et.exec(t))?new ep(255*r[1]/100,255*r[2]/100,255*r[3]/100,1):(r=er.exec(t))?eh(r[1],r[2],r[3],r[4]):(r=ei.exec(t))?eh(255*r[1]/100,255*r[2]/100,255*r[3]/100,r[4]):(r=en.exec(t))?eb(r[1],r[2]/100,r[3]/100,1):(r=ea.exec(t))?eb(r[1],r[2]/100,r[3]/100,r[4]):eo.hasOwnProperty(t)?ec(eo[t]):"transparent"===t?new ep(NaN,NaN,NaN,0):null}function ec(t){return new ep(t>>16&255,t>>8&255,255&t,1)}function eh(t,r,i,n){return n<=0&&(t=r=i=NaN),new ep(t,r,i,n)}function ef(t){return(t instanceof Y||(t=eu(t)),t)?new ep((t=t.rgb()).r,t.g,t.b,t.opacity):new ep}function ed(t,r,i,n){return 1==arguments.length?ef(t):new ep(t,r,i,null==n?1:n)}function ep(t,r,i,n){this.r=+t,this.g=+r,this.b=+i,this.opacity=+n}function em(){return`#${e_(this.r)}${e_(this.g)}${e_(this.b)}`}function eg(){let t=ey(this.opacity);return`${1===t?"rgb(":"rgba("}${ev(this.r)}, ${ev(this.g)}, ${ev(this.b)}${1===t?")":`, ${t})`}`}function ey(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ev(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function e_(t){return((t=ev(t))<16?"0":"")+t.toString(16)}function eb(t,r,i,n){return n<=0?t=r=i=NaN:i<=0||i>=1?t=r=NaN:r<=0&&(t=NaN),new eE(t,r,i,n)}function ex(t){if(t instanceof eE)return new eE(t.h,t.s,t.l,t.opacity);if(t instanceof Y||(t=eu(t)),!t)return new eE;if(t instanceof eE)return t;var r=(t=t.rgb()).r/255,i=t.g/255,n=t.b/255,a=Math.min(r,i,n),o=Math.max(r,i,n),s=NaN,l=o-a,u=(o+a)/2;return l?(s=r===o?(i-n)/l+(i<n)*6:i===o?(n-r)/l+2:(r-i)/l+4,l/=u<.5?o+a:2-o-a,s*=60):l=u>0&&u<1?0:s,new eE(s,l,u,t.opacity)}function ew(t,r,i,n){return 1==arguments.length?ex(t):new eE(t,r,i,null==n?1:n)}function eE(t,r,i,n){this.h=+t,this.s=+r,this.l=+i,this.opacity=+n}function eT(t){return(t=(t||0)%360)<0?t+360:t}function eA(t){return Math.max(0,Math.min(1,t||0))}function eS(t,r,i){return(t<60?r+(i-r)*t/60:t<180?i:t<240?r+(i-r)*(240-t)/60:r)*255}function eC(t,r,i,n,a){var o=t*t,s=o*t;return((1-3*t+3*o-s)*r+(4-6*o+3*s)*i+(1+3*t+3*o-3*s)*n+s*a)/6}W(Y,eu,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:es,formatHex:es,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ex(this).formatHsl()},formatRgb:el,toString:el}),W(ep,ed,Z(Y,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new ep(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new ep(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ep(ev(this.r),ev(this.g),ev(this.b),ey(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:em,formatHex:em,formatHex8:function(){return`#${e_(this.r)}${e_(this.g)}${e_(this.b)}${e_((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:eg,toString:eg})),W(eE,ew,Z(Y,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new eE(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new eE(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,r=isNaN(t)||isNaN(this.s)?0:this.s,i=this.l,n=i+(i<.5?i:1-i)*r,a=2*i-n;return new ep(eS(t>=240?t-240:t+120,a,n),eS(t,a,n),eS(t<120?t+240:t-120,a,n),this.opacity)},clamp(){return new eE(eT(this.h),eA(this.s),eA(this.l),ey(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=ey(this.opacity);return`${1===t?"hsl(":"hsla("}${eT(this.h)}, ${100*eA(this.s)}%, ${100*eA(this.l)}%${1===t?")":`, ${t})`}`}})),t.s(["Color",0,Y,"Rgb",0,ep,"brighter",0,1.4285714285714286,"darker",0,.7,"default",0,eu,"hsl",0,ew,"rgb",0,ed,"rgbConvert",0,ef],47238);let eM=t=>()=>t;function eD(t,r){return function(i){return t+i*r}}function eP(t){return 1==(t*=1)?eI:function(r,i){var n,a,o;return i-r?(n=r,a=i,n=Math.pow(n,o=t),a=Math.pow(a,o)-n,o=1/o,function(t){return Math.pow(n+t*a,o)}):eM(isNaN(r)?i:r)}
1}function eI(t,r){var i=r-t;return i?eD(t,i):eM(isNaN(t)?r:t)}t.s(["default",0,eI,"gamma",0,eP,"hue",0,function(t,r){var i=r-t;return i?eD(t,i>180||i<-180?i-360*Math.round(i/360):i):eM(isNaN(t)?r:t)}],825004);let ek=function t(r){var i=eP(r);function n(t,r){var n=i((t=ed(t)).r,(r=ed(r)).r),a=i(t.g,r.g),o=i(t.b,r.b),s=eI(t.opacity,r.opacity);return function(r){return t.r=n(r),t.g=a(r),t.b=o(r),t.opacity=s(r),t+""}}return n.gamma=t,n}(1);function eO(t){return function(r){var i,n,a=r.length,o=Array(a),s=Array(a),l=Array(a);for(i=0;i<a;++i)n=ed(r[i]),o[i]=n.r||0,s[i]=n.g||0,l[i]=n.b||0;return o=t(o),s=t(s),l=t(l),n.opacity=1,function(t){return n.r=o(t),n.g=s(t),n.b=l(t),n+""}}}var eN=eO(function(t){var r=t.length-1;return function(i){var n=i<=0?i=0:i>=1?(i=1,r-1):Math.floor(i*r),a=t[n],o=t[n+1],s=n>0?t[n-1]:2*a-o,l=n<r-1?t[n+2]:2*o-a;return eC((i-n/r)*r,s,a,o,l)}});function eL(t,r){return t*=1,r*=1,function(i){return t*(1-i)+r*i}}eO(function(t){var r=t.length;return function(i){var n=Math.floor(((i%=1)<0?++i:i)*r),a=t[(n+r-1)%r],o=t[n%r],s=t[(n+1)%r],l=t[(n+2)%r];return eC((i-n/r)*r,a,o,s,l)}}),t.s(["default",0,ek,"rgbBasis",0,eN],565445);var eR=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eF=RegExp(eR.source,"g");function eB(t,r){var i,n,a,o,s,l=eR.lastIndex=eF.lastIndex=0,u=-1,c=[],h=[];for(t+="",r+="";(a=eR.exec(t))&&(o=eF.exec(r));)(s=o.index)>l&&(s=r.slice(l,s),c[u]?c[u]+=s:c[++u]=s),(a=a[0])===(o=o[0])?c[u]?c[u]+=o:c[++u]=o:(c[++u]=null,h.push({i:u,x:eL(a,o)})),l=eF.lastIndex;return l<r.length&&(s=r.slice(l),c[u]?c[u]+=s:c[++u]=s),c.length<2?h[0]?(i=h[0].x,function(t){return i(t)+""}):(n=r,function(){return n}):(r=h.length,function(t){for(var i,n=0;n<r;++n)c[(i=h[n]).i]=i.x(t);return c.join("")})}function ez(t,r){var i,n,a=typeof r;return null==r||"boolean"===a?eM(r):("number"===a?eL:"string"===a?(n=eu(r))?(r=n,ek):eB:r instanceof eu?ek:r instanceof Date?function(t,r){var i=new Date;return t*=1,r*=1,function(n){return i.setTime(t*(1-n)+r*n),i}}:!ArrayBuffer.isView(i=r)||i instanceof DataView?Array.isArray(r)?function(t,r){var i,n=r?r.length:0,a=t?Math.min(n,t.length):0,o=Array(a),s=Array(n);for(i=0;i<a;++i)o[i]=ez(t[i],r[i]);for(;i<n;++i)s[i]=r[i];return function(t){for(i=0;i<a;++i)s[i]=o[i](t);return s}}:"function"!=typeof r.valueOf&&"function"!=typeof r.toString||isNaN(r)?function(t,r){var i,n={},a={};for(i in(null===t||"object"!=typeof t)&&(t={}),(null===r||"object"!=typeof r)&&(r={}),r)i in t?n[i]=ez(t[i],r[i]):a[i]=r[i];return function(t){for(i in n)a[i]=n[i](t);return a}}:eL:function(t,r){r||(r=[]);var i,n=t?Math.min(r.length,t.length):0,a=r.slice();return function(o){for(i=0;i<n;++i)a[i]=t[i]*(1-o)+r[i]*o;return a}})(t,r)}t.s(["interpolate",0,ez],944307),t.s(["pointer",0,function(t,r){if(t=function(t){let r;for(;r=t.sourceEvent;)t=r;return t}(t),void 0===r&&(r=t.currentTarget),r){var i=r.ownerSVGElement||r;if(i.createSVGPoint){var n=i.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,[(n=n.matrixTransform(r.getScreenCTM().inverse())).x,n.y]}if(r.getBoundingClientRect){var a=r.getBoundingClientRect();return[t.clientX-a.left-r.clientLeft,t.clientY-a.top-r.clientTop]}}return[t.pageX,t.pageY]}],100561);var ej,eU,eV=0,e$=0,eG=0,eq=0,eH=0,eW=0,eZ="object"==typeof performance&&performance.now?performance:Date,eY="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function eX(){return eH||(eY(eK),eH=eZ.now()+eW)}function eK(){eH=0}function eQ(){this._call=this._time=this._next=null}function eJ(t,r,i){var n=new eQ;return n.restart(t,r,i),n}function e0(){eH=(eq=eZ.now())+eW,eV=e$=0;try{eX(),++eV;for(var t,r=ej;r;)(t=eH-r._time)>=0&&r._call.call(void 0,t),r=r._next;--eV}finally{eV=0,function(){for(var t,r,i=ej,n=1/0;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(r=i._next,i._next=null,i=t?t._next=r:ej=r);eU=t,e2(n)}(),eH=0}}function e1(){var t=eZ.now(),r=t-eq;r>1e3&&(eW-=r,eq=t)}function e2(t){!eV&&(e$&&(e$=clearTimeout(e$)),t-eH>24?(t<1/0&&(e$=setTimeout(e0,t-eZ.now()-eW)),eG&&(eG=clearInterval(eG))):(eG||(eq=eZ.now(),eG=setInterval(e1,1e3)),eV=1,eY(e0)))}function e3(t,r,i){var n=new eQ;return r=null==r?0:+r,n.restart(i=>{n.stop(),t(i+r)},r,i),n}eQ.prototype=eJ.prototype={constructor:eQ,restart:function(t,r,i){if("function"!=typeof t)throw TypeError("callback is not a function");
1i=(null==i?eX():+i)+(null==r?0:+r),this._next||eU===this||(eU?eU._next=this:ej=this,eU=this),this._call=t,this._time=i,e2()},stop:function(){this._call&&(this._call=null,this._time=1/0,e2())}};var e4=i("start","end","cancel","interrupt"),e6=[];function e5(t,r,i,n,a,o){var s=t.__transition;if(s){if(i in s)return}else t.__transition={};!function(t,r,i){var n,a=t.__transition;function o(u){var c,h,f,d;if(1!==i.state)return l();for(c in a)if((d=a[c]).name===i.name){if(3===d.state)return e3(o);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete a[c]):+c<r&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete a[c])}if(e3(function(){3===i.state&&(i.state=4,i.timer.restart(s,i.delay,i.time),s(u))}),i.state=2,i.on.call("start",t,t.__data__,i.index,i.group),2===i.state){for(i.state=3,n=Array(f=i.tween.length),c=0,h=-1;c<f;++c)(d=i.tween[c].value.call(t,t.__data__,i.index,i.group))&&(n[++h]=d);n.length=h+1}}function s(r){for(var a=r<i.duration?i.ease.call(null,r/i.duration):(i.timer.restart(l),i.state=5,1),o=-1,s=n.length;++o<s;)n[o].call(t,a);5===i.state&&(i.on.call("end",t,t.__data__,i.index,i.group),l())}function l(){for(var n in i.state=6,i.timer.stop(),delete a[r],a)return;delete t.__transition}a[r]=i,i.timer=eJ(function(t){i.state=1,i.timer.restart(o,i.delay,i.time),i.delay<=t&&o(t-i.delay)},0,i.time)}(t,i,{name:r,index:n,group:a,on:e4,tween:e6,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function e8(t,r){var i=e9(t,r);if(i.state>0)throw Error("too late; already scheduled");return i}function e7(t,r){var i=e9(t,r);if(i.state>3)throw Error("too late; already running");return i}function e9(t,r){var i=t.__transition;if(!i||!(i=i[r]))throw Error("transition not found");return i}var te=180/Math.PI,tt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function tr(t,r,i,n,a,o){var s,l,u;return(s=Math.sqrt(t*t+r*r))&&(t/=s,r/=s),(u=t*i+r*n)&&(i-=t*u,n-=r*u),(l=Math.sqrt(i*i+n*n))&&(i/=l,n/=l,u/=l),t*n<r*i&&(t=-t,r=-r,u=-u,s=-s),{translateX:a,translateY:o,rotate:Math.atan2(r,t)*te,skewX:Math.atan(u)*te,scaleX:s,scaleY:l}}function ti(t,r,i,n){function a(t){return t.length?t.pop()+" ":""}return function(o,s){var l,u,c,h,f=[],d=[];return o=t(o),s=t(s),!function(t,n,a,o,s,l){if(t!==a||n!==o){var u=s.push("translate(",null,r,null,i);l.push({i:u-4,x:eL(t,a)},{i:u-2,x:eL(n,o)})}else(a||o)&&s.push("translate("+a+r+o+i)}(o.translateX,o.translateY,s.translateX,s.translateY,f,d),l=o.rotate,u=s.rotate,l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(a(f)+"rotate(",null,n)-2,x:eL(l,u)})):u&&f.push(a(f)+"rotate("+u+n),c=o.skewX,h=s.skewX,c!==h?d.push({i:f.push(a(f)+"skewX(",
1null,n)-2,x:eL(c,h)}):h&&f.push(a(f)+"skewX("+h+n),!function(t,r,i,n,o,s){if(t!==i||r!==n){var l=o.push(a(o)+"scale(",null,",",null,")");s.push({i:l-4,x:eL(t,i)},{i:l-2,x:eL(r,n)})}else(1!==i||1!==n)&&o.push(a(o)+"scale("+i+","+n+")")}(o.scaleX,o.scaleY,s.scaleX,s.scaleY,f,d),o=s=null,function(t){for(var r,i=-1,n=d.length;++i<n;)f[(r=d[i]).i]=r.x(t);return f.join("")}}}var tn=ti(function(t){let r=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return r.isIdentity?tt:tr(r.a,r.b,r.c,r.d,r.e,r.f)},"px, ","px)","deg)"),ta=ti(function(t){return null==t?tt:(i3||(i3=document.createElementNS("http://www.w3.org/2000/svg","g")),i3.setAttribute("transform",t),t=i3.transform.baseVal.consolidate())?tr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):tt},", ",")",")");function to(t,r,i){var n=t._id;return t.each(function(){var t=e7(this,n);(t.value||(t.value={}))[r]=i.apply(this,arguments)}),function(t){return e9(t,n).value[r]}}function ts(t,r){var i;return("number"==typeof r?eL:r instanceof eu?ek:(i=eu(r))?(r=i,ek):eB)(t,r)}t.s(["interpolateNumber",0,eL],552491),t.s(["interpolateRgb",0,ek],462573);var tl=H.prototype.constructor;function tu(t){return function(){this.style.removeProperty(t)}}var tc=0;function th(t,r,i,n){this._groups=t,this._parents=r,this._name=i,this._id=n}var tf=H.prototype;th.prototype=(function(t){return H().transition(t)}).prototype={constructor:th,select:function(t){var r=this._name,i=this._id;"function"!=typeof t&&(t=s(t));for(var n=this._groups,a=n.length,o=Array(a),l=0;l<a;++l)for(var u,c,h=n[l],f=h.length,d=o[l]=Array(f),p=0;p<f;++p)(u=h[p])&&(c=t.call(u,u.__data__,p,h))&&("__data__"in u&&(c.__data__=u.__data__),d[p]=c,e5(d[p],r,i,p,d,e9(u,i)));return new th(o,this._parents,r,i)},selectAll:function(t){var r=this._name,i=this._id;"function"!=typeof t&&(t=u(t));for(var n=this._groups,a=n.length,o=[],s=[],l=0;l<a;++l)for(var c,h=n[l],f=h.length,d=0;d<f;++d)if(c=h[d]){for(var p,m=t.call(c,c.__data__,d,h),g=e9(c,i),y=0,v=m.length;y<v;++y)(p=m[y])&&e5(p,r,i,y,m,g);o.push(m),s.push(c)}return new th(o,s,r,i)},selectChild:tf.selectChild,selectChildren:tf.selectChildren,filter:function(t){"function"!=typeof t&&(t=c(t));for(var r=this._groups,i=r.length,n=Array(i),a=0;a<i;++a)for(var o,s=r[a],l=s.length,u=n[a]=[],h=0;h<l;++h)(o=s[h])&&t.call(o,o.__data__,h,s)&&u.push(o);return new th(n,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw Error();for(var r=this._groups,i=t._groups,n=r.length,a=i.length,o=Math.min(n,a),s=Array(n),l=0;l<o;++l)for(var u,c=r[l],h=i[l],f=c.length,d=s[l]=Array(f),p=0;p<f;++p)(u=c[p]||h[p])&&(d[p]=u);for(;l<n;++l)s[l]=r[l];return new th(s,this._parents,this._name,this._id)},selection:function(){return new tl(this._groups,this._parents)},transition:function(){for(var t=this._name,r=this._id,i=++tc,n=this._groups,a=n.length,o=0;o<a;++o)for(var s,l=n[o],u=l.length,c=0;c<u;++c)if(s=l[c]){var h=e9(s,r);e5(s,t,i,c,l,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new th(n,this._parents,t,i)},call:tf.call,nodes:tf.nodes,node:tf.node,size:tf.size,empty:tf.empty,each:tf.each,on:function(t,r){var i,n,a,o,s,l,u=this._id;return arguments.length<2?e9(this.node(),u).on.on(t):this.each((i=u,n=t,a=r,l=(n+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>
1=0&&(t=t.slice(0,r)),!t||"start"===t})?e8:e7,function(){var t=l(this,i),r=t.on;r!==o&&(s=(o=r).copy()).on(n,a),t.on=s}))},attr:function(t,r){var i=T(t),n="transform"===i?ta:ts;return this.attrTween(t,"function"==typeof r?(i.local?function(t,r,i){var n,a,o;return function(){var s,l,u=i(this);return null==u?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local))===(l=u+"")?null:s===n&&l===a?o:(a=l,o=r(n=s,u))}}:function(t,r,i){var n,a,o;return function(){var s,l,u=i(this);return null==u?void this.removeAttribute(t):(s=this.getAttribute(t))===(l=u+"")?null:s===n&&l===a?o:(a=l,o=r(n=s,u))}})(i,n,to(this,"attr."+t,r)):null==r?(i.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(i):(i.local?function(t,r,i){var n,a,o=i+"";return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===n?a:a=r(n=s,i)}}:function(t,r,i){var n,a,o=i+"";return function(){var s=this.getAttribute(t);return s===o?null:s===n?a:a=r(n=s,i)}})(i,n,r))},attrTween:function(t,r){var i="attr."+t;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==r)return this.tween(i,null);if("function"!=typeof r)throw Error();var n=T(t);return this.tween(i,(n.local?function(t,r){var i,n;function a(){var a=r.apply(this,arguments);return a!==n&&(i=(n=a)&&function(r){this.setAttributeNS(t.space,t.local,a.call(this,r))}),i}return a._value=r,a}:function(t,r){var i,n;function a(){var a=r.apply(this,arguments);return a!==n&&(i=(n=a)&&function(r){this.setAttribute(t,a.call(this,r))}),i}return a._value=r,a})(n,r))},style:function(t,r,i){var n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A="transform"==(t+="")?tn:ts;return null==r?this.styleTween(t,(n=t,function(){var t=S(this,n),r=(this.style.removeProperty(n),S(this,n));return t===r?null:t===a&&r===o?s:s=A(a=t,o=r)})).on("end.style."+t,tu(t)):"function"==typeof r?this.styleTween(t,(l=t,u=to(this,"style."+t,r),function(){var t=S(this,l),r=u(this),i=r+"";return null==r&&(this.style.removeProperty(l),i=r=S(this,l)),t===i?null:t===c&&i===h?f:(h=i,f=A(c=t,r))})).each((d=this._id,b="end."+(_="style."+(p=t)),function(){var t=e7(this,d),r=t.on,i=null==t.value[_]?v||(v=tu(p)):void 0;(r!==m||y!==i)&&(g=(m=r).copy()).on(b,y=i),t.on=g})):this.styleTween(t,(x=t,T=r+"",function(){var t=S(this,x);return t===T?null:t===w?E:E=A(w=t,r)}),i).on("end.style."+t,null)},styleTween:function(t,r,i){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==r)return this.tween(n,null);if("function"!=typeof r)throw Error();return this.tween(n,function(t,r,i){var n,a;function o(){var o=r.apply(this,arguments);return o!==a&&(n=(a=o)&&function(r){this.style.setProperty(t,o.call(this,r),i)}),n}return o._value=r,o}(t,r,null==i?"":i))},text:function(t){var r,i;return this.tween("text","function"==typeof t?(r=to(this,"text",t),function(){var t=r(this);this.textContent=null==t?"":t}):(i=null==t?"":t+"",function(){this.textContent=i}))},textTween:function(t){var r="text";if(arguments.length<1)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw Error();return this.tween(r,function(t){var r,i;function n(){var n=t.apply(this,arguments);return n!==i&&(r=(i=n)&&function(t){this.textContent=n.call(this,t)}),r}return n._value=t,n}(t))},remove:function(){var t;return this.on("end.remove",(t=this._id,function(){var r=this.parentNode;for(var i in this.__transition)if(+i!==t)return;r&&r.removeChild(this)}))},tween:function(t,r){var i=this._id;if(t+="",arguments.length<2){for(var n,a=e9(this.node(),i).tween,o=0,s=a.length;o<s;++o)if((n=a[o]).name===t)return n.value;return null}return this.each((null==r?function(t,r){var i,n;return function(){var a=e7(this,t),o=a.tween;if(o!==i){n=i=o;for(var s=0,l=n.length;s<l;++s)if(n[s].name===r){(n=n.slice()).splice(s,1);break}}a.tween=n}}:function(t,r,i){var n,a;if("function"!=typeof i)throw Error();return function(){var o=e7(this,t),s=o.tween;if(s!==n){a=(n=s).slice();for(var l={name:r,value:i},u=0,c=a.length;u<c;++u)if(a[u].name===r){a[u]=l;break}u===c&&a.push(l)}o.tween=a}})(i,t,r))},delay:function(t){var r=this._id;return arguments.length?this.each(("function"==typeof t?function(t,r){return function(){e8(this,t).delay=+r.apply(this,arguments)}}:function(t,r){return r*=1,function(){e8(this,t).delay=r}})(r,t)):e9(this.node(),r).delay},duration:function(t){var r=this._id;return arguments.length?this.each(("function"==typeof t?function(t,r){return function(){e7(this,t).duration=+r.apply(this,arguments)}}:function(t,r){return r*=1,function(){e7(this,t).duration=r}})(r,t)):e9(this.node(),r).duration},ease:function(t){var r=this._id;return arguments.length?this.each(function(t,r){if("function"!=typeof r)throw Error();return function(){e7(this,t).ease=r}}(r,t)):e9(this.node(),r).ease},easeVarying:function(t){var r;if("function"!=typeof t)throw Error();return this.each((r=this._id,function(){var i=t.apply(this,arguments);if("function"!=typeof i)throw Error();e7(this,r).ease=i}))},end:function(){var t,r,i=this,n=i._id,a=i.size();return new Promise(function(o,s){var l={value:s},u={value:function(){0==--a&&o()}};i.each(function(){var i=e7(this,n),a=i.on;a!==t&&((r=(t=a).copy())._.cancel.push(l),r._.interrupt.push(l),r._.end.push(u)),i.on=r}),0===a&&o()})},[Symbol.iterator]:tf[Symbol.iterator]};var td={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};H.prototype.interrupt=function(t){return this.each(function(){!function(t,r){var i,n,a,o=t.__transition,s=!0;if(o){for(a in r=null==r?null:r+"",o){if((i=o[a]).name!==r){s=!1;continue}n=i.state>2&&i.state<5,i.state=6,i.timer.stop(),i.on.call(n?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete o[a]}s&&delete t.__transition}}(this,t)})},H.prototype.transition=function(t){var r,i;t instanceof th?(r=t._id,t=t._name):(r=++tc,(i=td).time=eX(),t=null==t?null:t+"");for(var n=this._groups,a=n.length,o=0;o<a;++o)for(var s,l=n[o],u=l.length,c=0;c<u;++c)(s=l[c])&&e5(s,t,r,c,l,i||function(t,r){for(var i;!(i=t.__transition)||!(i=i[r]);)if(!(t=t.parentNode))throw Error(`transition ${r} not found`);return i}(s,r));return new th(n,this._parents,t,r)};let{abs:tp,max:tm,min:tg}=Math;function ty(t){return{type:t}}function tv(t){return((t=Math.exp(t))+1/t)/2}function t_(t,r,i){this.k=t,this.x=r,this.y=i}["w","e"].map(ty),["n","s"].map(ty),["n","w","e","s","nw","ne","sw","se"].map(ty),!function t(r,i,n){function a(t,a){var o,s,l=t[0],u=t[1],c=t[2],h=a[0],f=a[1],d=a[2],p=h-l,m=f-u,g=p*p+m*m;if(g<1e-12)s=Math.log(d/c)/r,o=function(t){return[l+t*p,u+t*m,c*Math.exp(r*t*s)]};else{var y=Math.sqrt(g),v=(d*d-c*c+n*g)/(2*c*i*y),_=(d*d-c*c-n*g)/(2*d*i*y),b=Math.log(Math.sqrt(v*v+1)-v);s=(Math.log(Math.sqrt(_*_+1)-_)-b)/r,o=function(t){var n,a,o=t*s,h=tv(b),f=c/(i*y)*(h*(((n=Math.exp(2*(n=r*o+b)))-1)/(n+1))-((a=Math.exp(a=b))-1/a)/2);return[l+f*p,u+f*m,c*h/tv(r*o+b)]}}return o.duration=1e3*s*r/Math.SQRT2,o}return a.rho=function(r){var i=Math.max(.001,+r),n=i*i;return t(i,n,n*n)},a}(Math.SQRT2,2,4),t_.prototype={constructor:t_,scale:function(t){return 1===t?this:new t_(this.k*t,this.x,this.y)},translate:function(t,r){return 0===t&0===r?this:new t_(this.k,this.x+this.k*t,this.y+this.k*r)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};new t_(1,0,0);t_.prototype,t.s([],947716);let tb=Math.sqrt(50),tx=Math.sqrt(10),tw=Math.sqrt(2);function tE(t,r,i){let n,a,o,s=(r-t)/Math.max(0,i),l=Math.floor(Math.log10(s)),u=s/Math.pow(10,l),c=u>=tb?10:u>=tx?5:u>=tw?2:1;return(l<0?(n=Math.round(t*(o=Math.pow(10,-l)/c)),a=Math.round(r*o),n/o<t&&++n,a/o>r&&--a,o=-o):(n=Math.round(t/(o=Math.pow(10,l)*c)),a=Math.round(r/o),n*o<t&&++n,a*o>r&&--a),a<n&&.5<=i&&i<2)?tE(t,r,2*i):[n,a,o]}function tT(t,r,i){if(r*=1,t*=1,!((i*=1)>0))return[];if(t===r)return[t];let n=r<t,[a,o,s]=n?tE(r,t,i):tE(t,r,i);if(!(o>=a))return[];let l=o-a+1,u=Array(l);if(n)if(s<0)for(let t=0;t<l;++t)u[t]=-((o-t)/s);else for(let t=0;t<l;++t)u[t]=(o-t)*s;else if(s<0)for(let t=0;t<l;++t)u[t]=-((a+t)/s);else for(let t=0;t<l;++t)u[t]=(a+t)*s;return u}function tA(t,r,i){return tE(t*=1,r*=1,i*=1)[2]}function tS(t,r,i){r*=1,t*=1,i*=1;let n=r<t,a=n?tA(r,t,i):tA(t,r,i);return(n?-1:1)*(a<0?-(1/a):a)}function tC(t,r){return null==t||null==r?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function tM(t,r){return null==t||null==r?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function tD(t){let r,i,n;function a(t,n,o=0,s=t.length){if(o<s){if(0!==r(n,n))return s;do{let r=o+s>>>1;0>i(t[r],n)?o=r+1:s=r}while(o<s)}return o}return 2!==t.length?(r=tC,i=(r,i)=>tC(t(r),i),n=(r,i)=>t(r)-i):(r=t===tC||t===tM?t:tP,i=t,n=t),{left:a,center:function(t,r,i=0,o=t.length){let s=a(t,r,i,o-1);return s>i&&n(t[s-1],r)>-n(t[s],r)?s-1:s},right:function(t,n,a=0,o=t.length){if(a<o){if(0!==r(n,n))return o;do{let r=a+o>>>1;0>=i(t[r],n)?a=r+1:o=r}while(a<o)}return a}}}function tP(){return 0}function tI(t){return null===t?NaN:+t}t.s(["default",0,tT,"tickIncrement",0,tA,"tickStep",0,tS],428322),t.s(["ticks",0,tT],327975),t.s(["default",0,tC],594479),t.s(["default",0,tM],332389),t.s(["default",0,tD],17877),t.s(["default",0,tI,"numbers",0,function*(t,r){if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(yield r);else{let i=-1;for(let n of t)null!=(n=r(n,++i,t))&&(n*=1)>=n&&(yield n)}}],83662);let tk=tD(tC),tO=tk.right;function tN(t,r){return t*=1,r*=1,function(i){return Math.round(t*(1-i)+r*i)}}function tL(t){return+t}tk.left,tD(tI).center,t.s(["default",0,tO],547285),t.s(["bisect",0,tO],672895),t.s(["interpolateRound",0,tN],185654),t.s(["default",0,tL],997155);var tR=[0,1];function tF(t){return t}function tB(t,r){var i;return(r-=t*=1)?function(i){return(i-t)/r}:(i=isNaN(r)?NaN:.5,function(){return i})}function tz(t,r,i){var n=t[0],a=t[1],o=r[0],s=r[1];return a<n?(n=tB(a,n),o=i(s,o)):(n=tB(n,a),o=i(o,s)),function(t){return o(n(t))}}function tj(t,r,i){var n=Math.min(t.length,r.length)-1,a=Array(n),o=Array(n),s=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),r=r.slice().reverse());++s<n;)a[s]=tB(t[s],t[s+1]),o[s]=i(r[s],r[s+1]);return function(r){var i=tO(t,r,1,n)-1;return o[i](a[i](r))}}function tU(t,r){return r.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function tV(){var t,r,i,n,a,o,s=tR,l=tR,u=ez,c=tF;function h(){var t,r,i,u=Math.min(s.length,l.length);return c!==tF&&(t=s[0],r=s[u-1],t>r&&(i=t,t=r,r=i),c=function(i){return Math.max(t,Math.min(r,i))}),n=u>2?tj:tz,a=o=null,f}function f(r){return null==r||isNaN(r*=1)?i:(a||(a=n(s.map(t),l,u)))(t(c(r)))}return f.invert=function(i){return c(r((o||(o=n(l,s.map(t),eL)))(i)))},f.domain=function(t){return arguments.length?(s=Array.from(t,tL),h()):s.slice()},f.range=function(t){return arguments.length?(l=Array.from(t),h()):l.slice()},f.rangeRound=function(t){return l=Array.from(t),u=tN,h()},f.clamp=function(t){return arguments.length?(c=!!t||tF,h()):c!==tF},f.interpolate=function(t){return arguments.length?(u=t,h()):u},f.unknown=function(t){return arguments.length?(i=t,f):i},function(i,n){return t=i,r=n,h()}}function t$(){return tV()(tF,tF)}function tG(t,r){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(r).domain(t)}return this}function tq(t,r){if(!isFinite(t)||0===t)return null;var i=(t=r?t.toExponential(r-1):t.toExponential()).indexOf("e"),n=t.slice(0,i);return[n.length>1?n[0]+n.slice(2):n,+t.slice(i+1)]}function tH(t){return(t=tq(Math.abs(t)))?t[1]:NaN}t.s(["copy",0,tU,"default",0,t$,"identity",0,tF,"transformer",0,tV],659086),t.s(["initInterpolator",0,function(t,r){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof r?this.interpolator(r):this.range(r)}return this},"initRange",0,tG],365332);var tW=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function tZ(t){var r;if(!(r=tW.exec(t)))throw Error("invalid format: "+t);return new tY({fill:r[1],align:r[2],sign:r[3],symbol:r[4],zero:r[5],width:r[6],comma:r[7],precision:r[8]&&r[8].slice(1),trim:r[9],type:r[10]})}function tY(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.
1width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function tX(t,r){var i=tq(t,r);if(!i)return t+"";var n=i[0],a=i[1];return a<0?"0."+Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+Array(a-n.length+2).join("0")}tZ.prototype=tY.prototype,tY.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let tK={"%":(t,r)=>(100*t).toFixed(r),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,r)=>t.toExponential(r),f:(t,r)=>t.toFixed(r),g:(t,r)=>t.toPrecision(r),o:t=>Math.round(t).toString(8),p:(t,r)=>tX(100*t,r),r:tX,s:function(t,r){var i=tq(t,r);if(!i)return i4=void 0,t.toPrecision(r);var n=i[0],a=i[1],o=a-(i4=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,s=n.length;return o===s?n:o>s?n+Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+Array(1-o).join("0")+tq(t,Math.max(0,r+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function tQ(t){return t}var tJ=Array.prototype.map,t0=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function t1(t,r,i,n){var a,o,s=tS(t,r,i);switch((n=tZ(null==n?",f":n)).type){case"s":var l=Math.max(Math.abs(t),Math.abs(r));return null!=n.precision||isNaN(o=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(tH(l)/3)))-tH(Math.abs(s))))||(n.precision=o),i8(n,l);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(o=Math.max(0,tH(Math.abs(Math.max(Math.abs(t),Math.abs(r)))-(a=Math.abs(a=s)))-tH(a))+1)||(n.precision=o-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(o=Math.max(0,-tH(Math.abs(s))))||(n.precision=o-("%"===n.type)*2)}return i5(n)}function t2(t){var r=t.domain;return t.ticks=function(t){var i=r();return tT(i[0],i[i.length-1],null==t?10:t)},t.tickFormat=function(t,i){var n=r();return t1(n[0],n[n.length-1],null==t?10:t,i)},t.nice=function(i){null==i&&(i=10);var n,a,o=r(),s=0,l=o.length-1,u=o[s],c=o[l],h=10;for(c<u&&(a=u,u=c,c=a,a=s,s=l,l=a);h-- >0;){if((a=tA(u,c,i))===n)return o[s]=u,o[l]=c,r(o);if(a>0)u=Math.floor(u/a)*a,c=Math.ceil(c/a)*a;else if(a<0)u=Math.ceil(u*a)/a,c=Math.floor(c*a)/a;else break;n=a}return t},t}function t3(){var t=t$();return t.copy=function(){return tU(t,t3())},tG.apply(t,arguments),t2(t)}i5=(i6=function(t){var r,i,n,a=void 0===t.grouping||void 0===t.thousands?tQ:(r=tJ.call(t.grouping,Number),i=t.thousands+"",function(t,n){for(var a=t.length,o=[],s=0,l=r[0],u=0;a>0&&l>0&&(u+l+1>n&&(l=Math.max(1,n-u)),o.push(t.substring(a-=l,a+l)),!((u+=l+1)>n));)l=r[s=(s+1)%r.length];return o.reverse().join(i)}),o=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",l=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?tQ:(n=tJ.call(t.numerals,String),function(t){return t.replace(/[0-9]/g,function(t){return n[+t]})}),c=void 0===t.percent?"%":t.percent+"",h=void 0===t.minus?"â":t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function d(t,r){var i=(t=tZ(t)).fill,n=t.align,d=t.sign,p=t.symbol,m=t.zero,g=t.width,y=t.comma,v=t.precision,_=t.trim,b=t.type;"n"===b?(y=!0,b="g"):tK[b]||(void 0===v&&(v=12),_=!0,b="g"),(m||"0"===i&&"="===n)&&(m=!0,i="0",n="=");var x=(r&&void 0!==r.prefix?r.prefix:"")+("$"===p?o:"#"===p&&/[boxX]/.test(b)?"0"+b.toLowerCase():""),w=("$"===p?s:/[%p]/.test(b)?c:"")+(r&&void 0!==r.suffix?r.suffix:""),E=tK[b],T=/[defgprs%]/.test(b);function A(t){var r,o,s,c=x,p=w;if("c"===b)p=E(t)+p,t="";else{var A=(t*=1)<0||1/t<0;if(t=isNaN(t)?f:E(Math.abs(t),v),_&&(t=function(t){e:for(var r,i=t.length,n=1,a=-1;n<i;++n)switch(t[n]){case".":a=r=n;break;case"0":0===a&&(a=n),r=n;break;default:if(!+t[n])break e;a>0&&(a=0)}return a>0?t.slice(0,a)+t.slice(r+1):t}(t)),A&&0==+t&&"+"!==d&&(A=!1),c=(A?"("===d?d:h:"-"===d||"("===d?"":d)+c,p=("s"!==b||isNaN(t)||void 0===i4?"":t0[8+i4/3])+p+(A&&"("===d?")":""),T){for(r=-1,o=t.length;++r<o;)if(48>(s=t.charCodeAt(r))||s>57){p=(46===s?l+t.slice(r+1):t.slice(r))+p,t=t.slice(0,r);break}}}y&&!m&&(t=a(t,1/0));var S=c.length+t.length+p.length,C=S<g?Array(g-S+1).join(i):"";switch(y&&m&&(t=a(C+t,C.length?g-p.length:1/0),C=""),n){case"<":t=c+t+p+C;break;case"=":t=c+C+t+p;break;case"^":t=C.slice(0,S=C.length>>1)+c+t+p+C.slice(S);break;default:t=C+c+t+p}return u(t)}return v=void 0===v?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),A.toString=function(){return t+""},A}return{format:d,formatPrefix:function(t,r){var i=3*Math.max(-8,Math.min(8,Math.floor(tH(r)/3))),n=Math.pow(10,-i),a=d(((t=tZ(t)).type="f",t),{suffix:t0[8+i/3]});return function(t){return a(n*t)}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,i8=i6.formatPrefix,t.s(["format",()=>i5,"formatPrefix",()=>i8],64912),t.s(["formatSpecifier",0,tZ],34855),t.s(["default",0,t1],579892),t.s(["default",0,t3,"linearish",0,t2],971351),t.s(["scaleLinear",0,t3],282803);let t4=Math.PI/180,t6=180/Math.PI;t.s(["degrees",0,t6,"radians",0,t4],26915);let t5=4/29,t8=6/29,t7=6/29*3*(6/29),t9=6/29*(6/29)*(6/29);function re(t){if(t instanceof rr)return new rr(t.l,t.a,t.b,t.opacity);if(t instanceof rl)return ru(t);t instanceof ep||(t=ef(t));var r,i,n=ro(t.r),a=ro(t.g),o=ro(t.b),s=ri((.2225045*n+.7168786*a+.0606169*o)/1);return n===a&&a===o?r=i=s:(r=ri((.4360747*n+.3850649*a+.1430804*o)/.96422),i=ri((.0139322*n+.0971045*a+.7141733*o)/.82521)),new rr(116*s-16,500*(r-s),200*(s-i),t.opacity)}function rt(t,r,i,n){return 1==arguments.length?re(t):new rr(t,r,i,null==n?1:n)}function rr(t,r,i,n){this.l=+t,this.a=+r,this.b=+i,this.opacity=+n}function ri(t){return t>t9?Math.pow(t,1/3):t/t7+t5}function rn(t){return t>t8?t*t*t:t7*(t-t5)}
1function ra(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ro(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function rs(t,r,i,n){return 1==arguments.length?function(t){if(t instanceof rl)return new rl(t.h,t.c,t.l,t.opacity);if(t instanceof rr||(t=re(t)),0===t.a&&0===t.b)return new rl(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var r=Math.atan2(t.b,t.a)*t6;return new rl(r<0?r+360:r,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new rl(t,r,i,null==n?1:n)}function rl(t,r,i,n){this.h=+t,this.c=+r,this.l=+i,this.opacity=+n}function ru(t){if(isNaN(t.h))return new rr(t.l,0,0,t.opacity);var r=t.h*t4;return new rr(t.l,Math.cos(r)*t.c,Math.sin(r)*t.c,t.opacity)}function rc(){var t,r=[.5],i=[0,1],n=1;function a(a){return null!=a&&a<=a?i[tO(r,a,0,n)]:t}return a.domain=function(t){return arguments.length?(n=Math.min((r=Array.from(t)).length,i.length-1),a):r.slice()},a.range=function(t){return arguments.length?(i=Array.from(t),n=Math.min(r.length,i.length-1),a):i.slice()},a.invertExtent=function(t){var n=i.indexOf(t);return[r[n-1],r[n]]},a.unknown=function(r){return arguments.length?(t=r,a):t},a.copy=function(){return rc().domain(r).range(i).unknown(t)},tG.apply(a,arguments)}function rh(){return(rh=Object.assign.bind()).apply(null,arguments)}W(rr,rt,Z(Y,{brighter(t){return new rr(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new rr(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,r=isNaN(this.a)?t:t+this.a/500,i=isNaN(this.b)?t:t-this.b/200;return r=.96422*rn(r),new ep(ra(3.1338561*r-1.6168667*(t=+rn(t))-.4906146*(i=.82521*rn(i))),ra(-.9787684*r+1.9161415*t+.033454*i),ra(.0719453*r-.2289914*t+1.4052427*i),this.opacity)}})),W(rl,rs,Z(Y,{brighter(t){return new rl(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new rl(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return ru(this).rgb()}})),t.s(["default",0,rt,"hcl",0,rs],164441),t.s(["lab",0,rt],132628),t.s(["default",0,rc],833766),t.s(["scaleThreshold",0,rc],969571),t.s(["default",()=>rh],931067);var rf=t.i(768108);function rd(t,r,i,n){if(!(this instanceof rd))throw SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=r,this.min=i,this.max=n,this.message="Wrong number of arguments in function "+t+" ("+r+" provided, "+i+(null!=n?"-"+n:"")+" expected)",this.stack=Error().stack}function rp(t,r,i){if(!(this instanceof rp))throw SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=r,this.relation=i,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=Error().stack}function rm(t,r,i){if(!(this instanceof rm))throw SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=r):(this.min=r,this.max=i),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function rg(t,r){if(rv(t,r)||r_(t,r))return t[r];if(rb(t,r))throw Error('Cannot access method "'.concat(r,'" as a property'));if(null==t)throw TypeError('Cannot access property "'.concat(r,'": object is ').concat(t));throw Error('No access to property "'+r+'"')}function ry(t,r,i){if(rv(t,r)||r_(t,r))return t[r]=i,i;throw Error('No access to property "'.concat(r,'"'))}function rv(t,r){var i;return!!("object"==typeof(i=t)&&i&&i.constructor===Object)&&!(r in Object.prototype)}function r_(t,r){var i;return!!Array.isArray(t)&&("number"==typeof r||"string"==typeof r&&(i=r,/^\d+$/.test(i))||"length"===r)}function rb(t,r){return!(null==t||"function"!=typeof t[r]||im(t,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(t))&&(!!rx.has(r)||!(r in Object.prototype)&&!(r in Function.prototype))}rd.prototype=Error(),rd.prototype.constructor=Error,rd.prototype.name="ArgumentsError",rd.prototype.isArgumentsError=!0,rp.prototype=RangeError(),rp.prototype.constructor=RangeError,rp.prototype.name="DimensionError",rp.prototype.isDimensionError=!0,rm.prototype=RangeError(),rm.prototype.constructor=RangeError,rm.prototype.name="IndexError",rm.prototype.isIndexError=!0;
1var rx=new Set(["toString","valueOf","toLocaleString"]);class rw{constructor(t){this.wrappedObject=t,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(t=>this.has(t)).values()}get(t){return rg(this.wrappedObject,t)}set(t,r){return ry(this.wrappedObject,t,r),this}has(t){return rv(this.wrappedObject,t)&&t in this.wrappedObject}entries(){return rT(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var r of this.keys())t(this.get(r),r,this)}delete(t){rv(this.wrappedObject,t)&&delete this.wrappedObject[t]}clear(){for(var t of this.keys())this.delete(t)}get size(){return Object.keys(this.wrappedObject).length}}class rE{constructor(t,r,i){this.a=t,this.b=r,this.bKeys=i,this[Symbol.iterator]=this.entries}get(t){return this.bKeys.has(t)?this.b.get(t):this.a.get(t)}set(t,r){return this.bKeys.has(t)?this.b.set(t,r):this.a.set(t,r),this}has(t){return this.b.has(t)||this.a.has(t)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return rT(this.keys(),t=>[t,this.get(t)])}forEach(t){for(var r of this.keys())t(this.get(r),r,this)}delete(t){return this.bKeys.has(t)?this.b.delete(t):this.a.delete(t)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function rT(t,r){return{next:()=>{var i=t.next();return i.done?i:{value:r(i.value),done:!1}}}}function rA(){return new Map}function rS(t){if(!t)return rA();if(rZ(t))return t;if(rW(t))return new rw(t);throw Error("createMap can create maps from objects or Maps")}function rC(t){return"number"==typeof t}function rM(t){return!!t&&"object"==typeof t&&"function"==typeof t.constructor&&(!0===t.isBigNumber&&"object"==typeof t.constructor.prototype&&!0===t.constructor.prototype.isBigNumber||"function"==typeof t.constructor.isDecimal&&!0===t.constructor.isDecimal(t))}function rD(t){return"bigint"==typeof t}function rP(t){return t&&"object"==typeof t&&!0===Object.getPrototypeOf(t).isComplex||!1}function rI(t){return t&&"object"==typeof t&&!0===Object.getPrototypeOf(t).isFraction||!1}function rk(t){return t&&!0===t.constructor.prototype.isUnit||!1}function rO(t){return"string"==typeof t}var rN=Array.isArray;function rL(t){return t&&!0===t.constructor.prototype.isMatrix||!1}function rR(t){return Array.isArray(t)||rL(t)}function rF(t){return t&&t.isDenseMatrix&&!0===t.constructor.prototype.isMatrix||!1}function rB(t){return t&&t.isSparseMatrix&&!0===t.constructor.prototype.isMatrix||!1}function rz(t){return t&&!0===t.constructor.prototype.isRange||!1}function rj(t){return t&&!0===t.constructor.prototype.isIndex||!1}function rU(t){return"boolean"==typeof t}function rV(t){return t&&!0===t.constructor.prototype.isResultSet||!1}function r$(t){return t&&!0===t.constructor.prototype.isHelp||!1}function rG(t){return"function"==typeof t}function rq(t){return t instanceof Date}function rH(t){return t instanceof RegExp}function rW(t){return!!(t&&"object"==typeof t&&t.constructor===Object&&!rP(t)&&!rI(t))}function rZ(t){return!!t&&(t instanceof Map||t instanceof rw||"function"==typeof t.set&&"function"==typeof t.get&&"function"==typeof t.keys&&"function"==typeof t.has)}function rY(t){return rZ(t)&&rZ(t.a)&&rZ(t.b)}function rX(t){return rZ(t)&&rW(t.wrappedObject)}function rK(t){return null===t}function rQ(t){return void 0===t}function rJ(t){return t&&!0===t.isAccessorNode&&!0===t.constructor.prototype.isNode||!1}function r0(t){return t&&!0===t.isArrayNode&&!0===t.constructor.prototype.isNode||!1}function r1(t){return t&&!0===t.isAssignmentNode&&!0===t.constructor.prototype.isNode||!1}function r2(t){return t&&!0===t.isBlockNode&&!0===t.constructor.prototype.isNode||!1}function r3(t){return t&&!0===t.isConditionalNode&&!0===t.constructor.prototype.isNode||!1}function r4(t){return t&&!0===t.isConstantNode&&!0===t.constructor.prototype.isNode||!1}function r6(t){return r4(t)||ir(t)&&1===t.args.length&&r4(t.args[0])&&"-+~".includes(t.op)}function r5(t){return t&&!0===t.isFunctionAssignmentNode&&!0===t.constructor.prototype.isNode||!1}function r8(t){return t&&!0===t.isFunctionNode&&!0===t.constructor.prototype.isNode||!1}function r7(t){return t&&!0===t.isIndexNode&&!0===t.constructor.prototype.isNode||!1}function r9(t){return t&&!0===t.isNode&&!0===t.constructor.prototype.isNode||!1}function ie(t){return t&&!0===t.isObjectNode&&!0===t.constructor.prototype.isNode||!1}function ir(t){return t&&!0===t.isOperatorNode&&!0===t.constructor.prototype.isNode||!1}function ii(t){return t&&!0===t.isParenthesisNode&&!0===t.constructor.prototype.isNode||!1}function ia(t){return t&&!0===t.isRangeNode&&!0===t.constructor.prototype.isNode||!1}function io(t){return t&&!0===t.isRelationalNode&&!0===t.constructor.prototype.isNode||!1}function is(t){return t&&!0===t.isSymbolNode&&!0===t.constructor.prototype.isNode||!1}function il(t){return t&&!0===t.constructor.prototype.isChain||!1}function iu(t){var r=typeof t;return"object"===r?null===t?"null":rM(t)?"BigNumber":t.constructor&&t.constructor.name?t.constructor.name:"Object":r}function ic(t){var r=typeof t;
1if("number"===r||"bigint"===r||"string"===r||"boolean"===r||null==t)return t;if("function"==typeof t.clone)return t.clone();if(Array.isArray(t))return t.map(function(t){return ic(t)});if(t instanceof Date)return new Date(t.valueOf());if(rM(t))return t;if(rW(t)){var i=t,n=ic,a={};for(var o in i)im(i,o)&&(a[o]=n(i[o]));return a}if("function"===r)return t;throw TypeError("Cannot clone: unknown type of value (value: ".concat(t,")"))}function ih(t,r){for(var i in r)im(r,i)&&(t[i]=r[i]);return t}function id(t,r){var i,n,a;if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(n=0,a=t.length;n<a;n++)if(!id(t[n],r[n]))return!1;return!0}if("function"==typeof t)return t===r;if(!(t instanceof Object))return t===r;if(Array.isArray(r)||!(r instanceof Object))return!1;for(i in t)if(!(i in r)||!id(t[i],r[i]))return!1;for(i in r)if(!(i in t))return!1;return!0}function ip(t,r,i){var n,a=!0;Object.defineProperty(t,r,{get:function(){return a&&(n=i(),a=!1),n},set:function(t){n=t,a=!1},configurable:!0,enumerable:!0})}function im(t,r){return t&&Object.hasOwnProperty.call(t,r)}function ig(t,r,i,n){function a(n){var a=function(t,r){for(var i={},n=0;n<r.length;n++){var a=r[n],o=t[a];void 0!==o&&(i[a]=o)}return i}(n,r.map(iv));return function(t,r,i){if(!r.filter(t=>{var r;return!((r=t)&&"?"===r[0])}).every(t=>void 0!==i[t])){var n=r.filter(t=>void 0===i[t]);throw Error('Cannot create function "'.concat(t,'", ')+"some dependencies are missing: ".concat(n.map(t=>'"'.concat(t,'"')).join(", "),"."))}}(t,r,n),i(a)}return a.isFactory=!0,a.fn=t,a.dependencies=r.slice().sort(),n&&(a.meta=n),a}function iy(t){return"function"==typeof t&&"string"==typeof t.fn&&Array.isArray(t.dependencies)}function iv(t){return t&&"?"===t[0]?t.slice(1):t}var i_=t.i(865834),ib={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null,legacySubset:!1};t.s(["DEFAULT_CONFIG",0,ib],240814);var ix=["Matrix","Array"],iw=["number","BigNumber","bigint","Fraction"];function iE(t,r){function i(n){if(!n)return ic(t);if(void 0!==n.epsilon){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');var a=ic(n);return a.relTol=n.epsilon,a.absTol=.001*n.epsilon,delete a.epsilon,i(a)}!0===n.legacySubset&&console.warn('Warning: The configuration option "legacySubset" is for compatibility only and might be deprecated
1in the future.');var o=ic(t);iT(n,"matrix",ix),iT(n,"number",iw),function t(r,i){if(Array.isArray(i))throw TypeError("Arrays are not supported by deepExtend");for(var n in i)if(im(i,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(i[n]&&i[n].constructor===Object)void 0===r[n]&&(r[n]={}),r[n]&&r[n].constructor===Object?t(r[n],i[n]):r[n]=i[n];else if(Array.isArray(i[n]))throw TypeError("Arrays are not supported by deepExtend");else r[n]=i[n];return r}(t,n);var s=ic(t);return r("config",s,o,ic(n)),s}return i.MATRIX_OPTIONS=ix,i.NUMBER_OPTIONS=iw,Object.keys(ib).forEach(r=>{Object.defineProperty(i,r,{get:()=>t[r],enumerable:!0,configurable:!0})}),i}function iT(t,r,i){void 0===t[r]||i.includes(t[r])||console.warn('Warning: Unknown value "'+t[r]+'" for configuration option "'+r+'". Available options: '+i.map(t=>JSON.stringify(t)).join(", ")+".")}function iA(t,r){var i,n,a,o=rh({},ib,r);if("function"!=typeof Object.create)throw Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var s=((i={isNumber:rC,isComplex:rP,isBigNumber:rM,isBigInt:rD,isFraction:rI,isUnit:rk,isString:rO,isArray:rN,isMatrix:rL,isCollection:rR,isDenseMatrix:rF,isSparseMatrix:rB,isRange:rz,isIndex:rj,isBoolean:rU,isResultSet:rV,isHelp:r$,isFunction:rG,isDate:rq,isRegExp:rH,isObject:rW,isMap:rZ,isPartitionedMap:rY,isObjectWrappingMap:rX,isNull:rK,isUndefined:rQ,isAccessorNode:rJ,isArrayNode:r0,isAssignmentNode:r1,isBlockNode:r2,isConditionalNode:r3,isConstantNode:r4,isFunctionAssignmentNode:r5,isFunctionNode:r8,isIndexNode:r7,isNode:r9,isObjectNode:ie,isOperatorNode:ir,isParenthesisNode:ii,isRangeNode:ia,isRelationalNode:io,isSymbolNode:is,isChain:il}).on=(n=new i_.default).on.bind(n),i.off=n.off.bind(n),i.once=n.once.bind(n),i.emit=n.emit.bind(n),i);s.config=iE(o,s.emit),s.expression={transform:{},mathWithTransform:{config:s.config}};var l={};function u(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return s.typed.apply(s.typed,r)}u.isTypedFunction=rf.default.isTypedFunction;var c=function(t,r,i){function n(t,i){i&&"function"==typeof i.transform?(r.expression.transform[t]=i.transform,im(s,t)||(r.expression.mathWithTransform[t]=i.transform)):(delete r.expression.transform[t],im(s,t)||(r.expression.mathWithTransform[t]=i))}function a(t){delete r.expression.transform[t],im(s,t)?delete r.expression.mathWithTransform[t]:r.expression.mathWithTransform[t]=r[t]}function o(t){return void 0!==t&&void 0!==t.meta&&!0===t.meta.isTransformFunction}var s={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(l,u){var c=arguments.length;if(1!==c&&2!==c)throw new rd("import",c,1,2);u||(u={});var h={};for(var f in!function t(r,i,n){if(Array.isArray(i))i.forEach(i=>t(r,i));else{var a;if(rW(i)||"object"==typeof(a=i)&&"Module"===a[Symbol.toStringTag])for(var s in i)im(i,s)&&t(r,i[s],s);else if(iy(i)||void 0!==n){var l=iy(i)?o(i)?i.fn+".transform":i.fn:n;if(im(r,l)&&r[l]!==i&&!u.silent)throw Error('Cannot import "'+l+'" twice');r[l]=i}else if(!u.silent)throw TypeError("Factory, Object, or Array expected")}}(h,l),h)if(im(h,f)){var d,p=h[f];if(iy(p))!function(n,l){var u,c,h,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.fn;if(f.includes("."))throw Error("Factory name should not contain a nested path. Name: "+JSON.stringify(f));var d=o(n)?r.expression.transform:r,p=f in r.expression.transform,m=im(d,f)?d[f]:void 0,g=function(){var i={};n.dependencies.map(iv).forEach(t=>{if(t.includes("."))throw Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(t));"math"===t?i.math=r:"mathWithTransform"===t?i.mathWithTransform=r.expression.mathWithTransform:"classes"===t?i.classes=r:i[t]=r[t]});var a=n(i);if(a&&"function"==typeof a.transform)throw Error('Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"');if(void 0===m||l.override)return a;
1if(t.isTypedFunction(m)&&t.isTypedFunction(a))return t(m,a);if(l.silent)return m;throw Error('Cannot import "'+f+'": already exists')},y=null!=(c=null==(h=n.meta)?void 0:h.formerly)?c:"",v=o(n)||!(u=n).fn.includes(".")&&!im(s,u.fn)&&(!u.meta||!u.meta.isClass),_=r.expression.mathWithTransform;n.meta&&!1===n.meta.lazy?(d[f]=g(),y&&(d[y]=d[f]),m&&p?(a(f),y&&a(y)):v&&(ip(_,f,()=>d[f]),y&&ip(_,y,()=>d[f]))):(ip(d,f,g),y&&ip(d,y,g),m&&p?(a(f),y&&a(y)):v&&(ip(_,f,()=>d[f]),y&&ip(_,y,()=>d[f]))),i[f]=n,r.emit("import",f,g)}(p,u);else{if("function"==typeof(d=p)||"number"==typeof d||"string"==typeof d||"boolean"==typeof d||null===d||rk(d)||rP(d)||rM(d)||rI(d)||rL(d)||Array.isArray(d))!function(a,o,s){if(s.wrap&&"function"==typeof o&&(o=function(t){var i=function(){for(var i=[],n=0,a=arguments.length;n<a;n++){var o=arguments[n];i[n]=o&&o.valueOf()}return t.apply(r,i)};return t.transform&&(i.transform=t.transform),i}(o)),"function"==typeof(l=o)&&"string"==typeof l.signature&&(o=t(a,{[o.signature]:o})),t.isTypedFunction(r[a])&&t.isTypedFunction(o)){o=s.override?t(a,o.signatures):t(r[a],o),r[a]=o,delete i[a],n(a,o),r.emit("import",a,function(){return o});return}var l,u,c=void 0!==r[a],h=null==(u=r.Unit)?void 0:u.isValuelessUnit(a);if(!c&&!h||s.override){r[a]=o,delete i[a],n(a,o),r.emit("import",a,function(){return o});return}if(!s.silent)throw Error('Cannot import "'+a+'": already exists')}(f,p,u);else if(!u.silent)throw TypeError("Factory, Object, or Array expected")}}}}(u,s,l);return s.import=c,s.on("config",()=>{Object.values(l).forEach(t=>{t&&t.meta&&t.meta.recreateOnConfigChange&&c(t,{override:!0})})}),s.create=iA.bind(null,t),s.factory=ig,s.import(Object.values((function t(r,i){for(var n in r)if(im(r,n)){var a=r[n];"object"==typeof a&&null!==a?t(a,i):i[n]=a}}(t,a={}),a))),s.ArgumentsError=rd,s.DimensionError=rp,s.IndexError=rm,s}function iS(t){return"boolean"==typeof t||!!Number.isFinite(t)&&t===Math.round(t)}function iC(t,r){if("bigint"===r.number)try{BigInt(t)}catch(t){return r.numberFallback}return r.number}t.s(["MATRIX_OPTIONS",0,ix,"NUMBER_OPTIONS",0,iw,"configFactory",0,iE],120197),t.s([],101511),t.i(101511);var iM=Math.sign||function(t){return t>0?1:t<0?-1:0},iD=Math.log2||function(t){return Math.log(t)/Math.LN2},iP=Math.log10||function(t){return Math.log(t)/Math.LN10},iI=Math.log1p||function(t){return Math.log(t+1)},ik=Math.cbrt||function(t){if(0===t)return t;var r,i=t<0;return i&&(t=-t),Number.isFinite(t)?(r=Math.exp(Math.log(t)/3),r=(t/(r*r)+2*r)/3):r=t,i?-r:r},iO=Math.expm1||function(t){return t>=2e-4||t<=-2e-4?Math.exp(t)-1:t+t*t/2+t*t*t/6};function iN(t,r,i){var n="";if(i){if(i<1)throw Error("size must be in greater than 0");if(!iS(i))throw Error("size must be an integer");if(t>2**(i-1)-1||t<-(2**(i-1)))throw Error("Value must be in range [-2^".concat(i-1,", 2^").concat(i-1,"-1]"));if(!iS(t))throw Error("Value must be an integer");t<0&&(t+=2**i),n="i".concat(i)}var a="";return t<0&&(t=-t,a="-"),"".concat(a).concat({2:"0b",8:"0o",16:"0x"}[r]).concat(t.toString(r)).concat(n)}function iL(t,r){if("function"==typeof r)return r(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var{notation:i,precision:n,wordSize:a}=iR(r);switch(i){case"fixed":return iB(t,n);case"exponential":return iz(t,n);case"engineering":return function(t,r){if(isNaN(t)||!Number.isFinite(t))return String(t);var i=ij(iF(t),r),n=i.exponent,a=i.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(rC(r))for(;r>a.length||n-o+1>a.length;)a.push(0);else for(var s=Math.abs(n-o)-(a.length-1),l=0;l<s;l++)a.push(0);for(var u=Math.abs(n-o),c=1;u>0;)c++,u--;var h=a.slice(c).join(""),f=rC(r)&&h.length||h.match(/[1-9]/)?"."+h:"",d=a.slice(0,c).join("")+f+"e"+(n>=0?"+":"")+o.toString();return i.sign+d}(t,n);case"bin":return iN(t,2,a);case"oct":return iN(t,8,a);case"hex":return iN(t,16,a);case"auto":return(function(t,r,i){if(isNaN(t)||!Number.isFinite(t))return String(t);var n=iX(null==i?void 0:i.lowerExp,-3),a=iX(null==i?void 0:i.upperExp,5),o=iF(t),s=r?ij(o,r):o;if(s.exponent<n||s.exponent>=a)return iz(t,r);var l=s.coefficients,u=s.exponent;l.length<r&&(l=l.concat(iU(r-l.length))),l=l.concat(iU(u-l.length+1+(l.length<r?r-l.length:0))),l=iU(-u).concat(l);var c=u>0?u:0;return c<l.length-1&&l.splice(c+1,0,"."),s.sign+l.join("")})(t,n,r).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],r=arguments[4];return"."!==t?t+r:r});default:throw Error('Unknown notation "'+i+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function iR(t){var r,i,n="auto";if(void 0!==t)if(rC(t))r=t;else if(rM(t))r=t.toNumber();else if(rW(t))void 0!==t.precision&&(r=iY(t.precision,()=>{throw Error('Option "precision" must be a number or BigNumber')})),void 0!==t.wordSize&&(i=iY(t.wordSize,()=>{throw Error('Option "wordSize" must be a number or BigNumber')})),t.notation&&(n=t.notation);else throw Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:n,precision:r,wordSize:i}}function iF(t){var r=String(t).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!r)throw SyntaxError("Invalid number "+t);var i=r[1],n=r[2],a=parseFloat(r[4]||"0"),o=n.indexOf(".");a+=-1!==o?o-1:n.length-1;var s=n.replace(".","").replace(/^0*/,function(t){return a-=t.length,""}).replace(/0*$/,"").split("").map(function(t){return parseInt(t)});return 0===s.length&&(s.push(0),a++),{sign:i,coefficients:s,exponent:a}}function iB(t,r){if(isNaN(t)||!Number.isFinite(t))return String(t);var i=iF(t),n="number"==typeof r?ij(i,i.exponent+1+r):i,a=n.coefficients,o=n.exponent+1,s=o+(r||0);return a.length<s&&(a=a.concat(iU(s-a.length))),o<0&&(a=iU(-o+1).concat(a),o=1),o<a.length&&a.splice(o,0,0===o?"0.":"."),n.sign+a.join("")}function iz(t,r){if(isNaN(t)||!Number.isFinite(Number(t)))return String(t);var i=iF(t),n=r?ij(i,r):i,a=n.coefficients,o=n.exponent;a.length<r&&(a=a.concat(iU(r-a.length)));var s=a.shift();return n.sign+s+(a.length>0?"."+a.join(""):"")+"e"+(o>=0?"+":"")+o}function ij(t,r){for(var i={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},n=i.coefficients;r<=0;)n.unshift(0),i.exponent++,r++;if(n.length>r&&n.splice(r,n.length-r)[0]>=5){var a=r-1;for(n[a]++;10===n[a];)n.pop(),0===a&&(n.unshift(0),i.exponent++,a++),a--,n[a]++}return i}function iU(t){for(var r=[],i=0;i<t;i++)r.push(0);return r}function iV(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-8,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;
1if(i<=0)throw Error("Relative tolerance must be greater than 0");if(n<0)throw Error("Absolute tolerance must be at least 0");return!(isNaN(t)||isNaN(r))&&(Number.isFinite(t)&&Number.isFinite(r)?t===r||Math.abs(t-r)<=Math.max(i*Math.max(Math.abs(t),Math.abs(r)),n):t===r)}var i$=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)},iG=Math.asinh||function(t){return Math.log(Math.sqrt(t*t+1)+t)},iq=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2},iH=Math.cosh||function(t){return(Math.exp(t)+Math.exp(-t))/2},iW=Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))/2},iZ=Math.tanh||function(t){var r=Math.exp(2*t);return(r-1)/(r+1)};function iY(t,r){return rC(t)?t:rM(t)?t.toNumber():void r()}function iX(t,r){return rC(t)?t:rM(t)?t.toNumber():r}var iK=function(){return iK=rf.default.create,rf.default},iQ=ig("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(t){var{BigNumber:r,Complex:i,DenseMatrix:n,Fraction:a}=t,o=iK();return o.clear(),o.addTypes([{name:"number",test:rC},{name:"Complex",test:rP},{name:"BigNumber",test:rM},{name:"bigint",test:rD},{name:"Fraction",test:rI},{name:"Unit",test:rk},{name:"identifier",test:t=>rO&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFB
1D3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u
10EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD40-\uDD59\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC7\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDB0-\uDDDB\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE4
10-\uDE7F\uDEA0-\uDEB8\uDEBB-\uDED3\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF2\uDFF3]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDEC0-\uDEDE\uDEE0-\uDEE2\uDEE4\uDEE5\uDEE7-\uDEED\uDEF0-\uDEF4\uDEFE\uDEFF\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79])*$/.test(t)},{name:"string",test:rO},{name:"Chain",test:il},{name:"Array",test:rN},{name:"Matrix",test:rL},{name:"DenseMatrix",test:rF},{name:"SparseMatrix",test:rB},{name:"Range",test:rz},{name:"Index",test:rj},{name:"boolean",test:rU},{name:"ResultSet",test:rV},{name:"Help",test:r$},{name:"function",test:rG},{name:"Date",test:rq},{name:"RegExp",test:rH},{name:"null",test:rK},{name:"undefined",test:rQ}
1,{name:"AccessorNode",test:rJ},{name:"ArrayNode",test:r0},{name:"AssignmentNode",test:r1},{name:"BlockNode",test:r2},{name:"ConditionalNode",test:r3},{name:"ConstantNode",test:r4},{name:"FunctionNode",test:r8},{name:"FunctionAssignmentNode",test:r5},{name:"IndexNode",test:r7},{name:"Node",test:r9},{name:"ObjectNode",test:ie},{name:"OperatorNode",test:ir},{name:"ParenthesisNode",test:ii},{name:"RangeNode",test:ia},{name:"RelationalNode",test:io},{name:"SymbolNode",test:is},{name:"Map",test:rZ},{name:"Object",test:rW}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(t){if(r||iJ(t),t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+t+"). Use function bignumber(x) to convert to BigNumber.");return new r(t)}},{from:"number",to:"Complex",convert:function(t){return i||i0(t),new i(t,0)}},{from:"BigNumber",to:"Complex",convert:function(t){return i||i0(t),new i(t.toNumber(),0)}},{from:"bigint",to:"number",convert:function(t){if(t>Number.MAX_SAFE_INTEGER)throw TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+t+")");return Number(t)}},{from:"bigint",to:"BigNumber",convert:function(t){return r||iJ(t),new r(t.toString())}},{from:"bigint",to:"Fraction",convert:function(t){return a||i1(t),new a(t)}},{from:"Fraction",to:"BigNumber",convert:function(t){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(t){return i||i0(t),new i(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){a||i1(t);var r=new a(t);if(r.valueOf()!==t)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+t+"). Use function fraction(x) to convert to Fraction.");return r}},{from:"string",to:"number",convert:function(t){var r=Number(t);if(isNaN(r))throw Error('Cannot convert "'+t+'" to a number');return r}},{from:"string",to:"BigNumber",convert:function(t){r||iJ(t);try{return new r(t)}catch(r){throw Error('Cannot convert "'+t+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(t){try{return BigInt(t)}catch(r){throw Error('Cannot convert "'+t+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(t){a||i1(t);try{return new a(t)}catch(r){throw Error('Cannot convert "'+t+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(t){i||i0(t);try{return new i(t)}catch(r){throw Error('Cannot convert "'+t+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(t){return r||iJ(t),new r(+t)}},{from:"boolean",to:"bigint",convert:function(t){return BigInt(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return a||i1(t),new a(+t)}},{from:"boolean",to:"string",convert:function(t){return String(t)}},{from:"Array",to:"Matrix",convert:function(t){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(t)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}]),o.onMismatch=(t,r,i)=>{var n=o.createError(t,r,i);if(["wrongType","mismatch"].includes(n.data.category)&&1===r.length&&rR(r[0])&&i.some(t=>!t.params.includes(","))){var a=TypeError("Function '".concat(t,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(t,")'."));throw a.data=n.data,a}throw n},o.onMismatch=(t,r,i)=>{var n=o.createError(t,r,i);if(["wrongType","mismatch"].includes(n.data.category)&&1===r.length&&rR(r[0])&&i.some(t=>!t.params.includes(","))){var a=TypeError("Function '".concat(t,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(t,")'."));throw a.data=n.data,a}throw n},o});function iJ(t){throw Error("Cannot convert value ".concat(t," into a BigNumber: no class 'BigNumber' provided"))}function i0(t){throw Error("Cannot convert value ".concat(t," into a Complex number: no class 'Complex' provided"))}function i1(t){throw Error("Cannot convert value ".concat(t," into a Fraction, no class 'Fraction' provided."))}t.s(["createTyped",0,iQ],558935);var i2=ig("ResultSet",[],()=>{function t(r){if(!(this instanceof t))throw SyntaxError("Constructor must be called with the new operator");this.entries=r||[]}return t.prototype.type="ResultSet",t.prototype.isResultSet=!0,t.prototype.valueOf=function(){return this.entries},t.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},t.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},t.fromJSON=function(r){return new t(r.entries)},t},{isClass:!0});t.s(["createResultSet",0,i2],292373);var i3,i4,i6,i5,i8,i7,i9,ne="0123456789abcdef",nt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",nr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823
1066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ni={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},nn=!0,na="[DecimalError] ",no=na+"Invalid argument: ",ns=na+"Precision limit exceeded",nl=na+"crypto unavailable",nu="[object Decimal]",nc=Math.floor,nh=Math.pow,nf=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,nd=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,np=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,nm=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ng=nt.length-1,ny=nr.length-1,nv={toStringTag:nu};function n_(t){var r,i,n,a=t.length-1,o="",s=t[0];if(a>0){for(o+=s,r=1;r<a;r++)(i=7-(n=t[r]+"").length)&&(o+=nP(i)),o+=n;(i=7-(n=(s=t[r])+"").length)&&(o+=nP(i))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}function nb(t,r,i){if(t!==~~t||t<r||t>i)throw Error(no+t)}function nx(t,r,i,n){var a,o,s,l;for(o=t[0];o>=10;o/=10)--r;return--r<0?(r+=7,a=0):(a=Math.ceil((r+1)/7),r%=7),o=nh(10,7-r),l=t[a]%o|0,null==n?r<3?(0==r?l=l/100|0:1==r&&(l=l/10|0),s=i<4&&99999==l||i>3&&49999==l||5e4==l||0==l):s=(i<4&&l+1==o||i>3&&l+1==o/2)&&(t[a+1]/o/100|0)==nh(10,r-2)-1||(l==o/2||0==l)&&(t[a+1]/o/100|0)==0:r<4?(0==r?l=l/1e3|0:1==r?l=l/100|0:2==r&&(l=l/10|0),s=(n||i<4)&&9999==l||!n&&i>3&&4999==l):s=((n||i<4)&&l+1==o||!n&&i>3&&l+1==o/2)&&(t[a+1]/o/1e3|0)==nh(10,r-3)-1,s}function nw(t,r,i){for(var n,a,o=[0],s=0,l=t.length;s<l;){for(a=o.length;a--;)o[a]*=r;for(o[0]+=ne.indexOf(t.charAt(s++)),n=0;n<o.length;n++)o[n]>i-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/i|0,o[n]%=i)}return o.reverse()}nv.absoluteValue=nv.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),nT(t)},nv.ceil=function(){return nT(new this.constructor(this),this.e+1,2)},nv.clampedTo=nv.clamp=function(t,r){var i=this.constructor;if(t=new i(t),r=new i(r),!t.s||!r.s)return new i(NaN);if(t.gt(r))throw Error(no+r);return 0>this.cmp(t)?t:this.cmp(r)>0?r:new i(this)},nv.comparedTo=nv.cmp=function(t){var r,i,n,a,o=this.d,s=(t=new this.constructor(t)).d,l=this.s,u=t.s;if(!o||!s)return l&&u?l!==u?l:o===s?0:!o^l<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?l:s[0]?-u:0;if(l!==u)return l;if(this.e!==t.e)return this.e>t.e^l<0?1:-1;for(n=o.length,r=0,i=n<(a=s.length)?n:a;r<i;++r)if(o[r]!==s[r])return o[r]>s[r]^l<0?1:-1;return n===a?0:n>a^l<0?1:-1},nv.cosine=nv.cos=function(){var t,r,i=this,n=i.constructor;return i.d?i.d[0]?(t=n.precision,r=n.rounding,n.precision=t+Math.max(i.e,i.sd())+7,n.rounding=1,i=function(t,r){var i,n,a;if(r.isZero())return r;(n=r.d.length)<32?a=(1/nz(4,i=Math.ceil(n/3))).toString():(i=16,a="2.3283064365386962890625e-10"),t.precision+=i,r=nB(t,1,r.times(a),new t(1));for(var o=i;o--;){var s=r.times(r);r=s.times(s).minus(s).times(8).plus(1)}return t.precision-=i,r}(n,nj(n,i)),n.precision=t,n.rounding=r,nT(2==i9||3==i9?i.neg():i,t,r,!0)):new n(1):new n(NaN)},nv.cubeRoot=nv.cbrt=function(){var t,r,i,n,a,o,s,l,u,c,h=this.constructor;if(!this.isFinite()||this.isZero())return new h(this);for(nn=!1,(o=this.s*nh(this.s*this,1/3))&&Math.abs(o)!=1/0?n=new h(o.toString()):(i=n_(this.d),(o=((t=this.e)-i.length+1)%3)&&(i+=1==o||-2==o?"0":"00"),o=nh(i,1/3),t=nc((t+1)/3)-(t%3==(t<0?-1:2)),(n=new h(i=o==1/0?"5e"+t:(i=o.toExponential()).slice(0,i.indexOf("e")+1)+t)).s=this.s),s=(t=h.precision)+3;;)if(n=nE((c=(u=(l=n).times(l).times(l)).plus(this)).plus(this).times(l),c.plus(u),s+2,1),n_(l.d).slice(0,s)===(i=n_(n.d)).slice(0,s)){if("9999"!=(i=i.slice(s-3,s+1))&&(a||"4999"!=i)){+i&&(+i.slice(1)||"5"!=i.charAt(0))||(nT(n,t+1,1),r=!n.times(n).times(n).eq(this));break}if(!a&&(nT(l,t+1,0),l.times(l).times(l).eq(this))){n=l;break}s+=4,a=1}return nn=!0,nT(n,t,h.rounding,r)},nv.decimalPlaces=nv.dp=function(){var t,r=this.d,i=NaN;if(r){if(i=((t=r.length-1)-nc(this.e/7))*7,t=r[t])for(;t%10==0;t/=10)i--;i<0&&(i=0)}return i},nv.dividedBy=nv.div=function(t){return nE(this,new this.constructor(t))},nv.dividedToIntegerBy=nv.divToInt=function(t){var r=this.constructor;return nT(nE(this,new r(t),0,1,1),r.precision,r.rounding)},nv.equals=nv.eq=function(t){return 0===this.cmp(t)},nv.floor=function(){return nT(new this.constructor(this),this.e+1,3)},nv.greaterThan=nv.gt=function(t){return this.cmp(t)>0},nv.greaterThanOrEqualTo=nv.gte=function(t){var r=this.cmp(t);return 1==r||0===r},nv.hyperbolicCosine=nv.cosh=function(){var t,r,i,n,a,o=this,s=o.constructor,l=ne
1w s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return l;i=s.precision,n=s.rounding,s.precision=i+Math.max(o.e,o.sd())+4,s.rounding=1,(a=o.d.length)<32?r=(1/nz(4,t=Math.ceil(a/3))).toString():(t=16,r="2.3283064365386962890625e-10"),o=nB(s,1,o.times(r),new s(1),!0);for(var u,c=t,h=new s(8);c--;)u=o.times(o),o=l.minus(u.times(h.minus(u.times(h))));return nT(o,s.precision=i,s.rounding=n,!0)},nv.hyperbolicSine=nv.sinh=function(){var t,r,i,n,a=this,o=a.constructor;if(!a.isFinite()||a.isZero())return new o(a);if(r=o.precision,i=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(n=a.d.length)<3)a=nB(o,2,a,a,!0);else{t=(t=1.4*Math.sqrt(n))>16?16:0|t,a=nB(o,2,a=a.times(1/nz(5,t)),a,!0);for(var s,l=new o(5),u=new o(16),c=new o(20);t--;)s=a.times(a),a=a.times(l.plus(s.times(u.times(s).plus(c))))}return o.precision=r,o.rounding=i,nT(a,r,i,!0)},nv.hyperbolicTangent=nv.tanh=function(){var t,r,i=this.constructor;return this.isFinite()?this.isZero()?new i(this):(t=i.precision,r=i.rounding,i.precision=t+7,i.rounding=1,nE(this.sinh(),this.cosh(),i.precision=t,i.rounding=r)):new i(this.s)},nv.inverseCosine=nv.acos=function(){var t=this,r=t.constructor,i=t.abs().cmp(1),n=r.precision,a=r.rounding;return -1!==i?0===i?t.isNeg()?nM(r,n,a):new r(0):new r(NaN):t.isZero()?nM(r,n+4,a).times(.5):(r.precision=n+6,r.rounding=1,t=new r(1).minus(t).div(t.plus(1)).sqrt().atan(),r.precision=n,r.rounding=a,t.times(2))},nv.inverseHyperbolicCosine=nv.acosh=function(){var t,r,i=this,n=i.constructor;return i.lte(1)?new n(i.eq(1)?0:NaN):i.isFinite()?(t=n.precision,r=n.rounding,n.precision=t+Math.max(Math.abs(i.e),i.sd())+4,n.rounding=1,nn=!1,i=i.times(i).minus(1).sqrt().plus(i),nn=!0,n.precision=t,n.rounding=r,i.ln()):new n(i)},nv.inverseHyperbolicSine=nv.asinh=function(){var t,r,i=this,n=i.constructor;return!i.isFinite()||i.isZero()?new n(i):(t=n.precision,r=n.rounding,n.precision=t+2*Math.max(Math.abs(i.e),i.sd())+6,n.rounding=1,nn=!1,i=i.times(i).plus(1).sqrt().plus(i),nn=!0,n.precision=t,n.rounding=r,i.ln())},nv.inverseHyperbolicTangent=nv.atanh=function(){var t,r,i,n,a=this,o=a.constructor;return a.isFinite()?a.e>=0?new o(a.abs().eq(1)?a.s/0:a.isZero()?a:NaN):(t=o.precision,r=o.rounding,Math.max(n=a.sd(),t)<-(2*a.e)-1)?nT(new o(a),t,r,!0):(o.precision=i=n-a.e,a=nE(a.plus(1),new o(1).minus(a),i+t,1),o.precision=t+4,o.rounding=1,a=a.ln(),o.precision=t,o.rounding=r,a.times(.5)):new o(NaN)},nv.inverseSine=nv.asin=function(){var t,r,i,n,a=this,o=a.constructor;return a.isZero()?new o(a):(r=a.abs().cmp(1),i=o.precision,n=o.rounding,-1!==r)?0===r?((t=nM(o,i+4,n).times(.5)).s=a.s,t):new o(NaN):(o.precision=i+6,o.rounding=1,a=a.div(new o(1).minus(a.times(a)).sqrt().plus(1)).atan(),o.precision=i,o.rounding=n,a.times(2))},nv.inverseTangent=nv.atan=function(){var t,r,i,n,a,o,s,l,u,c=this,h=c.constructor,f=h.precision,d=h.rounding;if(c.isFinite()){if(c.isZero())return new h(c);else if(c.abs().eq(1)&&f+4<=ny)return(s=nM(h,f+4,d).times(.25)).s=c.s,s}else{if(!c.s)return new h(NaN);if(f+4<=ny)return(s=nM(h,f+4,d).times(.5)).s=c.s,s}for(h.precision=l=f+10,h.rounding=1,t=i=Math.min(28,l/7+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(nn=!1,r=Math.ceil(l/7),n=1,u=c.times(c),s=new h(c),a=c;-1!==t;)if(a=a.times(u),o=s.minus(a.div(n+=2)),a=a.times(u),void 0!==(s=o.plus(a.div(n+=2))).d[r])for(t=r;s.d[t]===o.d[t]&&t--;);return i&&(s=s.times(2<<i-1)),nn=!0,nT(s,h.precision=f,h.rounding=d,!0)},nv.isFinite=function(){return!!this.d},nv.isInteger=nv.isInt=function(){return!!this.d&&nc(this.e/7)>this.d.length-2},nv.isNaN=function(){return!this.s},nv.isNegative=nv.isNeg=function(){return this.s<0},nv.isPositive=nv.isPos=function(){return this.s>0},nv.isZero=function(){return!!this.d&&0===this.d[0]},nv.lessThan=nv.lt=function(t){return 0>this.cmp(t)},nv.lessThanOrEqualTo=nv.lte=function(t){return 1>this.cmp(t)},nv.logarithm=nv.log=function(t){var r,i,n,a,o,s,l,u=this.constructor,c=u.precision,h=u.rounding;if(null==t)t=new u(10),r=!0;else{if(i=(t=new u(t)).d,t.s<0||!i||!i[0]||t.eq(1))return new u(NaN);r=t.eq(10)}if(i=this.d,this.s<0||!i||!i[0]||this.eq(1))return new u(i&&!i[0]?-1/0:1!=this.s?NaN:i?0:1/0);if(r)if(i.length>1)a=!0;else{for(n=i[0];n%10==0;)n/=10;a=1!==n}if(nn=!1,nx((l=nE(o=nL(this,s=c+5),r?nC(u,s+10):nL(t,s),s,1)).d,n=c,h))do if(s+=10,l=nE(o=nL(this,s),r?nC(u,s+10):nL(t,s),s,1),!a){+n_(l.d).slice(n+1,n+15)+1==1e14&&(l=nT(l,c+1,0));break}while(nx(l.d,n+=10,h))return nn=!0,nT(l,c,h)},nv.minus=nv.sub=function(t){var r,i,n,a,o,s,l,u,c,h,f,d,p=this.constructor;if(t=new p(t),!this.d||!t.d)return this.s&&t.s?this.d?t.s=-t.s:t=new p(t.d||this.s!==t.s?this:NaN):t=new p(NaN),t;if(this.s!=t.s)return t.s=-t.s,this.plus(t);
1if(c=this.d,d=t.d,l=p.precision,u=p.rounding,!c[0]||!d[0]){if(d[0])t.s=-t.s;else{if(!c[0])return new p(3===u?-0:0);t=new p(this)}return nn?nT(t,l,u):t}if(i=nc(t.e/7),h=nc(this.e/7),c=c.slice(),o=h-i){for((f=o<0)?(r=c,o=-o,s=d.length):(r=d,i=h,s=c.length),o>(n=Math.max(Math.ceil(l/7),s)+2)&&(o=n,r.length=1),r.reverse(),n=o;n--;)r.push(0);r.reverse()}else{for((f=(n=c.length)<(s=d.length))&&(s=n),n=0;n<s;n++)if(c[n]!=d[n]){f=c[n]<d[n];break}o=0}for(f&&(r=c,c=d,d=r,t.s=-t.s),s=c.length,n=d.length-s;n>0;--n)c[s++]=0;for(n=d.length;n>o;){if(c[--n]<d[n]){for(a=n;a&&0===c[--a];)c[a]=1e7-1;--c[a],c[n]+=1e7}c[n]-=d[n]}for(;0===c[--s];)c.pop();for(;0===c[0];c.shift())--i;return c[0]?(t.d=c,t.e=nS(c,i),nn?nT(t,l,u):t):new p(3===u?-0:0)},nv.modulo=nv.mod=function(t){var r,i=this.constructor;return(t=new i(t),this.d&&t.s&&(!t.d||t.d[0]))?t.d&&(!this.d||this.d[0])?(nn=!1,9==i.modulo?(r=nE(this,t.abs(),0,3,1),r.s*=t.s):r=nE(this,t,0,i.modulo,1),r=r.times(t),nn=!0,this.minus(r)):nT(new i(this),i.precision,i.rounding):new i(NaN)},nv.naturalExponential=nv.exp=function(){return nN(this)},nv.naturalLogarithm=nv.ln=function(){return nL(this)},nv.negated=nv.neg=function(){var t=new this.constructor(this);return t.s=-t.s,nT(t)},nv.plus=nv.add=function(t){var r,i,n,a,o,s,l,u,c,h,f=this.constructor;if(t=new f(t),!this.d||!t.d)return this.s&&t.s?this.d||(t=new f(t.d||this.s===t.s?this:NaN)):t=new f(NaN),t;if(this.s!=t.s)return t.s=-t.s,this.minus(t);if(c=this.d,h=t.d,l=f.precision,u=f.rounding,!c[0]||!h[0])return h[0]||(t=new f(this)),nn?nT(t,l,u):t;if(o=nc(this.e/7),n=nc(t.e/7),c=c.slice(),a=o-n){for(a<0?(i=c,a=-a,s=h.length):(i=h,n=o,s=c.length),a>(s=(o=Math.ceil(l/7))>s?o+1:s+1)&&(a=s,i.length=1),i.reverse();a--;)i.push(0);i.reverse()}for((s=c.length)-(a=h.length)<0&&(a=s,i=h,h=c,c=i),r=0;a;)r=(c[--a]=c[a]+h[a]+r)/1e7|0,c[a]%=1e7;for(r&&(c.unshift(r),++n),s=c.length;0==c[--s];)c.pop();return t.d=c,t.e=nS(c,n),nn?nT(t,l,u):t},nv.precision=nv.sd=function(t){var r;if(void 0!==t&&!!t!==t&&1!==t&&0!==t)throw Error(no+t);return this.d?(r=nD(this.d),t&&this.e+1>r&&(r=this.e+1)):r=NaN,r},nv.round=function(){var t=this.constructor;return nT(new t(this),this.e+1,t.rounding)},nv.sine=nv.sin=function(){var t,r,i=this,n=i.constructor;return i.isFinite()?i.isZero()?new n(i):(t=n.precision,r=n.rounding,n.precision=t+Math.max(i.e,i.sd())+7,n.rounding=1,i=function(t,r){var i,n=r.d.length;if(n<3)return r.isZero()?r:nB(t,2,r,r);i=(i=1.4*Math.sqrt(n))>16?16:0|i,r=nB(t,2,r=r.times(1/nz(5,i)),r);for(var a,o=new t(5),s=new t(16),l=new t(20);i--;)a=r.times(r),r=r.times(o.plus(a.times(s.times(a).minus(l))));return r}(n,nj(n,i)),n.precision=t,n.rounding=r,nT(i9>2?i.neg():i,t,r,!0)):new n(NaN)},nv.squareRoot=nv.sqrt=function(){var t,r,i,n,a,o,s=this.d,l=this.e,u=this.s,c=this.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?this:1/0);for(nn=!1,0==(u=Math.sqrt(+this))||u==1/0?(((r=n_(s)).length+l)%2==0&&(r+="0"),u=Math.sqrt(r),l=nc((l+1)/2)-(l<0||l%2),n=new c(r=u==1/0?"5e"+l:(r=u.toExponential()).slice(0,r.indexOf("e")+1)+l)):n=new c(u.toString()),i=(l=c.precision)+3;;)if(n=(o=n).plus(nE(this,o,i+2,1)).times(.5),n_(o.d).slice(0,i)===(r=n_(n.d)).slice(0,i)){if("9999"!=(r=r.slice(i-3,i+1))&&(a||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(nT(n,l+1,1),t=!n.times(n).eq(this));break}if(!a&&(nT(o,l+1,0),o.times(o).eq(this))){n=o;break}i+=4,a=1}return nn=!0,nT(n,l,c.rounding,t)},nv.tangent=nv.tan=function(){var t,r,i=this,n=i.constructor;return i.isFinite()?i.isZero()?new n(i):(t=n.precision,r=n.rounding,n.precision=t+10,n.rounding=1,(i=i.sin()).s=1,i=nE(i,new n(1).minus(i.times(i)).sqrt(),t+10,0),n.precision=t,n.rounding=r,nT(2==i9||4==i9?i.neg():i,t,r,!0)):new n(NaN)},nv.times=nv.mul=function(t){var r,i,n,a,o,s,l,u,c,h=this.constructor,f=this.d,d=(t=new h(t)).d;if(t.s*=this.s,!f||!f[0]||!d||!d[0])return new h(!t.s||f&&!f[0]&&!d||d&&!d[0]&&!f?NaN:!f||!d?t.s/0:0*t.s);for(i=nc(this.e/7)+nc(t.e/7),(u=f.length)<(c=d.length)&&(o=f,f=d,d=o,s=u,u=c,c=s),o=[],n=s=u+c;n--;)o.push(0);for(n=c;--n>=0;){for(r=0,a=u+n;a>n;)l=o[a]+d[n]*f[a-n-1]+r,o[a--]=l%1e7|0,r=l/1e7|0;o[a]=(o[a]+r)%1e7|0}for(;!o[--s];)o.pop();return r?++i:o.shift(),t.d=o,t.e=nS(o,i),nn?nT(t,h.precision,h.rounding):t},nv.toBinary=function(t,r){return nU(this,2,t,r)},nv.toDecimalPlaces=nv.toDP=function(t,r){var i=this,n=i.constructor;return(i=new n(i),void 0===t)?i:(nb(t,0,1e9),void 0===r?r=n.rounding:nb(r,0,8),nT(i,t+i.e+1,r))},nv.toExponential=function(t,r){var i,n=this,a=n.constructor;return void 0===t?i=nA(n,!0):(nb(t,0,1e9),void 0===r?r=a.rounding:nb(r,0,8),i=nA(n=nT(new a(n),t+1,r),!0,t+1)),n.isNeg()&&!n.isZero()?"-"+i:i},nv.toFixed=function(t,r){var i,n,a=this.constructor;return void 0===t?i=nA(this):(nb(t,0,1e9),void 0===r?r=a.rounding:nb(r,0,8),i=nA(n=nT(new a(this),t+this.e+1,r),!1,t+n.e+1)),this.isNeg()&&!this.isZero()?"-"+i:i},nv.toFraction=function(t){var r,i,n,a,o,s,l,u,c,h,f,d,p=this.d,m=this.constructor;if(!p)return new m(this);if(c=i=new m(1),n=u=new m(0),s=(o=(r=new m(n)).e=nD(p)-this.e-1)%7,r.d[0]=nh(10,s<0?7+s:s),null==t)t=o>0?r:c;else{if(!(l=new m(t)).isInt()||l.lt(c))throw Error(no+l);t=l.gt(r)?o>0?r:c:l}for(nn=!1,l=new m(n_(p)),h=m.precision,m.precision=o=7*p.length*2;f=nE(l,r,0,1,1),1!=(a=i.plus(f.times(n))).cmp(t);
1)i=n,n=a,a=c,c=u.plus(f.times(a)),u=a,a=r,r=l.minus(f.times(a)),l=a;return a=nE(t.minus(i),n,0,1,1),u=u.plus(a.times(c)),i=i.plus(a.times(n)),u.s=c.s=this.s,d=1>nE(c,n,o,1).minus(this).abs().cmp(nE(u,i,o,1).minus(this).abs())?[c,n]:[u,i],m.precision=h,nn=!0,d},nv.toHexadecimal=nv.toHex=function(t,r){return nU(this,16,t,r)},nv.toNearest=function(t,r){var i=this,n=i.constructor;if(i=new n(i),null==t){if(!i.d)return i;t=new n(1),r=n.rounding}else{if(t=new n(t),void 0===r?r=n.rounding:nb(r,0,8),!i.d)return t.s?i:t;if(!t.d)return t.s&&(t.s=i.s),t}return t.d[0]?(nn=!1,i=nE(i,t,0,r,1).times(t),nn=!0,nT(i)):(t.s=i.s,i=t),i},nv.toNumber=function(){return+this},nv.toOctal=function(t,r){return nU(this,8,t,r)},nv.toPower=nv.pow=function(t){var r,i,n,a,o,s,l=this,u=l.constructor,c=+(t=new u(t));if(!l.d||!t.d||!l.d[0]||!t.d[0])return new u(nh(+l,c));if((l=new u(l)).eq(1))return l;if(n=u.precision,o=u.rounding,t.eq(1))return nT(l,n,o);if((r=nc(t.e/7))>=t.d.length-1&&(i=c<0?-c:c)<=0x1fffffffffffff)return a=nI(u,l,i,n),t.s<0?new u(1).div(a):nT(a,n,o);if((s=l.s)<0){if(r<t.d.length-1)return new u(NaN);if((1&t.d[r])==0&&(s=1),0==l.e&&1==l.d[0]&&1==l.d.length)return l.s=s,l}return(r=0!=(i=nh(+l,c))&&isFinite(i)?new u(i+"").e:nc(c*(Math.log("0."+n_(l.d))/Math.LN10+l.e+1)))>u.maxE+1||r<u.minE-1?new u(r>0?s/0:0):(nn=!1,u.rounding=l.s=1,i=Math.min(12,(r+"").length),(a=nN(t.times(nL(l,n+i)),n)).d&&nx((a=nT(a,n+5,1)).d,n,o)&&(r=n+10,+n_((a=nT(nN(t.times(nL(l,r+i)),r),r+5,1)).d).slice(n+1,n+15)+1==1e14&&(a=nT(a,n+1,0))),a.s=s,nn=!0,u.rounding=o,nT(a,n,o))},nv.toPrecision=function(t,r){var i,n=this,a=n.constructor;return void 0===t?i=nA(n,n.e<=a.toExpNeg||n.e>=a.toExpPos):(nb(t,1,1e9),void 0===r?r=a.rounding:nb(r,0,8),i=nA(n=nT(new a(n),t,r),t<=n.e||n.e<=a.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+i:i},nv.toSignificantDigits=nv.toSD=function(t,r){var i=this.constructor;return void 0===t?(t=i.precision,r=i.rounding):(nb(t,1,1e9),void 0===r?r=i.rounding:nb(r,0,8)),nT(new i(this),t,r)},nv.toString=function(){var t=this.constructor,r=nA(this,this.e<=t.toExpNeg||this.e>=t.toExpPos);return this.isNeg()&&!this.isZero()?"-"+r:r},nv.truncated=nv.trunc=function(){return nT(new this.constructor(this),this.e+1,1)},nv.valueOf=nv.toJSON=function(){var t=this.constructor,r=nA(this,this.e<=t.toExpNeg||this.e>=t.toExpPos);return this.isNeg()?"-"+r:r};var nE=function(){function t(t,r,i){var n,a=0,o=t.length;for(t=t.slice();o--;)n=t[o]*r+a,t[o]=n%i|0,a=n/i|0;return a&&t.unshift(a),t}function r(t,r,i,n){var a,o;if(i!=n)o=i>n?1:-1;else for(a=o=0;a<i;a++)if(t[a]!=r[a]){o=t[a]>r[a]?1:-1;break}return o}function i(t,r,i,n){for(var a=0;i--;)t[i]-=a,a=+(t[i]<r[i]),t[i]=a*n+t[i]-r[i];for(;!t[0]&&t.length>1;)t.shift()}return function(n,a,o,s,l,u){var c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D,P=n.constructor,I=n.s==a.s?1:-1,k=n.d,O=a.d;if(!k||!k[0]||!O||!O[0])return new P(!n.s||!a.s||(k?O&&k[0]==O[0]:!O)?NaN:k&&0==k[0]||!O?0*I:I/0);for(u?(p=1,h=n.e-a.e):(u=1e7,p=7,h=nc(n.e/p)-nc(a.e/p)),M=O.length,S=k.length,_=(v=new P(I)).d=[],f=0;O[f]==(k[f]||0);f++);if(O[f]>(k[f]||0)&&h--,null==o?(E=o=P.precision,s=P.rounding):E=l?o+(n.e-a.e)+1:o,E<0)_.push(1),m=!0;else{if(E=E/p+2|0,f=0,1==M){for(d=0,O=O[0],E++;(f<S||d)&&E--;f++)T=d*u+(k[f]||0),_[f]=T/O|0,d=T%O|0;m=d||f<S}else{for((d=u/(O[0]+1)|0)>1&&(O=t(O,d,u),k=t(k,d,u),M=O.length,S=k.length),A=M,x=(b=k.slice(0,M)).length;x<M;)b[x++]=0;(D=O.slice()).unshift(0),C=O[0],O[1]>=u/2&&++C;do d=0,(c=r(O,b,M,x))<0?(w=b[0],M!=x&&(w=w*u+(b[1]||0)),(d=w/C|0)>1?(d>=u&&(d=u-1),y=(g=t(O,d,u)).length,x=b.length,1==(c=r(g,b,y,x))&&(d--,i(g,M<y?D:O,y,u))):(0==d&&(c=d=1),g=O.slice()),(y=g.length)<x&&g.unshift(0),i(b,g,x,u),-1==c&&(x=b.length,(c=r(O,b,M,x))<1&&(d++,i(b,M<x?D:O,x,u))),x=b.length):0===c&&(d++,b=[0]),_[f++]=d,c&&b[0]?b[x++]=k[A]||0:(b=[k[A]],x=1);while((A++<S||void 0!==b[0])&&E--)m=void 0!==b[0]}_[0]||_.shift()}if(1==p)v.e=h,i7=m;else{for(f=1,d=_[0];d>=10;d/=10)f++;v.e=f+h*p-1,nT(v,l?o+v.e+1:o,s,m)}return v}}();function nT(t,r,i,n){var a,o,s,l,u,c,h,f,d,p=t.constructor;e:if(null!=r){if(!(f=t.d))return t;for(a=1,l=f[0];l>=10;l/=10)a++;if((o=r-a)<0)o+=7,s=r,u=(h=f[d=0])/nh(10,a-s-1)%10|0;else if((d=Math.ceil((o+1)/7))>=(l=f.length))if(n){for(;l++<=d;)f.push(0);h=u=0,a=1,o%=7,s=o-7+1}else break e;else{for(h=l=f[d],a=1;l>=10;l/=10)a++;o%=7,u=(s=o-7+a)<0?0:h/nh(10,a-s-1)%10|0}if(n=n||r<0||void 0!==f[d+1]||(s<0?h:h%nh(10,a-s-1)),c=i<4?(u||n)&&(0==i||i==(t.s<0?3:2)):u>5||5==u&&(4==i||n||6==i&&(o>0?s>0?h/nh(10,a-s):0:f[d-1])%10&1||i==(t.s<0?8:7)),r<1||!f[0])return f.length=0,c?(r-=t.e+1,f[0]=nh(10,(7-r%7)%7),t.e=-r||0):f[0]=t.e=0,t;if(0==o?(f.length=d,l=1,d--):(f.length=d+1,l=nh(10,7-o),f[d]=s>0?(h/nh(10,a-s)%nh(10,s)|0)*l:0),c)for(;;)if(0==d){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=l,l=1;s>=10;s/=10)l++;o!=l&&(t.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[d]+=l,1e7!=f[d])break;f[d--]=0,l=1}for(o=f.length;0===f[--o];)f.pop()}return nn&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function nA(t,r,i){if(!t.isFinite())return nR(t);var n,a=t.e,o=n_(t.d),s=o.length;return r?(i&&(n=i-s)>0?o=o.charAt(0)+"."+o.slice(1)+nP(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):a<0?(o="0."+nP(-a-1)+o,i&&(n=i-s)>0&&(o+=nP(n))):a>
vendor: 5,725 bytes, line 1
1=s?(o+=nP(a+1-s),i&&(n=i-a-1)>0&&(o=o+"."+nP(n))):((n=a+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),i&&(n=i-s)>0&&(a+1===s&&(o+="."),o+=nP(n))),o}function nS(t,r){var i=t[0];for(r*=7;i>=10;i/=10)r++;return r}function nC(t,r,i){if(r>ng)throw nn=!0,i&&(t.precision=i),Error(ns);return nT(new t(nt),r,1,!0)}function nM(t,r,i){if(r>ny)throw Error(ns);return nT(new t(nr),r,i,!0)}function nD(t){var r=t.length-1,i=7*r+1;if(r=t[r]){for(;r%10==0;r/=10)i--;for(r=t[0];r>=10;r/=10)i++}return i}function nP(t){for(var r="";t--;)r+="0";return r}function nI(t,r,i,n){var a,o=new t(1),s=Math.ceil(n/7+4);for(nn=!1;;){if(i%2&&nV((o=o.times(r)).d,s)&&(a=!0),0===(i=nc(i/2))){i=o.d.length-1,a&&0===o.d[i]&&++o.d[i];break}nV((r=r.times(r)).d,s)}return nn=!0,o}function nk(t){return 1&t.d[t.d.length-1]}function nO(t,r,i){for(var n,a,o=new t(r[0]),s=0;++s<r.length;){if(!(a=new t(r[s])).s){o=a;break}((n=o.cmp(a))===i||0===n&&o.s===i)&&(o=a)}return o}function nN(t,r){var i,n,a,o,s,l,u,c=0,h=0,f=0,d=t.constructor,p=d.rounding,m=d.precision;if(!t.d||!t.d[0]||t.e>17)return new d(t.d?!t.d[0]?1:t.s<0?0:1/0:t.s?t.s<0?0:t:0/0);for(null==r?(nn=!1,u=m):u=r,l=new d(.03125);t.e>-2;)t=t.times(l),f+=5;for(u+=n=Math.log(nh(2,f))/Math.LN10*2+5|0,i=o=s=new d(1),d.precision=u;;){if(o=nT(o.times(t),u,1),i=i.times(++h),n_((l=s.plus(nE(o,i,u,1))).d).slice(0,u)===n_(s.d).slice(0,u)){for(a=f;a--;)s=nT(s.times(s),u,1);if(null!=r)return d.precision=m,s;if(!(c<3&&nx(s.d,u-n,p,c)))return nT(s,d.precision=m,p,nn=!0);d.precision=u+=10,i=o=l=new d(1),h=0,c++}s=l}}function nL(t,r){var i,n,a,o,s,l,u,c,h,f,d,p=1,m=t,g=m.d,y=m.constructor,v=y.rounding,_=y.precision;if(m.s<0||!g||!g[0]||!m.e&&1==g[0]&&1==g.length)return new y(g&&!g[0]?-1/0:1!=m.s?NaN:g?0:m);if(null==r?(nn=!1,h=_):h=r,y.precision=h+=10,n=(i=n_(g)).charAt(0),!(15e14>Math.abs(o=m.e)))return c=nC(y,h+2,_).times(o+""),m=nL(new y(n+"."+i.slice(1)),h-10).plus(c),y.precision=_,null==r?nT(m,_,v,nn=!0):m;for(;n<7&&1!=n||1==n&&i.charAt(1)>3;)n=(i=n_((m=m.times(t)).d)).charAt(0),p++;for(o=m.e,n>1?(m=new y("0."+i),o++):m=new y(n+"."+i.slice(1)),f=m,u=s=m=nE(m.minus(1),m.plus(1),h,1),d=nT(m.times(m),h,1),a=3;;){if(s=nT(s.times(d),h,1),n_((c=u.plus(nE(s,new y(a),h,1))).d).slice(0,h)===n_(u.d).slice(0,h)){if(u=u.times(2),0!==o&&(u=u.plus(nC(y,h+2,_).times(o+""))),u=nE(u,new y(p),h,1),null!=r)return y.precision=_,u;if(!nx(u.d,h-10,v,l))return nT(u,y.precision=_,v,nn=!0);y.precision=h+=10,c=s=m=nE(f.minus(1),f.plus(1),h,1),d=nT(m.times(m),h,1),a=l=1}u=c,a+=2}}function nR(t){return String(t.s*t.s/0)}function nF(t,r){var i,n,a;for((i=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(i<0&&(i=n),i+=+r.slice(n+1),r=r.substring(0,n)):i<0&&(i=r.length),n=0;48===r.charCodeAt(n);n++);for(a=r.length;48===r.charCodeAt(a-1);--a);if(r=r.slice(n,a)){if(a-=n,t.e=i=i-n-1,t.d=[],n=(i+1)%7,i<0&&(n+=7),n<a){for(n&&t.d.push(+r.slice(0,n)),a-=7;n<a;)t.d.push(+r.slice(n,n+=7));n=7-(r=r.slice(n)).length}else n-=a;for(;n--;)r+="0";t.d.push(+r),nn&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function nB(t,r,i,n,a){var o,s,l,u,c=t.precision,h=Math.ceil(c/7);for(nn=!1,u=i.times(i),l=new t(n);;){if(s=nE(l.times(u),new t(r++*r++),c,1),l=a?n.plus(s):n.minus(s),n=nE(s.times(u),new t(r++*r++),c,1),void 0!==(s=l.plus(n)).d[h]){for(o=h;s.d[o]===l.d[o]&&o--;);if(-1==o)break}o=l,l=n,n=s,s=o}return nn=!0,s.d.length=h+1,s}function nz(t,r){for(var i=t;--r;)i*=t;return i}function nj(t,r){var i,n=r.s<0,a=nM(t,t.precision,1),o=a.times(.5);if((r=r.abs()).lte(o))return i9=n?4:1,r;if((i=r.divToInt(a)).isZero())i9=n?3:2;else{if((r=r.minus(i.times(a))).lte(o))return i9=nk(i)?n?2:3:n?4:1,r;i9=nk(i)?n?1:4:n?3:2}return r.minus(a).abs()}function nU(t,r,i,n){var a,o,s,l,u,c,h,f,d,p=t.constructor,m=void 0!==i;if(m?(nb(i,1,1e9),void 0===n?n=p.rounding:nb(n,0,8)):(i=p.precision,n=p.rounding),t.isFinite()){for(s=(h=nA(t)).indexOf("."),m?(a=2,16==r?i=4*i-3:8==r&&(i=3*i-2)):a=r,s>=0&&(h=h.replace(".",""),(d=new p(1)).e=h.length-s,d.d=nw(nA(d),10,a),d.e=d.d.length),o=u=(f=nw(h,10,a)).length;0==f[--u];)f.pop();if(f[0]){if(s<0?o--:((t=new p(t)).d=f,t.e=o,f=(t=nE(t,d,i,n,0,a)).d,o=t.e,c=i7),s=f[i],l=a/2,c=c||void 0!==f[i+1],c=n<4?(void 0!==s||c)&&(0===n||n===(t.s<0?3:2)):s>l||s===l&&(4===n||c||6===n&&1&f[i-1]||n===(t.s<0?8:7)),f.length=i,c)for(;++f[--i]>a-1;)f[i]=0,i||(++o,f.unshift(1));for(u=f.length;!f[u-1];--u);for(s=0,h="";s<u;s++)h+=ne.charAt(f[s]);if(m){if(u>1)if(16==r||8==r){for(s=16==r?4:3,--u;u%s;u++)h+="0";for(u=(f=nw(h,a,r)).length;!f[u-1];--u);for(s=1,h="1.";s<u;s++)h+=ne.charAt(f[s])}else h=h.charAt(0)+"."+h.slice(1);h=h+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)h="0"+h;h="0."+h}else if(++o>u)for(o-=u;o--;)h+="0";else o<u&&(h=h.slice(0,o)+"."+h.slice(o))}else h=m?"0p+0":"0";h=(16==r?"0x":2==r?"0b":8==r?"0o":"")+h}else h=nR(t);return t.s<0?"-"+h:h}function nV(t,r){if(t.length>r)return t.length=r,!0}function n$(t){return new this(t).abs()}function nG(t){return new this(t).acos()}function nq(t){return new this(t).acosh()}function nH(t,r){return new this(t).plus(r)}function nW(t){return new this(t).asin()}function nZ(t){return new this(t).asinh()}function nY(t){return new this(t).atan()}function nX(t){return new this(t).atanh()}function nK(t,r){t=new this(t),r=new this(r);var i,n=this.precision,a=this.rounding,o=n+4;return t.s&&r.s?t.d||r.d?!r.d||t.isZero()?(i=r.s<0?nM(this,n,a):new this(0)).s=t.s:!t.d||r.isZero()?(i=nM(this,o,1).times(.5)).s=t.s:r.s<0?(this.precision=o,this.rounding=1,i=this.atan(nE(t,r,o,1)),r=nM(this,o,1),this.precision=n,this.rounding=a,i=t.s<0?i.minus(r):i.plus(r)):i=this.atan(nE(t,r,o,1)):(i=nM(this,o,1).times(r.s>0?.25:.75)).s=t.s:i=new this(NaN),i}function nQ(t){return new this(t).cbrt()}
1function nJ(t){return nT(t=new this(t),t.e+1,2)}function n0(t,r,i){return new this(t).clamp(r,i)}function n1(t){if(!t||"object"!=typeof t)throw Error(na+"Object expected");var r,i,n,a=!0===t.defaults,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(r=0;r<o.length;r+=3)if(i=o[r],a&&(this[i]=ni[i]),void 0!==(n=t[i]))if(nc(n)===n&&n>=o[r+1]&&n<=o[r+2])this[i]=n;else throw Error(no+i+": "+n);if(i="crypto",a&&(this[i]=ni[i]),void 0!==(n=t[i]))if(!0===n||!1===n||0===n||1===n)if(n)if("u">typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[i]=!0;else throw Error(nl);else this[i]=!1;else throw Error(no+i+": "+n);return this}function n2(t){return new this(t).cos()}function n3(t){return new this(t).cosh()}function n4(t,r){return new this(t).div(r)}function n6(t){return new this(t).exp()}function n5(t){return nT(t=new this(t),t.e+1,3)}function n8(){var t,r,i=new this(0);for(t=0,nn=!1;t<arguments.length;)if(r=new this(arguments[t++]),r.d)i.d&&(i=i.plus(r.times(r)));else{if(r.s)return nn=!0,new this(1/0);i=r}return nn=!0,i.sqrt()}function n7(t){return t instanceof a_||t&&t.toStringTag===nu||!1}function n9(t){return new this(t).ln()}function ae(t,r){return new this(t).log(r)}function at(t){return new this(t).log(2)}function ar(t){return new this(t).log(10)}function ai(){return nO(this,arguments,-1)}function an(){return nO(this,arguments,1)}function aa(t,r){return new this(t).mod(r)}function ao(t,r){return new this(t).mul(r)}function as(t,r){return new this(t).pow(r)}function al(t){var r,i,n,a,o=0,s=new this(1),l=[];if(void 0===t?t=this.precision:nb(t,1,1e9),n=Math.ceil(t/7),this.crypto)if(crypto.getRandomValues)for(r=crypto.getRandomValues(new Uint32Array(n));o<n;)(a=r[o])>=429e7?r[o]=crypto.getRandomValues(new Uint32Array(1))[0]:l[o++]=a%1e7;else if(crypto.randomBytes){for(r=crypto.randomBytes(n*=4);o<n;)(a=r[o]+(r[o+1]<<8)+(r[o+2]<<16)+((127&r[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(r,o):(l.push(a%1e7),o+=4);o=n/4}else throw Error(nl);else for(;o<n;)l[o++]=1e7*Math.random()|0;for(n=l[--o],t%=7,n&&t&&(a=nh(10,7-t),l[o]=(n/a|0)*a);0===l[o];o--)l.pop();if(o<0)i=0,l=[0];else{for(i=-1;0===l[0];i-=7)l.shift();for(n=1,a=l[0];a>=10;a/=10)n++;n<7&&(i-=7-n)}return s.e=i,s.d=l,s}function au(t){return nT(t=new this(t),t.e+1,this.rounding)}function ac(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function ah(t){return new this(t).sin()}function af(t){return new this(t).sinh()}function ad(t){return new this(t).sqrt()}function ap(t,r){return new this(t).sub(r)}function am(){var t=0,r=arguments,i=new this(r[0]);for(nn=!1;i.s&&++t<r.length;)i=i.plus(r[t]);return nn=!0,nT(i,this.precision,this.rounding)}function ag(t){return new this(t).tan()}function ay(t){return new this(t).tanh()}function av(t){return nT(t=new this(t),t.e+1,1)}nv[Symbol.for("nodejs.util.inspect.custom")]=nv.toString,nv[Symbol.toStringTag]="Decimal";var a_=nv.constructor=function t(r){var i,n,a;function o(t){var r,i,n;if(!(this instanceof o))return new o(t);if(this.constructor=o,n7(t)){this.s=t.s,nn?!t.d||t.e>o.maxE?(this.e=NaN,this.d=null):t.e<o.minE?(this.e=0,this.d=[0]):(this.e=t.e,this.d=t.d.slice()):(this.e=t.e,this.d=t.d?t.d.slice():t.d);return}if("number"==(n=typeof t)){if(0===t){this.s=1/t<0?-1:1,this.e=0,this.d=[0];return}if(t<0?(t=-t,this.s=-1):this.s=1,t===~~t&&t<1e7){for(r=0,i=t;i>=10;i/=10)r++;nn?r>o.maxE?(this.e=NaN,this.d=null):r<o.minE?(this.e=0,this.d=[0]):(this.e=r,this.d=[t]):(this.e=r,this.d=[t]);return}if(0*t!=0){t||(this.s=NaN),this.e=NaN,this.d=null;return}return nF(this,t.toString())}if("string"===n)return 45===(i=t.charCodeAt(0))?(t=t.slice(1),this.s=-1):(43===i&&(t=t.slice(1)),this.s=1),nm.test(t)?nF(this,t):function(t,r){var i,n,a,o,s,l,u,c,h;if(r.indexOf("_")>-1){if(r=r.replace(/(\d)_(?=\d)/g,"$1"),nm.test(r))return nF(t,r)}else if("Infinity"===r||"NaN"===r)return+r||(t.s=NaN),t.e=NaN,t.d=null,t;if(nd.test(r))i=16,r=r.toLowerCase();else if(nf.test(r))i=2;else if(np.test(r))i=8;else throw Error(no+r);for((o=r.search(/p/i))>0?(u=+r.slice(o+1),r=r.substring(2,o)):r=r.slice(2),s=(o=r.indexOf("."))>=0,n=t.constructor,s&&(o=(l=(r=r.replace(".","")).length)-o,a=nI(n,new n(i),o,2*o)),o=h=(c=nw(r,i,1e7)).length-1;0===c[o];--o)c.pop();return o<0?new n(0*t.s):(t.e=nS(c,h),t.d=c,nn=!1,s&&(t=nE(t,a,4*l)),u&&(t=t.times(54>Math.abs(u)?nh(2,u):a_.pow(2,u))),nn=!0,t)}(this,t);if("bigint"===n)return t<0?(t=-t,this.s=-1):this.s=1,nF(this,t.toString());throw Error(no+t)}if(o.prototype=nv,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=n1,o.clone=t,o.isDecimal=n7,o.abs=n$,o.acos=nG,o.acosh=nq,o.add=nH,o.asin=nW,o.asinh=nZ,o.atan=nY,o.atanh=nX,o.atan2=nK,o.cbrt=nQ,o.ceil=nJ,o.clamp=n0,o.cos=n2,o.cosh=n3,o.div=n4,o.exp=n6,o.floor=n5,o.hypot=n8,o.ln=n9,o.log=ae,o.log10=ar,o.log2=at,o.max=ai,o.min=an,o.mod=aa,o.mul=ao,o.pow=as,o.random=al,o.round=au,o.sign=ac,o.sin=ah,o.sinh=af,o.sqrt=ad,o.sub=ap,o.sum=am,o.tan=ag,o.tanh=ay,o.trunc=av,void 0===r&&(r={}),r&&!0!==r.defaults)for(i=0,a=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];i<a.length;)r.hasOwnProperty(n=a[i++])||(r[n]=this[n]);return o.config(r),o}(ni);nt=new a_(nt),nr=new a_(nr);var ab=ig("BigNumber",["?on","config"],t=>{var{on:r,config:i}=t,n=a_.clone({precision:i.precision,modulo:a_.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(t){return new n(t.value)},r&&r("config",function(t,r){t.precision!==r.precision&&n.config({precision:t.precision})}),n},{isClass:!0});t.s(["createBigNumberClass",0,ab],672746);let ax=Math.cosh||function(t){return 1e-9>Math.abs(t)?1-t:(Math.exp(t)+Math.exp(-t))*.5},aw=Math.sinh||function(t){return 1e-9>Math.abs(t)?t:(Math.exp(t)-Math.exp(-t))*.5},aE=function(t,r){return((t=Math.abs(t))<(r=Math.abs(r))&&([t,r]=[r,t]),t<1e8)?Math.sqrt(t*t+r*r):(r/=t,t*Math.sqrt(1+r*r))},aT=function(){throw SyntaxError("Invalid Param")};function aA(t,r){let i=Math.abs(t),n=Math.abs(r);return 0===t?Math.log(n):0===r?Math.log(i):i<3e3&&n<3e3?.5*Math.log(t*t+r*r):.5*Math.log((t*=.5)*t+(r*=.5)*r)+Math.LN2}let aS={re:0,im:0},aC=function(t,r){if(null==t)aS.re=aS.im=0;else if(void 0!==r)aS.re=t,aS.im=r;else switch(typeof t){case"object":if("im"in t&&"re"in t)aS.re=t.re,aS.im=t.im;else if("abs"in t&&"arg"in t){if(!isFinite(t.abs)&&isFinite(t.arg))return aM.INFINITY;aS.re=t.abs*Math.cos(t.arg),aS.im=t.abs*Math.sin(t.arg)}else if("r"in t&&"phi"in t){if(!isFinite(t.r)&&isFinite(t.phi))return aM.INFINITY;aS.re=t.r*Math.cos(t.phi),aS.im=t.r*Math.sin(t.phi)}else 2===t.length?(aS.re=t[0],aS.im=t[1]):aT();break;case"string":aS.im=aS.re=0;let i=t.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,a=0;null===i&&aT();for(let t=0;t<i.length;t++){let r=i[t];" "===r||" "===r||"\n"===r||("+"===r?n++:"-"===r?a++:("i"===r||"I"===r?(n+a===0&&aT()," "===i[t+1]||isNaN(i[t+1])?aS.im+=parseFloat((a%2?"-":"")+"1"):(aS.im+=parseFloat((a%2?"-":"")+i[t+1]),t++)):((n+a===0||isNaN(r))&&aT(),"i"===i[t+1]||"I"===i[t+1]?(aS.im+=parseFloat((a%2?"-":"")+r),t++):aS.re+=parseFloat((a%2?"-":"")+r)),n=a=0))}n+a>0&&aT();break;case"number":aS.im=0,aS.re=t;break;default:aT()}return isNaN(aS.re)||isNaN(aS.im),aS};function aM(t,r){if(!(this instanceof aM))return new aM(t,r);let i=aC(t,r);this.re=i.re,this.im=i.im}aM.prototype={re:0,im:0,sign:function(){let t=aE(this.re,this.im);return new aM(this.re/t,this.im/t)},add:function(t,r){let i=aC(t,r),n=this.isInfinite(),a=!(isFinite(i.re)&&isFinite(i.im));return n||a?n&&a?aM.NAN:aM.INFINITY:new aM(this.re+i.re,this.im+i.im)},sub:function(t,r){let i=aC(t,r),n=this.isInfinite(),a=!(isFinite(i.re)&&isFinite(i.im));return n||a?n&&a?aM.NAN:aM.INFINITY:new aM(this.re-i.re,this.im-i.im)},mul:function(t,r){let i=aC(t,r),n=this.isInfinite(),a=!(isFinite(i.re)&&isFinite(i.im)),o=0===this.re&&0===this.im,s=0===i.re&&0===i.im;return n&&s||a&&o?aM.NAN:n||a?aM.INFINITY:0===i.im&&0===this.im?new aM(this.re*i.re,0):new aM(this.re*i.re-this.im*i.im,this.re*i.im+this.im*i.re)},div:function(t,r){let i=aC(t,r),n=this.isInfinite(),a=!(isFinite(i.re)&&isFinite(i.im)),o=0===this.re&&0===this.im,s=0===i.re&&0===i.im;if(o&&s||n&&a)return aM.NAN;if(s||n)return aM.INFINITY;if(o||a)return aM.ZERO;if(0===i.im)return new aM(this.re/i.re,this.im/i.re);if(Math.abs(i.re)<Math.abs(i.im)){let t=i.re/i.im,r=i.re*t+i.im;return new aM((this.re*t+this.im)/r,(this.im*t-this.re)/r)}{let t=i.im/i.re,r=i.im*t+i.re;return new aM((this.re+this.im*t)/r,(this.im-this.re*t)/r)}},pow:function(t,r){let i=aC(t,r),n=0===this.re&&0===this.im;if(0===i.re&&0===i.im)return aM.ONE;if(0===i.im){if(0===this.im&&this.re>0)return new aM(Math.pow(this.re,i.re),0);else if(0===this.re)switch((i.re%4+4)%4){case 0:return new aM(Math.pow(this.im,i.re),0);case 1:return new aM(0,Math.pow(this.im,i.re));case 2:return new aM(-Math.pow(this.im,i.re),0);case 3:return new aM(0,-Math.pow(this.im,i.re))}}if(n&&i.re>0)return aM.ZERO;let a=Math.atan2(this.im,this.re),o=aA(this.re,this.im),s=Math.exp(i.re*o-i.im*a),l=i.im*o+i.re*a;return new aM(s*Math.cos(l),s*Math.sin(l))},sqrt:function(){let t=this.re,r=this.im;if(0===r)if(t>
1=0)return new aM(Math.sqrt(t),0);else return new aM(0,Math.sqrt(-t));let i=Math.sqrt(.5*(aE(t,r)+Math.abs(t))),n=Math.abs(r)/(2*i);return t>=0?new aM(i,r<0?-n:n):new aM(n,r<0?-i:i)},exp:function(){let t=Math.exp(this.re);return 0===this.im?new aM(t,0):new aM(t*Math.cos(this.im),t*Math.sin(this.im))},expm1:function(){let t,r=this.re,i=this.im;return new aM(Math.expm1(r)*Math.cos(i)+-2*(t=Math.sin(.5*i))*t,Math.exp(r)*Math.sin(i))},log:function(){let t=this.re,r=this.im;return 0===r&&t>0?new aM(Math.log(t),0):new aM(aA(t,r),Math.atan2(r,t))},abs:function(){return aE(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let t=this.re,r=this.im;return new aM(Math.sin(t)*ax(r),Math.cos(t)*aw(r))},cos:function(){let t=this.re,r=this.im;return new aM(Math.cos(t)*ax(r),-Math.sin(t)*aw(r))},tan:function(){let t=2*this.re,r=2*this.im,i=Math.cos(t)+ax(r);return new aM(Math.sin(t)/i,aw(r)/i)},cot:function(){let t=2*this.re,r=2*this.im,i=Math.cos(t)-ax(r);return new aM(-Math.sin(t)/i,aw(r)/i)},sec:function(){let t=this.re,r=this.im,i=.5*ax(2*r)+.5*Math.cos(2*t);return new aM(Math.cos(t)*ax(r)/i,Math.sin(t)*aw(r)/i)},csc:function(){let t=this.re,r=this.im,i=.5*ax(2*r)-.5*Math.cos(2*t);return new aM(Math.sin(t)*ax(r)/i,-Math.cos(t)*aw(r)/i)},asin:function(){let t=this.re,r=this.im,i=new aM(r*r-t*t+1,-2*t*r).sqrt(),n=new aM(i.re-r,i.im+t).log();return new aM(n.im,-n.re)},acos:function(){let t=this.re,r=this.im,i=new aM(r*r-t*t+1,-2*t*r).sqrt(),n=new aM(i.re-r,i.im+t).log();return new aM(Math.PI/2-n.im,n.re)},atan:function(){let t=this.re,r=this.im;if(0===t){if(1===r)return new aM(0,1/0);if(-1===r)return new aM(0,-1/0)}let i=t*t+(1-r)*(1-r),n=new aM((1-r*r-t*t)/i,-2*t/i).log();return new aM(-.5*n.im,.5*n.re)},acot:function(){let t=this.re,r=this.im;if(0===r)return new aM(Math.atan2(1,t),0);let i=t*t+r*r;return 0!==i?new aM(t/i,-r/i).atan():new aM(0!==t?t/0:0,0!==r?-r/0:0).atan()},asec:function(){let t=this.re,r=this.im;if(0===t&&0===r)return new aM(0,1/0);let i=t*t+r*r;return 0!==i?new aM(t/i,-r/i).acos():new aM(0!==t?t/0:0,0!==r?-r/0:0).acos()},acsc:function(){let t=this.re,r=this.im;if(0===t&&0===r)return new aM(Math.PI/2,1/0);let i=t*t+r*r;return 0!==i?new aM(t/i,-r/i).asin():new aM(0!==t?t/0:0,0!==r?-r/0:0).asin()},sinh:function(){let t=this.re,r=this.im;return new aM(aw(t)*Math.cos(r),ax(t)*Math.sin(r))},cosh:function(){let t=this.re,r=this.im;return new aM(ax(t)*Math.cos(r),aw(t)*Math.sin(r))},tanh:function(){let t=2*this.re,r=2*this.im,i=ax(t)+Math.cos(r);return new aM(aw(t)/i,Math.sin(r)/i)},coth:function(){let t=2*this.re,r=2*this.im,i=ax(t)-Math.cos(r);return new aM(aw(t)/i,-Math.sin(r)/i)},csch:function(){let t=this.re,r=this.im,i=Math.cos(2*r)-ax(2*t);return new aM(-2*aw(t)*Math.cos(r)/i,2*ax(t)*Math.sin(r)/i)},sech:function(){let t=this.re,r=this.im,i=Math.cos(2*r)+ax(2*t);return new aM(2*ax(t)*Math.cos(r)/i,-2*aw(t)*Math.sin(r)/i)},asinh:function(){let t=this.re,r=this.im;if(0===r){if(0===t)return new aM(0,0);let r=Math.abs(t),i=Math.log(r+Math.sqrt(r*r+1));return new aM(t<0?-i:i,0)}let i=new aM(t*t-r*r+1,2*t*r).sqrt();return new aM(t+i.re,r+i.im).log()},acosh:function(){let t=this.re,r=this.im;if(0===r){if(t>1)return new aM(Math.log(t+Math.sqrt(t-1)*Math.sqrt(t+1)),0);if(t<-1){let r=Math.sqrt(t*t-1);return new aM(Math.log(-t+r),Math.PI)}return new aM(0,Math.acos(t))}let i=new aM(t-1,r).sqrt(),n=new aM(t+1,r).sqrt();return new aM(t+i.re*n.re-i.im*n.im,r+i.re*n.im+i.im*n.re).log()},atanh:function(){let t=this.re,r=this.im;if(0===r)return 0===t?new aM(0,0):1===t?new aM(1/0,0):-1===t?new aM(-1/0,0):-1<t&&t<1?new aM(.5*Math.log((1+t)/(1-t)),0):t>1?new aM(.5*Math.log((t+1)/(t-1)),-Math.PI/2):new aM(.5*Math.log(-((1+t)/(1-t))),Math.PI/2);let i=1-t,n=1+t,a=i*i+r*r;if(0===a)return new aM(-1!==t?t/0:0,0!==r?r/0:0);let o=(n*i-r*r)/a,s=(r*i+n*r)/a;return new aM(aA(o,s)/2,Math.atan2(s,o)/2)},acoth:function(){let t=this.re,r=this.im;if(0===t&&0===r)return new aM(0,Math.PI/2);let i=t*t+r*r;return 0!==i?new aM(t/i,-r/i).atanh():new aM(0!==t?t/0:0,0!==r?-r/0:0).atanh()},acsch:function(){let t=this.re,r=this.im;if(0===r){if(0===t)return new aM(1/0,0);let r=1/t;return new aM(Math.log(r+Math.sqrt(r*r+1)),0)}let i=t*t+r*r;return 0!==i?new aM(t/i,-r/i).asinh():new aM(0!==t?t/0:0,0!==r?-r/0:0).asinh()},asech:function(){let t=this.re,r=this.im;if(this.isZero())return aM.INFINITY;let i=t*t+r*r;return 0!==i?new aM(t/i,-r/i).acosh():new aM(0!==t?t/0:0,0!==r?-r/0:0).acosh()},inverse:function(){if(this.isZero())return aM.INFINITY;if(this.isInfinite())return aM.ZERO;let t=this.re,r=this.im,i=t*t+r*r;return new aM(t/i,-r/i)},conjugate:function(){return new aM(this.re,-this.im)},neg:function(){return new aM(-this.re,-this.im)}
1,ceil:function(t){return t=Math.pow(10,t||0),new aM(Math.ceil(this.re*t)/t,Math.ceil(this.im*t)/t)},floor:function(t){return t=Math.pow(10,t||0),new aM(Math.floor(this.re*t)/t,Math.floor(this.im*t)/t)},round:function(t){return t=Math.pow(10,t||0),new aM(Math.round(this.re*t)/t,Math.round(this.im*t)/t)},equals:function(t,r){let i=aC(t,r);return Math.abs(i.re-this.re)<=aM.EPSILON&&Math.abs(i.im-this.im)<=aM.EPSILON},clone:function(){return new aM(this.re,this.im)},toString:function(){let t=this.re,r=this.im,i="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(t)<aM.EPSILON&&(t=0),Math.abs(r)<aM.EPSILON&&(r=0),0===r)?i+t:(0!==t?(i+=t,i+=" ",r<0?(r=-r,i+="-"):i+="+",i+=" "):r<0&&(r=-r,i+="-"),1!==r&&(i+=r),i+"i")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},aM.ZERO=new aM(0,0),aM.ONE=new aM(1,0),aM.I=new aM(0,1),aM.PI=new aM(Math.PI,0),aM.E=new aM(Math.E,0),aM.INFINITY=new aM(1/0,1/0),aM.NAN=new aM(NaN,NaN),aM.EPSILON=1e-15;var aD=ig("Complex",[],()=>(Object.defineProperty(aM,"name",{value:"Complex"}),aM.prototype.constructor=aM,aM.prototype.type="Complex",aM.prototype.isComplex=!0,aM.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},aM.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},aM.prototype.format=function(t){var r=this.im,i=this.re,n=iL(this.re,t),a=iL(this.im,t),o=rC(t)?t:t?t.precision:null;if(null!==o){var s=Math.pow(10,-o);Math.abs(i/r)<s&&(i=0),Math.abs(r/i)<s&&(r=0)}return 0===r?n:0===i?1===r?"i":-1===r?"-i":a+"i":r<0?-1===r?n+" - i":n+" - "+a.substring(1)+"i":1===r?n+" + i":n+" + "+a+"i"},aM.fromPolar=function(t){switch(arguments.length){case 1:var r=arguments[0];if("object"==typeof r)return aM(r);throw TypeError("Input has to be an object with r and phi keys.");case 2:var i=arguments[0],n=arguments[1];if(rC(i)){if(rk(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),rC(n))return new aM({r:i,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},aM.prototype.valueOf=aM.prototype.toString,aM.fromJSON=function(t){return new aM(t)},aM.compare=function(t,r){return t.re>r.re?1:t.re<r.re?-1:t.im>r.im?1:t.im<r.im?-1:0},aM),{isClass:!0});t.s(["createComplexClass",0,aD],217789),"u"<typeof BigInt&&(BigInt=function(t){if(isNaN(t))throw Error("");return t});let aP=BigInt(0),aI=BigInt(1),ak=BigInt(2),aO=BigInt(3),aN=BigInt(5),aL=BigInt(10);BigInt(Number.MAX_SAFE_INTEGER);let aR={s:aI,n:aP,d:aI};function aF(t,r){try{t=BigInt(t)}catch(t){throw aH()}return t*r}function aB(t){return"bigint"==typeof t?t:Math.floor(t)}function az(t,r){if(r===aP)throw aq();let i=Object.create(aG.prototype);i.s=t<aP?-aI:aI;let n=a$(t=t<aP?-t:t,r);return i.n=t/n,i.d=r/n,i}let aj=[ak*ak,ak,ak*ak,ak,ak*ak,ak*aO,ak,ak*aO];function aU(t){let r=Object.create(null);if(t<=aI)return r[t]=aI,r;let i=t=>{r[t]=(r[t]||aP)+aI};for(;t%ak===aP;)i(ak),t/=ak;for(;t%aO===aP;)i(aO),t/=aO;for(;t%aN===aP;)i(aN),t/=aN;for(let r=0,n=ak+aN;n*n<=t;){for(;t%n===aP;)i(n),t/=n;n+=aj[r],r=r+1&7}return t>aI&&i(t),r}let aV=function(t,r){let i=aP,n=aI,a=aI;if(null==t);else if(void 0!==r){if("bigint"==typeof t)i=t;else if(isNaN(t))throw aH();else if(t%1!=0)throw aW();else i=BigInt(t);if("bigint"==typeof r)n=r;else if(isNaN(r))throw aH();else if(r%1!=0)throw aW();else n=BigInt(r);a=i*n}else if("object"==typeof t){if("d"in t&&"n"in t)i=BigInt(t.n),n=BigInt(t.d),"s"in t&&(i*=BigInt(t.s));else if(0 in t)i=BigInt(t[0]),1 in t&&(n=BigInt(t[1]));else if("bigint"==typeof t)i=t;else throw aH();a=i*n}else if("number"==typeof t){if(isNaN(t))throw aH();if(t<0&&(a=-aI,t=-t),t%1==0)i=BigInt(t);else{let r=1,a=0,o=1,s=1,l=1;for(t>=1&&(r=10**Math.floor(1+Math.log10(t)),t/=r);o<=1e7&&l<=1e7;){let r=(a+s)/(o+l);if(t===r){o+l<=1e7?(i=a+s,n=o+l):l>o?(i=s,n=l):(i=a,n=o);break}t>r?(a+=s,o+=l):(s+=a,l+=o),o>1e7?(i=s,n=l):(i=a,n=o)}
1i=BigInt(i)*BigInt(r),n=BigInt(n)}}else if("string"==typeof t){let r=0,o=aP,s=aP,l=aP,u=aI,c=aI,h=t.replace(/_/g,"").match(/\d+|./g);if(null===h)throw aH();if("-"===h[r]?(a=-aI,r++):"+"===h[r]&&r++,h.length===r+1?s=aF(h[r++],a):"."===h[r+1]||"."===h[r]?("."!==h[r]&&(o=aF(h[r++],a)),(++r+1===h.length||"("===h[r+1]&&")"===h[r+3]||"'"===h[r+1]&&"'"===h[r+3])&&(s=aF(h[r],a),u=aL**BigInt(h[r].length),r++),("("===h[r]&&")"===h[r+2]||"'"===h[r]&&"'"===h[r+2])&&(l=aF(h[r+1],a),c=aL**BigInt(h[r+1].length)-aI,r+=3)):"/"===h[r+1]||":"===h[r+1]?(s=aF(h[r],a),u=aF(h[r+2],aI),r+=3):"/"===h[r+3]&&" "===h[r+1]&&(o=aF(h[r],a),s=aF(h[r+2],a),u=aF(h[r+4],aI),r+=5),h.length<=r)a=i=l+(n=u*c)*o+c*s;else throw aH()}else if("bigint"==typeof t)i=t,a=t,n=aI;else throw aH();if(n===aP)throw aq();aR.s=a<aP?-aI:aI,aR.n=i<aP?-i:i,aR.d=n<aP?-n:n};function a$(t,r){if(!t)return r;if(!r)return t;for(;;){if(!(t%=r))return r;if(!(r%=t))return t}}function aG(t,r){if(aV(t,r),!(this instanceof aG))return az(aR.s*aR.n,aR.d);t=a$(aR.d,aR.n),this.s=aR.s,this.n=aR.n/t,this.d=aR.d/t}let aq=function(){return Error("Division by Zero")},aH=function(){return Error("Invalid argument")},aW=function(){return Error("Parameters must be integer")};aG.prototype={s:aI,n:aP,d:aI,abs:function(){return az(this.n,this.d)},neg:function(){return az(-this.s*this.n,this.d)},add:function(t,r){return aV(t,r),az(this.s*this.n*aR.d+aR.s*this.d*aR.n,this.d*aR.d)},sub:function(t,r){return aV(t,r),az(this.s*this.n*aR.d-aR.s*this.d*aR.n,this.d*aR.d)},mul:function(t,r){return aV(t,r),az(this.s*aR.s*this.n*aR.n,this.d*aR.d)},div:function(t,r){return aV(t,r),az(this.s*aR.s*this.n*aR.d,this.d*aR.n)},clone:function(){return az(this.s*this.n,this.d)},mod:function(t,r){if(void 0===t)return az(this.s*this.n%this.d,aI);if(aV(t,r),aP===aR.n*this.d)throw aq();return az(this.s*(aR.d*this.n)%(aR.n*this.d),aR.d*this.d)},gcd:function(t,r){return aV(t,r),az(a$(aR.n,this.n)*a$(aR.d,this.d),aR.d*this.d)},lcm:function(t,r){return(aV(t,r),aR.n===aP&&this.n===aP)?az(aP,aI):az(aR.n*this.n,a$(aR.n,this.n)*a$(aR.d,this.d))},inverse:function(){return az(this.s*this.d,this.n)},pow:function(t,r){if(aV(t,r),aR.d===aI)if(aR.s<aP)return az((this.s*this.d)**aR.n,this.n**aR.n);else return az((this.s*this.n)**aR.n,this.d**aR.n);if(this.s<aP)return null;let i=aU(this.n),n=aU(this.d),a=aI,o=aI;for(let t in i)if("1"!==t){if("0"===t){a=aP;break}if(i[t]*=aR.n,i[t]%aR.d!==aP)return null;i[t]/=aR.d,a*=BigInt(t)**i[t]}for(let t in n)if("1"!==t){if(n[t]*=aR.n,n[t]%aR.d!==aP)return null;n[t]/=aR.d,o*=BigInt(t)**n[t]}return aR.s<aP?az(o,a):az(a,o)},log:function(t,r){if(aV(t,r),this.s<=aP||aR.s<=aP)return null;let i=Object.create(null),n=aU(aR.n),a=aU(aR.d),o=aU(this.n),s=aU(this.d);for(let t in a)n[t]=(n[t]||aP)-a[t];for(let t in s)o[t]=(o[t]||aP)-s[t];for(let t in n)"1"!==t&&(i[t]=!0);for(let t in o)"1"!==t&&(i[t]=!0);let l=null,u=null;for(let t in i){let r=n[t]||aP,i=o[t]||aP;if(r===aP){if(i!==aP)return null;continue}let a=i,s=r,c=a$(a,s);if(a/=c,s/=c,null===l&&null===u)l=a,u=s;else if(a*u!=l*s)return null}return null!==l&&null!==u?az(l,u):null},equals:function(t,r){return aV(t,r),this.s*this.n*aR.d==aR.s*aR.n*this.d},lt:function(t,r){return aV(t,r),this.s*this.n*aR.d<aR.s*aR.n*this.d},lte:function(t,r){return aV(t,r),this.s*this.n*aR.d<=aR.s*aR.n*this.d},gt:function(t,r){return aV(t,r),this.s*this.n*aR.d>aR.s*aR.n*this.d},gte:function(t,r){return aV(t,r),this.s*this.n*aR.d>=aR.s*aR.n*this.d},compare:function(t,r){aV(t,r);let i=this.s*this.n*aR.d-aR.s*aR.n*this.d;return(aP<i)-(i<aP)},ceil:function(t){return t=aL**BigInt(t||0),az(aB(this.s*t*this.n/this.d)+(t*this.n%this.d>aP&&this.s>=aP?aI:aP),t)},floor:function(t){return t=aL**BigInt(t||0),az(aB(this.s*t*this.n/this.d)-(t*this.n%this.d>aP&&this.s<aP?aI:aP),t)},round:function(t){return t=aL**BigInt(t||0),az(aB(this.s*t*this.n/this.d)+this.s*((this.s>=aP?aI:aP)+ak*(t*this.n%this.d)>this.d?aI:aP),t)},roundTo:function(t,r){aV(t,r);let i=this.n*aR.d,n=this.d*aR.n,a=i%n,o=aB(i/n);return a+a>=n&&o++,az(this.s*o*aR.n,aR.d)},divisible:function(t,r){return aV(t,r),aR.n!==aP&&this.n*aR.d%(aR.n*this.d)===aP}
1,valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(t=15){let r=this.n,i=this.d,n=function(t){for(;t%ak===aP;t/=ak);for(;t%aN===aP;t/=aN);if(t===aI)return aP;let r=aL%t,i=1;for(;r!==aI;i++)if(r=r*aL%t,i>2e3)return aP;return BigInt(i)}(i),a=function(t,r){let i=aI,n=function(t,r,i){let n=aI;for(;r>aP;t=t*t%i,r>>=aI)r&aI&&(n=n*t%i);return n}(aL,r,t);for(let r=0;r<300;r++){if(i===n)return BigInt(r);i=i*aL%t,n=n*aL%t}return 0}(i,n),o=this.s<aP?"-":"";if(o+=aB(r/i),r%=i,(r*=aL)&&(o+="."),n){for(let t=a;t--;)o+=aB(r/i),r%=i,r*=aL;o+="(";for(let t=n;t--;)o+=aB(r/i),r%=i,r*=aL;o+=")"}else for(let n=t;r&&n--;)o+=aB(r/i),r%=i,r*=aL;return o},toFraction:function(t=!1){let r=this.n,i=this.d,n=this.s<aP?"-":"";if(i===aI)n+=r;else{let a=aB(r/i);t&&a>aP&&(n+=a,n+=" ",r%=i),n+=r,n+="/",n+=i}return n},toLatex:function(t=!1){let r=this.n,i=this.d,n=this.s<aP?"-":"";if(i===aI)n+=r;else{let a=aB(r/i);t&&a>aP&&(n+=a,r%=i),n+="\\frac{",n+=r,n+="}{",n+=i,n+="}"}return n},toContinued:function(){let t=this.n,r=this.d,i=[];for(;r;){i.push(aB(t/r));let n=t%r;t=r,r=n}return i},simplify:function(t=.001){let r=BigInt(Math.ceil(1/t)),i=this.abs(),n=i.toContinued();for(let t=1;t<n.length;t++){let a=az(n[t-1],aI);for(let r=t-2;r>=0;r--)a=a.inverse().add(n[r]);let o=a.sub(i);if(o.n*r<o.d)return a.mul(this.s)}return this}};var aZ=ig("Fraction",[],()=>(Object.defineProperty(aG,"name",{value:"Fraction"}),aG.prototype.constructor=aG,aG.prototype.type="Fraction",aG.prototype.isFraction=!0,aG.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},aG.fromJSON=function(t){return new aG(t)},aG),{isClass:!0});t.s(["createFractionClass",0,aZ],928712);var aY=ig("Range",[],()=>{function t(r,i,n){if(!(this instanceof t))throw SyntaxError("Constructor must be called with the new operator");var a=null!=r,o=null!=i,s=null!=n;if(a){if(rM(r))r=r.toNumber();else if("number"!=typeof r&&!rD(r))throw TypeError("Parameter start must be a number or bigint")}if(o){if(rM(i))i=i.toNumber();else if("number"!=typeof i&&!rD(i))throw TypeError("Parameter end must be a number or bigint")}if(s){if(rM(n))n=n.toNumber();else if("number"!=typeof n&&!rD(n))throw TypeError("Parameter step must be a number or bigint")}if(this.start=a?parseFloat(r):0,this.end=o?parseFloat(i):0,this.step=s?parseFloat(n):1,s&&iV(this.step,0))throw Error("Step must not be zero")}return t.prototype.type="Range",t.prototype.isRange=!0,t.parse=function(r){if("string"!=typeof r)return null;var i=r.split(":").map(function(t){return parseFloat(t)});if(i.some(function(t){return isNaN(t)}))return null;switch(i.length){case 2:return new t(i[0],i[1]);case 3:return new t(i[0],i[2],i[1]);default:return null}},t.prototype.clone=function(){return new t(this.start,this.end,this.step)},t.prototype.size=function(){var t=0,r=this.start,i=this.step,n=this.end-r;return iM(i)===iM(n)?t=Math.ceil(n/i):0===n&&(t=0),isNaN(t)&&(t=0),[t]},t.prototype.min=function(){var t=this.size()[0];return t>0?this.step>0?this.start:this.start+(t-1)*this.step:void 0},t.prototype.max=function(){var t=this.size()[0];return t>0?this.step>0?this.start+(t-1)*this.step:this.start:void 0},t.prototype.forEach=function(t){var r=this.start,i=this.step,n=this.end,a=0;if(i>0)for(;r<n;)t(r,[a],this),r+=i,a++;else if(i<0)for(;r>n;)t(r,[a],this),r+=i,a++},t.prototype.map=function(t){var r=[];return this.forEach(function(i,n,a){r[n[0]]=t(i,n,a)}),r},t.prototype.toArray=function(){var t=[];return this.forEach(function(r,i){t[i[0]]=r}),t},t.prototype.valueOf=function(){return this.toArray()},t.prototype.format=function(t){var r=iL(this.start,t);return 1!==this.step&&(r+=":"+iL(this.step,t)),r+=":"+iL(this.end,t)},t.prototype.toString=function(){return this.format()},t.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},t.fromJSON=function(r){return new t(r.start,r.end,r.step)},t},{isClass:!0});t.s(["createRangeClass",0,aY],190368);var aX=ig("Matrix",[],()=>{function t(){if(!(this instanceof t))throw SyntaxError("Constructor must be called with the new operator")}return t.prototype.type="Matrix",t.prototype.isMatrix=!0,t.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},t.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},t.prototype.create=function(t,r){throw Error("Cannot invoke create on a Matrix interface")},t.prototype.subset=function(t,r,i){throw Error("Cannot invoke subset on a Matrix interface")},t.prototype.get=function(t){throw Error("Cannot invoke get on a Matrix interface")},t.prototype.set=function(t,r,i){throw Error("Cannot invoke set on a Matrix interface")},t.prototype.resize=function(t,r){throw Error("Cannot invoke resize on a Matrix interface")},t.prototype.reshape=function(t,r){throw Error("Cannot invoke reshape on a Matrix interface")},t.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},t.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},t.prototype.map=function(t,r){throw Error("Cannot invoke map on a Matrix interface")},t.prototype.forEach=function(t){throw Error("Cannot invoke forEach on a Matrix interface")},t.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},t.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},t.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},t.prototype.format=function(t){throw Error("Cannot invoke format on a Matrix interface")},t.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},t},{isClass:!0});function aK(t,r,i){var n=new t.constructor(2),a="";if(i){if(i<1)throw Error("size must be in greater than 0");if(!iS(i))throw Error("size must be an integer");if(t.greaterThan(n.pow(i-1).sub(1))||t.lessThan(n.pow(i-1).mul(-1)))throw Error("Value must be in range [-2^".concat(i-1,", 2^").
1concat(i-1,"-1]"));if(!t.isInteger())throw Error("Value must be an integer");t.lessThan(0)&&(t=t.add(n.pow(i))),a="i".concat(i)}switch(r){case 2:return"".concat(t.toBinary()).concat(a);case 8:return"".concat(t.toOctal()).concat(a);case 16:return"".concat(t.toHexadecimal()).concat(a);default:throw Error("Base ".concat(r," not supported "))}}function aQ(t,r){return void 0!==r?t.toExponential(r-1):t.toExponential()}function aJ(t,r){return rC(t)?t:rM(t)?t.toNumber():r}function a0(t,r){var i=function(t,r){var i;if("number"==typeof t)return iL(t,r);if(rM(t))return function(t,r){if("function"==typeof r)return r(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var i,n,a,o,s,l,u,{notation:c,precision:h,wordSize:f}=iR(r);switch(c){case"fixed":return i=t,n=h,i.toFixed(n);case"exponential":return aQ(t,h);case"engineering":return a=t,o=h,l=(s=a.e)%3==0?s:s<0?s-3-s%3:s-s%3,(u=a.mul(Math.pow(10,-l)).toPrecision(o)).includes("e")&&(u=new a.constructor(u).toFixed()),u+"e"+(s>=0?"+":"")+l.toString();case"bin":return aK(t,2,f);case"oct":return aK(t,8,f);case"hex":return aK(t,16,f);case"auto":var d=aJ(null==r?void 0:r.lowerExp,-3),p=aJ(null==r?void 0:r.upperExp,5);if(t.isZero())return"0";var m=t.toSignificantDigits(h),g=m.e;return(g>=d&&g<p?m.toFixed():aQ(t,h)).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],r=arguments[4];return"."!==t?t+r:r});default:throw Error('Unknown notation "'+c+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(t,r);if((i=t)&&"object"==typeof i&&"bigint"==typeof i.s&&"bigint"==typeof i.n&&"bigint"==typeof i.d)if(!r||"decimal"!==r.fraction)return"".concat(t.s*t.n,"/").concat(t.d);else return t.toString();if(Array.isArray(t))return function t(r,i){if(!Array.isArray(r))return a0(r,i);for(var n="[",a=r.length,o=0;o<a;o++)0!==o&&(n+=", "),n+=t(r[o],i);return n+"]"}(t,r);if(rO(t))return a1(t);if("function"==typeof t)return t.syntax?String(t.syntax):"function";if(t&&"object"==typeof t)if("function"==typeof t.format)return t.format(r);else return t&&t.toString(r)!==({}).toString()?t.toString(r):"{"+Object.keys(t).map(i=>a1(i)+": "+a0(t[i],r)).join(", ")+"}";return String(t)}(t,r);return r&&"object"==typeof r&&"truncate"in r&&i.length>r.truncate?i.substring(0,r.truncate-3)+"...":i}function a1(t){for(var r=String(t),i="",n=0;n<r.length;){var a=r.charAt(n);i+=a in a2?a2[a]:a,n++}return'"'+i+'"'}t.s(["createMatrixClass",0,aX],309491);var a2={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function a3(t){var r=String(t);return r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function a4(t,r){if(!rO(t))throw TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+iu(t)+", index: 0)");if(!rO(r))throw TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+iu(r)+", index: 1)");return t===r?0:t>r?1:-1}function a6(t){for(var r=[];Array.isArray(t);)r.push(t.length),t=t[0];return r}function a5(t,r){if(0===r.length){if(Array.isArray(t))throw new rp(t.length,0)}else!function t(r,i,n){var a,o=r.length;if(o!==i[n])throw new rp(o,i[n]);if(n<i.length-1){var s=n+1;for(a=0;a<o;a++){if(!Array.isArray(r[a]))throw new rp(i.length-1,i.length,"<");t(r[a],i,s)}}else for(a=0;a<o;a++)if(Array.isArray(r[a]))throw new rp(i.length+1,i.length,">")}(t,r,0)}function a8(t,r){var i=t.isMatrix?t._size:a6(t);r._sourceSize.forEach((t,r)=>{if(null!==t&&t!==i[r])throw new rp(t,i[r])})}function a7(t,r){if(void 0!==t){if(!rC(t)||!iS(t))throw TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof r&&t>=r)throw new rm(t,r)}}function a9(t){for(var r=0;r<t._dimensions.length;++r){var i=t._dimensions[r];if(i._data&&rN(i._data)){if(0===i._size[0])return!0}else if(i.isRange){if(i.start===i.end)return!0}else if(rO(i)&&0===i.length)return!0}return!1}function oe(t,r,i){if(!Array.isArray(r))throw TypeError("Array expected");if(0===r.length)throw Error("Resizing to scalar is not supported");return r.forEach(function(t){if(!rC(t)||!iS(t)||t<0)throw TypeError("Invalid size, must contain positive integers (size: "+a0(r)+")")}),(rC(t)||rM(t))&&(t=[t]),function t(r,i,n,a){var o,s,l=r.length,u=i[n],c=Math.min(l,u);if(r.length=u,n<i.length-1){var h=n+1;for(o=0;o<c;o++)Array.isArray(s=r[o])||(s=[s],r[o]=s),t(s,i,h,a);for(o=c;o<u;o++)s=[],r[o]=s,t(s,i,h,a)}else{for(o=0;o<c;o++)for(;Array.isArray(r[o]);)r[o]=r[o][0];for(o=c;o<u;o++)r[o]=a}}(t,r,0,void 0!==i?i:0),t}function ot(t,r){var i=oo(t,!0),n=i.length;if(!Array.isArray(t)||!Array.isArray(r))throw TypeError("Array expected");if(0===r.length)throw new rp(0,n,"!=");var a=oi(r=or(r,n));if(n!==a)throw new rp(a,n,"!=");try{return function(t,r){for(var i,n=t,a=r.length-1;a>0;a--){var o=r[a];i=[];for(var s=n.length/o,l=0;l<s;l++)i.push(n.slice(l*o,(l+1)*o));n=i}return n}(i,r)}catch(t){if(t instanceof rp)throw new rp(a,n,"!=");throw t}}function or(t,r){var i=oi(t),n=t.slice(),a=t.indexOf(-1);if(t.indexOf(-1,a+1)>=0)throw Error("More than one wildcard in sizes");if(a>=0)if(r%i==0)n[a]=-r/i;else throw Error("Could not replace wildcard, since "+r+" is no multiple of "+-i);return n}function oi(t){return t.reduce((t,r)=>t*r,1)}function on(t,r){for(var i=r||a6(t);Array.isArray(t)&&1===t.length;)t=t[0],i.shift();for(var n=i.length;1===i[n-1];)n--;return n<i.length&&(t=function t(r,i,n){var a,o;if(n<i){var s=n+1;for(a=0,o=r.length;a<o;a++)r[a]=t(r[a],i,s)}else for(;Array.isArray(r);)r=r[0];return r}(t,n,0),i.length=n),t}function oa(t,r,i,n){var a=n||a6(t);if(i)for(var o=0;o<i;o++)t=[t],a.unshift(1);for(t=function t(r,i,n){var a,o;if(Array.isArray(r)){var s=n+1;for(a=0,o=r.length;a<o;a++)r[a]=t(r[a],i,s)}else for(var l=n;l<i;l++)r=[r];return r}(t,r,0);a.length<r;)a.push(1);return t}function oo(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!Array.isArray(t))return t;if("boolean"!=typeof r)throw TypeError("Boolean expected for second argument of flatten");var i=[];return r?function t(r){if(Array.isArray(r[0]))for(var n=0;n<r.length;n++)t(r[n]);else for(var a=0;a<r.length;a++)i.push(r[a])}(t):function t(r){for(var n=0;n<r.length;n++){var a=r[n];Array.isArray(a)?t(a):i.push(a)}}(t),i}function os(t,r){return Array.prototype.map.call(t,r)}function ol(t,r){Array.prototype.forEach.call(t,r)}function ou(t,r){if(1!==a6(t).length)throw Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,r)}function oc(t,r){if(1!==a6(t).length)throw Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,t=>r.test(t))}function oh(t,r){return Array.prototype.join.call(t,r)}function of(t){if(!Array.isArray(t))throw TypeError("Array input expected");if(0===t.length)return t;var r=[],i=0;r[0]={value:t[0],identifier:0};for(var n=1;n<t.length;n++)t[n]===t[n-1]?i++:i=0,r.push({value:t[n],identifier:i});return r}function od(t){if(!Array.isArray(t))throw TypeError("Array input expected");if(0===t.length)return t;for(var r=[],i=0;i<t.length;i++)r.push(t[i].value);return r}function op(t,r){for(var i,n=0,a=0;a<t.length;a++){var o=t[a],s=Array.isArray(o);if(0===a&&s&&(n=o.length),s&&o.length!==n)return;var l=s?op(o,r):r(o);if(void 0===i)i=l;else if(i!==l)return"mixed"}return i}function om(){var t=Array.prototype.slice.call(arguments,0,-1),r=Array.prototype.slice.call(arguments,-1);if(1===t.length)return t[0];if(t.length>1)return t.slice(1).reduce(function(t,i){return function t(r,i,n,a){if(!(a<n))return r.concat(i);if(r.length!==i.length)throw new rp(r.length,i.length);for(var o=[],s=0;s<r.length;s++)o[s]=t(r[s],i[s],n,a+1);return o}(t,i,r,0)},t[0]);throw Error("Wrong number of arguments in function concat")}function og(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];for(var n=r.map(t=>t.length),a=Math.max(...n),o=Array(a).fill(null),s=0;s<r.length;s++)for(var l=r[s],u=n[s],c=0;c<u;c++){var h=a-u+c;l[c]>o[h]&&(o[h]=l[c])}for(var f=0;f<r.length;f++)oy(r[f],o);return o}function oy(t,r){for(var i=r.length,n=t.length,a=0;a<n;a++){var o=i-n+a;if(t[a]<r[o]&&t[a]>1||t[a]>r[o])throw Error("shape mismatch: mismatch is found in arg with shape (".concat(t,") not possible to broadcast dimension ").concat(n," with size ").concat(t[a]," to size ").concat(r[o]))}}function ov(t,r){var i,n,a,o=a6(t);if(id(o,r))return t;oy(o,r);var s=og(o,r),l=s.length,u=[...Array(l-o.length).fill(1),...o],c=rh([],t);
1o.length<l&&(o=a6(c=ot(c,u)));for(var h=0;h<l;h++){o[h]<s[h]&&(o=a6((i=c,n=s[h],a=h,c=om(...Array(n).fill(i),a))))}return c}function o_(t,r){if(!Array.isArray(t))throw Error("Array expected");if(!Array.isArray(r))throw Error("Array expected for index");var i=a6(t);if(r.length!==i.length)throw new rp(r.length,i.length);for(var n=0;n<r.length;n++)a7(r[n],i[n]);return r.reduce((t,r)=>t[r],t)}function ob(t,r){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0===t.length)return[];if(i)return function t(i){if(!Array.isArray(i))return r(i);for(var n=i.length,a=Array(n),o=0;o<n;o++)a[o]=t(i[o]);return a}(t);var n=[];return function i(a,o){if(!Array.isArray(a))return r(a,n.slice(0,o),t);for(var s=a.length,l=Array(s),u=0;u<s;u++)n[o]=u,l[u]=i(a[u],o+1);return l}(t,0)}function ox(t,r){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0!==t.length){if(i)return void function t(i){if(Array.isArray(i))for(var n=i.length,a=0;a<n;a++)t(i[a]);else r(i)}(t);var n=[];!function i(a,o){if(Array.isArray(a))for(var s=a.length,l=0;l<s;l++)n[o]=l,i(a[l],o+1);else r(a,n.slice(0,o),t)}(t,0)}}function ow(t,r,i,n){if(rf.default.isTypedFunction(t)){if(n)a=1;else{var a,o,s=r.isMatrix?r.size():a6(r);if(!s.length||0===s[s.length-1])return{isUnary:n,fn:t};var l=s.map(()=>0);a=function(t,r,i,n){for(var a=[r,i,n],o=3;o>0;o--){var s=a.slice(0,o);if(null!==rf.default.resolve(t,s))return o}}(t,r.isMatrix?r.get(l):o_(r,l),l,r)}if(r.isMatrix&&"mixed"!==r.dataType&&void 0!==r.dataType){var u=function(t,r){var i=[];if(Object.entries(t.signatures).forEach(t=>{var[n,a]=t;n.split(",").length===r&&i.push(a)}),1===i.length)return i[0]}(t,a);o=void 0!==u?u:t}else o=t;return a>=1&&a<=3?{isUnary:1===a,fn:function(){for(var r=arguments.length,n=Array(r),s=0;s<r;s++)n[s]=arguments[s];return oE(o,n.slice(0,a),i,t.name)}}:{isUnary:!1,fn:function(){for(var r=arguments.length,n=Array(r),a=0;a<r;a++)n[a]=arguments[a];return oE(o,n,i,t.name)}}}return void 0===n?{isUnary:function(t){if(1!==t.length)return!1;var r=t.toString();if(/arguments/.test(r))return!1;var i=r.match(/\(.*?\)/);return!/\.\.\./.test(i)}(t),fn:t}:{isUnary:n,fn:t}}function oE(t,r,i,n){try{return t(...r)}catch(t){var a,o=t,s=r,l=i,u=n;if(o instanceof TypeError&&(null==(a=o.data)?void 0:a.category)==="wrongType"){var c=[];throw c.push("value: ".concat(iu(s[0]))),s.length>=2&&c.push("index: ".concat(iu(s[1]))),s.length>=3&&c.push("array: ".concat(iu(s[2]))),TypeError("Function ".concat(l," cannot apply callback arguments ")+"".concat(u,"(").concat(c.join(", "),") at index ").concat(JSON.stringify(s[1])))}throw TypeError("Function ".concat(l," cannot apply callback arguments ")+"to function ".concat(u,": ").concat(o.message))}}var oT=ig("DenseMatrix",["Matrix","config"],t=>{var{Matrix:r,config:i}=t;function n(t,r){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");if(r&&!rO(r))throw Error("Invalid datatype: "+r);if(rL(t))"DenseMatrix"===t.type?(this._data=ic(t._data),this._size=ic(t._size)):(this._data=t.toArray(),this._size=t.size()),this._datatype=r||t._datatype;else if(t&&rN(t.data)&&rN(t.size))this._data=t.data,this._size=t.size,a5(this._data,this._size),this._datatype=r||t.datatype;else if(rN(t))this._data=function t(r){return rL(r)?t(r.valueOf()):rN(r)?r.map(t):r}(t),this._size=a6(this._data),a5(this._data,this._size),this._datatype=r;else if(t)throw TypeError("Unsupported type of data ("+iu(t)+")");else this._data=[],this._size=[0],this._datatype=r}function a(t,r,i){if(0===r.length){for(var n=t._data;rN(n);)n=n[0];return n}return t._size=r.slice(0),t._data=oe(t._data,t._size,i),t}function o(t,r,i){for(var n=t._size.slice(0),o=!1;n.length<r.length;)n.push(0),o=!0;for(var s=0,l=r.length;s<l;s++)r[s]>n[s]&&(n[s]=r[s],o=!0);o&&a(t,n,i)}return n.prototype=new r,n.prototype.createDenseMatrix=function(t,r){return new n(t,r)},Object.defineProperty(n,"name",{value:"DenseMatrix"}),n.prototype.constructor=n,n.prototype.type="DenseMatrix",n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return op(this._data,iu)},n.prototype.storage=function(){return"dense"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(t,r){return new n(t,r)},n.prototype.subset=function(t,r,a){switch(arguments.length){case 1:return function(t,r){if(!rj(r))throw TypeError("Invalid index");if(i.legacySubset?r.size().every(t=>1===t):r.isScalar())return t.get(r.min());var a,o,s,l,u=r.size();if(u.length!==t._size.length)throw new rp(u.length,t._size.length);for(var c=r.min(),h=r.max(),f=0,d=t._size.length;f<d;f++)a7(c[f],t._size[f]),a7(h[f],t._size[f]);var p=new n,m=(a=t._data,l=Array(s=(o=r).size().length-1),{data:function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=o.dimension(i);function a(t,r){return rC(t)?r(t):t.map(r).valueOf()}return(rC(n)?l[i]=null:l[i]=n.size()[0],i<s)?a(n,n=>(a7(n,r.length),t(r[n],i+1))):a(n,t=>(a7(t,r.length),r[t]))}(a),size:l.filter(t=>null!==t)});return p._size=m.size,p._datatype=t._datatype,p._data=m.data,i.legacySubset?p.reshape(r.size()):p}(this,t);case 2:case 3:return function(t,r,i,n){if(!r||!0!==r.isIndex)throw TypeError("Invalid index");var a,s=r.size(),l=r.isScalar();if(rL(i)?(a=i.size(),i=i.valueOf()):a=a6(i),l){if(0!==a.length)throw TypeError("Scalar expected");t.set(r.min(),i,n)}else{if(!id(a,s)){if(0===a.length)i=ov([i],s);else try{i=ov(i,s)}catch(t){}a=a6(i)}if(s.length<t._size.length)throw new rp(s.length,t._size.length,"<");if(a.length<s.length){for(var u,c,h,f,d=0,p=0;1===s[d]&&1===a[d];)d++;for(;1===s[d];)p++,d++;i=oa(i,s.length,p,a)}if(!id(s,a))throw new rp(s,a,">");o(t,r.max().map(function(t){return t+1}),n),u=t._data,c=r,h=i,f=c.size().length-1,function t(r,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=c.dimension(n),o=(a,o)=>{a7(a,r.length),t(r[a],i[o[0]],n+1)},s=(t,n)=>{a7(t,r.length),r[t]=i[n[0]]};
1n<f?rC(a)?o(a,[0]):a.forEach(o):rC(a)?s(a,[0]):a.forEach(s)}(u,h)}return t}(this,t,r,a);default:throw SyntaxError("Wrong number of arguments")}},n.prototype.get=function(t){return o_(this._data,t)},n.prototype.set=function(t,r,i){if(!rN(t))throw TypeError("Array expected");if(t.length<this._size.length)throw new rp(t.length,this._size.length,"<");o(this,t.map(function(t){return t+1}),i);var n,a,s,l=this._data;for(n=0,a=t.length-1;n<a;n++)a7(s=t[n],l.length),l=l[s];return a7(s=t[t.length-1],l.length),l[s]=r,this},n.prototype.resize=function(t,r,i){if(!rR(t))throw TypeError("Array or Matrix expected");var n=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);return a(i?this.clone():this,n,r)},n.prototype.reshape=function(t,r){var i=r?this.clone():this;i._data=ot(i._data,t);var n=i._size.reduce((t,r)=>t*r);return i._size=or(t,n),i},n.prototype.clone=function(){return new n({data:ic(this._data),size:ic(this._size),datatype:this._datatype})},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this,n=i._size.length-1;if(n<0)return i.clone();var a=ow(t,i,"map",r),o=a.fn,s=i.create(void 0,i._datatype);if(s._size=i._size,r||a.isUnary)return s._data=function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=Array(r.length);if(i<n)for(var s=0;s<r.length;s++)a[s]=t(r[s],i+1);else for(var l=0;l<r.length;l++)a[l]=o(r[l]);return a}(i._data),s;if(0===n){for(var l=i.valueOf(),u=Array(l.length),c=0;c<l.length;c++)u[c]=o(l[c],[c],i);return s._data=u,s}var h=[];return s._data=function t(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=Array(r.length);if(a<n)for(var l=0;l<r.length;l++)h[a]=l,s[l]=t(r[l],a+1);else for(var u=0;u<r.length;u++)h[a]=u,s[u]=o(r[u],h.slice(),i);return s}(i._data),s},n.prototype.forEach=function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this,n=i._size.length-1;if(!(n<0)){var a=ow(t,i,"map",r),o=a.fn;if(r||a.isUnary)return void function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(i<n)for(var a=0;a<r.length;a++)t(r[a],i+1);else for(var s=0;s<r.length;s++)o(r[s])}(i._data);if(0===n){for(var s=0;s<i._data.length;s++)o(i._data[s],[s],i);return}var l=[];!function t(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(a<n)for(var s=0;s<r.length;s++)l[a]=s,t(r[s],a+1);else for(var u=0;u<r.length;u++)l[a]=u,o(r[u],l.slice(),i)}(i._data)}},n.prototype[Symbol.iterator]=function*(){var t=this._size.length-1;if(!(t<0)){if(0===t){for(var r=0;r<this._data.length;r++)yield{value:this._data[r],index:[r]};return}for(var i=Array(t+1).fill(0),n=this._size.reduce((t,r)=>t*r,1),a=0;a<n;a++){for(var o=this._data,s=0;s<t;s++)o=o[i[s]];yield{value:o[i[t]],index:i.slice()};for(var l=t;l>=0&&(i[l]++,!(i[l]<this._size[l]));l--)i[l]=0}}},n.prototype.rows=function(){var t=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var r of this._data)t.push(new n([r],this._datatype));return t},n.prototype.columns=function(){var t=this,r=[],i=this.size();if(2!==i.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var a=this._data,o=function(i){var o=a.map(t=>[t[i]]);r.push(new n(o,t._datatype))},s=0;s<i[1];s++)o(s);return r},n.prototype.toArray=function(){return ic(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(t){return a0(this._data,t)},n.prototype.toString=function(){return a0(this._data)},n.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(t){if(t){if(rM(t)&&(t=t.toNumber()),!rC(t)||!iS(t))throw TypeError("The parameter k must be an integer number")}else t=0;for(var r=t>0?t:0,i=t<0?-t:0,a=Math.min(this._size[0]-i,this._size[1]-r),o=[],s=0;s<a;s++)o[s]=this._data[s+i][s+r];return new n({data:o,size:[a],datatype:this._datatype})},n.diagonal=function(t,r,i,a){if(!rN(t))throw TypeError("Array expected, size parameter");if(2!==t.length)throw Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(rM(t)&&(t=t.toNumber()),!rC(t)||!iS(t)||t<1)throw Error("Size values must be positive integers");return t}),i){if(rM(i)&&(i=i.toNumber()),!rC(i)||!iS(i))throw TypeError("The parameter k must be an integer number")}else i=0;var o,s=i>0?i:0,l=i<0?-i:0,u=t[0],c=t[1],h=Math.min(u-l,c-s);if(rN(r)){if(r.length!==h)throw Error("Invalid value array length");o=function(t){return r[t]}}else if(rL(r)){var f=r.size();if(1!==f.length||f[0]!==h)throw Error("Invalid matrix length");o=function(t){return r.get([t])}}else o=function(){return r};a||(a=rM(o(0))?o(0).mul(0):0);var d=[];if(t.length>0){d=oe(d,t,a);for(var p=0;p<h;p++)d[p+l][p+s]=o(p)}return new n({data:d,size:[u,c]})},n.fromJSON=function(t){return new n(t)}
1,n.prototype.swapRows=function(t,r){if(!rC(t)||!iS(t)||!rC(r)||!iS(r))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return a7(t,this._size[0]),a7(r,this._size[0]),n._swapRows(t,r,this._data),this},n._swapRows=function(t,r,i){var n=i[t];i[t]=i[r],i[r]=n},n},{isClass:!0});t.s(["createDenseMatrixClass",0,oT],70528);var oA="clone",oS=ig(oA,["typed"],t=>{var{typed:r}=t;return r(oA,{any:ic})});function oC(t){var r,i,n=t.length,a=t[0].length,o=[];for(i=0;i<a;i++){var s=[];for(r=0;r<n;r++)s.push(t[r][i]);o.push(s)}return o}function oM(t){for(var r=0;r<t.length;r++)if(rR(t[r]))return!0;return!1}function oD(t,r){rL(t)?t.forEach(t=>r(t),!1,!0):ox(t,r,!0)}function oP(t,r,i){if(!i)if(rL(t))return t.map(t=>r(t),!1,!0);else return ob(t,r,!0);var n=t=>0===t?t:r(t);return rL(t)?t.map(t=>n(t),!1,!0):ob(t,n,!0)}function oI(t,r,i){var n=Array.isArray(t)?a6(t):t.size();if(r<0||r>=n.length)throw new rm(r,n.length);return rL(t)?t.create(ok(t.valueOf(),r,i),t.datatype()):ok(t,r,i)}function ok(t,r,i){var n,a,o,s;if(r<=0)if(Array.isArray(t[0])){for(s=oC(t),a=[],n=0;n<s.length;n++)a[n]=ok(s[n],r-1,i);return a}else{for(o=t[0],n=1;n<t.length;n++)o=i(o,t[n]);return o}for(n=0,a=[];n<t.length;n++)a[n]=ok(t[n],r-1,i);return a}function oO(t,r,i,n,a,o,s,l,u,c,h){var f,d,p,m,g=t._values,y=t._index,v=t._ptr;if(n)for(d=v[r],p=v[r+1],f=d;f<p;f++)i[m=y[f]]!==o?(i[m]=o,s.push(m),c?(n[m]=u?l(g[f],h):l(h,g[f]),a[m]=o):n[m]=g[f]):(n[m]=u?l(g[f],n[m]):l(n[m],g[f]),a[m]=o);else for(d=v[r],p=v[r+1],f=d;f<p;f++)i[m=y[f]]!==o?(i[m]=o,s.push(m)):a[m]=o}t.s(["createClone",0,oS],644260);var oN="isInteger",oL=ig(oN,["typed","equal"],t=>{var{typed:r,equal:i}=t;return r(oN,{number:t=>!!Number.isFinite(t)&&i(t,Math.round(t)),BigNumber:t=>!!t.isFinite()&&i(t.round(),t),bigint:t=>!0,Fraction:t=>1n===t.d,"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createIsInteger",0,oL],450076);var oR="number";function oF(t){return Number.isNaN(t)}function oB(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;
1if(i<=0)throw Error("Relative tolerance must be greater than 0");if(n<0)throw Error("Absolute tolerance must be at least 0");return!(t.isNaN()||r.isNaN())&&(t.isFinite()&&r.isFinite()?!!t.eq(r)||t.minus(r).abs().lte(t.constructor.max(t.constructor.max(t.abs(),r.abs()).mul(i),n)):t.eq(r))}oF.signature=oR;var oz="isNegative",oj=ig(oz,["typed","config"],t=>{var{typed:r,config:i}=t;return r(oz,{number:t=>!iV(t,0,i.relTol,i.absTol)&&t<0,BigNumber:t=>!oB(t,new t.constructor(0),i.relTol,i.absTol)&&t.isNeg()&&!t.isZero()&&!t.isNaN(),bigint:t=>t<0n,Fraction:t=>t.s<0n,Unit:r.referToSelf(t=>i=>r.find(t,i.valueType())(i.value)),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createIsNegative",0,oj],431237);var oU="isNumeric",oV=ig(oU,["typed"],t=>{var{typed:r}=t;return r(oU,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createIsNumeric",0,oV],760339);var o$="hasNumericValue",oG=ig(o$,["typed","isNumeric"],t=>{var{typed:r,isNumeric:i}=t;return r(o$,{boolean:()=>!0,string:function(t){return t.trim().length>0&&!isNaN(Number(t))},any:function(t){return i(t)}})});t.s(["createHasNumericValue",0,oG],825148);var oq="isPositive",oH=ig(oq,["typed","config"],t=>{var{typed:r,config:i}=t;return r(oq,{number:t=>!iV(t,0,i.relTol,i.absTol)&&t>0,BigNumber:t=>!oB(t,new t.constructor(0),i.relTol,i.absTol)&&!t.isNeg()&&!t.isZero()&&!t.isNaN(),bigint:t=>t>0n,Fraction:t=>t.s>0n&&t.n>0n,Unit:r.referToSelf(t=>i=>r.find(t,i.valueType())(i.value)),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createIsPositive",0,oH],862396);var oW="isZero",oZ=ig(oW,["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return r(oW,{"number | BigNumber | Complex | Fraction":t=>i(t,0),bigint:t=>0n===t,Unit:r.referToSelf(t=>i=>r.find(t,i.valueType())(i.value)),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createIsZero",0,oZ],839997);var oY="isNaN",oX=ig(oY,["typed"],t=>{var{typed:r}=t;return r(oY,{number:oF,BigNumber:function(t){return t.isNaN()},bigint:function(t){return!1},Fraction:function(t){return!1},Complex:function(t){return t.isNaN()},Unit:function(t){return Number.isNaN(t.value)},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createIsNaN",0,oX],215340);var oK="isBounded",oQ=ig(oK,["typed"],t=>{var{typed:r}=t;return r(oK,{number:t=>Number.isFinite(t),"BigNumber | Complex":t=>t.isFinite(),"bigint | Fraction":()=>!0,"null | undefined":()=>!1,Unit:r.referToSelf(t=>r=>t(r.value)),"Array | Matrix":r.referToSelf(t=>r=>(Array.isArray(r)||(r=r.valueOf()),r.every(r=>t(r))))})});t.s(["createIsBounded",0,oQ],709516);var oJ="isFinite",o0=ig(oJ,["typed","isBounded","map"],t=>{var{typed:r,isBounded:i,map:n}=t;return r(oJ,{"Array | Matrix":t=>n(t,i),any:t=>i(t)})});t.s(["createIsFinite",0,o0],962991);var o1="typeOf",o2=ig(o1,["typed"],t=>{var{typed:r}=t;return r(o1,{any:iu})});t.s(["createTypeOf",0,o2],263545);var o3=ig("compareUnits",["typed"],t=>{var{typed:r}=t;return{"Unit, Unit":r.referToSelf(t=>(i,n)=>{if(!i.equalBase(n))throw Error("Cannot compare units with different base");return r.find(t,[i.valueType(),n.valueType()])(i.value,n.value)})}}),o4="equalScalar",o6=ig(o4,["typed","config"],t=>{var{typed:r,config:i}=t,n=o3({typed:r});return r(o4,{"boolean, boolean":function(t,r){return t===r},"number, number":function(t,r){return iV(t,r,i.relTol,i.absTol)},"BigNumber, BigNumber":function(t,r){return t.eq(r)||oB(t,r,i.relTol,i.absTol)},"bigint, bigint":function(t,r){return t===r},"Fraction, Fraction":function(t,r){return t.equals(r)},"Complex, Complex":function(t,r){var n,a;return n=i.relTol,a=i.absTol,iV(t.re,r.re,n,a)&&iV(t.im,r.im,n,a)}},n)});ig(o4,["typed","config"],t=>{var{typed:r,config:i}=t;return r(o4,{"number, number":function(t,r){return iV(t,r,i.relTol,i.absTol)}})}),t.s(["createEqualScalar",0,o6],328815);var o5=ig("SparseMatrix",["typed","equalScalar","Matrix"],t=>{var{typed:r,equalScalar:i,Matrix:n}=t;function a(t,r){if(!(this instanceof a))throw SyntaxError("Constructor must be called with the new operator");if(r&&!rO(r))throw Error("Invalid datatype: "+r);if(rL(t)){var i,n,s;i=this,n=t,s=r,"SparseMatrix"===n.type?(i._values=n._values?ic(n._values):void 0,i._index=ic(n._index),i._ptr=ic(n._ptr),i._size=ic(n._size),i._datatype=s||n._datatype):o(i,n.valueOf(),s||n._datatype)}else if(t&&rN(t.index)&&rN(t.ptr)&&rN(t.size))this._values=t.values,this._index=t.index,this._ptr=t.ptr,this._size=t.size,this._datatype=r||t.datatype;else if(rN(t))o(this,t,r);else if(t)throw TypeError("Unsupported type of data ("+iu(t)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=r}function o(t,n,a){t._values=[],t._index=[],t._ptr=[],t._datatype=a;var o=n.length,s=0,l=i,u=0;if(rO(a)&&(l=r.find(i,[a,a])||i,u=r.convert(0,a)),o>0){var c=0;do{t._ptr.push(t._index.length);for(var h=0;h<o;h++){var f=n[h];if(rN(f)){if(0===c&&s<f.length&&(s=f.length),c<f.length){var d=f[c];l(d,u)||(t._values.push(d),t._index.push(h))}}else 0===c&&s<1&&(s=1),l(f,u)||(t._values.push(f),t._index.push(h))}c++}while(c<s)}for(;t._ptr.length<=s;)t._ptr.push(t._index.length);t._size=[o,s]}function s(t,r,i,n){if(i-r==0)return i;for(var a=r;a<i;a++)if(n[a]===t)return a;return r}function l(t,r,i,n,a,o,s){a.splice(t,0,n),o.splice(t,0,r);for(var l=i+1;l<s.length;l++)s[l]++}function u(t,n,a,o){var s,l,u,c=o||0,h=i,f=0;rO(t._datatype)&&(h=r.find(i,[t._datatype,t._datatype])||i,f=r.convert(0,t._datatype),c=r.convert(c,t._datatype));var d=!h(c,f),p=t._size[0],m=t._size[1];if(a>m){for(l=m;l<a;l++)if(t._ptr[l]=t._values.length,d)for(s=0;s<p;s++)t._values.push(c),t._index.push(s);t._ptr[a]=t._values.length}else a<m&&(t._ptr.splice(a+1,m-a),t._values.splice(t._ptr[a],t._values.length),t._index.splice(t._ptr[a],t._index.length));if(m=a,n>p){if(d){var g=0;for(l=0;l<m;l++){t._ptr[l]=t._ptr[l]+g,u=t._ptr[l+1]+g;var y=0;for(s=p;s<n;s++,y++)t._values.splice(u+y,0,c),t._index.splice(u+y,0,s),g++}t._ptr[m]=t._values.length}}else if(n<p){var v=0;for(l=0;l<m;l++){t._ptr[l]=t._ptr[l]-v;var _=t._ptr[l],b=t._ptr[l+1]-v;for(u=_;u<b;u++)(s=t._index[u])>n-1&&(t._values.splice(u,1),t._index.splice(u,1),v++)}t._ptr[l]=t._values.length}return t._size[0]=n,t._size[1]=a,t}function c(t,r,i,n,a){var o,s,l=n[0],u=n[1],c=[];for(o=0;o<l;o++)for(c[o]=[],s=0;s<u;s++)c[o][s]=0;for(s=0;s<u;s++)for(var h=i[s],f=i[s+1],d=h;d<f;d++)c[o=r[d]][s]=t?a?ic(t[d]):t[d]:1;return c}return a.prototype=new n,a.prototype.createSparseMatrix=function(t,r){return new a(t,r)},Object.defineProperty(a,"name",{value:"SparseMatrix"}),a.prototype.constructor=a,a.prototype.type="SparseMatrix",a.prototype.isSparseMatrix=!0,a.prototype.getDataType=function(){return op(this._values,iu)},a.prototype.storage=function(){return"sparse"},a.prototype.datatype=function(){return this._datatype},a.prototype.create=function(t,r){return new a(t,r)},a.prototype.density=function(){var t=this._size[0],r=this._size[1];return 0!==t&&0!==r?this._index.length/(t*r):0},a.prototype.subset=function(t,r,i){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(t,r){if(!rj(r))throw TypeError("Invalid index");if(r.isScalar())return t.get(r.min());var i,n,o,s,l=r.size();if(l.length!==t._size.length)throw new rp(l.length,t._size.length);var u=r.min(),c=r.max();for(i=0,n=t._size.length;i<n;i++)a7(u[i],t._size[i]),a7(c[i],t._size[i]);var h=t._values,f=t._index,d=t._ptr,p=r.dimension(0),m=r.dimension(1),g=[],y=[];function v(t,r){y[t]=r[0],g[t]=!0}
1Number.isInteger(p)?v(p,[0]):p.forEach(v);var _=h?[]:void 0,b=[],x=[];function w(t){for(x.push(b.length),o=d[t],s=d[t+1];o<s;o++)!0===g[i=f[o]]&&(b.push(y[i]),_&&_.push(h[o]))}return Number.isInteger(m)?w(m):m.forEach(w),x.push(b.length),new a({values:_,index:b,ptr:x,size:l,datatype:t._datatype})}(this,t);case 2:case 3:return function(t,r,i,n){if(!r||!0!==r.isIndex)throw TypeError("Invalid index");var a,o=r.size(),s=r.isScalar();if(rL(i)?(a=i.size(),i=i.toArray()):a=a6(i),s){if(0!==a.length)throw TypeError("Scalar expected");t.set(r.min(),i,n)}else{if(1!==o.length&&2!==o.length)throw new rp(o.length,t._size.length,"<");if(a.length<o.length){for(var l=0,u=0;1===o[l]&&1===a[l];)l++;for(;1===o[l];)u++,l++;i=oa(i,o.length,u,a)}if(!id(o,a))throw new rp(o,a,">");if(1===o.length)f(r.dimension(0),(r,a)=>{a7(r),t.set([r,0],i[a[0]],n)});else{var c=r.dimension(0),h=r.dimension(1);f(c,(r,a)=>{a7(r),f(h,(o,s)=>{a7(o),t.set([r,o],i[a[0]][s[0]],n)})})}}return t;function f(t,r){rC(t)?r(t,[0]):t.forEach(r)}}(this,t,r,i);default:throw SyntaxError("Wrong number of arguments")}},a.prototype.get=function(t){if(!rN(t))throw TypeError("Array expected");if(t.length!==this._size.length)throw new rp(t.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var r=t[0],i=t[1];a7(r,this._size[0]),a7(i,this._size[1]);var n=s(r,this._ptr[i],this._ptr[i+1],this._index);return n<this._ptr[i+1]&&this._index[n]===r?this._values[n]:0},a.prototype.set=function(t,n,a){if(!rN(t))throw TypeError("Array expected");if(t.length!==this._size.length)throw new rp(t.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var o=t[0],c=t[1],h=this._size[0],f=this._size[1],d=i,p=0;rO(this._datatype)&&(d=r.find(i,[this._datatype,this._datatype])||i,p=r.convert(0,this._datatype)),(o>h-1||c>f-1)&&(u(this,Math.max(o+1,h),Math.max(c+1,f),a),h=this._size[0],f=this._size[1]),a7(o,h),a7(c,f);var m=s(o,this._ptr[c],this._ptr[c+1],this._index);return m<this._ptr[c+1]&&this._index[m]===o?d(n,p)?function(t,r,i,n,a){i.splice(t,1),n.splice(t,1);for(var o=r+1;o<a.length;o++)a[o]--}(m,c,this._values,this._index,this._ptr):this._values[m]=n:d(n,p)||l(m,o,c,n,this._values,this._index,this._ptr),this},a.prototype.resize=function(t,r,i){if(!rR(t))throw TypeError("Array or Matrix expected");var n=t.valueOf().map(t=>Array.isArray(t)&&1===t.length?t[0]:t);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(t){if(!rC(t)||!iS(t)||t<0)throw TypeError("Invalid size, must contain positive integers (size: "+a0(n)+")")}),u(i?this.clone():this,n[0],n[1],r)},a.prototype.reshape=function(t,r){if(!rN(t))throw TypeError("Array expected");if(2!==t.length)throw Error("Sparse matrices can only be reshaped in two dimensions");t.forEach(function(r){if(!rC(r)||!iS(r)||r<=-2||0===r)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+a0(t)+")")});var i=this._size[0]*this._size[1],n=(t=or(t,i))[0]*t[1];if(i!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var a=r?this.clone():this;if(this._size[0]===t[0]&&this._size[1]===t[1])return a;for(var o=[],u=0;u<a._ptr.length;u++)for(var c=0;c<a._ptr[u+1]-a._ptr[u];c++)o.push(u);for(var h=a._values.slice(),f=a._index.slice(),d=0;d<a._index.length;d++){var p=f[d],m=o[d],g=p*a._size[1]+m;o[d]=g%t[1],f[d]=Math.floor(g/t[1])}a._values.length=0,a._index.length=0,a._ptr.length=t[1]+1,a._size=t.slice();for(var y=0;y<a._ptr.length;y++)a._ptr[y]=0;for(var v=0;v<h.length;v++){var _=f[v],b=o[v],x=h[v];l(s(_,a._ptr[b],a._ptr[b+1],a._index),_,b,x,a._values,a._index,a._ptr)}return a},a.prototype.clone=function(){return new a({values:this._values?ic(this._values):void 0,index:ic(this._index),ptr:ic(this._ptr),size:ic(this._size),datatype:this._datatype})},a.prototype.size=function(){return this._size.slice(0)},a.prototype.map=function(t,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var o=this,s=this._size[0],l=this._size[1],u=ow(t,o,"map");return function(t,n,o,s,l){var u=[],c=[],h=[],f=i,d=0;rO(t._datatype)&&(f=r.find(i,[t._datatype,t._datatype])||i,d=r.convert(0,t._datatype));for(var p=function(t,r,i){var n=s(t,r,i);f(n,d)||(u.push(n),c.push(r))},m=0;m<=o;m++){h.push(u.length);var g=t._ptr[m],y=t._ptr[m+1];if(l)for(var v=g;v<y;v++){var _=t._index[v];_>=0&&_<=n&&p(t._values[v],_-0,m-0)}else{for(var b={},x=g;x<y;x++)b[t._index[x]]=t._values[x];for(var w=0;w<=n;w++)p(w in b?b[w]:0,w-0,m-0)}}return h.push(u.length),new a({values:u,index:c,ptr:h,size:[n-0+1,o-0+1]})}(this,s-1,l-1,function(t,r,i){return u.fn(t,[r,i],o)},n)},a.prototype.forEach=function(t,r){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var i=this._size[0],n=this._size[1],a=ow(t,this,"forEach"),o=0;o<n;o++){var s=this._ptr[o],l=this._ptr[o+1];if(r)for(var u=s;u<l;u++){var c=this._index[u];a.fn(this._values[u],[c,o],this)}else{for(var h={},f=s;f<l;f++)h[this._index[f]]=this._values[f];for(var d=0;d<i;d++){var p=d in h?h[d]:0;a.fn(p,[d,o],this)}}}},a.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var t=this._size[1],r=0;r<t;r++)for(var i=this._ptr[r],n=this._ptr[r+1],a=i;a<n;a++){var o=this._index[a];yield{value:this._values[a],index:[o,r]}}},a.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},a.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},a.prototype.format=function(t){for(var r=this._size[0],i=this._size[1],n=this.density(),a="Sparse Matrix ["+a0(r,t)+" x "+a0(i,t)+"] density: "+a0(n,t)+"\n",o=0;o<i;o++)for(var s=this._ptr[o],l=this._ptr[o+1],u=s;u<l;u++)a+="\n ("+a0(this._index[u],t)+", "+a0(o,t)+") ==> "+(this._values?a0(this._values[u],t):"X");return a},a.prototype.toString=function(){return a0(this.toArray())},a.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},a.prototype.diagonal=function(t){if(t){if(rM(t)&&(t=t.toNumber()),!rC(t)||!iS(t))throw TypeError("The parameter k must be an integer number")}else t=0;var r=t>0?t:0,i=t<0?-t:0,n=this._size[0],o=this._size[1],s=Math.min(n-i,o-r),l=[],u=[],c=[];c[0]=0;for(var h=r;h<o&&l.length<s;h++)for(var f=this._ptr[h],d=this._ptr[h+1],p=f;p<d;p++){var m=this._index[p];if(m===h-r+i){l.push(this._values[p]),u[l.length-1]=m-i;break}}return c.push(l.length),new a({values:l,index:u,ptr:c,size:[s,1]})},a.fromJSON=function(t){return new a(t)},a.diagonal=function(t,n,o,s,l){if(!rN(t))throw TypeError("Array expected, size parameter");if(2!==t.length)throw Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(rM(t)&&(t=t.toNumber()),!rC(t)||!iS(t)||t<1)throw Error("Size values must be positive integers");return t}),o){if(rM(o)&&(o=o.toNumber()),!rC(o)||!iS(o))throw TypeError("The parameter k must be an integer number")}else o=0;var u,c=i,h=0;rO(l)&&(c=r.find(i,[l,l])||i,h=r.convert(0,l));var f=o>0?o:0,d=o<0?-o:0,p=t[0],m=t[1],g=Math.min(p-d,m-f);if(rN(n)){if(n.length!==g)throw Error("Invalid value array length");u=function(t){return n[t]}}else if(rL(n)){var y=n.size();if(1!==y.length||y[0]!==g)throw Error("Invalid matrix length");u=function(t){return n.get([t])}}else u=function(){return n};for(var v=[],_=[],b=[],x=0;x<m;x++){b.push(v.length);var w=x-f;if(w>=0&&w<g){var E=u(w);c(E,h)||(_.push(w+d),v.push(E))}}return b.push(v.length),new a({values:v,index:_,ptr:b,size:[p,m]})}
1,a.prototype.swapRows=function(t,r){if(!rC(t)||!iS(t)||!rC(r)||!iS(r))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return a7(t,this._size[0]),a7(r,this._size[0]),a._swapRows(t,r,this._size[1],this._values,this._index,this._ptr),this},a._forEachRow=function(t,r,i,n,a){for(var o=n[t],s=n[t+1],l=o;l<s;l++)a(i[l],r[l])},a._swapRows=function(t,r,i,n,a,o){for(var l=0;l<i;l++){var u=o[l],c=o[l+1],h=s(t,u,c,a),f=s(r,u,c,a);if(h<c&&f<c&&a[h]===t&&a[f]===r){if(n){var d=n[h];n[h]=n[f],n[f]=d}continue}if(h<c&&a[h]===t&&(f>=c||a[f]!==r)){var p=n?n[h]:void 0;a.splice(f,0,r),n&&n.splice(f,0,p),a.splice(f<=h?h+1:h,1),n&&n.splice(f<=h?h+1:h,1);continue}if(f<c&&a[f]===r&&(h>=c||a[h]!==t)){var m=n?n[f]:void 0;a.splice(h,0,t),n&&n.splice(h,0,m),a.splice(h<=f?f+1:f,1),n&&n.splice(h<=f?f+1:f,1)}}},a},{isClass:!0});t.s(["createSparseMatrixClass",0,o5],350774);var o8=ig("number",["typed"],t=>{var{typed:r}=t,i=r("number",{"":function(){return 0},number:function(t){return t},string:function(t){if("NaN"===t)return NaN;var r=function(t){var r=t.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(!r)return null;var i={"0b":2,"0o":8,"0x":16}[r[1]];return{input:t,radix:i,integerPart:r[2],fractionalPart:r[3]}}(t);if(r){for(var i=parseInt(r.integerPart,r.radix),n=0,a=0;a<r.fractionalPart.length;a++)n+=parseInt(r.fractionalPart[a],r.radix)/Math.pow(r.radix,a+1);var o=i+n;if(isNaN(o))throw SyntaxError('String "'+r.input+'" is not a valid number');return o}var s=0,l=t.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);l&&(s=Number(l[2]),t=l[1]);var u=Number(t);if(isNaN(u))throw SyntaxError('String "'+t+'" is not a valid number');if(l){if(u>2**s-1)throw SyntaxError('String "'.concat(t,'" is out of range'));u>=2**(s-1)&&(u-=2**s)}return u},BigNumber:function(t){return t.toNumber()},bigint:function(t){return Number(t)},Fraction:function(t){return t.valueOf()},Unit:r.referToSelf(t=>r=>{var i=r.clone();return i.value=t(r.value),i}),null:function(t){return 0},"Unit, string | Unit":function(t,r){return t.toNumber(r)},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))});return i.fromJSON=function(t){return parseFloat(t.value)},i});t.s(["createNumber",0,o8],875099);var o7=ig("bigint",["typed"],t=>{var{typed:r}=t,i=r("bigint",{"":function(){return 0n},bigint:function(t){return t},number:function(t){return BigInt(t.toFixed())},BigNumber:function(t){return BigInt(t.round().toString())},Fraction:function(t){return BigInt(t.valueOf().toFixed())},"string | boolean":function(t){return BigInt(t)},null:function(t){return 0n},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))});return i.fromJSON=function(t){return BigInt(t.value)},i});t.s(["createBigint",0,o7],245104);var o9="string",se=ig(o9,["typed"],t=>{var{typed:r}=t;return r(o9,{"":function(){return""},number:iL,null:function(t){return"null"},boolean:function(t){return t+""},string:function(t){return t},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t)),any:function(t){return String(t)}})});t.s(["createString",0,se],300497);var st="boolean",sr=ig(st,["typed"],t=>{var{typed:r}=t;return r(st,{"":function(){return!1},boolean:function(t){return t},number:function(t){return!!t},null:function(t){return!1},BigNumber:function(t){return!t.isZero()},string:function(t){var r=t.toLowerCase();if("true"===r)return!0;if("false"===r)return!1;var i=Number(t);if(""!==t&&!isNaN(i))return!!i;throw Error('Cannot convert "'+t+'" to a boolean')},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createBoolean",0,sr],200232);var si=ig("bignumber",["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t;return r("bignumber",{"":function(){return new i(0)},number:function(t){return new i(t+"")},string:function(t){var r=t.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(r){var n=r[2],a=i(r[1]),o=new i(2).pow(Number(n));if(a.gt(o.sub(1)))throw SyntaxError('String "'.concat(t,'" is out of range'));var s=new i(2).pow(Number(n)-1);return a.gte(s)?a.sub(o):a}return new i(t)},BigNumber:function(t){return t},bigint:function(t){return new i(t.toString())},Unit:r.referToSelf(t=>r=>{var i=r.clone();return i.value=t(r.value),i}),Fraction:function(t){return new i(String(t.n)).div(String(t.d)).times(String(t.s))},null:function(t){return new i(0)},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createBignumber",0,si],788870);var sn=ig("complex",["typed","Complex"],t=>{var{typed:r,Complex:i}=t;return r("complex",{"":function(){return i.ZERO},number:function(t){return new i(t,0)},"number, number":function(t,r){return new i(t,r)},"BigNumber, BigNumber":function(t,r){return new i(t.toNumber(),r.toNumber())},Fraction:function(t){return new i(t.valueOf(),0)},Complex:function(t){return t.clone()},string:function(t){return i(t)},null:function(t){return i(0)},Object:function(t){if("re"in t&&"im"in t)return new i(t.re,t.im);if("r"in t&&"phi"in t||"abs"in t&&"arg"in t)return new i(t);throw Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createComplex",0,sn],501388);var sa=ig("fraction",["typed","Fraction"],t=>{var{typed:r,Fraction:i}=t;return r("fraction",{number:function(t){if(!Number.isFinite(t)||isNaN(t))throw Error(t+" cannot be represented as a fraction");return new i(t)},string:function(t){return new i(t)},"number, number":function(t,r){return new i(t,r)},"bigint, bigint":function(t,r){return new i(t,r)},null:function(t){return new i(0)},BigNumber:function(t){return new i(t.toString())},bigint:function(t){return new i(t.toString())},Fraction:function(t){return t},Unit:r.referToSelf(t=>r=>{var i=r.clone();return i.value=t(r.value),i}),Object:function(t){return new i(t)},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createFraction",0,sa],601538);var so="matrix",ss=ig(so,["typed","Matrix","DenseMatrix","SparseMatrix"],t=>{var{typed:r,Matrix:i,DenseMatrix:n,SparseMatrix:a}=t;return r(so,{"":function(){return o([])}
1,string:function(t){return o([],t)},"string, string":function(t,r){return o([],t,r)},Array:function(t){return o(t)},Matrix:function(t){return o(t,t.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(t,r,i){if("dense"===r||"default"===r||void 0===r)return new n(t,i);if("sparse"===r)return new a(t,i);throw TypeError("Unknown matrix type "+JSON.stringify(r)+".")}});t.s(["createMatrix",0,ss],854924);var sl="matrixFromFunction",su=ig(sl,["typed","matrix","isZero"],t=>{var{typed:r,matrix:i,isZero:n}=t;return r(sl,{"Array | Matrix, function, string, string":function(t,r,i,n){return a(t,r,i,n)},"Array | Matrix, function, string":function(t,r,i){return a(t,r,i)},"Matrix, function":function(t,r){return a(t,r,"dense")},"Array, function":function(t,r){return a(t,r,"dense").toArray()},"Array | Matrix, string, function":function(t,r,i){return a(t,i,r)},"Array | Matrix, string, string, function":function(t,r,i,n){return a(t,n,r,i)}});function a(t,r,a,o){var s;return(s=void 0!==o?i(a,o):i(a)).resize(t),s.forEach(function(t,i){var a=r(i);n(a)||s.set(i,a)}),s}});t.s(["createMatrixFromFunction",0,su],719727);var sc="matrixFromRows",sh=ig(sc,["typed","matrix","flatten","size"],t=>{var{typed:r,matrix:i,flatten:n,size:a}=t;return r(sc,{"...Array":function(t){return o(t)},"...Matrix":function(t){return i(o(t.map(t=>t.toArray())))}});function o(t){if(0===t.length)throw TypeError("At least one row is needed to construct a matrix.");var r=s(t[0]),i=[];for(var a of t){var o=s(a);if(o!==r)throw TypeError("The vectors had different length: "+(0|r)+" â "+(0|o));i.push(n(a))}return i}function s(t){var r=a(t);if(1===r.length)return r[0];if(2===r.length)if(1===r[0])return r[1];else if(1===r[1])return r[0];else throw TypeError("At least one of the arguments is not a vector.");throw TypeError("Only one- or two-dimensional vectors are supported.")}});t.s(["createMatrixFromRows",0,sh],608444);var sf="matrixFromColumns",sd=ig(sf,["typed","matrix","flatten","size"],t=>{var{typed:r,matrix:i,flatten:n,size:a}=t;return r(sf,{"...Array":function(t){return o(t)},"...Matrix":function(t){return i(o(t.map(t=>t.toArray())))}});function o(t){if(0===t.length)throw TypeError("At least one column is needed to construct a matrix.");for(var r=s(t[0]),i=[],a=0;a<r;a++)i[a]=[];for(var o of t){var l=s(o);if(l!==r)throw TypeError("The vectors had different length: "+(0|r)+" â "+(0|l));for(var u=n(o),c=0;c<r;c++)i[c].push(u[c])}return i}function s(t){var r=a(t);if(1===r.length)return r[0];if(2===r.length)if(1===r[0])return r[1];else if(1===r[1])return r[0];else throw TypeError("At least one of the arguments is not a vector.");throw TypeError("Only one- or two-dimensional vectors are supported.")}});t.s(["createMatrixFromColumns",0,sd],280832);var sp="splitUnit",sm=ig(sp,["typed"],t=>{var{typed:r}=t;return r(sp,{"Unit, Array":function(t,r){return t.splitUnit(r)}})});t.s(["createSplitUnit",0,sm],905516);var sg="number",sy="number, number";function sv(t){return Math.abs(t)}function s_(t,r){return t+r}function sb(t,r){return t-r}function sx(t,r){return t*r}function sw(t){return-t}function sE(t){return t}function sT(t){return ik(t)}function sA(t){return t*t*t}function sS(t){return Math.exp(t)}function sC(t){return iO(t)}function sM(t,r){if(!iS(t)||!iS(r))throw Error("Parameters in function lcm must be integer numbers");if(0===t||0===r)return 0;for(var i,n=t*r;0!==r;)r=t%(i=r),t=i;return Math.abs(n/t)}function sD(t,r){return r?Math.log(t)/Math.log(r):Math.log(t)}function sP(t){return iP(t)}function sI(t){return iD(t)}function sk(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=r<0;if(i&&(r=-r),0===r)throw Error("Root must be non-zero");if(t<0&&Math.abs(r)%2!=1)throw Error("Root must be odd when a is negative.");if(0===t)return i?1/0:0;
1if(!isFinite(t))return i?0:t;var n=Math.pow(Math.abs(t),1/r);return n=t<0?-n:n,i?1/n:n}function sO(t){return iM(t)}function sN(t){return t*t}function sL(t,r){var i,n,a,o=0,s=1,l=1,u=0;if(!iS(t)||!iS(r))throw Error("Parameters in function xgcd must be integer numbers");for(;r;)n=Math.floor(t/r),a=t-n*r,i=o,o=s-n*o,s=i,i=l,l=u-n*l,u=i,t=r,r=a;return t<0?[-t,-s,-u]:[t,t?s:0,u]}function sR(t,r){return t*t<1&&r===1/0||t*t>1&&r===-1/0?0:Math.pow(t,r)}function sF(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!iS(r)||r<0||r>15)throw Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(iB(t,r))}sv.signature=sg,s_.signature=sy,sb.signature=sy,sx.signature=sy,sw.signature=sg,sE.signature=sg,sT.signature=sg,sA.signature=sg,sS.signature=sg,sC.signature=sg,sM.signature=sy,sP.signature=sg,sI.signature=sg,sO.signature=sg,sN.signature=sg,sL.signature=sy,sR.signature=sy;var sB="unaryMinus",sz=ig(sB,["typed"],t=>{var{typed:r}=t;return r(sB,{number:sw,"Complex | BigNumber | Fraction":t=>t.neg(),bigint:t=>-t,Unit:r.referToSelf(t=>i=>{var n=i.clone();return n.value=r.find(t,n.valueType())(i.value),n}),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t,!0))})});t.s(["createUnaryMinus",0,sz],783325);var sj="unaryPlus",sU=ig(sj,["typed","config","numeric"],t=>{var{typed:r,config:i,numeric:n}=t;return r(sj,{number:sE,Complex:function(t){return t},BigNumber:function(t){return t},bigint:function(t){return t},Fraction:function(t){return t},Unit:function(t){return t.clone()},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t,!0)),boolean:function(t){return n(+!!t,i.number)},string:function(t){return n(t,iC(t,i))}})});t.s(["createUnaryPlus",0,sU],388923);var sV=ig("abs",["typed"],t=>{var{typed:r}=t;return r("abs",{number:sv,"Complex | BigNumber | Fraction | Unit":t=>t.abs(),bigint:t=>t<0n?-t:t,"Array | Matrix":r.referToSelf(t=>r=>oP(r,t,!0))})});t.s(["createAbs",0,sV],421664);var s$="mapSlices",sG=ig(s$,["typed","isInteger"],t=>{var{typed:r,isInteger:i}=t;return r(s$,{"Array | Matrix, number | BigNumber, function":function(t,r,n){if(!i(r))throw TypeError("Integer number expected for dimension");var a=Array.isArray(t)?a6(t):t.size();if(r<0||r>=a.length)throw new rm(r,a.length);return rL(t)?t.create(sq(t.valueOf(),r,n),t.datatype()):sq(t,r,n)}})},{formerly:"apply"});function sq(t,r,i){var n,a,o;if(r<=0)if(!Array.isArray(t[0]))return i(t);else{for(o=function(t){var r,i,n=t.length,a=t[0].length,o=[];for(i=0;i<a;i++){var s=[];for(r=0;r<n;r++)s.push(t[r][i]);o.push(s)}return o}(t),a=[],n=0;n<o.length;n++)a[n]=sq(o[n],r-1,i);return a}for(n=0,a=[];n<t.length;n++)a[n]=sq(t[n],r-1,i);return a}t.s(["createMapSlices",0,sG],30631);var sH="addScalar",sW=ig(sH,["typed"],t=>{var{typed:r}=t;return r(sH,{"number, number":s_,"Complex, Complex":function(t,r){return t.add(r)},"BigNumber, BigNumber":function(t,r){return t.plus(r)},"bigint, bigint":function(t,r){return t+r},"Fraction, Fraction":function(t,r){return t.add(r)},"Unit, Unit":r.referToSelf(t=>(i,n)=>{if(null===i.value||void 0===i.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!i.equalBase(n))throw Error("Units do not match");var a=i.clone();return a.value=r.find(t,[a.valueType(),n.valueType()])(a.value,n.value),a.fixPrefix=!1,a})})});t.s(["createAddScalar",0,sW],275767);var sZ="subtractScalar",sY=ig(sZ,["typed"],t=>{var{typed:r}=t;return r(sZ,{"number, number":sb,"Complex, Complex":function(t,r){return t.sub(r)},"BigNumber, BigNumber":function(t,r){return t.minus(r)},"bigint, bigint":function(t,r){return t-r},"Fraction, Fraction":function(t,r){return t.sub(r)},"Unit, Unit":r.referToSelf(t=>(i,n)=>{if(null===i.value||void 0===i.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!i.equalBase(n))throw Error("Units do not match");var a=i.clone();return a.value=r.find(t,[a.valueType(),n.valueType()])(a.value,n.value),a.fixPrefix=!1,a})})});t.s(["createSubtractScalar",0,sY],380199);var sX="cbrt",sK=ig(sX,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],t=>{var{config:r,typed:i,isNegative:n,unaryMinus:a,matrix:o,Complex:s,BigNumber:l,Fraction:u}=t;return i(sX,{number:sT,Complex:c,"Complex, boolean":c,BigNumber:function(t){return t.cbrt()},Unit:function(t){if(t.value&&rP(t.value)){var r=t.clone();return r.value=1,(r=r.pow(1/3)).value=c(t.value),r}var i,o=n(t.value);o&&(t.value=a(t.value)),i=rM(t.value)?new l(1).div(3):rI(t.value)?new u(1,3):1/3;var s=t.pow(i);return o&&(s.value=a(s.value)),s}});function c(t,i){var n=t.arg()/3,a=t.abs(),l=new s(sT(a),0).mul(new s(0,n).exp());if(!i)return l;var u=[l,new s(sT(a),0).mul(new s(0,n+2*Math.PI/3).exp()),new s(sT(a),0).mul(new s(0,n-2*Math.PI/3).exp())];return"Array"===r.matrix?u:o(u)}});t.s(["createCbrt",0,sK],156142);var sQ=ig("matAlgo11xS0s",["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return function(t,n,a,o){var s,l=t._values,u=t._index,c=t._ptr,h=t._size,f=t._datatype;if(!l)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],p=h[1],m=i,g=0,y=a;"string"==typeof f&&(s=f,m=r.find(i,[s,s]),g=r.convert(0,s),n=r.convert(n,s),y=r.find(a,[s,s]));for(var v=[],_=[],b=[],x=0;x<p;x++){b[x]=_.length;for(var w=c[x],E=c[x+1],T=w;T<E;T++){var A=u[T],S=o?y(n,l[T]):y(l[T],n);m(S,g)||(_.push(A),v.push(S))}}return b[p]=_.length,t.createSparseMatrix({values:v,index:_,ptr:b,size:[d,p],datatype:s})}}),sJ=ig("matAlgo12xSfs",["typed","DenseMatrix"],t=>{var{typed:r,DenseMatrix:i}=t;return function(t,n,a,o){var s,l=t._values,u=t._index,c=t._ptr,h=t._size,f=t._datatype;if(!l)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],p=h[1],m=a;"string"==typeof f&&(s=f,n=r.convert(n,s),m=r.find(a,[s,s]));for(var g=[],y=[],v=[],_=0;_<p;_++){for(var b=_+1,x=c[_],w=c[_+1],E=x;E<w;E++){var T=u[E];y[T]=l[E],v[T]=b}for(var A=0;A<d;A++)0===_&&(g[A]=[]),v[A]===b?g[A][_]=o?m(n,y[A]):m(y[A],n):g[A][_]=o?m(n,0):m(0,n)}return new i({data:g,size:[d,p],datatype:s})}}),s0=ig("matAlgo14xDs",["typed"],t=>{var{typed:r}=t;return function(t,i,n,a){var o,s=t._data,l=t._size,u=t._datatype,c=n;"string"==typeof u&&(o=u,i=r.convert(i,o),c=r.find(n,[o,o]));var h=l.length>0?function t(r,i,n,a,o,s,l){var u=[];
1if(i===n.length-1)for(var c=0;c<a;c++)u[c]=l?r(s,o[c]):r(o[c],s);else for(var h=0;h<a;h++)u[h]=t(r,i+1,n,n[i+1],o[h],s,l);return u}(c,0,l,l[0],s,i,a):[];return t.createDenseMatrix({data:h,size:ic(l),datatype:o})}}),s1="ceil",s2=new a_(10),s3=ig(s1,["typed","config","round"],t=>{var{typed:r,config:i,round:n}=t;function a(t){var r=Math.ceil(t),a=n(t);return r===a?r:iV(t,a,i.relTol,i.absTol)&&!iV(t,r,i.relTol,i.absTol)?a:r}return r(s1,{number:a,"number, number":function(t,r){if(!iS(r))throw RangeError("number of decimals in function ceil must be an integer");if(r<0||r>15)throw RangeError("number of decimals in ceil number must be in range 0-15");var i=10**r;return a(t*i)/i}})}),s4=ig(s1,["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],t=>{var{typed:r,config:i,round:n,matrix:a,equalScalar:o,zeros:s,DenseMatrix:l}=t,u=sQ({typed:r,equalScalar:o}),c=sJ({typed:r,DenseMatrix:l}),h=s0({typed:r}),f=s3({typed:r,config:i,round:n});function d(t){var r=(t,r)=>oB(t,r,i.relTol,i.absTol),a=t.ceil(),o=n(t);return a.eq(o)?a:r(t,o)&&!r(t,a)?o:a}return r("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(t){return t.ceil()},"Complex, number":function(t,r){return t.ceil(r)},"Complex, BigNumber":function(t,r){return t.ceil(r.toNumber())},BigNumber:d,"BigNumber, BigNumber":function(t,r){var i=s2.pow(r);return d(t.mul(i)).div(i)},bigint:t=>t,"bigint, number":(t,r)=>t,"bigint, BigNumber":(t,r)=>t,Fraction:function(t){return t.ceil()},"Fraction, number":function(t,r){return t.ceil(r)},"Fraction, BigNumber":function(t,r){return t.ceil(r.toNumber())},"Unit, number, Unit":r.referToSelf(t=>function(r,i,n){var a=r.toNumeric(n);return n.multiply(t(a,i))}),"Unit, BigNumber, Unit":r.referToSelf(t=>(r,i,n)=>t(r,i.toNumber(),n)),"Array | Matrix, number | BigNumber, Unit":r.referToSelf(t=>(r,i,n)=>oP(r,r=>t(r,i,n),!0)),"Array | Matrix | Unit, Unit":r.referToSelf(t=>(r,i)=>t(r,0,i)),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t,!0)),"Array, number | BigNumber":r.referToSelf(t=>(r,i)=>oP(r,r=>t(r,i),!0)),"SparseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>u(r,i,t,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>h(r,i,t,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(t=>(r,i)=>h(a(i),r,t,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(t=>(r,i)=>o(r,0)?s(i.size(),i.storage()):"dense"===i.storage()?h(i,r,t,!0):c(i,r,t,!0))})});t.s(["createCeil",0,s4],909357);var s6="cube",s5=ig(s6,["typed"],t=>{var{typed:r}=t;return r(s6,{number:sA,Complex:function(t){return t.mul(t).mul(t)},BigNumber:function(t){return t.times(t).times(t)},bigint:function(t){return t*t*t},Fraction:function(t){return t.pow(3)},Unit:function(t){return t.pow(3)}})});t.s(["createCube",0,s5],666153);var s8=ig("exp",["typed"],t=>{var{typed:r}=t;return r("exp",{number:sS,Complex:function(t){return t.exp()},BigNumber:function(t){return t.exp()}})});t.s(["createExp",0,s8],673364);var s7="expm1",s9=ig(s7,["typed","Complex"],t=>{var{typed:r,Complex:i}=t;return r(s7,{number:sC,Complex:function(t){var r=Math.exp(t.re);return new i(r*Math.cos(t.im)-1,r*Math.sin(t.im))},BigNumber:function(t){return t.exp().minus(1)}})});t.s(["createExpm1",0,s9],686947);var le=ig("fix",["typed","ceil","floor"],t=>{var{typed:r,ceil:i,floor:n}=t;return r("fix",{number:function(t){return t>0?n(t):i(t)},"number, number":function(t,r){return t>0?n(t,r):i(t,r)}})}),lt=ig("fix",["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],t=>{var{typed:r,Complex:i,matrix:n,ceil:a,floor:o,equalScalar:s,zeros:l,DenseMatrix:u}=t,c=sJ({typed:r,DenseMatrix:u}),h=s0({typed:r}),f=le({typed:r,ceil:a,floor:o});return r("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(t){return new i(t.re>0?Math.floor(t.re):Math.ceil(t.re),t.im>0?Math.floor(t.im):Math.ceil(t.im))},"Complex, number":function(t,r){return new i(t.re>0?o(t.re,r):a(t.re,r),t.im>0?o(t.im,r):a(t.im,r))},"Complex, BigNumber":function(t,r){var n=r.toNumber();return new i(t.re>0?o(t.re,n):a(t.re,n),t.im>0?o(t.im,n):a(t.im,n))},BigNumber:function(t){return t.isNegative()?a(t):o(t)},"BigNumber, number | BigNumber":function(t,r){return t.isNegative()?a(t,r):o(t,r)},bigint:t=>t,"bigint, number":(t,r)=>t,"bigint, BigNumber":(t,r)=>t,Fraction:function(t){return t.s<0n?t.ceil():t.floor()},"Fraction, number | BigNumber":function(t,r){return t.s<0n?a(t,r):o(t,r)},"Unit, number, Unit":r.referToSelf(t=>function(r,i,n){var a=r.toNumeric(n);return n.multiply(t(a,i))}),"Unit, BigNumber, Unit":r.referToSelf(t=>(r,i,n)=>t(r,i.toNumber(),n)),"Array | Matrix, number | BigNumber, Unit":r.referToSelf(t=>(r,i,n)=>oP(r,r=>t(r,i,n),!0)),"Array | Matrix | Unit, Unit":r.referToSelf(t=>(r,i)=>t(r,0,i)),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t,!0)),"Array | Matrix, number | BigNumber":r.referToSelf(t=>(r,i)=>oP(r,r=>t(r,i),!0)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(t=>(r,i)=>h(n(i),r,t,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(t=>(r,i)=>s(r,0)?l(i.size(),i.storage()):"dense"===i.storage()?h(i,r,t,!0):c(i,r,t,!0))})});t.s(["createFix",0,lt],285697);var lr="floor",li=new a_(10),ln=ig(lr,["typed","config","round"],t=>{var{typed:r,config:i,round:n}=t;function a(t){var r=Math.floor(t),a=n(t);return r===a?r:iV(t,a,i.relTol,i.absTol)&&!iV(t,r,i.relTol,i.absTol)?a:r}return r(lr,{number:a,"number, number":function(t,r){if(!iS(r))throw RangeError("number of decimals in function floor must be an integer");if(r<0||r>15)throw RangeError("number of decimals in floor number must be in range 0 - 15");var i=10**r;return a(t*i)/i}})}),la=ig(lr,["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],t=>{var{typed:r,config:i,round:n,matrix:a,equalScalar:o,zeros:s,DenseMatrix:l}=t,u=sQ({typed:r,equalScalar:o}),c=sJ({typed:r,DenseMatrix:l}),h=s0({typed:r}),f=ln({typed:r,config:i,round:n});function d(t){var r=(t,r)=>oB(t,r,i.relTol,i.absTol),a=t.floor(),o=n(t);return a.eq(o)?a:r(t,o)&&!r(t,a)?o:a}return r("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(t){return t.floor()},"Complex, number":function(t,r){return t.floor(r)},"Complex, BigNumber":function(t,r){return t.floor(r.toNumber())},BigNumber:d,"BigNumber, BigNumber":function(t,r){var i=li.pow(r);return d(t.mul(i)).div(i)},bigint:t=>t,"bigint, number":(t,r)=>t,"bigint, BigNumber":(t,r)=>t,Fraction:function(t){return t.floor()},"Fraction, number":function(t,r){return t.floor(r)},"Fraction, BigNumber":function(t,r){return t.floor(r.toNumber())},"Unit, number, Unit":r.referToSelf(t=>function(r,i,n){var a=r.toNumeric(n);return n.multiply(t(a,i))}),"Unit, BigNumber, Unit":r.referToSelf(t=>(r,i,n)=>t(r,i.toNumber(),n)),"Array | Matrix, number | BigNumber, Unit":r.referToSelf(t=>(r,i,n)=>oP(r,r=>t(r,i,n),!0)),"Array | Matrix | Unit, Unit":r.referToSelf(t=>(r,i)=>t(r,0,i)),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t,!0)),"Array, number | BigNumber":r.referToSelf(t=>(r,i)=>oP(r,r=>t(r,i),!0)),"SparseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>
1u(r,i,t,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>h(r,i,t,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(t=>(r,i)=>h(a(i),r,t,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(t=>(r,i)=>o(r,0)?s(i.size(),i.storage()):"dense"===i.storage()?h(i,r,t,!0):c(i,r,t,!0))})});t.s(["createFloor",0,la],634919);var lo=ig("matAlgo02xDS0",["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return function(t,n,a,o){var s,l=t._data,u=t._size,c=t._datatype||t.getDataType(),h=n._values,f=n._index,d=n._ptr,p=n._size,m=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==p.length)throw new rp(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");if(!h)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=u[0],y=u[1],v=i,_=0,b=a;"string"==typeof c&&c===m&&"mixed"!==c&&(s=c,v=r.find(i,[s,s]),_=r.convert(0,s),b=r.find(a,[s,s]));for(var x=[],w=[],E=[],T=0;T<y;T++){E[T]=w.length;for(var A=d[T],S=d[T+1],C=A;C<S;C++){var M=f[C],D=o?b(h[C],l[M][T]):b(l[M][T],h[C]);v(D,_)||(w.push(M),x.push(D))}}return E[y]=w.length,n.createSparseMatrix({values:x,index:w,ptr:E,size:[g,y],datatype:c===t._datatype&&m===n._datatype?s:void 0})}}),ls=ig("matAlgo03xDSf",["typed"],t=>{var{typed:r}=t;return function(t,i,n,a){var o,s=t._data,l=t._size,u=t._datatype||t.getDataType(),c=i._values,h=i._index,f=i._ptr,d=i._size,p=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(l.length!==d.length)throw new rp(l.length,d.length);if(l[0]!==d[0]||l[1]!==d[1])throw RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+d+")");if(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=l[0],g=l[1],y=0,v=n;"string"==typeof u&&u===p&&"mixed"!==u&&(o=u,y=r.convert(0,o),v=r.find(n,[o,o]));for(var _=[],b=0;b<m;b++)_[b]=[];for(var x=[],w=[],E=0;E<g;E++){for(var T=E+1,A=f[E],S=f[E+1],C=A;C<S;C++){var M=h[C];x[M]=a?v(c[C],s[M][E]):v(s[M][E],c[C]),w[M]=T}for(var D=0;D<m;D++)w[D]===T?_[D][E]=x[D]:_[D][E]=a?v(y,s[D][E]):v(s[D][E],y)}return t.createDenseMatrix({data:_,size:[m,g],datatype:u===t._datatype&&p===i._datatype?o:void 0})}}),ll=ig("matAlgo05xSfSf",["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return function(t,n,a){var o,s,l,u,c,h=t._values,f=t._index,d=t._ptr,p=t._size,m=t._datatype||void 0===t._data?t._datatype:t.getDataType(),g=n._values,y=n._index,v=n._ptr,_=n._size,b=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(p.length!==_.length)throw new rp(p.length,_.length);if(p[0]!==_[0]||p[1]!==_[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+_+")");var x=p[0],w=p[1],E=i,T=0,A=a;"string"==typeof m&&m===b&&"mixed"!==m&&(o=m,E=r.find(i,[o,o]),T=r.convert(0,o),A=r.find(a,[o,o]));var S=h&&g?[]:void 0,C=[],M=[],D=S?[]:void 0,P=S?[]:void 0,I=[],k=[];for(l=0;l<w;l++){M[l]=C.length;var O=l+1;for(u=d[l],c=d[l+1];u<c;u++)s=f[u],C.push(s),I[s]=O,D&&(D[s]=h[u]);for(u=v[l],c=v[l+1];u<c;u++)I[s=y[u]]!==O&&C.push(s),k[s]=O,P&&(P[s]=g[u]);if(S)for(u=M[l];u<C.length;){var N=I[s=C[u]],L=k[s];if(N===O||L===O){var R=A(N===O?D[s]:T,L===O?P[s]:T);E(R,T)?C.splice(u,1):(S.push(R),u++)}}}return M[w]=C.length,t.createSparseMatrix({values:S,index:C,ptr:M,size:[x,w],datatype:m===t._datatype&&b===n._datatype?o:void 0})}}),lu=ig("matAlgo13xDD",["typed"],t=>{var{typed:r}=t;return function(t,i,n){var a,o=t._data,s=t._size,l=t._datatype,u=i._data,c=i._size,h=i._datatype,f=[];if(s.length!==c.length)throw new rp(s.length,c.length);for(var d=0;d<s.length;d++){if(s[d]!==c[d])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+c+")");f[d]=s[d]}var p=n;"string"==typeof l&&l===h&&(a=l,p=r.find(n,[a,a]));var m=f.length>0?function t(r,i,n,a,o,s){var l=[];if(i===n.length-1)for(var u=0;u<a;u++)l[u]=r(o[u],s[u]);else for(var c=0;c<a;c++)l[c]=t(r,i+1,n,n[i+1],o[c],s[c]);return l}(p,0,f,f[0],o,u):[];return t.createDenseMatrix({data:m,size:f,datatype:a})}});function lc(t,r){if(id(t.size(),r.size()))return[t,r];var i=og(t.size(),r.size());return[t,r].map(t=>{var r,n;return r=t,n=i,id(r.size(),n)?r:r.create(ov(r.valueOf(),n),r.datatype())})}var lh=ig("matrixAlgorithmSuite",["typed","matrix"],t=>{var{typed:r,matrix:i}=t,n=lu({typed:r}),a=s0({typed:r});return function(t){var o,s=t.elop,l=t.SD||t.DS;s?(o={"DenseMatrix, DenseMatrix":(t,r)=>n(...lc(t,r),s),"Array, Array":(t,r)=>n(...lc(i(t),i(r)),s).valueOf(),"Array, DenseMatrix":(t,r)=>n(...lc(i(t),r),s),"DenseMatrix, Array":(t,r)=>n(...lc(t,i(r)),s)},t.SS&&(o["SparseMatrix, SparseMatrix"]=(r,i)=>t.SS(...lc(r,i),s,!1)),t.DS&&(o["DenseMatrix, SparseMatrix"]=(r,i)=>t.DS(...lc(r,i),s,!1),o["Array, SparseMatrix"]=(r,n)=>t.DS(...lc(i(r),n),s,!1)),l&&(o["SparseMatrix, DenseMatrix"]=(t,r)=>l(...lc(r,t),s,!0),o["SparseMatrix, Array"]=(t,r)=>l(...lc(i(r),t),s,!0))):(o={"DenseMatrix, DenseMatrix":r.referToSelf(t=>(r,i)=>n(...lc(r,i),t)),"Array, Array":r.referToSelf(t=>(r,a)=>n(...lc(i(r),i(a)),t).valueOf()),"Array, DenseMatrix":r.referToSelf(t=>(r,a)=>n(...lc(i(r),a),t)),"DenseMatrix, Array":r.referToSelf(t=>(r,a)=>n(...lc(r,i(a)),t))},t.SS&&(o["SparseMatrix, SparseMatrix"]=r.referToSelf(r=>(i,n)=>t.SS(...lc(i,n),r,!1))),t.DS&&(o["DenseMatrix, SparseMatrix"]=r.referToSelf(r=>(i,n)=>t.DS(...lc(i,n),r,!1)),o["Array, SparseMatrix"]=r.referToSelf(r=>(n,a)=>t.DS(...lc(i(n),a),r,!1))),l&&(o["SparseMatrix, DenseMatrix"]=r.referToSelf(t=>(r,i)=>l(...lc(i,r),t,!0)),o["SparseMatrix, Array"]=r.referToSelf(t=>(r,n)=>l(...lc(i(n),r),t,!0))));var u=t.scalar||"any";(t.Ds||t.Ss)&&(s?(o["DenseMatrix,"+u]=(t,r)=>a(t,r,s,!1),o[u+", DenseMatrix"]=(t,r)=>a(r,t,s,!0),o["Array,"+u]=(t,r)=>a(i(t),r,s,!1).valueOf(),o[u+", Array"]=(t,r)=>a(i(r),t,s,!0).valueOf()):(o["DenseMatrix,"+u]=r.referToSelf(t=>(r,i)=>a(r,i,t,!1)),o[u+", DenseMatrix"]=r.referToSelf(t=>(r,i)=>a(i,r,t,!0)),o["Array,"+u]=r.referToSelf(t=>(r,n)=>a(i(r),n,t,!1).valueOf()),o[u+", Array"]=r.referToSelf(t=>(r,n)=>a(i(n),r,t,!0).valueOf())));var c=void 0!==t.sS?t.sS:t.Ss;return s?(t.Ss&&(o["SparseMatrix,"+u]=(r,i)=>
1t.Ss(r,i,s,!1)),c&&(o[u+", SparseMatrix"]=(t,r)=>c(r,t,s,!0))):(t.Ss&&(o["SparseMatrix,"+u]=r.referToSelf(r=>(i,n)=>t.Ss(i,n,r,!1))),c&&(o[u+", SparseMatrix"]=r.referToSelf(t=>(r,i)=>c(i,r,t,!0)))),s&&s.signatures&&ih(o,s.signatures),o}}),lf=ig("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],t=>{var{typed:r,config:i,round:n,matrix:a,equalScalar:o,zeros:s,DenseMatrix:l,concat:u}=t,c=la({typed:r,config:i,round:n,matrix:a,equalScalar:o,zeros:s,DenseMatrix:l}),h=lo({typed:r,equalScalar:o}),f=ls({typed:r}),d=ll({typed:r,equalScalar:o}),p=sQ({typed:r,equalScalar:o}),m=sJ({typed:r,DenseMatrix:l}),g=lh({typed:r,matrix:a,concat:u});return r("mod",{"number, number":function(t,r){return 0===r?t:t-r*c(t/r)},"BigNumber, BigNumber":function(t,r){return r.isZero()?t:t.sub(r.mul(c(t.div(r))))},"bigint, bigint":function(t,r){if(0n===r)return t;if(t<0){var i=t%r;return 0n===i?i:i+r}return t%r},"Fraction, Fraction":function(t,r){return r.equals(0)?t:t.sub(r.mul(c(t.div(r))))}},g({SS:d,DS:f,SD:h,Ss:p,sS:m}))});t.s(["createMod",0,lf],138981);var ld=ig("matAlgo01xDSid",["typed"],t=>{var{typed:r}=t;return function(t,i,n,a){var o,s,l=t._data,u=t._size,c=t._datatype||t.getDataType(),h=i._values,f=i._index,d=i._ptr,p=i._size,m=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(u.length!==p.length)throw new rp(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");if(!h)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g=u[0],y=u[1],v="string"==typeof c&&"mixed"!==c&&c===m?c:void 0,_=v?r.find(n,[v,v]):n,b=[];for(o=0;o<g;o++)b[o]=[];var x=[],w=[];for(s=0;s<y;s++){for(var E=s+1,T=d[s],A=d[s+1],S=T;S<A;S++)x[o=f[S]]=a?_(h[S],l[o][s]):_(l[o][s],h[S]),w[o]=E;for(o=0;o<g;o++)w[o]===E?b[o][s]=x[o]:b[o][s]=l[o][s]}return t.createDenseMatrix({data:b,size:[g,y],datatype:c===t._datatype&&m===i._datatype?v:void 0})}}),lp=ig("matAlgo04xSidSid",["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return function(t,n,a){var o,s,l,u,c,h,f=t._values,d=t._index,p=t._ptr,m=t._size,g=t._datatype||void 0===t._data?t._datatype:t.getDataType(),y=n._values,v=n._index,_=n._ptr,b=n._size,x=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(m.length!==b.length)throw new rp(m.length,b.length);if(m[0]!==b[0]||m[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+m+") must match Matrix B ("+b+")");var w=m[0],E=m[1],T=i,A=0,S=a;"string"==typeof g&&g===x&&"mixed"!==g&&(o=g,T=r.find(i,[o,o]),A=r.convert(0,o),S=r.find(a,[o,o]));var C=f&&y?[]:void 0,M=[],D=[],P=f&&y?[]:void 0,I=f&&y?[]:void 0,k=[],O=[];for(l=0;l<E;l++){D[l]=M.length;var N=l+1;for(c=p[l],h=p[l+1],u=c;u<h;u++)s=d[u],M.push(s),k[s]=N,P&&(P[s]=f[u]);for(c=_[l],h=_[l+1],u=c;u<h;u++)if(k[s=v[u]]===N){if(P){var L=S(P[s],y[u]);T(L,A)?k[s]=null:P[s]=L}}else M.push(s),O[s]=N,I&&(I[s]=y[u]);if(P&&I)for(u=D[l];u<M.length;)k[s=M[u]]===N?(C[u]=P[s],u++):O[s]===N?(C[u]=I[s],u++):M.splice(u,1)}return D[E]=M.length,t.createSparseMatrix({values:C,index:M,ptr:D,size:[w,E],datatype:g===t._datatype&&x===n._datatype?o:void 0})}}),lm=ig("matAlgo10xSids",["typed","DenseMatrix"],t=>{var{typed:r,DenseMatrix:i}=t;return function(t,n,a,o){var s,l=t._values,u=t._index,c=t._ptr,h=t._size,f=t._datatype;if(!l)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var d=h[0],p=h[1],m=a;"string"==typeof f&&(s=f,n=r.convert(n,s),m=r.find(a,[s,s]));for(var g=[],y=[],v=[],_=0;_<p;_++){for(var b=_+1,x=c[_],w=c[_+1],E=x;E<w;E++){var T=u[E];y[T]=l[E],v[T]=b}for(var A=0;A<d;A++)0===_&&(g[A]=[]),v[A]===b?g[A][_]=o?m(n,y[A]):m(y[A],n):g[A][_]=n}return new i({data:g,size:[d,p],datatype:s})}}),lg="number | BigNumber | Fraction | Matrix | Array",ly="".concat(lg,", ").concat(lg,", ...").concat(lg);function lv(t){return!t.some(t=>Array.isArray(t))}var l_=ig("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,config:n,round:a,equalScalar:o,zeros:s,BigNumber:l,DenseMatrix:u,concat:c}=t,h=lf({typed:r,config:n,round:a,matrix:i,equalScalar:o,zeros:s,DenseMatrix:u,concat:c}),f=ld({typed:r}),d=lp({typed:r,equalScalar:o}),p=lm({typed:r,DenseMatrix:u}),m=lh({typed:r,matrix:i,concat:c});return r("gcd",{"number, number":function(t,r){var i;if(!iS(t)||!iS(r))throw Error("Parameters in function gcd must be integer numbers");for(;0!==r;)i=h(t,r),t=r,r=i;return t<0?-t:t},"BigNumber, BigNumber":function(t,r){if(!t.isInt()||!r.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var i=new l(0);!r.isZero();){var n=h(t,r);t=r,r=n}return t.lt(i)?t.neg():t},"Fraction, Fraction":(t,r)=>t.gcd(r)},m({SS:d,DS:f,Ss:p}),{[ly]:r.referToSelf(t=>(r,i,n)=>{for(var a=t(r,i),o=0;o<n.length;o++)a=t(a,n[o]);return a}),Array:r.referToSelf(t=>r=>{if(1===r.length&&Array.isArray(r[0])&&lv(r[0]))return t(...r[0]);if(lv(r))return t(...r);throw new rd("gcd() supports only 1d matrices!")}),Matrix:r.referToSelf(t=>r=>t(r.toArray()))})});t.s(["createGcd",0,l_],169058);var lb=ig("matAlgo06xS0S0",["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return function(t,n,a){var o,s=t._values,l=t._size,u=t._datatype||void 0===t._data?t._datatype:t.getDataType(),c=n._values,h=n._size,f=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(l.length!==h.length)throw new rp(l.length,h.length);if(l[0]!==h[0]||l[1]!==h[1])throw RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+h+")");var d=l[0],p=l[1],m=i,g=0,y=a;"string"==typeof u&&u===f&&"mixed"!==u&&(o=u,m=r.find(i,[o,o]),g=r.convert(0,o),y=r.find(a,[o,o]));for(var v=s&&c?[]:void 0,_=[],b=[],x=v?[]:void 0,w=[],E=[],T=0;T<p;T++){b[T]=_.length;var A=T+1;if(oO(t,T,w,x,E,A,_,y),oO(n,T,w,x,E,A,_,y),x)for(var S=b[T];S<_.length;
1){var C=_[S];if(E[C]===A){var M=x[C];m(M,g)?_.splice(S,1):(v.push(M),S++)}else _.splice(S,1)}else for(var D=b[T];D<_.length;)E[_[D]]!==A?_.splice(D,1):D++}return b[p]=_.length,t.createSparseMatrix({values:v,index:_,ptr:b,size:[d,p],datatype:u===t._datatype&&f===n._datatype?o:void 0})}}),lx=ig("lcm",["typed","matrix","equalScalar","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,concat:a}=t,o=lo({typed:r,equalScalar:n}),s=lb({typed:r,equalScalar:n}),l=sQ({typed:r,equalScalar:n}),u=lh({typed:r,matrix:i,concat:a}),c="number | BigNumber | Fraction | Matrix | Array",h={};return h["".concat(c,", ").concat(c,", ...").concat(c)]=r.referToSelf(t=>(r,i,n)=>{for(var a=t(r,i),o=0;o<n.length;o++)a=t(a,n[o]);return a}),r("lcm",{"number, number":sM,"BigNumber, BigNumber":function(t,r){if(!t.isInt()||!r.isInt())throw Error("Parameters in function lcm must be integer numbers");if(t.isZero())return t;if(r.isZero())return r;for(var i=t.times(r);!r.isZero();){var n=r;r=t.mod(n),t=n}return i.div(t).abs()},"Fraction, Fraction":(t,r)=>t.lcm(r)},u({SS:s,DS:o,Ss:l}),h)});function lw(t,r,i,n){return function(a){if(a>0||i.predictable){if(a<=0)return NaN;var o=a.toString(16),s=o.substring(0,15);return t*(o.length-s.length)+r(Number("0x"+s))}return n(a.toNumber())}}t.s(["createLcm",0,lx],817051);var lE="log10",lT=sP(16),lA=ig(lE,["typed","config","Complex"],t=>{var{typed:r,config:i,Complex:n}=t;function a(t){return t.log().div(Math.LN10)}function o(t){return a(new n(t,0))}return r(lE,{number:function(t){return t>=0||i.predictable?sP(t):o(t)},bigint:lw(lT,sP,i,o),Complex:a,BigNumber:function(t){return!t.isNegative()||i.predictable?t.log():o(t.toNumber())},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createLog10",0,lA],286775);var lS="log2",lC=ig(lS,["typed","config","Complex"],t=>{var{typed:r,config:i,Complex:n}=t;function a(t){return o(new n(t,0))}return r(lS,{number:function(t){return t>=0||i.predictable?sI(t):a(t)},bigint:lw(4,sI,i,a),Complex:o,BigNumber:function(t){return!t.isNegative()||i.predictable?t.log(2):a(t.toNumber())},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))});function o(t){var r=Math.sqrt(t.re*t.re+t.im*t.im);return new n(Math.log2?Math.log2(r):Math.log(r)/Math.LN2,Math.atan2(t.im,t.re)/Math.LN2)}});t.s(["createLog2",0,lC],114291);var lM=ig("multiplyScalar",["typed"],t=>{var{typed:r}=t;return r("multiplyScalar",{"number, number":sx,"Complex, Complex":function(t,r){return t.mul(r)},"BigNumber, BigNumber":function(t,r){return t.times(r)},"bigint, bigint":function(t,r){return t*r},"Fraction, Fraction":function(t,r){return t.mul(r)},"number | Fraction | BigNumber | Complex, Unit":(t,r)=>r.multiply(t),"Unit, number | Fraction | BigNumber | Complex | Unit":(t,r)=>t.multiply(r)})});t.s(["createMultiplyScalar",0,lM],91749);var lD="multiply",lP=ig(lD,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],t=>{var{typed:r,matrix:i,addScalar:n,multiplyScalar:a,equalScalar:o,dot:s}=t,l=sQ({typed:r,equalScalar:o}),u=s0({typed:r});function c(t,r){switch(t.length){case 1:switch(r.length){case 1:if(t[0]!==r[0])throw RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(t[0]!==r[0])throw RangeError("Dimension mismatch in multiplication. Vector length ("+t[0]+") must match Matrix rows ("+r[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+r.length+" dimensions)")}break;case 2:switch(r.length){case 1:if(t[1]!==r[0])throw RangeError("Dimension mismatch in multiplication. Matrix columns ("+t[1]+") must match Vector length ("+r[0]+")");break;case 2:if(t[1]!==r[0])throw RangeError("Dimension mismatch in multiplication. Matrix A columns ("+t[1]+") must match Matrix B rows ("+r[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+r.length+" dimensions)")}break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+t.length+" dimensions)")}}var h=r("_multiplyMatrixVector",{"DenseMatrix, any":function(t,i){var o,s=t._data,l=t._size,u=t._datatype||t.getDataType(),c=i._data,h=i._datatype||i.getDataType(),f=l[0],d=l[1],p=n,m=a;u&&h&&u===h&&"string"==typeof u&&"mixed"!==u&&(o=u,p=r.find(n,[o,o]),m=r.find(a,[o,o]));for(var g=[],y=0;y<f;y++){for(var v=s[y],_=m(v[0],c[0]),b=1;b<d;b++)_=p(_,m(v[b],c[b]));g[y]=_}return t.createDenseMatrix({data:g,size:[f],datatype:u===t._datatype&&h===i._datatype?o:void 0})},"SparseMatrix, any":function(t,i){var s,l=t._values,u=t._index,c=t._ptr,h=t._datatype||void 0===t._data?t._datatype:t.getDataType();
1if(!l)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=i._data,d=i._datatype||i.getDataType(),p=t._size[0],m=i._size[0],g=[],y=[],v=[],_=n,b=a,x=o,w=0;h&&d&&h===d&&"string"==typeof h&&"mixed"!==h&&(s=h,_=r.find(n,[s,s]),b=r.find(a,[s,s]),x=r.find(o,[s,s]),w=r.convert(0,s));var E=[],T=[];v[0]=0;for(var A=0;A<m;A++){var S=f[A];if(!x(S,w))for(var C=c[A],M=c[A+1],D=C;D<M;D++){var P=u[D];T[P]?E[P]=_(E[P],b(S,l[D])):(T[P]=!0,y.push(P),E[P]=b(S,l[D]))}}for(var I=y.length,k=0;k<I;k++){var O=y[k];g[k]=E[O]}return v[1]=y.length,t.createSparseMatrix({values:g,index:y,ptr:v,size:[p,1],datatype:h===t._datatype&&d===i._datatype?s:void 0})}}),f=r("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(t,i){var o,s=t._data,l=t._size,u=t._datatype||t.getDataType(),c=i._data,h=i._size,f=i._datatype||i.getDataType(),d=l[0],p=l[1],m=h[1],g=n,y=a;u&&f&&u===f&&"string"==typeof u&&"mixed"!==u&&"mixed"!==u&&(o=u,g=r.find(n,[o,o]),y=r.find(a,[o,o]));for(var v=[],_=0;_<d;_++){var b=s[_];v[_]=[];for(var x=0;x<m;x++){for(var w=y(b[0],c[0][x]),E=1;E<p;E++)w=g(w,y(b[E],c[E][x]));v[_][x]=w}}return t.createDenseMatrix({data:v,size:[d,m],datatype:u===t._datatype&&f===i._datatype?o:void 0})},"DenseMatrix, SparseMatrix":function(t,i){var s,l=t._data,u=t._size,c=t._datatype||t.getDataType(),h=i._values,f=i._index,d=i._ptr,p=i._size,m=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(!h)throw Error("Cannot multiply Dense Matrix times Pattern only Matrix");var g=u[0],y=p[1],v=n,_=a,b=o,x=0;c&&m&&c===m&&"string"==typeof c&&"mixed"!==c&&(s=c,v=r.find(n,[s,s]),_=r.find(a,[s,s]),b=r.find(o,[s,s]),x=r.convert(0,s));for(var w=[],E=[],T=[],A=i.createSparseMatrix({values:w,index:E,ptr:T,size:[g,y],datatype:c===t._datatype&&m===i._datatype?s:void 0}),S=0;S<y;S++){T[S]=E.length;var C=d[S],M=d[S+1];if(M>C)for(var D=0,P=0;P<g;P++){for(var I=P+1,k=void 0,O=C;O<M;O++){var N=f[O];D!==I?(k=_(l[P][N],h[O]),D=I):k=v(k,_(l[P][N],h[O]))}D!==I||b(k,x)||(E.push(P),w.push(k))}}return T[y]=E.length,A},"SparseMatrix, DenseMatrix":function(t,i){var s,l=t._values,u=t._index,c=t._ptr,h=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!l)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=i._data,d=i._datatype||i.getDataType(),p=t._size[0],m=i._size[0],g=i._size[1],y=n,v=a,_=o,b=0;h&&d&&h===d&&"string"==typeof h&&"mixed"!==h&&(s=h,y=r.find(n,[s,s]),v=r.find(a,[s,s]),_=r.find(o,[s,s]),b=r.convert(0,s));for(var x=[],w=[],E=[],T=t.createSparseMatrix({values:x,index:w,ptr:E,size:[p,g],datatype:h===t._datatype&&d===i._datatype?s:void 0}),A=[],S=[],C=0;C<g;C++){E[C]=w.length;for(var M=C+1,D=0;D<m;D++){var P=f[D][C];if(!_(P,b))for(var I=c[D],k=c[D+1],O=I;O<k;O++){var N=u[O];S[N]!==M?(S[N]=M,w.push(N),A[N]=v(P,l[O])):A[N]=y(A[N],v(P,l[O]))}}for(var L=E[C],R=w.length,F=L;F<R;F++){var B=w[F];x[F]=A[B]}}return E[g]=w.length,T},"SparseMatrix, SparseMatrix":function(t,i){var o,s,l,u,c,h,f,d,p,m=t._values,g=t._index,y=t._ptr,v=t._datatype||void 0===t._data?t._datatype:t.getDataType(),_=i._values,b=i._index,x=i._ptr,w=i._datatype||void 0===i._data?i._datatype:i.getDataType(),E=t._size[0],T=i._size[1],A=m&&_,S=n,C=a;v&&w&&v===w&&"string"==typeof v&&"mixed"!==v&&(o=v,S=r.find(n,[o,o]),C=r.find(a,[o,o]));for(var M=A?[]:void 0,D=[],P=[],I=t.createSparseMatrix({values:M,index:D,ptr:P,size:[E,T],datatype:v===t._datatype&&w===i._datatype?o:void 0}),k=A?[]:void 0,O=[],N=0;N<T;N++){P[N]=D.length;var L=N+1;for(h=x[N],f=x[N+1],c=h;c<f;c++)if(p=b[c],A)for(l=y[p],u=y[p+1],s=l;s<u;s++)O[d=g[s]]!==L?(O[d]=L,D.push(d),k[d]=C(_[c],m[s])):k[d]=S(k[d],C(_[c],m[s]));else for(l=y[p],u=y[p+1],s=l;s<u;s++)O[d=g[s]]!==L&&(O[d]=L,D.push(d));if(A)for(var R=P[N],F=D.length,B=R;B<F;B++){var z=D[B];M[B]=k[z]}}return P[T]=D.length,I}});return r(lD,a,{"Array, Array":r.referTo("Matrix, Matrix",t=>(r,n)=>{c(a6(r),a6(n));var a=t(i(r),i(n));return rL(a)?a.valueOf():a}),"Matrix, Matrix":function(t,i){var o=t.size(),l=i.size();if(c(o,l),1===o.length){if(1===l.length){if(0===o[0])throw Error("Cannot multiply two empty vectors");return s(t,i)}if("dense"!==i.storage())throw Error("Support for SparseMatrix not implemented");return function(t,i){var o,s=t._data,l=t._size,u=t._datatype||t.getDataType(),c=i._data,h=i._size,f=i._datatype||i.getDataType(),d=l[0],p=h[1],m=n,g=
1a;u&&f&&u===f&&"string"==typeof u&&"mixed"!==u&&(o=u,m=r.find(n,[o,o]),g=r.find(a,[o,o]));for(var y=[],v=0;v<p;v++){for(var _=g(s[0],c[0][v]),b=1;b<d;b++)_=m(_,g(s[b],c[b][v]));y[v]=_}return t.createDenseMatrix({data:y,size:[p],datatype:u===t._datatype&&f===i._datatype?o:void 0})}(t,i)}return 1===l.length?h(t,i):f(t,i)},"Matrix, Array":r.referTo("Matrix,Matrix",t=>(r,n)=>t(r,i(n))),"Array, Matrix":r.referToSelf(t=>(r,n)=>t(i(r,n.storage()),n)),"SparseMatrix, any":function(t,r){return l(t,r,a,!1)},"DenseMatrix, any":function(t,r){return u(t,r,a,!1)},"any, SparseMatrix":function(t,r){return l(r,t,a,!0)},"any, DenseMatrix":function(t,r){return u(r,t,a,!0)},"Array, any":function(t,r){return u(i(t),r,a,!1).valueOf()},"any, Array":function(t,r){return u(i(r),t,a,!0).valueOf()},"any, any":a,"any, any, ...any":r.referToSelf(t=>(r,i,n)=>{for(var a=t(r,i),o=0;o<n.length;o++)a=t(a,n[o]);return a})})});t.s(["createMultiply",0,lP],590744);var lI="nthRoot",lk=ig(lI,["typed","matrix","equalScalar","BigNumber","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,BigNumber:a,concat:o}=t,s=ld({typed:r}),l=lo({typed:r,equalScalar:n}),u=lb({typed:r,equalScalar:n}),c=sQ({typed:r,equalScalar:n}),h=lh({typed:r,matrix:i,concat:o});function f(){throw Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return r(lI,{number:sk,"number, number":sk,BigNumber:t=>d(t,new a(2)),"BigNumber, BigNumber":d,Complex:f,"Complex, number":f,Array:r.referTo("DenseMatrix,number",t=>r=>t(i(r),2).valueOf()),DenseMatrix:r.referTo("DenseMatrix,number",t=>r=>t(r,2)),SparseMatrix:r.referTo("SparseMatrix,number",t=>r=>t(r,2)),"SparseMatrix, SparseMatrix":r.referToSelf(t=>(r,i)=>{if(1===i.density())return u(r,i,t);throw Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":r.referToSelf(t=>(r,i)=>{if(1===i.density())return s(r,i,t,!1);throw Error("Root must be non-zero")}),"Array, SparseMatrix":r.referTo("DenseMatrix,SparseMatrix",t=>(r,n)=>t(i(r),n)),"number | BigNumber, SparseMatrix":r.referToSelf(t=>(r,i)=>{if(1===i.density())return c(i,r,t,!0);throw Error("Root must be non-zero")})},h({scalar:"number | BigNumber",SD:l,Ss:c,sS:!1}));function d(t,r){var i=a.precision,n=a.clone({precision:i+2}),o=new a(0),s=new n(1),l=r.isNegative();if(l&&(r=r.neg()),r.isZero())throw Error("Root must be non-zero");if(t.isNegative()&&!r.abs().mod(2).equals(1))throw Error("Root must be odd when a is negative.");if(t.isZero())return l?new n(1/0):0;if(!t.isFinite())return l?o:t;var u=t.abs().pow(s.div(r));return u=t.isNeg()?u.neg():u,new a((l?s.div(u):u).toPrecision(i))}});t.s(["createNthRoot",0,lk],12140);var lO="sign",lN=ig(lO,["typed","BigNumber","Fraction","complex"],t=>{var{typed:r,BigNumber:i,complex:n,Fraction:a}=t;return r(lO,{number:sO,Complex:function(t){return 0===t.im?n(sO(t.re)):t.sign()},BigNumber:function(t){return new i(t.cmp(0))},bigint:function(t){return t>0n?1n:t<0n?-1n:0n},Fraction:function(t){return new a(0n===t.n?0:t.s)},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t,!0)),Unit:r.referToSelf(t=>i=>{if(!i._isDerived()&&0!==i.units[0].unit.offset)throw TypeError("sign is ambiguous for units with offset");return r.find(t,i.valueType())(i.value)})})});t.s(["createSign",0,lN],931708);var lL=ig("sqrt",["config","typed","Complex"],t=>{var{config:r,typed:i,Complex:n}=t;return i("sqrt",{number:a,Complex:function(t){return t.sqrt()},BigNumber:function(t){return!t.isNegative()||r.predictable?t.sqrt():a(t.toNumber())},Unit:function(t){return t.pow(.5)}});function a(t){return isNaN(t)?NaN:t>=0||r.predictable?Math.sqrt(t):new n(t,0).sqrt()}});t.s(["createSqrt",0,lL],176236);var lR="square",lF=ig(lR,["typed"],t=>{var{typed:r}=t;return r(lR,{number:sN,Complex:function(t){return t.mul(t)},BigNumber:function(t){return t.times(t)},bigint:function(t){return t*t},Fraction:function(t){return t.mul(t)},Unit:function(t){return t.pow(2)}})});t.s(["createSquare",0,lF],716483);var lB="subtract",lz=ig(lB,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,subtractScalar:a,unaryMinus:o,DenseMatrix:s,concat:l}=t,u=ld({typed:r}),c=ls({typed:r}),h=ll({typed:r,equalScalar:n}
1),f=lm({typed:r,DenseMatrix:s}),d=sJ({typed:r,DenseMatrix:s}),p=lh({typed:r,matrix:i,concat:l});return r(lB,{"any, any":a},p({elop:a,SS:h,DS:u,SD:c,Ss:d,sS:f}))});t.s(["createSubtract",0,lz],997708);var lj="xgcd",lU=ig(lj,["typed","config","matrix","BigNumber"],t=>{var{typed:r,config:i,matrix:n,BigNumber:a}=t;return r(lj,{"number, number":function(t,r){var a=sL(t,r);return"Array"===i.matrix?a:n(a)},"BigNumber, BigNumber":function(t,r){var o,s,l,u,c=new a(0),h=new a(1),f=c,d=h,p=h,m=c;if(!t.isInt()||!r.isInt())throw Error("Parameters in function xgcd must be integer numbers");for(;!r.isZero();)s=t.div(r).floor(),l=t.mod(r),o=f,f=d.minus(s.times(f)),d=o,o=p,p=m.minus(s.times(p)),m=o,t=r,r=l;return u=t.lt(c)?[t.neg(),d.neg(),m.neg()]:[t,t.isZero()?0:d,m],"Array"===i.matrix?u:n(u)}})});t.s(["createXgcd",0,lU],88096);var lV="invmod",l$=ig(lV,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],t=>{var{typed:r,config:i,BigNumber:n,xgcd:a,equal:o,smaller:s,mod:l,add:u,isInteger:c}=t;return r(lV,{"number, number":h,"BigNumber, BigNumber":h});function h(t,r){if(!c(t)||!c(r))throw Error("Parameters in function invmod must be integer numbers");if(t=l(t,r),o(r,0))throw Error("Divisor must be non zero");var i=a(t,r),[h,f]=i=i.valueOf();return o(h,n(1))?(s(f=l(f,r),n(0))&&(f=u(f,r)),f):NaN}});t.s(["createInvmod",0,l$],383998);var lG=ig("matAlgo09xS0Sf",["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return function(t,n,a){var o,s,l,u,c,h,f=t._values,d=t._index,p=t._ptr,m=t._size,g=t._datatype||void 0===t._data?t._datatype:t.getDataType(),y=n._values,v=n._index,_=n._ptr,b=n._size,x=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(m.length!==b.length)throw new rp(m.length,b.length);if(m[0]!==b[0]||m[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+m+") must match Matrix B ("+b+")");var w=m[0],E=m[1],T=i,A=0,S=a;"string"==typeof g&&g===x&&"mixed"!==g&&(o=g,T=r.find(i,[o,o]),A=r.convert(0,o),S=r.find(a,[o,o]));var C=f&&y?[]:void 0,M=[],D=[],P=C?[]:void 0,I=[];for(l=0;l<E;l++){D[l]=M.length;var k=l+1;if(P)for(c=_[l],h=_[l+1],u=c;u<h;u++)I[s=v[u]]=k,P[s]=y[u];for(c=p[l],h=p[l+1],u=c;u<h;u++)if(s=d[u],P){var O=I[s]===k?P[s]:A,N=S(f[u],O);T(N,A)||(M.push(s),C.push(N))}else M.push(s)}return D[E]=M.length,t.createSparseMatrix({values:C,index:M,ptr:D,size:[w,E],datatype:g===t._datatype&&x===n._datatype?o:void 0})}}),lq="dotMultiply",lH=ig(lq,["typed","matrix","equalScalar","multiplyScalar","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,multiplyScalar:a,concat:o}=t,s=lo({typed:r,equalScalar:n}),l=lG({typed:r,equalScalar:n}),u=sQ({typed:r,equalScalar:n}),c=lh({typed:r,matrix:i,concat:o});return r(lq,c({elop:a,SS:l,DS:s,Ss:u}))});function lW(t,r){if(t.isFinite()&&!t.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function bitAnd");var i=t.constructor;if(t.isNaN()||r.isNaN())return new i(NaN);if(t.isZero()||r.eq(-1)||t.eq(r))return t;if(r.isZero()||t.eq(-1))return r;if(!t.isFinite()||!r.isFinite()){if(!t.isFinite()&&!r.isFinite())return t.isNegative()===r.isNegative()?t:new i(0);if(!t.isFinite())return r.isNegative()?t:t.isNegative()?new i(0):r;if(!r.isFinite())return t.isNegative()?r:r.isNegative()?new i(0):t}return lX(t,r,function(t,r){return t&r})}function lZ(t){if(t.isFinite()&&!t.isInteger())throw Error("Integer expected in function bitNot");var r=t.constructor,i=r.precision;r.config({precision:1e9});var n=t.plus(new r(1));return n.s=-n.s||null,r.config({precision:i}),n}function lY(t,r){if(t.isFinite()&&!t.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function bitOr");var i=t.constructor;if(t.isNaN()||r.isNaN())return new i(NaN);var n=new i(-1);return t.isZero()||r.eq(n)||t.eq(r)?r:r.isZero()||t.eq(n)?t:t.isFinite()&&r.isFinite()?lX(t,r,function(t,r){return t|r}):!t.isFinite()&&!t.isNegative()&&r.isNegative()||t.isNegative()&&!r.isNegative()&&!r.isFinite()?n:t.isNegative()&&r.isNegative()?t.isFinite()?t:r:t.isFinite()?r:t}function lX(t,r,i){var n,a,o,s,l,u=t.constructor,c=+(t.s<0),h=+(r.s<0);if(c){n=lK(lZ(t));for(var f=0;f<n.length;++f)n[f]^=1}else n=lK(t);if(h){a=lK(lZ(r));for(var d=0;d<a.length;++d)a[d]^=1}else a=lK(r);n.length<=a.length?(o=n,s=a,l=c):(o=a,s=n,l=h);var p=o.length,m=s.length,g=1^i(c,h),y=new u(1^g),v=new u(1),_=new u(2),b=u.precision;for(u.config({precision:1e9});p>0;)i(o[--p],s[--m])===g&&(y=y.plus(v)),v=v.times(_);for(;m>0;)i(l,s[--m])===g&&(y=y.plus(v)),v=v.times(_);return u.config({precision:b}),0===g&&(y.s=-y.s),y}function lK(t){for(var r=t.d,i=r[0]+"",n=1;n<r.length;++n){for(var a=r[n]+"",o=7-a.length;o--;)a="0"+a;i+=a}for(var s=i.length;"0"===i.charAt(s);)s--;var l=t.e,u=i.slice(0,s+1||1),c=u.length;if(l>0)if(++l>c)for(l-=c;l--;)u+="0";else l<c&&(u=u.slice(0,l)+"."+u.slice(l));for(var h=[0],f=0;f<u.length;){for(var d=h.length;d--;)h[d]*=10;h[0]+=parseInt(u.charAt(f++));for(var p=0;p<h.length;++p)h[p]>1&&((null===h[p+1]||void 0===h[p+1])&&(h[p+1]=0),h[p+1]+=h[p]>>1,h[p]&=1)}return h.reverse()}function lQ(t,r){if(t.isFinite()&&!t.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function bitXor");var i=t.constructor;if(t.isNaN()||r.isNaN())return new i(NaN);if(t.isZero())return r;if(r.isZero())return t;if(t.eq(r))return new i(0);var n=new i(-1);return t.eq(n)?lZ(r):r.eq(n)?lZ(t):t.isFinite()&&r.isFinite()?lX(t,r,function(t,r){return t^r}):t.isFinite()||r.isFinite()?new i(t.isNegative()===r.isNegative()?1/0:-1/0):n}function lJ(t,r){if(t.isFinite()&&!t.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function leftShift");var i=t.constructor;return t.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new i(NaN):t.isZero()||r.isZero()?t:t.isFinite()||r.isFinite()?r.lt(55)?t.times(Math.pow(2,r.toNumber())+""):t.times(new i(2).pow(r)):new i(NaN)}function l0(t,r){if(t.isFinite()&&!t.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function rightArithShift");var i=t.constructor;return t.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new i(NaN):t.isZero()||r.isZero()?t:r.isFinite()?r.lt(55)?t.div(Math.pow(2,r.toNumber())+"").floor():t.div(new i(2).pow(r)).floor():new i(t.isNegative()?-1:t.isFinite()?0:NaN)}t.s(["createDotMultiply",0,lH],52072);var l1="number, number";function l2(t,r){if(!iS(t)||!iS(r))throw Error("Integers expected in function bitAnd");return t&r}function l3(t){if(!iS(t))throw Error("Integer expected in function bitNot");return~t}function l4(t,r){if(!iS(t)||!iS(r))throw Error("Integers expected in function bitOr");return t|r}function l6(t,r){if(!iS(t)||!iS(r))throw Error("Integers expected in function bitXor");return t^r}function l5(t,r){if(!iS(t)||!iS(r))throw Error("Integers expected in function leftShift");return t<<r}function l8(t,r){if(!iS(t)||!iS(r))throw Error("Integers expected in function rightArithShift");return t>>r}function l7(t,r){if(!iS(t)||!iS(r))throw Error("Integers expected in function rightLogShift");return t>>>r}l2.signature=l1,l3.signature="number",l4.signature=l1,l6.signature=l1,l5.signature=l1,l8.signature=l1,l7.signature=l1;var l9="bitAnd",ue=ig(l9,["typed","matrix","equalScalar","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,concat:a}=t,o=lo({typed:r,equalScalar:n}),s=lb({typed:r,equalScalar:n}),l=sQ({typed:r,equalScalar:n}),u=lh({typed:r,matrix:i,concat:a});return r(l9,{"number, number":l2,"BigNumber, BigNumber":lW,"bigint, bigint":(t,r)=>t&r},u({SS:s,DS:o,Ss:l}))});t.s(["createBitAnd",0,ue],36285);var ut="bitNot",ur=ig(ut,["typed"],t=>{var{typed:r}=t;return r(ut,{number:l3,BigNumber:lZ,bigint:t=>~t,"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createBitNot",0,ur],621380);var ui="bitOr",un=ig(ui,["typed","matrix","equalScalar","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,DenseMatrix:a,concat:o}=t,s=ld({typed:r}),l=lp({typed:r,equalScalar:n}),u=lm({typed:r,DenseMatrix:a}),c=lh({typed:r,matrix:i,concat:o});return r(ui,{"number, number":l4,"BigNumber, BigNumber":lY,"bigint, bigint":(t,r)=>t|r}
1,c({SS:l,DS:s,Ss:u}))});t.s(["createBitOr",0,un],242986);var ua=ig("matAlgo07xSSf",["typed","SparseMatrix"],t=>{var{typed:r,SparseMatrix:i}=t;return function(t,a,o){var s,l=t._size,u=t._datatype||void 0===t._data?t._datatype:t.getDataType(),c=a._size,h=a._datatype||void 0===a._data?a._datatype:a.getDataType();if(l.length!==c.length)throw new rp(l.length,c.length);if(l[0]!==c[0]||l[1]!==c[1])throw RangeError("Dimension mismatch. Matrix A ("+l+") must match Matrix B ("+c+")");var f=l[0],d=l[1],p=0,m=o;"string"==typeof u&&u===h&&"mixed"!==u&&(s=u,p=r.convert(0,s),m=r.find(o,[s,s]));for(var g=[],y=[],v=Array(d+1).fill(0),_=[],b=[],x=[],w=[],E=0;E<d;E++){var T=E+1,A=0;n(t,E,x,_,T),n(a,E,w,b,T);for(var S=0;S<f;S++){var C=m(x[S]===T?_[S]:p,w[S]===T?b[S]:p);0!==C&&!1!==C&&(y.push(S),g.push(C),A++)}v[E+1]=v[E]+A}return new i({values:g,index:y,ptr:v,size:[f,d],datatype:u===t._datatype&&h===a._datatype?s:void 0})};function n(t,r,i,n,a){for(var o=t._values,s=t._index,l=t._ptr,u=l[r],c=l[r+1];u<c;u++){var h=s[u];i[h]=a,n[h]=o[u]}}}),uo="bitXor",us=ig(uo,["typed","matrix","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,matrix:i,DenseMatrix:n,concat:a,SparseMatrix:o}=t,s=ls({typed:r}),l=ua({typed:r,SparseMatrix:o}),u=sJ({typed:r,DenseMatrix:n}),c=lh({typed:r,matrix:i,concat:a});return r(uo,{"number, number":l6,"BigNumber, BigNumber":lQ,"bigint, bigint":(t,r)=>t^r},c({SS:l,DS:s,Ss:u}))});t.s(["createBitXor",0,us],36876);var ul=ig("arg",["typed"],t=>{var{typed:r}=t;return r("arg",{number:function(t){return Math.atan2(0,t)},BigNumber:function(t){return t.constructor.atan2(0,t)},Complex:function(t){return t.arg()},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createArg",0,ul],752066);var uu="conj",uc=ig(uu,["typed"],t=>{var{typed:r}=t;return r(uu,{"number | BigNumber | Fraction":t=>t,Complex:t=>t.conjugate(),Unit:r.referToSelf(t=>r=>new r.constructor(t(r.toNumeric()),r.formatUnits())),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createConj",0,uc],372844);var uh=ig("im",["typed"],t=>{var{typed:r}=t;return r("im",{number:()=>0,"BigNumber | Fraction":t=>t.mul(0),Complex:t=>t.im,"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createIm",0,uh],324833);var uf=ig("re",["typed"],t=>{var{typed:r}=t;return r("re",{"number | BigNumber | Fraction":t=>t,Complex:t=>t.re,"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createRe",0,uf],598834);var ud="number, number";function up(t){return!t}function um(t,r){return!!(t||r)}function ug(t,r){return!!t!=!!r}function uy(t,r){return!!(t&&r)}up.signature="number",um.signature=ud,ug.signature=ud,uy.signature=ud;var uv=ig("not",["typed"],t=>{var{typed:r}=t;return r("not",{"null | undefined":()=>!0,number:up,Complex:function(t){return 0===t.re&&0===t.im},BigNumber:function(t){return t.isZero()||t.isNaN()},bigint:t=>!t,Unit:r.referToSelf(t=>i=>r.find(t,i.valueType())(i.value)),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createNot",0,uv],694969);var u_="nullish",ub=ig(u_,["typed","matrix","size","flatten","deepEqual"],t=>{var{typed:r,matrix:i,size:n,flatten:a,deepEqual:o}=t,s=ls({typed:r}),l=s0({typed:r}),u=lu({typed:r});return r(u_,{"number|bigint|Complex|BigNumber|Fraction|Unit|string|boolean|SparseMatrix, any":(t,r)=>t,"null, any":(t,r)=>r,"undefined, any":(t,r)=>r,"SparseMatrix, Array | Matrix":(t,r)=>{var i=n(t),a=n(r);if(o(i,a))return t;throw new rp(i,a)},"DenseMatrix, DenseMatrix":r.referToSelf(t=>(r,i)=>u(r,i,t)),"DenseMatrix, SparseMatrix":r.referToSelf(t=>(r,i)=>s(r,i,t,!1)),"DenseMatrix, Array":r.referToSelf(t=>(r,n)=>u(r,i(n),t)),"DenseMatrix, any":r.referToSelf(t=>(r,i)=>l(r,i,t,!1)),"Array, Array":r.referToSelf(t=>(r,n)=>u(i(r),i(n),t).valueOf()),"Array, DenseMatrix":r.referToSelf(t=>(r,n)=>u(i(r),n,t)),"Array, SparseMatrix":r.referToSelf(t=>(r,n)=>s(i(r),n,t,!1)),"Array, any":r.referToSelf(t=>(r,n)=>l(i(r),n,t,!1).valueOf())})});t.s(["createNullish",0,ub],905775);var ux=ig("or",["typed","matrix","equalScalar","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,DenseMatrix:a,concat:o}=t,s=ls({typed:r}),l=ll({typed:r,equalScalar:n}),u=sJ({typed:r,DenseMatrix:a}),c=lh({typed:r,matrix:i,concat:o});return r("or",{"number, number":um,"Complex, Complex":function(t,r){return 0!==t.re||0!==t.im||0!==r.re||0!==r.im},"BigNumber, BigNumber":function(t,r){return!t.isZero()&&!t.isNaN()||!r.isZero()&&!r.isNaN()},"bigint, bigint":um,"Unit, Unit":r.referToSelf(t=>(r,i)=>t(r.value||0,i.value||0))},c({SS:l,DS:s,Ss:u}))});t.s(["createOr",0,ux],450728);var uw=ig("xor",["typed","matrix","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,matrix:i,DenseMatrix:n,concat:a,SparseMatrix:o}=t,s=ls({typed:r}),l=ua({typed:r,SparseMatrix:o}),u=sJ({typed:r,DenseMatrix:n}),c=lh({typed:r,matrix:i,concat:a});return r("xor",{"number, number":ug,"Complex, Complex":function(t,r){return(0!==t.re||0!==t.im)!=(0!==r.re||0!==r.im)},"bigint, bigint":ug,"BigNumber, BigNumber":function(t,r){return(!t.isZero()&&!t.isNaN())!=(!r.isZero()&&!r.isNaN())},"Unit, Unit":r.referToSelf(t=>(r,i)=>t(r.value||0,i.value||0))},c({SS:l,DS:s,Ss:u}))});t.s(["createXor",0,uw],625256);var uE="concat",uT=ig(uE,["typed","matrix","isInteger"],t=>{var{typed:r,matrix:i,isInteger:n}=t;return r(uE,{"...Array | Matrix | number | BigNumber":function(t){var r,a,o=t.length,s=-1,l=!1,u=[];for(r=0;r<o;r++){var c=t[r];
1if(rL(c)&&(l=!0),rC(c)||rM(c)){if(r!==o-1)throw Error("Dimension must be specified as last argument");if(a=s,!n(s=c.valueOf()))throw TypeError("Integer number expected for dimension");if(s<0||r>0&&s>a)throw new rm(s,a+1)}else{var h=ic(c).valueOf(),f=a6(h);if(u[r]=h,a=s,s=f.length-1,r>0&&s!==a)throw new rp(a+1,s+1)}}if(0===u.length)throw SyntaxError("At least one matrix expected");for(var d=u.shift();u.length;)d=om(d,u.shift(),s);return l?i(d):d},"...string":function(t){return t.join("")}})});t.s(["createConcat",0,uT],900037);var uA="column",uS=ig(uA,["typed","Index","matrix","range"],t=>{var{typed:r,Index:i,matrix:n,range:a}=t;return r(uA,{"Matrix, number":o,"Array, number":function(t,r){return o(n(ic(t)),r).valueOf()}});function o(t,r){if(2!==t.size().length)throw Error("Only two dimensional matrix is supported");a7(r,t.size()[1]);var o=new i(a(0,t.size()[0]),[r]),s=t.subset(o);return rL(s)?s:n([[s]])}});t.s(["createColumn",0,uS],853696);var uC="count",uM=ig(uC,["typed","size","prod"],t=>{var{typed:r,size:i,prod:n}=t;return r(uC,{string:function(t){return t.length},"Matrix | Array":function(t){return n(i(t))}})});t.s(["createCount",0,uM],685681);var uD="cross",uP=ig(uD,["typed","matrix","subtract","multiply"],t=>{var{typed:r,matrix:i,subtract:n,multiply:a}=t;return r(uD,{"Matrix, Matrix":function(t,r){return i(o(t.toArray(),r.toArray()))},"Matrix, Array":function(t,r){return i(o(t.toArray(),r))},"Array, Matrix":function(t,r){return i(o(t,r.toArray()))},"Array, Array":o});function o(t,r){var i=Math.max(a6(t).length,a6(r).length);t=on(t),r=on(r);var o=a6(t),s=a6(r);if(1!==o.length||1!==s.length||3!==o[0]||3!==s[0])throw RangeError("Vectors with length 3 expected (Size A = ["+o.join(", ")+"], B = ["+s.join(", ")+"])");var l=[n(a(t[1],r[2]),a(t[2],r[1])),n(a(t[2],r[0]),a(t[0],r[2])),n(a(t[0],r[1]),a(t[1],r[0]))];return i>1?[l]:l}});t.s(["createCross",0,uP],281105);var uI="diag",uk=ig(uI,["typed","matrix","DenseMatrix","SparseMatrix"],t=>{var{typed:r,matrix:i,DenseMatrix:n,SparseMatrix:a}=t;return r(uI,{Array:function(t){return o(t,0,a6(t),null)},"Array, number":function(t,r){return o(t,r,a6(t),null)},"Array, BigNumber":function(t,r){return o(t,r.toNumber(),a6(t),null)},"Array, string":function(t,r){return o(t,0,a6(t),r)},"Array, number, string":function(t,r,i){return o(t,r,a6(t),i)},"Array, BigNumber, string":function(t,r,i){return o(t,r.toNumber(),a6(t),i)},Matrix:function(t){return o(t,0,t.size(),t.storage())},"Matrix, number":function(t,r){return o(t,r,t.size(),t.storage())},"Matrix, BigNumber":function(t,r){return o(t,r.toNumber(),t.size(),t.storage())},"Matrix, string":function(t,r){return o(t,0,t.size(),r)},"Matrix, number, string":function(t,r,i){return o(t,r,t.size(),i)},"Matrix, BigNumber, string":function(t,r,i){return o(t,r.toNumber(),t.size(),i)}});function o(t,r,o,s){if(!iS(r))throw TypeError("Second parameter in function diag must be an integer");var l=r>0?r:0,u=r<0?-r:0;switch(o.length){case 1:var c=t,h=r,f=s,d=o[0],p=u,m=l,g=[d+p,d+m];if(f&&"sparse"!==f&&"dense"!==f)throw TypeError("Unknown matrix type ".concat(f,'"'));var y="sparse"===f?a.diagonal(g,c,h):n.diagonal(g,c,h);return null!==f?y:y.valueOf();case 2:var v=t,_=r,b=s,x=o,w=u,E=l;if(rL(v)){var T=v.diagonal(_);return null!==b?b!==T.storage()?i(T,b):T:T.valueOf()}for(var A=Math.min(x[0]-w,x[1]-E),S=[],C=0;C<A;C++)S[C]=v[C+w][C+E];return null!==b?i(S):S}throw RangeError("Matrix for function diag must be 2 dimensional")}});t.s(["createDiag",0,uk],548631);var uO=ig("filter",["typed"],t=>{var{typed:r}=t;return r("filter",{"Array, function":uN,"Matrix, function":function(t,r){return t.create(uN(t.valueOf(),r),t.datatype())},"Array, RegExp":oc,"Matrix, RegExp":function(t,r){return t.create(oc(t.valueOf(),r),t.datatype())}})});function uN(t,r){var i=ow(r,t,"filter");return i.isUnary?ou(t,i.fn):ou(t,function(t,r,n){return i.fn(t,[r],n)})}t.s(["createFilter",0,uO],692745);var uL="flatten",uR=ig(uL,["typed"],t=>{var{typed:r}=t;return r(uL,{Array:function(t){return oo(t)},DenseMatrix:function(t){return t.create(oo(t.valueOf(),!0),t.datatype())},SparseMatrix:function(t){throw TypeError("SparseMatrix is not supported by function flatten because it does not support
11D vectors. Convert to a DenseMatrix or Array first. Example: flatten(x.toArray())")}})});t.s(["createFlatten",0,uR],139858);var uF="forEach",uB=ig(uF,["typed"],t=>{var{typed:r}=t;return r(uF,{"Array, function":uz,"Matrix, function":function(t,r){t.forEach(r)}})});function uz(t,r){var i=ow(r,t,uF);ox(t,i.fn,i.isUnary)}t.s(["createForEach",0,uB],289710);var uj="getMatrixDataType",uU=ig(uj,["typed"],t=>{var{typed:r}=t;return r(uj,{Array:function(t){return op(t,iu)},Matrix:function(t){return t.getDataType()}})});t.s(["createGetMatrixDataType",0,uU],583934);var uV="identity",u$=ig(uV,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],t=>{var{typed:r,config:i,matrix:n,BigNumber:a,DenseMatrix:o,SparseMatrix:s}=t;return r(uV,{"":function(){return"Matrix"===i.matrix?n([]):[]},string:function(t){return n(t)},"number | BigNumber":function(t){return u(t,t,"Matrix"===i.matrix?"dense":void 0)},"number | BigNumber, string":function(t,r){return u(t,t,r)},"number | BigNumber, number | BigNumber":function(t,r){return u(t,r,"Matrix"===i.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(t,r,i){return u(t,r,i)},Array:function(t){return l(t)},"Array, string":function(t,r){return l(t,r)},Matrix:function(t){return l(t.valueOf(),t.storage())},"Matrix, string":function(t,r){return l(t.valueOf(),r)}});function l(t,r){switch(t.length){case 0:return r?n(r):[];case 1:return u(t[0],t[0],r);case 2:return u(t[0],t[1],r);default:throw Error("Vector containing two values expected")}}function u(t,r,i){var n=rM(t)||rM(r)?a:null;if(rM(t)&&(t=t.toNumber()),rM(r)&&(r=r.toNumber()),!iS(t)||t<1||!iS(r)||r<1)throw Error("Parameters in function identity must be positive integers");var l=n?new a(1):1,u=n?new n(0):0,c=[t,r];if(i){if("sparse"===i)return s.diagonal(c,l,0,u);if("dense"===i)return o.diagonal(c,l,0,u);throw TypeError('Unknown matrix type "'.concat(i,'"'))}for(var h=oe([],c,u),f=t<r?t:r,d=0;d<f;d++)h[d][d]=l;return h}});t.s(["createIdentity",0,u$],486661);var uG="kron",uq=ig(uG,["typed","matrix","multiplyScalar"],t=>{var{typed:r,matrix:i,multiplyScalar:n}=t;return r(uG,{"Matrix, Matrix":function(t,r){return i(a(t.toArray(),r.toArray()))},"Matrix, Array":function(t,r){return i(a(t.toArray(),r))},"Array, Matrix":function(t,r){return i(a(t,r.toArray()))},"Array, Array":a});function a(t,r){var i,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(s<0){var l=a6(t).length,u=a6(r).length;for(s=Math.max(l,u);l++<s;)t=[t];for(;u++<s;)r=[r]}return 1===s?(i=t,o=r,i.flatMap(t=>o.map(r=>n(t,r)))):t.flatMap(t=>r.map(r=>a(t,r,s-1)))}});t.s(["createKron",0,uq],21803);var uH=ig("map",["typed"],t=>{var{typed:r}=t;return r("map",{"Array, function":n,"Matrix, function":function(t,r){return t.map(r)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(t,a,o)=>(function(t,a){if("function"!=typeof a)throw Error("Last argument must be a callback function");var o,s,l,u,c=t[0].isMatrix,h=t.map(t=>t.isMatrix?t.size():a6(t)),f=og(...h),d=t.length,p=c?(t,r)=>t.get(r):o_,m=t.map((t,r)=>{var i=h[r].map(()=>0);return t.isMatrix?t.get(i):o_(t,i)}),g=r.isTypedFunction(a)?(o=a,s=m,l=f.map(()=>0),u=t,null!==r.resolve(o,[...s,l,...u])?2:null!==r.resolve(o,[...s,l])?1:(r.resolve(o,s),0)):function(t,r){var i=t.toString();if(/arguments/.test(i))return 2;var n=i.match(/\(.*?\)/);return/\.\.\./.test(n)||t.length>r+1?2:+(t.length===r+1)}(a,d);if(g<2)return function(t,r){var i=t[0],n=t.map(t=>t.isMatrix?t.valueOf():t),a=t.map(t=>t.isMatrix?t.size():a6(t)),o=og(...a),s=a.map(t=>o.length-t.length),l=o.length-1,u=r.length>1?[]:null,c=function t(i){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=o[n],c=Array(a);if(n<l)for(var h=function(r){u&&(u[n]=r),c[r]=t(i.map((t,i)=>s[i]>n?t:1===t.length?t[0]:t[r]),n+1)},f=0;f<a;f++)h(f);else for(var d=function(t){u&&(u[n]=t),c[t]=r(i.map(r=>1===r.length?r[0]:r[t]),u?u.slice():void 0)},p=0;p<a;p++)d(p);return c}(n,0);if(!i.isMatrix)return c;var h=i.create();return h._data=c,h._size=o,h}(t,i(g,a,null));var y=c?t.map(r=>r.isMatrix?r.create(ov(r.toArray(),f),r.datatype()):t[0].create(ov(r.valueOf(),f))):t.map(t=>t.isMatrix?ov(t.toArray(),f):ov(t,f)),v=i(g,a,y),_=(t,r)=>v([t,...y.slice(1).map(t=>p(t,r))],r);return c?y[0].map(_):n(y[0],_)})([t,a,...o.slice(0,o.length-1)],o[o.length-1])});function i(t,r,i){switch(t){case 0:return t=>r(...t);case 1:return(t,i)=>r(...t,i);case 2:return(t,n)=>r(...t,n,...i)}}function n(t,r){var i=ow(r,t,"map");return ob(t,i.fn,i.isUnary)}});t.s(["createMap",0,uH],54632);var uW="diff",uZ=ig(uW,["typed","matrix","subtract","number"],t=>{var{typed:r,matrix:i,subtract:n,number:a}=t;return r(uW,{"Array | Matrix":function(t){return rL(t)?i(s(t.toArray())):s(t)},"Array | Matrix, number":function(t,r){if(!iS(r))throw RangeError("Dimension must be a whole number");return rL(t)?i(o(t.toArray(),r)):o(t,r)},"Array, BigNumber":r.referTo("Array,number",t=>(r,i)=>t(r,a(i))),"Matrix, BigNumber":r.referTo("Matrix,number",t=>(r,i)=>t(r,a(i)))});function o(t,r){if(rL(t)&&(t=t.toArray()),!Array.isArray(t))throw RangeError("Array/Matrix does not have that many dimensions");if(r>0){var i=[];return t.forEach(t=>{i.push(o(t,r-1))}),i}if(0===r)return s(t);throw RangeError("Cannot have negative dimension")}function s(t){for(var r=[],i=t.length,a=1;a<i;
1a++)r.push(function t(r,i){rL(r)&&(r=r.toArray()),rL(i)&&(i=i.toArray());var a=Array.isArray(r),o=Array.isArray(i);if(a&&o){var s=r,l=i;if(s.length!==l.length)throw RangeError("Not all sub-arrays have the same length");for(var u=[],c=s.length,h=0;h<c;h++)u.push(t(s[h],l[h]));return u}if(!a&&!o)return n(i,r);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}(t[a-1],t[a]));return r}});t.s(["createDiff",0,uZ],441839);var uY=ig("ones",["typed","config","matrix","BigNumber"],t=>{var{typed:r,config:i,matrix:n,BigNumber:a}=t;return r("ones",{"":function(){return"Array"===i.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(t){if("string"==typeof t[t.length-1]){var r=t.pop();return o(t,r)}return"Array"===i.matrix?o(t):o(t,"default")},Array:o,Matrix:function(t){var r=t.storage();return o(t.valueOf(),r)},"Array | Matrix, string":function(t,r){return o(t.valueOf(),r)}});function o(t,r){var i,o=(i=!1,t.forEach(function(t,r,n){rM(t)&&(i=!0,n[r]=t.toNumber())}),i)?new a(1):1;if(t.forEach(function(t){if("number"!=typeof t||!iS(t)||t<0)throw Error("Parameters in function ones must be positive integers")}),r){var s=n(r);return t.length>0?s.resize(t,o):s}var l=[];return t.length>0?oe(l,t,o):l}});function uX(){throw Error('No "bignumber" implementation available')}function uK(){throw Error('No "fraction" implementation available')}t.s(["createOnes",0,uY],712968);var uQ="range",uJ=ig(uQ,["typed","config","?matrix","?bignumber","equal","smaller","smallerEq","larger","largerEq","add","isZero","isPositive"],t=>{var{typed:r,config:i,matrix:n,bignumber:a,smaller:o,smallerEq:s,larger:l,largerEq:u,add:c,isZero:h,isPositive:f}=t;return r(uQ,{string:p,"string, boolean":p,number:function(t){throw TypeError("Too few arguments to function range(): ".concat(t))},boolean:function(t){throw TypeError("Unexpected type of argument 1 to function range(): ".concat(t,", number|bigint|BigNumber|Fraction"))},"number, number":function(t,r){return d(m(t,r,1,!1))},"number, number, number":function(t,r,i){return d(m(t,r,i,!1))},"number, number, boolean":function(t,r,i){return d(m(t,r,1,i))},"number, number, number, boolean":function(t,r,i,n){return d(m(t,r,i,n))},"bigint, bigint|number":function(t,r){return d(m(t,r,1n,!1))},"number, bigint":function(t,r){return d(m(BigInt(t),r,1n,!1))},"bigint, bigint|number, bigint|number":function(t,r,i){return d(m(t,r,BigInt(i),!1))},"number, bigint, bigint|number":function(t,r,i){return d(m(BigInt(t),r,BigInt(i),!1))},"bigint, bigint|number, boolean":function(t,r,i){return d(m(t,r,1n,i))},"number, bigint, boolean":function(t,r,i){return d(m(BigInt(t),r,1n,i))},"bigint, bigint|number, bigint|number, boolean":function(t,r,i,n){return d(m(t,r,BigInt(i),n))},"number, bigint, bigint|number, boolean":function(t,r,i,n){return d(m(BigInt(t),r,BigInt(i),n))},"BigNumber, BigNumber":function(t,r){var i=t.constructor;return d(m(t,r,new i(1),!1))},"BigNumber, BigNumber, BigNumber":function(t,r,i){return d(m(t,r,i,!1))},"BigNumber, BigNumber, boolean":function(t,r,i){var n=t.constructor;return d(m(t,r,new n(1),i))},"BigNumber, BigNumber, BigNumber, boolean":function(t,r,i,n){return d(m(t,r,i,n))},"Fraction, Fraction":function(t,r){return d(m(t,r,1,!1))},"Fraction, Fraction, Fraction":function(t,r,i){return d(m(t,r,i,!1))},"Fraction, Fraction, boolean":function(t,r,i){return d(m(t,r,1,i))},"Fraction, Fraction, Fraction, boolean":function(t,r,i,n){return d(m(t,r,i,n))},"Unit, Unit, Unit":function(t,r,i){return d(m(t,r,i,!1))},"Unit, Unit, Unit, boolean":function(t,r,i,n){return d(m(t,r,i,n))}});function d(t){return"Matrix"===i.matrix?n?n(t):function(){throw Error('No "matrix" implementation available')}():t}function p(t,r){var n=function(t){var r=t.split(":").map(function(t){return Number(t)});if(r.some(function(t){return isNaN(t)}))return null;switch(r.length){case 2:return{start:r[0],end:r[1],step:1};case 3:return{start:r[0],end:r[2],step:r[1]};default:return null}}(t);if(!n)throw SyntaxError('String "'+t+'" is no valid range');return"BigNumber"===i.number?(void 0===a&&uX(),d(m(a(n.start),a(n.end),a(n.step)))):d(m(n.start,n.end,n.step,r))}function m(t,r,i,n){var a=[];if(h(i))throw Error("Step must be non-zero");for(var d=f(i)?n?s:o:n?u:l,p=t;d(p,r);)a.push(p),p=c(p,i);return a}});t.s(["createRange",0,uJ],959128);var u0="reshape",u1=ig(u0,["typed","isInteger","matrix"],t=>{var{typed:r,isInteger:i}=t;return r(u0,{"Matrix, Array":function(t,r){return t.reshape(r,!0)},"Array, Array":function(t,r){return r.forEach(function(t){if(!i(t))throw TypeError("Invalid size for dimension: "+t)}),ot(t,r)}})});t.s(["createReshape",0,u1],966346);var u2=ig("resize",["config","matrix"],t=>{var{config:r,matrix:i}=t;return function(t,n,a){if(2!=arguments.length&&3!=arguments.length)throw new rd("resize",arguments.length,2,3);if(rL(n)&&(n=n.valueOf()),rM(n[0])&&(n=n.map(function(t){return rM(t)?t.toNumber():t})),rL(t))return t.resize(n,a,!0);if("string"==typeof t){var o=t,s=n,l=a;if(void 0!==l){if("string"!=typeof l||1!==l.length)throw TypeError("Single character expected as defaultValue")}else l=" ";if(1!==s.length)throw new rp(s.length,1);var u=s[0];if("number"!=typeof u||!iS(u))throw TypeError("Invalid size, must contain positive integers (size: "+a0(s)+")");if(o.length>u)return o.substring(0,u);if(!(o.length<u))return o;for(var c=o,h=0,f=u-o.length;h<f;h++)c+=l;return c}var d=!Array.isArray(t)&&"Array"!==r.matrix;if(0===n.length){for(;Array.isArray(t);)t=t[0];return ic(t)}Array.isArray(t)||(t=[t]);var p=oe(t=ic(t),n,a);return d?i(p):p}});t.s(["createResize",0,u2],691517);var u3="rotate",u4=ig(u3,["typed","multiply","rotationMatrix"],t=>{var{typed:r,multiply:i,rotationMatrix:n}=t;return r(u3,{"Array , number | BigNumber | Complex | Unit":function(t,r){return a(t,2),i(n(r),t).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(t,r){return a(t,2),i(n(r),t)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(t,r,o){return a(t,3),i(n(r,o),t)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(t,r,o){return a(t,3),i(n(r,o),t)}});function a(t,r){var i=Array.isArray(t)?a6(t):t.size();if(i.length>2||2===i.length&&1!==i[1]||i[0]!==r)throw RangeError("Vector must be of dimensions 1x".concat(r))}});t.s(["createRotate",0,u4],169797);var u6="rotationMatrix",u5=ig(u6,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],t=>{var{typed:r,config:i,multiplyScalar:n,addScalar:a,unaryMinus:o,norm:s,BigNumber:l,matrix:u,DenseMatrix:c,SparseMatrix:h,c
1os:f,sin:d}=t;return r(u6,{"":function(){return"Matrix"===i.matrix?u([]):[]},string:function(t){return u(t)},"number | BigNumber | Complex | Unit":function(t){return p(t,"Matrix"===i.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(t,r){return p(t,r)},"number | BigNumber | Complex | Unit, Array":function(t,r){var i=u(r);return m(i),v(t,i,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(t,r){m(r);var n=r.storage()||("Matrix"===i.matrix?"dense":void 0);return v(t,r,n)},"number | BigNumber | Complex | Unit, Array, string":function(t,r,i){var n=u(r);return m(n),v(t,n,i)},"number | BigNumber | Complex | Unit, Matrix, string":function(t,r,i){return m(r),v(t,r,i)}});function p(t,r){var i=rM(t)?new l(-1):-1,a=f(t),o=d(t);return y([[a,n(i,o)],[o,a]],r)}function m(t){var r=t.size();if(r.length<1||3!==r[0])throw RangeError("Vector must be of dimensions 1x3")}function g(t){return t.reduce((t,r)=>n(t,r))}function y(t,r){if(r){if("sparse"===r)return new h(t);if("dense"===r)return new c(t);throw TypeError('Unknown matrix type "'.concat(r,'"'))}return t}function v(t,r,i){var n=s(r);if(0===n)throw RangeError("Rotation around zero vector");var u=rM(t)?l:null,c=u?new u(1):1,h=u?new u(-1):-1,p=u?new u(r.get([0])/n):r.get([0])/n,m=u?new u(r.get([1])/n):r.get([1])/n,v=u?new u(r.get([2])/n):r.get([2])/n,_=f(t),b=a(c,o(_)),x=d(t);return y([[a(_,g([p,p,b])),a(g([p,m,b]),g([h,v,x])),a(g([p,v,b]),g([m,x]))],[a(g([p,m,b]),g([v,x])),a(_,g([m,m,b])),a(g([m,v,b]),g([h,p,x]))],[a(g([p,v,b]),g([h,m,x])),a(g([m,v,b]),g([p,x])),a(_,g([v,v,b]))]],i)}});t.s(["createRotationMatrix",0,u5],370592);var u8=ig("row",["typed","Index","matrix","range"],t=>{var{typed:r,Index:i,matrix:n,range:a}=t;return r("row",{"Matrix, number":o,"Array, number":function(t,r){return o(n(ic(t)),r).valueOf()}});function o(t,r){if(2!==t.size().length)throw Error("Only two dimensional matrix is supported");a7(r,t.size()[0]);var o=new i([r],a(0,t.size()[1])),s=t.subset(o);return rL(s)?s:n([[s]])}});t.s(["createRow",0,u8],5280);var u7="size",u9=ig(u7,["typed"],t=>{var{typed:r}=t;return r(u7,{Matrix:t=>t.size(),Array:a6,string:t=>[t.length],"number | Complex | BigNumber | Unit | boolean | null":t=>[]})});t.s(["createSize",0,u9],148741);var ce="squeeze",ct=ig(ce,["typed"],t=>{var{typed:r}=t;return r(ce,{Array:function(t){return on(ic(t))},Matrix:function(t){var r=on(t.toArray());return Array.isArray(r)?t.create(r,t.datatype()):r},any:function(t){return ic(t)}})});t.s(["createSqueeze",0,ct],977430);var cr="subset",ci=ig(cr,["typed","matrix","zeros","add"],t=>{var{typed:r,matrix:i,zeros:n,add:a}=t;return r(cr,{"Matrix, Index":function(t,r){return a9(r)?i():(a8(t,r),t.subset(r))},"Array, Index":r.referTo("Matrix, Index",function(t){return function(r,n){var a=t(i(r),n);return n.isScalar()?a:a.valueOf()}}),"Object, Index":co,"string, Index":cn,"Matrix, Index, any, any":function(t,r,i,o){return a9(r)?t:(a8(t,r),t.clone().subset(r,function(t,r){if("string"==typeof t)throw Error("can't boradcast a string");if(r.isScalar())return t;var i=r.size();if(!i.every(t=>t>0))return t;try{return a(t,n(i))}catch(r){return t}}(i,r),o))},"Array, Index, any, any":r.referTo("Matrix, Index, any, any",function(t){return function(r,n,a,o){var s=t(i(r),n,a,o);return s.isMatrix?s.valueOf():s}}),"Array, Index, any":r.referTo("Matrix, Index, any, any",function(t){return function(r,n,a){return t(i(r),n,a,void 0).valueOf()}}),"Matrix, Index, any":r.referTo("Matrix, Index, any, any",function(t){return function(r,i,n){return t(r,i,n,void 0)}}),"string, Index, string":ca,"string, Index, string, string":ca,"Object, Index, any":cs})});function cn(t,r){if(!rj(r))throw TypeError("Index expected");if(a9(r))return"";if(a8(Array.from(t),r),1!==r.size().length)throw new rp(r.size().length,1);var i=t.length;a7(r.min()[0],i),a7(r.max()[0],i);var n=r.dimension(0),a="";function o(r){a+=t.charAt(r)}return Number.isInteger(n)?o(n):n.forEach(o),a}function ca(t,r,i,n){if(!r||!0!==r.isIndex)throw TypeError("Index expected");if(a9(r))return t;if(a8(Array.from(t),r),1!==r.size().length)throw new rp(r.size().length,1);
1if(void 0!==n){if("string"!=typeof n||1!==n.length)throw TypeError("Single character expected as defaultValue")}else n=" ";var a=r.dimension(0);if((Number.isInteger(a)?1:a.size()[0])!==i.length)throw new rp(a.size()[0],i.length);var o=t.length;a7(r.min()[0]),a7(r.max()[0]);for(var s=[],l=0;l<o;l++)s[l]=t.charAt(l);function u(t,r){s[t]=i.charAt(r[0])}if(Number.isInteger(a)?u(a,[0]):a.forEach(u),s.length>o)for(var c=o-1,h=s.length;c<h;c++)s[c]||(s[c]=n);return s.join("")}function co(t,r){if(!a9(r)){if(1!==r.size().length)throw new rp(r.size(),1);var i=r.dimension(0);if("string"!=typeof i)throw TypeError("String expected as index to retrieve an object property");return rg(t,i)}}function cs(t,r,i){if(a9(r))return t;if(1!==r.size().length)throw new rp(r.size(),1);var n=r.dimension(0);if("string"!=typeof n)throw TypeError("String expected as index to retrieve an object property");var a=ic(t);return ry(a,n,i),a}t.s(["createSubset",0,ci],246718);var cl="transpose",cu=ig(cl,["typed","matrix"],t=>{var{typed:r,matrix:i}=t;return r(cl,{Array:t=>n(i(t)).valueOf(),Matrix:n,any:ic});function n(t){var r,i=t.size();switch(i.length){case 1:r=t.clone();break;case 2:var n=i[0],a=i[1];if(0===a)throw RangeError("Cannot transpose a 2D matrix with no columns (size: "+a0(i)+")");switch(t.storage()){case"dense":r=function(t,r,i){for(var n,a=t._data,o=[],s=0;s<i;s++){n=o[s]=[];for(var l=0;l<r;l++)n[l]=ic(a[l][s])}return t.createDenseMatrix({data:o,size:[i,r],datatype:t._datatype})}(t,n,a);break;case"sparse":r=function(t,r,i){for(var n,a,o,s=t._values,l=t._index,u=t._ptr,c=s?[]:void 0,h=[],f=[],d=[],p=0;p<r;p++)d[p]=0;for(n=0,a=l.length;n<a;n++)d[l[n]]++;for(var m=0,g=0;g<r;g++)f.push(m),m+=d[g],d[g]=f[g];for(f.push(m),o=0;o<i;o++)for(var y=u[o],v=u[o+1],_=y;_<v;_++){var b=d[l[_]]++;h[b]=o,s&&(c[b]=ic(s[_]))}return t.createSparseMatrix({values:c,index:h,ptr:f,size:[i,r],datatype:t._datatype})}(t,n,a)}break;default:throw RangeError("Matrix must be a vector or two dimensional (size: "+a0(i)+")")}return r}});t.s(["createTranspose",0,cu],835929);var cc="ctranspose",ch=ig(cc,["typed","transpose","conj"],t=>{var{typed:r,transpose:i,conj:n}=t;return r(cc,{any:function(t){return n(i(t))}})});t.s(["createCtranspose",0,ch],544318);var cf="zeros",cd=ig(cf,["typed","config","matrix","BigNumber"],t=>{var{typed:r,config:i,matrix:n,BigNumber:a}=t;return r(cf,{"":function(){return"Array"===i.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(t){if("string"==typeof t[t.length-1]){var r=t.pop();return o(t,r)}return"Array"===i.matrix?o(t):o(t,"default")},Array:o,Matrix:function(t){var r=t.storage();return o(t.valueOf(),r)},"Array | Matrix, string":function(t,r){return o(t.valueOf(),r)}});function o(t,r){var i,o=(i=!1,t.forEach(function(t,r,n){rM(t)&&(i=!0,n[r]=t.toNumber())}),i)?new a(0):0;if(t.forEach(function(t){if("number"!=typeof t||!iS(t)||t<0)throw Error("Parameters in function zeros must be positive integers")}),r){var s=n(r);return t.length>0?s.resize(t,o):s}var l=[];return t.length>0?oe(l,t,o):l}});t.s(["createZeros",0,cd],84143);var cp=ig("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],t=>{var{typed:r,matrix:i,addScalar:n,multiplyScalar:a,divideScalar:o,exp:s,tau:l,i:u,dotDivide:c,conj:h,pow:f,ceil:d,log2:p}=t;return r("fft",{Array:m,Matrix:function(t){return t.create(m(t.valueOf()),t.datatype())}});function m(t){var r=a6(t);return 1===r.length?g(t,r[0]):function t(r,i){var n=a6(r);if(0!==i)return Array(n[0]).fill(0).map((n,a)=>t(r[a],i-1));if(1===n.length)return g(r);function a(t){var r=a6(t);return Array(r[1]).fill(0).map((i,n)=>Array(r[0]).fill(0).map((r,i)=>t[i][n]))}return a(t(a(r),1))}(t.map(t=>m(t,r.slice(1))),0)}function g(t){var r=t.length;if(1===r)return[t[0]];if(r%2!=0)return function(t){for(var r=t.length,i=s(o(a(-1,a(u,l)),r)),n=[],y=1-r;y<r;y++)n.push(f(i,o(f(y,2),2)));for(var v=f(2,d(p(r+r-1))),_=[...Array(r).fill(0).map((i,o)=>a(t[o],n[r-1+o])),...Array(v-r).fill(0)],b=[...Array(r+r-1).fill(0).map((t,r)=>o(1,n[r])),...Array(v-(r+r-1)).fill(0)],x=g(_),w=g(b),E=c(h(m(h(Array(v).fill(0).map((t,r)=>a(x[r],w[r]))))),v),T=[],A=r-1;A<r+r-1;A++)T.push(a(E[A],n[A]));return T}(t);for(var i=[...g(t.filter((t,r)=>r%2==0)),...g(t.filter((t,r)=>r%2==1))],y=0;y<r/2;y++){var v=i[y],_=a(i[y+r/2],s(a(a(l,u),o(-y,r))));i[y]=n(v,_),i[y+r/2]=n(v,a(-1,_))}return i}});t.s(["createFft",0,cp],254312);var cm="ifft",cg=ig(cm,["typed","fft","dotDivide","conj"],t=>{var{typed:r,fft:i,dotDivide:n,conj:a}=t;return r(cm,{"Array | Matrix":function(t){var r=rL(t)?t.size():a6(t);return n(a(i(a(t))),r.reduce((t,r)=>t*r,1))}})});function cy(t){return(cy="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)}function cv(t,r,i){var n;return(n=function(t,r){if("object"!=cy(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=cy(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(r,"string"),(r="symbol"==cy(n)?n:n+"")in t)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}function c_(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}t.s(["createIfft",0,cg],356048);var cb=ig("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],t=>{var{typed:r,add:i,subtract:n,multiply:a,divide:o,max:s,map:l,abs:u,isPositive:c,isNegative:h,larger:f,smaller:d,matrix:p,bignumber:m,unaryMinus:g}=t;function y(t){return function(r,p,y,v){if(!(2===p.length&&(p.every(x)||p.every(rk))))throw Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var _,b=p[0],w=p[1],E=f(w,b),T=v.firstStep;if(void 0!==T&&!c(T))throw Error('"firstStep" must be positive');var A=v.maxStep;if(void 0!==A&&!c(A))throw Error('"maxStep" must be positive');var S=v.minStep;if(S&&h(S))throw Error('"minStep" must be positive or zero');var C=[b,w,T,S,A].filter(t=>void 0!==t);if(!(C.every(x)||C.every(rk)))throw Error('Inconsistent type of "t" dependant variables');for(var M=v.tol?v.tol:1e-4,D=v.minDelta?v.minDelta:.2,P=v.maxDelta?v.maxDelta:5,I=v.maxIter?v.maxIter:1e4,k=[b,w,...y,A,S].some(rM),[O,N,L,R]=k?[m(t.a),m(t.c),m(t.b),m(t.bp)]:[t.a,t.c,t.b,t.bp],F=T?E?T:g(T):o(n(w,b),1),B=[b],z=[y],j=n(L,R),U=0,V=0,$=E?d:f,G=(_
1=E?f:d,function(t,r,a){return _(i(t,a),r)?n(r,t):a});$(B[U],w);){var q=[];F=G(B[U],w,F),q.push(r(B[U],z[U]));for(var H=1;H<N.length;++H)q.push(r(i(B[U],a(N[H],F)),i(z[U],a(F,O[H],q))));var W=s(u(l(a(j,q),t=>rk(t)?t.value:t)));W<M&&M/W>1/4&&(B.push(i(B[U],F)),z.push(i(z[U],a(F,L,q))),U++);var Z=.84*(M/W)**.2;if(d(Z,D)?Z=D:f(Z,P)&&(Z=P),F=a(F,Z=k?m(Z):Z),A&&f(u(F),A)?F=E?A:g(A):S&&d(u(F),S)&&(F=E?S:g(S)),++V>I)throw Error("Maximum number of iterations reached, try changing options")}return{t:B,y:z}}}function v(t,r,i,n){return y({a:[[],[.5],[0,3/4],[2/9,1/3,4/9]],c:[null,.5,3/4,1],b:[2/9,1/3,4/9,0],bp:[7/24,1/4,1/3,1/8]})(t,r,i,n)}function _(t,r,i,n){return y({a:[[],[.2],[3/40,9/40],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,.2,.3,.8,8/9,1,1],b:[35/384,0,500/1113,125/192,-2187/6784,11/84,0],bp:[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40]})(t,r,i,n)}function b(t,r,i,n){var a=n.method?n.method:"RK45",o={RK23:v,RK45:_};if(a.toUpperCase()in o){var s=function(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?c_(Object(i),!0).forEach(function(r){cv(t,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c_(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}({},n);return delete s.method,o[a.toUpperCase()](t,r,i,s)}var l=Object.keys(o).map(t=>'"'.concat(t,'"')),u="".concat(l.slice(0,-1).join(", ")," and ").concat(l.slice(-1));throw Error('Unavailable method "'.concat(a,'". Available methods are ').concat(u))}function x(t){return rM(t)||rC(t)}function w(t,r,i,n){var a=b(t,r.toArray(),i.toArray(),n);return{t:p(a.t),y:p(a.y)}}return r("solveODE",{"function, Array, Array, Object":b,"function, Matrix, Matrix, Object":w,"function, Array, Array":(t,r,i)=>b(t,r,i,{}),"function, Matrix, Matrix":(t,r,i)=>w(t,r,i,{}),"function, Array, number | BigNumber | Unit":(t,r,i)=>{var n=b(t,r,[i],{});return{t:n.t,y:n.y.map(t=>t[0])}},"function, Matrix, number | BigNumber | Unit":(t,r,i)=>{var n=b(t,r.toArray(),[i],{});return{t:p(n.t),y:p(n.y.map(t=>t[0]))}},"function, Array, number | BigNumber | Unit, Object":(t,r,i,n)=>{var a=b(t,r,[i],n);return{t:a.t,y:a.y.map(t=>t[0])}},"function, Matrix, number | BigNumber | Unit, Object":(t,r,i,n)=>{var a=b(t,r.toArray(),[i],n);return{t:p(a.t),y:p(a.y.map(t=>t[0]))}}})});t.s(["createSolveODE",0,cb],496352);var cx=ig("erf",["typed"],t=>{var{typed:r}=t;return r("name",{number:function(t){var r=Math.abs(t);return r>=cS?iM(t):r<=cw?iM(t)*function(t){var r,i=t*t,n=cT[0][4]*i,a=i;for(r=0;r<3;r+=1)n=(n+cT[0][r])*i,a=(a+cA[0][r])*i;return t*(n+cT[0][3])/(a+cA[0][3])}(r):r<=4?iM(t)*(1-function(t){var r,i=cT[1][8]*t,n=t;for(r=0;r<7;r+=1)i=(i+cT[1][r])*t,n=(n+cA[1][r])*t;var a=(i+cT[1][7])/(n+cA[1][7]),o=parseInt(16*t)/16;return Math.exp(-o*o)*Math.exp(-((t-o)*(t+o)))*a}(r)):iM(t)*(1-function(t){var r,i=1/(t*t),n=cT[2][5]*i,a=i;for(r=0;r<4;r+=1)n=(n+cT[2][r])*i,a=(a+cA[2][r])*i;var o=i*(n+cT[2][4])/(a+cA[2][4]);o=(cE-o)/t,i=parseInt(16*t)/16;var s=(t-i)*(t+i);return Math.exp(-i*i)*Math.exp(-s)*o}(r))},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})}),cw=.46875,cE=.5641895835477563,cT=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,6587491615298378e-19,.016315387137302097]],cA=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],cS=0x20000000000000;t.s(["createErf",0,cx],750588);var cC="zeta",cM=ig(cC,["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isBounded","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],t=>{var{typed:r,config:i,multiply:n,pow:a,divide:o,factorial:s,equal:l,smallerEq:u,isBounded:c,isNegative:h,gamma:f,sin:d,subtract:p,add:m,Complex:g,BigNumber:y,pi:v}=t;return r(cC,{number:t=>_(t,t=>t,()=>20),BigNumber:t=>_(t,t=>new y(t),()=>Math.abs(Math.log10(i.relTol))),Complex:function(t){return 0===t.re&&0===t.im?new g(-.5):1===t.re?new g(NaN,NaN):t.re===1/0&&0===t.im?new g(1):t.im===1/0||t.re===-1/0?new g(NaN,NaN):b(t,t=>t,t=>Math.round(19.5+.9*Math.abs(t.im)),t=>t.re)}});function _(t,r,i){return l(t,0)?r(-.5):l(t,1)?r(NaN):c(t)?b(t,r,i,t=>t):r(h(t)?NaN:1)}function b(t,r,i,s){var l=i(t);if(s(t)>-(l-1)/2)return function(t,r,i){for(var s=o(1,n(x(i(0),r),p(1,a(2,p(1,t))))),l=i(0),c=i(1);
1u(c,r);c=m(c,1))l=m(l,o(n((-1)**(c-1),x(c,r)),a(c,t)));return n(s,l)}(t,r(l),r);var c=n(a(2,t),a(r(v),p(t,1)));return c=n(c,d(n(o(r(v),2),t))),c=n(c,f(p(1,t))),n(c,b(p(1,t),r,i,s))}function x(t,r){for(var i=t,l=t;u(l,r);l=m(l,1)){var c=o(n(s(m(r,p(l,1))),a(4,l)),n(s(p(r,l)),s(n(2,l))));i=m(i,c)}return n(r,i)}});t.s(["createZeta",0,cM],887471);var cD="mode",cP=ig(cD,["typed","isNaN","isNumeric"],t=>{var{typed:r,isNaN:i,isNumeric:n}=t;return r(cD,{"Array | Matrix":a,"...":function(t){return a(t)}});function a(t){if(0===(t=oo(t.valueOf())).length)throw Error("Cannot calculate mode of an empty array");for(var r={},a=[],o=0,s=0;s<t.length;s++){var l=t[s];if(n(l)&&i(l))throw Error("Cannot calculate mode of an array containing NaN values");l in r||(r[l]=0),r[l]++,r[l]===o?a.push(l):r[l]>o&&(o=r[l],a=[l])}return a}});function cI(t,r,i){var n;return String(t).includes("Unexpected type")?(n=arguments.length>2?" (type: "+iu(i)+", value: "+JSON.stringify(i)+")":" (type: "+t.data.actual+")",TypeError("Cannot calculate "+r+", unexpected type of argument"+n)):String(t).includes("complex numbers")?(n=arguments.length>2?" (type: "+iu(i)+", value: "+JSON.stringify(i)+")":"",TypeError("Cannot calculate "+r+", no ordering relation is defined for complex numbers"+n)):t}t.s(["createMode",0,cP],325296);var ck="prod",cO=ig(ck,["typed","config","multiplyScalar","numeric"],t=>{var{typed:r,config:i,multiplyScalar:n,numeric:a}=t;return r(ck,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(t,r){throw Error("prod(A, dim) is not yet supported")},"...":function(t){return o(t)}});function o(t){var r;if(oD(t,function(t){try{r=void 0===r?t:n(r,t)}catch(r){throw cI(r,"prod",t)}}),"string"==typeof r&&(r=a(r,iC(r,i))),void 0===r)throw Error("Cannot calculate prod of an empty array");return r}});t.s(["createProd",0,cO],980643);var cN="format",cL=ig(cN,["typed"],t=>{var{typed:r}=t;return r(cN,{any:a0,"any, Object | function | number | BigNumber":a0})});t.s(["createFormat",0,cL],249662);var cR=ig("bin",["typed","format"],t=>{var{typed:r,format:i}=t;return r("bin",{"number | BigNumber":function(t){return i(t,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(t,r){return i(t,{notation:"bin",wordSize:r})}})});t.s(["createBin",0,cR],727716);var cF=ig("oct",["typed","format"],t=>{var{typed:r,format:i}=t;return r("oct",{"number | BigNumber":function(t){return i(t,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(t,r){return i(t,{notation:"oct",wordSize:r})}})});t.s(["createOct",0,cF],219779);var cB=ig("hex",["typed","format"],t=>{var{typed:r,format:i}=t;return r("hex",{"number | BigNumber":function(t){return i(t,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(t,r){return i(t,{notation:"hex",wordSize:r})}})});t.s(["createHex",0,cB],899553);var cz=/\$([\w.]+)/g,cj="print",cU=ig(cj,["typed"],t=>{var{typed:r}=t;return r(cj,{"string, Object | Array":cV,"string, Object | Array, number | Object":cV})});function cV(t,r,i){return t.replace(cz,function(t,n){var a=n.split("."),o=r[a.shift()];for(void 0!==o&&o.isMatrix&&(o=o.toArray());a.length&&void 0!==o;){var s=a.shift();o=s?o[s]:o+"."}if(void 0!==o)if(!rO(o))return a0(o,i);else return o;return t})}t.s(["createPrint",0,cU],172905);var c$=ig("to",["typed","matrix","concat"],t=>{var{typed:r,matrix:i,concat:n}=t,a=lh({typed:r,matrix:i,concat:n});return r("to",{"Unit, Unit | string":(t,r)=>t.to(r)},a({Ds:!0}))});t.s(["createTo",0,c$],720926);var cG="toBest",cq=ig(cG,["typed"],t=>{var{typed:r}=t;return r(cG,{Unit:t=>t.toBest(),"Unit, string":(t,r)=>t.toBest(r.split(",")),"Unit, string, Object":(t,r,i)=>t.toBest(r.split(","),i),"Unit, Array":(t,r)=>t.toBest(r),"Unit, Array, Object":(t,r,i)=>t.toBest(r,i)})});t.s(["createToBest",0,cq],147659);var cH="isPrime",cW=ig(cH,["typed"],t=>{var{typed:r}=t;return r(cH,{number:function(t){if(t<=3)return t>1;if(t%2==0||t%3==0)return!1;for(var r=5;r*r<=t;r+=6)if(t%r==0||t%(r+2)==0)return!1;return!0},bigint:function(t){if(t<=3n)return t>1n;if(t%2n===0n||t%3n===0n)return!1;for(var r=5n;r*r<=t;r+=6n)if(t%r===0n||t%(r+2n)===0n)return!1;return!0},BigNumber:function(t){if(t.lte(3))return t.gt(1);if(t.mod(2).eq(0)||t.mod(3).eq(0))return!1;if(t.lt(0x100000000)){for(var r=t.toNumber(),i=5;i*i<=r;i+=6)if(r%i==0||r%(i+2)==0)return!1;return!0}t=new(t.constructor.clone({precision:2*t.toFixed(0).length}))(t);for(var n=0,a=t.sub(1);a.mod(2).eq(0);)a=a.div(2),n+=1;var o=null;if(t.lt("3317044064679887385961981"))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(r=>r<t);else{var s=Math.min(t.toNumber()-2,Math.floor(2*Math.pow(t.toFixed(0).length*Math.log(10),2)));o=[];for(var l=2;l<=s;l+=1)o.push(s)}for(var u=0;u<o.length;u+=1){var c=o[u],h=function(t,r,i){for(var n=1;!r.eq(0);)r.mod(2).eq(0)?(r=r.div(2),t=t.mul(t).mod(i)):(r=r.sub(1),n=t.mul(n).mod(i));return n}(t.sub(t).add(c),a,t);if(!h.eq(1)){for(var f=0,d=h;!d.eq(t.sub(1));f+=1,d=d.mul(d).mod(t))if(f===n-1)return!1}}return!0},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createIsPrime",0,cW],410309);var cZ=ig("numeric",["number","?bignumber","?fraction"],t=>{var{number:r,bignumber:i,fraction:n}=t,a={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:t=>r(t),BigNumber:i?t=>i(t):uX,bigint:t=>BigInt(t),Fraction:n?t=>n(t):uK};return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",i=arguments.length>2?arguments[2]:void 0;
1if(void 0!==i)throw SyntaxError("numeric() takes one or two arguments");var n=iu(t);if(!(n in a))throw TypeError("Cannot convert "+t+' of type "'+n+'"; valid input types are '+Object.keys(a).join(", "));if(!(r in o))throw TypeError("Cannot convert "+t+' to type "'+r+'"; valid output types are '+Object.keys(o).join(", "));return r===n?t:o[r](t)}});t.s(["createNumeric",0,cZ],770337);var cY="divideScalar",cX=ig(cY,["typed","numeric"],t=>{var{typed:r,numeric:i}=t;return r(cY,{"number, number":function(t,r){return t/r},"Complex, Complex":function(t,r){return t.div(r)},"BigNumber, BigNumber":function(t,r){return t.div(r)},"bigint, bigint":function(t,r){return t/r},"Fraction, Fraction":function(t,r){return t.div(r)},"Unit, number | Complex | Fraction | BigNumber | Unit":(t,r)=>t.divide(r),"number | Fraction | Complex | BigNumber, Unit":(t,r)=>r.divideInto(t)})});t.s(["createDivideScalar",0,cX],597928);var cK=ig("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],t=>{var{typed:r,config:i,identity:n,multiply:a,matrix:o,inv:s,number:l,fraction:u,Complex:c}=t;return r("pow",{"number, number":h,"Complex, Complex":function(t,r){return t.pow(r)},"BigNumber, BigNumber":function(t,r){return r.isInteger()||t>=0||i.predictable?t.pow(r):new c(t.toNumber(),0).pow(r.toNumber(),0)},"bigint, bigint":(t,r)=>t**r,"Fraction, Fraction":function(t,r){var n=t.pow(r);if(null!=n)return n;if(!i.predictable)return h(t.valueOf(),r.valueOf());throw Error("Result of pow is non-rational and cannot be expressed as a fraction")},"Array, number":f,"Array, BigNumber":function(t,r){return f(t,r.toNumber())},"Matrix, number":d,"Matrix, BigNumber":function(t,r){return d(t,r.toNumber())},"Unit, number | BigNumber":function(t,r){return t.pow(r)}});function h(t,r){if(i.predictable&&!iS(r)&&t<0)try{var n=u(r),a=l(n);if((r===a||1e-14>Math.abs((r-a)/r))&&n.d%2n===1n)return(n.n%2n===0n?1:-1)*Math.pow(-t,r)}catch(t){}return i.predictable&&(t<-1&&r===1/0||t>-1&&t<0&&r===-1/0)?NaN:iS(r)||t>=0||i.predictable?sR(t,r):t*t<1&&r===1/0||t*t>1&&r===-1/0?0:new c(t,0).pow(r,0)}function f(t,r){if(!iS(r))throw TypeError("For A^b, b must be an integer (value is "+r+")");var i=a6(t);if(2!==i.length)throw Error("For A^b, A must be 2 dimensional (A has "+i.length+" dimensions)");if(i[0]!==i[1])throw Error("For A^b, A must be square (size is "+i[0]+"x"+i[1]+")");if(r<0)try{return f(s(t),-r)}catch(t){if("Cannot calculate inverse, determinant is zero"===t.message)throw TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+r+")");throw t}for(var o=n(i[0]).valueOf(),l=t;r>=1;)(1&r)==1&&(o=a(l,o)),r>>=1,l=a(l,l);return o}function d(t,r){return o(f(t.valueOf(),r))}});t.s(["createPow",0,cK],247484);var cQ="Number of decimals in function round must be an integer",cJ="round",c0=ig(cJ,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],t=>{var{typed:r,config:i,matrix:n,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:l}=t,u=sQ({typed:r,equalScalar:a}),c=sJ({typed:r,DenseMatrix:l}),h=s0({typed:r});function f(t){return Math.abs(iF(t).exponent)}return r(cJ,{number:function(t){var r=sF(t,f(i.relTol));return sF(iV(t,r,i.relTol,i.absTol)?r:t)},"number, number":function(t,r){var n=f(i.relTol);if(r>=n)return sF(t,r);var a=sF(t,n);return sF(iV(t,a,i.relTol,i.absTol)?a:t,r)},"number, BigNumber":function(t,r){if(!r.isInteger())throw TypeError(cQ);return new s(t).toDecimalPlaces(r.toNumber())},Complex:function(t){return t.round()},"Complex, number":function(t,r){if(r%1)throw TypeError(cQ);return t.round(r)},"Complex, BigNumber":function(t,r){if(!r.isInteger())throw TypeError(cQ);var i=r.toNumber();return t.round(i)},BigNumber:function(t){var r=new s(t).toDecimalPlaces(f(i.relTol));return(oB(t,r,i.relTol,i.absTol)?r:t).toDecimalPlaces(0)},"BigNumber, BigNumber":function(t,r){if(!r.isInteger())throw TypeError(cQ);var n=f(i.relTol);if(r>=n)return t.toDecimalPlaces(r.toNumber());var a=t.toDecimalPlaces(n);return(oB(t,a,i.relTol,i.absTol)?a:t).toDecimalPlaces(r.toNumber())},bigint:t=>t,"bigint, number":(t,r)=>t,"bigint, BigNumber":(t,r)=>t,Fraction:function(t){return t.round()},"Fraction, number":function(t,r){if(r%1)throw TypeError(cQ);return t.round(r)},"Fraction, BigNumber":function(t,r){if(!r.isInteger())throw TypeError(cQ);return t.round(r.toNumber())},"Unit, number, Unit":r.referToSelf(t=>function(r,i,n){var a=r.toNumeric(n);return n.multiply(t(a,i))}),"Unit, BigNumber, Unit":r.referToSelf(t=>(r,i,n)=>t(r,i.toNumber(),n)),"Array | Matrix, number | BigNumber, Unit":r.referToSelf(t=>(r,i,n)=>oP(r,r=>t(r,i,n),!0)),"Array | Matrix | Unit, Unit":r.referToSelf(t=>(r,i)=>t(r,0,i)),"Array | Matrix":r.referToSelf(t=>r=>oP(r,t,!0)),"SparseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>
1u(r,i,t,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>h(r,i,t,!1)),"Array, number | BigNumber":r.referToSelf(t=>(r,i)=>h(n(r),i,t,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":r.referToSelf(t=>(r,i)=>a(r,0)?o(i.size(),i.storage()):c(i,r,t,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":r.referToSelf(t=>(r,i)=>a(r,0)?o(i.size(),i.storage()):h(i,r,t,!0)),"number | Complex | BigNumber | Fraction, Array":r.referToSelf(t=>(r,i)=>h(n(i),r,t,!0).valueOf())})});t.s(["createRound",0,c0],937839);var c1=Math.log(16),c2=ig("log",["config","typed","typeOf","divideScalar","Complex"],t=>{var{typed:r,typeOf:i,config:n,divideScalar:a,Complex:o}=t;function s(t){return t.log()}function l(t){return s(new o(t,0))}return r("log",{number:function(t){return t>=0||n.predictable?sD(t):l(t)},bigint:lw(c1,sD,n,l),Complex:s,BigNumber:function(t){return!t.isNegative()||n.predictable?t.ln():l(t.toNumber())},"any, any":r.referToSelf(t=>(r,n)=>{if("Fraction"===i(r)&&"Fraction"===i(n)){var o=r.log(n);if(null!==o)return o}return a(t(r),t(n))})})});t.s(["createLog",0,c2],137638);var c3="log1p",c4=ig(c3,["typed","config","divideScalar","log","Complex"],t=>{var{typed:r,config:i,divideScalar:n,log:a,Complex:o}=t;return r(c3,{number:function(t){return t>=-1||i.predictable?iI(t):s(new o(t,0))},Complex:s,BigNumber:function(t){var r=t.plus(1);return!r.isNegative()||i.predictable?r.ln():s(new o(t.toNumber(),0))},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t)),"any, any":r.referToSelf(t=>(r,i)=>n(t(r),a(i)))});function s(t){var r=t.re+1;return new o(Math.log(Math.sqrt(r*r+t.im*t.im)),Math.atan2(t.im,r))}});t.s(["createLog1p",0,c4],942528);var c6="nthRoots",c5=ig(c6,["config","typed","divideScalar","Complex"],t=>{var{typed:r,config:i,divideScalar:n,Complex:a}=t,o=[function(t){return new a(t,0)},function(t){return new a(0,t)},function(t){return new a(-t,0)},function(t){return new a(0,-t)}];function s(t,r){if(r<0)throw Error("Root must be greater than zero");if(0===r)throw Error("Root must be non-zero");if(r%1!=0)throw Error("Root must be an integer");if(0===t||0===t.abs())return[new a(0,0)];var i,n="number"==typeof t;(n||0===t.re||0===t.im)&&(i=n?2*(t<0):0===t.im?2*(t.re<0):2*(t.im<0)+1);for(var s=t.arg(),l=t.abs(),u=[],c=Math.pow(l,1/r),h=0;h<r;h++){var f=(i+4*h)/r;if(f===Math.round(f)){u.push(o[f%4](c));continue}u.push(new a({r:c,phi:(s+2*Math.PI*h)/r}))}return u}return r(c6,{Complex:function(t){return s(t,2)},"Complex, number":s})});t.s(["createNthRoots",0,c5],41333);var c8="dotPow",c7=ig(c8,["typed","equalScalar","matrix","pow","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,equalScalar:i,matrix:n,pow:a,DenseMatrix:o,concat:s,SparseMatrix:l}=t,u=ls({typed:r}),c=ua({typed:r,SparseMatrix:l}),h=sQ({typed:r,equalScalar:i}),f=sJ({typed:r,DenseMatrix:o}),d=lh({typed:r,matrix:n,concat:s}),p={};for(var m in a.signatures)!Object.prototype.hasOwnProperty.call(a.signatures,m)||m.includes("Matrix")||m.includes("Array")||(p[m]=a.signatures[m]);var g=r(p);return r(c8,d({elop:g,SS:c,DS:u,Ss:h,sS:f}))});t.s(["createDotPow",0,c7],635226);var c9="dotDivide",he=ig(c9,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,matrix:i,equalScalar:n,divideScalar:a,DenseMatrix:o,concat:s,SparseMatrix:l}=t,u=lo({typed:r,equalScalar:n}),c=ls({typed:r}),h=ua({typed:r,SparseMatrix:l}),f=sQ({typed:r,equalScalar:n}),d=sJ({typed:r,DenseMatrix:o}),p=lh({typed:r,matrix:i,concat:s});return r(c9,p({elop:a,SS:h,DS:c,SD:u,Ss:f,sS:d}))});function ht(t){var{DenseMatrix:r}=t;return function(t,i,n){var a=t.size();if(2!==a.length)throw RangeError("Matrix must be two dimensional (size: "+a0(a)+")");var o=a[0];if(o!==a[1])throw RangeError("Matrix must be square (size: "+a0(a)+")");var s=[];if(rL(i)){var l=i.size(),u=i._data;if(1===l.length){if(l[0]!==o)throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var c=0;c<o;c++)s[c]=[u[c]];return new r({data:s,size:[o,1],datatype:i._datatype})}if(2===l.length){if(l[0]!==o||1!==l[1])throw RangeError("Dimension mismatch. Matrix columns must match vector length.");
1if(rF(i)){if(n){s=[];for(var h=0;h<o;h++)s[h]=[u[h][0]];return new r({data:s,size:[o,1],datatype:i._datatype})}return i}if(rB(i)){for(var f=0;f<o;f++)s[f]=[0];for(var d=i._values,p=i._index,m=i._ptr,g=m[1],y=m[0];y<g;y++)s[p[y]][0]=d[y];return new r({data:s,size:[o,1],datatype:i._datatype})}}throw RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(rN(i)){var v=a6(i);if(1===v.length){if(v[0]!==o)throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var _=0;_<o;_++)s[_]=[i[_]];return new r({data:s,size:[o,1]})}if(2===v.length){if(v[0]!==o||1!==v[1])throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var b=0;b<o;b++)s[b]=[i[b][0]];return new r({data:s,size:[o,1]})}throw RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}t.s(["createDotDivide",0,he],719459);var hr="lsolve",hi=ig(hr,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],t=>{var{typed:r,matrix:i,divideScalar:n,multiplyScalar:a,subtractScalar:o,equalScalar:s,DenseMatrix:l}=t,u=ht({DenseMatrix:l});return r(hr,{"SparseMatrix, Array | Matrix":function(t,r){return function(t,r){for(var i=(r=u(t,r,!0))._data,c=t._size[0],h=t._size[1],f=t._values,d=t._index,p=t._ptr,m=[],g=0;g<h;g++){var y=i[g][0]||0;if(s(y,0))m[g]=[0];else{for(var v=0,_=[],b=[],x=p[g],w=p[g+1],E=x;E<w;E++){var T=d[E];T===g?v=f[E]:T>g&&(_.push(f[E]),b.push(T))}if(s(v,0))throw Error("Linear system cannot be solved since matrix is singular");for(var A=n(y,v),S=0,C=b.length;S<C;S++){var M=b[S];i[M]=[o(i[M][0]||0,a(A,_[S]))]}m[g]=[A]}}return new l({data:m,size:[c,1]})}(t,r)},"DenseMatrix, Array | Matrix":function(t,r){return c(t,r)},"Array, Array | Matrix":function(t,r){return c(i(t),r).valueOf()}});function c(t,r){for(var i=(r=u(t,r,!0))._data,c=t._size[0],h=t._size[1],f=[],d=t._data,p=0;p<h;p++){var m=i[p][0]||0,g=void 0;if(s(m,0))g=0;else{var y=d[p][p];if(s(y,0))throw Error("Linear system cannot be solved since matrix is singular");g=n(m,y);for(var v=p+1;v<c;v++)i[v]=[o(i[v][0]||0,a(g,d[v][p]))]}f[p]=[g]}return new l({data:f,size:[c,1]})}});t.s(["createLsolve",0,hi],310022);var hn="usolve",ha=ig(hn,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],t=>{var{typed:r,matrix:i,divideScalar:n,multiplyScalar:a,subtractScalar:o,equalScalar:s,DenseMatrix:l}=t,u=ht({DenseMatrix:l});return r(hn,{"SparseMatrix, Array | Matrix":function(t,r){return function(t,r){for(var i=(r=u(t,r,!0))._data,c=t._size[0],h=t._size[1],f=t._values,d=t._index,p=t._ptr,m=[],g=h-1;g>=0;g--){var y=i[g][0]||0;if(s(y,0))m[g]=[0];else{for(var v=0,_=[],b=[],x=p[g],w=p[g+1],E=w-1;E>=x;E--){var T=d[E];T===g?v=f[E]:T<g&&(_.push(f[E]),b.push(T))}if(s(v,0))throw Error("Linear system cannot be solved since matrix is singular");for(var A=n(y,v),S=0,C=b.length;S<C;S++){var M=b[S];i[M]=[o(i[M][0],a(A,_[S]))]}m[g]=[A]}}return new l({data:m,size:[c,1]})}(t,r)},"DenseMatrix, Array | Matrix":function(t,r){return c(t,r)},"Array, Array | Matrix":function(t,r){return c(i(t),r).valueOf()}});function c(t,r){for(var i=(r=u(t,r,!0))._data,c=t._size[0],h=t._size[1],f=[],d=t._data,p=h-1;p>=0;p--){var m=i[p][0]||0,g=void 0;if(s(m,0))g=0;else{var y=d[p][p];if(s(y,0))throw Error("Linear system cannot be solved since matrix is singular");g=n(m,y);for(var v=p-1;v>=0;v--)i[v]=[o(i[v][0]||0,a(g,d[v][p]))]}f[p]=[g]}return new l({data:f,size:[c,1]})}});t.s(["createUsolve",0,ha],124382);var ho="lsolveAll",hs=ig(ho,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],t=>{var{typed:r,matrix:i,divideScalar:n,multiplyScalar:a,subtractScalar:o,equalScalar:s,DenseMatrix:l}=t,u=ht({DenseMatrix:l});return r(ho,{"SparseMatrix, Array | Matrix":function(t,r){return function(t,r){for(var i=[u(t,r,!0)._data.map(t=>t[0])],c=t._size[0],h=t._size[1],f=t._values,d=t._index,p=t._ptr,m=0;m<h;m++)for(var g=i.length,y=0;y<g;y++){for(var v=i[y],_=[],b=[],x=p[m],w=p[m+1],E=0,T=x;T<w;T++){var A=d[T];A===m?E=f[T]:A>m&&(_.push(f[T]),b.push(A))}if(s(E,0))if(s(v[m],0)){if(0===y){var S=[...v];S[m]=1;for(var C=0,M=b.length;C<M;C++){var D=b[C];S[D]=o(S[D],_[C])}i.push(S)}}else{if(0===y)return[];i.splice(y,1),y-=1,g-=1}else{v[m]=n(v[m],E);for(var P=0,I=b.length;P<I;P++){var k=b[P];v[k]=o(v[k],a(v[m],_[P]))}}}return i.map(t=>new l({data:t.map(t=>[t]),size:[c,1]}))}(t,r)}
1,"DenseMatrix, Array | Matrix":function(t,r){return c(t,r)},"Array, Array | Matrix":function(t,r){return c(i(t),r).map(t=>t.valueOf())}});function c(t,r){for(var i=[u(t,r,!0)._data.map(t=>t[0])],c=t._data,h=t._size[0],f=t._size[1],d=0;d<f;d++)for(var p=i.length,m=0;m<p;m++){var g=i[m];if(s(c[d][d],0))if(s(g[d],0)){if(0===m){var y=[...g];y[d]=1;for(var v=d+1;v<f;v++)y[v]=o(y[v],c[v][d]);i.push(y)}}else{if(0===m)return[];i.splice(m,1),m-=1,p-=1}else{g[d]=n(g[d],c[d][d]);for(var _=d+1;_<f;_++)g[_]=o(g[_],a(g[d],c[_][d]))}}return i.map(t=>new l({data:t.map(t=>[t]),size:[h,1]}))}});t.s(["createLsolveAll",0,hs],623212);var hl="usolveAll",hu=ig(hl,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],t=>{var{typed:r,matrix:i,divideScalar:n,multiplyScalar:a,subtractScalar:o,equalScalar:s,DenseMatrix:l}=t,u=ht({DenseMatrix:l});return r(hl,{"SparseMatrix, Array | Matrix":function(t,r){return function(t,r){for(var i=[u(t,r,!0)._data.map(t=>t[0])],c=t._size[0],h=t._size[1],f=t._values,d=t._index,p=t._ptr,m=h-1;m>=0;m--)for(var g=i.length,y=0;y<g;y++){for(var v=i[y],_=[],b=[],x=p[m],w=p[m+1],E=0,T=w-1;T>=x;T--){var A=d[T];A===m?E=f[T]:A<m&&(_.push(f[T]),b.push(A))}if(s(E,0))if(s(v[m],0)){if(0===y){var S=[...v];S[m]=1;for(var C=0,M=b.length;C<M;C++){var D=b[C];S[D]=o(S[D],_[C])}i.push(S)}}else{if(0===y)return[];i.splice(y,1),y-=1,g-=1}else{v[m]=n(v[m],E);for(var P=0,I=b.length;P<I;P++){var k=b[P];v[k]=o(v[k],a(v[m],_[P]))}}}return i.map(t=>new l({data:t.map(t=>[t]),size:[c,1]}))}(t,r)},"DenseMatrix, Array | Matrix":function(t,r){return c(t,r)},"Array, Array | Matrix":function(t,r){return c(i(t),r).map(t=>t.valueOf())}});function c(t,r){for(var i=[u(t,r,!0)._data.map(t=>t[0])],c=t._data,h=t._size[0],f=t._size[1],d=f-1;d>=0;d--)for(var p=i.length,m=0;m<p;m++){var g=i[m];if(s(c[d][d],0))if(s(g[d],0)){if(0===m){var y=[...g];y[d]=1;for(var v=d-1;v>=0;v--)y[v]=o(y[v],c[v][d]);i.push(y)}}else{if(0===m)return[];i.splice(m,1),m-=1,p-=1}else{g[d]=n(g[d],c[d][d]);for(var _=d-1;_>=0;_--)g[_]=o(g[_],a(g[d],c[_][d]))}}return i.map(t=>new l({data:t.map(t=>[t]),size:[h,1]}))}});t.s(["createUsolveAll",0,hu],420361);var hc=ig("matAlgo08xS0Sid",["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return function(t,n,a){var o,s,l,u,c,h=t._values,f=t._index,d=t._ptr,p=t._size,m=t._datatype||void 0===t._data?t._datatype:t.getDataType(),g=n._values,y=n._index,v=n._ptr,_=n._size,b=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(p.length!==_.length)throw new rp(p.length,_.length);if(p[0]!==_[0]||p[1]!==_[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+_+")");if(!h||!g)throw Error("Cannot perform operation on Pattern Sparse Matrices");var x=p[0],w=p[1],E=i,T=0,A=a;"string"==typeof m&&m===b&&"mixed"!==m&&(o=m,E=r.find(i,[o,o]),T=r.convert(0,o),A=r.find(a,[o,o]));for(var S=[],C=[],M=[],D=[],P=[],I=0;I<w;I++){M[I]=C.length;var k=I+1;for(l=d[I],u=d[I+1],s=l;s<u;s++)P[c=f[s]]=k,D[c]=h[s],C.push(c);for(l=v[I],u=v[I+1],s=l;s<u;s++)P[c=y[s]]===k&&(D[c]=A(D[c],g[s]));for(s=M[I];s<C.length;){var O=D[c=C[s]];E(O,T)?C.splice(s,1):(S.push(O),s++)}}return M[w]=C.length,t.createSparseMatrix({values:S,index:C,ptr:M,size:[x,w],datatype:m===t._datatype&&b===n._datatype?o:void 0})}}),hh=ig("useMatrixForArrayScalar",["typed","matrix"],t=>{var{typed:r,matrix:i}=t;return{"Array, number":r.referTo("DenseMatrix, number",t=>(r,n)=>t(i(r),n).valueOf()),"Array, BigNumber":r.referTo("DenseMatrix, BigNumber",t=>(r,n)=>t(i(r),n).valueOf()),"number, Array":r.referTo("number, DenseMatrix",t=>(r,n)=>t(r,i(n)).valueOf()),"BigNumber, Array":r.referTo("BigNumber, DenseMatrix",t=>(r,n)=>t(r,i(n)).valueOf())}}),hf="leftShift",hd=ig(hf,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,zeros:a,DenseMatrix:o,concat:s}=t,l=ld({typed:r}),u=lo({typed:r,equalScalar:n}),c=hc({typed:r,equalScalar:n}),h=lm({typed:r,DenseMatrix:o}),f=sQ({typed:r,equalScalar:n}),d=s0({typed:r}),p=lh({typed:r,matrix:i,concat:s}),m=hh({typed:r,matrix:i});return r(hf,{"number, number":l5,"BigNumber, BigNumber":lJ,"bigint, bigint":(t,r)=>t<<r,"SparseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>
1n(i,0)?r.clone():f(r,i,t,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>n(i,0)?r.clone():d(r,i,t,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(t=>(r,i)=>n(r,0)?a(i.size(),i.storage()):h(i,r,t,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(t=>(r,i)=>n(r,0)?a(i.size(),i.storage()):d(i,r,t,!0))},m,p({SS:c,DS:l,SD:u}))});t.s(["createLeftShift",0,hd],214857);var hp="rightArithShift",hm=ig(hp,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,zeros:a,DenseMatrix:o,concat:s}=t,l=ld({typed:r}),u=lo({typed:r,equalScalar:n}),c=hc({typed:r,equalScalar:n}),h=lm({typed:r,DenseMatrix:o}),f=sQ({typed:r,equalScalar:n}),d=s0({typed:r}),p=lh({typed:r,matrix:i,concat:s}),m=hh({typed:r,matrix:i});return r(hp,{"number, number":l8,"BigNumber, BigNumber":l0,"bigint, bigint":(t,r)=>t>>r,"SparseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>n(i,0)?r.clone():f(r,i,t,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>n(i,0)?r.clone():d(r,i,t,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(t=>(r,i)=>n(r,0)?a(i.size(),i.storage()):h(i,r,t,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(t=>(r,i)=>n(r,0)?a(i.size(),i.storage()):d(i,r,t,!0))},m,p({SS:c,DS:l,SD:u}))});t.s(["createRightArithShift",0,hm],836458);var hg="rightLogShift",hy=ig(hg,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,zeros:a,DenseMatrix:o,concat:s}=t,l=ld({typed:r}),u=lo({typed:r,equalScalar:n}),c=hc({typed:r,equalScalar:n}),h=lm({typed:r,DenseMatrix:o}),f=sQ({typed:r,equalScalar:n}),d=s0({typed:r}),p=lh({typed:r,matrix:i,concat:s}),m=hh({typed:r,matrix:i});return r(hg,{"number, number":l7,"SparseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>n(i,0)?r.clone():f(r,i,t,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(t=>(r,i)=>n(i,0)?r.clone():d(r,i,t,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(t=>(r,i)=>n(r,0)?a(i.size(),i.storage()):h(i,r,t,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(t=>(r,i)=>n(r,0)?a(i.size(),i.storage()):d(i,r,t,!0))},m,p({SS:c,DS:l,SD:u}))});t.s(["createRightLogShift",0,hy],353877);var hv=ig("and",["typed","matrix","equalScalar","zeros","not","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,zeros:a,not:o,concat:s}=t,l=lo({typed:r,equalScalar:n}),u=lb({typed:r,equalScalar:n}),c=sQ({typed:r,equalScalar:n}),h=s0({typed:r}),f=lh({typed:r,matrix:i,concat:s});return r("and",{"number, number":uy,"Complex, Complex":function(t,r){return(0!==t.re||0!==t.im)&&(0!==r.re||0!==r.im)},"BigNumber, BigNumber":function(t,r){return!t.isZero()&&!r.isZero()&&!t.isNaN()&&!r.isNaN()},"bigint, bigint":uy,"Unit, Unit":r.referToSelf(t=>(r,i)=>t(r.value||0,i.value||0)),"SparseMatrix, any":r.referToSelf(t=>(r,i)=>o(i)?a(r.size(),r.storage()):c(r,i,t,!1)),"DenseMatrix, any":r.referToSelf(t=>(r,i)=>o(i)?a(r.size(),r.storage()):h(r,i,t,!1)),"any, SparseMatrix":r.referToSelf(t=>(r,i)=>o(r)?a(r.size(),r.storage()):c(i,r,t,!0)),"any, DenseMatrix":r.referToSelf(t=>(r,i)=>o(r)?a(r.size(),r.storage()):h(i,r,t,!0)),"Array, any":r.referToSelf(t=>(r,n)=>t(i(r),n).valueOf()),"any, Array":r.referToSelf(t=>(r,n)=>t(r,i(n)).valueOf())},f({SS:u,DS:l}))});t.s(["createAnd",0,hv],306431);var h_="compare",hb=ig(h_,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],t=>{var{typed:r,config:i,equalScalar:n,matrix:a,BigNumber:o,Fraction:s,DenseMatrix:l,concat:u}=t,c=ls({typed:r}),h=ll({typed:r,equalScalar:n}),f=sJ({typed:r,DenseMatrix:l}),d=lh({typed:r,matrix:a,concat:u}),p=o3({typed:r});return r(h_,hx({typed:r,config:i}),{"boolean, boolean":function(t,r){return t===r?0:t>r?1:-1},"BigNumber, BigNumber":function(t,r){return new o(oB(t,r,i.relTol,i.absTol)?0:t.cmp(r))},"bigint, bigint":function(t,r){return t===r?0n:t>r?1n:-1n},"Fraction, Fraction":function(t,r){return new s(t.compare(r))},"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},p,d({SS:h,DS:c,Ss:f}))}),hx=ig(h_,["typed","config"],t=>{var{typed:r,config:i}=t;return r(h_,{"number, number":function(t,r){return iV(t,r,i.relTol,i.absTol)?0:t>r?1:-1}})});t.s(["createCompare",0,hb],598061);var hw=t.i(123180),hE="compareNatural",hT=ig(hE,["typed","compare"],t=>{var{typed:r,compare:i}=t,n=i.signatures["boolean,boolean"];return r(hE,{"any, any":function t(r,o){var s,l,u,c=iu(r),h=iu(o);if(("number"===c||"BigNumber"===c||"Fraction"===c||"bigint"===c)&&("number"===h||"BigNumber"===h||"Fraction"===h||"bigint"===h))return"0"!==(u=i(r,o)).toString()?u>0?1:-1:(0,hw.default)(c,h);var f=["Array","DenseMatrix","SparseMatrix"];
1if(f.includes(c)||f.includes(h))return 0!==(u=function t(r,i,n){return rB(i)&&rB(n)?a(r,i.toJSON().values,n.toJSON().values):rB(i)?t(r,i.toArray(),n):rB(n)?t(r,i,n.toArray()):rF(i)?t(r,i.toJSON().data,n):rF(n)?t(r,i,n.toJSON().data):Array.isArray(i)?Array.isArray(n)?a(r,i,n):t(r,i,[n]):t(r,[i],n)}(t,r,o))?u:(0,hw.default)(c,h);if(c!==h)return(0,hw.default)(c,h);if("Complex"===c){return s=r,l=o,s.re>l.re?1:s.re<l.re?-1:s.im>l.im?1:s.im<l.im?-1:0}if("Unit"===c)return r.equalBase(o)?t(r.value,o.value):a(t,r.formatUnits(),o.formatUnits());if("boolean"===c)return n(r,o);if("string"===c)return(0,hw.default)(r,o);if("Object"===c)return function(t,r,i){var n=Object.keys(r),o=Object.keys(i);n.sort(hw.default),o.sort(hw.default);var s=a(t,n,o);if(0!==s)return s;for(var l=0;l<n.length;l++){var u=t(r[n[l]],i[o[l]]);if(0!==u)return u}return 0}(t,r,o);if("null"===c||"undefined"===c)return 0;throw TypeError('Unsupported type of value "'+c+'"')}});function a(t,r,i){for(var n=0,a=Math.min(r.length,i.length);n<a;n++){var o=t(r[n],i[n]);if(0!==o)return o}return r.length>i.length?1:r.length<i.length?-1:0}});t.s(["createCompareNatural",0,hT],749637);var hA="compareText";a4.signature="any, any";var hS=ig(hA,["typed","matrix","concat"],t=>{var{typed:r,matrix:i,concat:n}=t,a=lh({typed:r,matrix:i,concat:n});return r(hA,a4,a({elop:a4,Ds:!0}))});t.s(["createCompareText",0,hS],534491);var hC="equal",hM=ig(hC,["typed","matrix","equalScalar","DenseMatrix","SparseMatrix"],t=>{var{typed:r,matrix:i,equalScalar:n,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=ls({typed:r}),u=ua({typed:r,SparseMatrix:s}),c=sJ({typed:r,DenseMatrix:a}),h=lh({typed:r,matrix:i});return r(hC,hD({typed:r,equalScalar:n}),h({elop:n,SS:u,DS:l,Ss:c}))}),hD=ig(hC,["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return r(hC,{"any, any":function(t,r){return null===t?null===r:null===r?null===t:void 0===t?void 0===r:void 0===r?void 0===t:i(t,r)}})});t.s(["createEqual",0,hM],412876);var hP="equalText",hI=ig(hP,["typed","compareText","isZero"],t=>{var{typed:r,compareText:i,isZero:n}=t;return r(hP,{"any, any":function(t,r){return n(i(t,r))}})});t.s(["createEqualText",0,hI],676080);var hk="smaller",hO=ig(hk,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,config:i,bignumber:n,matrix:a,DenseMatrix:o,concat:s,SparseMatrix:l}=t,u=ls({typed:r}),c=ua({typed:r,SparseMatrix:l}),h=sJ({typed:r,DenseMatrix:o}),f=lh({typed:r,matrix:a,concat:s}),d=o3({typed:r});function p(t,r){return t.lt(r)&&!oB(t,r,i.relTol,i.absTol)}return r(hk,hN({typed:r,config:i}),{"boolean, boolean":(t,r)=>t<r,"BigNumber, BigNumber":p,"bigint, bigint":(t,r)=>t<r,"Fraction, Fraction":(t,r)=>-1===t.compare(r),"Fraction, BigNumber":function(t,r){return p(n(t),r)},"BigNumber, Fraction":function(t,r){return p(t,n(r))},"Complex, Complex":function(t,r){throw TypeError("No ordering relation is defined for complex numbers")}},d,f({SS:c,DS:u,Ss:h}))}),hN=ig(hk,["typed","config"],t=>{var{typed:r,config:i}=t;return r(hk,{"number, number":function(t,r){return t<r&&!iV(t,r,i.relTol,i.absTol)}})});t.s(["createSmaller",0,hO],986438);var hL="smallerEq",hR=ig(hL,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,config:i,matrix:n,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=ls({typed:r}),u=ua({typed:r,SparseMatrix:s}),c=sJ({typed:r,DenseMatrix:a}),h=lh({typed:r,matrix:n,concat:o}),f=o3({typed:r});return r(hL,hF({typed:r,config:i}),{"boolean, boolean":(t,r)=>t<=r,"BigNumber, BigNumber":function(t,r){return t.lte(r)||oB(t,r,i.relTol,i.absTol)},"bigint, bigint":(t,r)=>t<=r,"Fraction, Fraction":(t,r)=>1!==t.compare(r),"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},f,h({SS:u,DS:l,Ss:c}))}),hF=ig(hL,["typed","config"],t=>{var{typed:r,config:i}=t;return r(hL,{"number, number":function(t,r){return t<=r||iV(t,r,i.relTol,i.absTol)}})});t.s(["createSmallerEq",0,hR],957302);var hB="larger",hz=ig(hB,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,config:i,bignumber:n,matrix:a,DenseMatrix:o,concat:s,SparseMatrix:l}=t,u=ls({typed:r}),c=ua({typed:r,SparseMatrix:l}),h=sJ({typed:r,DenseMatrix:o}),f=lh({typed:r,matrix:a,concat:s}),d=o3({typed:r});function p(t,r){return t.gt(r)&&!oB(t,r,i.relTol,i.absTol)}return r(hB,hj({typed:r,config:i}),{"boolean, boolean":(t,r)=>t>r,"BigNumber, BigNumber":p,"bigint, bigint":(t,r)=>t>r,"Fraction, Fraction":(t,r)=>1===t.compare(r),"Fraction, BigNumber":function(t,r){return p(n(t),r)},"BigNumber, Fraction":function(t,r){return p(t,n(r))},"Complex, Complex":function(){throw TypeError("No ordering relation is defined for c
1omplex numbers")}},d,f({SS:c,DS:u,Ss:h}))}),hj=ig(hB,["typed","config"],t=>{var{typed:r,config:i}=t;return r(hB,{"number, number":function(t,r){return t>r&&!iV(t,r,i.relTol,i.absTol)}})});t.s(["createLarger",0,hz],47887);var hU="largerEq",hV=ig(hU,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,config:i,matrix:n,DenseMatrix:a,concat:o,SparseMatrix:s}=t,l=ls({typed:r}),u=ua({typed:r,SparseMatrix:s}),c=sJ({typed:r,DenseMatrix:a}),h=lh({typed:r,matrix:n,concat:o}),f=o3({typed:r});return r(hU,h$({typed:r,config:i}),{"boolean, boolean":(t,r)=>t>=r,"BigNumber, BigNumber":function(t,r){return t.gte(r)||oB(t,r,i.relTol,i.absTol)},"bigint, bigint":function(t,r){return t>=r},"Fraction, Fraction":(t,r)=>-1!==t.compare(r),"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},f,h({SS:u,DS:l,Ss:c}))}),h$=ig(hU,["typed","config"],t=>{var{typed:r,config:i}=t;return r(hU,{"number, number":function(t,r){return t>=r||iV(t,r,i.relTol,i.absTol)}})});t.s(["createLargerEq",0,hV],156104);var hG="deepEqual",hq=ig(hG,["typed","equal"],t=>{var{typed:r,equal:i}=t;return r(hG,{"any, any":function(t,r){return function t(r,n){if(Array.isArray(r))if(!Array.isArray(n))return!1;else{var a=r.length;if(a!==n.length)return!1;for(var o=0;o<a;o++)if(!t(r[o],n[o]))return!1;return!0}return!Array.isArray(n)&&i(r,n)}(t.valueOf(),r.valueOf())}})});t.s(["createDeepEqual",0,hq],878275);var hH="unequal",hW=ig(hH,["typed","config","equalScalar","matrix","DenseMatrix","concat","SparseMatrix"],t=>{var{typed:r,config:i,equalScalar:n,matrix:a,DenseMatrix:o,concat:s,SparseMatrix:l}=t,u=ls({typed:r}),c=ua({typed:r,SparseMatrix:l}),h=sJ({typed:r,DenseMatrix:o}),f=lh({typed:r,matrix:a,concat:s});return r(hH,hZ({typed:r,equalScalar:n}),f({elop:function(t,r){return!n(t,r)},SS:c,DS:u,Ss:h}))}),hZ=ig(hH,["typed","equalScalar"],t=>{var{typed:r,equalScalar:i}=t;return r(hH,{"any, any":function(t,r){return null===t?null!==r:null===r?null!==t:void 0===t?void 0!==r:void 0===r?void 0!==t:!i(t,r)}})});t.s(["createUnequal",0,hW],137943);var hY="partitionSelect",hX=ig(hY,["typed","isNumeric","isNaN","compare"],t=>{var{typed:r,isNumeric:i,isNaN:n,compare:a}=t,o=(t,r)=>-a(t,r);return r(hY,{"Array | Matrix, number":function(t,r){return s(t,r,a)},"Array | Matrix, number, string":function(t,r,i){if("asc"===i)return s(t,r,a);if("desc"===i)return s(t,r,o);
1throw Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(t,r,i){if(!iS(r)||r<0)throw Error("k must be a non-negative integer");if(rL(t)){if(t.size().length>1)throw Error("Only one dimensional matrices supported");return l(t.valueOf(),r,i)}if(Array.isArray(t))return l(t,r,i)}function l(t,r,a){if(r>=t.length)throw Error("k out of bounds");for(var o=0;o<t.length;o++)if(i(t[o])&&n(t[o]))return t[o];for(var s=0,l=t.length-1;s<l;){for(var u=s,c=l,h=t[Math.floor(Math.random()*(l-s+1))+s];u<c;)if(a(t[u],h)>=0){var f=t[c];t[c]=t[u],t[u]=f,--c}else++u;a(t[u],h)>0&&--u,r<=u?l=u:s=u+1}return t[r]}});t.s(["createPartitionSelect",0,hX],459350);var hK="sort",hQ=ig(hK,["typed","matrix","compare","compareNatural"],t=>{var{typed:r,matrix:i,compare:n,compareNatural:a}=t,o=(t,r)=>-n(t,r);return r(hK,{Array:function(t){return l(t),t.sort(n)},Matrix:function(t){return u(t),i(t.toArray().sort(n),t.storage())},"Array, function":function(t,r){return l(t),t.sort(r)},"Matrix, function":function(t,r){return u(t),i(t.toArray().sort(r),t.storage())},"Array, string":function(t,r){return l(t),t.sort(s(r))},"Matrix, string":function(t,r){return u(t),i(t.toArray().sort(s(r)),t.storage())}});function s(t){if("asc"===t)return n;if("desc"===t)return o;if("natural"===t)return a;throw Error('String "asc", "desc", or "natural" expected')}function l(t){if(1!==a6(t).length)throw Error("One dimensional array expected")}function u(t){if(1!==t.size().length)throw Error("One dimensional matrix expected")}});t.s(["createSort",0,hQ],767924);var hJ=ig("max",["typed","config","numeric","larger","isNaN"],t=>{var{typed:r,config:i,numeric:n,larger:a,isNaN:o}=t;return r("max",{"Array | Matrix":l,"Array | Matrix, number | BigNumber":function(t,r){return oI(t,r.valueOf(),s)},"...":function(t){if(oM(t))throw TypeError("Scalar values expected in function max");return l(t)}});function s(t,r){try{return a(t,r)?t:r}catch(t){throw cI(t,"max",r)}}function l(t){var r;if(oD(t,function(t){try{o(t)?r=t:(void 0===r||a(t,r))&&(r=t)}catch(r){throw cI(r,"max",t)}}),void 0===r)throw Error("Cannot calculate max of an empty array");return"string"==typeof r&&(r=n(r,iC(r,i))),r}});t.s(["createMax",0,hJ],696215);var h0=ig("min",["typed","config","numeric","smaller","isNaN"],t=>{var{typed:r,config:i,numeric:n,smaller:a,isNaN:o}=t;return r("min",{"Array | Matrix":l,"Array | Matrix, number | BigNumber":function(t,r){return oI(t,r.valueOf(),s)},"...":function(t){if(oM(t))throw TypeError("Scalar values expected in function min");return l(t)}});function s(t,r){try{return a(t,r)?t:r}catch(t){throw cI(t,"min",r)}}function l(t){var r;if(oD(t,function(t){try{o(t)?r=t:(void 0===r||a(t,r))&&(r=t)}catch(r){throw cI(r,"min",t)}}),void 0===r)throw Error("Cannot calculate min of an empty array");return"string"==typeof r&&(r=n(r,iC(r,i))),r}});t.s(["createMin",0,h0],58151);var h1=ig("ImmutableDenseMatrix",["smaller","DenseMatrix"],t=>{var{smaller:r,DenseMatrix:i}=t;function n(t,r){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");if(r&&!rO(r))throw Error("Invalid datatype: "+r);if(rL(t)||rN(t)){var a=new i(t,r);this._data=a._data,this._size=a._size,this._datatype=a._datatype,this._min=null,this._max=null}else if(t&&rN(t.data)&&rN(t.size))this._data=t.data,this._size=t.size,this._datatype=t.datatype,this._min=void 0!==t.min?t.min:null,this._max=void 0!==t.max?t.max:null;else if(t)throw TypeError("Unsupported type of data ("+iu(t)+")");else this._data=[],this._size=[0],this._datatype=r,this._min=null,this._max=null}return n.prototype=new i,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(t){switch(arguments.length){case 1:var r=i.prototype.subset.call(this,t);if(rL(r))return new n({data:r._data,size:r._size,datatype:r._datatype});return r;case 2:case 3:throw Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:ic(this._data),size:ic(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(t){return new n(t)},n.prototype.swapRows=function(){throw Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(null===this._min){var t=null;this.forEach(function(i){(null===t||r(i,t))&&(t=i)}),this._min=null!==t?t:void 0}return this._min},n.prototype.max=function(){if(null===this._max){var t=null;this.forEach(function(i){(null===t||r(t,i))&&(t=i)}),this._max=null!==t?t:void 0}return this._max},n},{isClass:!0});t.s(["createImmutableDenseMatrixClass",0,h1],589866);var h2=ig("Index",["ImmutableDenseMatrix","getMatrixDataType"],t=>{var{ImmutableDenseMatrix:r,getMatrixDataType:i}=t;function n(){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var t=0,r=arguments.length;t<r;t++){var o=t<0||arguments.length<=t?void 0:arguments[t],s=rN(o),l=rL(o),u=typeof o,c=null;if(rz(o))this._dimensions.push(o),this._isScalar=!1;else if(s||l){var h=void 0;this._isScalar=!1,"boolean"===i(o)?(s&&(h=a(h3(o).valueOf())),l&&(h=a(h3(o._data).valueOf())),c=o.valueOf().length):h=a(o.valueOf()),this._dimensions.push(h)}else if("number"===u)this._dimensions.push(o);else if("bigint"===u)this._dimensions.push(Number(o));else if("string"===u)this._dimensions.push(o);else throw TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");this._sourceSize.push(c)}}function a(t){for(var i=0,n=t.length;i<n;i++)if(!rC(t[i])||!iS(t[i]))throw TypeError("Index parameters must be positive integer numbers");var a=new r;return a._data=t,a._size=[t.length],a}return n.prototype.type="Index",n.prototype.isIndex=!0,n.prototype.clone=function(){var t=new n;return t._dimensions=ic(this._dimensions),t._isScalar=this._isScalar,t._sourceSize=this._sourceSize,t},n.create=function(t){var r=new n;return n.apply(r,t),r},n.prototype.size=function(){for(var t=[],r=0,i=this._dimensions.length;r<i;r++){var n=this._dimensions[r];t[r]=rO(n)||rC(n)?1:n.size()[0]}return t},n.prototype.max=function(){for(var t=[],r=0,i=this._dimensions.length;r<i;r++){var n=this._dimensions[r];t[r]=rO(n)||rC(n)?n:n.max()}return t},n.prototype.min=function(){for(var t=[],r=0,i=this._dimensions.length;r<i;r++){var n=this._dimensions[r];t[r]=rO(n)||rC(n)?n:n.min()}return t},n.prototype.forEach=function(t){for(var r=0,i=this._dimensions.length;r<i;r++)t(this._dimensions[r],r,this)},n.prototype.dimension=function(t){var r;return rC(t)&&null!=(r=this._dimensions[t])?r:null},n.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&rO(this._dimensions[0])},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var t=[],r=0,i=this._dimensions.length;r<i;r++){var n=this._dimensions[r];t.push(rO(n)||rC(n)?n:n.toArray())}return t},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var t=[],r=0,i=this._dimensions.length;r<i;r++){var n=this._dimensions[r];rO(n)?t.push(JSON.stringify(n)):t.push(n.toString())}return"["+t.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},n.fromJSON=function(t){return n.create(t.dimensions)},n},{isClass:!0});function h3(t){var r=[];return t.forEach((t,i)=>{t&&r.push(i)}),r}t.s(["createIndexClass",0,h2],861884);var h4=ig("FibonacciHeap",["smaller","larger"],t=>{var{smaller:r,larger:i}=t,n=1/Math.log((1+Math.sqrt(5))/2);function a(){if(!(this instanceof a))throw SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function o(t,r,i){r.left.right=r.right,r.right.left=r.left,i.degree--,i.child===r&&(i.child=r.right),0===i.degree&&(i.child=null),r.left=t,r.right=t.right,t.right=r,r.right.left=r,r.parent=null,r.mark=!1}a.prototype.type="FibonacciHeap",a.prototype.isFibonacciHeap=!0,a.prototype.insert=function(t,i){var n={key:t,value:i,degree:0};if(this._minimum){var a=this._minimum;n.left=a,n.right=a.right,a.right=n,n.right.left=n,r(t,a.key)&&(this._minimum=n)}else n.left=n,n.right=n,this._minimum=n;return this._size++,n},a.prototype.size=function(){return this._size},a.prototype.clear=function(){this._minimum=null,this._size=0},a.prototype.isEmpty=function(){return 0===this._size},a.prototype.extractMinimum=function(){var t=this._minimum;if(null===t)return t;for(var a=this._minimum,o=t.degree,l=t.child;o>0;){var u=l.right;l.left.right=l.right,l.right.left=l.left,l.left=a,l.right=a.right,a.right=l,l.right.left=l,l.parent=null,l=u,o--}return t.left.right=t.right,t.right.left=t.left,a=t===t.right?null:function(t,a){var o,l=Math.floor(Math.log(a)*n)+1,u=Array(l),c=0,h=t;if(h)for(c++,h=h.right;h!==t;)c++,h=h.right;for(;c>0;){for(var f=h.degree,d=h.right;o=u[f];){if(i(h.key,o.key)){var p=o;o=h,h=p}s(o,h),u[f]=null,f++}u[f]=h,h=d,c--}t=null;for(var m=0;m<l;m++)(o=u[m])&&(t?(o.left.right=o.right,o.right.left=o.left,o.left=t,o.right=t.right,t.right=o,o.right.left=o,r(o.key,t.key)&&
1(t=o)):t=o);return t}(a=t.right,this._size),this._size--,this._minimum=a,t},a.prototype.remove=function(t){var i,n,a;this._minimum=(i=this._minimum,(n=t).key=-1,(a=n.parent)&&r(n.key,a.key)&&(o(i,n,a),function t(r,i){var n=i.parent;n&&(i.mark?(o(r,i,n),t(n)):i.mark=!0)}(i,a)),r(n.key,i.key)&&(i=n),i),this.extractMinimum()};var s=function(t,r){t.left.right=t.right,t.right.left=t.left,t.parent=r,r.child?(t.left=r.child,t.right=r.child.right,r.child.right=t,t.right.left=t):(r.child=t,t.right=t,t.left=t),r.degree++,t.mark=!1};return a},{isClass:!0});t.s(["createFibonacciHeapClass",0,h4],827385);var h6=ig("Spa",["addScalar","equalScalar","FibonacciHeap"],t=>{var{addScalar:r,equalScalar:i,FibonacciHeap:n}=t;function a(){if(!(this instanceof a))throw SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return a.prototype.type="Spa",a.prototype.isSpa=!0,a.prototype.set=function(t,r){if(this._values[t])this._values[t].value=r;else{var i=this._heap.insert(t,r);this._values[t]=i}},a.prototype.get=function(t){var r=this._values[t];return r?r.value:0},a.prototype.accumulate=function(t,i){var n=this._values[t];n?n.value=r(n.value,i):(n=this._heap.insert(t,i),this._values[t]=n)},a.prototype.forEach=function(t,r,n){var a=this._heap,o=this._values,s=[],l=a.extractMinimum();for(l&&s.push(l);l&&l.key<=r;)l.key>=t&&!i(l.value,0)&&n(l.key,l.value,this),(l=a.extractMinimum())&&s.push(l);for(var u=0;u<s.length;u++){var c=s[u];o[(l=a.insert(c.key,c.value)).key]=l}},a.prototype.swap=function(t,r){var i=this._values[t],n=this._values[r];if(!i&&n)i=this._heap.insert(t,n.value),this._heap.remove(n),this._values[t]=i,this._values[r]=void 0;else if(i&&!n)n=this._heap.insert(r,i.value),this._heap.remove(i),this._values[r]=n,this._values[t]=void 0;else if(i&&n){var a=i.value;i.value=n.value,n.value=a}},a},{isClass:!0});function h5(t){var{hasher:r,limit:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i=null==i?1/0:i,r=null==r?JSON.stringify:r,function n(){"object"!=typeof n.cache&&(n.cache={values:new Map,lru:(a=i||1/0,o=0,s=1,l=Object.create(null),u=Object.create(null),c=0,h=function(t){var r=u[t];if(r&&(delete l[r],delete u[t],--o,s===r)){if(!o){c=0,s=1;return}for(;!Object.prototype.hasOwnProperty.call(l,++s););}},a=Math.abs(a),{hit:function(t){var r=u[t],i=++c;if(l[i]=t,u[t]=i,!r){if(++o<=a)return;return h(t=l[s]),t}if(delete l[r],s===r)for(;!Object.prototype.hasOwnProperty.call(l,++s););},delete:h,clear:function(){o=c=0,s=1,l=Object.create(null),u=Object.create(null)}})});for(var a,o,s,l,u,c,h,f=[],d=0;d<arguments.length;d++)f[d]=arguments[d];var p=r(f);if(n.cache.values.has(p))return n.cache.lru.hit(p),n.cache.values.get(p);var m=t.apply(t,f);return n.cache.values.set(p,m),n.cache.values.delete(n.cache.lru.hit(p)),m}}t.s(["createSpaClass",0,h6],449221);var h8=h5(function(t){return new t(1).exp()},{hasher:ft}),h7=h5(function(t){return new t(1).plus(new t(5).sqrt()).div(2)},{hasher:ft}),h9=h5(function(t){return t.acos(-1)},{hasher:ft}),fe=h5(function(t){return h9(t).times(2)},{hasher:ft});function ft(t){return t[0].precision}function fr(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function fi(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?fr(Object(i),!0).forEach(function(r){cv(t,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):fr(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}var fn=ig("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],t=>{var r,i,n,{on:a,config:o,addScalar:s,subtractScalar:l,multiplyScalar:u,divi
1deScalar:c,pow:h,abs:f,fix:d,round:p,equal:m,isNumeric:g,format:y,number:v,Complex:_,BigNumber:b,Fraction:x}=t;function w(t,r){if(!(this instanceof w))throw Error("Constructor must be called with the new operator");if(!(null==t||g(t)||rP(t)))throw TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===r)this.units=[],this.dimensions=N.map(t=>0);else if("string"==typeof r){var i=w.parse(r);this.units=i.units,this.dimensions=i.dimensions}else if(rk(r)&&null===r.value)this.fixPrefix=r.fixPrefix,this.skipAutomaticSimplification=r.skipAutomaticSimplification,this.dimensions=r.dimensions.slice(0),this.units=r.units.map(t=>rh({},t));else throw TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(t)}function E(){for(;" "===n||" "===n;)A()}function T(t){return t>="0"&&t<="9"}function A(){i++,n=r.charAt(i)}function S(t){i=t,n=r.charAt(i)}function C(){var t,r="",a=i;if("+"===n?A():"-"===n&&(r+=n,A()),!((t=n)>="0"&&t<="9"||"."===t))return S(a),null;if("."===n){if(r+=n,A(),!T(n))return S(a),null}else{for(;T(n);)r+=n,A();"."===n&&(r+=n,A())}for(;T(n);)r+=n,A();if("E"===n||"e"===n){var o="",s=i;if(o+=n,A(),("+"===n||"-"===n)&&(o+=n,A()),!T(n))return S(s),r;for(r+=o;
1T(n);)r+=n,A()}return r}function M(t){return n===t?(A(),t):null}Object.defineProperty(w,"name",{value:"Unit"}),w.prototype.constructor=w,w.prototype.type="Unit",w.prototype.isUnit=!0,w.parse=function(t,a){if(a=a||{},i=-1,n="","string"!=typeof(r=t))throw TypeError("Invalid argument in Unit.parse, string expected");var s=new w;s.units=[];var l=1,u=!1;A(),E();var c=C(),h=null;if(c){if("BigNumber"===o.number)h=new b(c);else if("Fraction"===o.number)try{h=new x(c)}catch(t){h=parseFloat(c)}else h=parseFloat(c);E(),M("*")?(l=1,u=!0):M("/")&&(l=-1,u=!0)}for(var f=[],d=1;;){for(E();"("===n;)f.push(l),d*=l,l=1,A(),E();var p=void 0;if(n){var m=n;if(null===(p=function(){for(var t="";T(n)||w.isValidAlpha(n);)t+=n,A();var r=t.charAt(0);return w.isValidAlpha(r)?t:null}()))throw SyntaxError('Unexpected "'+m+'" in "'+r+'" at index '+i.toString())}else break;var g=D(p);if(null===g)throw SyntaxError('Unit "'+p+'" not found.');var y=l*d;if(E(),M("^")){E();var v=C();if(null===v)throw SyntaxError('In "'+t+'", "^" must be followed by a floating-point number');y*=v}s.units.push({unit:g.unit,prefix:g.prefix,power:y});for(var _=0;_<N.length;_++)s.dimensions[_]+=(g.unit.dimensions[_]||0)*y;for(E();")"===n;){if(0===f.length)throw SyntaxError('Unmatched ")" in "'+r+'" at index '+i.toString());d/=f.pop(),A(),E()}if(u=!1,M("*")?(l=1,u=!0):M("/")?(l=-1,u=!0):l=1,g.unit.base){var S=g.unit.base.key;U.auto[S]={unit:g.unit,prefix:g.prefix}}}if(E(),n)throw SyntaxError('Could not parse: "'+t+'"');if(u)throw SyntaxError('Trailing characters: "'+t+'"');if(0!==f.length)throw SyntaxError('Unmatched "(" in "'+r+'"');if(0===s.units.length&&!a.allowNoUnits)throw SyntaxError('"'+t+'" contains
1no units');return s.value=void 0!==h?s._normalize(h):null,s},w.prototype.clone=function(){var t=new w;t.fixPrefix=this.fixPrefix,t.skipAutomaticSimplification=this.skipAutomaticSimplification,t.value=ic(this.value),t.dimensions=this.dimensions.slice(0),t.units=[];for(var r=0;r<this.units.length;r++)for(var i in t.units[r]={},this.units[r])im(this.units[r],i)&&(t.units[r][i]=this.units[r][i]);return t},w.prototype.valueType=function(){return iu(this.value)},w.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},w.prototype._normalize=function(t){if(null==t||0===this.units.length)return t;for(var r=t,i=w._getNumberConverter(iu(t)),n=0;n<this.units.length;n++){var a=i(this.units[n].unit.value),o=i(this.units[n].prefix.value),s=i(this.units[n].power);r=u(r,h(u(a,o),s))}return r},w.prototype._denormalize=function(t,r){if(null==t||0===this.units.length)return t;for(var i=t,n=w._getNumberConverter(iu(t)),a=0;a<this.units.length;a++){var o=n(this.units[a].unit.value),s=n(this.units[a].prefix.value),l=n(this.units[a].power);i=c(i,h(u(o,s),l))}return i};var D=h5(t=>{if(im(B,t)){var r=B[t],i=r.prefixes[""];return{unit:r,prefix:i}}for(var n in B)if(im(B,n)&&function(t,r){var i=t.length-r.length,n=t.length;return t.substring(i,n)===r}(t,n)){var a=B[n],o=t.length-n.length,s=t.substring(0,o),l=im(a.prefixes,s)?a.prefixes[s]:void 0;if(void 0!==l)return{unit:a,prefix:l}}return null},{hasher:t=>t[0],limit:100});function P(t){return t.equalBase(L.NONE)&&null!==t.value&&!o.predictable?t.value:t}function I(t){return w._getNumberConverter(iu(t))(1)}function k(t){var r,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.skipAutomaticSimplification||null===t.value?t.clone():t.simplify();(function(t){var r=!1;for(var i in void 0!==t.value&&null!==t.value&&rP(t.value)&&(r=1e-14>Math.abs(t.value.re)),t.units)im(t.units,i)&&t.units[i].unit&&("VA"===t.units[i].unit.name&&r?t.units[i].unit=B.VAR:"VAR"!==t.units[i].unit.name||r||(t.units[i].unit=B.VA))})(a),r=a,i=n.offset,1===r.units.length&&!r.fixPrefix&&1e-14>Math.abs(r.units[0].power-Math.round(r.units[0].power))&&(r.units[0].prefix=r._bestPrefix(i));var o=a._denormalize(a.value),s=null!==a.value?y(o,n||{}):"",l=a.formatUnits();return{simp:a,valueStr:s,unitStr:l}}w.isValuelessUnit=function(t){return null!==D(t)},w.prototype.hasBase=function(t){if("string"==typeof t&&(t=L[t]),!t)return!1;for(var r=0;r<N.length;r++)if(Math.abs((this.dimensions[r]||0)-(t.dimensions[r]||0))>1e-12)return!1;return!0},w.prototype.equalBase=function(t){for(var r=0;r<N.length;r++)if(Math.abs((this.dimensions[r]||0)-(t.dimensions[r]||0))>1e-12)return!1;return!0},w.prototype.equals=function(t){return this.equalBase(t)&&m(this.value,t.value)},w.prototype.multiply=function(t){for(var r=this.clone(),i=rk(t)?t:new w(t),n=0;n<N.length;n++)r.dimensions[n]=(this.dimensions[n]||0)+(i.dimensions[n]||0);for(var a=0;a<i.units.length;a++){var o=fi({},i.units[a]);r.units.push(o)}return null!==this.value||null!==i.value?r.value=u(null===this.value?this._normalize(I(i.value)):this.value,null===i.value?i._normalize(I(this.value)):i.value):r.value=null,rk(t)&&(r.skipAutomaticSimplification=!1),P(r)},w.prototype.divideInto=function(t){return new w(t).divide(this)},w.prototype.divide=function(t){for(var r=this.clone(),i=rk(t)?t:new w(t),n=0;n<N.length;n++)r.dimensions[n]=(this.dimensions[n]||0)-(i.dimensions[n]||0);for(var a=0;a<i.units.length;a++){var o=fi(fi({},i.units[a]),{},{power:-i.units[a].power});r.units.push(o)}return null!==this.value||null!==i.value?r.value=c(null===this.value?this._normalize(I(i.value)):this.value,null===i.value?i._normalize(I(this.value)):i.value):r.value=null,rk(t)&&(r.skipAutomaticSimplification=!1),P(r)},w.prototype.pow=function(t){for(var r=this.clone(),i=0;i<N.length;i++)r.dimensions[i]=(this.dimensions[i]||0)*t;for(var n=0;n<r.units.length;n++)r.units[n].power*=t;return null!==r.value?r.value=h(r.value,t):r.value=null,r.skipAutomaticSimplification=!1,P(r)},w.prototype.abs=function(){var t=this.clone();if(null!==t.value)if(t._isDerived()||0===t.units.length||0===t.units[0].unit.offset)t.value=f(t.value);else{var r=t._numberConverter(),i=u(r(t.units[0].unit.value),r(t.units[0].unit.offset));t.value=l(f(s(t.value,i)),i)}for(var n in t.units)("VA"===t.units[n].unit.name||"VAR"===t.units[n].unit.name)&&(t.units[n].unit=B.W);return t},w.prototype.to=function(t){var r,i=null===this.value?this._normalize(1):this.value;if("string"==typeof t)r=w.parse(t);else if(rk(t))r=t.clone();else throw Error("String or Unit expected as parameter");if(!this.equalBase(r))throw Error("Units do not match ('".concat(r.toString(),"' != '").concat(this.toString(),"')"));if(null!==r.value)throw Error("Cannot convert to a unit with a value");if(null===this.value||this._isDerived()||0===this.units.length||0===r.units.length||this.units[0].unit.offset===r.units[0].unit.offset)r.value=ic(i);else{var n=w._getNumberConverter(iu(i)),a=u(this.units[0].unit.value,this.units[0].unit.offset),o=u(r.units[0].unit.value,r.units[0].unit.offset);r.value=s(i,n(l(a,o)))}
1return r.fixPrefix=!0,r.skipAutomaticSimplification=!0,r},w.prototype.toNumber=function(t){return v(this.toNumeric(t))},w.prototype.toNumeric=function(t){var r;return(r=t?this.to(t):this.clone())._isDerived()||0===r.units.length?r._denormalize(r.value):r._denormalize(r.value,r.units[0].prefix.value)},w.prototype.toString=function(){return this.format()},w.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix,skipSimp:this.skipAutomaticSimplification}},w.fromJSON=function(t){var r,i,n,a=new w(t.value,null!=(r=t.unit)?r:void 0);return a.fixPrefix=null!=(i=t.fixPrefix)&&i,a.skipAutomaticSimplification=null==(n=t.skipSimp)||n,a},w.prototype.valueOf=w.prototype.toString,w.prototype.simplify=function(){var t,r,i=this.clone(),n=[];for(var a in V)if(im(V,a)&&i.hasBase(L[a])){t=a;break}if("NONE"===t)i.units=[];else if(t&&im(V,t)&&(r=V[t]),r)i.units=[{unit:r.unit,prefix:r.prefix,power:1}];else{for(var o=!1,s=0;s<N.length;s++){var l=N[s];Math.abs(i.dimensions[s]||0)>1e-12&&(im(V,l)?n.push({unit:V[l].unit,prefix:V[l].prefix,power:i.dimensions[s]||0}):o=!0)}n.length<i.units.length&&!o&&(i.units=n)}return i},w.prototype.toSI=function(){for(var t=this.clone(),r=[],i=0;i<N.length;i++){var n=N[i];
1if(Math.abs(t.dimensions[i]||0)>1e-12)if(im(U.si,n))r.push({unit:U.si[n].unit,prefix:U.si[n].prefix,power:t.dimensions[i]||0});else throw Error("Cannot express custom unit "+n+" in SI units")}return(t.units=r,t.fixPrefix=!0,t.skipAutomaticSimplification=!0,null!==this.value)?(t.value=null,this.to(t)):t},w.prototype.formatUnits=function(){for(var t="",r="",i=0,n=0,a=0;a<this.units.length;a++)this.units[a].power>0?(i++,t+=" "+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power-1)>1e-15&&(t+="^"+this.units[a].power)):this.units[a].power<0&&n++;if(n>0)for(var o=0;o<this.units.length;o++)this.units[o].power<0&&(i>0?(r+=" "+this.units[o].prefix.name+this.units[o].unit.name,Math.abs(this.units[o].power+1)>1e-15&&(r+="^"+-this.units[o].power)):(r+=" "+this.units[o].prefix.name+this.units[o].unit.name,r+="^"+this.units[o].power));t=t.substr(1),r=r.substr(1),i>1&&n>0&&(t="("+t+")"),n>1&&i>0&&(r="("+r+")");var s=t;return i>0&&n>0&&(s+=" / "),s+=r},w.prototype.toBest=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t&&!Array.isArray(t))throw Error("Invalid unit type. Expected string or Unit.");var i=this.units[0].unit.prefixes;if(t&&t.length>0){var n=t.map(t=>{var r=null;if("string"==typeof t){if(!(r=w.parse(t)))throw Error("Invalid unit type. Expected compatible string or Unit.")}else if(!rk(t))throw Error("Invalid unit type. Expected compatible string or Unit.");null===r&&(r=t.clone());try{return this.to(r.formatUnits()),r}catch(t){throw Error("Invalid unit type. Expected compatible string or Unit.")}}).map(t=>t.units[0].prefix);this.units[0].unit.prefixes=n.reduce((t,r)=>(t[r.name]=r,t),{}),this.units[0].prefix=n[0]}var a=k(this,r).simp;return this.units[0].unit.prefixes=i,a.fixPrefix=!0,a},w.prototype.format=function(t){var{simp:r,valueStr:i,unitStr:n}=k(this,t),a=i;return r.value&&rP(r.value)&&(a="("+a+")"),n.length>0&&a.length>0&&(a+=" "),a+=n},w.prototype._bestPrefix=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1.2;if(1!==this.units.length||Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var r=null!==this.value?f(this.value):0,i=f(this.units[0].unit.value),n=this.units[0].prefix;if(0===r)return n;var a=this.units[0].power,o=Math.log(r/Math.pow(n.value*i,a))/Math.LN10-t;if(o>-2.200001&&o<1.800001)return n;o=Math.abs(o);var s=this.units[0].unit.prefixes;for(var l in s)if(im(s,l)){var u=s[l];if(u.scientific){var c=Math.abs(Math.log(r/Math.pow(u.value*i,a))/Math.LN10-t);(c<o||c===o&&u.name.length<n.name.length)&&(n=u,o=c)}}return n},w.prototype.splitUnit=function(t){for(var r=this.clone(),i=[],n=0;n<t.length&&(r=r.to(t[n]),n!==t.length-1);n++){var a=r.toNumeric(),o=p(a),u=new w(m(o,a)?o:d(r.toNumeric()),t[n].toString());i.push(u),r=l(r,u)}for(var c=0,h=0;h<i.length;h++)c=s(c,i[h].value);return m(c,this.value)&&(r.value=0),i.push(r),i};var O={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0},r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0}
1,pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:1048576,scientific:!0},Gi:{name:"Gi",value:0x40000000,scientific:!0},Ti:{name:"Ti",value:0x10000000000,scientific:!0},Pi:{name:"Pi",value:0x4000000000000,scientific:!0},Ei:{name:"Ei",value:0x1000000000000000,scientific:!0},Zi:{name:"Zi",value:11805916207174113e5,scientific:!0},Yi:{name:"Yi",value:12089258196146292e8,scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:1048576,scientific:!0},gibi:{name:"gibi",value:0x40000000,scientific:!0},tebi:{name:"tebi",value:0x10000000000,scientific:!0},pebi:{name:"pebi",value:0x4000000000000,scientific:!0},exi:{name:"exi",value:0x1000000000000000,scientific:!0},zebi:{name:"zebi",value:11805916207174113e5,scientific:!0},yobi:{name:"yobi",value:12089258196146292e8,scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};O.SHORTLONG=rh({},O.SHORT,O.LONG),O.BINARY_SHORT=rh({},O.BINARY_SHORT_SI,O.BINARY_SHORT_IEC),O.BINARY_LONG=rh({},O.BINARY_LONG_SI,O.BINARY_LONG_IEC);var N=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],L={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var R in L)im(L,R)&&(L[R].key=R);var F={name:"",base:{},value:1,offset:0,dimensions:N.map(t=>0)},B={meter:{name:"meter",base:L.LENGTH,prefixes:O.LONG,value:1,offset:0},inch:{name:"inch",base:L.LENGTH,prefixes:O.NONE,value:.0254,offset:0},foot:{name:"foot",base:L.LENGTH,prefixes:O.NONE,value:.3048,offset:0},yard:{name:"yard",base:L.LENGTH,prefixes:O.NONE,value:.9144,offset:0},mile:{name:"mile",base:L.LENGTH,prefixes:O.NONE,value:1609.344,offset:0},link:{name:"link",base:L.LENGTH,prefixes:O.NONE,value:.201168,offset:0}
1,rod:{name:"rod",base:L.LENGTH,prefixes:O.NONE,value:5.0292,offset:0},chain:{name:"chain",base:L.LENGTH,prefixes:O.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:L.LENGTH,prefixes:O.NONE,value:1e-10,offset:0},m:{name:"m",base:L.LENGTH,prefixes:O.SHORT,value:1,offset:0},in:{name:"in",base:L.LENGTH,prefixes:O.NONE,value:.0254,offset:0},ft:{name:"ft",base:L.LENGTH,prefixes:O.NONE,value:.3048,offset:0},yd:{name:"yd",base:L.LENGTH,prefixes:O.NONE,value:.9144,offset:0},mi:{name:"mi",base:L.LENGTH,prefixes:O.NONE,value:1609.344,offset:0},li:{name:"li",base:L.LENGTH,prefixes:O.NONE,value:.201168,offset:0},rd:{name:"rd",base:L.LENGTH,prefixes:O.NONE,value:5.02921,offset:0},ch:{name:"ch",base:L.LENGTH,prefixes:O.NONE,value:20.1168,offset:0},mil:{name:"mil",base:L.LENGTH,prefixes:O.NONE,value:254e-7,offset:0},m2:{name:"m2",base:L.SURFACE,prefixes:O.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:L.SURFACE,prefixes:O.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:L.SURFACE,prefixes:O.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:L.SURFACE,prefixes:O.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:L.SURFACE,prefixes:O.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:L.SURFACE,prefixes:O.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:L.SURFACE,prefixes:O.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:L.SURFACE,prefixes:O.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:L.SURFACE,prefixes:O.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:L.SURFACE,prefixes:O.NONE,value:1e4,offset:0},m3:{name:"m3",base:L.VOLUME,prefixes:O.CUBIC,value:1,offset:0},L:{name:"L",base:L.VOLUME,prefixes:O.SHORT,value:.001,offset:0},l:{name:"l",base:L.VOLUME,prefixes:O.SHORT,value:.001,offset:0},litre:{name:"litre",base:L.VOLUME,prefixes:O.LONG,value:.001,offset:0},cuin:{name:"cuin",base:L.VOLUME,prefixes:O.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:L.VOLUME,prefixes:O.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:L.VOLUME,prefixes:O.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:L.VOLUME,prefixes:O.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:L.VOLUME,prefixes:O.NONE,value:15e-6,offset:0},drop:{name:"drop",base:L.VOLUME,prefixes:O.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:L.VOLUME,prefixes:O.NONE,value:5e-8,offset:0},minim:{name:"minim",base:L.VOLUME,prefixes:O.NONE,value:61611519921875e-21,offset:0},fluiddram:{name:"fluiddram",base:L.VOLUME,prefixes:O.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:L.VOLUME,prefixes:O.NONE,value:295735295625e-16,offset:0}
1,gill:{name:"gill",base:L.VOLUME,prefixes:O.NONE,value:11829411825e-14,offset:0},cc:{name:"cc",base:L.VOLUME,prefixes:O.NONE,value:1e-6,offset:0},cup:{name:"cup",base:L.VOLUME,prefixes:O.NONE,value:2365882365e-13,offset:0},pint:{name:"pint",base:L.VOLUME,prefixes:O.NONE,value:473176473e-12,offset:0},quart:{name:"quart",base:L.VOLUME,prefixes:O.NONE,value:946352946e-12,offset:0},gallon:{name:"gallon",base:L.VOLUME,prefixes:O.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:L.VOLUME,prefixes:O.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:L.VOLUME,prefixes:O.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:L.VOLUME,prefixes:O.NONE,value:.238480942392,offset:0},g:{name:"g",base:L.MASS,prefixes:O.SHORT,value:.001,offset:0},gram:{name:"gram",base:L.MASS,prefixes:O.LONG,value:.001,offset:0},ton:{name:"ton",base:L.MASS,prefixes:O.SHORT,value:907.18474,offset:0},t:{name:"t",base:L.MASS,prefixes:O.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:L.MASS,prefixes:O.LONG,value:1e3,offset:0},grain:{name:"grain",base:L.MASS,prefixes:O.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:L.MASS,prefixes:O.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:L.MASS,prefixes:O.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:L.MASS,prefixes:O.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:L.MASS,prefixes:O.NONE,value:45.359237,offset:0},stick:{name:"stick",base:L.MASS,prefixes:O.NONE,value:.115,offset:0},stone:{name:"stone",base:L.MASS,prefixes:O.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:L.MASS,prefixes:O.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:L.MASS,prefixes:O.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:L.MASS,prefixes:O.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:L.MASS,prefixes:O.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:L.MASS,prefixes:O.NONE,value:45.359237,offset:0},s:{name:"s",base:L.TIME,prefixes:O.SHORT,value:1,offset:0},min:{name:"min",base:L.TIME,prefixes:O.NONE,value:60,offset:0},h:{name:"h",base:L.TIME,prefixes:O.NONE,value:3600,offset:0},second:{name:"second",base:L.TIME,prefixes:O.LONG,value:1,offset:0},sec:{name:"sec",base:L.TIME,prefixes:O.LONG,value:1,offset:0},minute:{name:"minute",base:L.TIME,prefixes:O.NONE,value:60,offset:0},hour:{name:"hour",base:L.TIME,prefixes:O.NONE,value:3600,offset:0},day:{name:"day",base:L.TIME,prefixes:O.NONE,value:86400,offset:0},week:{name:"week",base:L.TIME,prefixes:O.NONE,value:604800,offset:0},month:{name:"month",base:L.TIME,prefixes:O.NONE,value:2629800,offset:0},year:{name:"year",base:L.TIME,prefixes:O.NONE,value:0x1e187e0,offset:0},decade:{name:"decade",base:L.TIME,prefixes:O.NONE,value:315576e3,offset:0},century:{name:"century",base:L.TIME,prefixes:O.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:L.TIME,prefixes:O.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:L.FREQUENCY,prefixes:O.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:L.FREQUENCY,prefixes:O.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:L.ANGLE,prefixes:O.SHORT,value:1,offset:0},radian:{name:"radian",base:L.ANGLE,prefixes:O.LONG,value:1,offset:0},deg:{name:"deg",base:L.ANGLE,prefixes:O.SHORT,value:null,offset:0},degree:{name:"degree",base:L.ANGLE,prefixes:O.LONG,value:null,offset:0},grad:{name:"grad",base:L.ANGLE,prefixes:O.SHORT,value:null,offset:0},gradian:{name:"gradian",base:L.ANGLE,prefixes:O.LONG,value:null,offset:0},cycle:{name:"cycle",base:L.ANGLE,prefixes:O.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:L.ANGLE,prefixes:O.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:L.ANGLE,prefixes:O.NONE,value:null,offset:0},A:{name:"A",base:L.CURRENT,prefixes:O.SHORT,value:1,offset:0},ampere:{name:"ampere",base:L.CURRENT,prefixes:O.LONG,value:1,offset:0}
1,K:{name:"K",base:L.TEMPERATURE,prefixes:O.SHORT,value:1,offset:0},degC:{name:"degC",base:L.TEMPERATURE,prefixes:O.SHORT,value:1,offset:273.15},degF:{name:"degF",base:L.TEMPERATURE,prefixes:O.SHORT,value:new x(5,9),offset:459.67},degR:{name:"degR",base:L.TEMPERATURE,prefixes:O.SHORT,value:new x(5,9),offset:0},kelvin:{name:"kelvin",base:L.TEMPERATURE,prefixes:O.LONG,value:1,offset:0},celsius:{name:"celsius",base:L.TEMPERATURE,prefixes:O.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:L.TEMPERATURE,prefixes:O.LONG,value:new x(5,9),offset:459.67},rankine:{name:"rankine",base:L.TEMPERATURE,prefixes:O.LONG,value:new x(5,9),offset:0},mol:{name:"mol",base:L.AMOUNT_OF_SUBSTANCE,prefixes:O.SHORT,value:1,offset:0},mole:{name:"mole",base:L.AMOUNT_OF_SUBSTANCE,prefixes:O.LONG,value:1,offset:0},cd:{name:"cd",base:L.LUMINOUS_INTENSITY,prefixes:O.SHORT,value:1,offset:0},candela:{name:"candela",base:L.LUMINOUS_INTENSITY,prefixes:O.LONG,value:1,offset:0},N:{name:"N",base:L.FORCE,prefixes:O.SHORT,value:1,offset:0},newton:{name:"newton",base:L.FORCE,prefixes:O.LONG,value:1,offset:0},dyn:{name:"dyn",base:L.FORCE,prefixes:O.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:L.FORCE,prefixes:O.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:L.FORCE,prefixes:O.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:L.FORCE,prefixes:O.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:L.FORCE,prefixes:O.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:L.FORCE,prefixes:O.NONE,value:9.80665,offset:0},J:{name:"J",base:L.ENERGY,prefixes:O.SHORT,value:1,offset:0},joule:{name:"joule",base:L.ENERGY,prefixes:O.LONG,value:1,offset:0},erg:{name:"erg",base:L.ENERGY,prefixes:O.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:L.ENERGY,prefixes:O.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:L.ENERGY,prefixes:O.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:L.ENERGY,prefixes:O.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:L.ENERGY,prefixes:O.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:L.POWER,prefixes:O.SHORT,value:1,offset:0},watt:{name:"watt",base:L.POWER,prefixes:O.LONG,value:1,offset:0},hp:{name:"hp",base:L.POWER,prefixes:O.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:L.POWER,prefixes:O.SHORT,value:_.I,offset:0},VA:{name:"VA",base:L.POWER,prefixes:O.SHORT,value:1,offset:0},Pa:{name:"Pa",base:L.PRESSURE,prefixes:O.SHORT,value:1,offset:0},psi:{name:"psi",base:L.PRESSURE,prefixes:O.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:L.PRESSURE,prefixes:O.NONE,value:101325,offset:0},bar:{name:"bar",base:L.PRESSURE,prefixes:O.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:L.PRESSURE,prefixes:O.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:L.PRESSURE,prefixes:O.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:L.PRESSURE,prefixes:O.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:L.PRESSURE,prefixes:O.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:L.ELECTRIC_CHARGE,prefixes:O.LONG,value:1,offset:0},C:{name:"C",base:L.ELECTRIC_CHARGE,prefixes:O.SHORT,value:1,offset:0},Ah:{name:"Ah",base:L.ELECTRIC_CHARGE,prefixes:O.SHORT,value:3600,offset:0},farad:{name:"farad",base:L.ELECTRIC_CAPACITANCE,prefixes:O.LONG,value:1,offset:0},F:{name:"F",base:L.ELECTRIC_CAPACITANCE,prefixes:O.SHORT,value:1,offset:0},volt:{name:"volt",base:L.ELECTRIC_POTENTIAL,prefixes:O.LONG,value:1,offset:0},V:{name:"V",base:L.ELECTRIC_POTENTIAL,prefixes:O.SHORT,value:1,offset:0},ohm:{name:"ohm",base:L.ELECTRIC_RESISTANCE,prefixes:O.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:L.ELECTRIC_INDUCTANCE,prefixes:O.LONG,value:1,offset:0},H:{name:"H",base:L.ELECTRIC_INDUCTANCE,prefixes:O.SHORT,value:1,offset:0},siemens:{name:"siemens",base:L.ELECTRIC_CONDUCTANCE,prefixes:O.LONG,value:1,offset:0},S:{name:"S",base:L.ELECTRIC_CONDUCTANCE,prefixes:O.SHORT,value:1,offset:0},weber:{name:"weber",base:L.MAGNETIC_FLUX,prefixes:O.LONG,value:1,offset:0},Wb:{name:"Wb",base:L.MAGNETIC_FLUX,prefixes:O.SHORT,value:1,offset:0},tesla:{name:"tesla",base:L.MAGNETIC_FLUX_DENSITY,prefixes:O.LONG,value:1,offset:0},T:{name:"T",base:L.MAGNETIC_FLUX_DENSITY,prefixes:O.SHORT,value:1,offset:0},b:{name:"b",base:L.BIT,prefixes:O.BINARY_SHORT,value:1,offset:0}
1,bits:{name:"bits",base:L.BIT,prefixes:O.BINARY_LONG,value:1,offset:0},B:{name:"B",base:L.BIT,prefixes:O.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:L.BIT,prefixes:O.BINARY_LONG,value:8,offset:0}},z={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fldr:"fluiddram",fluiddrams:"fluiddram",floz:"fluidounce",fluidounces:"fluidounce",gi:"gill",gills:"gill",cp:"cup",cups:"cup",pt:"pint",pints:"pint",qt:"quart",quarts:"quart",gal:"gallon",gallons:"gallon",bbl:"beerbarrel",beerbarrels:"beerbarrel",obl:"oilbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function j(t){if("BigNumber"===t.number){var r=h9(b);B.rad.value=new b(1),B.deg.value=r.div(180),B.grad.value=r.div(200),B.cycle.value=r.times(2),B.arcsec.value=r.div(648e3),B.arcmin.value=r.div(10800)}else B.rad.value=1,B.deg.value=Math.PI/180,B.grad.value=Math.PI/200,B.cycle.value=2*Math.PI,B.arcsec.value=Math.PI/648e3,B.arcmin.value=Math.PI/10800;B.radian.value=B.rad.value,B.degree.value=B.deg.value,B.gradian.value=B.grad.value}j(o),a&&a("config",function(t,r){t.number!==r.number&&j(t)});var U={si:{NONE:{unit:F,prefix:O.NONE[""]},LENGTH:{unit:B.m,prefix:O.SHORT[""]},MASS:{unit:B.g,prefix:O.SHORT.k},TIME:{unit:B.s,prefix:O.SHORT[""]},CURRENT:{unit:B.A,prefix:O.SHORT[""]},TEMPERATURE:{unit:B.K,prefix:O.SHORT[""]},LUMINOUS_INTENSITY:{unit:B.cd,prefix:O.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:B.mol,prefix:O.SHORT[""]},ANGLE:{unit:B.rad,prefix:O.SHORT[""]},BIT:{unit:B.bits,prefix:O.SHORT[""]},FORCE:{unit:B.N,prefix:O.SHORT[""]},ENERGY:{unit:B.J,prefix:O.SHORT[""]},POWER:{unit:B.W,prefix:O.SHORT[""]},PRESSURE:{unit:B.Pa,prefix:O.SHORT[""]},ELECTRIC_CHARGE:{unit:B.C,prefix:O.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:B.F,prefix:O.SHORT[""]},ELECTRIC_POTENTIAL:{unit:B.V,prefix:O.SHORT[""]},ELECTRIC_RESISTANCE:{unit:B.ohm,prefix:O.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:B.H,prefix:O.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:B.S,prefix:O.SHORT[""]},MAGNETIC_FLUX:{unit:B.Wb,prefix:O.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:B.T,prefix:O.SHORT[""]},FREQUENCY:{unit:B.Hz,prefix:O.SHORT[""]}}};U.cgs=JSON.parse(JSON.stringify(U.si)),U.cgs.LENGTH={unit:B.m,prefix:O.SHORT.c},U.cgs.MASS={unit:B.g,prefix:O.SHORT[""]},U.cgs.FORCE={unit:B.dyn,prefix:O.SHORT[""]},U.cgs.ENERGY={unit:B.erg,prefix:O.NONE[""]},U.us=JSON.parse(JSON.stringify(U.si)),U.us.LENGTH={unit:B.ft,prefix:O.NONE[""]},U.us.MASS={unit:B.lbm,prefix:O.NONE[""]},U.us.TEMPERATURE={unit:B.degF,prefix:O.NONE[""]},U.us.FORCE={unit:B.lbf,prefix:O.NONE[""]},U.us.ENERGY={unit:B.BTU,prefix:O.BTU[""]},U.us.POWER={unit:B.hp,prefix:O.NONE[""]},U.us.PRESSURE={unit:B.psi,prefix:O.NONE[""]},U.auto=JSON.parse(JSON.stringify(U.si));var V=U.auto;for(var $ in w.setUnitSystem=function(t){if(im(U,t))V=U[t];else throw Error("Unit system "+t+" does not exist. Choices are: "+Object.keys(U).join(", "))},w.getUnitSystem=function(){for(var t in U)if(im(U,t)&&U[t]===V)return t},w.typeConverters={BigNumber:function(t){return null!=t&&t.isFraction?new b(String(t.n)).div(String(t.d)).times(String(t.s)):new b(t+"")},Fraction:function(t){return new x(t)}
1,Complex:function(t){return t},number:function(t){return null!=t&&t.isFraction?v(t):t}},w.prototype._numberConverter=function(){var t=w.typeConverters[this.valueType()];if(t)return t;throw TypeError('Unsupported Unit value type "'+this.valueType()+'"')},w._getNumberConverter=function(t){if(!w.typeConverters[t])throw TypeError('Unsupported type "'+t+'"');return w.typeConverters[t]},B)if(im(B,$)){var G=B[$];G.dimensions=G.base.dimensions}for(var q in z)if(im(z,q)){var H=B[z[q]],W={};for(var Z in H)im(H,Z)&&(W[Z]=H[Z]);W.name=q,B[q]=W}return w.isValidAlpha=function(t){return/^[a-zA-Z]$/.test(t)},w.createUnit=function(t,r){if("object"!=typeof t)throw TypeError("createUnit expects first parameter to be of type 'Object'");if(r&&r.override){for(var i in t)if(im(t,i)&&w.deleteUnit(i),t[i].aliases)for(var n,a=0;a<t[i].aliases.length;a++)w.deleteUnit(t[i].aliases[a])}for(var o in t)im(t,o)&&(n=w.createUnitSingle(o,t[o]));return n},w.createUnitSingle=function(t,r){if(null==r&&(r={}),"string"!=typeof t)throw TypeError("createUnitSingle expects first parameter to be of type 'string'");if(im(B,t))throw Error('Cannot create unit "'+t+'": a unit with that name already exists');for(var i=0;i<t.length;i++){if(n=t.charAt(i),0===i&&!w.isValidAlpha(n))throw Error('Invalid unit name (must begin with alpha character): "'+t+'"');if(i>0&&!(w.isValidAlpha(n)||T(n)))throw Error('Invalid unit name (only alphanumeric characters are allowed): "'+t+'"')}var a,o,s,l=null,u=[],c=0;if(r&&"Unit"===r.type)l=r.clone();else if("string"==typeof r)""!==r&&(a=r);else if("object"==typeof r)a=r.definition,o=r.prefixes,c=r.offset,s=r.baseName,r.aliases&&(u=r.aliases.valueOf());else throw TypeError('Cannot create unit "'+t+'" from "'+r.toString()+'": expecting "string" or "Unit" or "Object"');if(u){for(var h=0;h<u.length;h++)if(im(B,u[h]))throw Error('Cannot create alias "'+u[h]+'": a unit with that name already exists')}if(a&&"string"==typeof a&&!l)try{l=w.parse(a,{allowNoUnits:!0})}catch(r){throw r.message='Could not create unit "'+t+'" from "'+a+'": '+r.message,r}else a&&"Unit"===a.type&&(l=a.clone());u=u||[],c=c||0,o=o&&o.toUpperCase&&O[o.toUpperCase()]||O.NONE;var f={};if(l){f={name:t,value:l.value,dimensions:l.dimensions.slice(0),prefixes:o,offset:c};var d=!1;for(var p in L)if(im(L,p)){for(var m=!0,g=0;g<N.length;g++)if(Math.abs((f.dimensions[g]||0)-(L[p].dimensions[g]||0))>1e-12){m=!1;break}if(m){d=!0,f.base=L[p];break}}if(!d){s=s||t+"_STUFF";var y={dimensions:l.dimensions.slice(0)};y.key=s,L[s]=y,V[s]={unit:f,prefix:O.NONE[""]},f.base=L[s]}}else{if(s=s||t+"_STUFF",N.indexOf(s)>=0)throw Error('Cannot create new base unit "'+t+'": a base unit with that name already exists (and cannot be overridden)');for(var v in N.push(s),L)im(L,v)&&(L[v].dimensions[N.length-1]=0);for(var _={dimensions:[]},b=0;b<N.length;b++)_.dimensions[b]=0;_.dimensions[N.length-1]=1,_.key=s,L[s]=_,f={name:t,value:1,dimensions:L[s].dimensions.slice(0),prefixes:o,offset:c,base:L[s]},V[s]={unit:f,prefix:O.NONE[""]}}w.UNITS[t]=f;for(var x=0;x<u.length;x++){var E=u[x],A={};for(var S in f)im(f,S)&&(A[S]=f[S]);A.name=E,w.UNITS[E]=A}return delete D.cache,new w(null,t)},w.deleteUnit=function(t){delete w.UNITS[t],delete D.cache},w.PREFIXES=O,w.BASE_DIMENSIONS=N,w.BASE_UNITS=L,w.UNIT_SYSTEMS=U,w.UNITS=B,w},{isClass:!0});t.s(["createUnitClass",0,fn],960708);var fa="unit",fo=ig(fa,["typed","Unit"],t=>{var{typed:r,Unit:i}=t;return r(fa,{Unit:function(t){return t.clone()},string:function(t){return i.isValuelessUnit(t)?new i(null,t):i.parse(t,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(t,r){return new i(t,r)},"number | BigNumber | Fraction":function(t){return new i(t)},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createUnitFunction",0,fo],398289);var fs="sparse",fl=ig(fs,["typed","SparseMatrix"],t=>{var{typed:r,SparseMatrix:i}=t;return r(fs,{"":function(){return new i([])},string:function(t){return new i([],t)},"Array | Matrix":function(t){return new i(t)},"Array | Matrix, string":function(t,r){return new i(t,r)}})});t.s(["createSparse",0,fl],979912);var fu="createUnit",fc=ig(fu,["typed","Unit"],t=>{var{typed:r,Unit:i}=t;return r(fu,{"Object, Object":function(t,r){return i.createUnit(t,r)},Object:function(t){return i.createUnit(t,{})},"string, Unit | string | Object, Object":function(t,r,n){var a={};return a[t]=r,i.createUnit(a,n)},"string, Unit | string | Object":function(t,r){var n={};return n[t]=r,i.createUnit(n,{})}
1,string:function(t){var r={};return r[t]={},i.createUnit(r,{})}})});t.s(["createCreateUnit",0,fc],526803);var fh="acos",ff=ig(fh,["typed","config","Complex"],t=>{var{typed:r,config:i,Complex:n}=t;return r(fh,{number:function(t){return t>=-1&&t<=1||i.predictable?Math.acos(t):new n(t,0).acos()},Complex:function(t){return t.acos()},BigNumber:function(t){return t.acos()}})});t.s(["createAcos",0,ff],692286);var fd="number";function fp(t){return Math.atan(1/t)}function fm(t){return Number.isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0}function fg(t){return Math.asin(1/t)}function fy(t){var r=1/t;return Math.log(r+Math.sqrt(r*r+1))}function fv(t){return Math.acos(1/t)}function f_(t){var r=1/t;return Math.log(Math.sqrt(r*r-1)+r)}function fb(t){return iG(t)}fp.signature=fd,fm.signature=fd,fg.signature=fd,fy.signature=fd,fv.signature=fd,f_.signature=fd,fb.signature=fd;function fx(t){return 1/Math.tan(t)}function fw(t){var r=Math.exp(2*t);return(r+1)/(r-1)}function fE(t){return 1/Math.sin(t)}function fT(t){return 0===t?1/0:Math.abs(2/(Math.exp(t)-Math.exp(-t)))*iM(t)}function fA(t){return 1/Math.cos(t)}function fS(t){return 2/(Math.exp(t)+Math.exp(-t))}function fC(t){return iW(t)}fx.signature=fd,fw.signature=fd,fE.signature=fd,fT.signature=fd,fA.signature=fd,fS.signature=fd,fC.signature=fd;var fM="acosh",fD=ig(fM,["typed","config","Complex"],t=>{var{typed:r,config:i,Complex:n}=t;return r(fM,{number:function(t){return t>=1||i.predictable?i$(t):t<=-1?new n(Math.log(Math.sqrt(t*t-1)-t),Math.PI):new n(t,0).acosh()},Complex:function(t){return t.acosh()},BigNumber:function(t){return t.acosh()}})});t.s(["createAcosh",0,fD],634365);var fP="acot",fI=ig(fP,["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t;return r(fP,{number:fp,Complex:function(t){return t.acot()},BigNumber:function(t){return new i(1).div(t).atan()}})});t.s(["createAcot",0,fI],580124);var fk="acoth",fO=ig(fk,["typed","config","Complex","BigNumber"],t=>{var{typed:r,config:i,Complex:n,BigNumber:a}=t;return r(fk,{number:function(t){return t>=1||t<=-1||i.predictable?fm(t):new n(t,0).acoth()},Complex:function(t){return t.acoth()},BigNumber:function(t){return new a(1).div(t).atanh()}})});t.s(["createAcoth",0,fO],63081);var fN="acsc",fL=ig(fN,["typed","config","Complex","BigNumber"],t=>{var{typed:r,config:i,Complex:n,BigNumber:a}=t;return r(fN,{number:function(t){return t<=-1||t>=1||i.predictable?fg(t):new n(t,0).acsc()},Complex:function(t){return t.acsc()},BigNumber:function(t){return new a(1).div(t).asin()}})});t.s(["createAcsc",0,fL],613634);var fR="acsch",fF=ig(fR,["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t;return r(fR,{number:fy,Complex:function(t){return t.acsch()},BigNumber:function(t){return new i(1).div(t).asinh()}})});t.s(["createAcsch",0,fF],763769);var fB="asec",fz=ig(fB,["typed","config","Complex","BigNumber"],t=>{var{typed:r,config:i,Complex:n,BigNumber:a}=t;return r(fB,{number:function(t){return t<=-1||t>=1||i.predictable?fv(t):new n(t,0).asec()},Complex:function(t){return t.asec()},BigNumber:function(t){return new a(1).div(t).acos()}})});t.s(["createAsec",0,fz],929046);var fj="asech",fU=ig(fj,["typed","config","Complex","BigNumber"],t=>{var{typed:r,config:i,Complex:n,BigNumber:a}=t;return r(fj,{number:function(t){if(t<=1&&t>=-1||i.predictable){var r=1/t;return r>0||i.predictable?f_(t):new n(Math.log(Math.sqrt(r*r-1)-r),Math.PI)}return new n(t,0).asech()},Complex:function(t){return t.asech()},BigNumber:function(t){return new a(1).div(t).acosh()}})});t.s(["createAsech",0,fU],59897);var fV="asin",f$=ig(fV,["typed","config","Complex"],t=>{var{typed:r,config:i,Complex:n}=t;return r(fV,{number:function(t){return t>=-1&&t<=1||i.predictable?Math.asin(t):new n(t,0).asin()},Complex:function(t){return t.asin()},BigNumber:function(t){return t.asin()}})});t.s(["createAsin",0,f$],58213);var fG=ig("asinh",["typed"],t=>{var{typed:r}=t;return r("asinh",{number:fb,Complex:function(t){return t.asinh()},BigNumber:function(t){return t.asinh()}})});t.s(["createAsinh",0,fG],807528);var fq=ig("atan",["typed"],t=>{var{typed:r}=t;return r("atan",{number:function(t){return Math.atan(t)},Complex:function(t){return t.atan()},BigNumber:function(t){return t.atan()}})});t.s(["createAtan",0,fq],705044);var fH="atan2",fW=ig(fH,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,BigNumber:a,DenseMatrix:o,concat:s}=t,l=lo({typed:r,equalScalar:n}),u=ls({typed:r}),c=lG({typed:r,equalScalar:n}),h=sQ({typed:r,equalScalar:n}),f=sJ({typed:r,DenseMatrix:o}),d=lh({typed:r,matrix:i,concat:s});return r(fH,{"number, number":Math.atan2,"BigNumber, BigNumber":(t,r)=>a.atan2(t,r)},d({scalar:"number | BigNumber",SS:c,DS:u,SD:l,Ss:h,sS:f}))});t.s(["createAtan2",0,fW],818932);var fZ="atanh",fY=ig(fZ,["typed","config","Complex"],t=>{var{typed:r,config:i,Complex:n}=t;return r(fZ,{number:function(t){return t<=1&&t>=-1||i.predictable?iq(t):new n(t,0).atanh()},Complex:function(t){return t.atanh()},BigNumber:function(t){return t.atanh()}})});t.s(["createAtanh",0,fY],672965);var fX=ig("trigUnit",["typed"],t=>{var{typed:r}=t;return{Unit:r.referToSelf(t=>i=>{if(!i.hasBase(i.constructor.BASE_UNITS.ANGLE))throw TypeError("Unit in function cot is no angle");return r.find(t,i.valueType())(i.value)})}}),fK=ig("cos",["typed"],t=>{var{typed:r}=t,i=fX({typed:r});return r("cos",{number:Math.cos,"Complex | BigNumber":t=>t.cos()},i)});t.s(["createCos",0,fK],153815);var fQ="cosh",fJ=ig(fQ,["typed"],t=>{var{typed:r}=t;return r(fQ,{number:iH,"Complex | BigNumber":t=>t.cosh()})});t.s(["createCosh",0,fJ],639302);var f0=ig("cot",["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t,n=fX({typed:r});return r("cot",{number:fx,Complex:t=>t.cot(),BigNumber:t=>new i(1).div(t.tan())},n)});t.s(["createCot",0,f0],71017);var f1="coth",f2=ig(f1,["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t;return r(f1,{number:fw,Complex:t=>t.coth(),BigNumber:t=>new i(1).div(t.tanh())})});t.s(["createCoth",0,f2],840208);var f3=ig("csc",["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t,n=fX({typed:r});return r("csc",{number:fE,Complex:t=>t.csc(),BigNumber:t=>new i(1).div(t.sin())},n)});t.s(["createCsc",0,f3],704089);var f4="csch",f6=ig(f4,["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t;return r(f4,{number:fT,Complex:t=>t.csch(),BigNumber:t=>new i(1).div(t.sinh())})});t.s(["createCsch",0,f6],498416);var f5=ig("sec",["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t,n=fX({typed:r});return r("sec",{number:fA,Complex:t=>t.sec(),BigNumber:t=>new i(1).div(t.cos())},n)});t.s(["createSec",0,f5],954398);var f8="sech",f7=ig(f8,["typed","BigNumber"],t=>{var{typed:r,BigNumber:i}=t;return r(f8,{number:fS,Complex:t=>t.sech(),BigNumber:t=>new i(1).div(t.cosh())})});t.s(["createSech",0,f7],375886);var f9=ig("sin",["typed"],t=>{var{typed:r}=t,i=fX({typed:r});return r("sin",{number:Math.sin,"Complex | BigNumber":t=>t.sin()},i)});t.s(["createSin",0,f9],948603);var de="sinh",dt=ig(de,["typed"],t=>{var{typed:r}=t;return r(de,{number:fC,"Complex | BigNumber":t=>t.sinh()})});t.s(["createSinh",0,dt],858706);var dr=ig("tan",["typed"],t=>{var{typed:r}=t,i=fX({typed:r});return r("tan",{number:Math.tan,"Complex | BigNumber":t=>t.tan()},i)});t.s(["createTan",0,dr],616718);var di=ig("tanh",["typed"],t=>{var{typed:r}=t;return r("tanh",{number:iZ,"Complex | BigNumber":t=>t.tanh()})});t.s(["createTanh",0,di],153039);var dn="setCartesian",da=ig(dn,["typed","size","subset","compareNatural","Index","DenseMatrix"],t=>{var{typed:r,size:i,subset:n,compareNatural:a,Index:o,DenseMatrix:s}=t;return r(dn,{"Array | Matrix, Array | Matrix":function(t,r){var l=[];
1if(0!==n(i(t),new o(0))&&0!==n(i(r),new o(0))){var u=oo(Array.isArray(t)?t:t.toArray()).sort(a),c=oo(Array.isArray(r)?r:r.toArray()).sort(a);l=[];for(var h=0;h<u.length;h++)for(var f=0;f<c.length;f++)l.push([u[h],c[f]])}return Array.isArray(t)&&Array.isArray(r)?l:new s(l)}})});t.s(["createSetCartesian",0,da],248588);var ds="setDifference",dl=ig(ds,["typed","size","subset","compareNatural","Index","DenseMatrix"],t=>{var{typed:r,size:i,subset:n,compareNatural:a,Index:o,DenseMatrix:s}=t;return r(ds,{"Array | Matrix, Array | Matrix":function(t,r){var l;if(0===n(i(t),new o(0)))l=[];else{if(0===n(i(r),new o(0)))return oo(t.toArray());var u,c=of(oo(Array.isArray(t)?t:t.toArray()).sort(a)),h=of(oo(Array.isArray(r)?r:r.toArray()).sort(a));l=[];for(var f=0;f<c.length;f++){u=!1;for(var d=0;d<h.length;d++)if(0===a(c[f].value,h[d].value)&&c[f].identifier===h[d].identifier){u=!0;break}u||l.push(c[f])}}return Array.isArray(t)&&Array.isArray(r)?od(l):new s(od(l))}})});t.s(["createSetDifference",0,dl],82243);var du="setDistinct",dc=ig(du,["typed","size","subset","compareNatural","Index","DenseMatrix"],t=>{var{typed:r,size:i,subset:n,compareNatural:a,Index:o,DenseMatrix:s}=t;return r(du,{"Array | Matrix":function(t){var r;if(0===n(i(t),new o(0)))r=[];else{var l=oo(Array.isArray(t)?t:t.toArray()).sort(a);(r=[]).push(l[0]);for(var u=1;u<l.length;u++)0!==a(l[u],l[u-1])&&r.push(l[u])}return Array.isArray(t)?r:new s(r)}})});t.s(["createSetDistinct",0,dc],879662);var dh="setIntersect",df=ig(dh,["typed","size","subset","compareNatural","Index","DenseMatrix"],t=>{var{typed:r,size:i,subset:n,compareNatural:a,Index:o,DenseMatrix:s}=t;return r(dh,{"Array | Matrix, Array | Matrix":function(t,r){var l;if(0===n(i(t),new o(0))||0===n(i(r),new o(0)))l=[];else{var u=of(oo(Array.isArray(t)?t:t.toArray()).sort(a)),c=of(oo(Array.isArray(r)?r:r.toArray()).sort(a));l=[];for(var h=0;h<u.length;h++)for(var f=0;f<c.length;f++)if(0===a(u[h].value,c[f].value)&&u[h].identifier===c[f].identifier){l.push(u[h]);break}}return Array.isArray(t)&&Array.isArray(r)?od(l):new s(od(l))}})});t.s(["createSetIntersect",0,df],977116);var dd="setIsSubset",dp=ig(dd,["typed","size","subset","compareNatural","Index"],t=>{var{typed:r,size:i,subset:n,compareNatural:a,Index:o}=t;return r(dd,{"Array | Matrix, Array | Matrix":function(t,r){if(0===n(i(t),new o(0)))return!0;if(0===n(i(r),new o(0)))return!1;for(var s,l=of(oo(Array.isArray(t)?t:t.toArray()).sort(a)),u=of(oo(Array.isArray(r)?r:r.toArray()).sort(a)),c=0;c<l.length;c++){s=!1;for(var h=0;h<u.length;h++)if(0===a(l[c].value,u[h].value)&&l[c].identifier===u[h].identifier){s=!0;break}if(!1===s)return!1}return!0}})});t.s(["createSetIsSubset",0,dp],10329);var dm="setMultiplicity",dg=ig(dm,["typed","size","subset","compareNatural","Index"],t=>{var{typed:r,size:i,subset:n,compareNatural:a,Index:o}=t;return r(dm,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(t,r){if(0===n(i(r),new o(0)))return 0;for(var s=oo(Array.isArray(r)?r:r.toArray()),l=0,u=0;u<s.length;u++)0===a(s[u],t)&&l++;return l}})});t.s(["createSetMultiplicity",0,dg],728502);var dy="setPowerset",dv=ig(dy,["typed","size","subset","compareNatural","Index"],t=>{var{typed:r,size:i,subset:n,compareNatural:a,Index:o}=t;return r(dy,{"Array | Matrix":function(t){if(0===n(i(t),new o(0)))return[];for(var r=oo(Array.isArray(t)?t:t.toArray()).sort(a),s=[],l=0;l.toString(2).length<=r.length;)s.push(function(t,r){for(var i=[],n=0;n<r.length;n++)"1"===r[n]&&i.push(t[n]);return i}(r,l.toString(2).split("").reverse())),l++;for(var u=s,c=[],h=u.length-1;h>0;h--)for(var f=0;f<h;f++)u[f].length>u[f+1].length&&(c=u[f],u[f]=u[f+1],u[f+1]=c);return u}})});t.s(["createSetPowerset",0,dv],712849);var d_="setSize",db=ig(d_,["typed","compareNatural"],t=>{var{typed:r,compareNatural:i}=t;return r(d_,{"Array | Matrix":function(t){return Array.isArray(t)?oo(t).length:oo(t.toArray()).length},"Array | Matrix, boolean":function(t,r){if(!1===r||0===t.length)return Array.isArray(t)?oo(t).length:oo(t.toArray()).length;for(var n=oo(Array.isArray(t)?t:t.toArray()).sort(i),a=1,o=1;o<n.length;o++)0!==i(n[o],n[o-1])&&a++;return a}})});t.s(["createSetSize",0,db],431713);var dx="setSymDifference",dw=ig(dx,["typed","size","concat","subset","setDifference","Index"],t=>{var{typed:r,size:i,concat:n,subset:a,setDifference:o,Index:s}=t;return r(dx,{"Array | Matrix, Array | Matrix":function(t,r){if(0===a(i(t),new s(0)))return oo(r);if(0===a(i(r),new s(0)))return oo(t);var l=oo(t),u=oo(r);return n(o(l,u),o(u,l))}})});t.s(["createSetSymDifference",0,dw],185935);var dE="setUnion",dT=ig(dE,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],t=>{var{typed:r,size:i,concat:n,subset:a,setIntersect:o,setSymDifference:s,Index:l}=t;return r(dE,{"Array | Matrix, Array | Matrix":function(t,r){if(0===a(i(t),new l(0)))return oo(r);if(0===a(i(r),new l(0)))return oo(t);var u=oo(t),c=oo(r);return n(s(u,c),o(u,c))}})});t.s(["createSetUnion",0,dT],770196);var dA=ig("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],t=>{var{typed:r,matrix:i,addScalar:n,equalScalar:a,DenseMatrix:o,SparseMatrix:s,concat:l}=t,u=ld({typed:r}),c=lp({typed:r,equalScalar:a}),h=lm({typed:r,DenseMatrix:o}),f=lh({typed:r,matrix:i,concat:l});return r("add",{"any, any":n,"any, any, ...any":r.referToSelf(t=>(r,i,n)=>{for(var a=t(r,i),o=0;o<n.length;o++)a=t(a,n[o]);return a})},f({elop:n,DS:u,SS:c,Ss:h}))});t.s(["createAdd",0,dA],503344);var dS="hypot",dC=ig(dS,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],t=>{var{typed:r,abs:i,addScalar:n,divideScalar:a,multiplyScalar:o,sqrt:s,smaller:l,isPositive:u}=t;return r(dS,{"... number | BigNumber":c,Array:c,Matrix:t=>c(oo(t.toArray(),!0))});function c(t){for(var r=0,c=0,h=0;h<t.length;h++){if(rP(t[h]))throw TypeError("Unexpected type of argument to hypot");var f=i(t[h]);l(c,f)?(r=n(r=o(r,o(a(c,f),a(c,f))),1),c=f):r=n(r,u(f)?o(a(f,c),a(f,c)):f)}return o(c,s(r))}});t.s(["createHypot",0,dC],175736);var dM="norm",dD=ig(dM,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],t=>{var{typed:r,abs:i,add:n,pow:a,conj:o,sqrt:s,multiply:l,equalScalar:u,larger:c,smaller:h,matrix:f,ctranspose:d,eigs:p}=t;return r(dM,{number:Math.abs,Complex:function(t){return t.abs()},BigNumber:function(t){return t.abs()},boolean:function(t){return Math.abs(t)},Array:function(t){return m(f(t),2)},Matrix:function(t){return m(t,2)},"Array, number | BigNumber | string":function(t,r){return m(f(t),r)},"Matrix, number | BigNumber | string":function(t,r){return m(t,r)}});function m(t,r){var f,g,y=t.size();if(1===y.length){if(r===1/0||"inf"===r)return f=0,t.forEach(function(t){var r=i(t);c(r,f)&&(f=r)},!0),f;if(r===-1/0||"-inf"===r)return t.forEach(function(t){var r=i(t);(!g||h(r,g))&&(g=r)},!0),g||0;if("fro"===r)return m(t,2);if("number"==typeof r&&!isNaN(r)){if(!u(r,0)){var v=0;return t.forEach(function(t){v=n(a(i(t),r),v)},!0),a(v,1/r)}return 1/0}throw Error("Unsupported parameter value")}if(2===y.length)if(y[0]&&y[1])return function(t,r){if(1===r)return a=[],u=0,t.forEach(function(t,r){var o=r[1],s=n(a[o]||0,i(t));c(s,u)&&(u=s),a[o]=s},!0),u;if(r===1/0||"inf"===r)return h=[],f=0,t.forEach(function(t,r){var a=r[0],o=n(h[a]||0,i(t));c(o,f)&&(f=o),h[a]=o},!0),f;if("fro"===r)return m=0,t.forEach(function(t,r){m=n(m,l(t,o(t)))}),i(s(m));if(2===r){var a,u,h,f,m,g=t.size();if(g[0]!==g[1])throw RangeError("Invalid matrix dimensions");var y=p(l(d(t),t)).values.toArray();return i(s(y[y.length-1]))}throw Error("Unsupported parameter value "+r)}(t,r);else throw RangeError("Invalid matrix dimensions")}});t.s(["createNorm",0,dD],148971);var dP=ig("dot",["typed","addScalar","multiplyScalar","conj","size"],t=>{var{typed:r,addScalar:i,multiplyScalar:n,conj:a,size:o}=t;return r("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(t,l){var u=s(t,l),c=rL(t)?t._data:t,h=rL(t)?t._datatype||t.getDataType():void 0,f=rL(l)?l._data:l,d=rL(l)?l._datatype||l.getDataType():void 0,p=2===o(t).length,m=2===o(l).length,g=i,y=n;
1if(h&&d&&h===d&&"string"==typeof h&&"mixed"!==h&&(g=r.find(i,[h,h]),y=r.find(n,[h,h])),!p&&!m){for(var v=y(a(c[0]),f[0]),_=1;_<u;_++)v=g(v,y(a(c[_]),f[_]));return v}if(!p&&m){for(var b=y(a(c[0]),f[0][0]),x=1;x<u;x++)b=g(b,y(a(c[x]),f[x][0]));return b}if(p&&!m){for(var w=y(a(c[0][0]),f[0]),E=1;E<u;E++)w=g(w,y(a(c[E][0]),f[E]));return w}if(p&&m){for(var T=y(a(c[0][0]),f[0][0]),A=1;A<u;A++)T=g(T,y(a(c[A][0]),f[A][0]));return T}},"SparseMatrix, SparseMatrix":function(t,r){s(t,r);for(var a=t._index,o=t._values,l=r._index,u=r._values,c=0,h=0,f=0;h<a.length&&f<l.length;){var d=a[h],p=l[f];if(d<p){h++;continue}if(d>p){f++;continue}d===p&&(c=i(c,n(o[h],u[f])),h++,f++)}return c}});function s(t,r){var i,n,a=o(t),s=o(r);if(1===a.length)i=a[0];else if(2===a.length&&1===a[1])i=a[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+a.join(", ")+")");if(1===s.length)n=s[0];else if(2===s.length&&1===s[1])n=s[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+s.join(", ")+")");if(i!==n)throw RangeError("Vectors must have equal length ("+i+" != "+n+")");if(0===i)throw RangeError("Cannot calculate the dot product of empty vectors");return i}});t.s(["createDot",0,dP],493733);var dI=ig("trace",["typed","matrix","add"],t=>{var{typed:r,matrix:i,add:n}=t;return r("trace",{Array:function(t){return a(i(t))},SparseMatrix:function(t){var r=t._values,i=t._index,a=t._ptr,o=t._size,s=o[0],l=o[1];if(s===l){var u=0;if(r.length>0)for(var c=0;c<l;c++)for(var h=a[c],f=a[c+1],d=h;d<f;d++){var p=i[d];if(p===c){u=n(u,r[d]);break}if(p>c)break}return u}throw RangeError("Matrix must be square (size: "+a0(o)+")")},DenseMatrix:a,any:ic});function a(t){var r=t._size,i=t._data;switch(r.length){case 1:if(1===r[0])return ic(i[0]);throw RangeError("Matrix must be square (size: "+a0(r)+")");case 2:var a=r[0];if(a===r[1]){for(var o=0,s=0;s<a;s++)o=n(o,i[s][s]);return o}throw RangeError("Matrix must be square (size: "+a0(r)+")");default:throw RangeError("Matrix must be two dimensional (size: "+a0(r)+")")}}});t.s(["createTrace",0,dI],374710);var dk="index",dO=ig(dk,["typed","Index"],t=>{var{typed:r,Index:i}=t;return r(dk,{"...number | string | BigNumber | Range | Array | Matrix":function(t){var r=t.map(function(t){return rM(t)?t.toNumber():rN(t)||rL(t)?t.map(function(t){return rM(t)?t.toNumber():t}):t}),n=new i;return i.apply(n,r),n}})});t.s(["createIndex",0,dO],670437);var dN=new Set(["end"]),dL=ig("Node",["mathWithTransform"],t=>{var{mathWithTransform:r}=t;return class{get type(){return"Node"}get isNode(){return!0}evaluate(t){return this.compile().evaluate(t)}compile(){var t=this._compile(r,{}),i={};return{evaluate:function(r){var n=rS(r);for(var a of[...dN])if(n.has(a))throw Error('Scope contains an illegal symbol, "'+a+'" is a reserved keyword');return t(n,i,null)}}}_compile(t,r){throw Error("Method _compile must be implemented by type "+this.type)}forEach(t){throw Error("Cannot run forEach on a Node interface")}map(t){throw Error("Cannot run map on a Node interface")}_ifNode(t){if(!r9(t))throw TypeError("Callback function must return a Node");return t}traverse(t){t(this,null,null),!function t(r,i){r.forEach(function(r,n,a){i(r,n,a),t(r,i)})}(this,t)}transform(t){return function r(i,n,a){var o=t(i,n,a);return o!==i?o:i.map(r)}(this,null,null)}filter(t){var r=[];return this.traverse(function(i,n,a){t(i,n,a)&&r.push(i)}),r}clone(){throw Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(t){return t.cloneDeep()})}equals(t){return!!t&&this.type===t.type&&id(this,t)}toString(t){var r=this._getCustomString(t);return void 0!==r?r:this._toString(t)}_toString(){throw Error("_toString not implemented for "+this.type)}toJSON(){throw Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(t){var r=this._getCustomString(t);return void 0!==r?r:this._toHTML(t)}_toHTML(){throw Error("_toHTML not implemented for "+this.type)}toTex(t){var r=this._getCustomString(t);return void 0!==r?r:this._toTex(t)}_toTex(t){throw Error("_toTex not implemented for "+this.type)}_getCustomString(t){if(t&&"object"==typeof t)switch(typeof t.handler){case"object":case"undefined":return;case"function":return t.handler(this,t);default:throw TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}},{isClass:!0,isNode:!0});function dR(t){return t&&t.isIndexError?new rm(t.index+1,t.min+1,void 0!==t.max?t.max+1:void 0):t}function dF(t){var{subset:r}=t;return function(t,i){try{if(Array.isArray(t))return r(t,i);if(t&&"function"==typeof t.subset)return t.subset(i);if("string"==typeof t)return r(t,i);else if("object"==typeof t){if(!i.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return rg(t,i.getObjectProperty())}else throw TypeError("Cannot apply index: unsupported type of object")}catch(t){throw dR(t)}}}t.s(["createNode",0,dL],850695);var dB="AccessorNode",dz=ig(dB,["subset","Node"],t=>{var{subset:r,Node:i}
1=t,n=dF({subset:r});function a(t){return!(rJ(t)||r0(t)||r4(t)||r8(t)||ie(t)||ii(t)||is(t))}class o extends i{constructor(t,r){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(super(),!r9(t))throw TypeError('Node expected for parameter "object"');if(!r7(r))throw TypeError('IndexNode expected for parameter "index"');this.object=t,this.index=r,this.optionalChaining=i}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return dB}get isAccessorNode(){return!0}_compile(t,r){var i=this.object._compile(t,r),a=this.index._compile(t,r),o=this.optionalChaining,s=rJ(this.object)&&this.object.optionalChaining;if(!this.index.isObjectProperty())return function(t,r,l){var u=l||{},c=i(t,r,u);if(o&&null==c){u.optionalShortCircuit=!0;return}if(!s||null==u||!u.optionalShortCircuit){var h=a(t,r,c);return n(c,h)}};var l=this.index.getObjectProperty();return function(t,r,n){var a=n||{},u=i(t,r,a);if(o&&null==u){a.optionalShortCircuit=!0;return}if(!s||null==a||!a.optionalShortCircuit)return rg(u,l)}}forEach(t){t(this.object,"object",this),t(this.index,"index",this)}map(t){return new o(this._ifNode(t(this.object,"object",this)),this._ifNode(t(this.index,"index",this)),this.optionalChaining)}clone(){return new o(this.object,this.index,this.optionalChaining)}_toString(t){var r=this.object.toString(t);return a(this.object)&&(r="("+r+")"),r+(this.optionalChaining?this.index.dotNotation?"?":"?.":"")+this.index.toString(t)}_toHTML(t){var r=this.object.toHTML(t);return a(this.object)&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+this.index.toHTML(t)}_toTex(t){var r=this.object.toTex(t);return a(this.object)&&(r="\\left(' + object + '\\right)"),r+this.index.toTex(t)}toJSON(){return{mathjs:dB,object:this.object,index:this.index,optionalChaining:this.optionalChaining}}static fromJSON(t){return new o(t.object,t.index,t.optionalChaining)}}return cv(o,"name",dB),o},{isClass:!0,isNode:!0});t.s(["createAccessorNode",0,dz],101073);var dj="ArrayNode",dU=ig(dj,["Node"],t=>{var{Node:r}=t;class i extends r{constructor(t){if(super(),this.items=t||[],!Array.isArray(this.items)||!this.items.every(r9))throw TypeError("Array containing Nodes expected")}get type(){return dj}get isArrayNode(){return!0}_compile(t,r){var i=os(this.items,function(i){return i._compile(t,r)});if("Array"===t.config.matrix)return function(t,r,n){return os(i,function(i){return i(t,r,n)})};var n=t.matrix;return function(t,r,a){return n(os(i,function(i){return i(t,r,a)}))}}forEach(t){for(var r=0;r<this.items.length;r++)t(this.items[r],"items["+r+"]",this)}map(t){for(var r=[],n=0;n<this.items.length;n++)r[n]=this._ifNode(t(this.items[n],"items["+n+"]",this));return new i(r)}clone(){return new i(this.items.slice(0))}_toString(t){return"["+this.items.map(function(r){return r.toString(t)}).join(", ")+"]"}toJSON(){return{mathjs:dj,items:this.items}}static fromJSON(t){return new i(t.items)}_toHTML(t){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map(function(r){return r.toHTML(t)}).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(t){return function r(i,n){var a=i.some(r0)&&!i.every(r0),o=n||a,s=i.map(function(i){return i.items?r(i.items,!n):i.toTex(t)}).join(o?"&":"\\\\");return a||!o||o&&!n?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}(this.items,!1)}}return cv(i,"name",dj),i},{isClass:!0,isNode:!0});t.s(["createArrayNode",0,dU],507607);var dV=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}
1,"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:nullish":{op:"??",associativity:"left",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function d$(t,r){if(!r||"auto"!==r)return t;for(var i=t;ii(i);)i=i.content;return i}function dG(t,r,i,n){var a=t;"keep"!==r&&(a=t.getContent());for(var o=a.getIdentifier(),s=null,l=0;l<dV.length;l++)if(o in dV[l]){s=l;break}if("OperatorNode:multiply"===o&&a.implicit&&"show"!==i){var u=d$(a.args[0],r);r4(u)&&n&&"OperatorNode:divide"===n.getIdentifier()&&r6(d$(n.args[0],r))||"OperatorNode:divide"===u.getIdentifier()&&r6(d$(u.args[0],r))&&r4(d$(u.args[1]))||(s+=1)}return s}function dq(t,r){var i=t;"keep"!==r&&(i=t.getContent());var n=i.getIdentifier(),a=dG(i,r);if(null===a)return null;var o=dV[a][n];if(im(o,"associativity")){if("left"===o.associativity)return"left";if("right"===o.associativity)return"right";throw Error("'"+n+"' has the invalid associativity '"+o.associativity+"'.")}return null}function dH(t,r,i){var n="keep"!==i?t.getContent():t,a="keep"!==i?t.getContent():r,o=n.getIdentifier(),s=a.getIdentifier(),l=dG(n,i);if(null===l)return null;var u=dV[l][o];if(im(u,"associativeWith")&&u.associativeWith instanceof Array){for(var c=0;c<u.associativeWith.length;c++)if(u.associativeWith[c]===s)return!0;return!1}return null}var dW="AssignmentNode",dZ=ig(dW,["subset","?matrix","Node"],t=>{var{subset:r,matrix:i,Node:n}=t,a=dF({subset:r}),o=function(t){var{subset:r,matrix:i}=t;return function(t,n,a){try{if(Array.isArray(t))return i(t).subset(n,a).valueOf().forEach((r,i)=>{t[i]=r}),t;if(t&&"function"==typeof t.subset)return t.subset(n,a);if("string"==typeof t)return r(t,n,a);else if("object"==typeof t){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return ry(t,n.getObjectProperty(),a),t}else throw TypeError("Cannot apply index: unsupported type of object")}catch(t){throw dR(t)}}}({subset:r,matrix:i});function s(t,r,i){r||(r="keep");var n=dG(t,r,i),a=dG(t.value,r,i);return"all"===r||null!==a&&a<=n}class l extends n{constructor(t,r,i){if(super(),this.object=t,this.index=i?r:null,this.value=i||r,!is(t)&&!rJ(t))throw TypeError('SymbolNode or AccessorNode expected as "object"');if(is(t)&&"end"===t.name)throw Error('Cannot assign to symbol "end"');if(this.index&&!r7(this.index))throw TypeError('IndexNode expected as "index"');if(!r9(this.value))throw TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return dW}get isAssignmentNode(){return!0}_compile(t,r){var i=this.object._compile(t,r),n=this.index?this.index._compile(t,r):null,s=this.value._compile(t,r),l=this.object.name;if(this.index)if(this.index.isObjectProperty()){var u=this.index.getObjectProperty();return function(t,r,n){var a=i(t,r,n),o=s(t,r,n);return ry(a,u,o),o}}else{if(is(this.object))return function(t,r,a){var u=i(t,r,a),c=s(t,r,a),h=n(t,r,u);return t.set(l,o(u,h,c)),c};var c=this.object.object._compile(t,r);if(this.object.index.isObjectProperty()){var h=this.object.index.getObjectProperty();return function(t,r,i){var a=c(t,r,i),l=rg(a,h),u=n(t,r,l),f=s(t,r,i);return ry(a,h,o(l,u,f)),f}}var f=this.object.index._compile(t,r);return function(t,r,i){var l=c(t,r,i),u=f(t,r,l),h=a(l,u),d=n(t,r,h),p=s(t,r,i);return o(l,u,o(h,d,p)),p}}if(!is(this.object))throw TypeError("SymbolNode expected as object");return function(t,r,i){var n=s(t,r,i);return t.set(l,n),n}}forEach(t){t(this.object,"object",this),this.index&&t(this.index,"index",this),t(this.value,"value",this)}map(t){return new l(this._ifNode(t(this.object,"object",this)),this.index?this._ifNode(t(this.index,"index",this)):null,this._ifNode(t(this.value,"value",this)))}clone(){return new l(this.object,this.index,this.value)}_toString(t){var r=this.object.toString(t),i=this.index?this.index.toString(t):"",n=this.value.toString(t);return s(this,t&&t.parenthesis,t&&t.implicit)&&(n="("+n+")"),r+i+" = "+n}toJSON(){return{mathjs:dW,object:this.object,index:this.index,value:this.value}}static fromJSON(t){return new l(t.object,t.index,t.value)}_toHTML(t){var r=this.object.toHTML(t),i=this.index?this.index.toHTML(t):"",n=this.value.toHTML(t);return s(this,t&&t.parenthesis,t&&t.implicit)&&(n='<span class="math-paranthesis math-round-parenthesis">(</span>'+n+'<span class="math-paranthesis math-round-parenthesis">)</span>'),r+i+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n}_toTex(t){var r=this.object.toTex(t),i=this.index?this.index.toTex(t):"",n=this.value.toTex(t);return s(this,t&&t.parenthesis,t&&t.implicit)&&(n="\\left(".concat(n,"\\right)")),r+i+"="+n}}return cv(l,"name",dW),l},{isClass:!0,isNode:!0});t.s(["createAssignmentNode",0,dZ],379668);var dY="BlockNode",dX=ig(dY,["ResultSet","Node"],t=>{var{ResultSet:r,Node:i}
1=t;class n extends i{constructor(t){if(super(),!Array.isArray(t))throw Error("Array expected");this.blocks=t.map(function(t){var r=t&&t.node,i=!t||void 0===t.visible||t.visible;if(!r9(r))throw TypeError('Property "node" must be a Node');if("boolean"!=typeof i)throw TypeError('Property "visible" must be a boolean');return{node:r,visible:i}})}get type(){return dY}get isBlockNode(){return!0}_compile(t,i){var n=os(this.blocks,function(r){return{evaluate:r.node._compile(t,i),visible:r.visible}});return function(t,i,a){var o=[];return ol(n,function(r){var n=r.evaluate(t,i,a);r.visible&&o.push(n)}),new r(o)}}forEach(t){for(var r=0;r<this.blocks.length;r++)t(this.blocks[r].node,"blocks["+r+"].node",this)}map(t){for(var r=[],i=0;i<this.blocks.length;i++){var a=this.blocks[i],o=this._ifNode(t(a.node,"blocks["+i+"].node",this));r[i]={node:o,visible:a.visible}}return new n(r)}clone(){return new n(this.blocks.map(function(t){return{node:t.node,visible:t.visible}}))}_toString(t){return this.blocks.map(function(r){return r.node.toString(t)+(r.visible?"":";")}).join("\n")}toJSON(){return{mathjs:dY,blocks:this.blocks}}static fromJSON(t){return new n(t.blocks)}_toHTML(t){return this.blocks.map(function(r){return r.node.toHTML(t)+(r.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(t){return this.blocks.map(function(r){return r.node.toTex(t)+(r.visible?"":";")}).join("\\;\\;\n")}}return cv(n,"name",dY),n},{isClass:!0,isNode:!0});t.s(["createBlockNode",0,dX],87802);var dK="ConditionalNode",dQ=ig(dK,["Node"],t=>{var{Node:r}=t;class i extends r{constructor(t,r,i){if(super(),!r9(t))throw TypeError("Parameter condition must be a Node");if(!r9(r))throw TypeError("Parameter trueExpr must be a Node");if(!r9(i))throw TypeError("Parameter falseExpr must be a Node");this.condition=t,this.trueExpr=r,this.falseExpr=i}get type(){return dK}get isConditionalNode(){return!0}_compile(t,r){var i=this.condition._compile(t,r),n=this.trueExpr._compile(t,r),a=this.falseExpr._compile(t,r);return function(t,r,o){return!function(t){if("number"==typeof t||"boolean"==typeof t||"string"==typeof t)return!!t;if(t){if(rM(t))return!t.isZero();if(rP(t))return!!(t.re||t.im);if(rk(t))return!!t.value}if(null==t)return!1;throw TypeError('Unsupported type of condition "'+iu(t)+'"')}(i(t,r,o))?a(t,r,o):n(t,r,o)}}forEach(t){t(this.condition,"condition",this),t(this.trueExpr,"trueExpr",this),t(this.falseExpr,"falseExpr",this)}map(t){return new i(this._ifNode(t(this.condition,"condition",this)),this._ifNode(t(this.trueExpr,"trueExpr",this)),this._ifNode(t(this.falseExpr,"falseExpr",this)))}clone(){return new i(this.condition,this.trueExpr,this.falseExpr)}_toString(t){var r=t&&t.parenthesis?t.parenthesis:"keep",i=dG(this,r,t&&t.implicit),n=this.condition.toString(t),a=dG(this.condition,r,t&&t.implicit);("all"===r||"OperatorNode"===this.condition.type||null!==a&&a<=i)&&(n="("+n+")");var o=this.trueExpr.toString(t),s=dG(this.trueExpr,r,t&&t.implicit);("all"===r||"OperatorNode"===this.trueExpr.type||null!==s&&s<=i)&&(o="("+o+")");var l=this.falseExpr.toString(t),u=dG(this.falseExpr,r,t&&t.implicit);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==u&&u<=i)&&(l="("+l+")"),n+" ? "+o+" : "+l}toJSON(){return{mathjs:dK,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(t){return new i(t.condition,t.trueExpr,t.falseExpr)}_toHTML(t){var r=t&&t.parenthesis?t.parenthesis:"keep",i=dG(this,r,t&&t.implicit),n=this.condition.toHTML(t),a=dG(this.condition,r,t&&t.implicit);("all"===r||"OperatorNode"===this.condition.type||null!==a&&a<=i)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>');var o=this.trueExpr.toHTML(t),s=dG(this.trueExpr,r,t&&t.implicit);("all"===r||"OperatorNode"===this.trueExpr.type||null!==s&&s<=i)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>');var l=this.falseExpr.toHTML(t),u=dG(this.falseExpr,r,t&&t.implicit);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==u&&u<=i)&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+'<span class="math-operator math-conditional-operator">?</span>'+o+'<span class="math-operator math-conditional-operator">:</span>'+l}_toTex(t){return"\\begin{cases} {"+this.trueExpr.toTex(t)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(t)+"}\\\\{"+this.falseExpr.toTex(t)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return cv(i,"name",dK),i},{isClass:!0,isNode:!0});t.s(["createConditionalNode",0,dQ],148876);var dJ=t.i(856166),d0={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},d1={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divi
1de:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},d2={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(d1.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(d1.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(d1.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(d1.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(d1.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},fraction:{2:"\\frac{${args[0]}}{${args[1]}}"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(d1.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(d1.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : y^${args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(d1.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(d1.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(d1.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(d1.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(d1.bitAnd,"${args[1]}\\right)")},bitNot:{1:d1.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(d1.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(d1.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(d1.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(d1.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(d1.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(d1.and,"${args[1]}\\right)")},not:{1:d1.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(d1.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(d1.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(d1.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(d1.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(d1.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(d1.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(d1.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(d1.larger,"${args[1]}\\right)")}
1,largerEq:{2:"\\left(${args[0]}".concat(d1.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(d1.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(d1.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(d1.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(d1.to,"${args[1]}\\right)")},numeric:function(t,r){return t.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},bigint:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(d0.i,"\\cdot\\left(${args[1]}\\right)\\right)")},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},d3={deg:"^\\circ"};function d4(t){return(0,dJ.default)(t,{preserveFormatting:!0})}function d6(t,r){return(r=void 0!==r&&r)?im(d3,t)?d3[t]:"\\mathrm{"+d4(t)+"}":im(d0,t)?d0[t]:d4(t)}var d5="ConstantNode",d8=ig(d5,["Node","isBounded"],t=>{var{Node:r,isBounded:i}=t;class n extends r{constructor(t){super(),this.value=t}get type(){return d5}get isConstantNode(){return!0}_compile(t,r){var i=this.value;return function(){return i}}forEach(t){}map(t){return this.clone()}clone(){return new n(this.value)}_toString(t){return a0(this.value,t)}_toHTML(t){var r=this._toString(t);switch(iu(this.value)){case"number":case"bigint":case"BigNumber":case"Fraction":return'<span class="math-number">'+r+"</span>";case"string":return'<span class="math-string">'+r+"</span>";case"boolean":return'<span class="math-boolean">'+r+"</span>";case"null":return'<span class="math-null-symbol">'+r+"</span>";case"undefined":return'<span class="math-undefined">'+r+"</span>";default:return'<span class="math-symbol">'+r+"</span>"}}toJSON(){return{mathjs:d5,value:this.value}}static fromJSON(t){return new n(t.value)}_toTex(t){var r=this._toString(t);switch(iu(this.value)){case"string":return"\\mathtt{"+d4(r)+"}";
1case"number":case"BigNumber":if(!i(this.value))return 0>this.value.valueOf()?"-\\infty":"\\infty";var n=r.toLowerCase().indexOf("e");if(-1!==n)return r.substring(0,n)+"\\cdot10^{"+r.substring(n+1)+"}";return r;case"bigint":return r.toString();case"Fraction":return this.value.toLatex();default:return r}}}return cv(n,"name",d5),n},{isClass:!0,isNode:!0});t.s(["createConstantNode",0,d8],832091);var d7="FunctionAssignmentNode",d9=ig(d7,["typed","Node"],t=>{var{typed:r,Node:i}=t;function n(t,r,i){var n=dG(t,r,i),a=dG(t.expr,r,i);return"all"===r||null!==a&&a<=n}class a extends i{constructor(t,r,i){if(super(),"string"!=typeof t)throw TypeError('String expected for parameter "name"');if(!Array.isArray(r))throw TypeError('Array containing strings or objects expected for parameter "params"');if(!r9(i))throw TypeError('Node expected for parameter "expr"');if(dN.has(t))throw Error('Illegal function name, "'+t+'" is a reserved keyword');var n=new Set;for(var a of r){var o="string"==typeof a?a:a.name;if(n.has(o))throw Error('Duplicate parameter name "'.concat(o,'"'));n.add(o)}this.name=t,this.params=r.map(function(t){return t&&t.name||t}),this.types=r.map(function(t){return t&&t.type||"any"}),this.expr=i}get type(){return d7}get isFunctionAssignmentNode(){return!0}_compile(t,i){var n=Object.create(i);ol(this.params,function(t){n[t]=!0});var a=this.expr,o=a._compile(t,n),s=this.name,l=this.params,u=oh(this.types,","),c=s+"("+oh(this.params,", ")+")";return function(t,i,n){var h={};h[u]=function(){for(var r=Object.create(i),a=0;a<l.length;a++)r[l[a]]=arguments[a];return o(t,r,n)};var f=r(s,h);return f.syntax=c,f.expr=a.toString(),t.set(s,f),f}}forEach(t){t(this.expr,"expr",this)}map(t){var r=this._ifNode(t(this.expr,"expr",this));return new a(this.name,this.params.slice(0),r)}clone(){return new a(this.name,this.params.slice(0),this.expr)}_toString(t){var r=t&&t.parenthesis?t.parenthesis:"keep",i=this.expr.toString(t);return n(this,r,t&&t.implicit)&&(i="("+i+")"),this.name+"("+this.params.join(", ")+") = "+i}toJSON(){var t=this.types;return{mathjs:d7,name:this.name,params:this.params.map(function(r,i){return{name:r,type:t[i]}}),expr:this.expr}}static fromJSON(t){return new a(t.name,t.params,t.expr)}_toHTML(t){for(var r=t&&t.parenthesis?t.parenthesis:"keep",i=[],a=0;a<this.params.length;a++)i.push('<span class="math-symbol math-parameter">'+a3(this.params[a])+"</span>");var o=this.expr.toHTML(t);return n(this,r,t&&t.implicit)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+a3(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+i.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+o}_toTex(t){var r=t&&t.parenthesis?t.parenthesis:"keep",i=this.expr.toTex(t);return n(this,r,t&&t.implicit)&&(i="\\left(".concat(i,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(d6).join(",")+"\\right)="+i}}return cv(a,"name",d7),a},{isClass:!0,isNode:!0});t.s(["createFunctionAssignmentNode",0,d9],965602);var pe="IndexNode",pt=ig(pe,["Node","size"],t=>{var{Node:r,size:i}=t;class n extends r{constructor(t,r){if(super(),this.dimensions=t,this.dotNotation=r||!1,!Array.isArray(t)||!t.every(r9))throw TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw Error("dotNotation only applicable for object properties")}get type(){return pe}get isIndexNode(){return!0}_compile(t,r){var n=os(this.dimensions,function(n,a){if(!(n.filter(t=>t.isSymbolNode&&"end"===t.name).length>0))return n._compile(t,r);var o=Object.create(r);o.end=!0;var s=n._compile(t,o);return function(t,r,n){if(!rL(n)&&!rN(n)&&!rO(n))throw TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+iu(n));var o=i(n),l=Object.create(r);return l.end=o[a],s(t,l,n)}}),a=rg(t,"index");return function(t,r,i){return a(...os(n,function(n){return n(t,r,i)}))}}forEach(t){for(var r=0;r<this.dimensions.length;r++)t(this.dimensions[r],"dimensions["+r+"]",this)}map(t){for(var r=[],i=0;i<this.dimensions.length;i++)r[i]=this._ifNode(t(this.dimensions[i],"dimensions["+i+"]",this));return new n(r,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return 1===this.dimensions.length&&r4(this.dimensions[0])&&"string"==typeof this.dimensions[0].value}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(t){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:pe,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(t){return new n(t.dimensions,t.dotNotation)}_toHTML(t){for(var r=[],i=0;i<this.dimensions.length;i++)r[i]=this.dimensions[i].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+a3(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(t){var r=this.dimensions.map(function(r){return r.toTex(t)});return this.dotNotation?"."+this.getObjectProperty():"_{"+r.join(",")+"}"}}return cv(n,"name",pe),n},{isClass:!0,isNode:!0});t.s(["createIndexNode",0,pt],783466);var pr="ObjectNode",pi=ig(pr,["Node"],t=>{var{Node:r}=t;class i extends r{constructor(t){if(super(),this.properties=t||{},t&&("object"!=typeof t||!Object.keys(t).every(function(r){return r9(t[r])})))throw TypeError("Object containing Nodes expected")}get type(){return pr}get isObjectNode(){return!0}_compile(t,r){var i={};for(var n in this.properties)if(im(this.properties,n)){var a=JSON.parse(a1(n)),o=rg(this.properties,n);i[a]=o._compile(t,r)}return function(t,r,n){var a={};for(var o in i)im(i,o)&&(a[o]=i[o](t,r,n));return a}}forEach(t){for(var r in this.properties)im(this.properties,r)&&t(this.properties[r],"properties["+a1(r)+"]",this)}map(t){var r={};for(var n in this.properties)im(this.properties,n)&&(r[n]=this._ifNode(t(this.properties[n],"properties["+a1(n)+"]",this)));return new i(r)}clone(){var t={};for(var r in this.properties)im(this.properties,r)&&(t[r]=this.properties[r]);return new i(t)}_toString(t){var r=[];for(var i in this.properties)im(this.properties,i)&&r.push(a1(i)+": "+this.properties[i].toString(t));return"{"+r.join(", ")+"}"}toJSON(){return{mathjs:pr,properties:this.properties}}static fromJSON(t){return new i(t.properties)}_toHTML(t){var r=[];for(var i in this.properties)im(this.properties,i)&&r.push('<span class="math-symbol math-property">'+a3(i)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[i].toHTML(t));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(t){var r=[];for(var i in this.properties)im(this.properties,i)&&r.push("\\mathbf{"+i+":} & "+this.properties[i].toTex(t)+"\\\\");return"\\left\\{\\begin{array}{ll}"+r.join("\n")+"\\end{array}\\right\\}"}}return cv(i,"name",pr),i},{isClass:!0,isNode:!0});function pn(t,r){return new rE(t,new rw(r),new Set(Object.keys(r)))}t.s(["createObjectNode",0,pi],811627);var pa="OperatorNode",po=ig(pa,["Node"],t=>{var{Node:r}=t;function i(t,r,i,n,a){var o=dG(t,r,i),s=dq(t,r);
1if("all"===r||n.length>2&&"OperatorNode:add"!==t.getIdentifier()&&"OperatorNode:multiply"!==t.getIdentifier())return n.map(function(t){switch(t.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});switch(n.length){case 0:l=[];break;case 1:var l,u,c,h=dG(n[0],r,i,t);if(a&&null!==h&&("keep"===r?(u=n[0].getIdentifier(),c=t.getIdentifier()):(u=n[0].getContent().getIdentifier(),c=t.getContent().getIdentifier()),!1===dV[o][c].latexLeftParens||!1===dV[h][u].latexParens)||null===h){l=[!1];break}if(h<=o){l=[!0];break}l=[!1];break;case 2:var f,d,p,m,g,y=dG(n[0],r,i,t),v=dH(t,n[0],r);f=null!==y&&(y===o&&"right"===s&&!v||y<o);var _=dG(n[1],r,i,t),b=dH(t,n[1],r);d=null!==_&&(_===o&&"left"===s&&!b||_<o),a&&("keep"===r?(p=t.getIdentifier(),m=t.args[0].getIdentifier(),g=t.args[1].getIdentifier()):(p=t.getContent().getIdentifier(),m=t.args[0].getContent().getIdentifier(),g=t.args[1].getContent().getIdentifier()),null!==y&&(!1===dV[o][p].latexLeftParens&&(f=!1),!1===dV[y][m].latexParens&&(f=!1)),null!==_&&(!1===dV[o][p].latexRightParens&&(d=!1),!1===dV[_][g].latexParens&&(d=!1))),l=[f,d];break;default:("OperatorNode:add"===t.getIdentifier()||"OperatorNode:multiply"===t.getIdentifier())&&(l=n.map(function(n){var a=dG(n,r,i,t),l=dH(t,n,r),u=dq(n,r);if(null===a);else if(o===a&&s===u&&!l)return!0;else if(a<o)return!0;return!1}))}if(n.length>=2&&"OperatorNode:multiply"===t.getIdentifier()&&t.implicit&&"all"!==r&&"hide"===i)for(var x=1;x<l.length;++x)!function t(r,i){var n=r;if("auto"===i)for(;ii(n);)n=n.content;return!!r4(n)||!!ir(n)&&t(n.args[0],i)}(n[x],r)||l[x-1]||"keep"===r&&ii(n[x-1])||(l[x]=!0);return l}class n extends r{constructor(t,r,i,n,a){if(super(),"string"!=typeof t)throw TypeError('string expected for parameter "op"');if("string"!=typeof r)throw TypeError('string expected for parameter "fn"');if(!Array.isArray(i)||!i.every(r9))throw TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===n,this.isPercentage=!0===a,this.op=t,this.fn=r,this.args=i||[]}get type(){return pa}get isOperatorNode(){return!0}_compile(t,r){if("string"!=typeof this.fn||!rb(t,this.fn))if(t[this.fn])throw Error('No access to function "'+this.fn+'"');else throw Error("Function "+this.fn+' missing in provided namespace "math"');var i=rg(t,this.fn),n=os(this.args,function(i){return i._compile(t,r)});if("function"==typeof i&&!0===i.rawArgs){var a=this.args;return function(r,n,o){return i(a,t,pn(r,n))}}if(1===n.length){var o=n[0];return function(t,r,n){return i(o(t,r,n))}}if(2!==n.length)return function(t,r,a){return i.apply(null,os(n,function(i){return i(t,r,a)}))};var s=n[0],l=n[1];return function(t,r,n){return i(s(t,r,n),l(t,r,n))}}forEach(t){for(var r=0;r<this.args.length;r++)t(this.args[r],"args["+r+"]",this)}map(t){for(var r=[],i=0;i<this.args.length;i++)r[i]=this._ifNode(t(this.args[i],"args["+i+"]",this));return new n(this.op,this.fn,r,this.implicit,this.isPercentage)}clone(){return new n(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return 1===this.args.length}isBinary(){return 2===this.args.length}_toString(t){var r=t&&t.parenthesis?t.parenthesis:"keep",n=t&&t.implicit?t.implicit:"hide",a=this.args,o=i(this,r,n,a,!1);if(1===a.length){var s=dq(this,r),l=a[0].toString(t);o[0]&&(l="("+l+")");var u=/[a-zA-Z]+/.test(this.op);return"right"===s?this.op+(u?" ":"")+l:"left"===s?l+(u?" ":"")+this.op:l+this.op}if(2===a.length){var c=a[0].toString(t),h=a[1].toString(t);return(o[0]&&(c="("+c+")"),o[1]&&(h="("+h+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n)?c+" "+h:c+" "+this.op+" "+h}if(!(a.length>2)||"OperatorNode:add"!==this.getIdentifier()&&"OperatorNode:multiply"!==this.getIdentifier())return this.fn+"("+this.args.join(", ")+")";var f=a.map(function(r,i){return r=r.toString(t),o[i]&&(r="("+r+")"),r});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?f.join(" "):f.join(" "+this.op+" ")}toJSON(){return{mathjs:pa,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(t){return new n(t.op,t.fn,t.args,t.implicit,t.isPercentage)}_toHTML(t){var r=t&&t.parenthesis?t.parenthesis:"keep",n=t&&t.implicit?t.implicit:"hide",a=this.args,o=i(this,r,n,a,!1);if(1===a.length){var s=dq(this,r),l=a[0].toHTML(t);return(o[0]&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===s)?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+a3(this.op)+"</span>"+l:l+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+a3(this.op)+"</span>"}if(2===a.length){var u=a[0].toHTML(t),c=a[1].toHTML(t);return(o[0]&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),o[1]&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>
1'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n)?u+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+c:u+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+a3(this.op)+"</span>"+c}var h=a.map(function(r,i){return r=r.toHTML(t),o[i]&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r});return a.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?h.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):h.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+a3(this.op)+"</span>"):'<span class="math-function">'+a3(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+h.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}_toTex(t){var r=t&&t.parenthesis?t.parenthesis:"keep",n=t&&t.implicit?t.implicit:"hide",a=this.args,o=i(this,r,n,a,!0),s=d1[this.fn];if(s=void 0===s?this.op:s,1===a.length){var l=dq(this,r),u=a[0].toTex(t);return(o[0]&&(u="\\left(".concat(u,"\\right)")),"right"===l)?s+u:u+s}if(2===a.length){var c,h=a[0],f=h.toTex(t);o[0]&&(f="\\left(".concat(f,"\\right)"));var d=a[1].toTex(t);switch(o[1]&&(d="\\left(".concat(d,"\\right)")),c="keep"===r?h.getIdentifier():h.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return s+"{"+f+"}{"+d+"}";case"OperatorNode:pow":switch(f="{"+f+"}",d="{"+d+"}",c){case"ConditionalNode":case"OperatorNode:divide":f="\\left(".concat(f,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return f+"~"+d}return f+s+d}if(!(a.length>2)||"OperatorNode:add"!==this.getIdentifier()&&"OperatorNode:multiply"!==this.getIdentifier())return"\\mathrm{"+this.fn+"}\\left("+a.map(function(r){return r.toTex(t)}).join(",")+"\\right)";var p=a.map(function(r,i){return r=r.toTex(t),o[i]&&(r="\\left(".concat(r,"\\right)")),r});return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===n?p.join("~"):p.join(s)}getIdentifier(){return this.type+":"+this.fn}}return cv(n,"name",pa),n},{isClass:!0,isNode:!0});t.s(["createOperatorNode",0,po],61284);var ps="ParenthesisNode",pl=ig(ps,["Node"],t=>{var{Node:r}=t;class i extends r{constructor(t){if(super(),!r9(t))throw TypeError('Node expected for parameter "content"');this.content=t}get type(){return ps}get isParenthesisNode(){return!0}_compile(t,r){return this.content._compile(t,r)}getContent(){return this.content.getContent()}forEach(t){t(this.content,"content",this)}map(t){return new i(t(this.content,"content",this))}clone(){return new i(this.content)}_toString(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"("+this.content.toString(t)+")":this.content.toString(t)}toJSON(){return{mathjs:ps,content:this.content}}static fromJSON(t){return new i(t.content)}_toHTML(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(t)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(t)}_toTex(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"\\left(".concat(this.content.toTex(t),"\\right)"):this.content.toTex(t)}}return cv(i,"name",ps),i},{isClass:!0,isNode:!0});t.s(["createParenthesisNode",0,pl],986258);var pu="RangeNode",pc=ig(pu,["Node"],t=>{var{Node:r}=t;function i(t,r,i){var n=dG(t,r,i),a={},o=dG(t.start,r,i);if(a.start=null!==o&&o<=n||"all"===r,t.step){var s=dG(t.step,r,i);a.step=null!==s&&s<=n||"all"===r}var l=dG(t.end,r,i);return a.end=null!==l&&l<=n||"all"===r,a}class n extends r{constructor(t,r,i){if(super(),!r9(t)||!r9(r)||i&&!r9(i))throw TypeError("Node expected");if(arguments.length>3)throw Error("Too many arguments");this.start=t,this.end=r,this.step=i||null}get type(){return pu}get isRangeNode(){return!0}needsEnd(){return this.filter(function(t){return is(t)&&"end"===t.name}).length>0}_compile(t,r){var i=t.range,n=this.start._compile(t,r),a=this.end._compile(t,r);
1if(!this.step)return function(t,r,o){return i(n(t,r,o),a(t,r,o))};var o=this.step._compile(t,r);return function(t,r,s){return i(n(t,r,s),a(t,r,s),o(t,r,s))}}forEach(t){t(this.start,"start",this),t(this.end,"end",this),this.step&&t(this.step,"step",this)}map(t){return new n(this._ifNode(t(this.start,"start",this)),this._ifNode(t(this.end,"end",this)),this.step&&this._ifNode(t(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(t){var r,n=i(this,t&&t.parenthesis?t.parenthesis:"keep",t&&t.implicit),a=this.start.toString(t);if(n.start&&(a="("+a+")"),r=a,this.step){var o=this.step.toString(t);n.step&&(o="("+o+")"),r+=":"+o}var s=this.end.toString(t);return n.end&&(s="("+s+")"),r+=":"+s}toJSON(){return{mathjs:pu,start:this.start,end:this.end,step:this.step}}static fromJSON(t){return new n(t.start,t.end,t.step)}_toHTML(t){var r,n=i(this,t&&t.parenthesis?t.parenthesis:"keep",t&&t.implicit),a=this.start.toHTML(t);if(n.start&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r=a,this.step){var o=this.step.toHTML(t);
1n.step&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+o}var s=this.end.toHTML(t);return n.end&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+s}_toTex(t){var r=i(this,t&&t.parenthesis?t.parenthesis:"keep",t&&t.implicit),n=this.start.toTex(t);if(r.start&&(n="\\left(".concat(n,"\\right)")),this.step){var a=this.step.toTex(t);r.step&&(a="\\left(".concat(a,"\\right)")),n+=":"+a}var o=this.end.toTex(t);return r.end&&(o="\\left(".concat(o,"\\right)")),n+=":"+o}}return cv(n,"name",pu),n},{isClass:!0,isNode:!0});t.s(["createRangeNode",0,pc],788448);var ph="RelationalNode",pf=ig(ph,["Node"],t=>{var{Node:r}=t,i={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends r{constructor(t,r){if(super(),!Array.isArray(t))throw TypeError("Parameter conditionals must be an array");if(!Array.isArray(r))throw TypeError("Parameter params must be an array");if(t.length!==r.length-1)throw TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=t,this.params=r}get type(){return ph}get isRelationalNode(){return!0}_compile(t,r){var i=this,n=this.params.map(i=>i._compile(t,r));return function(r,a,o){for(var s,l=n[0](r,a,o),u=0;u<i.conditionals.length;u++)if(s=l,l=n[u+1](r,a,o),!rg(t,i.conditionals[u])(s,l))return!1;return!0}}forEach(t){this.params.forEach((r,i)=>t(r,"params["+i+"]",this),this)}map(t){return new n(this.conditionals.slice(),this.params.map((r,i)=>this._ifNode(t(r,"params["+i+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(t){for(var r=t&&t.parenthesis?t.parenthesis:"keep",n=dG(this,r,t&&t.implicit),a=this.params.map(function(i,a){var o=dG(i,r,t&&t.implicit);return"all"===r||null!==o&&o<=n?"("+i.toString(t)+")":i.toString(t)}),o=a[0],s=0;s<this.conditionals.length;s++)o+=" "+i[this.conditionals[s]],o+=" "+a[s+1];return o}toJSON(){return{mathjs:ph,conditionals:this.conditionals,params:this.params}}static fromJSON(t){return new n(t.conditionals,t.params)}_toHTML(t){for(var r=t&&t.parenthesis?t.parenthesis:"keep",n=dG(this,r,t&&t.implicit),a=this.params.map(function(i,a){var o=dG(i,r,t&&t.implicit);return"all"===r||null!==o&&o<=n?'<span class="math-parenthesis math-round-parenthesis">(</span>'+i.toHTML(t)+'<span class="math-parenthesis math-round-parenthesis">)</span>':i.toHTML(t)}),o=a[0],s=0;s<this.conditionals.length;s++)o+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+a3(i[this.conditionals[s]])+"</span>"+a[s+1];return o}_toTex(t){for(var r=t&&t.parenthesis?t.parenthesis:"keep",i=dG(this,r,t&&t.implicit),n=this.params.map(function(n,a){var o=dG(n,r,t&&t.implicit);return"all"===r||null!==o&&o<=i?"\\left("+n.toTex(t)+"\right)":n.toTex(t)}),a=n[0],o=0;o<this.conditionals.length;o++)a+=d1[this.conditionals[o]]+n[o+1];return a}}return cv(n,"name",ph),n},{isClass:!0,isNode:!0});t.s(["createRelationalNode",0,pf],434078);var pd=ig("SymbolNode",["math","?Unit","Node"],t=>{var{math:r,Unit:i,Node:n}=t;function a(t){return!!i&&i.isValuelessUnit(t)}return class t extends n{constructor(t){if(super(),"string"!=typeof t)throw TypeError('String expected for parameter "name"');this.name=t}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(r,n){var o=this.name;if(!0===n[o])return function(t,r,i){return rg(r,o)};if(o in r)return function(t,i,n){return t.has(o)?t.get(o):rg(r,o)};var s=a(o);return function(r,n,a){return r.has(o)?r.get(o):s?new i(null,o):t.onUndefinedSymbol(o)}}forEach(t){}map(t){return this.clone()}static onUndefinedSymbol(t){throw Error("Undefined symbol "+t)}clone(){return new t(this.name)}_toString(t){return this.name}_toHTML(t){var r=a3(this.name);if("true"===r||"false"===r)return'<span class="math-symbol math-boolean">'+r+"</span>";if("i"===r)return'<span class="math-symbol math-imaginary-symbol">'+r+"</span>";if("Infinity"===r)return'<span class="math-symbol math-infinity-symbol">'+r+"</span>";if("NaN"===r)return'<span class="math-symbol math-nan-symbol">'+r+"</span>";if("null"===r)return'<span class="math-symbol math-null-symbol">'+r+"</span>";else if("undefined"===r)return'<span class="math-symbol math-undefined-symbol">'+r+"</span>";return'<span class="math-symbol">'+r+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(r){return new t(r.name)}_toTex(t){var i=!1;void 0===r[this.name]&&a(this.name)&&(i=!0);var n=d6(this.name,i);return"\\"===n[0]?n:" "+n}}},{isClass:!0,isNode:!0});t.s(["createSymbolNode",0,pd],486324);var pp="FunctionNode",pm=ig(pp,["math","Node","SymbolNode"],t=>{var{math:r,Node:i,SymbolNode:n}=t,a=t=>a0(t,{truncate:78});function o(t,r,i){for(var n,a="",o=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,s=0;null!==(n=o.exec(t));)if(a+=t.substring(s,n.index),s=n.index,"$$"===n[0])a+="$",s++;else{s+=n[0].length;var l=r[n[1]];if(!l)throw ReferenceError("Template: Property "+n[1]+" does not exist.");if(void 0===n[2])switch(typeof l){case"string":a+=l;break;case"object":if(r9(l))a+=l.toTex(i);else if(Array.isArray(l))a+=l.map(function(t,r){if(r9(t))return t.toTex(i);throw TypeError("Template: "+n[1]+"["+r+"] is not a Node.")}).join(",");else throw TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes");break;default:throw TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes")}else if(r9(l[n[2]]&&l[n[2]]))a+=l[n[2]].toTex(i);else throw TypeError("Template: "+n[1]+"["+n[2]+"] is not a Node.")}return a+t.slice(s)}class s extends i{constructor(t,r,i){if(super(),"string"==typeof t&&(t=new n(t)),!r9(t))throw TypeError('Node expected as parameter "fn"');if(!Array.isArray(r)||!r.every(r9))throw TypeError('Array containing Nodes expected for parameter "args"');var a=typeof i;if("undefined"!==a&&"boolean"!==a)throw TypeError("optional flag, if specified, must be boolean");this.fn=t,this.args=r||[],this.optional=!!i}get name(){return this.fn.name||""}get type(){return pp}get isFunctionNode(){return!0}_compile(t,r){var i=this.args.map(i=>
1i._compile(t,r)),n=this.optional||rJ(this.fn)&&this.fn.optionalChaining;if(is(this.fn)){var o=this.fn.name;if(r[o]){var l=this.args;return function(r,s,u){var c=rg(s,o);if(!n||void 0!==c){if("function"!=typeof c)throw TypeError("Argument '".concat(o,"' was not a function; received: ").concat(a(c)));if(c.rawArgs)return c(l,t,pn(r,s));var h=i.map(t=>t(r,s,u));return c.apply(c,h)}}}var u=o in t?rg(t,o):void 0,c="function"==typeof u&&!0===u.rawArgs,h=r=>{var i;if(r.has(o))i=r.get(o);else if(o in t)i=rg(t,o);else{if(!n)return s.onUndefinedFunction(o);i=void 0}if("function"==typeof i||n&&void 0===i)return i;throw TypeError("'".concat(o,"' is not a function; its value is:\n ").concat(a(i)))};if(c){var f=this.args;return function(r,n,a){var o=h(r);return!0===o.rawArgs?o(f,t,pn(r,n)):o(...i.map(t=>t(r,n,a)))}}switch(i.length){case 0:return function(t,r,i){var a=h(t);if(!n||void 0!==a)return a()};case 1:return function(t,r,a){var o=h(t);if(!n||void 0!==o)return o((0,i[0])(t,r,a))};case 2:return function(t,r,a){var o=h(t);if(!n||void 0!==o){var s=i[0],l=i[1];return o(s(t,r,a),l(t,r,a))}};default:return function(t,r,a){var o=h(t);if(!n||void 0!==o)return o(...i.map(i=>i(t,r,a)))}}}if(rJ(this.fn)&&r7(this.fn.index)&&this.fn.index.isObjectProperty()){var d=this.fn.object._compile(t,r),p=this.fn.index.getObjectProperty(),m=this.args;return function(r,a,o){var s=d(r,a,o);if(!n||null!=s&&void 0!==s[p]){var l=function(t,r){if(!rb(t,r))throw Error('No access to method "'+r+'"');return t[r]}(s,p);if(null!=l&&l.rawArgs)return l(m,t,pn(r,a));var u=i.map(t=>t(r,a,o));return l.apply(s,u)}}}var g=this.fn.toString(),y=this.fn._compile(t,r),v=this.args;return function(r,o,s){var l=y(r,o,s);if(!n||void 0!==l){if("function"!=typeof l)throw TypeError("Expression '".concat(g,"' did not evaluate to a function; value is:")+"\n ".concat(a(l)));if(l.rawArgs)return l(v,t,pn(r,o));var u=i.map(t=>t(r,o,s));return l.apply(l,u)}}}forEach(t){t(this.fn,"fn",this);for(var r=0;r<this.args.length;r++)t(this.args[r],"args["+r+"]",this)}map(t){for(var r=this._ifNode(t(this.fn,"fn",this)),i=[],n=0;n<this.args.length;n++)i[n]=this._ifNode(t(this.args[n],"args["+n+"]",this));return new s(r,i)}clone(){return new s(this.fn,this.args.slice(0))}toString(t){var r,i=this.fn.toString(t);return(t&&"object"==typeof t.handler&&im(t.handler,i)&&(r=t.handler[i](this,t)),void 0!==r)?r:super.toString(t)}_toString(t){var r=this.args.map(function(r){return r.toString(t)});return(r5(this.fn)?"("+this.fn.toString(t)+")":this.fn.toString(t))+"("+r.join(", ")+")"}toJSON(){return{mathjs:pp,fn:this.fn,args:this.args}}_toHTML(t){var r=this.args.map(function(r){return r.toHTML(t)});return'<span class="math-function">'+a3(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(t){var r;return(t&&"object"==typeof t.handler&&im(t.handler,this.name)&&(r=t.handler[this.name](this,t)),void 0!==r)?r:super.toTex(t)}_toTex(t){var i,n,a=this.args.map(function(r){return r.toTex(t)});switch(d2[this.name]&&(i=d2[this.name]),r[this.name]&&("function"==typeof r[this.name].toTex||"object"==typeof r[this.name].toTex||"string"==typeof r[this.name].toTex)&&(i=r[this.name].toTex),typeof i){case"function":n=i(this,t);break;case"string":n=o(i,this,t);break;case"object":switch(typeof i[a.length]){case"function":n=i[a.length](this,t);break;case"string":n=o(i[a.length],this,t)}}return void 0!==n?n:o("\\mathrm{${name}}\\left(${args}\\right)",this,t)}getIdentifier(){return this.type+":"+this.name}}return cv(s,"name",pp),cv(s,"onUndefinedFunction",function(t){throw Error("Undefined function "+t)}),cv(s,"fromJSON",function(t){return new s(t.fn,t.args)}),s},{isClass:!0,isNode:!0});t.s(["createFunctionNode",0,pm],172311);var pg="parse",py=ig(pg,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],t=>
1{var{typed:r,numeric:i,config:n,AccessorNode:a,ArrayNode:o,AssignmentNode:s,BlockNode:l,ConditionalNode:u,ConstantNode:c,FunctionAssignmentNode:h,FunctionNode:f,IndexNode:d,ObjectNode:p,OperatorNode:m,ParenthesisNode:g,RangeNode:y,RelationalNode:v,SymbolNode:_}=t,b=r(pg,{string:function(t){return R(t,{})},"Array | Matrix":function(t){return x(t,{})},"string, Object":function(t,r){return R(t,void 0!==r.nodes?r.nodes:{})},"Array | Matrix, Object":x});function x(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=void 0!==r.nodes?r.nodes:{};return oP(t,function(t){if("string"!=typeof t)throw TypeError("String expected");return R(t,i)})}var w={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"?.":!0,"??":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},T={true:!0,false:!1,null:null,undefined},A=["NaN","Infinity"],S={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "};function C(t,r){return t.expression.substr(t.index,r)}function M(t){return C(t,1)}function D(t){t.index++}function P(t){return t.expression.charAt(t.index-1)}function I(t){return t.expression.charAt(t.index+1)}function k(t){for(t.tokenType=0,t.token="",t.comment="";;){if("#"===M(t))for(;"\n"!==M(t)&&""!==M(t);)t.comment+=M(t),D(t);if(b.isWhitespace(M(t),t.nestingLevel))D(t);else break}if(""===M(t)){t.tokenType=1;return}if("\n"===M(t)&&!t.nestingLevel){t.tokenType=1,t.token=M(t),D(t);return}var r=M(t),i=C(t,2),n=C(t,3);if(3===n.length&&w[n]){t.tokenType=1,t.token=n,D(t),D(t),D(t);return}if(2===i.length&&w[i]&&("?."!==i||!b.isDigit(t.expression.charAt(t.index+2)))){t.tokenType=1,t.token=i,D(t),D(t);return}if(w[r]){t.tokenType=1,t.token=r,D(t);return}if(b.isDigitDot(r)){t.tokenType=2;var a=C(t,2);if("0b"===a||"0o"===a||"0x"===a){for(t.token+=M(t),D(t),t.token+=M(t),D(t);b.isAlpha(M(t),P(t),I(t))||b.isDigit(M(t));)t.token+=M(t),D(t);if("."===M(t))for(t.token+=".",D(t);b.isAlpha(M(t),P(t),I(t))||b.isDigit(M(t));)t.token+=M(t),D(t);else if("i"===M(t))for(t.token+="i",D(t);b.isDigit(M(t));)t.token+=M(t),D(t);return}if("."===M(t)){if(t.token+=M(t),D(t),!b.isDigit(M(t))){t.tokenType=1;return}}else{for(;b.isDigit(M(t));)t.token+=M(t),D(t);b.isDecimalMark(M(t),I(t))&&(t.token+=M(t),D(t))}for(;b.isDigit(M(t));)t.token+=M(t),D(t);if("E"===M(t)||"e"===M(t)){if(b.isDigit(I(t))||"-"===I(t)||"+"===I(t)){if(t.token+=M(t),D(t),("+"===M(t)||"-"===M(t))&&(t.token+=M(t),D(t)),!b.isDigit(M(t)))throw en(t,'Digit expected, got "'+M(t)+'"');for(;b.isDigit(M(t));)t.token+=M(t),D(t);if(b.isDecimalMark(M(t),I(t)))throw en(t,'Digit expected, got "'+M(t)+'"')}else if(b.isDecimalMark(I(t),t.expression.charAt(t.index+2)))throw D(t),en(t,'Digit expected, got "'+M(t)+'"')}return}if(b.isAlpha(M(t),P(t),I(t))){for(;b.isAlpha(M(t),P(t),I(t))||b.isDigit(M(t));)t.token+=M(t),D(t);im(E,t.token)?t.tokenType=1:t.tokenType=3;return}for(t.tokenType=4;""!==M(t);)t.token+=M(t),D(t);throw en(t,'Syntax error in part "'+t.token+'"')}function O(t){do k(t);while("\n"===t.token)}function N(t){t.nestingLevel++}function L(t){t.nestingLevel--}function R(t,r){var i={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:0,nestingLevel:0,conditionalLevel:null};rh(i,{expression:t,extraNodes:r}),k(i);var n=function(t){var r,i,n=[];for(""!==t.token&&"\n"!==t.token&&";"!==t.token&&(r=F(t),t.comment&&(r.comment=t.comment));"\n"===t.token||";"===t.token;)0===n.length&&r&&(i=";"!==t.token,n.push({node:r,visible:i})),k(t),"\n"!==t.token&&";"!==t.token&&""!==t.token&&(r=F(t),t.comment&&(r.comment=t.comment),i=";"!==t.token,n.push({node:r,visible:i}));return n.length>0?new l(n):(!r&&(r=new c(void 0),t.comment&&(r.comment=t.comment)),r)}(i);if(""!==i.token)if(1===i.tokenType)throw ea(i,"Unexpected operator "+i.token);else throw en(i,'Unexpected part "'+i.token+'"');return n}function F(t){var r,i,n,a,o=function(t){for(var r=function(t){for(var r=B(t);"or"===t.token;)O(t),r=new m("or","or",[r,B(t)]);return r}(t);"?"===t.token;){var i=t.conditionalLevel;t.conditionalLevel=t.nestingLevel,O(t);var n=r,a=F(t);if(":"!==t.token)throw en(t,"False part of conditional expression expected");t.conditionalLevel=null,O(t),r=new u(n,a,F(t)),t.conditionalLevel=i}return r}(t);
1if("="===t.token){if(is(o))return r=o.name,O(t),n=F(t),new s(new _(r),n);if(rJ(o)){if(o.optionalChaining)throw en(t,"Cannot assign to optional chain");return O(t),n=F(t),new s(o.object,o.index,n)}if(r8(o)&&is(o.fn)&&(a=!0,i=[],r=o.name,o.args.forEach(function(t,r){is(t)?i[r]=t.name:a=!1}),a))return O(t),new h(r,i,n=F(t));throw en(t,"Invalid left hand side of assignment operator =")}return o}function B(t){for(var r=z(t);"xor"===t.token;)O(t),r=new m("xor","xor",[r,z(t)]);return r}function z(t){for(var r=j(t);"and"===t.token;)O(t),r=new m("and","and",[r,j(t)]);return r}function j(t){for(var r=U(t);"|"===t.token;)O(t),r=new m("|","bitOr",[r,U(t)]);return r}function U(t){for(var r=V(t);"^|"===t.token;)O(t),r=new m("^|","bitXor",[r,V(t)]);return r}function V(t){for(var r=$(t);"&"===t.token;)O(t),r=new m("&","bitAnd",[r,$(t)]);return r}function $(t){for(var r=[G(t)],i=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};im(n,t.token);){var a={name:t.token,fn:n[t.token]};i.push(a),O(t),r.push(G(t))}return 1===r.length?r[0]:2===r.length?new m(i[0].name,i[0].fn,r):new v(i.map(t=>t.fn),r)}function G(t){for(var r,i,n=q(t),a={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};im(a,t.token);)i=a[r=t.token],O(t),n=new m(r,i,[n,q(t)]);return n}function q(t){for(var r,i,n=H(t),a={to:"to",in:"to"};im(a,t.token);)i=a[r=t.token],O(t),n="in"===r&&"])},;".includes(t.token)?new m("*","multiply",[n,new _("in")],!0):new m(r,i,[n,H(t)]);return n}function H(t){var r,i=[];if(":"===t.token)if(t.conditionalLevel===t.nestingLevel)throw en(t,"The true-expression of a conditional operator may not be empty");else r=new c(1);else r=W(t);if(":"===t.token&&t.conditionalLevel!==t.nestingLevel){for(i.push(r);":"===t.token&&i.length<3;)O(t),")"===t.token||"]"===t.token||","===t.token||""===t.token?i.push(new _("end")):i.push(W(t));r=3===i.length?new y(i[0],i[2],i[1]):new y(i[0],i[1])}return r}function W(t){for(var r,i,n,a=Z(t),o={"+":"add","-":"subtract"};im(o,t.token);){i=o[r=t.token],O(t);var s=Z(t);n=s.isPercentage?[a,new m("*","multiply",[a,s])]:[a,s],a=new m(r,i,n)}return a}function Z(t){for(var r,i,n,a=r=Y(t),o={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};;)if(im(o,t.token))n=o[i=t.token],O(t),r=new m(i,n,[r,Y(t)]);else break;return r}function Y(t){var r,i;for(i=r=X(t);;)if(3===t.tokenType||"in"===t.token&&r4(r)||"in"===t.token&&ir(r)&&"unaryMinus"===r.fn&&r4(r.args[0])||2===t.tokenType&&!r4(i)&&(!ir(i)||"!"===i.op)||"("===t.token)r=new m("*","multiply",[r,i=X(t)],!0);else break;return r}function X(t){for(var r=K(t),i=r,n=[];;)if("/"===t.token&&r6(i))if(n.push(rh({},t)),O(t),2===t.tokenType)if(n.push(rh({},t)),O(t),3===t.tokenType||"("===t.token||"in"===t.token)rh(t,n.pop()),n.pop(),r=new m("/","divide",[r,i=K(t)]);else{n.pop(),rh(t,n.pop());break}else{rh(t,n.pop());break}else break;return r}function K(t){var r=Q(t);if("%"===t.token){var i=rh({},t);O(t);try{Q(t),rh(t,i)}catch(t){r=new m("/","divide",[r,new c(100)],!1,!0)}}return r}function Q(t){var r,i,n,a,o,s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return im(s,t.token)?(o=s[t.token],a=t.token,O(t),new m(a,o,[Q(t)])):(i=function(t){for(var r=J(t);"??"===t.token;)O(t),r=new m("??","nullish",[r,J(t)]);return r}(r=t),("^"===r.token||".^"===r.token)&&(n=r.token,O(r),i=new m(n,"^"===n?"pow":"dotPow",[i,Q(r)])),i)}function J(t){for(var r,a,s=function(t){var r,a,s,l,u,h=[];if(3===t.tokenType&&im(t.extraNodes,t.token)){var f=t.extraNodes[t.token];if(k(t),"("===t.token){if(h=[],N(t),k(t),")"!==t.token)for(h.push(F(t));","===t.token;)k(t),h.push(F(t));if(")"!==t.token)throw en(t,"Parenthesis ) expected");L(t),k(t)}return new f(h)}return 3===(r=t).tokenType||1===r.tokenType&&r.token in E?(s=r.token,k(r),ee(r,im(T,s)?new c(T[s]):A.includes(s)?new c(i(s,"number")):new _(s))):'"'===(l=r).token||"'"===l.token?(u=new c(et(l,l.token)),u=ee(l,u)):function(t){if("["===t.token){if(N(t),k(t),"]"!==t.token){var r=er(t);if(";"===t.token){for(h=1,u=[r];";"===t.token;)k(t),"]"!==t.token&&(u[h]=er(t),h++);if("]"!==t.token)throw en(t,"End of matrix ] expected");L(t),k(t),f=u[0].items.length;for(var a=1;a<h;a++)if(u[a].items.length!==f)throw ea(t,"Column dimensions mismatch ("+u[a].items.length+" !== "+f+")");l=new o(u)}else{if("]"!==t.token)throw en(t,"End of matrix ] expected");L(t),k(t),l=r}}else L(t),k(t),l=new o([]);return ee(t,l)}var s=t;if("{"===s.token){N(s);var l,u,h,f,d,m={};do if(k(s),"}"!==s.token){if('"'===s.token||"'"===s.token)d=et(s,s.token);else if(3===s.tokenType||1===s.tokenType&&s.token in E)d=s.token,k(s);else throw en(s,"Symbol or string expected as object key");if(":"!==s.token)throw en(s,"Colon : expected after object key");k(s),m[d]=F(s)}while(","===s.token)if("}"!==s.token)throw en(s,"Comma , or bracket } expected after object value");L(s),k(s);var y=new p(m);return ee(s,y)}return function(t){if(2===t.tokenType){r=t.token,k(t);var r,a,o=iC(r,n);return new c(i(r,o))}var s=t;if("("===s.token){if(N(s),k(s),a=F(s),")"!==s.token)throw en(s,"Parenthesis ) expected");return L(s),k(s),a=ee(s,a=new g(a))}var l=s;if(""===l.token)throw en(l,"Unexpected end of expression");throw en(l,"Value expected")}(s)}(l)}(t),l={"!":"factorial","'":"ctranspose"};im(l,t.token);)a=l[r=t.token],k(t),s=ee(t,s=new m(r,a,[s]));return s}function ee(t,r,i){for(var n;;){var o=!1;"?."===t.token&&(o=!0,k(t));var s=("("===t.token||"["===t.token||"."===t.token)&&(!i||i.includes(t.token));if(!(o||s))break;if(n=[],"("===t.token)if(o||is(r)||rJ(r)){if(N(t),k(t),")"!==t.token)for(n.push(F(t));","===t.token;)k(t),n.push(F(t));if(")"!==t.token)throw en(t,"Parenthesis ) expected");L(t),k(t),r=new f(r,n,o)}else break;else if("["===t.token){if(N(t),k(t),"]"!==t.token)for(n.push(F(t));","===t.token;)k(t),n.push(F(t));if("]"!==t.token)throw en(t,"Parenthesis ] expected");L(t),k(t),r=new a(r,new d(n),o)}else{if(o||k(t),!(3===t.tokenType||1===t.tokenType&&t.token in E)){var l="Property name expected after ";throw en(t,l+=o?"optional chain":"dot")}n.push(new c(t.token)),k(t),r=new a(r,new d(n,!0),o)}}return r}function et(t,r){for(var i="";""!==M(t)&&M(t)!==r;)if("\\"===M(t)){D(t);var n=M(t),a=S[n];if(void 0!==a)i+=a,t.index+=1;else if("u"===n){var o=t.expression.slice(t.index+1,t.index+5);if(/^[0-9A-Fa-f]{4}$/.test(o))i+=String.fromCharCode(parseInt(o,16)),t.index+=5;else throw en(t,"Invalid unicode character \\u".concat(o))}else throw en(t,"Bad escape character \\".concat(n))}else i+=M(t),D(t);if(k(t),t.token!==r)throw en(t,"End of string ".concat(r," expected"));return k(t),i}function er(t){for(var r=[F(t)],i=1;","===t.token;)k(t),"]"!==t.token&&";"!==t.token&&(r[i]=F(t),i++);return new o(r)}function ei(t){return t.index-t.token.length+1}function en(t,r){var i=ei(t),n=SyntaxError(r+" (char "+i+")");return n.char=i,n}function ea(t,r){var i=ei(t),n=SyntaxError(r+" (char "+i+")");return n.char=i,n}return b.isAlpha=function(t,r,i){return b.isValidLatinOrGreek(t)||b.isValidMathSymbol(t,i)||b.isValidMathSymbol(r,t)},b.isValidLatinOrGreek=function(t){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(t)},b.isValidMathSymbol=function(t,r){return/^[\uD835]$/.test(t)&&/^[\uDC00-\uDFFF]$/.test(r)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(r)},b.isWhitespace=function(t,r){return" "===t||" "===t||"Â "===t||"\n"===t&&r>0},b.isDecimalMark=function(t,r){return"."===t&&"/"!==r&&"*"!==r&&"^"!==r},b.isDigitDot=function(t){return t>="0"&&t<="9"||"."===t},b.isDigit=function(t){return t>="0"&&t<="9"},r.addConversion({from:"string",to:"Node",convert:b}),b});t.s(["createParse",0,py],608112);
1var pv="compile",p_=ig(pv,["typed","parse"],t=>{var{typed:r,parse:i}=t;return r(pv,{string:function(t){return i(t).compile()},"Array | Matrix":function(t){return oP(t,function(t){return i(t).compile()})}})});t.s(["createCompile",0,p_],228948);var pb="evaluate",px=ig(pb,["typed","parse"],t=>{var{typed:r,parse:i}=t;return r(pb,{string:function(t){var r=rA();return i(t).compile().evaluate(r)},"string, Map | Object":function(t,r){return i(t).compile().evaluate(r)},"Array | Matrix":function(t){var r=rA();return oP(t,function(t){return i(t).compile().evaluate(r)})},"Array | Matrix, Map | Object":function(t,r){return oP(t,function(t){return i(t).compile().evaluate(r)})}})});t.s(["createEvaluate",0,px],633229);var pw=ig("Parser",["evaluate","parse"],t=>{var{evaluate:r,parse:i}=t;function n(){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:rA(),writable:!1})}return n.prototype.type="Parser",n.prototype.isParser=!0,n.prototype.evaluate=function(t){return r(t,this.scope)},n.prototype.get=function(t){if(this.scope.has(t))return this.scope.get(t)},n.prototype.getAll=function(){var t=this.scope;if(t instanceof rw)return t.wrappedObject;var r={};for(var i of t.keys()){var n=t.get(i);ry(r,i,n)}return r},n.prototype.getAllAsMap=function(){return this.scope},n.prototype.set=function(t,r){if(!function(t){if(0===t.length)return!1;for(var r=0;r<t.length;r++){var n=t.charAt(r-1),a=t.charAt(r),o=t.charAt(r+1);if(!(i.isAlpha(a,n,o)||r>0&&i.isDigit(a)))return!1}return!0}(t))throw Error("Invalid variable name: '".concat(t,"'. Variable names must follow the specified rules."));return this.scope.set(t,r),r},n.prototype.remove=function(t){this.scope.delete(t)},n.prototype.clear=function(){this.scope.clear()},n.prototype.toJSON=function(){var t,r={mathjs:"Parser",variables:{},functions:{}};for(var[i,n]of this.scope)if(rG(n)){if("function"!=typeof(t=n)||"string"!=typeof t.syntax||"string"!=typeof t.expr)throw Error("Cannot serialize external function ".concat(i));r.functions[i]="".concat(n.syntax," = ").concat(n.expr)}else r.variables[i]=n;return r},n.fromJSON=function(t){var r=new n;return Object.entries(t.variables).forEach(t=>{var[i,n]=t;return r.set(i,n)}),Object.entries(t.functions).forEach(t=>{var[i,n]=t;return r.evaluate(n)}),r},n},{isClass:!0});t.s(["createParserClass",0,pw],520219);var pE="parser",pT=ig(pE,["typed","Parser"],t=>{var{typed:r,Parser:i}=t;return r(pE,{"":function(){return new i}})});t.s(["createParser",0,pT],588724);var pA=ig("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],t=>{var{typed:r,matrix:i,abs:n,addScalar:a,divideScalar:o,multiplyScalar:s,subtractScalar:l,larger:u,equalScalar:c,unaryMinus:h,DenseMatrix:f,SparseMatrix:d,Spa:p}=t;return r("lup",{DenseMatrix:function(t){return m(t)},SparseMatrix:function(t){return function(t){var r,i,a,l=t._size[0],f=t._size[1],m=Math.min(l,f),g=t._values,y=t._index,v=t._ptr,_=[],b=[],x=[],w=[l,m],E=[],T=[],A=[],S=[m,f],C=[],M=[];for(r=0;r<l;r++)C[r]=r,M[r]=r;var D=function(t,r){var i=M[t],n=M[r];C[i]=r,C[n]=t,M[t]=n,M[r]=i};for(i=0;i<f;i++)!function(){var t=new p;i<l&&(x.push(_.length),_.push(1),b.push(i)),A.push(E.length);var f=v[i],m=v[i+1];for(a=f;a<m;a++)r=y[a],t.set(C[r],g[a]);i>0&&t.forEach(0,i-1,function(r,i){d._forEachRow(r,_,b,x,function(n,a){n>r&&t.accumulate(n,h(s(a,i)))})});var M=i,P=t.get(i),I=n(P);t.forEach(i+1,l-1,function(t,r){var i=n(r);u(i,I)&&(M=t,I=i,P=r)}),i!==M&&(d._swapRows(i,M,w[1],_,b,x),d._swapRows(i,M,S[1],E,T,A),t.swap(i,M),D(i,M)),t.forEach(0,l-1,function(t,r){t<=i?(E.push(r),T.push(t)):c(r=o(r,P),0)||(_.push(r),b.push(t))})}();return A.push(E.length),x.push(_.length),{L:new d({values:_,index:b,ptr:x,size:w}),U:new d({values:E,index:T,ptr:A,size:S}),p:C,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(t)},Array:function(t){var r=m(i(t));return{L:r.L.valueOf(),U:r.U.valueOf(),p:r.p}}});function m(t){var r,i,h,d=t._size[0],p=t._size[1],m=Math.min(d,p),g=ic(t._data),y=[],v=[d,m],_=[],b=[m,p],x=[];for(r=0;r<d;r++)x[r]=r;for(i=0;i<p;i++){if(i>0)for(r=0;r<d;r++){var w=Math.min(r,i),E=0;for(h=0;h<w;h++)E=a(E,s(g[r][h],g[h][i]));g[r][i]=l(g[r][i],E)}var T=i,A=0,S=0;for(r=i;r<d;r++){var C=g[r][i],M=n(C);u(M,A)&&(T=r,A=M,S=C)}if(i!==T&&(x[i]=[x[T],x[T]=x[i]][0],f._swapRows(i,T,g)),i<d)for(r=i+1;r<d;r++)c(g[r][i],0)||(g[r][i]=o(g[r][i],S))}for(i=0;i<p;i++)for(r=0;r<d;r++){if(0===i&&(r<p&&(_[r]=[]),y[r]=[]),r<i){r<p&&(_[r][i]=g[r][i]),i<d&&(y[r][i]=0);continue}if(r===i){r<p&&(_[r][i]=g[r][i]),i<d&&(y[r][i]=1);continue}r<p&&(_[r][i]=0),i<d&&(y[r][i]=g[r][i])}var D=new f({data:y,size:v}),P=new f({data:_,size:b}),I=[];for(r=0,m=x.length;r<m;r++)I[x[r]]=r;return{L:D,U:P,p:I,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}});t.s(["createLup",0,pA],642718);var pS=ig("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],t=>{var{typed:r,matrix:i,zeros:n,identity:a,isZero:o,equal:s,sign:l,sqrt:u,conj:c,unaryMinus:h,addScalar:f,divideScalar:d,multiplyScalar:p,subtractScalar:m,complex:g}=t;return rh(r("qr",{DenseMatrix:function(t){return v(t)},SparseMatrix:function(t){throw Error("qr not implemented for sparse matrices yet")},Array:function(t){var r=v(i(t));return{Q:r.Q.valueOf(),R:r.R.valueOf()}}}),{_denseQRimpl:y});function y(t){var r,i,g,y=t._size[0],v=t._size[1],_=a([y],"dense"),b=_._data,x=t.clone(),w=x._data,E=n([y],"");for(g=0;g<Math.min(v,y);++g){var T=w[g][g],A=h(s(T,0)?1:l(T)),S=c(A),C=0;for(r=g;r<y;r++)C=f(C,p(w[r][g],c(w[r][g])));var M=p(A,u(C));if(!o(M)){var D=m(T,M);for(E[g]=1,r=g+1;r<y;r++)E[r]=d(w[r][g],D);var P=h(c(d(D,M))),I=void 0;for(i=g;i<v;i++){for(I=0,r=g;r<y;r++)I=f(I,p(c(E[r]),w[r][i]));for(I=p(I,P),r=g;r<y;r++)w[r][i]=p(m(w[r][i],p(E[r],I)),S)}for(r=0;r<y;r++){for(I=0,i=g;i<y;i++)I=f(I,p(b[r][i],E[i]));for(I=p(I,P),i=g;i<y;++i)b[r][i]=d(m(b[r][i],p(I,c(E[i]))),S)}}}return{Q:_,R:x,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function v(t){var r=y(t),i=r.R._data;if(t._data.length>0)for(var n="Complex"===i[0][0].type?g(0):0,a=0;a<i.length;++a)for(var o=0;o<a&&o<(i[0]||[]).length;++o)i[a][o]=n;return r}});function pC(t,r,i,n,a,o,s){var l=0;for(i[s]=t;l>=0;){var u=i[s+l],c=i[n+u];-1===c?(l--,o[r++]=u):(i[n+u]=i[a+c],i[s+ ++l]=c)}return r}t.s(["createQr",0,pS],576420);var pM=ig("csAmd",["add","multiply","transpose"],t=>{var{add:r,multiply:i,transpose:n}=t;return function(t,s){if(!s||t<=0||t>3)return null;var l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T=s._size,A=T[0],S=T[1],C=0,M=Math.max(16,10*Math.sqrt(S));M=Math.min(S-2,M);var D=function(t,a,o,s,l){var u=n(a);if(1===t&&s===o)return r(a,u);if(2===t){for(var c=u._index,h=u._ptr,f=0,d=0;d<o;d++){var p=h[d];if(h[d]=f,!(h[d+1]-p>l))for(var m=h[d+1];p<m;p++)c[f++]=c[p]}h[o]=f,a=n(u)}return i(u,a)}(t,s,A,S,M);!function(t,r){for(var i=t._values,n=t._index,a=t._ptr,o=t._size[1],s=0,l=0;l<o;l++){var u=a[l];for(a[l]=s;
1u<a[l+1];u++)r(n[u],l,i?i[u]:1,null)&&(n[s]=n[u],i&&(i[s]=i[u]),s++)}a[o]=s,n.splice(s,n.length-s),i&&i.splice(s,i.length-s)}(D,o);for(var P=D._index,I=D._ptr,k=I[S],O=[],N=[],L=S+1,R=2*(S+1),F=3*(S+1),B=4*(S+1),z=5*(S+1),j=6*(S+1),U=7*(S+1),V=function(t,r,i,n,o,s,l,u,c,h,f){for(var d=0;d<t;d++)i[0+d]=r[d+1]-r[d];i[0+t]=0;for(var p=0;p<=t;p++)i[n+p]=-1,o[p]=-1,i[s+p]=-1,i[l+p]=-1,i[u+p]=1,i[c+p]=1,i[h+p]=0,i[f+p]=i[0+p];var m=a(0,0,i,c,t);return i[h+t]=-2,r[t]=-1,i[c+t]=0,m}(S,I,N,F,O,R,U,L,j,B,z),$=function(t,r,i,n,a,o,s,l,u,c,h){for(var f=0,d=0;d<t;d++){var p=i[n+d];if(0===p)i[a+d]=-2,f++,r[d]=-1,i[o+d]=0;else if(p>s)i[l+d]=0,i[a+d]=-1,f++,r[d]=-t-2,i[l+t]++;else{var m=i[u+p];-1!==m&&(c[m]=d),i[h+d]=i[u+p],i[u+p]=d}}return f}(S,I,N,z,B,j,M,L,F,O,R),G=0;$<S;){for(c=-1;G<S&&-1===(c=N[F+G]);G++);-1!==N[R+c]&&(O[N[R+c]]=-1),N[F+G]=N[R+c];var q=N[B+c],H=N[L+c];$+=H;var W=0;N[L+c]=-H;var Z=I[c],Y=0===q?Z:k,X=Y;for(h=1;h<=q+1;h++){for(h>q?(d=c,p=Z,m=N[0+c]-q):(p=I[d=P[Z++]],m=N[0+d]),f=1;f<=m;f++)(g=N[L+(l=P[p++])])<=0||(W+=g,N[L+l]=-g,P[X++]=l,-1!==N[R+l]&&(O[N[R+l]]=O[l]),-1!==O[l]?N[R+O[l]]=N[R+l]:N[F+N[z+l]]=N[R+l]);d!==c&&(I[d]=-c-2,N[j+d]=0)}for(0!==q&&(k=X),N[z+c]=W,I[c]=Y,N[0+c]=X-Y,N[B+c]=-2,V=a(V,C,N,j,S),y=Y;y<X;y++)if(!((v=N[B+(l=P[y])])<=0)){var K=V-(g=-N[L+l]);for(Z=I[l],_=I[l]+v-1;Z<=_;Z++)N[j+(d=P[Z])]>=V?N[j+d]-=g:0!==N[j+d]&&(N[j+d]=N[z+d]+K)}for(y=Y;y<X;y++){for(b=(_=I[l=P[y]])+N[B+l]-1,x=_,w=0,E=0,Z=_;Z<=b;Z++)if(0!==N[j+(d=P[Z])]){var Q=N[j+d]-V;Q>0?(E+=Q,P[x++]=d,w+=d):(I[d]=-c-2,N[j+d]=0)}N[B+l]=x-_+1;var J=x,ee=_+N[0+l];for(Z=b+1;Z<ee;Z++){var et=N[L+(u=P[Z])];et<=0||(E+=et,P[x++]=u,w+=u)}0===E?(I[l]=-c-2,W-=g=-N[L+l],H+=g,$+=g,N[L+l]=0,N[B+l]=-1):(N[z+l]=Math.min(N[z+l],E),P[x]=P[J],P[J]=P[_],P[_]=c,N[0+l]=x-_+1,w=(w<0?-w:w)%S,N[R+l]=N[U+w],N[U+w]=l,O[l]=w)}for(N[z+c]=W,V=a(V+(C=Math.max(C,W)),C,N,j,S),y=Y;y<X;y++)if(!(N[L+(l=P[y])]>=0))for(l=N[U+(w=O[l])],N[U+w]=-1;-1!==l&&-1!==N[R+l];l=N[R+l],V++){for(m=N[0+l],v=N[B+l],Z=I[l]+1;Z<=I[l]+m-1;Z++)N[j+P[Z]]=V;var er=l;for(u=N[R+l];-1!==u;){var ei=N[0+u]===m&&N[B+u]===v;for(Z=I[u]+1;ei&&Z<=I[u]+m-1;Z++)N[j+P[Z]]!==V&&(ei=0);ei?(I[u]=-l-2,N[L+l]+=N[L+u],N[L+u]=0,N[B+u]=-1,u=N[R+u],N[R+er]=u):(er=u,u=N[R+u])}}for(Z=Y,y=Y;y<X;y++)(g=-N[L+(l=P[y])])<=0||(N[L+l]=g,E=Math.min(E=N[z+l]+W-g,S-$-g),-1!==N[F+E]&&(O[N[F+E]]=l),N[R+l]=N[F+E],O[l]=-1,N[F+E]=l,G=Math.min(G,E),N[z+l]=E,P[Z++]=l);N[L+c]=H,0==(N[0+c]=Z-Y)&&(I[c]=-1,N[j+c]=0),0!==q&&(k=Z)}for(l=0;l<S;l++)I[l]=-I[l]-2;for(u=0;
1u<=S;u++)N[F+u]=-1;for(u=S;u>=0;u--)N[L+u]>0||(N[R+u]=N[F+I[u]],N[F+I[u]]=u);for(d=S;d>=0;d--)N[L+d]<=0||-1!==I[d]&&(N[R+d]=N[F+I[d]],N[F+I[d]]=d);for(c=0,l=0;l<=S;l++)-1===I[l]&&(c=pC(l,c,N,F,R,O,j));return O.splice(O.length-1,1),O};function a(t,r,i,n,a){if(t<2||t+r<0){for(var o=0;o<a;o++)0!==i[n+o]&&(i[n+o]=1);t=2}return t}function o(t,r){return t!==r}}),pD=ig("csCounts",["transpose"],t=>{var{transpose:r}=t;return function(t,i,n,a){if(!t||!i||!n)return null;var o,s,l,u,c,h,f,d=t._size,p=d[0],m=d[1],g=4*m+(a?m+p+1:0),y=[],v=2*m,_=3*m,b=4*m,x=5*m+1;for(l=0;l<g;l++)y[l]=-1;var w=[],E=r(t),T=E._index,A=E._ptr;for(l=0;l<m;l++)for(w[s=n[l]]=+(-1===y[_+s]);-1!==s&&-1===y[_+s];s=i[s])y[_+s]=l;if(a){for(l=0;l<m;l++)y[n[l]]=l;for(o=0;o<p;o++){for(l=m,h=A[o],f=A[o+1],c=h;c<f;c++)l=Math.min(l,y[T[c]]);y[x+o]=y[b+l],y[b+l]=o}}for(o=0;o<m;o++)y[0+o]=o;for(l=0;l<m;l++){for(-1!==i[s=n[l]]&&w[i[s]]--,u=a?y[b+l]:s;-1!==u;u=a?y[x+u]:-1)for(c=A[u];c<A[u+1];c++){var S=function(t,r,i,n,a,o){var s,l,u,c=0;if(t<=r||i[n+r]<=i[a+t])return -1;i[a+t]=i[n+r];var h=i[o+t];if(i[o+t]=r,-1===h)c=1,u=t;else{for(c=2,u=h;u!==i[0+u];u=i[0+u]);for(s=h;s!==u;s=l)l=i[0+s],i[0+s]=u}return{jleaf:c,q:u}}(o=T[c],s,y,_,m,v);S.jleaf>=1&&w[s]++,2===S.jleaf&&w[S.q]--}-1!==i[s]&&(y[0+s]=i[s])}for(s=0;s<m;s++)-1!==i[s]&&(w[i[s]]+=w[s]);return w}}),pP=ig("csSqr",["add","multiply","transpose"],t=>{var{add:r,multiply:i,transpose:n}=t,a=pM({add:r,multiply:i,transpose:n}),o=pD({transpose:n});return function(t,r,i){var n,s=r._ptr,l=r._size[1],u={};if(u.q=a(t,r),t&&!u.q)return null;if(i){var c=t?function(t,r){for(var i=t._values,n=t._index,a=t._ptr,o=t._size,s=t._datatype,l=o[0],u=o[1],c=[],h=[],f=0,d=0;d<u;d++){h[d]=f;for(var p=r?r[d]:d,m=a[p],g=a[p+1],y=m;y<g;y++){var v=n[y];c[f]=v,f++}}return h[u]=f,t.createSparseMatrix({values:null,index:c,ptr:h,size:[l,u],datatype:s})}(r,u.q):r;u.parent=function(t){if(!t)return null;var r,i,n=t._index,a=t._ptr,o=t._size,s=o[0],l=o[1],u=[],c=[];for(r=0;r<s;r++)c[l+r]=-1;for(var h=0;h<l;h++){u[h]=-1,c[0+h]=-1;for(var f=a[h],d=a[h+1],p=f;p<d;p++){var m=n[p];for(r=c[l+m];-1!==r&&r<h;r=i)i=c[0+r],c[0+r]=h,-1===i&&(u[r]=h);c[l+m]=h}}return u}(c);var h=function(t,r){if(!t)return null;var i,n=0,a=[],o=[],s=2*r;for(i=0;i<r;i++)o[0+i]=-1;for(i=r-1;i>=0;i--)-1!==t[i]&&(o[r+i]=o[0+t[i]],o[0+t[i]]=i);for(i=0;i<r;i++)-1===t[i]&&(n=pC(i,n,o,0,r,a,s));return a}(u.parent,l);if(u.cp=o(c,u.parent,h,1),c&&u.parent&&u.cp&&function(t,r){var i,n,a,o,s,l=t._ptr,u=t._index,c=t._size,h=c[0],f=c[1];r.pinv=[],r.leftmost=[];var d=r.parent,p=r.pinv,m=r.leftmost,g=[],y=h+f,v=h+2*f;for(n=0;n<f;n++)g[h+n]=-1,g[y+n]=-1,g[v+n]=0;for(i=0;i<h;i++)m[i]=-1;for(n=f-1;n>=0;n--)for(o=l[n],s=l[n+1],a=o;a<s;a++)m[u[a]]=n;for(i=h-1;i>=0;i--)p[i]=-1,-1!==(n=m[i])&&(0==g[v+n]++&&(g[y+n]=i),g[0+i]=g[h+n],g[h+n]=i);for(r.lnz=0,r.m2=h,n=0;n<f;n++)if(i=g[h+n],r.lnz++,i<0&&(i=r.m2++),p[i]=n,!(--v[n]<=0)){r.lnz+=g[v+n];var _=d[n];-1!==_&&(0===g[v+_]&&(g[y+_]=g[y+n]),g[0+g[y+n]]=g[h+_],g[h+_]=g[0+i],g[v+_]+=g[v+n])}for(i=0;i<h;i++)p[i]<0&&(p[i]=n++);return!0}(c,u))for(u.unz=0,n=0;n<l;n++)u.unz+=u.cp[n]}else u.unz=4*s[l]+l,u.lnz=u.unz;return u}});function pI(t,r){t[r]=-t[r]-2}var pk=ig("csSpsolve",["divideScalar","multiply","subtract"],t=>{var{divideScalar:r,multiply:i,subtract:n}=t;return function(t,a,o,s,l,u,c){var h,f,d,p,m=t._values,g=t._index,y=t._ptr,v=t._size[1],_=a._values,b=a._index,x=a._ptr,w=function(t,r,i,n,a){var o,s,l,u=t._ptr,c=t._size,h=r._index,f=r._ptr,d=c[1],p=d;for(s=f[i],l=f[i+1],o=s;o<l;o++){var m=h[o];u[m]<0||(p=function(t,r,i,n,a){var o,s,l,u=r._index,c=r._ptr,h=r._size[1],f=0;for(n[0]=t;f>=0;){t=n[f];var d,p,m=a?a[t]:t;c[t]<0||(pI(c,t),n[h+f]=m<0?0:(d=c[m])<0?-d-2:d);var g=1;for(s=n[h+f],l=m<0?0:(p=c[m+1])<0?-p-2:p;s<l;s++)if(!(c[o=u[s]]<0)){n[h+f]=s,n[++f]=o,g=0;break}g&&(f--,n[--i]=t)}return i}(m,t,p,n,a))}for(o=p;o<d;o++)pI(u,n[o]);return p}(t,a,o,s,u);for(h=w;h<v;h++)l[s[h]]=0;for(f=x[o],d=x[o+1],h=f;h<d;h++)l[b[h]]=_[h];for(var E=w;E<v;E++){var T=s[E],A=u?u[T]:T;if(!(A<0))for(f=y[A],d=y[A+1],l[T]=r(l[T],m[c?f:d-1]),h=c?f+1:f,p=c?d:d-1;h<p;h++){var S=g[h];l[S]=n(l[S],i(m[h],l[T]))}}return w}}),pO=ig("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],t=>
1{var{abs:r,divideScalar:i,multiply:n,subtract:a,larger:o,largerEq:s,SparseMatrix:l}=t,u=pk({divideScalar:i,multiply:n,subtract:a});return function(t,a,c){if(!t)return null;var h,f,d,p=t._size[1],m=100,g=100;a&&(h=a.q,m=a.lnz||m,g=a.unz||g);var y=[],v=[],_=[],b=new l({values:y,index:v,ptr:_,size:[p,p]}),x=[],w=[],E=[],T=new l({values:x,index:w,ptr:E,size:[p,p]}),A=[],S=[],C=[];for(f=0;f<p;f++)S[f]=0,A[f]=-1,_[f+1]=0;m=0,g=0;for(var M=0;M<p;M++){_[M]=m,E[M]=g;var D=h?h[M]:M,P=u(b,t,D,C,S,A,1),I=-1,k=-1;for(d=P;d<p;d++)if(A[f=C[d]]<0){var O=r(S[f]);o(O,k)&&(k=O,I=f)}else w[g]=A[f],x[g++]=S[f];if(-1===I||k<=0)return null;A[D]<0&&s(r(S[D]),n(k,c))&&(I=D);var N=S[I];for(w[g]=M,x[g++]=N,A[I]=M,v[m]=I,y[m++]=1,d=P;d<p;d++)A[f=C[d]]<0&&(v[m]=f,y[m++]=i(S[f],N)),S[f]=0}for(_[p]=m,E[p]=g,d=0;d<m;d++)v[d]=A[v[d]];return y.splice(m,y.length-m),v.splice(m,v.length-m),x.splice(g,x.length-g),w.splice(g,w.length-g),{L:b,U:T,pinv:A}}}),pN=ig("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],t=>{var{typed:r,abs:i,add:n,multiply:a,transpose:o,divideScalar:s,subtract:l,larger:u,largerEq:c,SparseMatrix:h}=t,f=pP({add:n,multiply:a,transpose:o}),d=pO({abs:i,divideScalar:s,multiply:a,subtract:l,larger:u,largerEq:c,SparseMatrix:h});return r("slu",{"SparseMatrix, number, number":function(t,r,i){if(!iS(r)||r<0||r>3)throw Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(i<0||i>1)throw Error("Partial pivoting threshold must be a number from 0 to 1");var n=f(r,t,!1),a=d(t,n,i);return{L:a.L,U:a.U,p:a.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})});function pL(t,r){var i,n=r.length,a=[];if(t)for(i=0;i<n;i++)a[t[i]]=r[i];else for(i=0;i<n;i++)a[i]=r[i];return a}t.s(["createSlu",0,pN],212649);var pR="lusolve",pF=ig(pR,["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],t=>{var{typed:r,matrix:i,lup:n,slu:a,usolve:o,lsolve:s,DenseMatrix:l}=t,u=ht({DenseMatrix:l});return r(pR,{"Array, Array | Matrix":function(t,r){var a=n(t=i(t));return h(a.L,a.U,a.p,null,r).valueOf()},"DenseMatrix, Array | Matrix":function(t,r){var i=n(t);return h(i.L,i.U,i.p,null,r)},"SparseMatrix, Array | Matrix":function(t,r){var i=n(t);return h(i.L,i.U,i.p,null,r)},"SparseMatrix, Array | Matrix, number, number":function(t,r,i,n){var o=a(t,i,n);return h(o.L,o.U,o.p,o.q,r)},"Object, Array | Matrix":function(t,r){return h(t.L,t.U,t.p,t.q,r)}});function c(t){if(rL(t))return t;if(rN(t))return i(t);throw TypeError("Invalid Matrix LU decomposition")}function h(t,r,i,n,a){t=c(t),r=c(r),i&&((a=u(t,a,!0))._data=pL(i,a._data));var l=o(r,s(t,a));return n&&(l._data=pL(n,l._data)),l}});t.s(["createLusolve",0,pF],330312);var pB="polynomialRoot",pz=ig(pB,["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],t=>{var{typed:r,isZero:i,equalScalar:n,add:a,subtract:o,multiply:s,divide:l,sqrt:u,unaryMinus:c,cbrt:h,typeOf:f,im:d,re:p}=t;
1return r(pB,{"number|Complex, ...number|Complex":(t,r)=>{for(var m=[t,...r];m.length>0&&i(m[m.length-1]);)m.pop();if(m.length<2)throw RangeError("Polynomial [".concat(t,", ").concat(r,"] must have a non-zero non-constant coefficient"));switch(m.length){case 2:return[c(l(m[0],m[1]))];case 3:var[g,y,v]=m,_=s(2,v),b=s(y,y),x=s(4,v,g);if(n(b,x))return[l(c(y),_)];var w=u(o(b,x));return[l(o(w,y),_),l(o(c(w),y),_)];case 4:var[E,T,A,S]=m,C=c(s(3,S)),M=s(A,A),D=s(3,S,T),P=a(s(2,A,A,A),s(27,S,S,E)),I=s(9,S,A,T);if(n(M,D)&&n(P,I))return[l(A,C)];var k=o(M,D),O=o(P,I);if(n(a(s(18,S,A,T,E),s(A,A,T,T)),a(s(4,A,A,A,E),s(4,S,T,T,T),s(27,S,S,E,E))))return[l(o(s(4,S,A,T),a(s(9,S,S,E),s(A,A,A))),s(S,k)),l(o(s(9,S,E),s(A,T)),s(2,k))];return h(n(M,D)?O:l(a(O,u(o(s(O,O),s(4,k,k,k)))),2),!0).toArray().map(t=>l(a(A,t,l(k,t)),C)).map(t=>"Complex"===f(t)&&n(p(t),p(t)+d(t))?p(t):t);default:throw RangeError("only implemented for cubic or lower-order polynomials, not ".concat(m))}}})});t.s(["createPolynomialRoot",0,pz],666299);var pj=ig("Help",["evaluate"],t=>{var{evaluate:r}=t;function i(t){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(!t)throw Error('Argument "doc" missing');this.doc=t}return i.prototype.type="Help",i.prototype.isHelp=!0,i.prototype.toString=function(){var t=this.doc||{},i="\n";if(t.name&&(i+="Name: "+t.name+"\n\n"),t.category&&(i+="Category: "+t.category+"\n\n"),t.description&&(i+="Description:\n "+t.description+"\n\n"),t.syntax&&(i+="Syntax:\n "+t.syntax.join("\n ")+"\n\n"),t.examples){i+="Examples:\n";for(var n=!1,a=r("config()"),o={config:t=>(n=!0,r("config(newConfig)",{newConfig:t}))},s=0;s<t.examples.length;s++){var l=t.examples[s];i+=" "+l+"\n";var u=void 0;try{u=r(l,o)}catch(t){u=t}void 0===u||r$(u)||(i+=" "+a0(u,{precision:14})+"\n")}i+="\n",n&&r("config(originalConfig)",{originalConfig:a})}return t.mayThrow&&t.mayThrow.length&&(i+="Throws: "+t.mayThrow.join(", ")+"\n\n"),t.seealso&&t.seealso.length&&(i+="See also: "+t.seealso.join(", ")+"\n"),i},i.prototype.toJSON=function(){var t=ic(this.doc);return t.mathjs="Help",t},i.fromJSON=function(t){var r={};return Object.keys(t).filter(t=>"mathjs"!==t).forEach(i=>{r[i]=t[i]}),new i(r)},i.prototype.valueOf=i.prototype.toString,i},{isClass:!0});t.s(["createHelpClass",0,pj],558760);var pU=ig("Chain",["?on","math","typed"],t=>{var{on:r,math:i,typed:n}=t;function a(t){if(!(this instanceof a))throw SyntaxError("Constructor must be called with the new operator");il(t)?this.value=t.value:this.value=t}function o(t,r){ip(a.prototype,t,function(){var t=r();if("function"==typeof t)return s(t)})}function s(t){return function(){if(0==arguments.length)return new a(t(this.value));for(var r=[this.value],i=0;i<arguments.length;i++)r[i+1]=arguments[i];if(n.isTypedFunction(t)){var o=n.resolve(t,r);if(1===o.params.length)throw Error("chain function "+t.name+" cannot match rest parameter between chain value and additional arguments.");return new a(o.implementation.apply(t,r))}return new a(t.apply(t,r))}}a.prototype.type="Chain",a.prototype.isChain=!0,a.prototype.done=function(){return this.value},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return a0(this.value)},a.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},a.fromJSON=function(t){return new a(t.value)},a.createProxy=function(t,r){if("string"==typeof t)"function"==typeof r&&(a.prototype[t]=s(r));else{var i=function(r){im(t,r)&&void 0===l[r]&&o(r,()=>t[r])};for(var n in t)i(n)}};var l={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return a.createProxy(i),r&&r("import",function(t,r,i){i||o(t,r)}),a},{isClass:!0});t.s(["createChainClass",0,pU],616672);var pV={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},p$={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]},pG={bignumber:{name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","bigint","complex","fraction","index","matrix","string","unit"]},bigint:{name:"bigint",category:"Construction",syntax:["bigint(x)"],description:"Create a bigint, an integer with an arbitrary number of digits, from a number or string.",examples:["123123123123123123 # a large number will lose digits",'bigint("123123123123123123")','bignumber(["1", "3", "5"])'],seealso:["boolean","bignumber","number","complex","fraction","index","matrix","string","unit"]},boolean:{name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},complex:{name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},createUnit:{name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},fraction:{name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,de
1n)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},index:{name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix","number","range","string","unit"]},matrix:{name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},number:{name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","bigint","boolean","complex","fraction","index","matrix","string","unit"]},sparse:{name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},splitUnit:{name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},string:{name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},unit:{name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},e:pV,E:pV,false:{name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},i:{name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},Infinity:{name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},LN2:{name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LN10:{name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LOG2E:{name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},LOG10E:{name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},NaN:{name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},null:{name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]}
1,pi:p$,PI:p$,phi:{name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},SQRT1_2:{name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},SQRT2:{name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tau:{name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},true:{name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},version:{name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]}
1,coulomb:{description:"Coulomb's constant. Deprecated in favor of coulombConstant",examples:["coulombConstant"]},coulombConstant:{description:"Coulomb's constant",examples:["coulombConstant"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Bohr magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Bohr radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:{name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},lsolve:{name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},lsolveAll:{name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},lup:{name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2,
11], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolve:{name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},leafCount:{name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},polynomialRoot:{name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},resolve:{name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},simplify:{name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},simplifyConstant:{name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},simplifyCore:{name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},symbolicEqual:{name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},rationalize:{name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},slu:{name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},usolve:{name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},usolveAll:{name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},qr:{name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},abs:{name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},add:{name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},cbrt:{name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cub
1ic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceil:{name:"ceil",category:"Arithmetic",syntax:["ceil(x)","ceil(x, n)","ceil(unit, valuelessUnit)","ceil(unit, n, valuelessUnit)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)","ceil(3.241cm, cm)","ceil(3.241cm, 2, cm)"],seealso:["floor","fix","round"]},cube:{name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},divide:{name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},dotDivide:{name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},dotMultiply:{name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},dotPow:{name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},exp:{name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},expm:{name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},expm1:{name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},fix:{name:"fix",category:"Arithmetic",syntax:["fix(x)","fix(x, n)","fix(unit, valuelessUnit)","fix(unit, n, valuelessUnit)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)","fix(3.241cm, cm)","fix(3.241cm, 2, cm)"],seealso:["ceil","floor","round"]},floor:{name:"floor",category:"Arithmetic",syntax:["floor(x)","floor(x, n)","floor(unit, valuelessUnit)","floor(unit, n, valuelessUnit)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)","floor(3.241cm, cm)","floor(3.241cm, 2, cm)"],seealso:["ceil","fix","round"]},gcd:{name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},hypot:{name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenuse of a list with values.",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},lcm:{name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},log:{name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},log2:{name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},log1p:{name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},log10:{name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},mod:{name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divi
1de"]},multiply:{name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},norm:{name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},nthRoot:{name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},nthRoots:{name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},pow:{name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]},sign:{name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>0, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},sqrt:{name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]}
1,sqrtm:{name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]},square:{name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]},subtract:{name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]},unaryMinus:{name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]},unaryPlus:{name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},xgcd:{name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]}
1,invmod:{name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ⣠1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]},num:{name:"num",category:"Fraction",syntax:["num(x)"],description:"Get the numerator of a fraction.",examples:["num(fraction(2, 3))","num(fraction(5, 8))"],seealso:["den","fraction"]},den:{name:"den",category:"Fraction",syntax:["den(x)"],description:"Get the denominator of a fraction.",examples:["den(fraction(2, 3))","den(fraction(5, 8))"],seealso:["num","fraction"]},bitAnd:{name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitNot:{name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitOr:{name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]},bitXor:{name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]},leftShift:{name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]},rightArithShift:{name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]},rightLogShift:{name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]},bellNumbers:{name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]},catalan:{name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]},composition:{name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]},stirlingS2:{name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2
1(n, k)"],description:"The Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers","bernoulli"]},config:{name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]},import:{name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]},typed:{name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]},arg:{name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]},conj:{name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]},re:{name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]},im:{name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]},evaluate:{name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:["parser","parse","compile"]},help:{name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},parse:{name:"parse",category:"Expression",syntax:["parse(expr)","parse(expr, options)","parse([expr1, expr2, expr3, ...])","parse([expr1, expr2, expr3, ...], options)"],description:"Parse an expression. Returns a node tree, which can be evaluated by invoking node.evaluate() or transformed into a functional object via node.compile().",examples:['node1 = parse("sqrt(3^2 + 4^2)")',"node1.evaluate()","code1 = node1.compile()","code1.evaluate()","scope = {a: 3, b: 4}",'node2 = parse("a * b")',"node2.evaluate(scope)","code2 = node2.compile()","code2.evaluate(scope)"],seealso:["parser","evaluate","compile"]},parser:{name:"parser",category:"Expression",syntax:["parser()"],description:"Create a parser object that keeps a context of variables and their values, allowing the evaluation of expressions in that context.",examples:["myParser = parser()",'myParser.evaluate("sqrt(3^2 + 4^2)")','myParser.set("x", 3)','myParser.evaluate("y = x + 3")','myParser.evaluate(["y = x + 3", "y = y + 1"])','myParser.get("y")'],seealso:["evaluate","parse","compile"]},compile:{name:"compile",category:"Expression",syntax:["compile(expr) ","compile([expr1, expr2, expr3, ...])"],description:"Parse and compile an expression. Returns a an object with a function evaluate([scope]) to evaluate the compiled expression.",examples:['code1 = compile("sqrt(3^2 + 4^2)")',"code1.evaluate() ",'code2 = compile("a * b")',"code2.evaluate({a: 3, b: 4})"],seealso:["parser","parse","evaluate"]},distance:{name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]},intersect:{name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]},and:{name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]},not:{name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]},nullish:{name:"nullish",category:"Logical",syntax:["x ?? y","nullish(x, y)"],description:"Nullish coalescing operator. Returns the right-hand operand when the left-hand operand is null or undefined, and otherwise returns the left-hand operand.",examples:["null ?? 42","undefined ?? 42","0 ?? 42","false ?? 42","null ?? undefined ?? 42"],seealso:["and","or","not"]},or:{name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]},xor:{name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]},mapSlices:{name:"mapSlices",category:"Matrix",syntax:["mapSlices(A, dim, callback)"],description:"Generate a matrix one dimension less than A by applying c
1allback to each slice of A along dimension dim.",examples:["A = [[1, 2], [3, 4]]","mapSlices(A, 1, sum)","mapSlices(A, 2, prod)"],seealso:["map","forEach"]},concat:{name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},count:{name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]},cross:{name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]},column:{name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]},ctranspose:{name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","one
1s","range","size","squeeze","subset","trace","zeros"]},det:{name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diag:{name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diff:{name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicate the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},dot:{name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},getMatrixDataType:{name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},identity:{name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},filter:{name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},flatten:{name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]}
1,forEach:{name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]},inv:{name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},pinv:{name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the MooreâPenrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},eigs:{name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]},kron:{name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the Kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},matrixFromFunction:{name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn
1)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},matrixFromRows:{name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},matrixFromColumns:{name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},map:{name:"map",category:"Matrix",syntax:["map(x, callback)","map(x, y, ..., callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.",examples:["map([1, 2, 3], square)","map([1, 2], [3, 4], f(a,b) = a + b)"],seealso:["filter","forEach"]},ones:{name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},partitionSelect:{name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]},range:{name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","one
1s","size","squeeze","subset","trace","transpose","zeros"]},resize:{name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},reshape:{name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]},rotate:{name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]},rotationMatrix:{name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]},row:{name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]},size:{name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","one
1s","range","squeeze","subset","trace","transpose","zeros"]},sort:{name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},squeeze:{name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},subset:{name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","one
1s","range","size","squeeze","trace","transpose","zeros"]},trace:{name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},transpose:{name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},zeros:{name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},fft:{name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ifft:{name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},sylvester:{name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},schur:{name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},lyap:{name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},solveODE:{name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},bernoulli:{name:"bernoulli",category:"Probability",syntax:["bernoulli(n)"],description:"The nth Bernoulli number",examples:["bernoulli(4)","bernoulli(fraction(12))"],seealso:["combinations","gamma","stirlingS2"]},combinations:{name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},combinationsWithRep:{name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},factorial:{name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},gamma:{name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},kldivergence:{name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},lgamma:{name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},multinomial:{name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},permutations:{name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},pickRandom:{name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},random:{name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},randomInt:{name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},compare:{name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},compareNatural:{name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},compareText:{name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},deepEqual:{name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},equal:{name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},equalText:{name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},larger:{name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not. Comparing a value with NaN returns false.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]}
1,largerEq:{name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},smaller:{name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not. Comparing a value with NaN returns false.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},smallerEq:{name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},unequal:{name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},setCartesian:{name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},setDifference:{name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},setDistinct:{name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},setIntersect:{name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},setIsSubset:{name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},setMultiplicity:{name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},setPowerset:{name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},setSize:{name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},setSymDifference:{name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},setUnion:{name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},zpk2tf:{name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},freqz:{name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},erf:{name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},zeta:{name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},cumsum:{name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},mad:{name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},max:{name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},mean:{name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},median:{name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},min:{name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},mode:{name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},prod:{name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},quantileSeq:{name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},std:{name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]},sum:{name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","variance"]},variance:{name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]}
1,corr:{name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},acos:{name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},acosh:{name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acot:{name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},acoth:{name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},acsc:{name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},acsch:{name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},asec:{name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},asech:{name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asin:{name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},asinh:{name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},atan:{name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},atanh:{name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},atan2:{name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},cos:{name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},cosh:{name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cot:{name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},coth:{name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},csc:{name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},csch:{name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]}
1,sec:{name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},sech:{name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},sin:{name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},sinh:{name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tan:{name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},tanh:{name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},to:{name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},toBest:{name:"toBest",category:"Units",syntax:["toBest(x)","toBest(x, unitList)","toBest(x, unitList, options)"],description:"Converts to the most appropriate display unit.",examples:['toBest(unit(5000, "m"))','toBest(unit(3500000, "W"))','toBest(unit(0.000000123, "A"))','toBest(unit(10, "m"), "cm")','toBest(unit(10, "m"), "mm,km", {offset: 1.5})'],seealso:[]},clone:{name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables, and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},format:{name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},bin:{name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},oct:{name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},hex:{name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},isNaN:{name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero","isFinite","isBounded"]},isBounded:{name:"isBounded",category:"Utils",syntax:["isBounded(x)"],description:"Test whether a value or its entries are bounded.",examples:["isBounded(Infinity)","isBounded(bigint(3))","isBounded([3, -Infinity, -3])"],seealso:["isFinite","isNumeric","isNaN","isNegative","isPositive"]},isFinite:{name:"isFinite",category:"Utils",syntax:["isFinite(x)"],description:"Test whether a value is finite, elementwise on collections.",examples:["isFinite(Infinity)","isFinite(bigint(3))","isFinite([3, -Infinity, -3])"],seealso:["isBounded","isNumeric","isNaN","isNegative","isPositive"]},isInteger:{name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isNegative:{name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},isNumeric:{name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue","isFinite","isBounded"]},hasNumericValue:{name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},isPositive:{name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]}
1,isPrime:{name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isZero:{name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},print:{name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},typeOf:{name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},numeric:{name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "bigint")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","bigint","fraction","bignumber","string","format"]}},pq="help",pH=ig(pq,["typed","mathWithTransform","Help"],t=>{var{typed:r,mathWithTransform:i,Help:n}=t;return r(pq,{any:function(t){var r,a=t;if("string"!=typeof t){for(r in i)if(im(i,r)&&t===i[r]){a=r;break}}var o=rg(pG,a);if(!o)throw Error('No documentation found on "'+("function"==typeof a?a.name:a)+'"');return new n(o)}})});t.s(["createHelp",0,pH],544717);var pW="chain",pZ=ig(pW,["typed","Chain"],t=>{var{typed:r,Chain:i}=t;return r(pW,{"":function(){return new i},any:function(t){return new i(t)}})});t.s(["createChain",0,pZ],980477);var pY=ig("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],t=>{var{typed:r,matrix:i,subtractScalar:n,multiply:a,divideScalar:o,isZero:s,unaryMinus:l}=t;return r("det",{any:function(t){return ic(t)},"Array | Matrix":function(t){var r;switch((r=rL(t)?t.size():Array.isArray(t)?(t=i(t)).size():[]).length){case 0:return ic(t);case 1:if(1===r[0])return ic(t.valueOf()[0]);if(0===r[0])return 1;throw RangeError("Matrix must be square (size: "+a0(r)+")");case 2:var u=r[0],c=r[1];if(u===c)return function(t,r){if(1===r)return ic(t[0][0]);if(2===r)return n(a(t[0][0],t[1][1]),a(t[1][0],t[0][1]));for(var i=!1,u=Array(r).fill(0).map((t,r)=>r),c=0;c<r;c++){var h=u[c];if(s(t[h][c])){var f=void 0;for(f=c+1;f<r;f++)if(!s(t[u[f]][c])){h=u[f],u[f]=u[c],u[c]=h,i=!i;break}if(f===r)return t[h][c]}for(var d=t[h][c],p=0===c?1:t[u[c-1]][c-1],m=c+1;m<r;m++)for(var g=u[m],y=c+1;y<r;y++)t[g][y]=o(n(a(t[g][y],d),a(t[g][c],t[h][y])),p)}var v=t[u[r-1]][r-1];return i?l(v):v}(t.clone().valueOf(),u);if(0===c)return 1;throw RangeError("Matrix must be square (size: "+a0(r)+")");default:throw RangeError("Matrix must be two dimensional (size: "+a0(r)+")")}}})});t.s(["createDet",0,pY],333834);var pX=ig("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],t=>{var{typed:r,matrix:i,divideScalar:n,addScalar:a,multiply:o,unaryMinus:s,det:l,identity:u,abs:c}=t;return r("inv",{"Array | Matrix":function(t){var r=rL(t)?t.size():a6(t);switch(r.length){case 1:if(1===r[0])if(rL(t))return i([n(1,t.valueOf()[0])]);else return[n(1,t[0])];throw RangeError("Matrix must be square (size: "+a0(r)+")");case 2:var a=r[0],o=r[1];if(a===o)if(rL(t))return i(h(t.valueOf(),a,o),t.storage());else return h(t,a,o);throw RangeError("Matrix must be square (size: "+a0(r)+")");default:throw RangeError("Matrix must be two dimensional (size: "+a0(r)+")")}},any:function(t){return n(1,t)}});function h(t,r,i){if(1===r){if(0===(p=t[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,p)]]}if(2===r){var h,f,d,p,m,g=l(t);if(0===g)throw Error("Cannot calculate inverse, determinant is zero");return[[n(t[1][1],g),n(s(t[0][1]),g)],[n(s(t[1][0]),g),n(t[0][0],g)]]}var y=t.concat();for(h=0;h<r;h++)y[h]=y[h].concat();for(var v=u(r).valueOf(),_=0;_<i;_++){var b=c(y[_][_]),x=_;for(h=_+1;h<r;)c(y[h][_])>b&&(b=c(y[h][_]),x=h),h++;if(0===b)throw Error("Cannot calculate inverse, determinant is zero");(h=x)!==_&&(m=y[_],y[_]=y[h],y[h]=m,m=v[_],v[_]=v[h],v[h]=m);var w=y[_],E=v[_];for(h=0;h<r;h++){var T=y[h],A=v[h];if(h!==_){if(0!==T[_]){for(d=n(s(T[_]),w[_]),f=_;f<i;f++)T[f]=a(T[f],o(d,w[f]));for(f=0;f<i;f++)A[f]=a(A[f],o(d,E[f]))}}else{for(d=w[_],f=_;f<i;f++)T[f]=n(T[f],d);for(f=0;f<i;f++)A[f]=n(A[f],d)}}}return v}});t.s(["createInv",0,pX],747711);var pK="pinv",pQ=ig(pK,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],t=>{var{typed:r,matrix:i,inv:n,deepEqual:a,equal:o,dotDivide:s,dot:l,ctranspose:u,divideScalar:c,multiply:h,add:f,Complex:d}=t;return r(pK,{"Array | Matrix":function(t){var r=rL(t)?t.size():a6(t);switch(r.length){case 1:if(g(t))return u(t);if(1===r[0])return n(t);return s(u(t),l(t,t));case 2:if(g(t))return u(t);var a=r[0],o=r[1];if(a===o)try{return n(t)}catch(t){if(t instanceof Error&&t.message.match(/Cannot calculate inverse, determinant is zero/));else throw t}if(rL(t))return i(p(t.valueOf(),a,o),t.storage());return p(t,a,o);
1default:throw RangeError("Matrix must be two dimensional (size: "+a0(r)+")")}},any:function(t){return o(t,0)?ic(t):c(1,t)}});function p(t,r,i){var a,o,c,{C:d,F:p}=(c=function(t,r,i){for(var n=ic(t),a=0,o=0;o<r&&!(i<=a);o++){for(var l=o;m(n[l][a]);)if(r===++l&&(l=o,i===++a))return n;[n[l],n[o]]=[n[o],n[l]];for(var u=n[o][a],c=0;c<i;c++)n[o][c]=s(n[o][c],u);for(var d=0;d<r;d++)if(d!==o){u=n[d][a];for(var p=0;p<i;p++)n[d][p]=f(n[d][p],h(-1,h(u,n[o][p])))}a++}return n}(a=t,o=r,i),{C:a.map((t,r)=>t.filter((t,r)=>r<o&&!m(l(c[r],c[r])))),F:c.filter((t,r)=>!m(l(c[r],c[r])))}),g=h(n(h(u(d),d)),u(d)),y=h(u(p),n(h(p,u(p))));return h(y,g)}function m(t){return o(f(t,d(1,1)),f(0,d(1,1)))}function g(t){return a(f(t,d(1,1)),f(h(t,0),d(1,1)))}});t.s(["createPinv",0,pQ],317889);var pJ=ig("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],t=>{var{config:r,typed:i,matrix:n,addScalar:a,subtract:o,equal:s,abs:l,atan:u,cos:c,sin:h,multiplyScalar:f,divideScalar:d,inv:p,bignumber:m,multiply:g,add:y,larger:v,column:_,flatten:b,number:x,complex:w,sqrt:E,diag:T,size:A,reshape:S,qr:C,usolve:M,usolveAll:D,im:P,re:I,smaller:k,matrixFromColumns:O,dot:N}=t,L=function(t){var{config:r,addScalar:i,subtract:n,abs:a,atan:o,cos:s,sin:l,multiplyScalar:u,inv:c,bignumber:h,multiply:f,add:d}=t;function p(t){for(var r=t.length,i=0,n=[0,1],a=0;a<r;a++)for(var o=a+1;o<r;o++)Math.abs(i)<Math.abs(t[a][o])&&(i=Math.abs(t[a][o]),n=[a,o]);return[n,i]}function m(t){for(var r=t.length,i=0,n=[0,1],o=0;o<r;o++)for(var s=o+1;s<r;s++)a(i)<a(t[o][s])&&(i=a(t[o][s]),n=[o,s]);return[n,i]}function g(t,r,i){var n,o=t.length,s=Array(o);if(i){n=Array(o);for(var l=0;l<o;l++)n[l]=Array(o)}for(var u=0;u<o;u++){for(var c=0,h=t[0],f=0;f<t.length;f++)a(t[f])<a(h)&&(h=t[c=f]);if(s[u]=t.splice(c,1)[0],i)for(var d=0;d<o;d++)n[u][d]=r[d][c],r[d].splice(c,1)}if(!i)return{values:s};var p=n.map((t,r)=>({value:s[r],vector:t}));return{values:s,eigenvectors:p}}return function(t,y){var v=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.relTol,_=arguments.length>3?arguments[3]:void 0,b=arguments.length>4?arguments[4]:void 0;if("number"===_)return function(t,i,n){var a,o,s=t.length,l=Math.abs(i/s);if(n){o=Array(s);for(var u=0;u<s;u++)o[u]=Array(s).fill(0),o[u][u]=1}for(var c=p(t);Math.abs(c[1])>=Math.abs(l);){var h,f,d,m=c[0][0],y=c[0][1];h=t[m][m],f=t[y][y],d=t[m][y],t=function(t,r,i,n){for(var a=t.length,o=Math.cos(r),s=Math.sin(r),l=o*o,u=s*s,c=Array(a).fill(0),h=Array(a).fill(0),f=l*t[i][i]-2*o*s*t[i][n]+u*t[n][n],d=u*t[i][i]+2*o*s*t[i][n]+l*t[n][n],p=0;p<a;p++)c[p]=o*t[i][p]-s*t[n][p],h[p]=s*t[i][p]+o*t[n][p];t[i][i]=f,t[n][n]=d,t[i][n]=0,t[n][i]=0;for(var m=0;m<a;m++)m!==i&&m!==n&&(t[i][m]=c[m],t[m][i]=c[m],t[n][m]=h[m],t[m][n]=h[m]);return t}(t,a=Math.abs(f-h)<=r.relTol?Math.PI/4:.5*Math.atan(2*d/(f-h)),m,y),n&&(o=function(t,r,i,n){for(var a=t.length,o=Math.cos(r),s=Math.sin(r),l=Array(a).fill(0),u=Array(a).fill(0),c=0;c<a;c++)l[c]=o*t[c][i]-s*t[c][n],u[c]=s*t[c][i]+o*t[c][n];for(var h=0;h<a;h++)t[h][i]=l[h],t[h][n]=u[h];return t}(o,a,m,y)),c=p(t)}for(var v=Array(s).fill(0),_=0;_<s;_++)v[_]=t[_][_];return g(ic(v),o,n)}(t,v,b);if("BigNumber"===_)return function(t,p,y){var v,_,b=t.length,x=a(p/b);if(y){_=Array(b);for(var w=0;w<b;w++)_[w]=Array(b).fill(0),_[w][w]=1}for(var E=m(t);a(E[1])>=a(x);){var T=E[0][0],A=E[0][1];v=function(t,i,s){var l=n(i,t);return a(l)<=r.relTol?h(-1).acos().div(4):u(.5,o(f(2,s,c(l))))}(t[T][T],t[A][A],t[T][A]),t=function(t,r,a,o){for(var c=t.length,p=h(s(r)),m=h(l(r)),g=u(p,p),y=u(m,m),v=Array(c).fill(h(0)),_=Array(c).fill(h(0)),b=f(h(2),p,m,t[a][o]),x=i(n(u(g,t[a][a]),b),u(y,t[o][o])),w=d(u(y,t[a][a]),b,u
1(g,t[o][o])),E=0;E<c;E++)v[E]=n(u(p,t[a][E]),u(m,t[o][E])),_[E]=i(u(m,t[a][E]),u(p,t[o][E]));t[a][a]=x,t[o][o]=w,t[a][o]=h(0),t[o][a]=h(0);for(var T=0;T<c;T++)T!==a&&T!==o&&(t[a][T]=v[T],t[T][a]=v[T],t[o][T]=_[T],t[T][o]=_[T]);return t}(t,v,T,A),y&&(_=function(t,r,a,o){for(var c=t.length,f=s(r),d=l(r),p=Array(c).fill(h(0)),m=Array(c).fill(h(0)),g=0;g<c;g++)p[g]=n(u(f,t[g][a]),u(d,t[g][o])),m[g]=i(u(d,t[g][a]),u(f,t[g][o]));for(var y=0;y<c;y++)t[y][a]=p[y],t[y][o]=m[y];return t}(_,v,T,A)),E=m(t)}for(var S=Array(b).fill(0),C=0;C<b;C++)S[C]=t[C][C];return g(ic(S),_,y)}(t,v,b);throw TypeError("Unsupported data type: "+_)}}({config:r,addScalar:a,subtract:o,column:_,flatten:b,equal:s,abs:l,atan:u,cos:c,sin:h,multiplyScalar:f,inv:p,bignumber:m,complex:w,multiply:g,add:y}),R=function(t){var{addScalar:r,subtract:i,flatten:n,multiply:a,multiplyScalar:o,divideScalar:s,sqrt:l,abs:u,bignumber:c,diag:h,size:f,reshape:d,inv:p,qr:m,usolve:g,usolveAll:y,equal:v,complex:_,larger:b,smaller:x,matrixFromColumns:w,dot:E}=t;function T(t,r){for(var i=0;i<t.length;i++)t[i].push(...Array(r-t[i].length).fill(0));for(var n=t.length;n<r;n++)t.push(Array(r).fill(0)),t[n][n]=1;return t}function A(t,r){var n=f(t);for(var o of r)t=i(t,a(s(E(o=d(o,n),t),E(o,o)),o));return t}function S(t){return u(l(E(t,t)))}function C(t,r){return a(s("BigNumber"===r?c(1):"Complex"===r?_(1):1,S(t)),t)}return function(t,f,d,w){var E=!(arguments.length>4)||void 0===arguments[4]||arguments[4],M=function(t,i,n,a){var l,f="BigNumber"===n,d=f?c(0):0,p=f?c(1):"Complex"===n?_(1):1,m=f?c(1):1,g=f?c(10):2,y=o(g,g);a&&(l=Array(i).fill(p));for(var w=!1;!w;){w=!0;for(var E=0;E<i;E++){for(var T=d,A=d,S=0;S<i;S++)E!==S&&(T=r(T,u(t[S][E])),A=r(A,u(t[E][S])));if(!v(T,0)&&!v(A,0)){for(var C=m,M=T,D=s(A,g),P=o(A,g);x(M,D);)M=o(M,y),C=o(C,g);for(;b(M,P);)M=s(M,y),C=s(C,g);if(x(s(r(M,A),C),o(r(T,A),.95))){w=!1;for(var I=s(1,C),k=0;k<i;k++)E!==k&&(t[E][k]=o(t[E][k],I),t[k][E]=o(t[k][E],C));a&&(l[E]=o(l[E],I))}}}}return a?h(l):null}(t,f,w,E);!function(t,n,a,l,h,f){var d="BigNumber"===l,p=d?c(0):"Complex"===l?_(0):0;d&&(a=c(a));for(var m=0;m<n-2;m++){for(var g=0,y=p,v=m+1;v<n;v++){var b=t[v][m];x(u(y),u(b))&&(y=b,g=v)}if(!x(u(y),a)){if(g!==m+1){var w=t[g];t[g]=t[m+1],t[m+1]=w;for(var E=0;E<n;E++){var T=t[E][g];t[E][g]=t[E][m+1],t[E][m+1]=T}if(h){var A=f[g];f[g]=f[m+1],f[m+1]=A}}for(var S=m+2;S<n;S++){var C=s(t[S][m],y);if(0!==C){for(var M=0;M<n;M++)t[S][M]=i(t[S][M],o(C,t[m+1][M]));for(var D=0;D<n;D++)t[D][m+1]=r(t[D][m+1],o(C,t[D][S]));if(h)for(var P=0;P<n;P++)f[S][P]=i(f[S][P],o(C,f[m+1][P]))}}}}}(t,f,d,w,E,M);var{values:D,C:P}=function(t,n,s,f,d){var p="BigNumber"===f,g="Complex"===f,y=p?c(1):g?_(1):1;p&&(s=c(s));for(var v=ic(t),w=[],E=n,A=[],S=d?h(Array(n).fill(y)):void 0,C=d?h(Array(E).fill(y)):void 0,M=0;M<=100;){M+=1;for(var D=v[E-1][E-1],P=0;P<E;P++)v[P][P]=i(v[P][P],D);var{Q:I,R:k}=m(v);v=a(k,I);for(var O=0;O<E;O++)v[O][O]=r(v[O][O],D);if(d&&(C=a(C,I)),1===E||x(u(v[E-1][E-2]),s)){M=0,w.push(v[E-1][E-1]),d&&(A.unshift([[1]]),T(C,n),S=a(S,C),E>1&&(C=h(Array(E-1).fill(y)))),E-=1,v.pop();for(var N=0;N<E;N++)v[N].pop()}else if(2===E||x(u(v[E-2][E-3]),s)){M=0;var L=function(t,n,a,s){var u=r(t,s),c=i(o(t,s),o(n,a)),h=o(u,.5),f=o(l(i(o(u,u),o(4,c))),.5);return[r(h,f),i(h,f)]}(v[E-2][E-2],v[E-2][E-1],v[E-1][E-2],v[E-1][E-1]);w.push(...L),d&&(A.unshift(function(t,r,n,a,o,s,l,h){var f="BigNumber"===h,d="Complex"===h,p=f?c(0):d?_(0):0,m=f?c(1):d?_(1):1;if(x(u(n),l))return[[m,p],[p,m]];if(b(u(i(o,s)),l))return[[i(o,a),i(s,a)],[n,n]];var g=i(t,o),y=i(a,o);return x(u(r),l)&&x(u(y),l)?[[g,m],[n,p]]:[[r,p],[y,m]]}(v[E-2][E-2],v[E-2][E-1],v[E-1][E-2],v[E-1][E-1],L[0],L[1],s,f)),T(C,n),S=a(S,C),E>2&&(C=h(Array(E-2).fill(y)))),E-=2,v.pop(),v.pop();for(var R=0;R<E;R++)v[R].pop(),v[R].pop()}if(0===E)break}if(w.sort((t,r)=>+i(u(t),u(r))),M>100){var F=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+w.join(", "));throw F.values=w,F.vectors=[],F}return{values:w,C:d?a(S,function(t,r){for(var i=[],n=0;n<r;n++)i[n]=Array(r).fill(0);var a=0;for(var o of t){for(var s=o.length,l=0;l<s;l++)for(var u=0;u<s;u++)i[a+l][a+u]=o[l][u];a+=s}return i}(A,n)):void 0}}(t,f,d,w,E);if(E){var I=function(t,r,o,s,l,u,f){var d=a(p(o),t,o),m="BigNumber"===f,w="Complex"===f,E=m?c(0):w?_(0):0,T=m?c(1):w?_(1):1,M=[],D=[];for(var P of l){var I=function(t,r,i){for(var n=0;n<t.length;n++)if(i(t[n],r))return n;return -1}(M,P,v);-1===I?(M.push(P),D.push(1)):D[I]+=1}for(var k=[],O=M.length,N=Array(r).fill(E),L=h(Array(r).fill(T)),R=0;R<O;R++)!function(){var t=M[R],l=i(d,a(t,L)),h=y(l,N);for(h.shift();h.length<D[R];){var m=function(t,r,i,n,a){for(var o,s="BigNumber"===a?c(1e3):1e3,l=0;l<5;++l){o=function(t,r,i){var n="BigNumber"===i,a="Complex"===i,o=Array(t).fill(0).map(t=>2*Math.random()-1);return n&&(o=o.map(t=>c(t))),a&&(o=o.map(t=>_(t))),C(o=A(o,r),i)}(r,i,a);try{o=g(t,o)}catch(t){continue}if(b(S(o),s))break}if(l>=5)return null;for(l=0;;){var u=g(t,o);if(x(S(A(o,[u])),n))break;if(++l>=10)return null;o=C(u)}return o}(l,r,h,u,f);if(null===m)break;h.push(m)}var v=a(p(s),o);h=h.map(t=>a(v,t)),k.push(...h.map(r=>({value:t,vector:n(r)})))}();return k}(t,f,P,M,D,d,w);return{values:D,eigenvectors:I}}return{values:D}}}({config:r,addScalar:a,subtract:o,multiply:g,multiplyScalar:f,flatten:b,divideScalar:d,sqrt:E,abs:l,bignumber:m,diag:T,size:A,reshape:S,qr:C,inv:p,usolve:M,usolveAll:D,equal:s,complex:w,larger:v,smaller:k,matrixFromColumns:O,dot:N});return i("eigs",{Array:function(t){return F(n(t))},"Array, number|BigNumber":function(t,r){return F(n(t),{precision:r})},"Array, Object":(t,r)=>F(n(t),r),Matrix:function(t){return F(t,{matricize:!0})},"Matrix, number|BigNumber":function(t,r){return F(t,{precision:r,matricize:!0})},"Matrix, Object":function(t,r){var i={matricize:!0};return rh(i,r),F(t,i)}});function F(t){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=!("eigenvectors"in a)||a.eigenvectors,u=function(t,r,i){var n=t.toArray(),a=t.size();if(2!==a.length||a[0]!==a[1])throw RangeError("Matrix must be square (size: ".concat(a0(a),")"));var s=a[0];if(function(t,r,i){for(var n=0;n<r;n++)for(var a=0;a<r;a++)if(v(m(l(P(t[n][a]))),i))return!1;return!0}(n,s,r)&&(function(t,r){for(var i=0;i<r;i++)for(var n=0;n<r;n++)t[i][n]=I(t[i][n])}(n,s),function(t,r,i){for(var n=0;n<r;n++)for(var a=n;a<r;a++)if(v(m(l(o(t[n][a],t[a][n]))),i))return!1;return!0}(n,s,r))){var u=B(t,n,s);return L(n,s,r,u,i)}var c=B(t,n,s);return R(n,s,r,c,i)}(t,null!=(i=a.precision)?i:r.relTol,s);return a.matricize&&(u.values=n(u.values),s&&(u.eigenvectors=u.eigenvectors.map(t=>{var{value:r,vector:i}=t;return{value:r,vector:n(i)}}))),s&&Object.defineProperty(u,"vectors",{enumerable:!1,get:()=>{throw Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),u}function B(t,r,i){var n=t.datatype();if("number"===n||"BigNumber"===n||"Complex"===n)return n;for(var a=!1,o=!1,s=!1,l=0;l<i;l++)for(var u=0;u<i;u++){var c=r[l][u];if(rC(c)||rI(c))a=!0;else if(rM(c))o=!0;else if(rP(c))s=!0;else throw TypeError("Unsupported type in Matrix: "+iu(c))}if(o&&s&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),s){for(var h=0;h<i;h++)for(var f=0;f<i;f++)r[h][f]=w(r[h][f]);return"Complex"}if(o){for(var d=0;d<i;d++)for(var p=0;p<i;p++)r[d][p]=m(r[d][p]);return"BigNumber"}if(a){for(var g=0;g<i;g++)for(var y=0;y<i;y++)r[g][y]=x(r[g][y]);return"number"}throw TypeError("Matrix contains unsupported types only.")}});t.s(["createEigs",0,pJ],45608);var p0="expm",p1=ig(p0,["typed","abs","add","identity","inv","multiply"],t=>{var{typed:r,abs:i,add:n,identity:a,inv:o,multiply:s}=t;return r(p0,{Matrix:function(t){var r=t.size();if(2!==r.length||r[0]!==r[1])throw RangeError("Matrix must be square (size: "+a0(r)+")");for(var l=r[0],u=function(t){for(var r=0;r<30;r++)for(var i=0;i<=r;i++){var n=r-i;if(1e-15>function(t,r,i){for(var n=1,a=2;a<=r;a++)n*=a;for(var o=n,s=r+1;s<=2*r;s++)o*=s;var l=o*(2*r+1);return 8*Math.pow(t/Math.pow(2,i),2*r)*n*n/(o*l)}(t,i,n))return{q:i,j:n}}throw Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(function(t){for(var r=t.size()[0],n=0,a=0;a<r;a++){for(var o=0,s=0;s<r;s++)o+=i(t.get([a,s]));n=Math.max(o,n)}return n}(t)),c=u.q,h=u.j,f=s(t,Math.pow(2,-h)),d=a(l),p=a(l),m=1,g=f,y=-1,v=1;v<=c;v++)v>1&&(g=s(g,f),y=-y),d=n(d,s(m=m*(c-v+1)/((2*c-v+1)*v),g)),p=n(p,s(m*y,g));for(var _=s(o(p),d),b=0;b<h;b++)_=s(_,_);return rB(t)?t.createSparseMatrix(_):_}})});t.s(["createExpm",0,p1],610830);var p2="sqrtm",p3=ig(p2,["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],t=>{var{typed:r,abs:i,add:n,multiply:a,map:o,sqrt:s,subtract:l,inv:u,size:c,max:h,identity:f}=t;return r(p2,{"Array | Matrix":function(t){var r=rL(t)?t.size():a6(t);switch(r.length){case 1:if(1===r[0])return o(t,s);throw RangeError("Matrix must be square (size: "+a0(r)+")");case 2:if(r[0]===r[1])return function(t){var r,o=0,s=t,d=f(c(t));do{var p=s;
1if(s=a(.5,n(p,u(d))),d=a(.5,n(d,u(p))),(r=h(i(l(s,p))))>1e-6&&++o>1e3)throw Error("computing square root of matrix: iterative method could not converge")}while(r>1e-6)return s}(t);throw RangeError("Matrix must be square (size: "+a0(r)+")");default:throw RangeError("Matrix must be at most two dimensional (size: "+a0(r)+")")}}})});t.s(["createSqrtm",0,p3],622417);var p4="sylvester",p6=ig(p4,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],t=>{var{typed:r,schur:i,matrixFromColumns:n,matrix:a,multiply:o,range:s,concat:l,transpose:u,index:c,subset:h,add:f,subtract:d,identity:p,lusolve:m,abs:g,config:y}=t;return r(p4,{"Matrix, Matrix, Matrix":v,"Array, Matrix, Matrix":function(t,r,i){return v(a(t),r,i)},"Array, Array, Matrix":function(t,r,i){return v(a(t),a(r),i)},"Array, Matrix, Array":function(t,r,i){return v(a(t),r,a(i))},"Matrix, Array, Matrix":function(t,r,i){return v(t,a(r),i)},"Matrix, Array, Array":function(t,r,i){return v(t,a(r),a(i))},"Matrix, Matrix, Array":function(t,r,i){return v(t,r,a(i))},"Array, Array, Array":function(t,r,i){return v(a(t),a(r),a(i)).toArray()}});function v(t,r,y){for(var v=r.size()[0],_=t.size()[0],b=i(t),x=b.T,w=b.U,E=i(o(-1,r)),T=E.T,A=E.U,S=o(o(u(w),y),A),C=s(0,_),M=[],D=(t,r)=>l(t,r,1),P=(t,r)=>l(t,r,0),I=0;I<v;I++)if(I<v-1&&g(h(T,c(I+1,I)))>1e-5){for(var k=P(h(S,c(C,[I])),h(S,c(C,[I+1]))),O=0;O<I;O++)k=f(k,P(o(M[O],h(T,c(O,I))),o(M[O],h(T,c(O,I+1)))));var N=o(p(_),o(-1,h(T,c(I,I)))),L=o(p(_),o(-1,h(T,c(I+1,I)))),R=o(p(_),o(-1,h(T,c(I,I+1)))),F=o(p(_),o(-1,h(T,c(I+1,I+1)))),B=m(P(D(f(x,N),L),D(R,f(x,F))),k);M[I]=B.subset(c(s(0,_),[0])),M[I+1]=B.subset(c(s(_,2*_),[0])),I++}else{for(var z=h(S,c(C,[I])),j=0;j<I;j++)z=f(z,o(M[j],h(T,c(j,I))));var U=d(x,o(h(T,c(I,I)),p(_)));M[I]=m(U,z)}return o(w,o(a(n(...M)),u(A)))}});t.s(["createSylvester",0,p6],676997);var p5="schur",p8=ig(p5,["typed","matrix","identity","multiply","qr","norm","subtract"],t=>{var{typed:r,matrix:i,identity:n,multiply:a,qr:o,norm:s,subtract:l}=t;return r(p5,{Array:function(t){var r=u(i(t));return{U:r.U.valueOf(),T:r.T.valueOf()}},Matrix:function(t){return u(t)}});function u(t){var r,i=t.size()[0],u=t,c=n(i),h=0;do{r=u;var f=o(u),d=f.Q;if(u=a(f.R,d),c=a(c,d),h++>100)break}while(s(l(u,r))>1e-4)return{U:c,T:u}}});t.s(["createSchur",0,p8],913255);var p7="lyap",p9=ig(p7,["typed","matrix","sylvester","multiply","transpose"],t=>{var{typed:r,matrix:i,sylvester:n,multiply:a,transpose:o}=t;return r(p7,{"Matrix, Matrix":function(t,r){return n(t,o(t),a(-1,r))},"Array, Matrix":function(t,r){return n(i(t),o(i(t)),a(-1,r))},"Matrix, Array":function(t,r){return n(t,o(i(t)),i(a(-1,r)))},"Array, Array":function(t,r){return n(i(t),o(i(t)),i(a(-1,r))).toArray()}})});t.s(["createLyap",0,p9],167064);var me=ig("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],t=>{var{typed:r,matrix:i,multiply:n,equalScalar:a,divideScalar:o,inv:s}=t,l=sQ({typed:r,equalScalar:a}),u=s0({typed:r});return r("divide",ih({"Array | Matrix, Array | Matrix":function(t,r){return n(t,s(r))},"DenseMatrix, any":function(t,r){return u(t,r,o,!1)},"SparseMatrix, any":function(t,r){return l(t,r,o,!1)},"Array, any":function(t,r){return u(i(t),r,o,!1).valueOf()},"any, Array | Matrix":function(t,r){return n(t,s(r))}},o.signatures))});t.s(["createDivide",0,me],302797);var mt="distance",mr=ig(mt,["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],t=>{var{typed:r,addScalar:i,subtractScalar:n,multiplyScalar:a,divideScalar:o,deepEqual:s,sqrt:l,abs:u}=t;return r(mt,{"Array, Array, Array":function(t,r,i){if(2===t.length&&2===r.length&&2===i.length){if(!h(t))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!h(r))throw TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!h(i))throw TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(s(r,i))throw TypeError("LinePoint1 should not be same with LinePoint2");var o=n(i[1],r[1]),l=n(r[0],i[0]),u=n(a(i[0],r[1]),a(r[0],i[1]));return g(t[0],t[1],o,l,u)}throw TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(t,r,i){if(2===Object.keys(t).length&&2===Object.keys(r).length&&2===Object.keys(i).length){if(!h(t))throw TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!h(r))throw TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!h(i))throw TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(s(m(r),m(i)))throw TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in t&&"pointY"in t&&"lineOnePtX"in r&&"lineOnePtY"in r&&"lineTwoPtX"in
1i&&"lineTwoPtY"in i){var o=n(i.lineTwoPtY,r.lineOnePtY),l=n(r.lineOnePtX,i.lineTwoPtX),u=n(a(i.lineTwoPtX,r.lineOnePtY),a(r.lineOnePtX,i.lineTwoPtY));return g(t.pointX,t.pointY,o,l,u)}throw TypeError("Key names do not match")}throw TypeError("Invalid Arguments: Try again")},"Array, Array":function(t,r){if(2===t.length&&3===r.length){if(!h(t))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(r))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(t[0],t[1],r[0],r[1],r[2])}if(3===t.length&&6===r.length){if(!f(t))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(r))throw TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(t[0],t[1],t[2],r[0],r[1],r[2],r[3],r[4],r[5])}if(t.length===r.length&&t.length>0){if(!d(t)||!d(r))throw TypeError("All values of an array should be numbers or BigNumbers");return v(t,r)}throw TypeError("Invalid Arguments: Try again")},"Object, Object":function(t,r){if(2===Object.keys(t).length&&3===Object.keys(r).length){if(!h(t))throw TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(r))throw TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in t&&"pointY"in t&&"xCoeffLine"in r&&"yCoeffLine"in r&&"constant"in r)return g(t.pointX,t.pointY,r.xCoeffLine,r.yCoeffLine,r.constant);
1throw TypeError("Key names do not match")}if(3===Object.keys(t).length&&6===Object.keys(r).length){if(!f(t))throw TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(r))throw TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in t&&"pointY"in t&&"x0"in r&&"y0"in r&&"z0"in r&&"a"in r&&"b"in r&&"c"in r)return y(t.pointX,t.pointY,t.pointZ,r.x0,r.y0,r.z0,r.a,r.b,r.c);throw TypeError("Key names do not match")}if(2===Object.keys(t).length&&2===Object.keys(r).length){if(!h(t))throw TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!h(r))throw TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in t&&"pointOneY"in t&&"pointTwoX"in r&&"pointTwoY"in r)return v([t.pointOneX,t.pointOneY],[r.pointTwoX,r.pointTwoY]);throw TypeError("Key names do not match")}if(3===Object.keys(t).length&&3===Object.keys(r).length){if(!f(t))throw TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(r))throw TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in t&&"pointOneY"in t&&"pointOneZ"in t&&"pointTwoX"in r&&"pointTwoY"in r&&"pointTwoZ"in r)return v([t.pointOneX,t.pointOneY,t.pointOneZ],[r.pointTwoX,r.pointTwoY,r.pointTwoZ]);
1throw TypeError("Key names do not match")}throw TypeError("Invalid Arguments: Try again")},Array:function(t){if(!function(t){if(2===t[0].length&&c(t[0][0])&&c(t[0][1])){if(t.some(t=>2!==t.length||!c(t[0])||!c(t[1])))return!1}else if(!(3===t[0].length&&c(t[0][0])&&c(t[0][1])&&c(t[0][2])))return!1;else if(t.some(t=>3!==t.length||!c(t[0])||!c(t[1])||!c(t[2])))return!1;return!0}(t))throw TypeError("Incorrect array format entered for pairwise distance calculation");return function(t){for(var r=[],i=[],n=[],a=0;a<t.length-1;a++)for(var o=a+1;o<t.length;o++)2===t[0].length?(i=[t[a][0],t[a][1]],n=[t[o][0],t[o][1]]):3===t[0].length&&(i=[t[a][0],t[a][1],t[a][2]],n=[t[o][0],t[o][1],t[o][2]]),r.push(v(i,n));return r}(t)}});function c(t){return"number"==typeof t||rM(t)}function h(t){return t.constructor!==Array&&(t=m(t)),c(t[0])&&c(t[1])}function f(t){return t.constructor!==Array&&(t=m(t)),c(t[0])&&c(t[1])&&c(t[2])}function d(t){return Array.isArray(t)||(t=m(t)),t.every(c)}function p(t){return t.constructor!==Array&&(t=m(t)),c(t[0])&&c(t[1])&&c(t[2])&&c(t[3])&&c(t[4])&&c(t[5])}function m(t){for(var r=Object.keys(t),i=[],n=0;n<r.length;n++)i.push(t[r[n]]);return i}function g(t,r,n,s,c){return o(u(i(i(a(n,t),a(s,r)),c)),l(i(a(n,n),a(s,s))))}function y(t,r,s,u,c,h,f,d,p){var m=[n(a(n(c,r),p),a(n(h,s),d)),n(a(n(h,s),f),a(n(u,t),p)),n(a(n(u,t),d),a(n(c,r),f))];return o(m=l(i(i(a(m[0],m[0]),a(m[1],m[1])),a(m[2],m[2]))),l(i(i(a(f,f),a(d,d)),a(p,p))))}function v(t,r){for(var o=t.length,s=0,u=0,c=0;c<o;c++)s=i(a(u=n(t[c],r[c]),u),s);return l(s)}});t.s(["createDistance",0,mr],734600);var mi=ig("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],t=>{var{typed:r,config:i,abs:n,add:a,addScalar:o,matrix:s,multiply:l,multiplyScalar:u,divi
1deScalar:c,subtract:h,smaller:f,equalScalar:d,flatten:p,isZero:m,isNumeric:g}=t;return r("intersect",{"Array, Array, Array":y,"Array, Array, Array, Array":v,"Matrix, Matrix, Matrix":function(t,r,i){var n=y(t.valueOf(),r.valueOf(),i.valueOf());return null===n?null:s(n)},"Matrix, Matrix, Matrix, Matrix":function(t,r,i,n){var a=v(t.valueOf(),r.valueOf(),i.valueOf(),n.valueOf());return null===a?null:s(a)}});function y(t,r,i){var n,a,s,l,f,d,p,m,y,v,b,w,E,T,A,S,C,M;if(t=_(t),r=_(r),i=_(i),!x(t))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(r))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!(4===(n=i).length&&g(n[0])&&g(n[1])&&g(n[2])&&g(n[3])))throw TypeError("Array with 4 numbers expected as third argument");return a=t[0],s=t[1],l=t[2],f=r[0],d=r[1],p=r[2],m=i[0],y=i[1],v=i[2],b=i[3],w=u(a,m),E=u(f,m),T=u(s,y),A=u(d,y),S=u(l,v),C=u(p,v),M=c(h(h(h(b,w),T),S),h(h(h(o(o(E,A),C),w),T),S)),[o(a,u(M,h(f,a))),o(s,u(M,h(d,s))),o(l,u(M,h(p,l)))]}function v(t,r,s,p){if(t=_(t),r=_(r),s=_(s),p=_(p),2===t.length){if(!b(t))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(r))throw TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(s))throw TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(p))throw TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(t,r,s,d){var p=h(t,r),g=h(s,d),y=h(u(p[0],g[1]),u(g[0],p[1]));if(m(y)||f(n(y),i.relTol))return null;var v=u(g[0],t[1]),_=u(g[1],t[0]),b=u(g[0],s[1]),x=u(g[1],s[0]);return a(l(p,c(o(h(h(v,_),b),x),y)),t)}(t,r,s,p)}if(3===t.length){if(!x(t))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!x(r))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!x(s))throw TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!x(p))throw TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(t,r,i,n,a,s,l,f,p,g,y,v){var _=w(t,l,g,l,r,f,y,f,i,p,v,p),b=w(g,l,n,t,y,f,a,r,v,p,s,i),x=w(t,l,n,t,r,f,a,r,i,p,s,i),E=w(g,l,g,l,y,f,y,f,v,p,v,p),T=w(n,t,n,t,a,r,a,r,s,i,s,i),A=h(u(_,b),u(x,E)),S=h(u(T,E),u(b,b));if(m(S))return null;var C=c(A,S),M=c(o(_,u(C,b)),E),D=o(t,u(C,h(n,t))),P=o(r,u(C,h(a,r))),I=o(i,u(C,h(s,i))),k=o(l,u(M,h(g,l))),O=o(f,u(M,h(y,f))),N=o(p,u(M,h(v,p)));return d(D,k)&&d(P,O)&&d(I,N)?[D,P,I]:null}(t[0],t[1],t[2],r[0],r[1],r[2],s[0],s[1],s[2],p[0],p[1],p[2])}throw TypeError("Arrays with two or thee dimensional points expected")}function _(t){return 1===t.length?t[0]:t.length>1&&Array.isArray(t[0])&&t.every(t=>Array.isArray(t)&&1===t.length)?p(t):t}function b(t){return 2===t.length&&g(t[0])&&g(t[1])}function x(t){return 3===t.length&&g(t[0])&&g(t[1])&&g(t[2])}function w(t,r,i,n,a,s,l,c,f,d,p,m){var g=u(h(t,r),h(i,n)),y=u(h(a,s),h(l,c)),v=u(h(f,d),h(p,m));return o(o(g,y),v)}});t.s(["createIntersect",0,mi],355915);var mn=ig("sum",["typed","config","add","numeric"],t=>{var{typed:r,config:i,add:n,numeric:a}=t;return r("sum",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(t,r){try{return oI(t,r,n)}catch(t){throw cI(t,"sum")}},"...":function(t){if(oM(t))throw TypeError("Scalar values expected in function sum");return o(t)}});function o(t){var r;return oD(t,function(t){try{r=void 0===r?t:n(r,t)}catch(r){throw cI(r,"sum",t)}}),void 0===r&&(r=a(0,i.number)),"string"==typeof r&&(r=a(r,iC(r,i))),r}});t.s(["createSum",0,mn],732009);var ma="cumsum",mo=ig(ma,["typed","add","unaryPlus"],t=>{var{typed:r,add:i,unaryPlus:n}=t;return r(ma,{Array:a,Matrix:function(t){return t.create(a(t.valueOf(),t.datatype()))},"Array, number | BigNumber":s,"Matrix, number | BigNumber":function(t,r){return t.create(s(t.valueOf(),r),t.datatype())},"...":function(t){if(oM(t))throw TypeError("All values expected to be scalar in function cumsum");return a(t)}});function a(t){try{return o(t)}catch(t){throw cI(t,ma)}}function o(t){if(0===t.length)return[];for(var r=[n(t[0])],a=1;a<t.length;++a)r.push(i(r[a-1],t[a]));return r}function s(t,r){var i=a6(t);if(r<0||r>=i.length)throw new rm(r,i.length);try{return function t(r,i){var n,a,s;if(i<=0){if(!Array.isArray(r[0][0]))return o(r);for(s=oC(r),a=[],n=0;n<s.length;n++)a[n]=t(s[n],i-1);return a}for(n=0,a=[];n<r.length;n++)a[n]=t(r[n],i-1);return a}(t,r)}catch(t){throw cI(t,ma)}}});t.s(["createCumSum",0,mo],852847);var ms="mean",ml=ig(ms,["typed","add","divide"],t=>{var{typed:r,add:i,divide:n}=t;return r(ms,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(t,r){try{var a=oI(t,r,i),o=Array.isArray(t)?a6(t):t.size();return n(a,o[r])}catch(t){throw cI(t,"mean")}},"...":function(t){if(oM(t))throw TypeError("Scalar values expected in function mean");return a(t)}});function a(t){var r,a=0;if(oD(t,function(t){try{r=void 0===r?t:i(r,t),a++}catch(r){throw cI(r,"mean",t)}}),0===a)throw Error("Cannot calculate the mean of an empty array");return n(r,a)}});t.s(["createMean",0,ml],433789);var mu="median",mc=ig(mu,["typed","add","divide","compare","partitionSelect"],t=>{var{typed:r,add:i,divide:n,compare:a,partitionSelect:o}=t;function s(t){try{var r=(t=oo(t.valueOf())).length;if(0===r)throw Error("Cannot calculate median of an empty array");if(r%2==0){for(var i=r/2-1,n=o(t,i+1),s=t[i],c=0;c<i;++c)a(t[c],s)>0&&(s=t[c]);return u(s,n)}var h=o(t,(r-1)/2);return l(h)}catch(t){throw cI(t,"median")}}var l=r({"number | BigNumber | Complex | Unit":function(t){return t}}),u=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(t,r){return n(i(t,r),2)}});return r(mu,{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(t,r){throw Error("median(A, dim) is not yet supported")},"...":function(t){if(oM(t))throw TypeError("Scalar values expected in function median");return s(t)}})});t.s(["createMedian",0,mc],268408);var mh=ig("mad",["typed","abs","map","median","subtract"],t=>{var{typed:r,abs:i,map:n,median:a,subtract:o}=t;return r("mad",{"Array | Matrix":s,"...":function(t){return s(t)}});function s(t){if(0===(t=oo(t.valueOf())).length)throw Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var r=a(t);return a(n(t,function(t){return i(o(t,r))}))}catch(t){if(t instanceof TypeError&&t.message.includes("median"))throw TypeError(t.message.replace("median","mad"));throw cI(t,"mad")}}});t.s(["createMad",0,mh],390431);var mf="unbiased",md="variance",mp=ig(md,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],t=>{var{typed:r,add:i,subtract:n,multiply:a,divide:o,mapSlices:s,isNaN:l}=t;return r(md,{"Array | Matrix":function(t){return u(t,mf)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(t,r){return c(t,r,mf)},"Array | Matrix, number | BigNumber, string":c,"...":function(t){return u(t,mf)}});function u(t,r){var s,u=0;if(0===t.length)throw SyntaxError("Function variance requires one or more parameters (0 provided)");if(oD(t,function(t){try{s=void 0===s?t:i(s,t),u++}catch(r){throw cI(r,"variance",t)}}),0===u)throw Error("Cannot calculate variance of an empty array");var c=o(s,u);
1if(s=void 0,oD(t,function(t){var r=n(t,c);s=void 0===s?a(r,r):i(s,a(r,r))}),l(s))return s;switch(r){case"uncorrected":return o(s,u);case"biased":return o(s,u+1);case"unbiased":var h=rM(s)?s.mul(0):0;return 1===u?h:o(s,u-1);default:throw Error('Unknown normalization "'+r+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function c(t,r,i){try{if(0===t.length)throw SyntaxError("Function variance requires one or more parameters (0 provided)");return s(t,r,t=>u(t,i))}catch(t){throw cI(t,"variance")}}});t.s(["createVariance",0,mp],187058);var mm="quantileSeq",mg=ig(mm,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],t=>{var{typed:r,bignumber:i,add:n,subtract:a,divide:o,multiply:s,partitionSelect:l,compare:u,isInteger:c,smaller:h,smallerEq:f,larger:d,mapSlices:p}=t;return r(mm,{"Array | Matrix, number | BigNumber":(t,r)=>g(t,r,!1),"Array | Matrix, number | BigNumber, number":(t,r,i)=>m(t,r,!1,i,g),"Array | Matrix, number | BigNumber, boolean":g,"Array | Matrix, number | BigNumber, boolean, number":(t,r,i,n)=>m(t,r,i,n,g),"Array | Matrix, Array | Matrix":(t,r)=>y(t,r,!1),"Array | Matrix, Array | Matrix, number":(t,r,i)=>m(t,r,!1,i,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(t,r,i,n)=>m(t,r,i,n,y)});function m(t,r,i,n,a){return p(t,n,t=>a(t,r,i))}function g(t,r,a){var s,l=t.valueOf();if(h(r,0))throw Error("N/prob must be non-negative");if(f(r,1))return rC(r)?v(l,r,a):i(v(l,r,a));if(d(r,1)){if(!c(r))throw Error("N must be a positive integer");if(d(r,0xffffffff))throw Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var u=n(r,1);s=[];for(var p=0;h(p,r);p++){var m=o(p+1,u);s.push(v(l,m,a))}return rC(r)?s:i(s)}}function y(t,r,i){for(var n=t.valueOf(),a=r.valueOf(),o=[],s=0;s<a.length;++s)o.push(v(n,a[s],i));return o}function v(t,r,i){var o,h,f=oo(t),d=f.length;if(0===d)throw Error("Cannot calculate quantile of an empty sequence");var p=rC(r)?r*(d-1):r.times(d-1),m=rC(r)?Math.floor(p):p.floor().toNumber(),g=rC(r)?p%1:p.minus(m);if(c(p))return i?f[p]:l(f,rC(r)?p:p.valueOf());if(i)o=f[m],h=f[m+1];else{h=l(f,m+1),o=f[m];for(var y=0;y<m;++y)u(f[y],o)>0&&(o=f[y])}return n(s(o,a(1,g)),s(h,g))}});t.s(["createQuantileSeq",0,mg],724429);var my=ig("std",["typed","map","sqrt","variance"],t=>{var{typed:r,map:i,sqrt:n,variance:a}=t;return r("std",{"Array | Matrix":o,"Array | Matrix, string":o,"Array | Matrix, number | BigNumber":o,"Array | Matrix, number | BigNumber, string":o,"...":function(t){return o(t)}});function o(t,r){if(0===t.length)throw SyntaxError("Function std requires one or more parameters (0 provided)");try{var o=a.apply(null,arguments);if(rR(o))return i(o,n);return n(o)}catch(t){if(t instanceof TypeError&&t.message.includes(" variance"))throw TypeError(t.message.replace(" variance"," std"));throw t}}});t.s(["createStd",0,my],74964);var mv="corr",m_=ig(mv,["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],t=>{var{typed:r,matrix:i,sqrt:n,sum:a,add:o,subtract:s,multiply:l,pow:u,divide:c}=t;return r(mv,{"Array, Array":function(t,r){return h(t,r)},"Matrix, Matrix":function(t,r){var n=h(t.toArray(),r.toArray());return Array.isArray(n)?i(n):n}});function h(t,r){var i=[];if(Array.isArray(t[0])&&Array.isArray(r[0])){if(t.length!==r.length)throw SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var n=0;n<t.length;n++){if(t[n].length!==r[n].length)throw SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");i.push(f(t[n],r[n]))}return i}if(t.length!==r.length)throw SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(t,r)}function f(t,r){var i=t.length,h=a(t),f=a(r),d=t.reduce((t,i,n)=>o(t,l(i,r[n])),0),p=a(t.map(t=>u(t,2))),m=a(r.map(t=>u(t,2)));return c(s(l(i,d),l(h,f)),n(l(s(l(i,p),u(h,2)),s(l(i,m),u(f,2)))))}});t.s(["createCorr",0,m_],946986);var mb="bernoulli",mx=ig(mb,["typed","config","isInteger","number","?BigNumber","?Fraction"],t=>{var{typed:r,config:i,number:n,BigNumber:a,Fraction:o}=t,s=[void 0],l=[void 0],u=[void 0],c=50;return r(mb,{number:t=>mw(t,t=>t,s,(t,r)=>t+r,(t,r)=>t*r,(t,r)=>t/r),"bigint | Fraction":t=>mw(n(t),t=>new o(t),l,(t,r)=>t.add(r),(t,r)=>t.mul(r),(t,r)=>t.div(r)),BigNumber:t=>(i.precision!==c&&(u=[void 0],c=i.precision),mw(n(t),t=>new a(t),u,(t,r)=>t.add(r),(t,r)=>t.mul(r),(t,r)=>t.div(r)))})});function mw(t,r,i,n,a,o){if(t<0||!iS(t))throw RangeError("Bernoulli index must be nonnegative integer");if(0===t)return r(1);if(1===t)return o(r(-1),r(2));if(t%2==1)return r(0);var s=r(1);1===i.length&&i.push([o(s,r(-3)),o(s,r(-2)),o(s,r(6))]);for(var l=t/2,u=r(0),c=r(2);i.length<=l;){for(var h=i.length,f=Math.floor((h+1)/2),d=u,p=1;p<f;++p)d=n(d,a(i[p][0],i[h-p][0]));d=a(d,c),h%2==0&&(d=n(d,a(i[f][0],i[f][0]))),d=o(d,r(-(2*h+1)));var m=o(a(i[h-1][1],r(-h*(2*h-1))),c);i.push([d,m,a(m,d)])}return i[l][2]}function mE(t,r){if(r<t)return 1;if(r===t)return r;var i=r+t>>1;return mE(t,i)*mE(i+1,r)}function mT(t,r){if(!iS(t)||t<0||!iS(r)||r<0)throw TypeError("Positive integer value expected in function combinations");
1if(r>t)throw TypeError("k must be less than or equal to n");for(var i=t-r,n=1,a=r<i?i+1:r+1,o=2,s=r<i?r:i,l=a;l<=t;++l)for(n*=l;o<=s&&n%o==0;)n/=o,++o;return o<=s&&(n/=mE(o,s)),n}t.s(["createBernoulli",0,mx],932193),mT.signature="number, number";var mA="combinations",mS=ig(mA,["typed"],t=>{var{typed:r}=t;return r(mA,{"number, number":mT,"BigNumber, BigNumber":function(t,r){var i,n,a=t.constructor,o=t.minus(r),s=new a(1);if(!mC(t)||!mC(r))throw TypeError("Positive integer value expected in function combinations");if(r.gt(t))throw TypeError("k must be less than n in function combinations");if(i=s,r.lt(o))for(n=s;n.lte(o);n=n.plus(s))i=i.times(r.plus(n)).dividedBy(n);else for(n=s;n.lte(r);n=n.plus(s))i=i.times(o.plus(n)).dividedBy(n);return i}})});function mC(t){return t.isInteger()&&t.gte(0)}t.s(["createCombinations",0,mS],831431);var mM="combinationsWithRep",mD=ig(mM,["typed"],t=>{var{typed:r}=t;return r(mM,{"number, number":function(t,r){if(!iS(t)||t<0||!iS(r)||r<0)throw TypeError("Positive integer value expected in function combinationsWithRep");if(t<1)throw TypeError("k must be less than or equal to n + k - 1");return r<t-1?mE(t,t+r-1)/mE(1,r):mE(r+1,t+r-1)/mE(1,t-1)},"BigNumber, BigNumber":function(t,r){var i,n,a=new t.constructor(1),o=t.minus(a);if(!mP(t)||!mP(r))throw TypeError("Positive integer value expected in function combinationsWithRep");if(t.lt(a))throw TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(i=a,r.lt(o))for(n=a;n.lte(o);n=n.plus(a))i=i.times(r.plus(n)).dividedBy(n);else for(n=a;n.lte(r);n=n.plus(a))i=i.times(o.plus(n)).dividedBy(n);return i}})});function mP(t){return t.isInteger()&&t.gte(0)}function mI(t){if(iS(t))return t<=0?Number.isFinite(t)?1/0:NaN:t>171?1/0:mE(1,t-1);if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*mI(1-t));if(t>=171.35)return 1/0;if(t>85){var r,i=t*t,n=i*t,a=n*t,o=a*t;return Math.sqrt(2*Math.PI/t)*Math.pow(t/Math.E,t)*(1+1/(12*t)+1/(288*i)-139/(51840*n)-571/(2488320*a)+163879/(0xc756000*o)+5246819/(0x11850f0000*o*t))}--t,r=mO[0];for(var s=1;s<mO.length;++s)r+=mO[s]/(t+s);var l=t+mk+.5;return Math.sqrt(2*Math.PI)*Math.pow(l,t+.5)*Math.exp(-l)*r}t.s(["createCombinationsWithRep",0,mD],557965),mI.signature="number";var mk=4.7421875,mO=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,1580887032249125e-19,-21026444172410488e-20,21743961811521265e-20,-1643181065367639e-19,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],mN=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function mL(t){if(t<0)return NaN;if(0===t)return 1/0;if(!Number.isFinite(t))return t;if(t<.5)return Math.log(Math.PI/Math.sin(Math.PI*t))-mL(1-t);for(var r=(t-=1)+5+.5,i=mN[0],n=6;n>=1;n--)i+=mN[n]/(t+n);return .9189385332046728+(t+.5)*Math.log(r)-r+Math.log(i)}mL.signature="number";var mR="gamma",mF=ig(mR,["typed","config","multiplyScalar","pow","BigNumber","Complex"],t=>{var{typed:r,config:i,multiplyScalar:n,pow:a,BigNumber:o,Complex:s}=t;return r(mR,{number:mI,Complex:function t(r){if(0===r.im)return mI(r.re);if(r.re<.5){var i=new s(1-r.re,-r.im),n=new s(Math.PI*r.re,Math.PI*r.im);return new s(Math.PI).div(n.sin()).div(t(i))}r=new s(r.re-1,r.im);for(var a=new s(mO[0],0),o=1;o<mO.length;++o){var l=new s(mO[o],0);a=a.add(l.div(r.add(o)))}var u=new s(r.re+mk+.5,r.im),c=Math.sqrt(2*Math.PI),h=u.pow(r.add(.5)),f=u.neg().exp();return a.mul(c).mul(h).mul(f)},BigNumber:function(t){if(t.isInteger())return t.isNegative()||t.isZero()?new o(1/0):function t(r){if(r<8)return new o([1,1,2,6,24,120,720,5040][r]);var n=i.precision+(0|Math.log(r.toNumber())),a=o.clone({precision:n});if(r%2==1)return r.times(t(new o(r-1)));for(var s=r,l=new a(r),u=r.toNumber();s>2;)s-=2,u+=s,l=l.times(u);return new o(l.toPrecision(o.precision))}(t.minus(1));if(!t.isFinite())return new o(t.isNegative()?NaN:1/0);throw Error("Integer BigNumber expected")}})});t.s(["createGamma",0,mF],631897);var mB="lgamma",mz=ig(mB,["Complex","typed"],t=>{var{Complex:r,typed:i}=t,n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,8417508417508417e-19,-5952380952380953e-19,7936507936507937e-19,-.002777777777777778,.08333333333333333];return i(mB,{number:mL,Complex:function t(i){if(i.isNaN())return new r(NaN,NaN);if(0===i.im)return new r(mL(i.re),0);if(i.re>=7||Math.abs(i.im)>=7)return a(i);if(i.re<=.1){var n,s=(!0^((n=i.im)>0||!(n<0)&&1/n==1/0)?-6.283185307179586:6.283185307179586)*Math.floor(.5*i.re+.25),l=i.mul(Math.PI).sin().log(),u=t(new r(1-i.re,-i.im));return new r(1.1447298858494002,s).sub(l).sub(u)}if(i.im>=0)return o(i);else return o(i.conjugate()).conjugate()},BigNumber:function(){throw Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function a(t){for(var i=t.sub(.5).mul(t.log()).sub(t).add(.9189385332046728),a=new r(1,0).div(t),o=a.div(t),s=n[0],l=n[1],u=2*o.re,c=o.re*o.re+o.im*o.im,h=2;h<8;h++){var f=l;l=-c*s+n[h],s=u*s+f}var d=a.mul(o.mul(s).add(l));return i.add(d)}function o(t){var i=0,n=0,o=t;for(t=t.add(1);t.re<=7;){var s=+((o=o.mul(t)).im<0);0!==s&&0===n&&i++,n=s,t=t.add(1)}return a(t).sub(o.log()).sub(new r(0,2*i*Math.PI*1))}});t.s(["createLgamma",0,mz],706263);var mj="factorial",mU=ig(mj,["typed","gamma"],t=>{var{typed:r,gamma:i}=t;return r(mj,{number:function(t){if(t<0)throw Error("Value must be non-negative");return i(t+1)},BigNumber:function(t){if(t.isNegative())throw Error("Value must be non-negative");return i(t.plus(1))},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createFactorial",0,mU],611217);var mV="kldivergence",m$=ig(mV,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],t=>{var{typed:r,matrix:i,divide:n,sum:a,multiply:o,map:s,dotDivide:l,log:u,isNumeric:c}=t;return r(mV,{"Array, Array":function(t,r){return h(i(t),i(r))},"Matrix, Array":function(t,r){return h(t,i(r))},"Array, Matrix":function(t,r){return h(i(t),r)},"Matrix, Matrix":function(t,r){return h(t,r)}});function h(t,r){var i=r.size().length,h=t.size().length;if(i>1)throw Error("first object must be one dimensional");if(h>1)throw Error("second object must be one dimensional");if(i!==h)throw Error("Length of two vectors must be equal");if(0===a(t))throw Error("Sum of elements in first object must be non zero");if(0===a(r))throw Error("Sum of elements in second object must be non zero");var f=n(t,a(t)),d=n(r,a(r)),p=a(o(f,s(l(f,d),t=>u(t))));return c(p)?p:NaN}});t.s(["createKldivergence",0,m$],41629);var mG="multinomial",mq=ig(mG,["typed","add","divide","multiply","factorial","isInteger","isPositive"],t=>{var{typed:r,add:i,divide:n,multiply:a,factorial:o,isInteger:s,isPositive:l}=t;return r(mG,{"Array | Matrix":function(t){var r=0,u=1;return oD(t,function(t){if(!s(t)||!l(t))throw TypeError("Positive integer value expected in function multinomial");r=i(r,t),u=a(u,o(t))}),n(o(r),u)}})});t.s(["createMultinomial",0,mq],105078);var mH="permutations",mW=ig(mH,["typed","factorial"],t=>{var{typed:r,factorial:i}=t;return r(mH,{"number | BigNumber":i,"number, number":function(t,r){if(!iS(t)||t<0||!iS(r)||r<0)throw TypeError("Positive integer value expected in function permutations");
1if(r>t)throw TypeError("second argument k must be less than or equal to first argument n");return mE(t-r+1,t)},"BigNumber, BigNumber":function(t,r){var i,n;if(!mZ(t)||!mZ(r))throw TypeError("Positive integer value expected in function permutations");if(r.gt(t))throw TypeError("second argument k must be less than or equal to first argument n");for(i=t.mul(0).add(1),n=t.minus(r).plus(1);n.lte(t);n=n.plus(1))i=i.times(n);return i}})});function mZ(t){return t.isInteger()&&t.gte(0)}t.s(["createPermutations",0,mW],439621);var mY=t.i(289378),mX=(0,mY.default)(Date.now());function mK(t){var r;return r=null===t?mX:(0,mY.default)(String(t)),function(){return r()}}var mQ="pickRandom",mJ=ig(mQ,["typed","config","?on"],t=>{var{typed:r,config:i,on:n}=t,a=mK(i.randomSeed);return n&&n("config",function(t,r){t.randomSeed!==r.randomSeed&&(a=mK(t.randomSeed))}),r(mQ,{"Array | Matrix":function(t){return o(t,{})},"Array | Matrix, Object":function(t,r){return o(t,r)},"Array | Matrix, number":function(t,r){return o(t,{number:r})},"Array | Matrix, Array | Matrix":function(t,r){return o(t,{weights:r})},"Array | Matrix, Array | Matrix, number":function(t,r,i){return o(t,{number:i,weights:r})},"Array | Matrix, number, Array | Matrix":function(t,r,i){return o(t,{number:r,weights:i})}});function o(t,r){var i,{number:n,weights:o,elementWise:s=!0}=r,l=void 0===n;l&&(n=1);var u=rL(t)?t.create:rL(o)?o.create:null;t=t.valueOf(),o&&(o=o.valueOf()),!0===s&&(t=oo(t),o=oo(o));var c=0;if(void 0!==o){if(o.length!==t.length)throw Error("Weights must have the same length as possibles");for(var h=0,f=o.length;h<f;h++){if(!rC(o[h])||o[h]<0)throw Error("Weights must be an array of positive numbers");c+=o[h]}}for(var d=t.length,p=[];p.length<n;){if(void 0===o)i=t[Math.floor(a()*d)];else for(var m=a()*c,g=0,y=t.length;g<y;g++)if((m-=o[g])<0){i=t[g];break}p.push(i)}return l?p[0]:u?u(p):p}});function m0(t,r){var i=[];if((t=t.slice(0)).length>1)for(var n=0,a=t.shift();n<a;n++)i.push(m0(t,r));else for(var o=0,s=t.shift();o<s;o++)i.push(r());return i}t.s(["createPickRandom",0,mJ],52025);var m1="random",m2=ig(m1,["typed","config","?on"],t=>{var{typed:r,config:i,on:n}=t,a=mK(i.randomSeed);return n&&n("config",function(t,r){t.randomSeed!==r.randomSeed&&(a=mK(t.randomSeed))}),r(m1,{"":()=>0+ +a(),number:t=>{var r;return r=t,0+a()*(r-0)},"number, number":(t,r)=>{var i,n;return i=t,n=r,i+a()*(n-i)},"Array | Matrix":t=>o(t,0,1),"Array | Matrix, number":(t,r)=>o(t,0,r),"Array | Matrix, number, number":(t,r,i)=>o(t,r,i)});function o(t,r,i){var n=m0(t.valueOf(),()=>{var t,n;return t=r,n=i,t+a()*(n-t)});return rL(t)?t.create(n,"number"):n}});t.s(["createRandom",0,m2],470017);var m3="randomInt",m4=ig(m3,["typed","config","log2","?on"],t=>{var{typed:r,config:i,log2:n,on:a}=t,o=mK(i.randomSeed);return a&&a("config",function(t,r){t.randomSeed!==r.randomSeed&&(o=mK(t.randomSeed))}),r(m3,{"":()=>l(0,2),number:t=>l(0,t),"number, number":(t,r)=>l(t,r),bigint:t=>u(0n,t),"bigint, bigint":u,"Array | Matrix":t=>s(t,0,1),"Array | Matrix, number":(t,r)=>s(t,0,r),"Array | Matrix, number, number":(t,r,i)=>s(t,r,i)});function s(t,r,i){var n=m0(t.valueOf(),()=>l(r,i));return rL(t)?t.create(n,"number"):n}function l(t,r){return Math.floor(t+o()*(r-t))}function u(t,r){var i=r-t;if(i<=2n**30n)return t+BigInt(l(0,Number(i)));for(var a=n(i),s=i;s>=i;){s=0n;for(var u=0;u<a;++u)s=2n*s+(.5>o()?0n:1n)}return t+s}});t.s(["createRandomInt",0,m4],542927);var m6="stirlingS2",m5=ig(m6,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],t=>{var{typed:r,addScalar:i,subtractScalar:n,multiplyScalar:a,divideScalar:o,pow:s,factorial:l,combinations:u,isNegative:c,isInteger:h,number:f,bignumber:d,larger:p}=t,m=[],g=[];return r(m6,{"number | BigNumber, number | BigNumber":function(t,r){if(!h(t)||c(t)||!h(r)||c(r))throw TypeError("Non-negative integer value expected in function stirlingS2");if(p(r,t))throw TypeError("k must be less than or equal to n in function stirlingS2");var n=!(rC(t)&&rC(r)),o=n?g:m,s=n?d:f,l=f(t),u=f(r);if(o[l]&&o[l].length>u)return o[l][u];for(var y=0;y<=l;++y)if(o[y]||(o[y]=[s(+(0===y))]),0!==y)for(var v=o[y],_=o[y-1],b=v.length;b<=y&&b<=u;++b)b===y?v[b]=1:v[b]=i(a(s(b),_[b]),_[b-1]);return o[l][u]}})});t.s(["createStirlingS2",0,m5],816467);var m8="bellNumbers",m7=ig(m8,["typed","addScalar","isNegative","isInteger","stirlingS2"],t=>{var{typed:r,addScalar:i,isNegative:n,isInteger:a,stirlingS2:o}=t;return r(m8,{"number | BigNumber":function(t){if(!a(t)||n(t))throw TypeError("Non-negative integer value expected in function bellNumbers");for(var r=0,s=0;s<=t;s++)r=i(r,o(t,s));return r}})});t.s(["createBellNumbers",0,m7],193438);var m9="catalan",ge=ig(m9,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],t=>{var{typed:r,addScalar:i,divideScalar:n,multiplyScalar:a,combinations:o,isNegative:s,isInteger:l}=t;return r(m9,{"number | BigNumber":function(t){if(!l(t)||s(t))throw TypeError("Non-negative integer value expected in function catalan");return n(o(a(t,2),t),i(t,1))}})});t.s(["createCatalan",0,ge],962971);var gt="composition",gr=ig(gt,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],t=>
1{var{typed:r,addScalar:i,combinations:n,isPositive:a,isNegative:o,isInteger:s,larger:l}=t;return r(gt,{"number | BigNumber, number | BigNumber":function(t,r){if(s(t)&&a(t)&&s(r)&&a(r)){if(l(r,t))throw TypeError("k must be less than or equal to n in function composition")}else throw TypeError("Positive integer value expected in function composition");return n(i(t,-1),i(r,-1))}})});t.s(["createComposition",0,gr],499979);var gi="leafCount",gn=ig(gi,["parse","typed"],t=>{var{parse:r,typed:i}=t;return i(gi,{Node:function(t){return function t(r){var i=0;return r.forEach(r=>{i+=t(r)}),i||1}(t)}})});function ga(t){return r4(t)||ir(t)&&t.isUnary()&&r4(t.args[0])}function go(t){return!!(r4(t)||(r8(t)||ir(t))&&t.args.every(go)||ii(t)&&go(t.content))}function gs(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function gl(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?gs(Object(i),!0).forEach(function(r){cv(t,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):gs(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}t.s(["createLeafCount",0,gn],757864);var gu=ig("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],t=>{var{FunctionNode:r,OperatorNode:i,SymbolNode:n}=t,a="defaultF",o={add:{trivial:!0,total:!0,commutative:!0,associative:!0},unaryPlus:{trivial:!0,total:!0,commutative:!0,associative:!0},subtract:{trivial:!1,total:!0,commutative:!1,associative:!1},multiply:{trivial:!0,total:!0,commutative:!0,associative:!0},divide:{trivial:!1,total:!0,commutative:!1,associative:!1},paren:{trivial:!0,total:!0,commutative:!0,associative:!1},defaultF:{trivial:!1,total:!0,commutative:!1,associative:!1}};function s(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o,n=a;if("string"==typeof t?n=t:ir(t)?n=t.fn.toString():r8(t)?n=t.name:ii(t)&&(n="paren"),im(i,n)){var s=i[n];if(im(s,r))return s[r];if(im(o,n))return o[n][r]}if(im(i,a)){var l=i[a];return im(l,r)?l[r]:o[a][r]}if(im(o,n)){var u=o[n];if(im(u,r))return u[r]}return o[a][r]}function l(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;return s(t,"associative",r)}function u(t,r){var i,n=[],a=function(t){for(var r=0;r<t.args.length;r++){var o=t.args[r];ir(o)&&i===o.op?a(o):n.push(o)}};return l(t,r)?(i=t.op,a(t),n):t.args}function c(t){return ir(t)?function(r){try{return new i(t.op,t.fn,r,t.implicit)}catch(t){return console.error(t),[]}}:function(i){return new r(new n(t.name),i)}}return{createMakeNodeFunction:c,hasProperty:s,isCommutative:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;return s(t,"commutative",r)},isAssociative:l,mergeContext:function(t,r){var i=gl({},t);for(var n in r)im(t,n)?i[n]=gl(gl({},r[n]),t[n]):i[n]=r[n];return i},flatten:function t(r,i){if(!r.args||0===r.args.length)return r;r.args=u(r,i);for(var n=0;n<r.args.length;n++)t(r.args[n],i)},allChildren:u,unflattenr:function t(r,i){if(r.args&&0!==r.args.length){for(var n=c(r),a=r.args.length,o=0;o<a;o++)t(r.args[o],i);if(a>2&&l(r,i)){for(var s=r.args.pop();r.args.length>0;)s=n([r.args.pop(),s]);r.args=s.args}}},unflattenl:function t(r,i){if(r.args&&0!==r.args.length){for(var n=c(r),a=r.args.length,o=0;o<a;o++)t(r.args[o],i);if(a>2&&l(r,i)){for(var s=r.args.shift();r.args.length>0;)s=n([s,r.args.shift()]);r.args=s.args}}},defaultContext:o,realContext:{divide:{total:!1},log:{total:!1}},positiveContext:{subtract:{total:!1},abs:{trivial:!0},log:{total:!0}}}}),gc=ig("simplify",["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],t=>{var{typed:r,parse:i,equal:n,resolve:a,simplifyConstant:o,simplifyCore:s,AccessorNode:l,ArrayNode:u,ConstantNode:c,FunctionNode:h,IndexNode:f,ObjectNode:d,OperatorNode:p,ParenthesisNode:m,SymbolNode:g,replacer:y}=t,{hasProperty:v,isCommutative:_,isAssociative:b,mergeContext:x,flatten:w,unflattenr:E,unflattenl:T,createMakeNodeFunction:A,defaultContext:S,realContext:C,positiveContext:M}=gu({FunctionNode:h,OperatorNode:p,SymbolNode:g});r.addConversion({from:"Object",to:"Map",convert:rS});var D=r("simplify",{Node:N,"Node, Map":(t,r)=>
1N(t,!1,r),"Node, Map, Object":(t,r,i)=>N(t,!1,r,i),"Node, Array":N,"Node, Array, Map":N,"Node, Array, Map, Object":N});function P(t){return t.transform(function(t){return ii(t)?P(t.content):t})}r.removeConversion({from:"Object",to:"Map",convert:rS}),D.defaultContext=S,D.realContext=C,D.positiveContext=M;var I={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};D.rules=[s,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},o,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},o,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];var k=0;function O(){return new g("_p"+k++)}function N(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rA(),o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=o.consoleDebug;r=function(t,r){for(var n=[],a=0;a<t.length;a++){var o=t[a],s=void 0,l=typeof o;switch(l){case"string":o={s:o};case"object":s=function(t,r){var n={};if(t.s){var a=t.s.split("->");if(2===a.length)n.l=a[0],n.r=a[1];else throw SyntaxError("Could not parse rule: "+t.s)}else n.l=t.l,n.r=t.r;for(var o of(n.l=P(i(n.l)),n.r=P(i(n.r)),["imposeContext","repeat","assuming"]))o in t&&(n[o]=t[o]);if(t.evaluate&&(n.evaluate=i(t.evaluate)),b(n.l,r)){var s,l=!_(n.l,r);l&&(s=O());var u=A(n.l),c=O();n.expanded={},n.expanded.l=u([n.l,c]),w(n.expanded.l,r),E(n.expanded.l,r),n.expanded.r=u([n.r,c]),l&&(n.expandedNC1={},n.expandedNC1.l=u([s,n.l]),n.expandedNC1.r=u([s,n.r]),n.expandedNC2={},n.expandedNC2.l=u([s,n.expanded.l]),n.expandedNC2.r=u([s,n.expanded.r]))}return n}(o,r);break;case"function":s=o;break;default:throw TypeError("Unsupported type of rule: "+l)}n.push(s)}return n}(r||D.rules,o.context);var l=a(t,n);l=P(l);for(var u={},c=l.toString({parenthesis:"all"});!u[c];){u[c]=!0,k=0;var h=c;s&&console.log("Working on: ",c);for(var f=0;f<r.length;f++){var d="";if("function"==typeof r[f]?(l=r[f](l,o),s&&(d=r[f].name)):(w(l,o.context),l=R(l,r[f],o.context),s&&(d="".concat(r[f].l.toString()," -> ").concat(r[f].r.toString()))),s){var p=l.toString({parenthesis:"all"});p!==h&&(console.log("Applying",d,"produced",p),h=p)}T(l,o.context)}c=l.toString({parenthesis:"all"})}return l}function L(t,r,i){var n=t;if(t)for(var a=0;a<t.length;++a){var o=R(t[a],r,i);o!==t[a]&&(n===t&&(n=t.slice()),n[a]=o)}return n}function R(t,r,i){if(r.assuming){for(var n in r.assuming)for(var a in r.assuming[n])if(v(n,a,i)!==r.assuming[n][a])return t}var o=x(r.imposeContext,i),s=t;if(s instanceof p||s instanceof h){var c=L(s.args,r,i);c!==s.args&&((s=s.clone()).args=c)}else if(s instanceof m){if(s.content){var g=R(s.content,r,i);g!==s.content&&(s=new m(g))}}else if(s instanceof u){var y=L(s.items,r,i);y!==s.items&&(s=new u(y))}else if(s instanceof l){var _=s.object;s.object&&(_=R(s.object,r,i));var b=s.index;s.index&&(b=R(s.index,r,i)),(_!==s.object||b!==s.index)&&(s=new l(_,b))}else if(s instanceof f){var w=L(s.dimensions,r,i);w!==s.dimensions&&(s=new f(w))}else if(s instanceof d){var E=!1,T={};for(var A in s.properties)T[A]=R(s.properties[A],r,i),T[A]!==s.properties[A]&&(E=!0);E&&(s=new d(T))}var S=r.r,C=B(r.l,s,o)[0];if(!C&&r.expanded&&(S=r.expanded.r,C=B(r.expanded.l,s,o)[0]),!C&&r.expandedNC1&&(S=r.expandedNC1.r,(C=B(r.expandedNC1.l,s,o)[0])||
1(S=r.expandedNC2.r,C=B(r.expandedNC2.l,s,o)[0])),C){var M=s.implicit;s=S.clone(),M&&"implicit"in S&&(s.implicit=!0),s=s.transform(function(t){return t.isSymbolNode&&im(C.placeholders,t.name)?C.placeholders[t.name].clone():t})}return r.repeat&&s!==t&&(s=R(s,r,i)),s}function F(t,r){var i,a=[];if(0===t.length||0===r.length)return a;for(var o=0;o<t.length;o++)for(var s=0;s<r.length;s++)(i=function(t,r){var i={placeholders:{}};if(!t.placeholders&&!r.placeholders)return i;if(!t.placeholders)return r;if(!r.placeholders)return t;for(var a in t.placeholders)if(im(t.placeholders,a)&&(i.placeholders[a]=t.placeholders[a],im(r.placeholders,a)&&!function t(r,i){if(r instanceof c&&i instanceof c){if(!n(r.value,i.value))return!1}else if(r instanceof g&&i instanceof g){if(r.name!==i.name)return!1}else{if((!(r instanceof p)||!(i instanceof p))&&(!(r instanceof h)||!(i instanceof h)))return!1;if(r instanceof p){if(r.op!==i.op||r.fn!==i.fn)return!1}else if(r instanceof h&&r.name!==i.name)return!1;if(r.args.length!==i.args.length)return!1;for(var a=0;a<r.args.length;a++)if(!t(r.args[a],i.args[a]))return!1}return!0}(t.placeholders[a],r.placeholders[a])))return null;for(var o in r.placeholders)im(r.placeholders,o)&&(i.placeholders[o]=r.placeholders[o]);return i}(t[o],r[s]))&&a.push(i);return a}function B(t,r,i,a){var o=[{placeholders:{}}];if(t instanceof p&&r instanceof p||t instanceof h&&r instanceof h){if(t instanceof p){if(t.op!==r.op||t.fn!==r.fn)return[]}else if(t instanceof h&&t.name!==r.name)return[];if(1===r.args.length&&1===t.args.length||!b(r,i)&&r.args.length===t.args.length||a){for(var s=[],l=0;l<t.args.length;l++){var u=B(t.args[l],r.args[l],i);if(0===u.length)break;s.push(u)}if(s.length!==t.args.length){if(!_(r,i)||1===t.args.length)return[];if(t.args.length>2)throw Error("permuting >2 commutative non-associative rule arguments not yet implemented");var f=B(t.args[0],r.args[1],i);if(0===f.length)return[];var d=B(t.args[1],r.args[0],i);if(0===d.length)return[];s=[f,d]}o=function(t){if(0===t.length)return t;for(var r=t.reduce(F),i=[],n={},a=0;a<r.length;a++){var o=JSON.stringify(r[a],y);n[o]||(n[o]=!0,i.push(r[a]))}return i}(s)}else if(r.args.length>=2&&2===t.args.length){for(var m=function(t,r){var i,n,a=[],o=A(t);if(_(t,r))for(var s=0;s<t.args.length;s++)(n=t.args.slice(0)).splice(s,1),i=1===n.length?n[0]:o(n),a.push(o([t.args[s],i]));else for(var l=1;l<t.args.length;l++){var u=t.args[0];l>1&&(u=o(t.args.slice(0,l))),i=1===(n=t.args.slice(l)).length?n[0]:o(n),a.push(o([u,i]))}return a}(r,i),v=[],x=0;x<m.length;x++){var w=B(t,m[x],i,!0);v=v.concat(w)}return v}else if(!(t.args.length>2))return[];else throw Error("Unexpected non-binary associative function: "+t.toString())}else if(t instanceof g){if(0===t.name.length)throw Error("Symbol in rule has 0 length...!?");if(I[t.name]){if(t.name!==r.name)return[]}else switch(t.name[1]>="a"&&t.name[1]<="z"?t.name.substring(0,2):t.name[0]){case"n":case"_p":o[0].placeholders[t.name]=r;break;case"c":case"cl":if(!r4(r))return[];o[0].placeholders[t.name]=r;break;case"v":if(r4(r))return[];o[0].placeholders[t.name]=r;break;case"vl":if(!is(r))return[];o[0].placeholders[t.name]=r;break;case"cd":if(!ga(r))return[];o[0].placeholders[t.name]=r;break;case"vd":if(ga(r))return[];o[0].placeholders[t.name]=r;break;case"ce":if(!go(r))return[];o[0].placeholders[t.name]=r;break;case"ve":if(go(r))return[];o[0].placeholders[t.name]=r;break;default:throw Error("Invalid symbol in rule: "+t.name)}}else if(!(t instanceof c))return[];else if(!n(t.value,r.value))return[];return o}return D});t.s(["createSimplify",0,gc],436627);var gh=ig("simplifyConstant",["typed","config","mathWithTransform","matrix","isBounded","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],t=>{var{typed:r,config:i,mathWithTransform:n,matrix:a,isBounded:o,fraction:s,bignumber:l,AccessorNode:u,ArrayNode:c,ConstantNode:h,FunctionNode:f,IndexNode:d,ObjectNode:p,OperatorNode:m,SymbolNode:g}=t,{isCommutative:y,isAssociative:v,allChildren:_,createMakeNodeFunction:b}=gu({FunctionNode:f,OperatorNode:m,SymbolNode:g}
1),x=r("simplifyConstant",{Node:t=>T(D(t,{})),"Node, Object":function(t,r){return T(D(t,r))}});function w(t,r,i){try{return n[t].apply(null,r)}catch(o){return r=r.map(function t(r){return rI(r)?r.valueOf():r instanceof Array?r.map(t):rL(r)?a(t(r.valueOf())):r}),S(n[t].apply(null,r),i)}}var E=r({Fraction:function(t){var r=t=>"BigNumber"===i.number&&l?l(t):Number(t),n=t.s*t.n,a=n<0n?new m("-","unaryMinus",[new h(-r(n))]):new h(r(n));return 1n===t.d?a:new m("/","divide",[a,new h(r(t.d))])},number:function(t){return t<0?C(new h(-t)):new h(t)},BigNumber:function(t){return t<0?C(new h(-t)):new h(t)},bigint:function(t){return t<0n?C(new h(-t)):new h(t)},Complex:function(t){throw Error("Cannot convert Complex number to Node")},string:function(t){return new h(t)},Matrix:function(t){return new c(t.valueOf().map(t=>E(t)))}});function T(t){return r9(t)?t:E(t)}function A(t,r){if(r&&!1!==r.exactFractions&&o(t)&&s){var i=s(t),n=r&&"number"==typeof r.fractionsLimit?r.fractionsLimit:1/0;if(i.valueOf()===t&&i.n<n&&i.d<n)return i}return t}var S=r({"string, Object":function(t,r){var n=iC(t,i);return"BigNumber"===n?(void 0===l&&uX(),l(t)):"bigint"===n?BigInt(t):"Fraction"===n?(void 0===s&&uK(),s(t)):A(parseFloat(t),r)},"Fraction, Object":function(t,r){return t},"BigNumber, Object":function(t,r){return t},"number, Object":function(t,r){return A(t,r)},"bigint, Object":function(t,r){return t},"Complex, Object":function(t,r){return 0!==t.im?t:A(t.re,r)},"Matrix, Object":function(t,r){return a(A(t.valueOf()))},"Array, Object":function(t,r){return t.map(A)}});function C(t){return new m("-","unaryMinus",[t])}function M(t,r,i,n){var a=r.shift(),o=r.reduce((r,a)=>{if(!r9(a)){var o=r.pop();if(r9(o))return[o,a];try{return r.push(w(t,[o,a],n)),r}catch(t){r.push(o)}}r.push(T(r.pop()));var s=1===r.length?r[0]:i(r);return[i([s,T(a)])]},[a]);return 1===o.length?o[0]:i([o[0],E(o[1])])}function D(t,r){switch(t.type){case"SymbolNode":return t;case"ConstantNode":switch(typeof t.value){case"number":case"bigint":return S(t.value,r);case"string":return t.value;default:if(!isNaN(t.value))return S(t.value,r)}return t;case"FunctionNode":if(n[t.name]&&n[t.name].rawArgs)return t;if(!["add","multiply"].includes(t.name)){var i=t.args.map(t=>D(t,r));if(!i.some(r9))try{return w(t.name,i,r)}catch(t){}if("size"===t.name&&1===i.length&&r0(i[0])){for(var o=[],s=i[0];r0(s);)o.push(s.items.length),s=s.items[0];return a(o)}return new f(t.name,i.map(T))}case"OperatorNode":var l,m,g=t.fn.toString(),E=b(t);if(ir(t)&&t.isUnary())m=r9((l=[D(t.args[0],r)])[0])?E(l):w(g,l,r);else if(v(t,r.context))if(l=(l=_(t,r.context)).map(t=>D(t,r)),y(g,r.context)){for(var A=[],C=[],P=0;P<l.length;P++)r9(l[P])?C.push(l[P]):A.push(l[P]);A.length>1?(m=M(g,A,E,r),C.unshift(m),m=M(g,C,E,r)):m=M(g,l,E,r)}else m=M(g,l,E,r);else m=M(g,l=t.args.map(t=>D(t,r)),E,r);return m;case"ParenthesisNode":return D(t.content,r);case"AccessorNode":return function(t,r,i){if(!r7(r))return new u(T(t),T(r));if(r0(t)||rL(t)){for(var n=Array.from(r.dimensions);n.length>0;)if(r4(n[0])&&"string"!=typeof n[0].value){var o=S(n.shift().value,i);r0(t)?t=t.items[o-1]:(t=t.valueOf()[o-1])instanceof Array&&(t=a(t))}else if(n.length>1&&r4(n[1])&&"string"!=typeof n[1].value){var s=S(n[1].value,i),l=[],f=r0(t)?t.items:t.valueOf();for(var p of f)if(r0(p))l.push(p.items[s-1]);else if(rL(t))l.push(p[s-1]);else break;if(l.length===f.length)t=r0(t)?new c(l):a(l),n.splice(1,1);else break}else break;return n.length===r.dimensions.length?new u(T(t),r):n.length>0?(r=new d(n),new u(T(t),r)):t}if(ie(t)&&1===r.dimensions.length&&r4(r.dimensions[0])){var m=r.dimensions[0].value;return m in t.properties?t.properties[m]:new h}return new u(T(t),r)}(D(t.object,r),D(t.index,r),r);case"ArrayNode":var I=t.items.map(t=>D(t,r));if(I.some(r9))return new c(I.map(T));return a(I);case"IndexNode":return new d(t.dimensions.map(t=>x(t,r)));case"ObjectNode":var k={};for(var O in t.properties)k[O]=x(t.properties[O],r);return new p(k);default:throw Error("Unimplemented node type in simplifyConstant: ".concat(t.type))}}return x});t.s(["createSimplifyConstant",0,gh],79116);var gf="simplifyCore",gd=ig(gf,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],t=>{var{typed:r,parse:i,equal:n,isZero:a,add:o,subtract:s,multiply:l,divide:u,pow:c,Acce
1ssorNode:h,ArrayNode:f,ConstantNode:d,FunctionNode:p,IndexNode:m,ObjectNode:g,OperatorNode:y,ParenthesisNode:v,SymbolNode:_}=t,b=new d(0),x=new d(1),w=new d(!0),E=new d(!1);function T(t){return ir(t)&&["and","not","or"].includes(t.op)}var{hasProperty:A,isCommutative:S}=gu({FunctionNode:p,OperatorNode:y,SymbolNode:_});function C(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r?r.context:void 0;if(A(t,"trivial",i)){if(r8(t)&&1===t.args.length)return C(t.args[0],r);var o=!1,s=0;if(t.forEach(t=>{1==++s&&(o=C(t,r))}),1===s)return o}var l=t;if(r8(l)){var u=function(t){var r="OperatorNode:"+t;for(var i of dV)if(r in i)return i[r].op;return null}(l.name);if(!u)return new p(C(l.fn),l.args.map(t=>C(t,r)));if(l.args.length>2&&A(l,"associative",i))for(;l.args.length>2;){var c=l.args.pop(),d=l.args.pop();l.args.push(new y(u,l.name,[c,d]))}l=new y(u,l.name,l.args)}if(ir(l)&&l.isUnary()){var v=C(l.args[0],r);if("~"===l.op&&ir(v)&&v.isUnary()&&"~"===v.op||"not"===l.op&&ir(v)&&v.isUnary()&&"not"===v.op&&T(v.args[0]))return v.args[0];var _=!0;if("-"===l.op&&ir(v)&&(v.isBinary()&&"subtract"===v.fn&&(l=new y("-","subtract",[v.args[1],v.args[0]]),_=!1),v.isUnary()&&"-"===v.op))return v.args[0];if(_)return new y(l.op,l.fn,[v])}if(ir(l)&&l.isBinary()){var M=C(l.args[0],r),D=C(l.args[1],r);if("+"===l.op){if(r4(M)&&a(M.value))return D;if(r4(D)&&a(D.value))return M;ir(D)&&D.isUnary()&&"-"===D.op&&(l=new y("-","subtract",[M,D=D.args[0]]))}if("-"===l.op)return ir(D)&&D.isUnary()&&"-"===D.op?C(new y("+","add",[M,D.args[0]]),r):r4(M)&&a(M.value)?C(new y("-","unaryMinus",[D])):r4(D)&&a(D.value)?M:new y(l.op,l.fn,[M,D]);if("*"===l.op){if(r4(M)){if(a(M.value))return b;else if(n(M.value,1))return D}if(r4(D)){if(a(D.value))return b;if(n(D.value,1))return M;if(S(l,i))return new y(l.op,l.fn,[D,M],l.implicit)}return new y(l.op,l.fn,[M,D],l.implicit)}if("/"===l.op)return r4(M)&&a(M.value)?b:r4(D)&&n(D.value,1)?M:new y(l.op,l.fn,[M,D]);if("^"===l.op&&r4(D)){if(a(D.value))return x;else if(n(D.value,1))return M}if("and"===l.op){if(r4(M))if(!M.value)return E;else{if(T(D))return D;if(r4(D))return D.value?w:E}if(r4(D)){if(!D.value)return E;else if(T(M))return M}}if("or"===l.op){if(r4(M)){if(M.value)return w;else if(T(D))return D}if(r4(D)){if(D.value)return w;else if(T(M))return M}}return new y(l.op,l.fn,[M,D])}if(ir(l))return new y(l.op,l.fn,l.args.map(t=>C(t,r)));if(r0(l))return new f(l.items.map(t=>C(t,r)));if(rJ(l))return new h(C(l.object,r),C(l.index,r));if(r7(l))return new m(l.dimensions.map(t=>C(t,r)));if(ie(l)){var P={};for(var I in l.properties)P[I]=C(l.properties[I],r);return new g(P)}return l}return r(gf,{Node:C,"Node,Object":C})});t.s(["createSimplifyCore",0,gd],705255);var gp=ig("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],t=>{var{typed:r,parse:i,ConstantNode:n,FunctionNode:a,OperatorNode:o,ParenthesisNode:s}=t;function l(t,r){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!r)return t;if(is(t)){if(u.has(t.name)){var c=Array.from(u).join(", ");throw ReferenceError("recursive loop of variable definitions among {".concat(c,"}"))}var h=r.get(t.name);if(r9(h)){var f=new Set(u);return f.add(t.name),l(h,r,f)}return"number"==typeof h?i(String(h)):void 0!==h?new n(h):t}if(ir(t)){var d=t.args.map(function(t){return l(t,r,u)});return new o(t.op,t.fn,d,t.implicit)}if(ii(t))return new s(l(t.content,r,u));if(r8(t)){var p=t.args.map(function(t){return l(t,r,u)});return new a(t.name,p)}return t.map(t=>l(t,r,u))}return r("resolve",{Node:l,"Node, Map | null | undefined":l,"Node, Object":(t,r)=>l(t,rS(r)),"Array | Matrix":r.referToSelf(t=>r=>r.map(r=>t(r))),"Array | Matrix, null | undefined":r.referToSelf(t=>r=>r.map(r=>t(r))),"Array, Object":r.referTo("Array,Map",t=>(r,i)=>t(r,rS(i))),"Matrix, Object":r.referTo("Matrix,Map",t=>(r,i)=>t(r,rS(i))),"Array | Matrix, Map":r.referToSelf(t=>(r,i)=>r.map(r=>t(r,i)))})});t.s(["createResolve",0,gp],119843);var gm="symbolicEqual",gg=ig(gm,["parse","simplify","typed","OperatorNode"],t=>{var{parse:r,simplify:i,typed:n,OperatorNode:a}=t;function o(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i(new a("-","subtract",[t,r]),{},n);return r4(o)&&!o.value}return n(gm,{"Node, Node":o,"Node, Node, Object":o})});t.s(["createSymbolicEqual",0,gg],849003);var gy="derivative",gv=ig(gy,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],t=>{var{typed:r,config:i,parse:n,simplify:a,equal:o,isZero:s,numeric:l,ConstantNode:u,FunctionNode:c,OperatorNode:h,ParenthesisNode:f,SymbolNode:d}=t;function p(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0},n=new Map,o=r.name,s=_(t,function t(r){var i=n.get(r);if(void 0!==i)return i;var a=v(t,r,o);return n.set(r,a),a});return i.simplify?a(s):s}function m(t){var r=n(t);if(!r.isSymbolNode)throw TypeError("Invalid variable. "+"Cannot parse ".concat(JSON.stringify(t)," into a variable in function derivative"));return r}var g=r(gy,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p,"Node, string":(t,r)=>p(t,m(r)),"Node, string, Object":(t,r,i)=>p(t,m(r),i)});g._simplify=!0,g.toTex=function(t){return y.apply(null,t.args)};var y=r("_derivTex",{"Node, SymbolNode":function(t,r){return r4(t)&&"string"===iu(t.value)?y(n(t.value).toString(),r.toString(),1):y(t.toTex(),r.toString(),1)},"Node, ConstantNode":function(t,r){if("string"===iu(r.value))return y(t,n(r.value));
1throw Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(t,r,i){return y(t.toString(),r.name,i.value)},"string, string, number":function(t,r,i){return(1===i?"{d\\over d"+r+"}":"{d^{"+i+"}\\over d"+r+"^{"+i+"}}")+"\\left[".concat(t,"\\right]")}}),v=r("_isConst",{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(t,r,i){return r.name!==i},"function, ParenthesisNode, string":function(t,r,i){return t(r.content,i)},"function, FunctionAssignmentNode, string":function(t,r,i){return!r.params.includes(i)||t(r.expr,i)},"function, FunctionNode | OperatorNode, string":function(t,r,i){return r.args.every(r=>t(r,i))}}),_=r("_derivative",{"ConstantNode, function":function(){return b(0)},"SymbolNode, function":function(t,r){return r(t)?b(0):b(1)},"ParenthesisNode, function":function(t,r){return new f(_(t.content,r))},"FunctionAssignmentNode, function":function(t,r){return r(t)?b(0):_(t.expr,r)},"FunctionNode, function":function(t,r){if(r(t))return b(0);var i,n,a,o,s=t.args[0],l=!1,u=!1;switch(t.name){case"cbrt":l=!0,n=new h("*","multiply",[b(3),new h("^","pow",[s,new h("/","divide",[b(2),b(3)])])]);break;case"sqrt":case"nthRoot":if(1===t.args.length)l=!0,n=new h("*","multiply",[b(2),new c("sqrt",[s])]);else if(2===t.args.length)return i=new h("/","divide",[b(1),t.args[1]]),_(new h("^","pow",[s,i]),r);break;case"log10":i=b(10);case"log":if(i||1!==t.args.length){if(1===t.args.length&&i||2===t.args.length&&r(t.args[1]))n=new h("*","multiply",[s.clone(),new c("log",[i||t.args[1]])]),l=!0;else if(2===t.args.length)return _(new h("/","divide",[new c("log",[s]),new c("log",[t.args[1]])]),r)}else n=s.clone(),l=!0;break;case"pow":if(2===t.args.length)return _(new h("^","pow",[s,t.args[1]]),r);break;case"exp":n=new c("exp",[s.clone()]);break;case"sin":n=new c("cos",[s.clone()]);break;case"cos":n=new h("-","unaryMinus",[new c("sin",[s.clone()])]);break;case"tan":n=new h("^","pow",[new c("sec",[s.clone()]),b(2)]);break;case"sec":n=new h("*","multiply",[t,new c("tan",[s.clone()])]);break;case"csc":u=!0,n=new h("*","multiply",[t,new c("cot",[s.clone()])]);break;case"cot":u=!0,n=new h("^","pow",[new c("csc",[s.clone()]),b(2)]);break;case"asin":l=!0,n=new c("sqrt",[new h("-","subtract",[b(1),new h("^","pow",[s.clone(),b(2)])])]);break;case"acos":l=!0,u=!0,n=new c("sqrt",[new h("-","subtract",[b(1),new h("^","pow",[s.clone(),b(2)])])]);break;case"atan":l=!0,n=new h("+","add",[new h("^","pow",[s.clone(),b(2)]),b(1)]);break;case"asec":l=!0,n=new h("*","multiply",[new c("abs",[s.clone()]),new c("sqrt",[new h("-","subtract",[new h("^","pow",[s.clone(),b(2)]),b(1)])])]);break;case"acsc":l=!0,u=!0,n=new h("*","multiply",[new c("abs",[s.clone()]),new c("sqrt",[new h("-","subtract",[new h("^","pow",[s.clone(),b(2)]),b(1)])])]);break;case"acot":l=!0,u=!0,n=new h("+","add",[new h("^","pow",[s.clone(),b(2)]),b(1)]);break;case"sinh":n=new c("cosh",[s.clone()]);break;case"cosh":n=new c("sinh",[s.clone()]);break;case"tanh":n=new h("^","pow",[new c("sech",[s.clone()]),b(2)]);break;case"sech":u=!0,n=new h("*","multiply",[t,new c("tanh",[s.clone()])]);break;case"csch":u=!0,n=new h("*","multiply",[t,new c("coth",[s.clone()])]);break;case"coth":u=!0,n=new h("^","pow",[new c("csch",[s.clone()]),b(2)]);break;case"asinh":l=!0,n=new c("sqrt",[new h("+","add",[new h("^","pow",[s.clone(),b(2)]),b(1)])]);break;case"acosh":l=!0,n=new c("sqrt",[new h("-","subtract",[new h("^","pow",[s.clone(),b(2)]),b(1)])]);break;case"atanh":l=!0,n=new h("-","subtract",[b(1),new h("^","pow",[s.clone(),b(2)])]);break;case"asech":l=!0,u=!0,n=new h("*","multiply",[s.clone(),new c("sqrt",[new h("-","subtract",[b(1),new h("^","pow",[s.clone(),b(2)])])])]);break;case"acsch":l=!0,u=!0,n=new h("*","multiply",[new c("abs",[s.clone()]),new c("sqrt",[new h("+","add",[new h("^","pow",[s.clone(),b(2)]),b(1)])])]);break;case"acoth":l=!0,u=!0,n=new h("-","subtract",[b(1),new h("^","pow",[s.clone(),b(2)])]);break;case"abs":n=new h("/","divide",[new c(new d("abs"),[s.clone()]),s.clone()]);break;default:throw Error('Cannot process function "'+t.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}l?(a="/",o="divide"):(a="*",o="multiply");var f=_(s,r);
1return u&&(f=new h("-","unaryMinus",[f])),new h(a,o,[f,n])},"OperatorNode, function":function(t,r){if(r(t))return b(0);if("+"===t.op)return new h(t.op,t.fn,t.args.map(function(t){return _(t,r)}));if("-"===t.op){if(t.isUnary())return new h(t.op,t.fn,[_(t.args[0],r)]);if(t.isBinary())return new h(t.op,t.fn,[_(t.args[0],r),_(t.args[1],r)])}if("*"===t.op){var i=t.args.filter(function(t){return r(t)});if(i.length>0){var n=t.args.filter(function(t){return!r(t)}),a=1===n.length?n[0]:new h("*","multiply",n);return new h("*","multiply",i.concat(_(a,r)))}return new h("+","add",t.args.map(function(i){return new h("*","multiply",t.args.map(function(t){return t===i?_(t,r):t.clone()}))}))}if("/"===t.op&&t.isBinary()){var l=t.args[0],u=t.args[1];return r(u)?new h("/","divide",[_(l,r),u]):r(l)?new h("*","multiply",[new h("-","unaryMinus",[l]),new h("/","divide",[_(u,r),new h("^","pow",[u.clone(),b(2)])])]):new h("/","divide",[new h("-","subtract",[new h("*","multiply",[_(l,r),u.clone()]),new h("*","multiply",[l.clone(),_(u,r)])]),new h("^","pow",[u.clone(),b(2)])])}if("^"===t.op&&t.isBinary()){var f=t.args[0],d=t.args[1];if(r(f))return r4(f)&&(s(f.value)||o(f.value,1))?b(0):new h("*","multiply",[t,new h("*","multiply",[new c("log",[f.clone()]),_(d.clone(),r)])]);if(r(d)){if(r4(d)){if(s(d.value))return b(0);if(o(d.value,1))return _(f,r)}var p=new h("^","pow",[f.clone(),new h("-","subtract",[d,b(1)])]);return new h("*","multiply",[d.clone(),new h("*","multiply",[_(f,r),p])])}return new h("*","multiply",[new h("^","pow",[f.clone(),d.clone()]),new h("+","add",[new h("*","multiply",[_(f,r),new h("/","divide",[d.clone(),f.clone()])]),new h("*","multiply",[_(d,r),new c("log",[f.clone()])])])])}throw Error('Cannot process operator "'+t.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function b(t,r){return new u(l(t,r||iC(String(t),i)))}return g});t.s(["createDerivative",0,gv],517034);var g_="rationalize",gb=ig(g_,["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],t=>{var{config:r,typed:i,equal:n,isZero:a,add:o,subtract:s,multiply:l,divide:u,pow:c,parse:h,simplifyConstant:f,simplifyCore:d,simplify:p,fraction:m,bignumber:g,mathWithTransform:y,matrix:v,AccessorNode:_,ArrayNode:b,ConstantNode:x,FunctionNode:w,IndexNode:E,ObjectNode:T,OperatorNode:A,SymbolNode:S,ParenthesisNode:C}=t;function M(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=(c=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],h=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],(m={}).firstRules=(u=[d,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}]).concat(c,h),m.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],m.sucDivRules=h,m.firstRulesAgain=u.concat(c),m.finalRules=[d,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],m),a=(g=t,y=r,v=!0,_=n.firstRules,b=[],w=p(g,_,y,{exactFractions:!1}),E="+-*"+((v=!!v)?"/":""),!function t(r){var i=r.type;if("FunctionNode"===i)throw Error("There is an unsolved function call");if("OperatorNode"===i)if("^"===r.op)if("ConstantNode"===r.args[1].type&&iS(parseFloat(r.args[1].value)))t(r.args[0]);else throw Error("There is a non-integer exponent");else{if(!E.includes(r.op))throw Error("Operator "+r.op+" invalid in polynomial expression");for(var n=0;n<r.args.length;n++)t(r.args[n])}
1else if("SymbolNode"===i){var a=r.name;-1===b.indexOf(a)&&b.push(a)}else if("ParenthesisNode"===i)t(r.content);else if("ConstantNode"!==i)throw Error("type "+i+" is not allowed in polynomial expression")}(w),(T={}).expression=w,T.variables=b,T),o=a.variables.length,s={exactFractions:!1},l={exactFractions:!0};if(t=a.expression,o>=1){t=function t(r,i,n){var a=r.type,o=arguments.length>1;if("OperatorNode"===a&&r.isBinary()){var s,l=!1;if("^"===r.op&&("ParenthesisNode"===r.args[0].type||"OperatorNode"===r.args[0].type)&&"ConstantNode"===r.args[1].type&&(l=(s=parseFloat(r.args[1].value))>=2&&iS(s)),l){if(s>2){var u=r.args[0],c=new A("^","pow",[r.args[0].cloneDeep(),new x(s-1)]);r=new A("*","multiply",[u,c])}else r=new A("*","multiply",[r.args[0],r.args[0].cloneDeep()]);o&&("content"===n?i.content=r:i.args[n]=r)}}if("ParenthesisNode"===a)t(r.content,r,"content");else if("ConstantNode"!==a&&"SymbolNode"!==a)for(var h=0;h<r.args.length;h++)t(r.args[h],r,h);if(!o)return r}(t);var u,c,h,m,g,y,v,_,b,w,E,T,S,C,M=!0,P=!1;for(t=p(t,n.firstRules,{},s);t=p(t,M?n.distrDivRules:n.sucDivRules,{},l),M=!M,(C=t.toString())!==S;)P=!0,S=C;
1P&&(t=p(t,n.firstRulesAgain,{},s)),t=p(t,n.finalRules,{},s)}var I=[],k={};return("OperatorNode"===t.type&&t.isBinary()&&"/"===t.op?(1===o&&(t.args[0]=D(t.args[0],I),t.args[1]=D(t.args[1])),i&&(k.numerator=t.args[0],k.denominator=t.args[1])):(1===o&&(t=D(t,I)),i&&(k.numerator=t,k.denominator=null)),i)?(k.coefficients=I,k.variables=a.variables,k.expression=t,k):t}return i(g_,{Node:M,"Node, boolean":(t,r)=>M(t,{},r),"Node, Object":M,"Node, Object, boolean":M});function D(t,r){void 0===r&&(r=[]),r[0]=0;var i,n={};n.cte=1,n.oper="+",n.fire="";var a=0,o="";(function t(i,n,s){var l=i.type;if("FunctionNode"===l)throw Error("There is an unsolved function call");if("OperatorNode"===l){if(!"+-*^".includes(i.op))throw Error("Operator "+i.op+" invalid");if(null!==n&&(("unaryMinus"===i.fn||"pow"===i.fn)&&"add"!==n.fn&&"subtract"!==n.fn&&"multiply"!==n.fn||("subtract"===i.fn||"add"===i.fn||"multiply"===i.fn)&&"add"!==n.fn&&"subtract"!==n.fn||("subtract"===i.fn||"add"===i.fn||"unaryMinus"===i.fn)&&0!==s.noFil))throw Error("Invalid "+i.op+" placing");("^"===i.op||"*"===i.op)&&(s.fire=i.op);for(var u=0;u<i.args.length;u++)"unaryMinus"===i.fn&&(s.oper="-"),("+"===i.op||"subtract"===i.fn)&&(s.fire="",s.cte=1,s.oper=0===u?"+":i.op),s.noFil=u,t(i.args[u],i,s)}else if("SymbolNode"===l){if(i.name!==o&&""!==o)throw Error("There is more than one variable");if(o=i.name,null===n){r[1]=1;return}if("^"===n.op&&0!==s.noFil)throw Error("In power the variable should be the first parameter");if("*"===n.op&&1!==s.noFil)throw Error("In multiply the variable should be the second parameter");(""===s.fire||"*"===s.fire)&&(a<1&&(r[1]=0),r[1]+=s.cte*("+"===s.oper?1:-1),a=Math.max(1,a))}else if("ConstantNode"===l){var c=parseFloat(i.value);if(null===n){r[0]=c;return}if("^"===n.op){if(1!==s.noFil)throw Error("Constant cannot be powered");if(!iS(c)||c<=0)throw Error("Non-integer exponent is not allowed");for(var h=a+1;h<c;h++)r[h]=0;c>a&&(r[c]=0),r[c]+=s.cte*("+"===s.oper?1:-1),a=Math.max(c,a);return}s.cte=c,""===s.fire&&(r[0]+=s.cte*("+"===s.oper?1:-1))}else throw Error("Type "+l+" is not allowed")})(t,null,n),a=r.length-1;for(var s=!0,l=a;l>=0;l--)if(0!==r[l]){var u=new x(s?r[l]:Math.abs(r[l])),c=r[l]<0?"-":"+";if(l>0){var h=new S(o);l>1&&(h=new A("^","pow",[h,new x(l)])),u=-1===r[l]&&s?new A("-","unaryMinus",[h]):1===Math.abs(r[l])?h:new A("*","multiply",[u,h])}i=s?u:"+"===c?new A("+","add",[i,u]):new A("-","subtract",[i,u]),s=!1}return s?new x(0):i}});t.s(["createRationalize",0,gb],518335);var gx="zpk2tf",gw=ig(gx,["typed","add","multiply","Complex","number"],t=>{var{typed:r,add:i,multiply:n,Complex:a,number:o}=t;return r(gx,{"Array,Array,number":function(t,r,i){return s(t,r,i)},"Array,Array":function(t,r){return s(t,r,1)},"Matrix,Matrix,number":function(t,r,i){return s(t.valueOf(),r.valueOf(),i)},"Matrix,Matrix":function(t,r){return s(t.valueOf(),r.valueOf(),1)}});function s(t,r,i){t.some(t=>"BigNumber"===t.type)&&(t=t.map(t=>o(t))),r.some(t=>"BigNumber"===t.type)&&(r=r.map(t=>o(t)));for(var s=[a(1,0)],u=[a(1,0)],c=0;c<t.length;c++){var h=t[c];"number"==typeof h&&(h=a(h,0)),s=l(s,[a(1,0),a(-h.re,-h.im)])}for(var f=0;f<r.length;f++){var d=r[f];"number"==typeof d&&(d=a(d,0)),u=l(u,[a(1,0),a(-d.re,-d.im)])}for(var p=0;p<s.length;p++)s[p]=n(s[p],i);return[s,u]}function l(t,r){for(var o=[],s=0;s<t.length+r.length-1;s++){o[s]=a(0,0);for(var l=0;l<t.length;l++)s-l>=0&&s-l<r.length&&(o[s]=i(o[s],n(t[l],r[s-l])))}return o}});t.s(["createZpk2tf",0,gw],537537);var gE="freqz",gT=ig(gE,["typed","add","multiply","Complex","divide","matrix"],t=>{var{typed:r,add:i,multiply:n,Complex:a,divide:o,matrix:s}=t;return r(gE,{"Array, Array":function(t,r){return l(t,r,u(512))},"Array, Array, Array":function(t,r,i){return l(t,r,i)},"Array, Array, number":function(t,r,i){if(i<0)throw Error("w must be a positive number");return l(t,r,u(i))},"Matrix, Matrix":function(t,r){var i=u(512),{w:n,h:a}=l(t.valueOf(),r.valueOf(),i);return{w:s(n),h:s(a)}},"Matrix, Matrix, Matrix":function(t,r,i){var{h:n}=l(t.valueOf(),r.valueOf(),i.valueOf());return{h:s(n),w:s(i)}},"Matrix, Matrix, number":function(t,r,i){if(i<0)throw Error("w must be a positive number");var n=u(i),{h:a}=l(t.valueOf(),r.valueOf(),n);return{h:s(a),w:s(n)}}});function l(t,r,s){for(var l=[],u=[],c=0;c<s.length;c++){for(var h=a(0,0),f=a(0,0),d=0;d<t.length;d++)h=i(h,n(t[d],a(Math.cos(-d*s[c]),Math.sin(-d*s[c]))));for(var p=0;p<r.length;p++)f=i(f,n(r[p],a(Math.cos(-p*s[c]),Math.sin(-p*s[c]))));l.push(h),u.push(f)}for(var m=[],g=0;g<l.length;g++)m.push(o(l[g],u[g]));return{h:m,w:s}}function u(t){for(var r=[],i=0;i<t;i++)r.push(i/t*Math.PI);return r}});t.s(["createFreqz",0,gT],272405);var gA=ig("reviver",["classes"],t=>{var{classes:r}=t;return function(t,i){var n=r[i&&i.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(i):i}});t.s(["createReviver",0,gA],578488);var gS=ig("replacer",[],()=>function(t,r){return"number"==typeof r&&(!Number.isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:"bigint"==typeof r?{mathjs:"bigint",value:String(r)}:r});t.s(["createReplacer",0,gS],243686);var gC=Math.PI,gM=2*Math.PI,gD=Math.E,gP=ig("true",[],()=>!0),gI=ig("false",[],()=>!1),gk=ig("null",[],()=>null),gO=gY("Infinity",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?new i(1/0):1/0}),gN=gY("NaN",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?new i(NaN):NaN}),gL=gY("pi",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?h9(i):gC}),gR=gY("tau",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?fe(i):gM}),gF=gY("e",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?h8(i):gD}),gB=gY("phi",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?h7(i):1.618033988749895}),gz=gY("LN2",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?new i(2).ln():Math.LN2}),gj=gY("LN10",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?new i(10).ln():Math.LN10}),gU=gY("LOG2E",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?new i(1).div(new i(2).ln()):Math.LOG2E}),gV=gY("LOG10E",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?new i(1).div(new i(10).ln()):Math.LOG10E}),g$=gY("SQRT1_2",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?new i("0.5").sqrt():Math.SQRT1_2}
1),gG=gY("SQRT2",["config","?BigNumber"],t=>{var{config:r,BigNumber:i}=t;return"BigNumber"===r.number?new i(2).sqrt():Math.SQRT2}),gq=gY("i",["Complex"],t=>{var{Complex:r}=t;return r.I}),gH=ig("PI",["pi"],t=>{var{pi:r}=t;return r}),gW=ig("E",["e"],t=>{var{e:r}=t;return r}),gZ=ig("version",[],()=>"15.2.0");function gY(t,r,i){return ig(t,r,i,{recreateOnConfigChange:!0})}t.s(["createE",0,gF,"createFalse",0,gI,"createI",0,gq,"createInfinity",0,gO,"createLN10",0,gj,"createLN2",0,gz,"createLOG10E",0,gV,"createLOG2E",0,gU,"createNaN",0,gN,"createNull",0,gk,"createPhi",0,gB,"createPi",0,gL,"createSQRT1_2",0,g$,"createSQRT2",0,gG,"createTau",0,gR,"createTrue",0,gP,"createUppercaseE",0,gW,"createUppercasePi",0,gH,"createVersion",0,gZ],691079);var gX=yF("speedOfLight","299792458","m s^-1"),gK=yF("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),gQ=yF("planckConstant","6.62607015e-34","J s"),gJ=yF("reducedPlanckConstant","1.0545718176461565e-34","J s"),g0=yF("magneticConstant","1.25663706212e-6","N A^-2"),g1=yF("electricConstant","8.8541878128e-12","F m^-1"),g2=yF("vacuumImpedance","376.730313667","ohm"),g3=yF("coulomb","8.987551792261171e9","N m^2 C^-2"),g4=yF("coulombConstant","8.987551792261171e9","N m^2 C^-2"),g6=yF("elementaryCharge","1.602176634e-19","C"),g5=yF("bohrMagneton","9.2740100783e-24","J T^-1"),g8=yF("conductanceQuantum","7.748091729863649e-5","S"),g7=yF("inverseConductanceQuantum","12906.403729652257","ohm"),g9=yF("magneticFluxQuantum","2.0678338484619295e-15","Wb"),ye=yF("nuclearMagneton","5.0507837461e-27","J T^-1"),yt=yF("klitzing","25812.807459304513","ohm"),yr=yF("bohrRadius","5.29177210903e-11","m"),yi=yF("classicalElectronRadius","2.8179403262e-15","m"),yn=yF("electronMass","9.1093837015e-31","kg"),ya=yF("fermiCoupling","1.1663787e-5","GeV^-2"),yo=yB("fineStructure",.0072973525693),ys=yF("hartreeEnergy","4.3597447222071e-18","J"),yl=yF("protonMass","1.67262192369e-27","kg"),yu=yF("deuteronMass","3.3435830926e-27","kg"),yc=yF("neutronMass","1.6749271613e-27","kg"),yh=yF("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),yf=yF("rydberg","10973731.568160","m^-1"),yd=yF("thomsonCrossSection","6.6524587321e-29","m^2"),yp=yB("weakMixingAngle",.2229),ym=yB("efimovFactor",22.7),yg=yF("atomicMass","1.66053906660e-27","kg"),yy=yF("avogadro","6.02214076e23","mol^-1"),yv=yF("boltzmann","1.380649e-23","J K^-1"),y_=yF("faraday","96485.33212331001","C mol^-1"),yb=yF("firstRadiation","3.7417718521927573e-16","W m^2"),yx=yF("loschmidt","2.686780111798444e25","m^-3"),yw=yF("gasConstant","8.31446261815324","J K^-1 mol^-1"),yE=yF("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),yT=yF("molarVolume","0.022413969545014137","m^3 mol^-1"),yA=yB("sackurTetrode",-1.16487052358),yS=yF("secondRadiation","0.014387768775039337","m K"),yC=yF("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),yM=yF("wienDisplacement","2.897771955e-3","m K"),yD=yF("molarMass","0.99999999965e-3","kg mol^-1"),yP=yF("molarMassC12","11.9999999958e-3","kg mol^-1"),yI=yF("gravity","9.80665","m s^-2"),yk=yF("planckLength","1.616255e-35","m"),yO=yF("planckMass","2.176435e-8","kg"),yN=yF("planckTime","5.391245e-44","s"),yL=yF("planckCharge","1.87554603778e-18","C"),yR=yF("planckTemperature","1.416785e+32","K");function yF(t,r,i){return ig(t,["config","Unit","BigNumber"],t=>{var{config:n,Unit:a,BigNumber:o}=t,s=new a("BigNumber"===n.number?new o(r):parseFloat(r),i);return s.fixPrefix=!0,s})}function yB(t,r){return ig(t,["config","BigNumber"],t=>{var{config:i,BigNumber:n}=t;return"BigNumber"===i.number?new n(r):r})}function yz(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}t.s(["createAtomicMass",0,yg,"createAvogadro",0,yy,"createBohrMagneton",0,g5,"createBohrRadius",0,yr,"createBoltzmann",0,yv,"createClassicalElectronRadius",0,yi,"createConductanceQuantum",0,g8,"createCoulomb",0,g3,"createCoulombConstant",0,g4,"createDeuteronMass",0,yu,"createEfimovFactor",0,ym,"createElectricConstant",0,g1,"createElectronMass",0,yn,"createElementaryCharge",0,g6,"createFaraday",0,y_,"createFermiCoupling",0,ya,"createFineStructure",0,yo,"createFirstRadiation",0,yb,"createGasConstant",0,yw,"createGravitationConstant",0,gK,"createGravity",0,yI,"createHartreeEnergy",0,ys,"createInverseConductanceQuantum",0,g7,"createKlitzing",0,yt,"createLoschmidt",0,yx,"createMagneticConstant",0,g0,"createMagneticFluxQuantum",0,g9,"createMolarMass",0,yD,"createMolarMassC12",0,yP,"createMolarPlanckConstant",0,yE,"createMolarVolume",0,yT,"createNeutronMass",0,yc,"createNuclearMagneton",0,ye,"createPlanckCharge",0,yL,"createPlanckConstant",0,gQ,"createPlanckLength",0,yk,"createPlanckMass",0,yO,"createPlanckTemperature",0,yR,"createPlanckTime",0,yN,"createProtonMass",0,yl,"createQuantumOfCirculation",0,yh,"createReducedPlanckConstant",0,gJ,"createRydberg",0,yf,"createSackurTetrode",0,yA,"createSecondRadiation",0,yS,"createSpeedOfLight",0,gX,"createStefanBoltzmann",0,yC,"createThomsonCrossSection",0,yd,"createVacuumImpedance",0,g2,"createWeakMixingAngle",0,yp,"createWienDisplacement",0,yM],3990);var yj=ig("mapSlices",["typed","isInteger"],t=>{var{typed:r,isInteger:i}=t,n=sG({typed:r,isInteger:i});return r("mapSlices",{"...any":function(t){var r=t[1];rC(r)?t[1]=r-1:rM(r)&&(t[1]=r.minus(1));try{return n.apply(null,t)}catch(t){throw dR(t)}}})},function(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};
1r%2?yz(Object(i),!0).forEach(function(r){cv(t,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):yz(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}({isTransformFunction:!0},sG.meta));t.s(["createMapSlicesTransform",0,yj],965571);var yU=ig("column",["typed","Index","matrix","range"],t=>{var{typed:r,Index:i,matrix:n,range:a}=t,o=uS({typed:r,Index:i,matrix:n,range:a});return r("column",{"...any":function(t){var r=t.length-1,i=t[r];rC(i)&&(t[r]=i-1);try{return o.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});function yV(t,r,i){var n=t.filter(function(t){return is(t)&&!(t.name in r)&&!i.has(t.name)})[0];if(!n)throw Error('No undefined variable found in inline expression "'+t+'"');var a=n.name,o=new Map,s=new rE(i,o,new Set([a])),l=t.compile();return function(t){return o.set(a,t),l.evaluate(s)}}t.s(["createColumnTransform",0,yU],131024);var y$=ig("transformCallback",["typed"],t=>{var{typed:r}=t;return function(t,i){return r.isTypedFunction(t)?function t(i,n){var a=Object.fromEntries(Object.entries(i.signatures).map(i=>{var[a,o]=i,s=a.split(",").length;return r.isTypedFunction(o)?[a,t(o,n)]:[a,yG(o,s,n)]}));return"string"==typeof i.name?r(i.name,a):r(a)}(t,i):yG(t,t.length,i)}});function yG(t,r,i){return r===i?t:r===i+1?function(){for(var r=arguments.length,n=Array(r),a=0;a<r;a++)n[a]=arguments[a];return t(...n.slice(0,i),yq(n[i]))}:r>i+1?function(){for(var r=arguments.length,n=Array(r),a=0;a<r;a++)n[a]=arguments[a];return t(...n.slice(0,i),yq(n[i]),...n.slice(i+1))}:t}function yq(t){return t.map(t=>t+1)}var yH=ig("filter",["typed"],t=>{var{typed:r}=t;function i(t,i,a){var o=uO({typed:r}),s=y$({typed:r});if(0===t.length)return o();var l=t[0];if(1===t.length)return o(l);var u=t.length-1,c=t[u];return l&&(l=n(l,a)),c&&(c=is(c)||r5(c)?n(c,a):yV(c,i,a)),o(l,s(c,u))}function n(t,r){return t.compile().evaluate(r)}return i.rawArgs=!0,i},{isTransformFunction:!0});t.s(["createFilterTransform",0,yH],474456);var yW=ig("forEach",["typed"],t=>{var{typed:r}=t,i=uB({typed:r}),n=y$({typed:r});function a(t,r,a){if(0===t.length)return i();var s=t[0];if(1===t.length)return i(s);var l=t.length-1,u=t[l];return s&&(s=o(s,a)),u&&(u=is(u)||r5(u)?o(u,a):yV(u,r,a)),i(s,n(u,l))}function o(t,r){return t.compile().evaluate(r)}return a.rawArgs=!0,a},{isTransformFunction:!0});t.s(["createForEachTransform",0,yW],262518);var yZ=ig("index",["Index","getMatrixDataType"],t=>{var{Index:r,getMatrixDataType:i}=t;return function(){for(var t=[],n=0,a=arguments.length;n<a;n++){var o=arguments[n];if(rz(o))o.start--,o.end-=o.step>0?0:2;else if(o&&!0===o.isSet)o=o.map(function(t){return t-1});else if(rN(o)||rL(o))"boolean"!==i(o)&&(o=o.map(function(t){return t-1}));else if(rC(o)||rD(o))o--;else if(rM(o))o=o.toNumber()-1;else if("string"==typeof o);else throw TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");t[n]=o}var s=new r;return r.apply(s,t),s}},{isTransformFunction:!0});t.s(["createIndexTransform",0,yZ],223553);var yY=ig("map",["typed"],t=>{var{typed:r}=t,i=uH({typed:r}),n=y$({typed:r});function a(t,r,a){if(0===t.length)return i();if(1===t.length)return i(t[0]);var o=t.length-1,s=t.slice(0,o),l=t[o];return s=s.map(t=>u(t,a)),l&&(l=is(l)||r5(l)?u(l,a):yV(l,r,a)),i(...s,n(l,o));function u(t,r){return t.compile().evaluate(r)}}return a.rawArgs=!0,a},{isTransformFunction:!0});function yX(t){if(2===t.length&&rR(t[0])){var r=(t=t.slice())[1];(rC(r)||rM(r))&&(t[1]=rC(r)?r-1:rM(r)?r.minus(1):r)}return t}t.s(["createMapTransform",0,yY],717013);var yK=ig("max",["typed","config","numeric","larger","isNaN"],t=>{var{typed:r,config:i,numeric:n,larger:a,isNaN:o}=t,s=hJ({typed:r,config:i,numeric:n,larger:a,isNaN:o});return r("max",{"...any":function(t){t=yX(t);try{return s.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createMaxTransform",0,yK],987247);var yQ=ig("mean",["typed","add","divide"],t=>{var{typed:r,add:i,divide:n}=t,a=ml({typed:r,add:i,divide:n});return r("mean",{"...any":function(t){t=yX(t);try{return a.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createMeanTransform",0,yQ],247817);var yJ=ig("min",["typed","config","numeric","smaller","isNaN"],t=>{var{typed:r,config:i,numeric:n,smaller:a,isNaN:o}=t,s=h0({typed:r,config:i,numeric:n,smaller:a,isNaN:o});return r("min",{"...any":function(t){t=yX(t);try{return s.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createMinTransform",0,yJ],809199);var y0=ig("range",["typed","config","?matrix","?bignumber","equal","smaller","smallerEq","larger","largerEq","add","isZero","isPositive"],t=>{var{typed:r,config:i,matrix:n,bignumber:a,equal:o,smaller:s,smallerEq:l,larger:u,largerEq:c,add:h,isZero:f,isPositive:d}=t,p=uJ({typed:r,config:i,matrix:n,bignumber:a,equal:o,smaller:s,smallerEq:l,larger:u,largerEq:c,add:h,isZero:f,isPositive:d});return r("range",{"...any":function(t){var r=t.length-1;return"boolean"!=typeof t[r]&&t.push(!0),p.apply(null,t)}})},{isTransformFunction:!0});t.s(["createRangeTransform",0,y0],379971);var y1=ig("row",["typed","Index","matrix","range"],t=>{var{typed:r,Index:i,matrix:n,range:a}=t,o=u8({typed:r,Index:i,matrix:n,range:a});return r("row",{"...any":function(t){var r=t.length-1,i=t[r];rC(i)&&(t[r]=i-1);try{return o.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createRowTransform",0,y1],68105);var y2=ig("subset",["typed","matrix","zeros","add"],t=>{var{typed:r,matrix:i,zeros:n,add:a}=t,o=ci({typed:r,matrix:i,zeros:n,add:a});return r("subset",{"...any":function(t){try{return o.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createSubsetTransform",0,y2],163934);var y3=ig("concat",["typed","matrix","isInteger"],t=>{var{typed:r,matrix:i,isInteger:n}=t,a=uT({typed:r,matrix:i,isInteger:n});return r("concat",{"...any":function(t){var r=t.length-1,i=t[r];rC(i)?t[r]=i-1:rM(i)&&(t[r]=i.minus(1));try{return a.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createConcatTransform",0,y3],72677);var y4="diff",y6=ig(y4,["typed","matrix","subtract","number","bignumber"],t=>{var{typed:r,matrix:i,subtract:n,number:a,bignumber:o}=t,s=uZ({typed:r,matrix:i,subtract:n,number:a,bignumber:o});return r(y4,{"...any":function(t){t=yX(t);try{return s.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createDiffTransform",0,y6],200397);var y5=ig("std",["typed","map","sqrt","variance"],t=>{var{typed:r,map:i,sqrt:n,variance:a}=t,o=my({typed:r,map:i,sqrt:n,variance:a});return r("std",{"...any":function(t){t=yX(t);try{return o.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createStdTransform",0,y5],714401);var y8=ig("sum",["typed","config","add","numeric"],t=>{var{typed:r,config:i,add:n,numeric:a}=t,o=mn({typed:r,config:i,add:n,numeric:a});return r("sum",{"...any":function(t){t=yX(t);try{return o.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createSumTransform",0,y8],892587);var y7=ig("quantileSeq",["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],t=>{var{typed:r,bignumber:i,add:n,subtract:a,divide:o,multiply:s,partitionSelect:l,compare:u,isInteger:c,smaller:h,smallerEq:f,larger:d,mapSlices:p}=t,m=mg({typed:r,bignumber:i,add:n,subtract:a,divide:o,multiply:s,partitionSelect:l,compare:u,isInteger:c,smaller:h,smallerEq:f,larger:d,mapSlices:p});return r("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(t,r,i)=>m(t,r,g(i)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(t,r,i,n)=>m(t,r,i,g(n)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(t,r,i)=>m(t,r,g(i)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(t,r,i,n)=>m(t,r,i,g(n))});function g(t){return yX([[],t])[1]}},{isTransformFunction:!0});t.s(["createQuantileSeqTransform",0,y7],867396);var y9="cumsum",ve=ig(y9,["typed","add","unaryPlus"],t=>{var{typed:r,add:i,unaryPlus:n}=t,a=mo({typed:r,add:i,unaryPlus:n});return r(y9,{"...any":function(t){if(2===t.length&&rR(t[0])){var r=t[1];rC(r)?t[1]=r-1:rM(r)&&(t[1]=r.minus(1))}try{return a.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createCumSumTransform",0,ve],880179);var vt="variance",vr=ig(vt,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],t=>{var{typed:r,add:i,subtract:n,multiply:a,divide:o,mapSlices:s,isNaN:l}=t,u=mp({typed:r,add:i,subtract:n,multiply:a,divide:o,mapSlices:s,isNaN:l});return r(vt,{"...any":function(t){t=yX(t);try{return u.apply(null,t)}catch(t){throw dR(t)}}})},{isTransformFunction:!0});t.s(["createVarianceTransform",0,vr],733327);var vi="print",vn=ig(vi,["typed","matrix","zeros","add"],t=>{var{typed:r,matrix:i,zeros:n,add:a}=t,o=cU({typed:r,matrix:i,zeros:n,add:a});return r(vi,{"string, Object | Array":function(t,r){return o(s(t),r)},"string, Object | Array, number | Object":function(t,r,i){return o(s(t),r,i)}});function s(t){return t.replace(cz,t=>"$"+t.slice(1).split(".").map(function(t){return!isNaN(t)&&t.length>0?parseInt(t)-1:t}).join("."))}},{isTransformFunction:!0});t.s(["createPrintTransform",0,vn],612415);var va=ig("and",["typed","matrix","zeros","add","equalScalar","not","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,zeros:a,not:o,concat:s}=t,l=hv({typed:r,matrix:i,equalScalar:n,zeros:a,not:o,concat:s});function u(t,r,i){var n=t[0].compile().evaluate(i);return(!!rR(n)||!!l(n,!0))&&l(n,t[1].compile().evaluate(i))}return u.rawArgs=!0,u},{isTransformFunction:!0});t.s(["createAndTransform",0,va],590016);var vo=ig("or",["typed","matrix","equalScalar","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,DenseMatrix:a,concat:o}=t,s=ux({typed:r,matrix:i,equalScalar:n,DenseMatrix:a,concat:o});function l(t,r,i){var n=t[0].compile().evaluate(i);return!!(!rR(n)&&s(n,!1))||s(n,t[1].compile().evaluate(i))}return l.rawArgs=!0,l},{isTransformFunction:!0});t.s(["createOrTransform",0,vo],166664);var vs=ig("nullish",["typed","matrix","size","flatten","deepEqual"],t=>{var{typed:r,matrix:i,size:n,flatten:a,deepEqual:o}=t,s=ub({typed:r,matrix:i,size:n,flatten:a,deepEqual:o});function l(t,r,i){var n=t[0].compile().evaluate(i);return rR(n)||null==n||void 0===n?s(n,t[1].compile().evaluate(i)):n}return l.rawArgs=!0,l},{isTransformFunction:!0});t.s(["createNullishTransform",0,vs],706964);var vl=ig("bitAnd",["typed","matrix","zeros","add","equalScalar","not","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,zeros:a,not:o,concat:s}=t,l=ue({typed:r,matrix:i,equalScalar:n,zeros:a,not:o,concat:s});function u(t,r,i){var n=t[0].compile().evaluate(i);if(!rR(n)){if(isNaN(n))return NaN;if(0===n||!1===n)return 0}return l(n,t[1].compile().evaluate(i))}return u.rawArgs=!0,u},{isTransformFunction:!0});t.s(["createBitAndTransform",0,vl],705218);var vu=ig("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],t=>{var{typed:r,matrix:i,equalScalar:n,DenseMatrix:a,concat:o}=t,s=un({typed:r,matrix:i,equalScalar:n,DenseMatrix:a,concat:o});function l(t,r,i){var n=t[0].compile().evaluate(i);if(!rR(n)){if(isNaN(n))return NaN;if(-1===n)return -1;if(!0===n)return 1}return s(n,t[1].compile().evaluate(i))}return l.rawArgs=!0,l},{isTransformFunction:!0});t.s(["createBitOrTransform",0,vu],625724);var vc=ig("num",["typed","fraction"],t=>{var{typed:r,fraction:i}=t;return r("num",{Fraction:t=>t.s*t.n,BigNumber:t=>{var r=i(t);return r.s*r.n},"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createNum",0,vc],118528);var vh=ig("den",["typed","fraction"],t=>{var{typed:r,fraction:i}=t;return r("den",{Fraction:t=>t.d,BigNumber:t=>i(t).d,"Array | Matrix":r.referToSelf(t=>r=>oP(r,t))})});t.s(["createDen",0,vh],208193),t.s(["createAbs",0,sV,"createAccessorNode",0,dz,"createAcos",0,ff,"createAcosh",0,fD,"createAcot",0,fI,"createAcoth",0,fO,"createAcsc",0,fL,"createAcsch",0,fF,"createAdd",0,dA,"createAddScalar",0,sW,"createAnd",0,hv,"createAndTransform",0,va,"createArg",0,ul,"createArrayNode",0,dU,"createAsec",0,fz,"createAsech",0,fU,"createAsin",0,f$,"createAsinh",0,fG,"createAssignmentNode",0,dZ,"createAtan",0,fq,"createAtan2",0,fW,"createAtanh",0,fY,"createAtomicMass",0,yg,"createAvogadro",0,yy,"createBellNumbers",0,m7,"createBernoulli",0,mx,"createBigNumberClass",0,ab,"createBigint",0,o7,"createBignumber",0,si,"createBin",0,cR,"createBitAnd",0,ue,"createBitAndTransform",0,vl,"createBitNot",0,ur,"createBitOr",0,un,"createBitOrTransform",0,vu,"createBitX
1or",0,us,"createBlockNode",0,dX,"createBohrMagneton",0,g5,"createBohrRadius",0,yr,"createBoltzmann",0,yv,"createBoolean",0,sr,"createCatalan",0,ge,"createCbrt",0,sK,"createCeil",0,s4,"createChain",0,pZ,"createChainClass",0,pU,"createClassicalElectronRadius",0,yi,"createClone",0,oS,"createColumn",0,uS,"createColumnTransform",0,yU,"createCombinations",0,mS,"createCombinationsWithRep",0,mD,"createCompare",0,hb,"createCompareNatural",0,hT,"createCompareText",0,hS,"createCompile",0,p_,"createComplex",0,sn,"createComplexClass",0,aD,"createComposition",0,gr,"createConcat",0,uT,"createConcatTransform",0,y3,"createConditionalNode",0,dQ,"createConductanceQuantum",0,g8,"createConj",0,uc,"createConstantNode",0,d8,"createCorr",0,m_,"createCos",0,fK,"createCosh",0,fJ,"createCot",0,f0,"createCoth",0,f2,"createCoulomb",0,g3,"createCoulombConstant",0,g4,"createCount",0,uM,"createCreateUnit",0,fc,"createCross",0,uP,"createCsc",0,f3,"createCsch",0,f6,"createCtranspose",0,ch,"createCube",0,s5,"createCumSum",0,mo,"createCumSumTransform",0,ve,"createDeepEqual",0,hq,"createDen",0,vh,"createDenseMatrixClass",0,oT,"createDerivative",0,gv,"createDet",0,pY,"createDeuteronMass",0,yu,"createDiag",0,uk,"createDiff",0,uZ,"createDiffTransform",0,y6,"createDistance",0,mr,"createDivide",0,me,"createDivideScalar",0,cX,"createDot",0,dP,"createDotDivide",0,he,"createDotMultiply",0,lH,"createDotPow",0,c7,"createE",0,gF,"createEfimovFactor",0,ym,"createEigs",0,pJ,"createElectricConstant",0,g1,"createElectronMass",0,yn,"createElementaryCharge",0,g6,"createEqual",0,hM,"createEqualScalar",0,o6,"createEqualText",0,hI,"createErf",0,cx,"createEvaluate",0,px,"createExp",0,s8,"createExpm",0,p1,"createExpm1",0,s9,"createFactorial",0,mU,"createFalse",0,gI,"createFaraday",0,y_,"createFermiCoupling",0,ya,"createFft",0,cp,"createFibonacciHeapClass",0,h4,"createFilter",0,uO,"createFilterTransform",0,yH,"createFineStructure",0,yo,"createFirstRadiation",0,yb,"createFix",0,lt,"createFlatten",0,uR,"createFloor",0,la,"createForEach",0,uB,"createForEachTransform",0,yW,"createFormat",0,cL,"createFraction",0,sa,"createFractionClass",0,aZ,"createFreqz",0,gT,"createFunctionAssignmentNode",0,d9,"createFunctionNode",0,pm,"createGamma",0,mF,"createGasConstant",0,yw,"createGcd",0,l_,"createGetMatrixDataType",0,uU,"createGravitationConstant",0,gK,"createGravity",0,yI,"createHartreeEnergy",0,ys,"createHasNumericValue",0,oG,"createHelp",0,pH,"createHelpClass",0,pj,"createHex",0,cB,"createHypot",0,dC,"createI",0,gq,"createIdentity",0,u$,"createIfft",0,cg,"createIm",0,uh,"createImmutableDenseMatrixClass",0,h1,"createIndex",0,dO,"createIndexClass",0,h2,"createIndexNode",0,pt,"createIndexTransform",0,yZ,"createInfinity",0,gO,"createIntersect",0,mi,"createInv",0,pX,"createInverseConductanceQuantum",0,g7,"createInvmod",0,l$,"createIsBounded",0,oQ,"createIsFinite",0,o0,"createIsInteger",0,oL,"createIsNaN",0,oX,"createIsNegative",0,oj,"createIsNumeric",0,oV,"createIsPositive",0,oH,"createIsPrime",0,cW,"createIsZero",0,oZ,"createKldivergence",0,m$,"createKlitzing",0,yt,"createKron",0,uq,"createLN10",0,gj,"createLN2",0,gz,"createLOG10E",0,gV,"createLOG2E",0,gU,"createLarger",0,hz,"createLargerEq",0,hV,"createLcm",0,lx,"createLeafCount",0,gn,"createLeftShift",0,hd,"createLgamma",0,mz,"createLog",0,c2,"createLog10",0,lA,"createLog1p",0,c4,"createLog2",0,lC,"createLoschmidt",0,yx,"createLsolve",0,hi,"createLsolveAll",0,hs,"createLup",0,pA,"createLusolve",0,pF,"createLyap",0,p9,"createMad",0,mh,"createMagneticConstant",0,g0,"createMagneticFluxQuantum",0,g9,"createMap",0,uH,"createMapSlices",0,sG,"createMapSlicesTransform",0,yj,"createMapTransform",0,yY,"createMatrix",0,ss,"createMatrixClass",0,aX,"createMatrixFromColumns",0,sd,"createMatrixFromFunction",0,su,"createMatrixFromRows",0,sh,"createMax",0,hJ,"createMaxTransform",0,yK,"createMean",0,ml,"createMeanTransform",0,yQ,"createMedian",0,mc,"createMin",0,h0,"createMinTransform",0,yJ,"createMod",0,lf,"createMode",0,cP,"createMolarMass",0,yD,"createMolarMassC12",0,yP,"createMolarPlanckConstant",0,yE,"createMolarVolume",0,yT,"createMultinomial",0,mq,"createMultiply",0,lP,"createMultiplyScalar",0,lM,"createNaN",0,gN,"createNeutronMass",0,yc,"createNode",0,dL,"createNorm",0,dD,"createNot",0,uv,"createNthRoot",0,lk,"createNthRoots",0,c5,"createNuclearMagneton",0,ye,"createNull",0,gk,"createNullish",0,ub,"createNullishTransform",0,vs,"createNum",0,vc,"createNumber",0,o8,"createNumeric",0,cZ,"createObjectNode",0,pi,"createOct",0,cF,"createOnes",0,uY,"createOperatorNode",0,po,"createOr",0,ux,"createOrTransform",0,vo,"createParenthesisNode",0,pl,"createParse",0,py,"createParser",0,pT,"createParserClass",0,pw,"createPartitionSelect",0,hX,"createPermutations",0,mW,"createPhi",0,gB,"createPi",0,gL,"createPickRandom",0,mJ,"createPinv",0,pQ,"createPlanckCharge",0,yL,"createPlanckConstant",0,gQ,"createPlanckLength",0,yk,"createPlanckMass",0,yO,"createPlanckTemperature",0,yR,"createPlanckTime",0,yN,"createPolynomialRoot",0,pz,"createPow",0,cK,"createPrint",0,cU,"createPrintTransform",0,vn,"createProd",0,cO,"createProtonMass",0,yl,"createQr",0,pS,"createQuantileSeq",0,mg,"createQuantileSeqTransform",0,y7,"createQuantumOfCirculation",0,yh,"createRandom",0,m2,"createRandomInt",0,m4,"createRange",0,uJ,"createRangeClass",0,aY,"createRangeNode",0,pc,"createRangeTransform",0,y0,"createRationalize",0,gb,"createRe",0,uf,"createReducedPlanckConstant",0,gJ,"createRelationalNode",0,pf,"createReplacer",0,gS,"createReshape",0,u1,"createResize",0,u2,"createResolve",0,gp,"createResultSet",0,i2,"createReviver",0,gA,"createRightArithShift",0,hm,"createRightLogShift",0,hy,"createRotate",0,u4,"createRotationMatrix",0,u5,"createRound",0,c0,"createRow",0,u8,"createRowTransform",0,y1,"createRydberg",0,yf,"createSQRT1_2",0,g$,"createSQRT2",0,gG,"createSackurTetrode",0,yA,"createSchur",0,p8,"createSec",0,f5,"createSech",0,f7,"createSecondRadiation",0,yS,"createSetCartesian",0,da,"createSetDifference",0,dl,"createSetDistinct",0,dc,"createSetIntersect",0,df,"createSetIsSubset",0,dp,"createSetMultiplicity",0,dg,"createSetPowerset",0,dv,"createSetSize",0,db,"createSetSymDifference",0,dw,"createSetUnion",0,dT,"createSign",0,lN,"createSimplify",0,gc,"createSimplifyConstant",0,gh,"createSimplifyCore",0,gd,"createSin",0,f9,"createSinh",0,dt,"createSize",0,u9,"createSlu",0,pN,"createSmaller",0,hO,"createSmallerEq",0,hR,"createSolveODE",0,cb,"createSort",0,hQ,"createSpaClass",0,h6,"createSparse",0,fl,"createSparseMatrixClass",0,o5,"createSpeedOfLight",0,gX,"createSplitUnit",0,sm,"createSqrt",0,lL,"createSqrtm",0,p3,"createSquare",0,lF,"createSqueeze",0,ct,"createStd",0,my,"createStdTransform",0,y5,"createStefanBoltzmann",0,yC,"createStirlingS2",0,m5,"createString",0,se,"createSubset",0,ci,"createSubsetTransform",0,y2,"createSubtract",0,lz,"createSubtractScalar",0,sY,"createSum",0,mn,"createSumTransform",0,y8,"createSylvester",0,p6,"createSymbolNode",0,pd,"createSymbolicEqual",0,gg,"createTan",0,dr,"createTanh",0,di,"createTau",0,gR,"createThomsonCrossSection",0,yd,"createTo",0,c$,"createToBest",0,cq,"createTrace",0,dI,"createTranspose",0,cu,"createTrue",0,gP,"createTypeOf",0,o2,"createTyped",0,iQ,"createUnaryMinus",0,sz,"createUnaryPlus",0,sU,"createUnequal",0,hW,"createUnitClass",0,fn,"createUnitFunction",0,fo,"createUppercaseE",0,gW,"createUppercasePi",0,gH,"createUsolve",0,ha,"createUsolveAll",0,hu,"createVacuumImpedance",0,g2,"createVariance",0,mp,"createVarianceTransform",0,vr,"createVersion",0,gZ,"createWeakMixingAngle",0,yp,"createWienDisplacement",0,yM,"createXgcd",0,lU,"createXor",0,uw,"createZeros",0,cd,"createZeta",0,cM,"createZ
1pk2tf",0,gw],244316);var vf=t.i(244316);let vd=iA(vf),vp=null,vm=[["01","Canada"],["10","Newfoundland and Labrador"],["11","Prince Edward Island"],["12","Nova Scotia"],["13","New Brunswick"],["24","Quebec"],["35","Ontario"],["46","Manitoba"],["47","Saskatchewan"],["48","Alberta"],["59","British Columbia"],["60","Yukon"],["61","Northwest Territories"],["62","Nunavut"]],vg=[7.1,4.9,.2,.1,.1,.4,.5,.5,.6,.8,1.2,1.9,3.1,4.9,7.5,11.6,18.7,30.7,53.2,92.8,187.8,0,8.9,6.1,.2,.1,.1,.6,.6,.5,.7,1,1.6,2.2,3.7,5.9,8.3,14.3,24.3,39.5,70.6,119,223.4,0,8.6,3.3,.1,.2,.2,.4,.4,.6,.6,1.1,1.1,1.9,3.6,4.7,8.9,12.2,23.6,35,60.5,107.2,213.9,0,9.1,4.3,.1,.1,.2,.5,.6,.5,.6,.9,1.4,2.2,3.8,5.3,8.4,14.4,21.9,36.5,62.4,103.8,198.3,0,8.6,4.6,.1,.1,.1,.5,.7,.7,.7,1,1.4,2.3,3.1,5,7.9,12.2,20.9,33.3,58.4,101.5,196.1,0,7.5,4.8,.2,.1,.1,.3,.4,.4,.5,.7,1.1,1.8,3,4.9,7.6,11.6,19.1,31.4,54.4,93.6,185.6,0,6.8,4.8,.2,.1,.1,.3,.4,.5,.6,.7,1.1,1.8,3,4.8,7.2,11.1,17.9,29.5,51.7,90.1,183.1,0,8.1,6.4,.2,.1,.2,.6,.9,.7,.9,1.2,1.7,2.4,3.6,5.6,8.9,13.9,21.1,33.5,56.5,98,198,0,8.6,6.6,.4,.1,.2,.7,.8,1,1,1.4,2,2.6,3.5,5.4,8.2,13.7,20.8,34.5,55.5,99.2,206.1,0,5.7,4.9,.2,.1,.1,.5,.7,.7,.7,.8,1.3,2.2,3.2,4.9,7.6,11.8,19.7,30.8,52.6,94.1,190.6,0,7.1,3.8,.2,.1,.1,.3,.6,.6,.7,.8,1.2,1.9,2.9,4.7,6.8,10.6,16.6,27.9,49.7,88.5,186,0,5.7,1.5,0,.2,.5,1.1,.5,1,1.5,1,1.9,2.9,4.1,5.3,11.1,18.2,25.9,36.6,71.1,155.2,219.6,0,4.5,6.4,.5,.1,.1,.9,1,.9,1.4,1.6,1.8,2.3,4.3,6.6,10.4,19.6,29.3,45,67,127.4,148.1,0,5.1,22.8,1,.5,.5,3.6,3.2,3.6,1.9,2.3,2.4,5.4,3.9,4.2,15.3,27.4,54.3,83.9,108,235.2,235.2,0],vy=null;function vv(t,r){let i=(vy||(vy={},vm.forEach(function(t,r){let i=vg.slice(1+22*r,21+22*r).map(function(t){return t/1e3}),n=i.shift(),a=i[0],o=i[1],s=(1-n/2)*Math.pow(1-a,4.5);for(let t=1;t<5;t++)s+=Math.pow(1-a,5-t)*Math.pow(1-o,t);let l=[];l[0]=s/5;for(let t=1;t<i.length;t++){let r=1;for(let n=0;n<5;n++)r*=1-function(t,r){let n,a,o;return t==i.length-1?(a=i[i.length-3],o=i[i.length-2],n=i[i.length-1]*Math.exp((r+.5)/5*Math.log(o/a)/6)):t==i.length-2?(a=i[i.length-3],n=(o=i[i.length-2])*Math.exp((r+.5)/5*Math.log(o/a))):(n=.3*(a=i[t])*Math.exp((r+.5)/5*Math.log((o=i[t+1])/a)),r+=.5,n+=.7*(r*o+(5-r)*a)/5),n}(t,n);l[t]=r}vy[t[0]]=l}),["60","61","62"].forEach(function(t){vy[t]=vy[t].map(function(t,r){return(t+vy["01"][r])/2})})),vy),n="CMA"===t.t||"CT"===t.t?t.ruid:t.id;if(!n)return 1;"s"===n[0]&&(n=n.split("_")[2]);let a=i[n=n.slice(0,2)];return(a?a[r/5]:1)||1}function v_(t,r){return t+r}function vb(t){return .5*vd.erf(-t/vd.SQRT2)}var vx=t.i(517711),vw=t.i(76734);let vE={center:[1/3,1/3,1/3],breaks:3,discrete:!0,hue:80,chroma:140,lightness:80,contrast:.4,spread:1};function vT(t){return t.map(t=>{var r;if(!t||!(Array.isArray(r=t)&&3===r.length&&r.every(t=>"number"==typeof t&&!Number.isNaN(t))))return null;let i=t[0]+t[1]+t[2];return 0===i?null:[t[0]/i,t[1]/i,t[2]/i]})}function vA(t){let r=t*t,i=[];for(let n=1;n<=r;n++){let a=Math.floor(Math.sqrt(r-n)),o=a*a,s=((-r+n+a*(a+2)+1)%2-3*o-3*n+3*r+1)/(6*t),l=-((-r+o+n+2*a+1)%2+3*a-3*t+1)/(3*t),u=((-r+o+n+2*a+1)%2+3*o+6*a+3*n-3*r+1)/(6*t);i.push({id:n,p1:s,p2:l,p3:u})}return i}function vS(t,r={}){var i,n;let a,{center:o,breaks:s,discrete:l,hue:u,chroma:c,lightness:h,contrast:f,spread:d}={...vE,...r};vT([...t]);let p=vT([...t]);if(l&&Number.isFinite(s)&&s<100){let t=vA(s).map(t=>[t.p1,t.p2,t.p3]);p=p.map(r=>{if(!r)return null;let i=t.map(t=>{let i=r[0]-t[0],n=r[1]-t[1],a=r[2]-t[2];return-(n*a+a*i+i*n)});return t[i.indexOf(Math.min(...i))]})}return(i=p,a=[1/o[0],1/o[1],1/o[2]],n=i.map(t=>{if(!t)return null;let r=[t[0]*a[0],t[1]*a[1],t[2]*a[2]],i=r[0]+r[1]+r[2];return[r[0]/i,r[1]/i,r[2]/i]}),n.map(t=>{if(!t)return null;let r=[Math.pow(t[0],d),Math.pow(t[1],d),Math.pow(t[2],d)],i=r[0]+r[1]+r[2];return[r[0]/i,r[1]/i,r[2]/i]})).map((t,r)=>{var i,n,a;let o,s,l,d,p,m,g,y,v,_,b,x,w,E;if(!t)return null;let T=t.map(t=>t*c),A=[u,u+120,u+240].map(t=>t*Math.PI/180).reduce((t,r,i)=>({re:t.re+T[i]*Math.cos(r),im:t.im+T[i]*Math.sin(r)}),{re:0,im:0}),S=(180*Math.atan2(A.im,A.re)/Math.PI+360)%360,C=Math.sqrt(A.re*A.re+A.im*A.im),M=C*f/c+1-f;return i=S,n=M*C,a=M*h,i=(i%360+360)%360,n=Math.max(0,Math.min(n,230)),o=i*Math.PI/180,s=a=Math.max(0,Math.min(a,100)),l=Math.cos(o)*n,d=Math.sin(o)*n,p=(s+16)/116,g=.95047*(m=t=>t>.206893034?Math.pow(t,3):(t-16/116)/7.787)(l/500+p),y=+m(p),_=3.2406*g-1.5372*y-.4986*(v=1.08883*m(p-d/200)),b=-.9689*g+1.8758*y+.0415*v,x=.0557*g-.204*y+1.057*v,_=(w=t=>t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t)(_),b=w(b),x=w(x),E=t=>{let r=Math.round(255*Math.max(0,Math.min(1,t))).toString(16);return 1===r.length?"0"+r:r},`#${E(_)}${E(b)}${E(x)}`})}function vC(t,r={}){let i=vS([t],r)[0];return i?[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)]:null}t.s(["colorMapTricolore",0,vS,"getTernaryMeshVertices",0,function(t,r={}){let i=vA(t),n=vS(i.map(t=>[t.p1,t.p2,t.p3]),{...r,breaks:t,discrete:!1}),a=[3*(r.center?.[0]??1/3),3*(r.center?.[1]??1/3),3*(r.center?.[2]??1/3)
1],o=t=>{let r=t[0]*a[0],i=t[1]*a[1],n=t[2]*a[2],o=r+i+n;return 0===o?[1/3,1/3,1/3]:[r/o,i/o,n/o]};return i.map((r,i)=>{let a=t-Math.floor(Math.sqrt(t*t-r.id)),s=r.id-(a-1)*(2*t-a+1),l=2*Math.pow(-1,s%2)/(3*t),u=Math.pow(-1,s%2)/(3*t),c=[r.p1-l,r.p2+u,r.p3+u],h=[r.p1+u,r.p2-l,r.p3+u],f=[r.p1+u,r.p2+u,r.p3-l];return{id:r.id,vertices:[o(c),o(h),o(f)],color:n[i]||"#585858"}})},"tricoloreToRgb",0,vC],166832);let vM={bins:3,color1:"#D4631A",color2:"#2166AC",baseColor:"#F2F2EF",darkenAmount:15},vD=t=>Math.max(0,Math.min(1,t)),vP=t=>t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,vI=t=>t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,vk=t=>t>.008856?Math.pow(t,1/3):7.787*t+16/116,vO=t=>t>.206897?Math.pow(t,3):(t-16/116)/7.787;function vN(t){let r=t.replace("#",""),i=3===r.length?r.split("").map(t=>t+t).join(""):r;return[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16)]}function vL(t){let r,i,n,a,o,s,l,u,[c,h,f]=vN(t);return r=vP(c/255),i=vP(h/255),a=vk((.4124564*r+.3575761*i+.1804375*(n=vP(f/255)))/.95047),o=vk((.2126729*r+.7151522*i+.072175*n)/1),s=vk((.0193339*r+.119192*i+.9503041*n)/1.08883),l=500*(a-o),u=200*(o-s),{l:116*o-16,c:Math.sqrt(l*l+u*u),h:(180*Math.atan2(u,l)/Math.PI+360)%360}}function vR(t,r,i){let n=t.l+(r.l-t.l)*i,a=t.c+(r.c-t.c)*i,o=r.h-t.h;return o>180&&(o-=360),o<-180&&(o+=360),{l:n,c:a,h:(t.h+o*i+360)%360}}function vF(t={}){var r,i;let n={...vM,...t},a=n.bins,o=vL(n.baseColor),s=vL(n.color1),l=vL(n.color2),u=(r=vR(s,l,.5),i=n.darkenAmount,{...r,l:Math.max(0,r.l-i)}),c=[];for(let t=0;t<a;t++){c[t]=[];let r=t/(a-1);for(let i=0;i<a;i++){let n=i/(a-1),h=vR(o,s,r),f=vR(l,u,r),d=vR(h,f,n);c[t][i]=function(t,r,i){let n,a,o,s,l,u,c,h,f,d,p,m,[g,y,v]=(a=Math.cos(n=i*Math.PI/180)*r,o=Math.sin(n)*r,l=.95047*vO(a/500+(s=(t+16)/116)),u=+vO(s),h=3.2404542*l-1.5371385*u-.4985314*(c=1.08883*vO(s-o/200)),f=-.969266*l+1.8760108*u+.041556*c,d=.0556434*l-.2040259*u+1.0572252*c,h=vI(h),f=vI(f),d=vI(d),[(p=t=>Math.round(255*vD(t)))(h),p(f),p(d)]);return m=t=>Math.round(255*vD(t/255)).toString(16).padStart(2,"0"),`#${m(g)}${m(y)}${m(v)}`}(d.l,d.c,d.h)}}return c}function vB(t,r,i={}){if(!isFinite(t)||!isFinite(r))return null;let n=function(t,r={}){let i=vF(r),n=r.bins??vM.bins;return t.map(t=>{if(null==t)return null;let[r,a]=t;if(!isFinite(r)||!isFinite(a))return null;let o=Math.round(vD(r)*(n-1)),s=Math.round(vD(a)*(n-1));return i[o][s]??null})}([[t,r]],i)[0];return n?vN(n):null}function vz(t,r){for(let i=0;i<r.length;i++)if(t<r[i])return i;return r.length}function vj(t,r){let i=r-1;return{xCuts:t.slice(0,i),yCuts:t.slice(i,2*i)}}t.s(["BIVARIATE_PRESETS",0,[{name:"RdBu",color1:"#c85a5a",color2:"#64acbe",baseColor:"#e8e8e8"},{name:"BuPu",color1:"#5ac8c8",color2:"#be64ac",baseColor:"#e8e8e8"},{name:"GnBu",color1:"#6c83b5",color2:"#73ae80",baseColor:"#e8e8e8"},{name:"PuOr",color1:"#c8b35a",color2:"#9972af",baseColor:"#e8e8e8"}],"applyBinCutoffs",0,vz,"bivariateToRgb",0,vB,"defaultBivariateOptions",0,vM,"generateBivariateGrid",0,vF,"splitBivariateDomain",0,vj],628172);var vU=t.i(905151);let vV=iA(vf);vV.import({array:function(...t){return t},wasserstein:function(...t){let r=t.length,i=1;r%2==1&&(i=t[r-1],r-=1);let n=t.slice(0,r/2).sort(),a=t.slice(r/2,r).sort(),o=n.map((t,r)=>vd.abs(a[r]-t)**i);return(o.reduce(v_)/(r/2))**(1/i)},ifge:function(t,r,i,n){return t>=r?i:n},dissimilarity:function(...t){let r=t.filter(function(t,r){return r%2==0}),i=r.reduce(v_),n=t.filter(function(t,r){return r%2==1}),a=n.reduce(v_);return n.map(function(t,n){return vd.abs(t/a-r[n]/i)}).reduce(v_)/2},diversity:function(...t){let r=t.map(t=>vd.square(t)).reduce(v_),i=t.reduce(v_);return 1-r/(i*i)},surprise2:function(...t){let r=t.shift(),i=t.shift();return void 0===r||void 0===i?0:function(t,r,i){let n;if(void 0===t)return 0;let a=i.map(function(){return 1/i.length}),o=i.map(function(i){return t/r-i/r}),s=o.map(function(t){return 1-Math.abs(t)}),l=a.map(function(t,r){return t*s[r]}),u=0,c=0,h=i.map(function(){return 0});for(n=0;n<l.length;n++){var f,d;u+=(f=l[n],d=a[n],f<=0||d<=0?0:Math.log(f/d)/Math.log(2)*f),c+=o[n]*a[n],h[n]+=vd.abs(o[n])}return c>=0?vd.abs(u):-1*vd.abs(u)}(r,i,t)},sum:vV.sum,cdf:vb,surprise:function(t,r,i,n){let a=(t-r)/n*vd.sqrt(i);
1return(1-(2-2*vb(vd.abs(a))))*vd.sign(a)},gini:function(...t){let r,i=[...t],n=i.length%2==1?i.pop():null,a=i.filter(function(t,r){return r%2==0}),o=a.reduce(v_),s=i.filter(function(t,r){return r%2==1}),l=s.length,u=s.map(function(t,r){return r<l-1?(t+s[r+1])/2:t+(t-s[r-1])});if(n){let t=a[l-1];if(t>0){let r=u.pop(),i=(n-u.map(function(t,r){return t*a[r]}).reduce(v_))/t;i>s[l-1]&&(r=i>r?i:(i+r)/2),u.push(r)}}let c=[0];for(r=0;r<l;r++)a[r]/=o,c.push(c[r]+u[r]*a[r]);return 1-a.map(function(t,r){return t*(c[r]+c[r+1])}).reduce(v_)/c[l]},gini2:function(...t){let r,i=[...t],n=i.length%2==1?i.pop():null,a=i.filter(function(t,r){return r%2==0}),o=a.reduce(v_),s=i.filter(function(t,r){return r%2==1}),l=s[s.length-1],u=a.pop(),c=u*(l+(l-s[s.length-2])),h=a.map(function(t,r){return t*(s[r]+s[r+1])/2});if(a.push(u),n&&u>0){let t=h.reduce(v_);n-t>c&&(c=n-t)}h.push(c);let f=[];for(r=0;r<h.length;r++){let t=h[r];r>0&&(t+=f[r-1]),f.push(t)}let d=0;for(r=0;r<h.length;r++){let t=f[r];r>0&&(t+=f[r-1]),d+=t*a[r]}return 1-d/f[f.length-1]/o},mortality:function(t){return vp?1-vv(vp,t):0},survival:function(t){return vp?vv(vp,t):1},levels:function(...t){if(!vp)return t[t.length-1];let r=t.indexOf(vp.t);return r>=0?t[r+1]:t[t.length-1]},pcce:function(t,r,i,n){return void 0===n||r>=n?{value:t/r,error:i/r}:"x"},pcc:function(t,r,i){return void 0===i||r>=i?t/r:"x"},quantile:function(...t){let r=[...t],i=r.pop(),n=r.filter(function(t,r){return r%2==0}),a=n.reduce(v_),o=r.filter(function(t,r){return r%2==1}),s=a*i,l=-1,u=0,c=0,h=0;for(;s>c&&u<n.length;)h=c,l=u,u+=1,c+=n[l];let f=l>0?o[l]:0,d=u<o.length?o[u]:2*o[o.length-1],p=(s-h)/(c-h);return d*p+f*(1-p)},countgz:function(...t){return t.filter(function(t){return t>0}).length},naz:function(t){return isNaN(t)?0:t}});class v${state={};domain=[];number_of_colors=void 0;range=[];domain_type=1;range_type=0;units=0;options={};vectors=[];variables=[];data_layers={};layer_array=[];map_scale=t3();functionString="";substitutedFunctionString="";valueFunction=()=>null;title="";label="";description="";user_id=0;author=null;created_at=null;data_attribution="";data_set_identifiers=[];geo_set_identifier="";shortValueFormatter=t=>t.toString();highlightColor=[200,200,200];widgetHighlightColor=vU.HIGHLIGHT_COLORS.HISTOGRAM_HIGHLIGHT;rangeHighlightColor=vU.HIGHLIGHT_COLORS.RANGE_HIGHLIGHT;displayedVariables=null;is_owner=!1;status=vw.MapStatus.Private;share_hash=null;defaultLat=null;defaultLng=null;defaultZoom=null;vectorInfo=null;defaultTricoloreOptions={breaks:3,discrete:!0,hue:80,chroma:140,lightness:80,contrast:.4,spread:1,center:[1/3,1/3,1/3]};tricoloreOptions=this.defaultTricoloreOptions;bivariateOptions={...vM};serverVariablesRegexp=RegExp("^v_.+_\\d+$|^a$|^nrr$|^pop$|^pop2$|^dw$|^hh$|^pop16$|^dw16$|^hh16$|^pop11$|^pop11_r$|^dw11$|^hh11$|^nt\\d+$|^nh\\d+$|^nm\\d+$|^nf\\d+$|^ct\\d+$|^ch\\d+$|^cm\\d+$|^cf\\d+$");functionList=["naz","max","min","abs","sum","ifge","countgz","dissimilarity","diversity","wasserstein","square","surprise","gini","quantile","categoryMax","sqrt","sign","kl","cdf","mortality","survival","pcc","pcce","dot","rgb","rgbt","rgba","log","array","levels"];computeHighlightColor(){let t=this.collectMapColors();return this.maxMinDistanceColor(t)}collectMapColors(){if(this.rgbColors()){let t={hue:this.tricoloreOptions.hue??80,chroma:this.tricoloreOptions.chroma??140,lightness:this.tricoloreOptions.lightness??80,discrete:!1},r=[];for(let i=0;i<=5;i++)for(let n=0;n<=5-i;n++){let a=5-i-n,o=vC([i/5,n/5,a/5],t);o&&r.push(o)}return r}if(this.bivariateColors()){let t=vF(this.bivariateOptions),r=[];for(let i of t)for(let t of i){let i=eu(t);i&&"r"in i&&"g"in i&&"b"in i&&r.push([i.r,i.g,i.b])}return r}let t=[];for(let r of this.range??[]){let i=eu(r);i&&"r"in i&&"g"in i&&"b"in i&&t.push([i.r,i.g,i.b])}return t}maxMinDistanceColor(t){if(0===t.length)return[255,200,0];let r=t.map(([t,r,i])=>rt(ed(t,r,i))),i=[255,200,0],n=-1;for(let t=0;t<360;t+=15)for(let a of[.25,.75]){let o=ew(t,.9,a).rgb();if(!isFinite(o.r)||!isFinite(o.g)||!isFinite(o.b))continue;let s=[Math.round(o.r),Math.round(o.g),Math.round(o.b)],l=rt(ed(s[0],s[1],s[2])),u=1/0;for(let t of r){if(!isFinite(t.l)||!isFinite(t.a)||!isFinite(t.b))continue;let r=l.l-t.l,i=l.a-t.a,n=l.b-t.b;u=Math.min(u,Math.sqrt(r*r+i*i+n*n))}u>n&&(n=u,i=s)}return i}static async create(t,r){let i=new v$,n=r??await i.fetchMap(t);return i.state=n,i.domain=n.domain.map(t=>+t),i.range=n.range,i.number_of_colors=+n.number_of_colors,isFinite(i.number_of_colors)||(i.number_of_colors=void 0),i.domain_type=+n.domain_type,i.range_type=+n.range_type,i.units=+n.units,30==i.units&&(i.units=32),i.options=n.options??{},void 0!==i.options.index&&(i.options.index=+i.options.index),i.vectors=(n.vectors??[]).sort(),i.variables=n.variables||[],i.title=n.title,i.label=n.label,i.description=n.description,i.user_id=n.user_id,i.author=n.author??null,i.created_at=n.created_at??null,i.is_owner=n.is_owner??!1,i.status=n.status??vw.MapStatus.Private,i.share_hash=n.share_hash??null,i.data_attribution=n.data_attribution,i.data_set_identifiers=n.data_set_identifiers,i.geo_set_identifier=n.geo_set_identifier,i.data_layers=n.data_layers,i.functionString=n.function_string,i.defaultLat=n.lat??null,i.defaultLng=n.lng??null,i.defaultZoom=n.zoom??null,i.layer_array=Object.keys(i.data_layers).map(t=>({key:t,...i.data_layers[t]})).sort((t,r)=>t.min-r.min),i.domain_type=n.domain_type||1,i.buildMapScale(),i.displayedVariables=i.getDisplayedVariables(),i.shortValueFormatter=i.shortFormatterForUnits(),i.options&&void 0!==i.options.index&&41!=i.units&&(i.shortValueFormatter=i.shortFormatterForUnits(i.unitsForVariableIndex(i.options.index))),i.setSubstitutedFunctionString(),i.setValueFunction(),i.highlightColor=i.computeHighlightColor(),i.rangeHighlightColor=i.computeHighlightColor(),i.widgetHighlightColor=i.computeHighlightColor(),i.fetchVectorInfo(),i}getDefaultLocation(){return null!==this.defaultLat&&null!==this.defaultLng&&null!==this.defaultZoom?{lat:this.defaultLat,lng:this.defaultLng,zoom:this.defaultZoom}:null}setTricoloreOptions(){this.tricoloreOptions={...this.tricoloreOptions,...void 0!==this.number_of_colors&&{breaks:this.number_of_colors},...void 0!==this.domain_type&&{discrete:2===this.domain_type},...void 0!==this.range&&{hue:+this.range[0]},...void 0!==this.range&&{chroma:+this.range[1]},...void 0!==this.range&&{lightness:+this.range[2]},...void 0!==this.range&&{contrast:+this.range[3]},...void 0!==this.domain&&{spread:this.domain[3]},...this.domain&&{center:this.domain.slice(0,3)}}}saveTricoloreOptions(t){this.number_of_colors=t.breaks??this.number_of_colors,this.domain_type=void 0!==t.discrete?t.discrete?2:1:this.domain_type,void 0!==t.hue&&(this.range[0]=t.hue.toString()),void 0!==t.chroma&&(this.range[1]=t.chroma.toString()),void 0!==t.lightness&&(this.range[2]=t.lightness.toString()),void 0!==t.contrast&&(this.range[3]=t.contrast.toString()),this.range.length>4&&(this.range=this.range.slice(0,4));
1let r=this.tricoloreOptions.center??this.defaultTricoloreOptions.center,i=this.tricoloreOptions.spread??this.defaultTricoloreOptions.spread??1;this.domain=[...r,i]}updateMapFunction(t){this.functionString=t,this.setState("function_string",t),this.buildMapScale(),this.displayedVariables=this.getDisplayedVariables(),this.setSubstitutedFunctionString(),this.setValueFunction()}mainWidget(){if(this.bivariateColors())return{type:"scatter-plot",formatter:this.shortValueFormatter};if([10,11,12,20,30,31,32,33,34,35,36,40,41,42,43].includes(this.units)){let t={type:"categories",balanced:[12,41,43].includes(this.units),formatter:this.shortValueFormatter};return this.options&&this.options.domainBounds&&(t.domainBounds=this.options.domainBounds),[40,41,42,43].includes(this.units)&&(t.colorFunction=(t,r)=>0==r%2?"steelblue":"lightblue"),t}return{type:"histogram"}}haveIndex(){return[40,41,42,43,44].includes(this.units)}isPubliclyShareable(){return this.status>=vw.MapStatus.Public||this.status===vw.MapStatus.Shared&&!!this.share_hash}async fetchMap(t){let r=new URLSearchParams(window.location.search).get("share_hash"),i=r?`/api/maps/${t}?share_hash=${encodeURIComponent(r)}`:`/api/maps/${t}`,n=await fetch(i);if(401===n.status||403===n.status){let t=encodeURIComponent(window.location.pathname+window.location.search);throw window.location.href=`/auth/login?returnTo=${t}`,Error("Authentication required")}if(404===n.status)throw Error("Map not found");if(!n.ok)throw Error(`Failed to load map: ${n.status}`);return await n.json()}async fetchVectorInfo(){if(!this.data_set_identifiers||0===this.data_set_identifiers.length)return;let t=(0,vx.getAPIBaseUrl)(),r={};await Promise.all(this.data_set_identifiers.map(async i=>{try{let n=await fetch(`${t}/map_api/vector_info/${i}.json`);n.ok&&(r[i]=await n.json())}catch(t){console.warn(`Failed to fetch vector_info for ${i}:`,t)}})),Object.keys(r).length>0&&(this.vectorInfo=r)}getState(t){return this.state[t]}setState(t,r){this.state[t]=r}resetState(){this.state={}}rgbColors(){return[10,11,12].includes(this.units)}rgbaColors(){return 12===this.units}rgbtColors(){return 11===this.units}dotColors(){return 20===this.units}categoryColors(){return[30,31,32,33,34,35,36].includes(this.units)}bivariateColors(){return this.units>=50&&this.units<=59}rangeColors(){return!this.rgbColors()&&!this.bivariateColors()}indexColors(){return this.units>=40&&this.units<=44}autoDomain(t=this.range.length){2===this.domain_type&&t--;let r=[this.domain[0],this.domain[this.domain.length-1]],i=(r[1]-r[0])/(t-1);return Array.from({length:t},(t,n)=>r[0]+n*i)}visibleLayerKeyForZoom(t){if(!this.layer_array||0===this.layer_array.length)return null;let r=this.layer_array[0].key;for(let i=0;i<this.layer_array.length;i++){let n=this.layer_array[i];if(t<n.min)break;r=n.key}return r}buildMapScale(){if(this.rgbColors())return void this.setTricoloreOptions();if(this.bivariateColors())return void this.setBivariateOptions();let t=this.domain;if(1===this.domain_type){let r=t.length!==this.range.length;r&&(t=this.autoDomain());let i=t3().domain(t).range(t);r&&i.nice(),this.map_scale=i}else t.length!==this.range.length-1&&(t=this.autoDomain(this.range.length)),this.map_scale=rc().domain(t).range(this.range);this.domain=this.map_scale.domain()}fillColor(t){if(!t||!t.properties)return[88,88,88];let r=this.valueFunction(t);return r&&"object"==typeof r&&r.fillColor?r.fillColor:[88,88,88]}colorForValue(t){if(null==t||!isFinite(t)||this.rgbColors())return[88,88,88];let r=eu(this.range[Math.min(Math.max(0,Math.floor((t-this.domain[0])/(this.domain[this.domain.length-1]-this.domain[0])*(this.range.length-1))),this.range.length-1)]);return r&&"r"in r&&"g"in r&&"b"in r?[r.r,r.g,r.b]:[88,88,88]}setSubstitutedFunctionString(){let t="variables",r=this.serverVariablesRegexp,i=this.functionList,n=this.variables.filter(t=>null!=t.value).map(t=>({key:t.key,value:t.value}));n.push({key:"___value",value:this.getState("function_string")});let a=[],o=!0,s=[];for(;n.length>0&&o;){o=!1;for(let l=0;l<n.length;l++){let u=n[l];if(!u.value)continue;let c=[...new Set(u.value.match(/\b[a-zA-Z_]\w*\b/g)||[])],h=c.filter(t=>r.test(t)),f=c.filter(t=>i.includes(t)),d=c.filter(t=>a.map(t=>t.key).includes(t)),p=c.filter(t=>"x"===t);if(h.length+f.length+d.length+p.length===c.length){h.forEach(t=>{u.value=u.value.replace(RegExp(`\\b${t}\\b`,"g"),`p.${t}`)}),d.forEach(r=>{u.value=u.value.replace(RegExp(`\\b${r}\\b`,"g"),`${t}.${r}`)}),f.forEach(t=>{["rgb","rgbt","rgba","categoryMax"].includes(t)&&(u.value=u.value.replace(RegExp(`\\b${t}\\b`,"g"),"array"))}),a.push(u),n.splice(l,1),s=s.concat(h),o=!0;break}}}let l=s.filter(t=>t.startsWith("v_")).sort();l.filter(t=>!this.vectors.includes(t)),this.vectors=l;let u=a.find(t=>"___value"===t.key),c=a.filter(t=>"___value"!==t.key);c.push({key:"rawValue",value:u?.value??"0"});let h=`${t}={};`;h+=c.map(r=>`${t}.${r.key}=${r.value};`).join(""),this.indexColors()?h+=`{variables:${t}, value:${t}.rawValue, mapValue:${t}.rawValue[${this.options.index+1}]}`:h+=`{variables:${t}, value:${t}.rawValue, mapValue:${t}.rawValue}`,this.substitutedFunctionString=h}updateOptions(t){this.options={...this.options,...t},void 0!==this.options.index&&(this.shortValueFormatter=this.shortFormatterForUnits(this.unitsForVariableIndex(this.options.index))),this.buildMapScale(),this.setSubstitutedFunctionString(),this.setValueFunction()}selectOptionIndex(t){this.options={...this.options,index:t},this.shortValueFormatter=this.shortFormatterForUnits(this.unitsForVariableIndex(t)),this.setValueFunction()}setValueFunction(){let t=this;this.valueFunction=function(r){try{if(!r||!r.properties)return console.error("Invalid input to valueFunction:",r),null;let i=r.properties.__value,n=t.indexColors()?t.options?.index:void 0;if(void 0!==n&&i&&"object"==typeof i&&Array.isArray(i.variables?.rawValue)){let a=i.variables.rawValue[n];return"object"!=typeof a||Array.isArray(a)||null===a||(void 0!==a.error&&(i.uncertainty=a.error),a=void 0!==a.value?a.value:a.values[0]),i.mapValue=a,i.fillColor=t.computeFillColor(a),r.properties.__value=i,i}if(vp=r.properties,!(i=vV.evaluate(t.substitutedFunctionString,{p:r.properties}
1))||"object"!=typeof i||!("entries"in i)||0===i.entries.length)return console.error("Invalid result from math.evaluate:",i),null;return i=i.entries[0],void 0!==n&&(i.mapValue=i.variables.rawValue[n]),"object"!=typeof i.mapValue||Array.isArray(i.mapValue)||null===i.mapValue||(void 0!==i.mapValue.error&&(i.uncertainty=i.mapValue.error),i.mapValue=void 0!==i.mapValue.value?i.mapValue.value:i.mapValue.values[0]),i.fillColor=t.computeFillColor(i.mapValue),r.properties.__value=i,i}catch(i){let t={variables:{},value:null,mapValue:null,fillColor:[88,88,88]};return r.properties.__value=t,t}},this.valueFunction=this.valueFunction.bind(this)}computeFillColor(t){let r=[88,88,88];if(null==t)return r;if(this.rgbColors()){if(!Array.isArray(t)||t.length<3)return r;let i=t.slice(0,3).map(t=>vV.abs(t)),n=i.reduce((t,r)=>t+r,0);return n<=0||5==t.length&&(n<t[3]||n>t[4])?r:vC([i[0]/n,i[1]/n,i[2]/n],this.tricoloreOptions)||r}if(this.bivariateColors()){if(!Array.isArray(t)||t.length<2)return r;let i=t[0],n=t[1];if(!isFinite(i)||!isFinite(n))return r;let a=this.bivariateOptions.bins??vM.bins,{xCuts:o,yCuts:s}=vj(this.domain,a);return vB(vz(i,o)/(a-1),vz(n,s)/(a-1),this.bivariateOptions)||r}if(this.categoryColors()){if(!Array.isArray(t)||0===t.length)return r;let i=t.indexOf(Math.max(...t)),n=eu(this.range[i]);return n&&"r"in n&&"g"in n&&"b"in n?[n.r,n.g,n.b]:r}{if(!isFinite(t))return r;let i=eu(String(this.map_scale(t)));return i&&"r"in i&&"g"in i&&"b"in i?[i.r,i.g,i.b]:r}}mainWidgetType(){return this.mapUnitInfo().graphType}getBarGraphLabels(){if(null==this.variables||0===this.variables.length||!this.displayedVariables)return[];let t=[];for(let r of this.displayedVariables){let i=this.variables.find(t=>t.key===r);i&&t.push(i.label)}return t}unitsForVariableIndex(t){if(null==this.variables||0===this.variables.length||!this.displayedVariables||t<0||t>=this.displayedVariables.length)return 0;let r=this.displayedVariables[t],i=this.variables.find(t=>t.key===r);return i?+i.units:0}shortFormatterForUnits(t){let r=t=>r=>t(r).replace(/(\.\d*?)0+([%kMGTPEZY]?)$/,"$1$2").replace(/\.([%kMGTPEZY]?)$/,"$1"),i=this.mapUnitInfo(t);return r("formatter_percentage"===i.id||"formatter_rgb"===i.id?i5(".2%"):"formatter_array_percentage_pm"===i.id?i5(".2%"):"formatter_percentage_100"===i.id?t=>i5(".2%")(t/100):"formatter_ratio"===i.id?i5(",.2f"):"formatter_numberr"===i.id?i5(".2s"):"formatter_currency"===i.id?i5("$.2s"):"formatter_currency_1000"===i.id?i5("$.2sk"):i5(".2s"))}longFormatterForUnits(t){let r=t=>r=>t(r).replace(/(\.\d*?)0+([%kMGTPEZY]?)$/,"$1$2").replace(/\.([%kMGTPEZY]?)$/,"$1"),i=this.mapUnitInfo(t);return"formatter_percentage"===i.id||"formatter_array_percentage_pm"===i.id?r(i5(".2%")):"formatter_percentage_100"===i.id?r(t=>i5(".2%")(t/100)):"formatter_ratio"===i.id?r(i5(".2s")):"formatter_currency"===i.id?t=>"$"+Math.round(t).toLocaleString():"formatter_currency_1000"===i.id?t=>"$"+Math.round(1e3*t).toLocaleString():t=>Math.round(t).toLocaleString()}mapUnitInfo(t){let r=[{id:"formatter_number",value:1,label:"Number",graphType:"histogram"},{id:"formatter_percentage",value:2,label:"Percentage",graphType:"histogram"},{id:"formatter_ratio",value:4,label:"Ratio",graphType:"histogram"},{id:"formatter_currency",value:3,label:"Currency",graphType:"histogram"},{id:"formatter_percentage_100",value:5,label:"Percentage 100",graphType:"histogram"},{id:"formatter_currency_1000",value:6,label:"Currency 1000s",graphType:"histogram"},{id:"formatter_rgb",value:10,label:"RGB",graphType:"tricolore"},{id:"formatter_rgbt",value:11,label:"RGBt",graphType:"tricolore"},{id:"formatter_rgba",value:12,label:"RGBa",graphType:"tricolore"},{id:"formatter_dot",value:20,label:"Dot",graphType:"bargraph"},{id:"formatter_category",value:31,label:"Category",graphType:"bargraph"},{id:"formatter_category",value:32,label:"Category",graphType:"bargraph"},{id:"formatter_category",value:33,label:"Category",graphType:"bargraph"},{id:"formatter_category",value:34,label:"Category",graphType:"bargraph"},{id:"formatter_category",value:35,label:"Category",graphType:"bargraph"},{id:"formatter_category",value:36,label:"Category",graphType:"bargraph"},{id:"formatter_array_percentage",value:40,label:"Array Percentage",graphType:"bargraph"},{id:"formatter_array_percentage_pm",value:41,label:"Array Percentage Zero Centered",graphType:"bargraphPM"},{id:"formatter_array_total",value:42,label:"Array Total",graphType:"bargraph"},{id:"formatter_total_pm",value:43,label:"Array Total Zero Centred",graphType:"bargraphPM"},{id:"formatter_percentage",value:44,label:"Array Selection Percentage",graphType:"histogram"},{id:"formatter_bivariate",value:50,label:"Bivariate (Scatter)",graphType:"bivariate"},{id:"formatter_bivariate",value:51,label:"Bivariate",graphType:"bivariate"},{id:"formatter_bivariate",value:52,label:"Bivariate",graphType:"bivariate"},{id:"formatter_bivariate",value:53,label:"Bivariate",graphType:"bivariate"},{id:"formatter_bivariate",value:54,label:"Bivariate",graphType:"bivariate"},{id:"formatter_bivariate",value:55,label:"Bivariate",graphType:"bivariate"},{id:"formatter_bivariate",value:56,label:"Bivariate",graphType:"bivariate"},{id:"formatter_bivariate",value:57,label:"Bivariate",graphType:"bivariate"},{id:"formatter_bivariate",value:58,label:"Bivariate",graphType:"bivariate"},{id:"formatter_bivariate",value:59,label:"Bivariate",graphType:"bivariate"}],i=void 0!==t?+t:+this.units,n=r.find(t=>t.value===i)||r[0];if(void 0===t&&this.options&&this.options.units){let t=r.find(t=>t.value===+this.options.units);t&&(n.id=t.id)}return n}fixedBarDomain(){return 42==this.units||12==this.units||this.categoryColors()}getSubMapOptionsLabels(){return null!=this.variables&&0!==this.variables.length&&this.haveIndex()&&this.displayedVariables?this.displayedVariables.map((t,r)=>{let i=this.variables.find(r=>r.key===t);return{label:i?i.label:t,key:t,index:r}}):[]}getDisplayedVariables(){let t=this.getState("function_string")||this.functionString;if(!t)return[];let r=(t=t.replace(/rgb\s*\(/g,"array(").replace(/rgbt\s*\(/g,"array(").replace(/rgba\s*\(/g,"array(").replace(/categoryMax\s*\(/g,"array(")).match(/array\(([^)]+)\)/);return r?r[1].split(",").map(t=>t.trim()).filter(t=>t.length>0):[]}getSubMapIndex(t){let r=-1;for(let i=0;i<this.variables.length;i++)if(this.variables[i].label==t){r=i;break}return r||0}getRgbLabels(){let t=["R","G","B"];if(!this.functionString)return t;let r=this.functionString.match(/rgba?\s*\(\s*([^,]+)\s*,\s*([^,]+)\s*,\s*([^,)]+)/i)||this.functionString.match(/rgbt\s*\(\s*([^,]+)\s*,\s*([^,]+)\s*,\s*([^,)]+)/i);return r?[r[1].trim(),r[2].trim(),r[3].trim()].map(t=>{let r=this.variables.find(r=>r.key===t);return r&&r.label?r.label:t}):t}getTricoloreOptions(){return this.setTricoloreOptions(),{...this.tricoloreOptions}}updateTricoloreOptions(t){this.tricoloreOptions={...this.tricoloreOptions,...t},this.saveTricoloreOptions(t),this.clearValueCache()}setBivariateOptions(){let t=void 0!==this.number_of_colors&&[2,3,4].includes(this.number_of_colors)?this.number_of_colors:vM.bins;this.bivariateOptions={bins:t,color1:this.range[0]??vM.color1,color2:this.range[1]??vM.color2,baseColor:this.range[2]??vM.baseColor,darkenAmount:void 0!==this.range[3]?+this.range[3]:vM.darkenAmount}}saveBivariateOptions(t){this.bivariateOptions={...this.bivariateOptions,...t};let r=this.bivariateOptions;this.number_of_colors=r.bins??vM.bins,this.range=[r.color1??vM.color1,r.color2??vM.color2,r.baseColor??vM.baseColor,String(r.dar
1kenAmount??vM.darkenAmount)];let i=2*(this.number_of_colors-1);this.domain.length!==i&&(this.domain=Array.from({length:i},(t,r)=>this.domain[r]??0))}updateBivariateOptions(t){this.saveBivariateOptions(t),this.clearValueCache()}clearValueCache(){this.setValueFunction()}getBivariateLabels(){let t=["X Axis","Y Axis"];if(!this.functionString)return t;let r=this.functionString.match(/array\s*\(\s*([^,]+)\s*,\s*([^,)]+)/i);if(!r)return t;let i=t=>{let r=t.trim(),i=this.variables.find(t=>t.key===r);return i?.label||r};return[i(r[1]),i(r[2])]}getBivariateFormatters(){let t=this.shortValueFormatter;if(!this.functionString)return[t,t];let r=this.functionString.match(/array\s*\(\s*([^,]+)\s*,\s*([^,)]+)/i);if(!r)return[t,t];let i=r=>{let i=this.variables.find(t=>t.key===r.trim());return i?this.shortFormatterForUnits(+i.units):t};return[i(r[1]),i(r[2])]}}t.s(["default",0,v$],310341)},931213,840170,964607,t=>{"use strict";let r;var i=t.i(843476),n=t.i(271645),a=t.i(264360),o=t.i(90522),s=t.i(429525),l=t.i(88014),u=t.i(837866),c=t.i(273447),h=t.i(310341),f=t.i(836807),d=t.i(641705),p=t.i(517711),m=t.i(338646),g=t.i(76734),y=t.i(142722),v=t.i(477713),_=t.i(891844),b=t.i(969353),x=t.i(905151),w=t.i(174080),E=t.i(647163),T=t.i(710632);t.i(947716);var A=t.i(47238),S=t.i(723685),C=t.i(479220),M=t.i(253913),D=t.i(279769),P=t.i(944307),I=t.i(523915);function k(t,r,i="inner-fan"){let n={name:"Census Data",children:[]};for(let[i,a]of Object.entries(t)){let t=function t(r,i,n){if(!r||"object"!=typeof r)return null;let a=r.name??"",o=r.short??a,s=1==r.prop,l=void 0!==r.units?Number(r.units):void 0,u=Array.isArray(r.key)?r.key:"string"==typeof r.key?[r.key]:[],c=Array.isArray(r.type)?r.type:[],h=[];if(Array.isArray(r.children))for(let a of r.children){let r=t(a,i,s||n);r&&h.push(r)}if(u.length>0&&0===h.length){if(1===u.length)return{name:a,short:o,size:1,value:R(i.graph_data[u[0]])??void 0,units:l};if(n){let t=c.findIndex(t=>"string"==typeof t&&"total"===t.toLowerCase());return{name:a,short:o,size:1,value:R(i.graph_data[u[t>=0?t:0]])??void 0,units:l}}let t=u.map((t,r)=>{let n=R(i.graph_data[t]);return{name:a+(c[r]?` (${c[r]})`:` [${r}]`),size:1,value:n??void 0,units:l}});return{name:a,children:t,units:l}}return h.length>0?{name:a,short:o,children:h,prop:s,units:l,value:(u.length>0?R(i.graph_data[u[0]]):null)??void 0}:u.length>0&&h.length>0?{name:a,short:o,children:h,prop:s,units:l,value:R(i.graph_data[u[0]])??void 0}:null}(a,r,!1);t&&n.children.push(t)}if((0,I.collapseGenericWrappers)(n),1===n.children.length){let t=n.children[0];return"inner-fan"===i&&O(t),t}return"inner-fan"===i&&O(n),n}function O(t){if(t.children&&0!==t.children.length){for(let r of t.children)O(r);if(t.prop)for(let r of t.children){let t=function t(r){if(r.children){let i=0;for(let n of r.children)i+=t(n);return i}return Math.max(0,r.value??0)}(r),i=N(r);i>0&&t>0&&L(r,t/i)}else for(let r of t.children){let t=N(r);t>0&&L(r,1/t)}}}function N(t){if(t.children){let r=0;for(let i of t.children)r+=N(i);return r}return t.size??0}function L(t,r){if(t.children)for(let i of t.children)L(i,r);else void 0!==t.size&&(t.size=Math.max(0,t.size*r))}function R(t){return(Array.isArray(t)&&(t=t[0]),"number"==typeof t)?t:"string"==typeof t&&null!==t?Number(t):null}function F({vectorInfo:t,mapId:r,geoUid:a,viewMode:o="inner-fan",onHierarchyChange:s}){let l=(0,n.useRef)(null),u=(0,n.useRef)(null),[c,h]=(0,n.useState)(!0),[f,d]=(0,n.useState)(null),[m,g]=(0,n.useState)(null),[y,v]=(0,n.use
1State)([]),[_,b]=(0,n.useState)(null),x=(0,n.useRef)(_);x.current=_;let w=(0,n.useRef)(null),T=(0,n.useRef)(o);T.current=o;let I=(0,n.useRef)([]),O=(0,n.useRef)(null);if((0,n.useEffect)(()=>{if(s)if(_){let t=[],r=_.node;for(;r;)t.unshift({name:r.data.name,value:r.data.value,units:r.data.units,isLeaf:r===_.node}),r=r.parent;s(t)}else y.length>0&&s(y.map(t=>({name:t.name,value:t.node.data.value,units:t.node.data.units})))},[y,_,s]),(0,n.useEffect)(()=>{y.length>0&&(I.current=V(y[y.length-1].node))},[y]),(0,n.useEffect)(()=>{O.current=_?V(_.node):null},[_]),(0,n.useEffect)(()=>{let t=!1;h(!0),d(null);let i=(0,p.getAPIBaseUrl)();return fetch(`${i}/map_api/geo_details/${r}/${a}.json`).then(t=>{if(!t.ok)throw Error(`Failed to fetch: ${t.status}`);return t.json()}).then(r=>{t||(g(r),h(!1))}).catch(r=>{t||(d(r.message),h(!1))}),()=>{t=!0}},[r,a]),(0,n.useEffect)(()=>{if(!m||!t||!u.current||!l.current)return;let r=k(t,m,"inner-fan"),i=k(t,m,"outer-fan"),n=l.current,a=n.getBoundingClientRect(),o=Math.min(a.width,a.height);if(o<=0)return;function s(t,n,a){let o,s=function(t,r,i,n,a,o,s,l){let u=S.select(t);u.selectAll("*").remove(),document.documentElement.classList.contains("dark");let c="#111827",h=C.hierarchy(r).sum(t=>t.size??0),f=C.hierarchy(i).sum(t=>t.size??0),d=h.height,p=M.partition().size([2*Math.PI,d+1]),m=p(h),g=p(f),y=m.descendants(),v=g.descendants();for(let t=0;t<y.length;t++){let r=y[t];r.innerX0=y[t].x0,r.innerX1=y[t].x1,r.outerX0=v[t].x0,r.outerX1=v[t].x1}let _=o;"outer-fan"===o&&m.each(t=>{t.x0=t.outerX0,t.x1=t.outerX1}),m.each(t=>{t.current={x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1}});let b=m,x=n/2-4,w=1.5;for(let t=0;t<d-1;t++)w+=Math.pow(.9,t);let E=x-a,T=d>0?E/w:E,I=[0];if(d>0){I.push(1.5*T);for(let t=0;t<d-1;t++)I.push(I[I.length-1]+T*Math.pow(.9,t))}let k=1.5*T,O=a;function N(t){if(t<=0)return 0;if(t<=1)return t*O;let r=t-1,i=Math.floor(r);if(i>=I.length-1)return O+I[I.length-1];let n=I[i]+(r-i)*(I[i+1]-I[i]);return O+n}function L(t){return D.arc().startAngle(t=>t.x0).endAngle(t=>t.x1).padAngle(t=>Math.min((t.x1-t.x0)/2,.003)).padRadius(1.5*O).innerRadius(t=>N(t.y0)).outerRadius(t=>Math.max(N(t.y0),N(t.y1)-1))(t)}u.attr("viewBox",`${-n/2} ${-n/2} ${n} ${n}`).attr("width",n).attr("height",n);let R=S.select(t.parentElement).selectAll(".sunburst-tooltip").data([null]);R=R.enter().append("div").attr("class","sunburst-tooltip").style("position","absolute").style("pointer-events","none").style("opacity","0").style("background","rgba(0,0,0,0.8)").style("color","white").style("padding","4px 8px").style("border-radius","4px").style("font-size","12px").style("z-index","100").style("line-height","1.4").style("max-width","300px").merge(R);let F=u.append("g").selectAll("path").data(m.descendants().slice(1)).join("path").attr("fill",t=>j(t,m)).attr("fill-opacity",t=>.85*!!G(t.current)).attr("pointer-events",t=>G(t.current)?"auto":"none").attr("d",t=>L(t.current)).attr("stroke",c).attr("stroke-width",.5).style("cursor","pointer").on("mouseover",function(t,r){S.select(this).attr("fill-opacity",1).attr("stroke-width",1.5);let i=r.ancestors().reverse().filter(t=>t!==m).map(t=>{let r=t.data.value,i=void 0!==r?`${t.data.name}: <b>${q(r)}</b>`:t.data.name;return`<div style="padding-left:1em;text-indent:-1em">${i}</div>`}).join("");R.style("opacity","1").html(i)}).on("mousemove",function(r){let i=t.parentElement.getBoundingClientRect();R.style("left",`${r.clientX-i.left+12}px`).style("top",`${r.clientY-i.top-20}px`)}).on("mouseout",function(t,r){let i=r===B;S.select(this).attr("fill-opacity",i?1:.85*!!G(r.current)).attr("stroke-width",i?2.5:.5),i&&S.select(this).attr("stroke","#fff"),R.style("opacity","0")}),B=null;function z(t){if(B){let t=B;F.filter(r=>r===t).attr("stroke",c).attr("stroke-width",.5).attr("fill-opacity",.85*!!G(t.current))}if(B=t){let t=B;F.filter(r=>r===t).attr("stroke","#fff").attr("stroke-width",2.5).attr("fill-opacity",1)}}F.filter(t=>!!t.children).on("click",function(t,r){z(null),l(null),Y(t,r)}),F.filter(t=>!t.children).on("click",function(t,r){let i=r.parent;i&&(Z.datum()!==i&&Y(t,i),z(r),l({name:r.data.name,node:r}))});let V=`sb-${Math.random().toString(36).slice(2,8)}`;function $(t){return Math.max(10,Math.min(18,.55*(Math.max(N(t.y0),N(t.y1)-1)-N(t.y0))))}
1let H=m.descendants().slice(1);function W(){u.selectAll(".label-defs").remove(),u.selectAll(".label-group").remove(),u.append("defs").attr("class","label-defs").selectAll("path").data(H).join("path").attr("id",(t,r)=>`${V}-${r}`).attr("d",t=>(function(t){let r=(N(t.y0)+Math.max(N(t.y0),N(t.y1)-1))/2;if(r<=0)return null;let i=t.x0,n=t.x1;n-i>Math.PI&&(n=i+Math.PI);let a=(i+n)/2,o=a>Math.PI/2&&a<3*Math.PI/2;o&&([i,n]=[n,i]);let s=r*Math.sin(i),l=-r*Math.cos(i),u=r*Math.sin(n),c=-r*Math.cos(n),h=+(Math.abs(n-i)>Math.PI);return`M${s},${l} A${r},${r} 0 ${h} ${+!o} ${u},${c}`})(t.current)),u.append("g").attr("class","label-group").attr("pointer-events","none").selectAll("text").data(H).join("text").attr("font-size",t=>$(t.current)).attr("fill",t=>A.hsl(j(t,m)).l<.55?"#fff":"#000").attr("fill-opacity",t=>{let r=t.data.short??t.data.name;return .85*!!function(t,r){if(!G(t))return!1;let i=(N(t.y0)+Math.max(N(t.y0),N(t.y1)-1))/2,n=(t.x1-t.x0)*i,a=$(t);return n>r.length*a*.65+1}(t.current,r)}).append("textPath").attr("href",(t,r)=>`#${V}-${r}`).attr("startOffset","50%").attr("text-anchor","middle").attr("dominant-baseline","central").text(t=>t.data.short??t.data.name)}W();let Z=u.append("circle").datum(m).attr("r",O).attr("fill","none").attr("pointer-events","all").style("cursor","pointer").on("click",function(t,r){z(null),l(null),Y(t,r)});function Y(t,r){b=r,Z.datum(r.parent||m);let i=r===m;m.each(t=>{t.target={x0:2*Math.max(0,Math.min(1,(t.x0-r.x0)/(r.x1-r.x0)))*Math.PI,x1:2*Math.max(0,Math.min(1,(t.x1-r.x0)/(r.x1-r.x0)))*Math.PI,y0:Math.max(0,t.y0-r.depth),y1:Math.max(0,t.y1-r.depth)}}),X(i?a:k),s(U(r))}function X(t){let r=O,i=t??O,n=u.transition().duration(750);i!==r&&Z.transition(n).attrTween("r",()=>{let t=P.interpolate(r,i);return r=>String(O=t(r))}),u.selectAll(".label-defs").remove(),u.selectAll(".label-group").remove(),F.transition(n).tween("data",t=>{let r=P.interpolate(t.current,t.target);return i=>{t.current=r(i)}}).filter(function(t){return!!this.getAttribute("d")||G(t.target)}).attr("fill-opacity",t=>.85*!!G(t.target)).attr("pointer-events",t=>G(t.target)?"auto":"none").attrTween("d",t=>()=>L(t.current)).end().then(()=>{if(W(),B){let t=B;F.filter(r=>r===t).attr("stroke","#fff").attr("stroke-width",2.5).attr("fill-opacity",1)}}).catch(()=>{})}function K(t){b=t,Z.datum(t.parent||m),O=t===m?a:k,Z.attr("r",O),m.each(r=>{let i={x0:2*Math.max(0,Math.min(1,(r.x0-t.x0)/(t.x1-t.x0)))*Math.PI,x1:2*Math.max(0,Math.min(1,(r.x1-t.x0)/(t.x1-t.x0)))*Math.PI,y0:Math.max(0,r.y0-t.depth),y1:Math.max(0,r.y1-t.depth)};r.current=i}),F.attr("d",t=>L(t.current)).attr("fill-opacity",t=>.85*!!G(t.current)).attr("pointer-events",t=>G(t.current)?"auto":"none"),W(),s(U(t))}return s(U(m)),{navigate:t=>{z(null),l(null),Y(null,t)},switchMode:function(t){if(t===_||"list"===t)return;_=t;let r="inner-fan"===t,i=b,n=r?i.innerX0:i.outerX0,a=r?i.innerX1:i.outerX1;m.each(t=>{t.x0=r?t.innerX0:t.outerX0,t.x1=r?t.innerX1:t.outerX1,t.target={x0:2*Math.max(0,Math.min(1,(t.x0-n)/(a-n)))*Math.PI,x1:2*Math.max(0,Math.min(1,(t.x1-n)/(a-n)))*Math.PI,y0:Math.max(0,t.y0-b.depth),y1:Math.max(0,t.y1-b.depth)}}),X()},selectLeaf:t=>{if(t){let r=t.parent;r&&b!==r&&K(r),z(t),l({name:t.data.name,node:t})}else z(null),l(null)},navigateAndSelect:(t,r)=>{b!==t&&Y(null,t),z(r),l({name:r.data.name,node:r})},zoomToImmediate:K,root:m}}(t,r,i,n,a,T.current,v,b);w.current=s;let l=I.current;(o=l.length>1?$(s.root,l):function(t){for(;t.children?.length===1;)t=t.children[0];return t}(s.root))!==s.root&&s.zoomToImmediate(o);let u=O.current;if(u){let t=$(s.root,u);t&&!t.children&&s.selectLeaf(t)}}s(u.current,o,o/12);let c=o,h=new ResizeObserver(()=>{if(!l.current||!u.current)return;let t=l.current.getBoundingClientRect(),r=Math.min(t.width,t.height);r<=0||4>Math.abs(r-c)||(c=r,s(u.current,r,r/12))});return h.observe(n),()=>h.disconnect()},[m,t]),(0,n.useEffect)(()=>{if("list"===o)return;let t=w.current;if(!t)return;t.switchMode(o);let r=x.current;if(r){let i=r.node.parent;i&&t.navigateAndSelect(i,r.node)}},[o]),c)return(0,i.jsx)("div",{className:"flex items-center justify-center h-full w-full text-gray-400 dark:text-gray-500 text-sm",children:"Loading census data..."});if(f)return(0,i.jsx)("div",{className:"flex items-center justify-center h-full w-full text-red-400 text-sm",children:f});let N="list"===o,L=y.length>0?y[y.length-1].node:null,R=y.length>0?y[0].node:null;return(0,i.jsxs)("div",{className:(0,E.cn)("w-full flex flex-col",N?"":"h-full"),children:[y.length>0&&(0,i.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5 text-xs text-gray-600 dark:text-gray-400 flex-wrap min-h-[28px]",children:y.map((t,r)=>(0,i.jsxs)(n.default.Fragment,{children:[r>0&&(0,i.jsx)("span",{className:"text-gray-400 dark:text-gray-500",children:"/"}),r<y.length-1?(0,i.jsx)("button",{className:"hover:text-blue-600 dar
1k:hover:text-blue-400 hover:underline cursor-pointer truncate max-w-[200px]",onClick:()=>w.current?.navigate(t.node),title:t.name,children:t.name}):(0,i.jsx)("span",{className:"font-semibold text-gray-900 dark:text-gray-100 truncate max-w-[200px]",title:t.name,children:t.name})]},r))}),(0,i.jsx)("div",{className:(0,E.cn)("relative",N?"h-0 overflow-hidden":"flex-1 min-h-0"),children:(0,i.jsx)("div",{ref:l,className:"absolute inset-0 flex items-center justify-center",children:(0,i.jsx)("svg",{ref:u})})}),N&&R&&(0,i.jsx)(B,{treeRoot:R,expandTo:L,selectedLeaf:_,onSelectLeaf:t=>{w.current?.selectLeaf(t)},onSelectBranch:t=>{w.current?.zoomToImmediate(t)}})]})}function B({treeRoot:t,expandTo:r,selectedLeaf:a,onSelectLeaf:o,onSelectBranch:s}){let[l,u]=(0,n.useState)(()=>{let i=new Set;if(r){let n=r;for(;n&&n!==t;)n.children&&i.add(n),n=n.parent}if(a){let r=a.node.parent;for(;r&&r!==t;)r.children&&i.add(r),r=r.parent}return i});n.default.useEffect(()=>{let i=new Set;if(r){let n=r;for(;n&&n!==t;)n.children&&i.add(n),n=n.parent}if(a){let r=a.node.parent;for(;r&&r!==t;)r.children&&i.add(r),r=r.parent}u(i)},[r,a,t]);let c=n.default.useCallback(t=>{u(r=>{let i=new Set(r);if(i.has(t)){i.delete(t);let r=t=>{t.children?.forEach(t=>{i.delete(t),r(t)})};r(t)}else i.add(t);return i})},[]),h=n.default.useMemo(()=>(function t(r,i,n){let a=[];if(!r.children)return a;for(let o of r.children)a.push({node:o,depth:i}),o.children&&n.has(o)&&a.push(...t(o,i+1,n));return a})(t,0,l),[t,l]);return(0,i.jsx)("div",{className:"px-3 py-2",children:h.map((t,r)=>{let n=!t.node.children,u=!n&&l.has(t.node),h=n&&a?.node===t.node,f=t.node.data.value;return(0,i.jsxs)("div",{className:["flex items-baseline gap-1 py-0.5 text-sm cursor-pointer rounded px-1",h?"bg-blue-100 dark:bg-blue-900/40 text-blue-800 dark:text-blue-200":n?"text-gray-800 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800":"text-gray-500 dark:text-gray-400 font-medium hover:bg-gray-100 dark:hover:bg-gray-800"].join(" "),style:{paddingLeft:`${16*t.depth+4}px`},onClick:()=>{n?o(t.node):(c(t.node),s(t.node))},children:[!n&&(0,i.jsx)("span",{className:"inline-block w-3 text-[10px] leading-none flex-shrink-0 text-center select-none",children:u?"â¼":"â¶"}),(0,i.jsx)("span",{className:n?"truncate pl-3":"truncate",children:t.node.data.name}),void 0!==f&&(0,i.jsx)("span",{className:["whitespace-nowrap tabular-nums ml-auto",h?"font-medium":"text-gray-600 dark:text-gray-400"].join(" "),children:q(f)})]},r)})})}let z=[210,30,140,0,270,60,330,180,90,300];function j(t,r){if(t===r)return"none";let i=[],n=t;for(;n.parent&&n.parent!==r;)i.push(n),n=n.parent;i.push(n);let a=i[i.length-1],o=(z[(r.children??[a]).indexOf(a)%z.length]+(t.depth-1)*15)%360,s=t.parent?.children??[t],l=s.indexOf(t),u=s.length,c=Math.max(30,65-5*t.depth);return A.hsl(o,c/100,(u<=1?60:40+l/(u-1)*45)/100).formatHex()}function U(t){let r=[],i=t;for(;i;)r.unshift({name:i.data.name,node:i}),i=i.parent;return r}function V(t){let r=[],i=t;for(;i;)r.unshift(i.data.name),i=i.parent;return r}function $(t,r){let i=t;for(let t=1;t<r.length;t++){let n=i.children?.find(i=>i.data.name===r[t]);if(!n)break;i=n}return i}function G(t){return t.y0>=1&&t.x1>t.x0}function q(t){return Math.abs(t)>=1e6?`${(t/1e6).toFixed(1)}M`:Math.abs(t)>=1e3?`${(t/1e3).toFixed(1)}K`:Number.isInteger(t)?t.toLocaleString():t.toFixed(2)}let H=[12,12];function W({position:t,visible:r=!0,offset:a=H,className:o,rows:s,children:l,containerRef:u,onClose:c}){let h=n.default.useRef(null);if(!t||!r)return null;let f=a[0],d=a[1],p=t.x+f,m=t.y+d,g=h.current;if(g){let r=g.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight;p+r.width>i-8&&(p=t.x-r.width-f),m+r.height>n-8&&(m=t.y-r.height-d),p=Math.max(8,p),m=Math.max(8,m)}let y=p,v=m;return(0,i.jsxs)("div",{ref:h,className:(0,E.cn)("fixed pointer-events-none z-50","bg-white/95 dark:bg-gray-900/95 backdrop-blur-sm","rounded-lg shadow-lg border border-gray-200 dark:border-gray-700","px-3 py-2 text-sm","transition-opacity duration-75",o),style:{left:y,top:v},children:[c&&(0,i.jsx)("button",{className:"absolute top-1 right-1 p-0.5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer",onClick:c,"aria-label":"Close",children:(0,i.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,i.jsx)("path",{d:"M3 3l8 8M11 3l-8 8"})})}),l??(s&&s.length>0&&(0,i.jsx)("div",{className:"space-y-1",children:s.map((t,r)=>(0,i.jsx)(Z,{label:t.label,value:t.value},`row-${r}`))}))]})}function Z({label:t,value:r}){return(0,i.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,i.jsxs)("span",{className:"font-medium text-gray-600 dark:text-gray-400",children:[t,":"]}),(0,i.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:r})]})}function Y(t){return"number"==typeof t?{value:t}:t&&"object"==typeof t&&!Array.isArray(t)&&"number"==typeof t.value?{value:t.value,uncertainty:"number"==typeof t.error?t.error:void 0}:null}function X(t,r){return void 0===t.uncertainty?r(t.value):(0,i.jsxs)(i.Fragment,{children:[r(t.value),(0,i.jsxs)("span",{className:"text-gray-500 dark:text-gray-400 font-normal text-xs ml-0.5",children:["±",r(t.uncertainty)]})]})}let K={DA:"Dissemination Area",CT:"Census Tract",CD:"Census Division",CSD:"Census Subdivision",CMA:"Census Metro Area",PR:"Province",C:"Canada",DB:"Dissemination Block",EA:"Enumeration Area"};function Q({feature:t,mapState:r,geoLevel:a,vectorInfo:o,mapId:s}
1){let[l,u]=(0,n.useState)(!1);return t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"space-y-1.5 max-w-72 pr-4",children:[(0,i.jsx)(J,{feature:t,mapState:r,geoLevel:a,vectorInfo:o}),(0,i.jsx)("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-1",children:(0,i.jsx)("button",{className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",onClick:()=>u(!0),children:"More..."})})]}),l&&(0,i.jsx)(ee,{feature:t,mapState:r,geoLevel:a,vectorInfo:o,mapId:s,onClose:()=>u(!1)})]}):null}function J({feature:t,mapState:r,geoLevel:a,vectorInfo:o,sunburstHierarchy:s}){let l,u,[c,h]=(0,n.useState)(!1),f=(0,n.useMemo)(()=>{if(!o||!r?.vectors?.length||!t)return[];let i=new Set(r.vectors),n=[];for(let r of Object.values(o))n.push(...function t(r,i,n,a){var o;if(!r||"object"!=typeof r)return[];if("Available data"===r.name&&Array.isArray(r.children)){let o=[];for(let s of r.children)o.push(...t(s,i,n,a));return o}let s=Array.isArray(o=r.key)?o:"string"==typeof o?[o]:[],l=Array.isArray(r.type)?r.type:[],u=[];for(let t=0;t<s.length;t++)i.has(s[t])&&u.push({index:t,key:s[t]});let c=[];if(Array.isArray(r.children))for(let o of r.children)c.push(...t(o,i,n,a+1));if(0===u.length&&0===c.length)return[];let h=[],f=void 0!==r.units?Number(r.units):void 0,d=null!=r.name?String(r.name):"";if(u.length>0)for(let t of u){let r=Y(n[t.key]),i=u.length>1&&l[t.index]?` (${l[t.index]})`:"";h.push({depth:a,name:d+i,isCategory:!1,value:r?.value,uncertainty:r?.uncertainty,units:f})}else h.push({depth:a,name:d,isCategory:!0});return h.push(...c),h}(r,i,t,0));return n},[o,r?.vectors,t]);if(!t)return null;let d=t.__value,p=r?.longFormatterForUnits()||(t=>String(t)),m=(0,T.featureDisplayName)(t),g=a?K[a]||a:null,y=r?.haveIndex(),v=r?.rgbColors(),_=[];void 0!==t.pop&&_.push({label:"Pop",value:t.pop}),void 0!==t.dw&&_.push({label:"Dw",value:t.dw}),void 0!==t.hh&&_.push({label:"Hh",value:t.hh});let b=[];void 0!==t.pop16&&b.push({label:"Pop '16",value:t.pop16}),void 0!==t.dw16&&b.push({label:"Dw '16",value:t.dw16}),void 0!==t.hh16&&b.push({label:"Hh '16",value:t.hh16}),void 0!==t.pop11&&b.push({label:"Pop '11",value:t.pop11}),void 0!==t.dw11&&b.push({label:"Dw '11",value:t.dw11}),void 0!==t.hh11&&b.push({label:"Hh '11",value:t.hh11});let x=!y&&!v&&r?.variables?.filter(t=>1==t.tooltip)||[];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"font-semibold text-gray-900 dark:text-gray-100 truncate",children:m}),g&&(0,i.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:g})]}),d&&(0,i.jsx)("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-1",children:v?(0,i.jsx)(et,{mapState:r,variables:d.variables}):y?(0,i.jsx)(er,{mapState:r,variables:d.variables,uncertainty:d.uncertainty}):(0,i.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,i.jsxs)("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:["number"==typeof d.mapValue?p(d.mapValue):"N/A",void 0!==d.uncertainty&&(0,i.jsxs)("span",{className:"text-gray-500 dark:text-gray-400 font-normal text-xs ml-0.5",children:["±",p(d.uncertainty)]})]}),r?.title&&(0,i.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:r.title})]})}),_.length>0&&(0,i.jsxs)("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-1",children:[(0,i.jsx)("div",{className:"flex gap-3 text-xs text-gray-600 dark:text-gray-400",children:_.map(t=>(0,i.jsxs)("span",{children:[(0,i.jsx)("span",{className:"font-medium",children:t.label})," ",t.value.toLocaleString()]},t.label))}),b.length>0&&(0,i.jsx)("div",{className:"flex gap-3 text-xs text-gray-500 dark:text-gray-500 mt-0.5",children:b.map(t=>(0,i.jsxs)("span",{children:[(0,i.jsx)("span",{className:"font-medium",children:t.label})," ",t.value.toLocaleString()]},t.label))})]}),x.length>0&&d?.variables&&(0,i.jsx)("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-1 space-y-0.5",children:x.map(t=>{let n=d.variables?.[t.key];if(void 0===n)return null;let a=r?.longFormatterForUnits(t.units)||p,o=Y(n);return(0,i.jsxs)("div",{className:"flex items-baseline gap-1.5 text-xs",children:[(0,i.jsxs)("span",{className:"text-gray-500 dark:text-gray-400 truncate",children:[t.label,":"]}
1),(0,i.jsx)("span",{className:"text-gray-900 dark:text-gray-100 font-medium",children:o?X(o,a):String(n)})]},t.key)})}),s&&s.length>1&&(u=(l=s.slice(1)).length>0&&l[l.length-1].isLeaf?l.length-2:l.length-1,(0,i.jsxs)("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-1",children:[(0,i.jsx)("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-medium mb-0.5",children:"Selected hierarchy"}),(0,i.jsx)("div",{className:"space-y-0.5",children:l.map((t,r)=>{var n;return(0,i.jsxs)("div",{className:(0,E.cn)("flex justify-between gap-2 text-xs",t.isLeaf&&"mt-1 pt-1 border-t border-gray-200 dark:border-gray-700"),style:{paddingLeft:`${10*r}px`},children:[(0,i.jsx)("span",{className:(0,E.cn)("truncate",t.isLeaf?"font-semibold text-blue-700 dark:text-blue-300":r===u?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"),children:t.name}),void 0!==t.value&&(0,i.jsx)("span",{className:(0,E.cn)("font-medium whitespace-nowrap",t.isLeaf?"text-blue-700 dark:text-blue-300":"text-gray-900 dark:text-gray-100"),children:Math.abs(n=t.value)>=1e6?`${(n/1e6).toFixed(1)}M`:Math.abs(n)>=1e3?`${(n/1e3).toFixed(1)}K`:Number.isInteger(n)?n.toLocaleString():n.toFixed(2)})]},r)})})]})),f.length>0&&(0,i.jsxs)("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-1",children:[(0,i.jsx)("button",{className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",onClick:()=>h(!c),children:c?"Hide variables":"All variables..."}),c&&(0,i.jsx)("div",{className:"mt-1 max-h-60 overflow-y-auto",children:f.map((t,n)=>(0,i.jsx)("div",{className:(0,E.cn)("text-xs leading-snug",t.isCategory?"text-gray-500 dark:text-gray-400 font-medium mt-0.5":"text-gray-800 dark:text-gray-200"),style:{paddingLeft:`${10*t.depth}px`},children:t.isCategory?t.name:(0,i.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,i.jsx)("span",{className:"truncate",children:t.name}),(0,i.jsx)("span",{className:"text-gray-900 dark:text-gray-100 font-medium whitespace-nowrap",children:void 0!==t.value?X({value:t.value,uncertainty:t.uncertainty},r.longFormatterForUnits(t.units)):""})]})},n))})]})]})}function ee({feature:t,mapState:r,geoLevel:a,vectorInfo:o,mapId:s,onClose:l}){let{isSm:u}=(0,f.useBreakpoint)(),[c,h]=(0,n.useState)([]),[d,p]=(0,n.useState)("inner-fan");return(0,w.createPortal)((0,i.jsxs)("div",{className:"fixed inset-0 z-[60] bg-white dark:bg-gray-900 flex flex-col",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[(0,i.jsx)("div",{className:"flex items-center gap-0.5 bg-gray-100 dark:bg-gray-800 rounded-md p-0.5",children:[{value:"outer-fan",label:"Outer fan"},{value:"inner-fan",label:"Inner fan"},{value:"list",label:"List"}].map(t=>(0,i.jsx)("button",{className:(0,E.cn)("px-3 py-1 text-xs font-medium rounded cursor-pointer transition-colors",d===t.value?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),onClick:()=>p(t.value),children:t.label},t.value))}),(0,i.jsx)("button",{className:"p-1.5 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer",onClick:l,"aria-label":"Close",children:(0,i.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,i.jsx)("path",{d:"M3 3l8 8M11 3l-8 8"})})})]}),(0,i.jsxs)("div",{className:(0,E.cn)("flex flex-1 min-h-0",u?"flex-row":"flex-col overflow-y-auto"),children:[(0,i.jsx)("div",{className:(0,E.cn)("bg-gray-50 dark:bg-gray-800/50 p-4 text-sm space-y-1.5",u?"order-1 w-80 border-r border-gray-200 dark:border-gray-700 overflow-y-auto":"order-2"),children:(0,i.jsx)(J,{feature:t,mapState:r,geoLevel:a,vectorInfo:o,sunburstHierarchy:c})}),(0,i.jsx)("div",{className:(0,E.cn)("min-w-0 p-4",u?"order-2 flex-1 min-h-0 overflow-y-auto":"list"===d?"order-1 w-full":"order-1 aspect-square w-full max-w-[80vh] mx-auto"),children:t&&s&&o&&(0,i.jsx)(F,{vectorInfo:o,mapId:s,geoUid:t.id,viewMode:d,onHierarchyChange:h})})]})]}),document.body)}function et({mapState:t,variables:r}){let n=t.getRgbLabels(),a=r?.rawValue;return!Array.isArray(a)||a.length<3?null:(0,i.jsx)("div",{className:"space-y-0.5",children:n.map((r,n)=>{let o=Y(a[n]),s=t.longFormatterForUnits(t.unitsForVariableIndex(n));return(0,i.jsxs)("div",{className:"flex items-baseline gap-1.5 text-xs",children:[(0,i.jsxs)("span",{className:"text-gray-500 dark:text-gray-400 truncate",children:[r,":"]}),(0,i.jsx)("span",{className:"text-gray-900 dark:text-gray-100 font-medium",children:o?X(o,s):String(a[n])})]},n)})})}function er({mapState:t,variables:r,uncertainty:n}
1){let a=t.getSubMapOptionsLabels(),o=r?.rawValue,s=t.options?.index;if(!Array.isArray(o)||0===a.length)return null;let l=a.find(t=>s===t.index)||a[0],u=a.indexOf(l),c=o[u],h=Y(c),f=t.longFormatterForUnits(t.unitsForVariableIndex(u));return(0,i.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,i.jsxs)("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:[h?X(h,f):String(c??"N/A"),!h?.uncertainty&&void 0!==n&&(0,i.jsxs)("span",{className:"text-gray-500 dark:text-gray-400 font-normal text-xs ml-0.5",children:["±",f(n)]})]}),(0,i.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:l.label})]})}t.s(["GEO_LEVEL_LABELS",0,K,"MapTooltip",0,W,"SelectedTooltipContent",0,Q],840170);var ei=t.i(456420);let en={name:"rotate-ccw",size:24,node:[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]};en.node;let ea=(0,ei.default)(en);var eo=t.i(166832),es=t.i(628172);let el=t=>Math.abs(t)>=1e6?(t/1e6).toFixed(1)+"M":Math.abs(t)>=1e3?(t/1e3).toFixed(1)+"k":Number.isInteger(t)?t.toString():t.toFixed(2);function eu(t){let{visible:r=!0,className:n}=t;return r?(0,i.jsxs)("div",{className:(0,E.cn)("bg-white/95 dark:bg-gray-900/95 backdrop-blur-sm","rounded-lg shadow-lg border border-gray-200 dark:border-gray-700","px-3 py-2 text-sm w-full",n),children:[t.title&&(0,i.jsx)("div",{className:"font-medium text-gray-900 dark:text-gray-100 mb-2 text-xs",children:t.title}),"choropleth"===t.type&&(0,i.jsx)(eh,{...t}),"categorical"===t.type&&(0,i.jsx)(ef,{...t}),"gradient"===t.type&&(0,i.jsx)(ed,{...t}),"rgb"===t.type&&(0,i.jsx)(ep,{...t}),"bivariate"===t.type&&(0,i.jsx)(ev,{...t})]}):null}function ec({distribution:t,colors:r,size:a=30,isRebalanced:o,onRebalance:s,onReset:l}){let u=t.reduce((t,r)=>t+r,0),c=0===u,h=c?Array(t.length||r.length).fill(1):t,f=c?h.length:u,d=c?h.map(()=>"#d1d5db"):r,p=a/2,m=.55*p,g=(0,n.useMemo)(()=>{let t=[],r=-Math.PI/2;for(let i=0;i<h.length;i++){let n=h[i]/f;if(n<=0)continue;let a=r,o=r+2*n*Math.PI;r=o;let s=p+p*Math.cos(a),l=p+p*Math.sin(a),u=p+p*Math.cos(o),c=p+p*Math.sin(o),g=p+m*Math.cos(o),y=p+m*Math.sin(o),v=p+m*Math.cos(a),_=p+m*Math.sin(a),b=+(n>.5);t.push({d:`M ${s} ${l} A ${p} ${p} 0 ${b} 1 ${u} ${c} L ${g} ${y} A ${m} ${m} 0 ${b} 0 ${v} ${_} Z`,color:d[i]||"#ccc"})}return t},[h,f,d,p,m]);return o&&l?(0,i.jsx)("div",{className:"flex flex-col items-center gap-0.5 flex-shrink-0",children:(0,i.jsx)("button",{onClick:l,title:"Reset to default colours",className:"flex items-center justify-center cursor-pointer hover:opacity-80 transition-opacity flex-shrink-0",style:{width:a,height:a},children:(0,i.jsx)(ea,{size:.75*a,className:"text-gray-300"})})}):(0,i.jsx)("div",{className:"flex flex-col items-center gap-0.5 flex-shrink-0",children:(0,i.jsx)("button",{onClick:s,title:"Rebalance colours",className:(0,E.cn)("cursor-pointer hover:opacity-80 transition-opacity",c&&"opacity-40"),style:{width:a,height:a},children:(0,i.jsxs)("svg",{width:a,height:a,viewBox:`0 0 ${a} ${a}`,children:[(0,i.jsx)("circle",{cx:p,cy:p,r:(p+m)/2,fill:"none",stroke:"#e5e7eb",strokeWidth:p-m}),g.map((t,r)=>(0,i.jsx)("path",{d:t.d,fill:t.color},r))]})})})}function eh({colors:t,cutoffs:r,formatter:n=el,distribution:a,isRebalanced:o,onRebalance:s,onReset:l}){if(!t||0===t.length)return null;let u=a&&a.length>0&&(s||l);return(0,i.jsxs)("div",{className:"flex items-start gap-2",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("div",{className:"flex w-full",style:{height:16},children:t.map((r,n)=>(0,i.jsx)("div",{className:"flex-1",style:{backgroundColor:r,borderRadius:0===n?"4px 0 0 4px":n===t.length-1?"0 4px 4px 0":void 0}},n))}),(0,i.jsx)("div",{className:"relative w-full mt-1",style:{height:14},children:r.map((r,a)=>{let o=(a+1)/t.length*100;return(0,i.jsx)("span",{className:"absolute text-gray-600 dark:text-gray-400 whitespace-nowrap",style:{left:`${o}%`,transform:"translateX(-50%)",fontSize:"0.65rem"},children:n(r)},a)})})]}),u&&(0,i.jsx)(ec,{distribution:a,colors:t,size:30,isRebalanced:o,onRebalance:s,onReset:l})]})}function ef({items:t}){return t&&0!==t.length?(0,i.jsx)("div",{className:"space-y-1",children:t.map((t,r)=>(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"w-4 h-4 rounded-sm flex-shrink-0",style:{backgroundColor:t.color}}),(0,i.jsx)("span",{className:"text-xs text-gray-700 dark:text-gray-300",children:t.label})]},r))}):null}function ed({colors:t,min:r,max:n,formatter:a=el}){if(!t||0===t.length)return null;let o=t.map((r,i)=>{let n=i/(t.length-1)*100;return`${r} ${n}%`}).join(", ");return(0,i.jsxs)("div",{className:"w-full",children:[(0,i.jsx)("div",{className:"w-full h-4 rounded",style:{background:`linear-gradient(to right, ${o})`}}),(0,i.jsxs)("div",{className:"flex justify-between mt-1",children:[(0,i.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:a(r)}),(0,i.jsx)("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:a(n)})]})]})}function ep({labels:t=["R","G","B"],tricoloreOptions:r,hoveredPoint:a,points:o,size:s=120,center:l,onCenterChange:u}){let c=n.default.useRef(null),h=n.default.useRef(null),f=n.default.useRef(!1),d=s*Math.sqrt(3)/2,p={breaks:3,discrete:!0,hue:80,chroma:140,lightness:80,contrast:.4,spread:1,center:[1/3,1/3,1/3],...r};return n.default.useEffect(()=>{var t,r,i,n;let a,o=c.current;if(!o)return;let l=o.getContext("2d");l&&(l.clearRect(0,0,s,Math.ceil(d)),p.discrete?(t=l,r=s,i=d,a=(n=p).breaks||3,(0,eo.getTernaryMeshVertices)(a,n).forEac
1h(({vertices:n,color:a})=>{let o=n.map(t=>ey(t,r,i));t.beginPath(),t.moveTo(o[0][0],o[0][1]),t.lineTo(o[1][0],o[1][1]),t.lineTo(o[2][0],o[2][1]),t.closePath(),t.fillStyle=a,t.fill()})):function(t,r,i,n){let a=t.createImageData(r,Math.ceil(i)),o=a.data;for(let t=0;t<i;t++)for(let a=0;a<r;a++){let s=eg(a,t,r,i);if(s[0]>=-.001&&s[1]>=-.001&&s[2]>=-.001&&s[0]<=1.001&&s[1]<=1.001&&s[2]<=1.001){let i=s[0]+s[1]+s[2],l=[s[0]/i,s[1]/i,s[2]/i],u=(0,eo.colorMapTricolore)([l],{...n,discrete:!1})[0];if(u){let i=(t*r+a)*4;o[i]=parseInt(u.slice(1,3),16),o[i+1]=parseInt(u.slice(3,5),16),o[i+2]=parseInt(u.slice(5,7),16),o[i+3]=255}}}t.putImageData(a,0,0)}(l,s,d,p))},[s,d,p.breaks,p.discrete,p.hue,p.chroma,p.lightness,p.contrast,p.spread,p.center?.[0],p.center?.[1],p.center?.[2]]),n.default.useEffect(()=>{let t=h.current;if(!t)return;let r=t.getContext("2d");if(r){if(r.clearRect(0,0,s,Math.ceil(d)),o&&o.length>0){for(let t of(r.save(),r.globalAlpha=.45,o)){let i=t[0]+t[1]+t[2];if(i<=0)continue;let[n,a]=ey([t[0]/i,t[1]/i,t[2]/i],s,d);r.beginPath(),r.arc(n,a,1.5,0,2*Math.PI),r.fillStyle="white",r.fill()}r.restore()}if(l&&Array.isArray(l)&&3===l.length){let t=l[0]+l[1]+l[2];if(t>0){let[i,n]=ey([l[0]/t,l[1]/t,l[2]/t],s,d);for(let[t,a]of(r.beginPath(),r.arc(i,n,6,0,2*Math.PI),r.strokeStyle="white",r.lineWidth=3,r.stroke(),r.beginPath(),r.arc(i,n,6,0,2*Math.PI),r.strokeStyle="black",r.lineWidth=1.5,r.stroke(),[[3,"white"],[1.5,"black"]]))r.lineWidth=t,r.strokeStyle=a,r.beginPath(),r.moveTo(i-6-5,n),r.lineTo(i+6+5,n),r.moveTo(i,n-6-5),r.lineTo(i,n+6+5),r.stroke()}}if(a&&Array.isArray(a)&&3===a.length){let t=a[0]+a[1]+a[2];if(t>0){let[i,n]=ey([a[0]/t,a[1]/t,a[2]/t],s,d);r.beginPath(),r.arc(i,n,5,0,2*Math.PI),r.fillStyle="white",r.fill(),r.strokeStyle="black",r.lineWidth=2,r.stroke(),r.beginPath(),r.arc(i,n,3,0,2*Math.PI),r.fillStyle="black",r.fill()}}}},[a,o,l,s,d]),(0,i.jsxs)("div",{className:"flex flex-col items-center",children:[(0,i.jsx)("span",{className:"text-gray-600 dark:text-gray-400 mb-1",style:{fontSize:"0.65rem"},children:t[0]}),(0,i.jsxs)("div",{className:"relative",style:{width:s,height:Math.ceil(d)},children:[(0,i.jsx)("canvas",{ref:c,width:s,height:Math.ceil(d),className:"block absolute top-0 left-0"}),(0,i.jsx)("canvas",{ref:h,width:s,height:Math.ceil(d),className:"block absolute top-0 left-0",style:{pointerEvents:u?"auto":"none",cursor:u?"crosshair":"default"},onPointerDown:u?t=>{f.current=!0,t.currentTarget.setPointerCapture(t.pointerId);let r=t.currentTarget.getBoundingClientRect();u(em(eg(t.clientX-r.left,t.clientY-r.top,s,d)))}:void 0,onPointerMove:u?t=>{if(!f.current)return;let r=t.currentTarget.getBoundingClientRect();u(em(eg(t.clientX-r.left,t.clientY-r.top,s,d)))}:void 0,onPointerUp:u?()=>{f.current=!1}:void 0})]}),(0,i.jsxs)("div",{className:"flex justify-between w-full mt-1",style:{width:s},children:[(0,i.jsx)("span",{className:"text-gray-600 dark:text-gray-400",style:{fontSize:"0.65rem"},children:t[1]}),(0,i.jsx)("span",{className:"text-gray-600 dark:text-gray-400 text-right",style:{fontSize:"0.65rem"},children:t[2]})]})]})}function em(t){let r=[Math.max(0,t[0]),Math.max(0,t[1]),Math.max(0,t[2])],i=r[0]+r[1]+r[2];return 0===i?[1/3,1/3,1/3]:[r[0]/i,r[1]/i,r[2]/i]}function eg(t,r,i,n){let a=t/i,o=r/n;return[1-o,.5-a+o/2,a+o/2-.5]}function ey(t,r,i){return[t[0]*(r/2)+0*t[1]+t[2]*r,0*t[0]+t[1]*i+t[2]*i]}function ev({labels:t=["X Axis","Y Axis"],bivariateOptions:a,hoveredCell:o,size:s=120,xCutoffs:l,yCutoffs:u,formatter:c,xFormatter:h,yFormatter:f}){let d={...es.defaultBivariateOptions,...a},p=d.bins,m=(0,n.useMemo)(()=>(0,es.generateBivariateGrid)(d),[d.bins,d.color1,d.color2,d.baseColor,d.darkenAmount]),g=s/p,y=c??(t=>t.toFixed(1)),v=h??y,_=f??y,b=[],x=[];l&&l.length>0&&l.forEach((t,r)=>{b.push({pos:(r+1)*g,label:v(t)})}),u&&u.length>0&&u.forEach((t,r)=>{x.push({pos:s-(r+1)*g,label:_(t)})});let w=x.length?Math.ceil(Math.max(...x.map(t=>(function(t,i=8.8){return"u"<typeof document?t.length*i*.6:(void 0===r&&(r=document.createElement("canvas").getContext("2d")??null),r)?(r.font=`${i}px ui-sans-serif, system-ui, sans-serif`,r.measureText(t).width):t.length*i*.6})(t.label))))+6:4,E=b.length?18:4,T=s+w,A=s+E;return(0,i.jsxs)("div",{className:"flex flex-col items-start gap-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)("div",{className:"text-gray-500 dark:text-gray-400 select-none",style:{fontSize:"0.6rem",writingMode:"vertical-rl",transform:"rotate(180deg)",whiteSpace:"nowrap",maxWidth:10,overflow:"hidden",textOverflow:"ellipsis",maxHeight:s},title:t[1],children:t[1]}),(0,i.jsxs)("svg",{width:T,height:A,overflow:"visible",style:{display:"block"},children:[Array.from({length:p},(t,r)=>Array.from({length:p},(t,n)=>{let a=r*g,l=s-(n+1)*g,u=o&&o[0]===r&&o[1]===n;return(0,i.jsx)("rect",{x:a,y:l,width:g,height:g,fill:m[r]?.[n]??"#888",stroke:u?"white":"none",strokeWidth:2*!!u},`${r}-${n}`)})),x.map(({pos:t,label:r},n)=>(0,i.jsx)("text",{x:s+3,y:t+3,fontSize:"0.55rem",fill:"#6b7280",dominantBaseline:"middle",children:r},`ytick-${n}`)),b.map(({pos:t,label:r},n)=>(0,i.jsx)("text",{x:t,y:s+10,fontSize:"0.55rem",fill:"#6b7280",textAnchor:"middle",children:r},`xtick-${n}`)),(0,i.jsx)("text",{x:2,y:s-2,fontSize:"0.5rem",fill:"#9ca3af",children:"Low"}),(0,i.jsx)("text",{x:s-2,y:s-2,fontSize:"0.5rem",fill:"#9ca3af",textAnchor:"end",children:"High"}),(0,i.jsx)("text",{x:2,y:8,fontSize:"0.5rem",fill:"#9ca3af",children:"High"})]})]}),(0,i.jsx)("div",{className:"text-gray-500 dark:text-gray-400 select-none text-center",style:{fontSize:"0.6rem",marginLeft:14,width:s,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t[0],children:t[0]})]})}
1t.s(["MapLegend",0,eu,"RgbLegend",0,ep],964607);var e_=t.i(846932),eb=t.i(88653),ex=t.i(167881),ew=t.i(970065);let eE="viewerTutorial_visits",eT="viewerTutorial_autoShown",eA=[{title:"Welcome to CensusMapper",description:"Explore interactive maps of Canadian census data. This quick tour covers the main features. You can reopen it any time from the Tutorial link in the top menu.",target:null},{title:"Map & Chart Interaction",description:"Hover over a region on the map to highlight it in the chart. Hover over a bar or point in the chart to highlight the matching regions on the map. Click a region for a detailed data tooltip.",target:"sidebar-chart"},{title:"Rebalancing Colours",description:"The colour legend shows how values map to colours. If most regions look the same shade, click the circular icon on the right end of the legend to rebalance colours across the currently visible range.",target:"map-legend"},{title:"Navigating the Map",description:"Zoom with +/â or your scroll wheel. Drag to pan. Right-click drag (or two-finger drag on mobile) to tilt. The compass button resets the view orientation.",target:"nav-controls"},{title:"Search & Geolocation",description:"Type a city, province, or address to jump to that location. Click the location icon to navigate to where you currently are.",target:"map-search"},{title:"Map Layers",description:"Toggle background layers â roads, transit, parks, and more â to customize what's shown underneath the census data.",target:"map-layers"},{title:"Browse Census Maps",description:"Use the search bar above to explore thousands of pre-built census maps covering topics like income, housing, language, and demographics.",target:"navbar-search-bar"},{title:"Create Your Own Map",description:"Build a custom census data map. It's free â sign up or log in, then click Create in the top menu to choose a census year and start mapping.",target:"navbar-create"},{title:"Data API",description:"Download census data or generate R / Python code for your own research. Access it from the API link in the top menu.",target:"navbar-api"},{title:"Learn More",description:"Visit the About page for documentation, dataset details, and more information about CensusMapper and Canadian census data.",target:"navbar-about"}];function eS({rect:t,vw:r,vh:n,children:a}){let o;if(t){let{top:i,left:a}=function(t,r,i){var n;let a=t.left+t.width/2,o=t.top+t.height/2,s=[{left:t.left+t.width+14,top:o-130},{left:t.left-320-14,top:o-130},{left:a-160,top:t.top+t.height+14},{left:a-160,top:t.top-260-14}],l=s.find(({left:t,top:n})=>t>=12&&t+320<=r-12&&n>=12&&n+260<=i-12);if(l)return l;let u=[r-(t.left+t.width),t.left,i-(t.top+t.height),t.top],c=u.indexOf(Math.max(...u));return n=s[c].left,{left:Math.max(12,Math.min(r-320-12,n)),top:Math.max(12,Math.min(i-260-12,s[c].top))}}(t,r,n);o={position:"fixed",top:i,left:a,width:320,zIndex:9999}}else o={position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:320,zIndex:9999};return(0,i.jsx)("div",{style:o,children:a})}function eC({isOpen:t,onClose:r}
1){let[a,o]=(0,n.useState)(0),[s,l]=(0,n.useState)(null),[u,c]=(0,n.useState)(0),[h,f]=(0,n.useState)(0),d=(0,n.useRef)(null),p=eA[a],m=(0,n.useCallback)(()=>{c(window.innerWidth),f(window.innerHeight),l(function(t){if(!t)return null;let r=document.querySelector(`[data-tutorial="${t}"]`);if(!r)return null;let i=r.getBoundingClientRect();return 0===i.width&&0===i.height?null:{top:i.top-12,left:i.left-12,width:i.width+24,height:i.height+24}}(p.target))},[p.target]);(0,n.useEffect)(()=>{if(t)return m(),d.current&&clearTimeout(d.current),d.current=setTimeout(m,200),()=>{d.current&&clearTimeout(d.current)}},[t,a,m]),(0,n.useEffect)(()=>{if(t)return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[t,m]),(0,n.useEffect)(()=>{t&&o(0)},[t]);let g=(0,n.useCallback)(()=>{r()},[r]),y=(0,n.useCallback)(()=>{a<eA.length-1?o(t=>t+1):g()},[a,g]),v=(0,n.useCallback)(()=>{a>0&&o(t=>t-1)},[a]);if((0,n.useEffect)(()=>{if(!t)return;let r=t=>{"Space"!==t.code||t.repeat||(t.preventDefault(),y())};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t,y]),!t)return null;let _=a===eA.length-1,b=!!s,x=u||window.innerWidth,w=h||window.innerHeight;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("svg",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:9998,pointerEvents:"none"},width:x,height:w,children:[(0,i.jsx)("defs",{children:(0,i.jsxs)("mask",{id:"viewer-tutorial-mask",children:[(0,i.jsx)("rect",{width:x,height:w,fill:"white"}),b&&s&&(0,i.jsx)("rect",{x:s.left,y:s.top,width:s.width,height:s.height,rx:8,fill:"black"})]})}),(0,i.jsx)("rect",{width:x,height:w,fill:"rgba(0,0,0,0.55)",mask:"url(#viewer-tutorial-mask)"})]}),(0,i.jsx)("div",{style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:9997},onClick:g,"aria-label":"Close tutorial"}),(0,i.jsx)(eS,{rect:s,vw:x,vh:w,children:(0,i.jsx)(eb.AnimatePresence,{mode:"wait",children:(0,i.jsx)(e_.motion.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.18},onClick:t=>t.stopPropagation(),style:{zIndex:9999,position:"relative"},children:(0,i.jsx)(ew.Card,{className:"shadow-xl border-gray-200 bg-white",children:(0,i.jsxs)(ew.CardContent,{className:"p-5",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,i.jsxs)("span",{className:"text-xs text-gray-400 font-medium",children:["Step ",a+1," of ",eA.length]}),(0,i.jsx)("button",{onClick:g,className:"text-xs text-gray-400 hover:text-gray-600 transition-colors","aria-label":"Skip tutorial",children:"Skip"})]}),(0,i.jsx)("div",{className:"flex gap-1.5 mb-4",children:eA.map((t,r)=>(0,i.jsx)("div",{className:"h-1 rounded-full transition-all duration-300",style:{width:r===a?20:8,backgroundColor:r===a?"#1f2937":r<a?"#6b7280":"#e5e7eb"}},r))}),(0,i.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-2",children:p.title}),(0,i.jsx)("p",{className:"text-xs text-gray-600 leading-relaxed mb-5",children:p.description}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[a>0&&(0,i.jsx)(ex.Button,{variant:"outline",size:"sm",onClick:v,className:"flex-shrink-0",children:"Back"}),(0,i.jsx)("div",{className:"flex-1"}),(0,i.jsxs)(ex.Button,{size:"sm",onClick:y,className:"bg-gray-800 hover:bg-gray-700 text-white gap-1.5",children:[_?"Done":"Next",(0,i.jsx)("kbd",{className:"inline-flex items-center px-1 py-px bg-gray-700 rounded border border-gray-600 leading-none select-none",children:(0,i.jsx)("svg",{width:"16",height:"9",viewBox:"0 0 16 9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,i.jsx)("path",{d:"M1 8 L1 4 M15 8 L15 4 M1 8 L15 8"})})})]})]})]})})},a)})})]})}let eM=!0;function eD(t,r,i){if(0===r.size)return i();let n=t?.properties??t,a=n?.id??"";return a&&r.has(a)?[65,182,230]:(0,m.isImplicitlySelected)(n,r)?[180,220,240]:i()}t.s(["default",0,function({mapId:t,initialMapMetadata:r,externalMapStateRef:m,sidebarContent:w,renderHoverTooltip:E,renderClickTooltip:T,onFeatureClick:A,onFeatureHover:S,selectedFeatureIds:C,showRegionBoundaries:M,onMapReady:D,onVisibleFeaturesC
1hange:P,mapOverlayContent:I,initialLayerVisibility:k,isOwner:O,showMapActions:N=!1,subMapOptions:L,subMapCallback:R}){let F,B=(0,n.useRef)(null),z=(0,n.useRef)(null),j=(0,n.useRef)([]),U=(0,n.useRef)([]),V=(0,n.useRef)(null),$=(0,n.useRef)(0),G=(0,n.useRef)(null),q=(0,n.useRef)(new Set),H=(0,n.useRef)(null),Z=m??H,[Y,X]=(0,n.useState)(null),[K,J]=(0,n.useState)(null),[ee,et]=(0,n.useState)([]),[er,ei]=(0,n.useState)(null),[en,ea]=(0,n.useState)(!1),[eo,el]=(0,n.useState)(null),[ec,eh]=(0,n.useState)(null),[ef,ed]=(0,n.useState)(null),{isSm:ep}=(0,f.useBreakpoint)(),em=(0,_.useURLParamNumber)("index",-1),eg=(0,_.useURLParam)("view"),[ey,ev]=(0,n.useState)(!1);(0,n.useEffect)(()=>{ev("fullscreen"===eg)},[eg]),(0,n.useEffect)(()=>(ey?document.body.classList.add("social-preview"):document.body.classList.remove("social-preview"),()=>{document.body.classList.remove("social-preview")}),[ey]);let{deduplicateFeatures:e_}=(0,b.useFeatureWorker)(),[eb,ex]=(0,n.useState)(null),[ew,eA]=(0,n.useState)(!1),eS=(0,n.useRef)(null),[eP,eI]=(0,n.useState)(null),ek=(0,n.useRef)(null),[eO,eN]=(0,n.useState)(!1),eL=(0,n.useRef)(!1),eR=(0,n.useRef)(null),eF=(0,n.useRef)(!1),eB=(0,n.useRef)(void 0),ez=(0,n.useRef)(null),[ej,eU]=(0,n.useState)(!1),eV=(0,n.useRef)(!1),{dataLayersRef:e$,setDataLayers:eG,computeLayerKeys:eq}=(0,y.useMapLayers)(),{handleHover:eH,handleClick:eW}=(0,v.useMapEventHandlers)({setHoveredFeature:X,setHoveredMapValue:ei,setSelectedFeature:J,setHighlightedFeatureIds:ex,isMapHoveredRef:eL,setClickPosition:el});(0,n.useEffect)(()=>{eF.current=ew},[ew]),(0,n.useEffect)(()=>{},[]),(0,n.useEffect)(()=>{if(!r||m||eV.current)return;eV.current=!0;let t=setTimeout(()=>{let t,r,i;!document.body.classList.contains("social-preview")&&(t=parseInt(localStorage.getItem(eE)||"0")+1,localStorage.setItem(eE,String(t)),r=JSON.parse(localStorage.getItem(eT)||"[]"),(i=1===t||10===t&&!r.some(t=>t>=10))&&(r.push(t),localStorage.setItem(eT,JSON.stringify(r))),i)&&eU(!0)},1200);return()=>clearTimeout(t)},[]),(0,n.useEffect)(()=>{if(!r||m)return;let t=()=>eU(!0);return window.addEventListener("censusmapper:tutorial",t),()=>window.removeEventListener("censusmapper:tutorial",t)},[]);let eZ=(0,n.useCallback)(t=>{j.current=t,z.current?.setProps({layers:t})},[]);(0,n.useEffect)(()=>{if(m)return;let i=t||x.MAP_CONFIG.DEFAULT_MAP_ID;ea(!1),J(null),X(null),et([]);let n=!1;return h.default.create(i.toString(),r).then(t=>{if(!n){if(H.current=t,t.status===g.MapStatus.Shared&&t.share_hash&&1){let r=new URL(window.location.href);r.searchParams.get("share_hash")!==t.share_hash&&(r.searchParams.set("share_hash",t.share_hash),window.history.replaceState(null,"",r.toString()))}if(ea(t.is_owner??!1),eN(null!==t.getDefaultLocation()),B.current&&e1(),ey){let r=new URLSearchParams(window.location.search);if(!r.has("z")||!r.has("lat")||!r.has("lng")){let r=t.getDefaultLocation();if(r&&B.current){B.current.jumpTo({center:[r.lng,r.lat],zoom:r.zoom});let t=new URL(window.location.href);t.searchParams.set("z",r.zoom.toFixed(2)),t.searchParams.set("lat",r.lat.toFixed(4)),t.searchParams.set("lng",r.lng.toFixed(4)),window.history.replaceState(null,"",t.toString())}}}else if(eM){let r=()=>{let r=t.getDefaultLocation();r&&B.current&&(B.current.flyTo({center:[r.lng,r.lat],zoom:r.zoom}),B.current.once("idle",()=>eQ()))};fetch(`${(0,p.getAPIBaseUrl)()}/api/geolocate`,{credentials:"include"}).then(t=>t.json()).then(t=>{let i=B.current;t&&t.latitude&&t.longitude&&"CA"===t.country_code&&i?(i.flyTo({center:[t.longitude,t.latitude],zoom:10}),eM=!1,i.once("idle",()=>eQ())):r()}).catch(()=>{r()})}}}),()=>{n=!0}},[t]);let eY=(0,n.useRef)(null),eX=(0,n.useRef)(null);function eK(){eY.current&&(clearTimeout(eY.current),eY.current=null),null!==eX.current&&"u">typeof cancelIdleCallback&&(cancelIdleCallback(eX.current),eX.current=null)}function eQ(){eK(),eY.current=setTimeout(()=>{eY.current=null,"u">typeof requestIdleCallback?eX.current=requestIdleCallback(()=>{eX.current=null,eJ()},{timeout:2e3}):eJ()},x.MAP_CONFIG.DEBOUNCE_DELAY)}async function eJ(){let t=B.current;if(!t||t.isMoving())return;let r=Z.current?.visibleLayerKeyForZoom(t.getZoom())||null,i=j.current.filter(t=>null!==r&&(t.id===r||t.id.startsWith(r+"-")));if(!i||0===i.length)return;let a=i[0];if(a&&"function"==typeof a.getRawRenderedFeatures)try{let t=a.getRawRenderedFeatures($.current,!ep),r=a.getUniqueIdProperty?.()||"id",
1i=await e_(t,r);(0,n.startTransition)(()=>{et(i),P?.(i)})}catch(t){console.error("Error getting visible features:",t)}}function e0(){let t=Z.current;if(t)if(t.bivariateColors()){let{xCuts:r,yCuts:i}=(0,es.splitBivariateDomain)(t.domain,t.bivariateOptions?.bins??2),[n,a]=t.getBivariateFormatters();ed({type:"bivariate",labels:t.getBivariateLabels(),bivariateOptions:t.bivariateOptions,xCutoffs:r,yCutoffs:i,formatter:t.shortValueFormatter,xFormatter:n,yFormatter:a})}else if(t.rgbColors())ed({type:"rgb",labels:t.getRgbLabels(),tricoloreOptions:t.getTricoloreOptions()});else if(t.categoryColors()){let r=t.range,i=t.displayedVariables??[],n=t.variables,a=i.map(t=>{let r=n.find(r=>r.key===t);return r?.label??t});ed({type:"categorical",items:r.map((t,r)=>({color:t,label:a[r]??""}))})}else t.range&&t.range.length>0&&ed({type:"choropleth",colors:t.range,cutoffs:t.domain,formatter:t.shortValueFormatter})}function e1(){if(!B.current||!Z.current)return;let t=Z.current?.data_layers;if(!t)return;eG(t),e0();let r=eq(t).map(r=>(function(t,r=e$.current){let i=(0,p.getAPIBaseUrl)(),n=r[t];n.subdomains[0];let a=Z.current?.vectors||[],o=a.length>0?function(t){let r=5381;for(let i=0;i<t.length;i++)r=((r<<5)+r^t.charCodeAt(i))>>>0;return r.toString(36)}(a.join(",")):"",s=o?`${t}-${o}`:t;return new c.default({id:s,data_layer:n,vectors:Z.current?.vectors||[],onViewportLoad:()=>eQ(),getFillColor:t=>eD(t,q.current,()=>Z.current?.fillColor(t?.properties!==void 0?t:{properties:t})||[100,100,100]),valueFunction:Z.current?.valueFunction||(()=>null),onHover:t=>{let r=t.object?.properties??null;eh(r?{x:t.x,y:t.y}:null),S?(X(r),S(r)):eH(t)},onClick:t=>{A?A(t.object?.properties??null):eW(t)},highlightColor:Z.current?.highlightColor||[200,200,200],...M?{stroked:!0,getLineColor:Z.current?.highlightColor||[200,200,200],lineWidthMinPixels:3}:{},base_url:i,autoHighlight:!0,visible:!0,data:[]})})(r,t));if(z.current)z.current.setProps({layers:r});else{let t=new u.MapLibreOverlay({interleaved:!0,layerFilter:({layer:t,viewport:r})=>{let i=Z.current?.visibleLayerKeyForZoom(r.zoom)||null;return null!==i&&(t.id===i||t.id.startsWith(i+"-"))},layers:r});z.current=t,B.current.addControl(t)}j.current=r,U.current=r,eJ()}let e2=(0,n.useRef)(null),e3=(0,n.useCallback)(()=>{if(!z.current)return;let t=Date.now(),r=q.current,i=U.current.map(i=>(i.setComputedValues(Z.current?.valueFunction||(()=>null)),r.size>0&&i.applySelectionColors?.(r),i.clone({getFillColor:t=>eD(t,r,()=>Z.current?.fillColor(t?.properties!==void 0?t:{properties:t})||[100,100,100]),updateTriggers:{getFillColor:t}})));eZ(i),U.current=i,e0()},[eZ]);(0,n.useEffect)(()=>{q.current=C??new Set,z.current&&e3()},[C,e3]);let e4=(0,n.useCallback)(()=>{let t=Z.current;if(!t||!z.current)return;eS.current||(eS.current={domain:[...t.domain],domainType:t.domain_type});let r=[];for(let t of ee){let i=t.__value?.mapValue;"number"==typeof i&&isFinite(i)&&r.push(i)}if(r.length<2)return;let i=t.range.length,n=i-1;r.sort((t,r)=>t-r);let a=[];for(let t=1;t<=n;t++){let n=Math.min(Math.floor(r.length*t/i),r.length-1);a.push(r[n])}
1let o=[...new Set(a)];!(o.length<1)&&(t.domain_type=2,t.domain=o,t.buildMapScale(),e3(),eQ(),eA(!0),eI(null),ek.current&&clearTimeout(ek.current))},[ee,e3]),e6=(0,n.useCallback)(()=>{let t=Z.current;t&&eS.current&&(t.domain=[...eS.current.domain],t.domain_type=eS.current.domainType,t.buildMapScale(),e3(),eQ(),eA(!1),eS.current=null)},[e3]),e5=(0,n.useCallback)((t,r)=>{if(!B.current)return;let i=x.LAYER_TOGGLE_PATTERNS[t];i&&B.current.getStyle().layers?.forEach(t=>{i.test(t.id)&&B.current.setLayoutProperty(t.id,"visibility",r?"visible":"none")})},[]);(0,n.useEffect)(()=>{if(!V.current||B.current)return;eM=!0;let t=new URLSearchParams(window.location.search),r=parseFloat(t.get("z")??""),n=parseFloat(t.get("lat")??""),u=parseFloat(t.get("lng")??""),c=x.MAP_CONFIG.DEFAULT_CENTER,h=x.MAP_CONFIG.DEFAULT_ZOOM;if(isNaN(r)||isNaN(n)||isNaN(u)){let t=window.location.hash.replace("#","").split("/").map(Number);3===t.length&&t.every(t=>!isNaN(t))&&(c=[t[2],t[1]],h=t[0],eM=!1)}else c=[u,n],h=r,eM=!1;let f=null,d=null,m=null,g=null,y=null,v=null;return(async()=>{let t=(0,p.getTileBaseUrl)(),r=async()=>{if(!t)return"/styles/style_census.json";try{let r=await fetch(`${t}/styles/style_census.json`),i=await r.json();for(let r of Object.values(i.sources??{}))Array.isArray(r.tiles)&&(r.tiles=r.tiles.map(r=>r.startsWith("/")?`${t}${r}`:r)),"string"==typeof r.url&&r.url.startsWith("/")&&(r.url=`${t}${r.url}`);return i}catch{return`${t}/styles/style_census.json`}},n=await r();if(!V.current)return;let u=t=>{let{lat:r,lng:i}=t.getCenter(),n=t.getZoom(),a=new URL(window.location.href);a.hash="",a.searchParams.set("z",n.toFixed(2)),a.searchParams.set("lat",r.toFixed(4)),a.searchParams.set("lng",i.toFixed(4)),window.history.replaceState(null,"",a.toString())};a.setWorkerUrl("/maplibre/maplibre-gl-worker.mjs"),B.current=f=new a.Map({container:V.current,style:n,center:c,zoom:h,minZoom:x.MAP_CONFIG.MIN_ZOOM,maxZoom:x.MAP_CONFIG.MAX_ZOOM,hash:!1,attributionControl:!1}),u(f);let _=document.createElement("div");_.className="maplibregl-ctrl",_.setAttribute("data-tutorial","map-search"),ey||(f.addControl({onAdd:()=>_,onRemove:()=>_.remove()},"top-left"),(d=(0,l.createRoot)(_)).render((0,i.jsx)(o.MapSearchControl,{mapRef:B}))),ey||(f.addControl(new a.NavigationControl,"top-left"),V.current?.querySelector(".maplibregl-ctrl-zoom-in")?.closest(".maplibregl-ctrl-group")?.setAttribute("data-tutorial","nav-controls"),f.addControl(new a.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0,showAccuracyCircle:!1}),"top-left"),f.addControl(new a.FullscreenControl,"top-left")),f.addControl(new a.AttributionControl({compact:!1,customAttribution:'<a href="https://www.statcan.gc.ca/en/terms-conditions/open-licence" target="_blank">Statistics Canada</a> | © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors'}),"bottom-right");{let t=V.current?.querySelector(".maplibregl-ctrl-attrib-inner");if(t){let r=$.current,i=window.matchMedia("(min-width: 640px)").matches;t.style.marginRight=i?`${r+5}px`:"0"}}ey&&V.current?.requestFullscreen?.().catch(()=>{});let b=document.createElement("div");b.className="maplibregl-ctrl",b.setAttribute("data-tutorial","map-layers"),ey||(f.addControl({onAdd:()=>b,onRemove:()=>b.remove()},"top-left"),(m=(0,l.createRoot)(b)).render((0,i.jsx)(s.MapLayersControl,{mapRef:B,initialVisibility:k}))),f.once("load",()=>{em>=0&&Z.current&&(Z.current.options.index=em,Z.current.setSubstitutedFunctionString(),Z.current.setValueFunction()),Z.current&&e1();let t={mapStateRef:Z,updateColors:e3,updateLegend:e0,updateLayers:()=>e1(),toggleBaseLayer:e5,getMap:()=>B.current,getOverlay:()=>z.current};e2.current=t,D?.(t)}),g=()=>{eQ(),u(f);let[t,r,i,n]=x.MAP_CONFIG.CENTER_BOUNDS,a=f.getCenter(),o=Math.min(Math.max(a.lng,t),i),s=Math.min(Math.max(a.lat,r),n);(o!==a.lng||s!==a.lat)&&requestAnimationFrame(()=>f.easeTo({center:[o,s]}))},y=()=>{eQ(),u(f)},f.on("moveend",g),f.on("zoomend",y),f.on("move",eK),f.on("zoom",eK),v=t=>{let{lat:r,lng:i,zoom:n}=t.detail;f.flyTo({center:[i,r],zoom:n,duration:2500})},window.addEventListener("censusmapper:flyto",v)})(),()=>{if(!f)return;g&&f.off("moveend",g),y&&f.off("zoomend",y),f.off("move",eK),f.off("zoom",eK),v&&window.removeEventListener("censusmapper:flyto",v);let t=z.current;z.current=null,j.current=[],U.current=[],B.current=null,setTimeout(()=>{d&&d.unmount(),m&&m.unmount()},0);let r=f;setTimeout(()=>{if(t)try{r.removeControl(t)}catch(t){}r.remove()},0)}},[]);
1let[e8,e7]=(0,n.useState)(null),[e9,te]=(0,n.useState)(new Set);(0,n.useEffect)(()=>{if(!z.current||!B.current)return;let t=Z.current?.visibleLayerKeyForZoom(B.current?.getZoom()||12)||null,r=Date.now();eZ(U.current.map(i=>null!==t&&(i.id===t||i.id.startsWith(t+"-"))?i.clone({getFillColor:t=>{let r=String(t.properties?.id);return e9.size>0&&e9.has(r)?Z.current?.widgetHighlightColor||x.HIGHLIGHT_COLORS.HISTOGRAM_HIGHLIGHT:Z.current?.fillColor(t)||x.HIGHLIGHT_COLORS.DEFAULT},updateTriggers:{getFillColor:r}}):i))},[e9]),(0,n.useEffect)(()=>{if(!B.current||!Z.current||0===ee.length)return;let t=Z.current.visibleLayerKeyForZoom(B.current.getZoom()??12),r=eR.current;if((eR.current=t,null===r||r!==t)&&(ez.current&&clearTimeout(ez.current),!eF.current))return ez.current=setTimeout(()=>{if(ez.current=null,eF.current)return;let t=eB.current;if(!t)return;let r=t.reduce((t,r)=>t+r,0);if(0===r)return;let i=Math.round([...t].sort((t,r)=>r-t).slice(0,3).reduce((t,r)=>t+r,0)/r*100);i>=80&&eI({top3Percent:i})},8e3),()=>{ez.current&&clearTimeout(ez.current)}},[ee]),(0,n.useEffect)(()=>{if(!z.current)return;if(!e8)return void eZ(U.current);let[t,r]=e8,i=Z.current?.visibleLayerKeyForZoom(B.current?.getZoom()||12)||null;eZ(U.current.map(n=>null!==i&&(n.id===i||n.id.startsWith(i+"-"))?n.clone({getFillColor:i=>{let n=Z.current?.valueFunction?.(i.properties);return n>=t&&n<=r?Z.current?.rangeHighlightColor||x.HIGHLIGHT_COLORS.RANGE_HIGHLIGHT:Z.current?.fillColor(i)||x.HIGHLIGHT_COLORS.DEFAULT},updateTriggers:{getFillColor:`${t}-${r}`}}):n))},[e8]);let tt=(0,n.useCallback)(t=>{te(new Set(t??[])),ex(t)},[]),tr=Z.current?.getSubMapOptionsLabels(),ti=L??tr,[tn,ta]=(0,n.useState)(null),to=(0,n.useCallback)(t=>{if(Z.current&&z.current){if(1===Object.keys(t).length&&"index"in t&&Z.current.indexColors()){let r=t.index;Z.current.selectOptionIndex(r);let i=Z.current.computeFillColor.bind(Z.current),n=Date.now(),a=q.current,o=U.current.map(t=>(t.applyIndexChange?.(r,i),a.size>0&&t.applySelectionColors?.(a),t.clone({getFillColor:t=>eD(t,a,()=>Z.current?.fillColor(t?.properties!==void 0?t:{properties:t})||[100,100,100]),updateTriggers:{getFillColor:n}})));eZ(o),U.current=o,e0();return}Z.current.updateOptions(t),e3()}},[eZ]),ts=(0,n.useCallback)(t=>{if(ta(t),!t)return;to(t),eQ();let r=new URL(window.location.href);r.searchParams.set("index",String(t.index)),window.history.replaceState({},"",r.toString())},[to]),tl=tn??(void 0!==(F=Z.current?.options?.index)&&ti?.length?ti.find(t=>t.index===F)??null:null),tu=n.default.useMemo(()=>{if(!ef||"rgb"!==ef.type||0===ee.length)return[];let t=[];for(let r of ee){let i=r.__value?.mapValue;if(!Array.isArray(i)||i.length<3)continue;let n=Math.abs(i[0]),a=Math.abs(i[1]),o=Math.abs(i[2]),s=n+a+o;s<=0||t.push([n/s,a/s,o/s])}return t},[ee,ef]),tc=n.default.useMemo(()=>{if(!ef||"choropleth"!==ef.type||!ef.colors||!ef.cutoffs)return;let t=ef.cutoffs,r=ef.colors.length,i=Array(r).fill(0);for(let n of ee){let a=n.__value?.mapValue;if("number"!=typeof a||!isFinite(a))continue;let o=r-1;for(let r=0;r<t.length;r++)if(a<t[r]){o=r;break}i[o]++}return i},[ee,ef]);return(0,n.useEffect)(()=>{eB.current=tc},[tc]),(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"flex flex-row relative h-full w-full max-w-vw",children:[(0,i.jsxs)("div",{className:"flex-1",style:{position:"relative"},children:[(0,i.jsx)("div",{ref:V,style:{width:"100%",height:"100%"},onMouseEnter:()=>{eL.current=!0},onMouseLeave:()=>{eL.current=!1,X(null),ei(null),ex(null),eh(null),j.current.forEach(t=>{t.clearHighlight?.()})}}),I,E&&(0,i.jsx)(W,{position:ec,visible:!!Y&&!!ec,containerRef:V,children:E(Y,Z.current)}),!E&&(0,i.jsx)(W,{position:eo,visible:!!K,containerRef:V,className:"pointer-events-auto",onClose:()=>{J(null),el(null)},children:T?T(K,Z.current):K&&(0,i.jsx)(Q,{feature:K,mapState:Z.current,geoLevel:Z.current?.visibleLayerKeyForZoom(B.current?.getZoom()||12),vectorInfo:Z.current?.vectorInfo,mapId:t})}),ef&&"choropleth"===ef.type&&(0,i.jsxs)("div",{className:"map-legend-container choropleth","data-tutorial":"map-legend",children:[eP&&(0,i.jsx)("div",{className:"absolute pointer-events-auto",style:{bottom:"calc(100% + 10px)",right:0},children:(0,i.jsxs)("div",{className:"relative bg-white/95 backdrop-blur-sm border border-gray-200 rounded-lg shadow-lg px-3 py-2 text-xs text-gray-700 whitespace-nowrap",children:["Not enough contrast? Try rebalancing colours.",(0,i.jsx)("button",{onClick:()=>{eI(null),ek.current&&clearTimeout(ek.current)},className:"ml-2 text-gray-400 hover:text-gray-600 transition-colors","aria-label":"Dismiss",children:"â"}),(0,i.jsx)("span",{className:"absolute",style:{bottom:-6,right:12,width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:"6px solid white",filter:"drop-shadow(0 1px 0 #e5e7eb)"}})]})}),(0,i.jsx)(eu,{type:"choropleth",colors:ef.colors,cutoffs:ef.cutoffs,formatter:ef.formatter,distribution:tc,isRebalanced:ew,onRebalance:e4,onReset:e6})]}),ef&&"categorical"===ef.type&&(0,i.jsx)("div",{className:"map-legend-container categorical",children:(0,i.jsx)(eu,{type:"categorical",items:ef.items})}),ef&&"rgb"===ef.type&&(0,i.jsx)("div",{className:"map-legend-container rgb",children:(0,i.jsx)(eu,{type:"rgb",labels:ef.labels,tricoloreOptions:ef.tricoloreOptions,points:tu,hoveredPoint:(()=>{let t=Y?.__value?.mapValue;if(Array.isArray(t)&&t.length>=3){let r=t.slice(0,3).map(Math.abs),i=Math.max(...r);return i>0?r.map(t=>t/i):r}return null})()})}),ef&&"bivariate"===ef.type&&(0,i.jsx)("div",{className:"map-legend-container bivariate",children:(0,i.jsx)(eu,{type:"bivariate",labels:ef.labels,bivariateOptions:ef.bivariateOptions,xCutoffs:ef.xCutoffs,yCutoffs:ef.yCutoffs,formatter:ef.formatter,xFormatter:ef.xFormatter,yFormatter:ef.yFormatter,hoveredCell:(()=>{let t=Y?.__value?.mapValue;if(!Array.isArray(t)||t.length<2)return null;let r=ef.bivariateOptions,i=r?.bins??2,n=(0,es.applyBinCutoffs)(t[0],ef.xCutoffs??[]),a=(0,es.applyBinCutoffs)(t[1],ef.yCutoffs??[]);return n<0||a<0?null:[Math.min(n,i-1),Math.min(a,i-1)]})()})})]}
1),!ey&&(0,i.jsx)("div",{className:"absolute right-0 top-0 h-full z-40",children:(0,i.jsx)(d.ResizableSidebar,{mapStateRef:Z,visibleFeatures:ee,highlightedFeatureIds:eb,hoveredFeature:Y,tileHighlightCallback:tt,subMapOptions:ti,subMapDefaultIndex:tl,subMapCallback:R??ts,minSpan:250,maxSpan:600,isMobile:!ep,isOwner:O??en,mapId:t,showMapActions:N,onHomeClick:function(){let t=Z.current?.getDefaultLocation();t&&B.current&&B.current.flyTo({center:[t.lng,t.lat],zoom:t.zoom})},hasDefaultLocation:eO,getMapPosition:()=>{let t=B.current;if(!t)return null;let{lat:r,lng:i}=t.getCenter();return{zoom:t.getZoom(),lat:r,lng:i}},sidebarContent:w,onEffectiveSizeChange:t=>{$.current=t;let r=V.current?.querySelector(".maplibregl-ctrl-attrib-inner");r&&(r.style.marginRight=ep?`${t+5}px`:"0"),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{G.current=null,eQ()},x.MAP_CONFIG.DEBOUNCE_DELAY)}})}),r&&!m&&(0,i.jsx)(eC,{isOpen:ej,onClose:()=>eU(!1)})]})})}],931213)},641705,456539,189904,490939,300298,710632,58472,150693,829162,39300,142722,477713,891844,969353,479220,253913,279769,t=>{"use strict";let r,i,n,a,o,s;var l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D,P,I,k,O,N,L,R,F,B,z,j,U,V,$,G,q,H,W,Z,Y,X,K,Q,J,ee,et,er,ei,en,ea,eo,es,el,eu=t.i(843476),ec=t.i(271645),eh=t.i(24071),ef=t.i(867927),ed=t.i(716327),ep=t.i(456420);let em={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};em.node;let eg=(0,ep.default)(em);t.s(["ChevronUp",0,eg],456539);let ey={name:"ellipsis-vertical",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],aliases:["more-vertical"]};ey.node;let ev=(0,ep.default)(ey);t.s(["MoreVertical",0,ev],189904);let e_={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};e_.node;let eb=(0,ep.default)(e_);var ex=t.i(522016),ew=t.i(463415);t.i(947716);class eE extends Map{constructor(t,r=eM){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),null!=t)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(eA(this,t))}has(t){return super.has(eA(this,t))}set(t,r){return super.set(eS(this,t),r)}delete(t){return super.delete(eC(this,t))}}class eT extends Set{constructor(t,r=eM){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),null!=t)for(const r of t)this.add(r)}has(t){return super.has(eA(this,t))}add(t){return super.add(eS(this,t))}delete(t){return super.delete(eC(this,t))}}function eA({_intern:t,_key:r},i){let n=r(i);return t.has(n)?t.get(n):i}function eS({_intern:t,_key:r},i){let n=r(i);return t.has(n)?t.get(n):(t.set(n,i),i)}function eC({_intern:t,_key:r},i){let n=r(i);return t.has(n)&&(i=t.get(n),t.delete(n)),i}function eM(t){return null!==t&&"object"==typeof t?t.valueOf():t}function eD(t){return t}function eP(t,...r){return ek(t,eD,eD,r)}function eI(t,r,...i){return ek(t,eD,r,i)}function ek(t,r,i,n){return function t(a,o){if(o>=n.length)return i(a);let s=new eE,l=n[o++],u=-1;for(let t of a){let r=l(t,++u,a),i=s.get(r);i?i.push(t):s.set(r,[t])}for(let[r,i]of s)s.set(r,t(i,o));return r(s)}(t,0)}var eO=t.i(594479),eO=eO,eN=t.i(332389),eN=eN;function eL(t){return null!=t&&!Number.isNaN(t)}function eR(t,r){return eL(r)-eL(t)||(0,eO.default)(t,r)}function eF(t,r){return eL(r)-eL(t)||(0,eN.default)(t,r)}function eB(t){return null!=t&&""!=`${t}`}function ez(t){return isFinite(t)?t:NaN}function ej(t){return t>0&&isFinite(t)?t:NaN}function eU(t){return t<0&&isFinite(t)?t:NaN}function eV(t,r){let i;if(void 0===r)for(let r of t)null!=r&&(i<r||void 0===i&&r>=r)&&(i=r);else{let n=-1;for(let a of t)null!=(a=r(a,++n,t))&&(i<a||void 0===i&&a>=a)&&(i=a)}return i}function e$(t,r){let i;if(void 0===r)for(let r of t)null!=r&&(i>r||void 0===i&&r>=r)&&(i=r);else{let n=-1;for(let a of t)null!=(a=r(a,++n,t))&&(i>a||void 0===i&&a>=a)&&(i=a)}return i}var eG=eO;function eq(t,...r){if("function"!=typeof t[Symbol.iterator])throw TypeError("values is not iterable");t=Array.from(t);let[i]=r;if(i&&2!==i.length||r.length>1){var n;let a=Uint32Array.from(t,(t,r)=>r);return r.length>1?(r=r.map(r=>t.map(r)),a.sort((t,i)=>{for(let n of r){let r=eW(n[t],n[i]);if(r)return r}})):(i=t.map(i),a.sort((t,r)=>eW(i[t],i[r]))),n=t,Array.from(a,t=>n[t])}return t.sort(eH(i))}function eH(t=eG.default){if(t===eG.default)return eW;if("function"!=typeof t)throw TypeError("compare is not a function");return(r,i)=>{let n=t(r,i);return n||0===n?n:(0===t(i,i))-(0===t(r,r))}}function eW(t,r){return(null==t||!(t>=t))-(null==r||!(r>=r))||(t<r?-1:+(t>r))}function eZ(t,r,i){let n=t[r];t[r]=t[i],t[i]=n}var eY=t.i(83662);function eX(t,r,i){if(!(!(n=(t=Float64Array.from((0,eY.numbers)(t,i))).length)||isNaN(r*=1))){if(r<=0||n<2)return e$(t);if(r>=1)return eV(t);var n,a=(n-1)*r,o=Math.floor(a),s=eV((function t(r,i,n=0,a=1/0,o){if(i=Math.floor(i),n=Math.floor(Math.max(0,n)),a=Math.floor(Math.min(r.length-1,a)),!(n<=i&&i<=a))return r;for(o=void 0===o?eW:eH(o);a>n;){if(a-n>600){let s=a-n+1,l=i-n+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1),f=Math.max(n,Math.floor(i-l*c/s+h)),d=Math.min(a,Math.floor(i+(s-l)*c/s+h));t(r,i,f,d,o)}let s=r[i],l=n,u=a;for(eZ(r,n,i),o(r[a],s)>0&&eZ(r,n,a);l<u;){for(eZ(r,l,u),++l,--u;0>o(r[l],s);)++l;for(;o(r[u],s)>0;)--u}0===o(r[n],s)?eZ(r,n,u):eZ(r,++u,a),u<=i&&(n=u+1),i<=u&&(a=u-1)}return r})(t,o).subarray(0,o+1));return s+(e$(t.subarray(o+1))-s)*(a-o)}}function eK(t,r,i){t*=1,r*=1,i=(a=arguments.length)<2?(r=t,t=0,1):a<3?1:+i;for(var n=-1,a=0|Math.max(0,Math.ceil((r-t)/i)),o=Array(a);++n<a;)o[n]=t+n*i;return o}let eQ=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function eJ(t,r){return eQ.test(t+="")?new Date(t):"function"==typeof r?r(t):r}var e0=t.i(17877),e0=e0;let e1=new Date,e2=new Date;function e3(t,r,i,n){function a(r){return t(r=0==arguments.length?new Date:new Date(+r)),r}return a.floor=r=>(t(r=new Date(+r)),r),a.ceil=i=>(t(i=new Date(i-1)),r(i,1),t(i),i),a.round=t=>{let r=a(t),i=a.ceil(t);return t-r<i-t?r:i},a.offset=(t,i)=>(r(t=new Date(+t),null==i?1:Math.floor(i)),t),a.range=(i,n,o)=>{let s,l=[];
1if(i=a.ceil(i),o=null==o?1:Math.floor(o),!(i<n)||!(o>0))return l;do l.push(s=new Date(+i)),r(i,o),t(i);while(s<i&&i<n)return l},a.filter=i=>e3(r=>{if(r>=r)for(;t(r),!i(r);)r.setTime(r-1)},(t,n)=>{if(t>=t)if(n<0)for(;++n<=0;)for(;r(t,-1),!i(t););else for(;--n>=0;)for(;r(t,1),!i(t););}),i&&(a.count=(r,n)=>(e1.setTime(+r),e2.setTime(+n),t(e1),t(e2),Math.floor(i(e1,e2))),a.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?a.filter(n?r=>n(r)%t==0:r=>a.count(0,r)%t==0):a:null),a}let e4=e3(t=>t.setHours(0,0,0,0),(t,r)=>t.setDate(t.getDate()+r),(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1);e4.range;let e6=e3(t=>{t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r)},(t,r)=>(r-t)/864e5,t=>t.getUTCDate()-1);e6.range;let e5=e3(t=>{t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r)},(t,r)=>(r-t)/864e5,t=>Math.floor(t/864e5));function e8(t){return e3(r=>{r.setDate(r.getDate()-(r.getDay()+7-t)%7),r.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+7*r)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}e5.range;let e7=e8(0),e9=e8(1),te=e8(2),tt=e8(3),tr=e8(4),ti=e8(5),tn=e8(6);function ta(t){return e3(r=>{r.setUTCDate(r.getUTCDate()-(r.getUTCDay()+7-t)%7),r.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+7*r)},(t,r)=>(r-t)/6048e5)}e7.range,e9.range,te.range,tt.range,tr.range,ti.range,tn.range;let to=ta(0),ts=ta(1),tl=ta(2),tu=ta(3),tc=ta(4),th=ta(5),tf=ta(6);to.range,ts.range,tl.range,tu.range,tc.range,th.range,tf.range;let td=e3(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r)},(t,r)=>r.getFullYear()-t.getFullYear(),t=>t.getFullYear());td.every=t=>isFinite(t=Math.floor(t))&&t>0?e3(r=>{r.setFullYear(Math.floor(r.getFullYear()/t)*t),r.setMonth(0,1),r.setHours(0,0,0,0)},(r,i)=>{r.setFullYear(r.getFullYear()+i*t)}):null,td.range;let tp=e3(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r)},(t,r)=>r.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());function tm(t){if(0<=t.y&&t.y<100){var r=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return r.setFullYear(t.y),r}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function tg(t){if(0<=t.y&&t.y<100){var r=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return r.setUTCFullYear(t.y),r}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ty(t,r,i){return{y:t,m:r,d:i,H:0,M:0,S:0,L:0}}tp.every=t=>isFinite(t=Math.floor(t))&&t>0?e3(r=>{r.setUTCFullYear(Math.floor(r.getUTCFullYear()/t)*t),r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,i)=>{r.setUTCFullYear(r.getUTCFullYear()+i*t)}):null,tp.range;var tv={"-":"",_:" ",0:"0"},t_=/^\s*\d+/,tb=/^%/,tx=/[\\^$*+?|[\]().{}]/g;function tw(t,r,i){var n=t<0?"-":"",a=(n?-t:t)+"",o=a.length;return n+(o<i?Array(i-o+1).join(r)+a:a)}function tE(t){return t.replace(tx,"\\$&")}function tT(t){return RegExp("^(?:"+t.map(tE).join("|")+")","i")}function tA(t){return new Map(t.map((t,r)=>[t.toLowerCase(),r]))}function tS(t,r,i){var n=t_.exec(r.slice(i,i+1));return n?(t.w=+n[0],i+n[0].length):-1}function tC(t,r,i){var n=t_.exec(r.slice(i,i+1));return n?(t.u=+n[0],i+n[0].length):-1}function tM(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.U=+n[0],i+n[0].length):-1}function tD(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.V=+n[0],i+n[0].length):-1}function tP(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.W=+n[0],i+n[0].length):-1}function tI(t,r,i){var n=t_.exec(r.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1}function tk(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),i+n[0].length):-1}function tO(t,r,i){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(r.slice(i,i+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),i+n[0].length):-1}function tN(t,r,i){var n=t_.exec(r.slice(i,i+1));return n?(t.q=3*n[0]-3,i+n[0].length):-1}function tL(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.m=n[0]-1,i+n[0].length):-1}function tR(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1}function tF(t,r,i){var n=t_.exec(r.slice(i,i+3));return n?(t.m=0,t.d=+n[0],i+n[0].length):-1}function tB(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1}function tz(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1}function tj(t,r,i){var n=t_.exec(r.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1}function tU(t,r,i){var n=t_.exec(r.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1}function tV(t,r,i){var n=t_.exec(r.slice(i,i+6));return n?(t.L=Math.floor(n[0]/1e3),i+n[0].length):-1}function t$(t,r,i){var n=tb.exec(r.slice(i,i+1));return n?i+n[0].length:-1}function tG(t,r,i){var n=t_.exec(r.slice(i));return n?(t.Q=+n[0],i+n[0].length):-1}function tq(t,r,i){var n=t_.exec(r.slice(i));return n?(t.s=+n[0],i+n[0].length):-1}function tH(t,r){return tw(t.getDate(),r,2)}function tW(t,r){return tw(t.getHours(),r,2)}function tZ(t,r){return tw(t.getHours()%12||12,r,2)}function tY(t,r){return tw(1+e4.count(td(t),t),r,3)}function tX(t,r){return tw(t.getMilliseconds(),r,3)}function tK(t,r){return tX(t,r)+"000"}function tQ(t,r){return tw(t.getMonth()+1,r,2)}function tJ(t,r){return tw(t.getMinutes(),r,2)}function t0(t,r){return tw(t.getSeconds(),r,2)}function t1(t){var r=t.getDay();return 0===r?7:r}function t2(t,r){return tw(e7.count(td(t)-1,t),r,2)}function t3(t){var r=t.getDay();return r>=4||0===r?tr(t):tr.ceil(t)}function t4(t,r){return t=t3(t),tw(tr.count(td(t),t)+(4===td(t).getDay()),r,2)}function t6(t){return t.getDay()}function t5(t,r){return tw(e9.count(td(t)-1,t),r,2)}function t8(t,r){return tw(t.getFullYear()%100,r,2)}function t7(t,r){return tw((t=t3(t)).getFullYear()%100,r,2)}function t9(t,r){return tw(t.getFullYear()%1e4,r,4)}function re(t,r){var i=t.getDay();return tw((t=i>=4||0===i?tr(t):tr.ceil(t)).getFullYear()%1e4,r,4)}function rt(t){var r=t.getTimezoneOffset();return(r>0?"-":(r*=-1,"+"))+tw(r/60|0,"0",2)+tw(r%60,"0",2)}function rr(t,r){return tw(t.getUTCDate(),r,2)}function ri(t,r){return tw(t.getUTCHours(),r,2)}function rn(t,r){return tw(t.getUTCHours()%12||12,r,2)}function ra(t,r){return tw(1+e6.count(tp(t),t),r,3)}function ro(t,r){return tw(t.getUTCMilliseconds(),r,3)}function rs(t,r){return ro(t,r)+"000"}function rl(t,r){return tw(t.getUTCMonth()+1,r,2)}function ru(t,r){return tw(t.getUTCMinutes(),r,2)}function rc(t,r){return tw(t.getUTCSeconds(),r,2)}function rh(t){var r=t.getUTCDay();return 0===r?7:r}function rf(t,r){return tw(to.count(tp(t)-1,t),r,2)}function rd(t){var r=t.getUTCDay();return r>=4||0===r?tc(t):tc.ceil(t)}function rp(t,r){return t=rd(t),tw(tc.count(tp(t),t)+(4===tp(t).getUTCDay()),r,2)}function rm(t){return t.getUTCDay()}function rg(t,r){return tw(ts.count(tp(t)-1,t),r,2)}function ry(t,r){return tw(t.getUTCFullYear()%100,r,2)}function rv(t,r){return tw((t=rd(t)).getUTCFullYear()%100,r,2)}function r_(t,r){return tw(t.getUTCFullYear()%1e4,r,4)}function rb(t,r){var i=t.getUTCDay();return tw((t=i>=4||0===i?tc(t):tc.ceil(t)).getUTCFullYear()%1e4,r,4)}function rx(){return"+0000"}function rw(){return"%"}function rE(t){return+t}function rT(t){return Math.floor(t/1e3)}cx=(cb=function(t){var r=t.dateTime,i=t.date,n=t.time,a=t.periods,o=t.days,s=t.shortDays,l=t.months,u=t.shortMonths,c=tT(a),h=tA(a),f=tT(o),d=tA(o),p=tT(s),m=tA(s),g=tT(l),y=tA(l),v=tT(u),_=tA(u),b={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:null,d:tH,e:tH,f:tK,g:t7,G:re,H:tW,I:tZ,j:tY,L:tX,m:tQ,M:tJ,p:function(t){return a[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:rE,s:rT,S:t0,u:t1,U:t2,V:t4,w:t6,W:t5,x:null,X:null,y:t8,Y:t9,Z:rt,"%":rw},x={a:function(t){return s[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return l[t.getUTCMonth()]},c:null,d:rr,e:rr,f:rs,g:rv,G:rb,H:ri,I:rn,j:ra,L:ro,m:rl,M:ru,p:function(t){return a[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)}
1,Q:rE,s:rT,S:rc,u:rh,U:rf,V:rp,w:rm,W:rg,x:null,X:null,y:ry,Y:r_,Z:rx,"%":rw},w={a:function(t,r,i){var n=p.exec(r.slice(i));return n?(t.w=m.get(n[0].toLowerCase()),i+n[0].length):-1},A:function(t,r,i){var n=f.exec(r.slice(i));return n?(t.w=d.get(n[0].toLowerCase()),i+n[0].length):-1},b:function(t,r,i){var n=v.exec(r.slice(i));return n?(t.m=_.get(n[0].toLowerCase()),i+n[0].length):-1},B:function(t,r,i){var n=g.exec(r.slice(i));return n?(t.m=y.get(n[0].toLowerCase()),i+n[0].length):-1},c:function(t,i,n){return A(t,r,i,n)},d:tR,e:tR,f:tV,g:tk,G:tI,H:tB,I:tB,j:tF,L:tU,m:tL,M:tz,p:function(t,r,i){var n=c.exec(r.slice(i));return n?(t.p=h.get(n[0].toLowerCase()),i+n[0].length):-1},q:tN,Q:tG,s:tq,S:tj,u:tC,U:tM,V:tD,w:tS,W:tP,x:function(t,r,n){return A(t,i,r,n)},X:function(t,r,i){return A(t,n,r,i)},y:tk,Y:tI,Z:tO,"%":t$};function E(t,r){return function(i){var n,a,o,s=[],l=-1,u=0,c=t.length;for(i instanceof Date||(i=new Date(+i));++l<c;)37===t.charCodeAt(l)&&(s.push(t.slice(u,l)),null!=(a=tv[n=t.charAt(++l)])?n=t.charAt(++l):a="e"===n?" ":"0",(o=r[n])&&(n=o(i,a)),s.push(n),u=l+1);return s.push(t.slice(u,l)),s.join("")}}function T(t,r){return function(i){var n,a,o=ty(1900,void 0,1);if(A(o,t,i+="",0)!=i.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(!r||"Z"in o||(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(n=(a=(n=tg(ty(o.y,0,1))).getUTCDay())>4||0===a?ts.ceil(n):ts(n),n=e6.offset(n,(o.V-1)*7),o.y=n.getUTCFullYear(),o.m=n.getUTCMonth(),o.d=n.getUTCDate()+(o.w+6)%7):(n=(a=(n=tm(ty(o.y,0,1))).getDay())>4||0===a?e9.ceil(n):e9(n),n=e4.offset(n,(o.V-1)*7),o.y=n.getFullYear(),o.m=n.getMonth(),o.d=n.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:+("W"in o)),a="Z"in o?tg(ty(o.y,0,1)).getUTCDay():tm(ty(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(a+5)%7:o.w+7*o.U-(a+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,tg(o)):tm(o)}}function A(t,r,i,n){for(var a,o,s=0,l=r.length,u=i.length;s<l;){if(n>=u)return -1;if(37===(a=r.charCodeAt(s++))){if(!(o=w[(a=r.charAt(s++))in tv?r.charAt(s++):a])||(n=o(t,i,n))<0)return -1}else if(a!=i.charCodeAt(n++))return -1}return n}return b.x=E(i,b),b.X=E(n,b),b.c=E(r,b),x.x=E(i,x),x.X=E(n,x),x.c=E(r,x),{format:function(t){var r=E(t+="",b);return r.toString=function(){return t},r},parse:function(t){var r=T(t+="",!1);return r.toString=function(){return t},r},utcFormat:function(t){var r=E(t+="",x);return r.toString=function(){return t},r},utcParse:function(t){var r=T(t+="",!0);return r.toString=function(){return t},r}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,cb.parse,cw=cb.utcFormat,cb.utcParse;let rA=e3(t=>{t.setTime(t-t.getMilliseconds())},(t,r)=>{t.setTime(+t+1e3*r)},(t,r)=>(r-t)/1e3,t=>t.getUTCSeconds());rA.range;let rS=e3(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},(t,r)=>{t.setTime(+t+6e4*r)},(t,r)=>(r-t)/6e4,t=>t.getMinutes());rS.range;let rC=e3(t=>{t.setUTCSeconds(0,0)},(t,r)=>{t.setTime(+t+6e4*r)},(t,r)=>(r-t)/6e4,t=>t.getUTCMinutes());rC.range;let rM=e3(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())},(t,r)=>{t.setTime(+t+36e5*r)},(t,r)=>(r-t)/36e5,t=>t.getHours());rM.range;let rD=e3(t=>{t.setUTCMinutes(0,0,0)},(t,r)=>{t.setTime(+t+36e5*r)},(t,r)=>(r-t)/36e5,t=>t.getUTCHours());rD.range;let rP=e3(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,r)=>{t.setMonth(t.getMonth()+r)},(t,r)=>r.getMonth()-t.getMonth()+(r.getFullYear()-t.getFullYear())*12,t=>t.getMonth());rP.range;
1let rI=e3(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCMonth(t.getUTCMonth()+r)},(t,r)=>r.getUTCMonth()-t.getUTCMonth()+(r.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());rI.range;var eN=eN;function rk(t){if(null==t)return;let r=t[0],i=t[t.length-1];return(0,eN.default)(r,i)}let rO=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",1e3],["5 seconds",5e3],["15 seconds",15e3],["30 seconds",3e4],["minute",6e4],["5 minutes",3e5],["15 minutes",9e5],["30 minutes",18e5],["hour",36e5],["3 hours",108e5],["6 hours",216e5],["12 hours",432e5],["day",864e5],["2 days",1728e5],["week",6048e5],["2 weeks",12096e5],["month",2592e6],["3 months",7776e6],["6 months",15552e6],["year",31536e6],["2 years",63072e6],["5 years",15768e7],["10 years",31536e7],["20 years",63072e7],["50 years",15768e8],["100 years",31536e8]],rN=new Map([["second",1e3],["minute",6e4],["hour",36e5],["day",864e5],["monday",6048e5],["tuesday",6048e5],["wednesday",6048e5],["thursday",6048e5],["friday",6048e5],["saturday",6048e5],["sunday",6048e5],["week",6048e5],["month",2592e6],["year",31536e6]]),rL=new Map([["second",rA],["minute",rS],["hour",rM],["day",e4],["monday",e9],["tuesday",te],["wednesday",tt],["thursday",tr],["friday",ti],["saturday",tn],["sunday",e7],["week",e7],["month",rP],["year",td]]),rR=new Map([["second",rA],["minute",rC],["hour",rD],["day",e5],["monday",ts],["tuesday",tl],["wednesday",tu],["thursday",tc],["friday",th],["saturday",tf],["sunday",to],["week",to],["month",rI],["year",tp]]),rF=Symbol("intervalDuration"),rB=Symbol("intervalType");for(let[t,r]of rL)r[rF]=rN.get(t),r[rB]="time";for(let[t,r]of rR)r[rF]=rN.get(t),r[rB]="utc";let rz=[["year",tp,"utc"],["month",rI,"utc"],["day",e5,"utc",15552e6],["hour",rD,"utc",2592e5],["minute",rC,"utc",216e5],["second",rA,"utc",18e5]],rj=[["year",td,"time"],["month",rP,"time"],["day",e4,"time",15552e6],["hour",rM,"time",2592e5],["minute",rS,"time",216e5],["second",rA,"time",18e5]],rU=[rz[0],rj[0],rz[1],rj[1],rz[2],rj[2],...rz.slice(3)];function rV(t){let r=`${t}`.toLowerCase();r.endsWith("s")&&(r=r.slice(0,-1));let i=1,n=/^(?:(\d+)\s+)/.exec(r);switch(n&&(r=r.slice(n[0].length),i=+n[1]),r){case"quarter":r="month",i*=3;break;case"half":r="month",i*=6}let a=rR.get(r);if(!a)throw Error(`unknown interval: ${t}`);if(i>1&&!a.every)throw Error(`non-periodic interval: ${r}`);return[r,i]}function r$(t){return rq(rV(t),"time")}function rG(t){return rq(rV(t),"utc")}function rq([t,r],i){let n=("time"===i?rL:rR).get(t);return r>1&&((n=n.every(r))[rF]=rN.get(t)*r,n[rB]=i),n}function rH(t,r){if(!(r>1))return;let i=t[rF];if(!rO.some(([,t])=>t===i)||i%864e5==0&&864e5<i&&i<2592e6)return;let[n]=rO[(0,e0.default)(([,t])=>Math.log(t)).center(rO,Math.log(i*r))];return("time"===t[rB]?r$:rG)(n)}function rW(t,r,i){var n;let a="time"===r?cx:cw;if(null==i)return a("year"===t?"%Y":"month"===t?"%Y-%m":"day"===t?"%Y-%m-%d":"hour"===t||"minute"===t?"%Y-%m-%dT%H:%M":"second"===t?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let o="left"===(n=i)||"right"===n?(t,r)=>` 2${t} 3${r}`:"top"===n?(t,r)=>`${r} 4${t}`:(t,r)=>`${t} 5${r}`;switch(t){case"millisecond":return rZ(a(".%L"),a(":%M:%S"),o);case"second":return rZ(a(":%S"),a("%-I:%M"),o);case"minute":return rZ(a("%-I:%M"),a("%p"),o);case"hour":return rZ(a("%-I %p"),a("%b %-d"),o);case"day":return rZ(a("%-d"),a("%b"),o);case"month":return rZ(a("%b"),a("%Y"),o);case"year":return a("%Y")}throw Error("unable to format time ticks")}function rZ(t,r,i){return(n,a,o)=>{let s=t(n,a),l=r(n,a),u=a-rk(o);return a!==u&&void 0!==o[u]&&l===r(o[u],u)?s:i(s,l)}}let rY=Object.getPrototypeOf(Uint8Array),rX=Object.prototype.toString;function rK(t){return t instanceof Array||t instanceof rY}function rQ(t){var r;return t instanceof rY&&!((r=t)instanceof BigInt64Array||r instanceof BigUint64Array)}function rJ(t){var r;return t?.prototype instanceof rY&&(r=t)!==BigInt64Array&&r!==BigUint64Array}let r0=Symbol("reindex");function r1(t,r,i){var n,a;let o=typeof r;return"string"===o?i6(t)?r4(t.getChild(r),i):r2(t,r8(r),i):"function"===o?r2(t,r,i):"number"===o||r instanceof Date||"boolean"===o?ix(t,il(r),i):"function"==typeof r?.transform?r3(r.transform(t),i):(n=r3(r,i),a=t?.[r0],null!=n&&a?iN(n,a):n)}function r2(t,r,i){return ix(t,rJ(i)?(t,i)=>ic(r(t,i)):r,i)}function r3(t,r){return void 0===r?i_(t):i5(t)?r4(t,r):t instanceof r?t:r.from(t,rJ(r)&&!rQ(t)?ic:void 0)}function r4(t,r){var i;
5return null==t?t:(void 0===r||r===Array)&&(i=t.type)&&(8===i.typeId||10===i.typeId)&&1===i.unit?ih(r6(t)):r3(r6(t),r)}function r6(t){return t.nullCount?t.toJSON():t.toArray()}let r5=[null],r8=t=>r=>{let i=r[t];return void 0===i&&"Feature"===r.type?r.properties?.[t]:i},r7={transform:iO},r9={transform:t=>t},ie=()=>1,ir=()=>!0,ii=t=>null==t?t:`${t}`,ia=t=>null==t?t:+t,io=t=>t?t[0]:void 0,is=t=>t?t[1]:void 0,il=t=>()=>t;function iu(t){return rQ(t)?t:ix(t,ic,Float64Array)}function ic(t){return null==t?NaN:Number(t)}function ih(t){return ix(t,id)}function id(t){return t instanceof Date&&!isNaN(t)?t:"string"==typeof t?eJ(t):null==t||isNaN(t=Number(t))?void 0:new Date(t)}function ip(t,r){return void 0===t&&(t=r),null===t?[void 0,"none"]:iK(t)?[void 0,t]:[t,void 0]}function im(t,r){return void 0===t&&(t=r),null===t||"number"==typeof t?[void 0,t]:[t,void 0]}function ig(t,r,i){if(null!=t)return iy(t,r,i)}function iy(t,r,i){let n=`${t}`.toLowerCase();if(!i.includes(n))throw Error(`invalid ${r}: ${t}`);return n}function iv(t){return i6(t)?t:i_(t)}function i_(t){if(null==t||rK(t))return t;if(i5(t))return r4(t);if(ib(t))switch(t.type){case"FeatureCollection":return t.features;case"GeometryCollection":return t.geometries;default:return[t]}return Array.from(t)}function ib(t){switch(t?.type){case"FeatureCollection":case"GeometryCollection":case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":return!0;default:return!1}}function ix(t,r,i=Array){return null==t?t:t instanceof i?t.map(r):i.from(t,r)}function iw(t,r=Array){return t instanceof r?t.slice():r.from(t)}function iE({x:t,x1:r,x2:i}){return void 0!==t||void 0!==r||void 0!==i}function iT({y:t,y1:r,y2:i}){return void 0!==t||void 0!==r||void 0!==i}function iA(t){return iE(t)||iT(t)||void 0!==t.interval}function iS(t){return t?.toString===rX}function iC(t){return iS(t)&&(void 0!==t.type||void 0!==t.domain)}function iM(t){return iS(t)&&"function"!=typeof t.transform}function iD(t){return iM(t)&&void 0===t.value&&void 0===t.channel}function iP(t,r,i,n=r9){return void 0===r&&void 0===i?(r=0,i=void 0===t?n:t):void 0===r?r=void 0===t?0:t:void 0===i&&(i=void 0===t?0:t),[r,i]}function iI(t,r){return void 0===t&&void 0===r?[io,is]:[t,r]}function ik(t){return rK(t)?t.length:t?.numRows}function iO(t){let r=ik(t),i=new Uint32Array(r);for(let t=0;t<r;++t)i[t]=t;return i}function iN(t,r){return rK(t)?ix(r,r=>t[r],t.constructor):ix(r,r=>t.at(r))}function iL(t){return null!==t&&"object"==typeof t?t.valueOf():t}function iR(t){let r;return[{transform:()=>r,label:iF(t)},t=>r=t]}function iF(t,r){return"string"==typeof t?t:t&&void 0!==t.label?t.label:r}function iB(t,r){return{transform(i){let n=t.transform(i),a=r.transform(i);return iH(n)||iH(a)?ix(n,(t,r)=>new Date((+n[r]+ +a[r])/2)):ix(n,(t,r)=>(+n[r]+ +a[r])/2,Float64Array)},label:t.label}}function iz(t,r){let i=ij(t,r);return i&&(t=>eL(t)?i.floor(t):t)}function ij(t,r){if(null!=t){if("number"==typeof t){var i;let r;return 0<(i=+t)&&i<1&&Number.isInteger(1/i)&&(i=-1/i),r=Math.abs(i),i<0?{floor:t=>Math.floor(t*r)/r,offset:(t,i=1)=>(t*r+Math.floor(i))/r,range:(t,i)=>eK(Math.ceil(t*r),i*r).map(t=>t/r)}:{floor:t=>Math.floor(t/r)*r,offset:(t,i=1)=>t+r*Math.floor(i),range:(t,i)=>eK(Math.ceil(t/r),i/r).map(t=>t*r)}}if("string"==typeof t)return("time"===r?r$:rG)(t);if("function"!=typeof t.floor)throw Error("invalid interval; missing floor method");if("function"!=typeof t.offset)throw Error("invalid interval; missing offset method");return t}}function iU(t,r){if((t=ij(t,r))&&"function"!=typeof t.range)throw Error("invalid interval: missing range method");return t}function iV(t){return void 0===t||iM(t)?t:{value:t}}function i$(t){return t&&"function"==typeof t[Symbol.iterator]}function iG(t){for(let r of t)if(null!=r)return"object"!=typeof r||r instanceof Date}function iq(t){for(let r of t){if(null==r)continue;let t=typeof r;return"string"===t||"boolean"===t}}function iH(t){for(let r of t)if(null!=r)return r instanceof Date}function iW(t){for(let r of t)if(null!=r)return"string"==typeof r&&isNaN(r)&&eJ(r)}function iZ(t){for(let r of t)if(null!=r){if("string"!=typeof r)return!1;if(r.trim())return!isNaN(r)}}function iY(t,r){let i;for(let n of t)if(null!=n){if(!r(n))return!1;i=!0}return i}let iX=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function iK(t){return"string"==typeof t&&(t=t.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(t)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(t)||iX.has(t))}function iQ(t){return"number"==typeof t&&(0<=t&&t<=1||isNaN(t))}function iJ(t){return null==t||i0(t)}function i0(t){return/^\s*none\s*$/i.test(t)}function i1(t,r){return ig(t,r,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function i2(t="middle"){return i1(t,"frameAnchor")}function i3(t){let r;return i$(t)?(console.warn("named iterables are deprecated; please use an object instead"),r=new Set,Object.fromEntries(Array.from(t,t=>{let{name:i}=t;if(null==i)throw Error("missing name");let n=`${i}`;if("__proto__"===n)throw Error(`illegal name: ${n}`);if(r.has(n))throw Error(`duplicate name: ${n}`);return r.add(n),[i,t]}))):t}function i4(t){return!0===t?t="frame":!1===t?t=null:ib(t)||null==t||"sphere"===(t=iy(t,"clip",["frame","sphere"]))&&(t={type:"Sphere"}),t}function i6(t){return t&&"function"==typeof t.getChild&&"function"==typeof t.toArray&&t.schema&&Array.isArray(t.schema.fields)}function i5(t){return t&&"function"==typeof t.toArray&&t.type}let i8=Symbol("position"),i7=Symbol("color"),i9=Symbol("radius"),ne=Symbol("length"),nt=Symbol("opacity"),nr=Symbol("symbol"),ni=Symbol("projection"),nn=new Map([["x",i8],["y",i8],["fx",i8],["fy",i8],["r",i9],["color",i7],["opacity",nt],["symbol",nr],["length",ne],["projection",ni]]),na=Math.abs,no=Math.atan2,ns=Math.cos,nl=Math.max,nu=Math.min,nc=Math.sin,nh=Math.sqrt,nf=Math.PI,nd=nf/2,np=2*nf;function nm(t){return t>=1?nd:t<=-1?-nd:Math.asin(t)}let ng=nh(3),ny={draw(t,r){let i=.59436*nh(r+nu(r/28,.75)),n=i/2,a=n*ng;t.moveTo(0,i),t.lineTo(0,-i),t.moveTo(-a,-n),t.lineTo(a,n),t.moveTo(-a,n),t.lineTo(a,-n)}},nv={draw(t,r){let i=.62625*nh(r);t.moveTo(0,-i),t.lineTo(i,0),t.lineTo(0,i),t.lineTo(-i,0),t.closePath()}},n_={draw(t,r){let i=.87559*nh(r-nu(r/7,2));t.moveTo(-i,0),t.lineTo(i,0),t.moveTo(0,i),t.lineTo(0,-i)}},nb={draw(t,r){let i=.4431*nh(r);t.moveTo(i,i),t.lineTo(i,-i),t.lineTo(-i,-i),t.lineTo(-i,i),t.closePath()}},nx=nh(3),nw={draw(t,r){let i=.6824*nh(r),n=i/2,a=i*nx/2;t.moveTo(0,-i),t.lineTo(a,n),t.lineTo(-a,n),t.closePath()}},nE={draw(t,r){let i=.6189*nh(r-nu(r/6,1.7));t.moveTo(-i,-i),t.lineTo(i,i),t.moveTo(-i,i),t.lineTo(i,-i)}},nT={draw(t,r){let i=nh(r/nf);t.moveTo(i,0),t.arc(0,0,i,0,np)}},nA={draw(t,r){let i=nh(r/5)/2;t.moveTo(-3*i,-i),t.lineTo(-i,-i),t.lineTo(-i,-3*i),t.lineTo(i,-3*i),t.lineTo(i,-i),t.lineTo(3*i,-i),t.lineTo(3*i,i),t.lineTo(i,i),t.lineTo(i,3*i),t.lineTo(-i,3*i),t.lineTo(-i,i),t.lineTo(-3*i,i),t.closePath()}},nS=nh(1/3),nC=2*nS,nM={draw(t,r){let i=nh(r/nC),n=i*nS;t.moveTo(0,-i),t.lineTo(n,0),t.lineTo(0,i),t.lineTo(-n,0),t.closePath()}},nD={draw(t,r){let i=nh(r),n=-i/2;t.rect(n,n,i,i)}},nP=nc(nf/10)/nc(7*nf/10),nI=nc(np/10)*nP,nk=-ns(np/10)*nP,nO={draw(t,r){let i=nh(.8908130915292852*r),n=nI*i,a=nk*i;t.moveTo(0,-i),t.lineTo(n,a);for(let r=1;r<5;++r){let o=np*r/5,s=ns(o),l=nc(o);t.lineTo(l*i,-s*i),t.lineTo(s*n-l*a,l*n+s*a)}t.closePath()}},nN=nh(3),nL={draw(t,r){let i=-nh(r/(3*nN));t.moveTo(0,2*i),t.lineTo(-nN*i,-i),t.lineTo(nN*i,-i),t.closePath()}},nR=nh(3)/2,nF=1/nh(12),nB=(nF/2+1)*3,nz={draw(t,r){let i=nh(r/nB),n=i/2,a=i*nF,o=i*nF+i,s=-n;t.moveTo(n,a),t.lineTo(n,o),t.lineTo(s,o),t.lineTo(-.5*n-nR*a,nR*n+-.5*a),t.lineTo(-.5*n-nR*o,nR*n+-.5*o),t.lineTo(-.5*s-nR*o,nR*s+-.5*o),t.lineTo(-.5*n+nR*a,-.5*a-nR*n),t.lineTo(-.5*n+nR*o,-.5*o-nR*n),t.lineTo(-.5*s+nR*o,-.5*o-nR*s),t.closePath()}},nj=2/Math.sqrt(3),nU=new Map([["asterisk",ny],["circle",nT],["cross",nA],["diamond",nM],["diamond2",nv],["hexagon",{draw(t,r){let i=Math.sqrt(r/Math.PI),n=i*nj,a=n/2;
5t.moveTo(0,n),t.lineTo(i,a),t.lineTo(i,-a),t.lineTo(0,-n),t.lineTo(-i,-a),t.lineTo(-i,a),t.closePath()}}],["plus",n_],["square",nD],["square2",nb],["star",nO],["times",nE],["triangle",nL],["triangle2",nw],["wye",nz]]);function nV(t){return t&&"function"==typeof t.draw}function n$(t){return!!nV(t)||"string"==typeof t&&nU.has(t.toLowerCase())}function nG(t){if(null==t||nV(t))return t;let r=nU.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid symbol: ${t}`)}function nq(t,r){let i,n=0,a=0,o=0;if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(i=r-a,a+=i/++n,o+=i*(r-a));else{let s=-1;for(let l of t)null!=(l=r(l,++s,t))&&(l*=1)>=l&&(i=l-a,a+=i/++n,o+=i*(l-a))}if(n>1)return o/(n-1)}function nH(t,r){let i=nq(t,r);return i?Math.sqrt(i):i}function nW(t,r){let i,n=-1,a=-1;if(void 0===r)for(let r of t)++a,null!=r&&(i<r||void 0===i&&r>=r)&&(i=r,n=a);else for(let o of t)null!=(o=r(o,++a,t))&&(i<o||void 0===i&&o>=o)&&(i=o,n=a);return n}function nZ(t,r){let i=0,n=0;if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(++i,n+=r);else{let a=-1;for(let o of t)null!=(o=r(o,++a,t))&&(o*=1)>=o&&(++i,n+=o)}if(i)return n/i}function nY(t,r){return eX(t,.5,r)}function nX(t,r){let i,n=-1,a=-1;if(void 0===r)for(let r of t)++a,null!=r&&(i>r||void 0===i&&r>=r)&&(i=r,n=a);else for(let o of t)null!=(o=r(o,++a,t))&&(i>o||void 0===i&&o>=o)&&(i=o,n=a);return n}function nK(t,r){let i,n=new eE;if(void 0===r)for(let r of t)null!=r&&r>=r&&n.set(r,(n.get(r)||0)+1);else{let i=-1;for(let a of t)null!=(a=r(a,++i,t))&&a>=a&&n.set(a,(n.get(a)||0)+1)}let a=0;for(let[t,r]of n)r>a&&(a=r,i=t);return i}function nQ(t,r){let i=0;if(void 0===r)for(let r of t)(r*=1)&&(i+=r);else{let n=-1;for(let a of t)(a=+r(a,++n,t))&&(i+=a)}return i}function nJ(t){return{reduceIndex:(r,i)=>t(r,t=>i[t])}}function n0(t){return{reduceIndex(r,i){let n=t(r,t=>i[t]);return iH(i)?new Date(n):n}}}let n1={reduceIndex:(t,r)=>iN(r,t)},n2={reduceIndex:(t,r)=>r[t[0]]},n3={reduceIndex:(t,r)=>r[t[t.length-1]]},n4={label:"Frequency",reduceIndex:t=>t.length},n6={label:"Distinct",reduceIndex(t,r){let i=new eT;for(let n of t)i.add(r[n]);return i.size}},n5=nJ(nQ);function n8(t,r){return null==t?{scope:r,label:"Frequency",reduceIndex:(t,r,i=1)=>t.length/i}:{scope:r,reduceIndex:(t,r,i=1)=>nQ(t,t=>r[t])/i}}function n7(t,{scale:r,type:i,value:n,filter:a,hint:o,label:s=iF(n)},l){return void 0===o&&"function"==typeof n?.transform&&(o=n.hint),n9(l,{scale:r,type:i,value:r1(t,n),label:s,filter:a,hint:o})}function n9(t,r){let{scale:i,value:n}=r;if(!0===i||"auto"===i)switch(t){case"fill":case"stroke":case"color":r.scale=!0!==i&&iY(n,iK)?null:"color",r.defaultScale="color";break;case"fillOpacity":case"strokeOpacity":case"opacity":r.scale=!0!==i&&iY(n,iQ)?null:"opacity",r.defaultScale="opacity";break;case"symbol":!0!==i&&iY(n,n$)?(r.scale=null,r.value=ix(n,nG)):r.scale="symbol",r.defaultScale="symbol";break;default:r.scale=nn.has(t)?t:null}else if(!1===i)r.scale=null;else if(null!=i&&!nn.has(i))throw Error(`unknown scale: ${i}`);return r}function ae(t,r,i){let n=at(t,r);return ix(at(t,i),(t,r)=>Math.abs(t-n[r]),Float64Array)}function at(t,r,i){let n=t[r];if(n||void 0===i||(n=t[i]),n)return n.value;throw Error(`missing channel: ${r}`)}function ar([t,r],[i,n]){return eR(r,n)||eR(t,i)}function ai([t,r],[i,n]){return eF(r,n)||eR(t,i)}function an(t,r){let i=t[r];if(i){for(;i.source;)i=i.source;return null===i.source?null:i}}function aa(t){return 0|t.length}function ao(t){return!(t>0)}function as(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}var eN=eN;function al(t,r){let i,n;if(void 0===r)for(let r of t)null!=r&&(void 0===i?r>=r&&(i=n=r):(i>r&&(i=r),n<r&&(n=r)));else{let a=-1;for(let o of t)null!=(o=r(o,++a,t))&&(void 0===i?o>=o&&(i=n=o):(i>o&&(i=o),n<o&&(n=o)))}return[i,n]}var au=t.i(164441),ac=t.i(825004);function ah(t){return function(r,i){var n=t((r=(0,au.hcl)(r)).h,(i=(0,au.hcl)(i)).h),a=(0,ac.default)(r.c,i.c),o=(0,ac.default)(r.l,i.l),s=(0,ac.default)(r.opacity,i.opacity);return function(t){return r.h=n(t),r.c=a(t),r.l=o(t),r.opacity=s(t),r+""}}}let af=ah(ac.hue);ah(ac.default);var ad=t.i(47238);function ap(t){return function(r,i){var n=t((r=(0,ad.hsl)(r)).h,(i=(0,ad.hsl)(i)).h),a=(0,ac.default)(r.s,i.s),o=(0,ac.default)(r.l,i.l),s=(0,ac.default)(r.opacity,i.opacity);return function(t){return r.h=n(t),r.s=a(t),r.l=o(t),r.opacity=s(t),r+""}}}let am=ap(ac.hue);ap(ac.default);var ag=t.i(132628),ay=t.i(552491),av=t.i(462573),a_=t.i(185654),ab=t.i(685575);function ax(t,r){void 0===r&&(r=t,t=ab.default);for(var i=0,n=r.length-1,a=r[0],o=Array(n<0?0:n);i<n;)o[i]=t(a,a=r[++i]);return function(t){var r=Math.max(0,Math.min(n-1,Math.floor(t*=n)));return o[r](t-r)}}function aw(t,r){for(var i=Array(r),n=0;n<r;++n)i[n]=t(n/(r-1));return i}function aE(t){if("function"!=typeof t[Symbol.iterator])throw TypeError("values is not iterable");return Array.from(t).reverse()}var aT=t.i(971351),aA=t.i(997155);function aS(t){var r;function i(t){return null==t||isNaN(t*=1)?r:t}return i.invert=i,i.domain=i.range=function(r){return arguments.length?(t=Array.from(r,aA.default),i):t.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return aS(t).unknown(r)},t=arguments.length?Array.from(t,aA.default):[0,1],(0,aT.linearish)(i)}var aC=t.i(282803),aM=t.i(327975),aD=t.i(64912),aP=t.i(34855);function aI(t,r){t=t.slice();var i,n=0,a=t.length-1,o=t[n],s=t[a];return s<o&&(i=n,n=a,a=i,i=o,o=s,s=i),t[n]=r.floor(o),t[a]=r.ceil(s),t}var ak=t.i(659086),aO=t.i(365332);function aN(t){return Math.log(t)}function aL(t){return Math.exp(t)}function aR(t){return-Math.log(-t)}function aF(t){return-Math.exp(-t)}function aB(t){return isFinite(t)?+("1e"+t):t<0?0:t}function az(t){return(r,i)=>-t(-r,i)}function aj(t){let r,i,n=t(aN,aL),a=n.domain,o=10;function s(){var s,l;return r=(s=o)===Math.E?Math.log:10===s&&Math.log10||2===s&&Math.log2||(s=Math.log(s),t=>Math.log(t)/s),i=10===(l=o)?aB:l===Math.E?Math.exp:t=>Math.pow(l,t),a()[0]<0?(r=az(r),i=az(i),t(aR,aF)):t(aN,aL),n}return n.base=function(t){return arguments.length?(o=+t,s()):o},n.domain=function(t){return arguments.length?(a(t),s()):a()},n.ticks=t=>{let n,s,l=a(),u=l[0],c=l[l.length-1],h=c<u;h&&([u,c]=[c,u]);let f=r(u),d=r(c),p=null==t?10:+t,m=[];
5if(!(o%1)&&d-f<p){if(f=Math.floor(f),d=Math.ceil(d),u>0){for(;f<=d;++f)for(n=1;n<o;++n)if(!((s=f<0?n/i(-f):n*i(f))<u)){if(s>c)break;m.push(s)}}else for(;f<=d;++f)for(n=o-1;n>=1;--n)if(!((s=f>0?n/i(-f):n*i(f))<u)){if(s>c)break;m.push(s)}2*m.length<p&&(m=(0,aM.ticks)(u,c,p))}else m=(0,aM.ticks)(f,d,Math.min(d-f,p)).map(i);return h?m.reverse():m},n.tickFormat=(t,a)=>{if(null==t&&(t=10),null==a&&(a=10===o?"s":","),"function"!=typeof a&&(o%1||null!=(a=(0,aP.formatSpecifier)(a)).precision||(a.trim=!0),a=(0,aD.format)(a)),t===1/0)return a;let s=Math.max(1,o*t/n.ticks().length);return t=>{let n=t/i(Math.round(r(t)));return n*o<o-.5&&(n*=o),n<=s?a(t):""}},n.nice=()=>a(aI(a(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),n}function aU(){let t=aj((0,ak.transformer)()).domain([1,10]);return t.copy=()=>(0,ak.copy)(t,aU()).base(t.base()),aO.initRange.apply(t,arguments),t}function aV(t){return function(r){return r<0?-Math.pow(-r,t):Math.pow(r,t)}}function a$(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function aG(t){return t<0?-t*t:t*t}function aq(t){var r=t(ak.identity,ak.identity),i=1;return r.exponent=function(r){return arguments.length?1==(i=+r)?t(ak.identity,ak.identity):.5===i?t(a$,aG):t(aV(i),aV(1/i)):i},(0,aT.linearish)(r)}function aH(){var t=aq((0,ak.transformer)());return t.copy=function(){return(0,ak.copy)(t,aH()).exponent(t.exponent())},aO.initRange.apply(t,arguments),t}function aW(){return aH.apply(null,arguments).exponent(.5)}var eO=eO,aZ=t.i(672895);function aY(){var t,r=[],i=[],n=[];function a(){var t=0,a=Math.max(1,i.length);for(n=Array(a-1);++t<a;)n[t-1]=function(t,r,i=eY.default){if(!(!(n=t.length)||isNaN(r*=1))){if(r<=0||n<2)return+i(t[0],0,t);if(r>=1)return+i(t[n-1],n-1,t);var n,a=(n-1)*r,o=Math.floor(a),s=+i(t[o],o,t);return s+(i(t[o+1],o+1,t)-s)*(a-o)}}(r,t/a);return o}function o(r){return null==r||isNaN(r*=1)?t:i[(0,aZ.bisect)(n,r)]}return o.invertExtent=function(t){var a=i.indexOf(t);return a<0?[NaN,NaN]:[a>0?n[a-1]:r[0],a<n.length?n[a]:r[r.length-1]]},o.domain=function(t){if(!arguments.length)return r.slice();for(let i of(r=[],t))null==i||isNaN(i*=1)||r.push(i);return r.sort(eO.default),a()},o.range=function(t){return arguments.length?(i=Array.from(t),a()):i.slice()},o.unknown=function(r){return arguments.length?(t=r,o):t},o.quantiles=function(){return n.slice()},o.copy=function(){return aY().domain(r).range(i).unknown(t)},aO.initRange.apply(o,arguments)}function aX(t){return function(r){return Math.sign(r)*Math.log1p(Math.abs(r/t))}}function aK(t){return function(r){return Math.sign(r)*Math.expm1(Math.abs(r))*t}}function aQ(t){var r=1,i=t(aX(1),aK(r));return i.constant=function(i){return arguments.length?t(aX(r=+i),aK(r)):r},(0,aT.linearish)(i)}function aJ(){var t=aQ((0,ak.transformer)());return t.copy=function(){return(0,ak.copy)(t,aJ()).constant(t.constant())},aO.initRange.apply(t,arguments)}var a0=t.i(969571);function a1(t){for(var r=t.length/6|0,i=Array(r),n=0;n<r;)i[n]="#"+t.slice(6*n,6*++n);return i}var a2=t.i(565445),a2=a2;let a3=t=>(0,a2.rgbBasis)(t[t.length-1]);var a4=[,,,].concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(a1);let a6=a3(a4);var a5=[,,,].concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(a1);let a8=a3(a5);var a7=[,,,].concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(a1);let a9=a3(a7);var oe=[,,,].concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(a1);let ot=a3(oe);
5var or=[,,,].concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(a1);let oi=a3(or);var on=[,,,].concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(a1);let oa=a3(on);var oo=[,,,].concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(a1);let os=a3(oo);var ol=[,,,].concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(a1);let ou=a3(ol);var oc=[,,,].concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(a1);let oh=a3(oc);var of=[,,,].concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(a1);let od=a3(of);var op=[,,,].concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(a1);let om=a3(op);var og=[,,,].concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(a1);let oy=a3(og);var ov=[,,,].concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(a1);let o_=a3(ov);var ob=[,,,].concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(a1);let ox=a3(ob);var ow=[,,,].concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(a1);let oE=a3(ow);var oT=[,,,].concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(a1);let oA=a3(oT);var oS=[,,,].concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(a1);let oC=a3(oS);var oM=[,,,].concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(a1);let oD=a3(oM);var oP=[,,,].concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(a1);let oI=a3(oP);var ok=[,,,].concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(a1);let oO=a3(ok);var oN=[,,,].concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d
57191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(a1);let oL=a3(oN);var oR=[,,,].concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(a1);let oF=a3(oR);var oB=[,,,].concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(a1);let oz=a3(oB);var oj=[,,,].concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(a1);let oU=a3(oj);var oV=[,,,].concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(a1);let o$=a3(oV);var oG=[,,,].concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(a1);let oq=a3(oG);var oH=[,,,].concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(a1);let oW=a3(oH);function oZ(t){return"rgb("+Math.max(0,Math.min(255,Math.round(34.61+(t=Math.max(0,Math.min(1,t)))*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"}function oY(t){var r=t.length;return function(i){return t[Math.max(0,Math.min(r-1,Math.floor(i*r)))]}}let oX=oY(a1("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36
5a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var oK=oY(a1("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),oQ=oY(a1("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),oJ=oY(a1("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function o0(t){return"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-(t=Math.max(0,Math.min(1,t)))*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+
5Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"}var o1=t.i(611209),o2=t.i(26915),o3=-1.78277*.29227-.1347134789;function o4(t,r,i,n){return 1==arguments.length?function(t){if(t instanceof o6)return new o6(t.h,t.s,t.l,t.opacity);t instanceof ad.Rgb||(t=(0,ad.rgbConvert)(t));var r=t.r/255,i=t.g/255,n=t.b/255,a=(o3*n+-1.7884503806*r-3.5172982438*i)/(o3+-1.7884503806-3.5172982438),o=n-a,s=-((1.97294*(i-a)- -.29227*o)/.90649),l=Math.sqrt(s*s+o*o)/(1.97294*a*(1-a)),u=l?Math.atan2(s,o)*o2.degrees-120:NaN;return new o6(u<0?u+360:u,l,a,t.opacity)}(t):new o6(t,r,i,null==n?1:n)}function o6(t,r,i,n){this.h=+t,this.s=+r,this.l=+i,this.opacity=+n}function o5(t){return function r(i){function n(r,n){var a=t((r=o4(r)).h,(n=o4(n)).h),o=(0,ac.default)(r.s,n.s),s=(0,ac.default)(r.l,n.l),l=(0,ac.default)(r.opacity,n.opacity);return function(t){return r.h=a(t),r.s=o(t),r.l=s(Math.pow(t,i)),r.opacity=l(t),r+""}}return i*=1,n.gamma=r,n}(1)}(0,o1.default)(o6,o4,(0,o1.extend)(ad.Color,{brighter(t){return t=null==t?ad.brighter:Math.pow(ad.brighter,t),new o6(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ad.darker:Math.pow(ad.darker,t),new o6(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*o2.radians,r=+this.l,i=isNaN(this.s)?0:this.s*r*(1-r),n=Math.cos(t),a=Math.sin(t);return new ad.Rgb(255*(r+i*(-.14861*n+1.78277*a)),255*(r+i*(-.29227*n+-.90649*a)),255*(r+1.97294*n*i),this.opacity)}}
5)),o5(ac.hue);var o8=o5(ac.default);let o7=o8(o4(300,.5,0),o4(-240,.5,1));var o9=o8(o4(-100,.75,.35),o4(80,1.5,.8)),se=o8(o4(260,.75,.35),o4(80,1.5,.8)),st=o4();function sr(t){(t<0||t>1)&&(t-=Math.floor(t));var r=Math.abs(t-.5);return st.h=360*t-100,st.s=1.5-1.5*r,st.l=.8-.9*r,st+""}var si=(0,ad.rgb)(),sn=Math.PI/3,sa=2*Math.PI/3;function so(t){var r;return si.r=255*(r=Math.sin(t=(.5-t)*Math.PI))*r,si.g=255*(r=Math.sin(t+sn))*r,si.b=255*(r=Math.sin(t+sa))*r,si+""}let ss=new Map([["accent",a1("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666")],["category10",a1("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf")],["dark2",a1("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666")],["observable10",a1("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0")],["paired",a1("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928")],["pastel1",a1("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2")],["pastel2",a1("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc")],["set1",a1("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999")],["set2",a1("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3")],["set3",a1("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f")],["tableau10",a1("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab")]]),sl=new Map([...ss,["brbg",sc(a5,a8)],["prgn",sc(op,om)],["piyg",sc(of,od)],["puor",sc(ob,ox)],["rdbu",sc(oS,oC)],["rdgy",sc(oM,oD)],["rdylbu",sc(ok,oO)],["rdylgn",sc(oN,oL)],["spectral",sc(oB,oz)],["burd",sh(oS,oC)],["buylrd",sh(ok,oO)],["blues",su(a4,a6)],["greens",su(on,oa)],["greys",su(oo,os)],["oranges",su(ol,ou)],["purples",su(oT,oA)],["reds",su(oR,oF)],["turbo",sf(oZ)],["viridis",sf(oX)],["magma",sf(oK)],["inferno",sf(oQ)],["plasma",sf(oJ)],["cividis",sf(o0)],["cubehelix",sf(o7)],["warm",sf(o9)],["cool",sf(se)],["bugn",su(a7,a9)],["bupu",su(oe,ot)],["gnbu",su(or,oi)],["orrd",su(oc,oh)],["pubu",su(og,oy)],["pubugn",su(ov,o_)],["purd",su(ow,oE)],["rdpu",su(oP,oI)],["ylgn",su(oj,oU)],["ylgnbu",su(oV,o$)],["ylorbr",su(oG,oq)],["ylorrd",su(oH,oW)],["rainbow",sd(sr)],["sinebow",sd(so)]]);function su(t,r){return({length:i})=>1===i?[t[3][1]]:2===i?[t[3][1],t[3][2]]:(i=Math.max(3,Math.floor(i)))>9?aw(r,i):t[i]}function sc(t,r){return({length:i})=>2===i?[t[3][0],t[3][2]]:(i=Math.max(3,Math.floor(i)))>11?aw(r,i):t[i]}function sh(t,r){return({length:i})=>2===i?[t[3][2],t[3][0]]:(i=Math.max(3,Math.floor(i)))>11?aw(t=>r(1-t),i):t[i].slice().reverse()}function sf(t){return({length:r})=>aw(t,Math.max(2,Math.floor(r)))}function sd(t){return({length:r})=>aw(t,Math.floor(r)+1).slice(0,-1)}function sp(t){let r=`${t}`.toLowerCase();if(!sl.has(r))throw Error(`unknown ordinal scheme: ${r}`);return sl.get(r)}function sm(t,r){let i=sp(t),n="function"==typeof i?i({length:r}):i;return n.length!==r?n.slice(0,r):n}let sg=new Map([["brbg",a8],["prgn",om],["piyg",od],["puor",ox],["rdbu",oC],["rdgy",oD],["rdylbu",oO],["rdylgn",oL],["spectral",oz],["burd",t=>oC(1-t)],["buylrd",t=>oO(1-t)],["blues",a6],["greens",oa],["greys",os],["purples",oA],["reds",oF],["oranges",ou],["turbo",oZ],["viridis",oX],["magma",oK],["inferno",oQ],["plasma",oJ],["cividis",o0],["cubehelix",o7],["warm",o9],["cool",se],["bugn",a9],["bupu",ot],["gnbu",oi],["orrd",oh],["pubugn",o_],["pubu",oy],["purd",oE],["rdpu",oI],["ylgnbu",o$],["ylgn",oU],["ylorbr",oq],["ylorrd",oW],["rainbow",sr],["sinebow",so]]);function sy(t){let r=`${t}`.toLowerCase();if(!sg.has(r))throw Error(`unknown quantitative scheme: ${r}`);return sg.get(r)}let sv=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]),s_=t=>r=>t(1-r),sb=[0,1],sx=new Map([["number",ay.interpolateNumber],["rgb",av.interpolateRgb],["hsl",am],["hcl",af],["lab",function(t,r){var i=(0,ac.default)((t=(0,ag.lab)(t)).l,(r=(0,ag.lab)(r)).l),n=(0,ac.default)(t.a,r.a),a=(0,ac.default)(t.b,r.b),o=(0,ac.default)(t.opacity,r.opacity);return function(r){return t.l=i(r),t.a=n(r),t.b=a(r),t.opacity=o(r),t+""}}]]);function sw(t){let r=`${t}`.toLowerCase();if(!sx.has(r))throw Error(`unknown interpolator: ${r}`);return sx.get(r)}function sE(t,r,i,{type:n,nice:a,clamp:o,zero:s,domain:l=sM(t,i),unknown:u,round:c,scheme:h,interval:f,range:d=nn.get(t)===i9?function(t,r){let i=t.find(({radiu
5s:t})=>void 0!==t);if(void 0!==i)return[0,i.radius];let n=eX(t,.5,({value:t})=>void 0===t?NaN:eX(t,.25,ej)),a=r.map(t=>3*Math.sqrt(t/n)),o=30/eV(a);return o<1?a.map(t=>t*o):a}(i,l):nn.get(t)===ne?function(t,r){let i=nY(t,({value:t})=>void 0===t?NaN:nY(t,Math.abs)),n=r.map(t=>12*t/i),a=60/eV(n);return a<1?n.map(t=>t*a):n}(i,l):nn.get(t)===nt?sb:void 0,interpolate:p=nn.get(t)===i7?null==h&&void 0!==d?av.interpolateRgb:sy(void 0!==h?h:"cyclical"===n?"rainbow":"turbo"):c?a_.interpolateRound:ay.interpolateNumber,reverse:m}){var g,y;if((l=sT(l),f=iU(f,n),("cyclical"===n||"sequential"===n)&&(n="linear"),"function"!=typeof p&&(p=sw(p)),m=!!m,void 0!==d)&&l.length!==(d=sT(d)).length){if(1===p.length)throw Error("invalid piecewise interpolator");p=ax(p,d),d=void 0}if(1===p.length?(m&&(p=s_(p),m=!1),void 0===d&&2===(d=Float64Array.from(l,(t,r)=>r/(l.length-1))).length&&(d=sb),r.interpolate((d===sb?il:sD)(p))):r.interpolate(p),s){let[t,r]=al(l);(t>0||r<0)&&((rk(l=iw(l))||1)===Math.sign(t)?l[0]=0:l[l.length-1]=0)}return m&&(l=aE(l)),r.domain(l).unknown(u),a&&(r.nice((g=a,y=n,!0===g?void 0:"number"==typeof g?g:function(t,r){if((t=iU(t,r))&&"function"!=typeof t.ceil)throw Error("invalid interval: missing ceil method");return t}(g,y))),l=r.domain()),void 0!==d&&r.range(d),o&&r.clamp(o),{type:n,domain:l,range:d,scale:r,interpolate:p,interval:f}}function sT(t){return(t=i_(t)).length>=2?t:[t[0],t[0]]}function sA(t,r,{exponent:i=1,...n}){return sE(t,aH().exponent(i),r,{...n,type:"pow"})}function sS(t,r,{domain:i=[0],unknown:n,scheme:a="rdylbu",interpolate:o,range:s=void 0!==o?aw(o,i.length+1):nn.get(t)===i7?sm(a,i.length+1):void 0,reverse:l}){let u=rk(i=i_(i));if(!isNaN(u)&&!function(t,r){for(let i=1,n=t.length,a=t[0];i<n;++i){let n=(0,eN.default)(a,a=t[i]);if(0!==n&&n!==r)return!1}return!0}(i,u))throw Error(`the ${t} scale has a non-monotonic domain`);return l&&(s=aE(s)),{type:"threshold",scale:(0,a0.scaleThreshold)(u<0?aE(i):i,void 0===s?[]:s).unknown(n),domain:i,range:s}}function sC(t,r=ez){return t.length?[e$(t,({value:t})=>void 0===t?t:e$(t,r)),eV(t,({value:t})=>void 0===t?t:eV(t,r))]:[0,1]}function sM(t,r){let i=nn.get(t);return(i===i9||i===nt||i===ne?function(t){return[0,t.length?eV(t,({value:t})=>void 0===t?t:eV(t,ez)):1]}:sC)(r)}function sD(t){return(r,i)=>n=>t(r+n*(i-r))}var eN=eN,sP=t.i(944307);function sI(){var t,r,i,n,a,o=0,s=1,l=ak.identity,u=!1;function c(r){return null==r||isNaN(r*=1)?a:l(0===i?.5:(r=(n(r)-t)*i,u?Math.max(0,Math.min(1,r)):r))}function h(t){return function(r){var i,n;return arguments.length?([i,n]=r,l=t(i,n),c):[l(0),l(1)]}}return c.domain=function(a){return arguments.length?([o,s]=a,t=n(o*=1),r=n(s*=1),i=t===r?0:1/(r-t),c):[o,s]},c.clamp=function(t){return arguments.length?(u=!!t,c):u},c.interpolator=function(t){return arguments.length?(l=t,c):l},c.range=h(sP.interpolate),c.rangeRound=h(a_.interpolateRound),c.unknown=function(t){return arguments.length?(a=t,c):a},function(a){return n=a,t=a(o),r=a(s),i=t===r?0:1/(r-t),c}}function sk(t,r){return r.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function sO(){var t=(0,aT.linearish)(sI()(ak.identity));return t.copy=function(){return sk(t,sO())},aO.initInterpolator.apply(t,arguments)}function sN(){var t=aj(sI()).domain([1,10]);return t.copy=function(){return sk(t,sN()).base(t.base())},aO.initInterpolator.apply(t,arguments)}function sL(){var t=aQ(sI());return t.copy=function(){return sk(t,sL()).constant(t.constant())},aO.initInterpolator.apply(t,arguments)}function sR(){var t=aq(sI());return t.copy=function(){return sk(t,sR()).exponent(t.exponent())},aO.initInterpolator.apply(t,arguments)}function sF(){return sR.apply(null,arguments).exponent(.5)}function sB(){var t,r,i,n,a,o,s,l=0,u=.5,c=1,h=1,f=ak.identity,d=!1;function p(t){return isNaN(t*=1)?s:(t=.5+((t=+o(t))-r)*(h*t<h*r?n:a),f(d?Math.max(0,Math.min(1,t)):t))}function m(t){return function(r){var i,n,a;return arguments.length?([i,n,a]=r,f=ax(t,[i,n,a]),p):[f(0),f(.5),f(1)]}}return p.domain=function(s){return arguments.length?([l,u,c]=s,t=o(l*=1),r=o(u*=1),i=o(c*=1),n=t===r?0:.5/(r-t),a=r===i?0:.5/(i-r),h=r<t?-1:1,p):[l,u,c]},p.clamp=function(t){return arguments.length?(d=!!t,p):d},p.interpolator=function(t){return arguments.length?(f=t,p):f},p.range=m(sP.interpolate),p.rangeRound=m(a_.interpolateRound),p.unknown=function(t){return arguments.length?(s=t,p):s},function(s){return o=s,t=s(l),r=s(u),i=s(c),n=t===r?0:.5/(r-t),a=r===i?0:.5/(i-r),h=r<t?-1:1,p}}function sz(){var t=(0,aT.linearish)(sB()(ak.identity));return t.copy=function(){return sk(t,sz())},aO.initInterpolator.apply(t,arguments)}function sj(){var t=aj(sB()).domain([.1,1,10]);return t.copy=function(){return sk(t,sj()).base(t.base())},aO.initInterpolator.apply(t,arguments)}function sU(){var t=aQ(sB());return t.copy=function(){return sk(t,sU()).constant(t.constant())},aO.initInterpolator.apply(t,arguments)}function sV(){var t=aq(sB());return t.copy=function(){return sk(t,sV()).exponent(t.exponent())},aO.initInterpolator.apply(t,arguments)}function s$(){return sV.apply(null,arguments).exponent(.5)}let sG=0;function sq(t){t!==r&&(r=t,console.warn(t),++sG)}function sH(t,r,i,n,{type:a,nice:o,clamp:s,domain:l=sC(n),unknown:u,pivot:c=0,scheme:h,range:f,symmetric:d=!0,interpolate:p=nn.get(t)===i7?null==h&&void 0!==f?av.interpolateRgb:sy(void 0!==h?h:"rdbu"):ay.interpolateNumber,reverse:m}){c*=1;let[g,y]=l=i_(l);if(l.length>2&&sq(`Warning: the diverging ${t} scale domain contains extra elements.`),0>(0,eN.default)(g,y)&&([g,y]=[y,g],m=!m),g=Math.min(g,c),y=Math.max(y,c),"function"!=typeof p&&(p=sw(p)),void 0!==f&&(p=1===p.length?sD(p)(...f):ax(p,f)),m&&(p=s_(p)),d){let t=i.apply(c),r=t-i.apply(g),n=i.apply(y)-t;r<n?g=i.invert(t-n):r>n&&(y=i.invert(t+r))}return r.domain([g,c,y]).unknown(u).interpolator(p),s&&r.clamp(s),o&&r.nice(o),{type:a,domain:[g,y],pivot:c,interpolate:p,scale:r}}function sW(t,r,{exponent:i=1,...n}){var a;return sH(t,sV().exponent(i*=1),.5===(a=i)?sX:{apply:t=>
5Math.sign(t)*Math.pow(Math.abs(t),a),invert:t=>Math.sign(t)*Math.pow(Math.abs(t),1/a)},r,{...n,type:"diverging-pow"})}let sZ={apply:t=>t,invert:t=>t},sY={apply:Math.log,invert:Math.exp},sX={apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>t*t*Math.sign(t)};var e0=e0,sK=t.i(428322);let sQ=e3(()=>{},(t,r)=>{t.setTime(+t+r)},(t,r)=>r-t);function sJ(t,r,i,n,a,o){let s=[[rA,1,1e3],[rA,5,5e3],[rA,15,15e3],[rA,30,3e4],[o,1,6e4],[o,5,3e5],[o,15,9e5],[o,30,18e5],[a,1,36e5],[a,3,108e5],[a,6,216e5],[a,12,432e5],[n,1,864e5],[n,2,1728e5],[i,1,6048e5],[r,1,2592e6],[r,3,7776e6],[t,1,31536e6]];function l(r,i,n){let a=Math.abs(i-r)/n,o=(0,e0.default)(([,,t])=>t).right(s,a);if(o===s.length)return t.every((0,sK.tickStep)(r/31536e6,i/31536e6,n));if(0===o)return sQ.every(Math.max((0,sK.tickStep)(r,i,n),1));let[l,u]=s[a/s[o-1][2]<s[o][2]/a?o-1:o];return l.every(u)}return[function(t,r,i){let n=r<t;n&&([t,r]=[r,t]);let a=i&&"function"==typeof i.range?i:l(t,r,i),o=a?a.range(t,+r+1):[];return n?o.reverse():o},l]}sQ.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?e3(r=>{r.setTime(Math.floor(r/t)*t)},(r,i)=>{r.setTime(+r+i*t)},(r,i)=>(i-r)/t):sQ:null,sQ.range;let[s0,s1]=sJ(tp,rI,to,e5,rD,rC),[s2,s3]=sJ(td,rP,e7,e4,rM,rS);function s4(t){return new Date(t)}function s6(t){return t instanceof Date?+t:+new Date(+t)}function s5(t,r,i,n,a,o,s,l,u,c){var h=(0,ak.default)(),f=h.invert,d=h.domain,p=c(".%L"),m=c(":%S"),g=c("%I:%M"),y=c("%I %p"),v=c("%a %d"),_=c("%b %d"),b=c("%B"),x=c("%Y");function w(t){return(u(t)<t?p:l(t)<t?m:s(t)<t?g:o(t)<t?y:n(t)<t?a(t)<t?v:_:i(t)<t?b:x)(t)}return h.invert=function(t){return new Date(f(t))},h.domain=function(t){return arguments.length?d(Array.from(t,s6)):d().map(s4)},h.ticks=function(r){var i=d();return t(i[0],i[i.length-1],null==r?10:r)},h.tickFormat=function(t,r){return null==r?w:c(r)},h.nice=function(t){var i=d();return t&&"function"==typeof t.range||(t=r(i[0],i[i.length-1],null==t?10:t)),t?d(aI(i,t)):h},h.copy=function(){return(0,ak.copy)(h,s5(t,r,i,n,a,o,s,l,u,c))},h}function s8(){return aO.initRange.apply(s5(s2,s3,td,rP,e7,e4,rM,rS,rA,cx).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function s7(){return aO.initRange.apply(s5(s0,s1,tp,rI,to,e6,rD,rC,rA,cw).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function s9(t){return function(){return t}}let le=Math.PI,lt=2*le,lr=lt-1e-6;function li(t){this._+=t[0];for(let r=1,i=t.length;r<i;++r)this._+=arguments[r]+t[r]}class ln{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?li:function(t){let r=Math.floor(t);if(!(r>=0))throw Error(`invalid digits: ${t}`);if(r>15)return li;let i=10**r;return function(t){this._+=t[0];for(let r=1,n=t.length;r<n;++r)this._+=Math.round(arguments[r]*i)/i+t[r]}}(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,i,n){this._append`Q${+t},${+r},${this._x1=+i},${this._y1=+n}`}bezierCurveTo(t,r,i,n,a,o){this._append`C${+t},${+r},${+i},${+n},${this._x1=+a},${this._y1=+o}`}arcTo(t,r,i,n,a){if(t*=1,r*=1,i*=1,n*=1,(a*=1)<0)throw Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,l=i-t,u=n-r,c=o-t,h=s-r,f=c*c+h*h;if(null===this._x1)this._append`M${this._x1=t},${this._y1=r}`;else if(f>1e-6)if(Math.abs(h*l-u*c)>1e-6&&a){let d=i-o,p=n-s,m=l*l+u*u,g=Math.sqrt(m),y=Math.sqrt(f),v=a*Math.tan((le-Math.acos((m+f-(d*d+p*p))/(2*g*y)))/2),_=v/y,b=v/g;Math.abs(_-1)>1e-6&&this._append`L${t+_*c},${r+_*h}`,this._append`A${a},${a},0,0,${+(h*d>c*p)},${this._x1=t+b*l},${this._y1=r+b*u}`}else this._append`L${this._x1=t},${this._y1=r}`}arc(t,r,i,n,a,o){if(t*=1,r*=1,i*=1,o=!!o,i<0)throw Error(`negative radius: ${i}`);let s=i*Math.cos(n),l=i*Math.sin(n),u=t+s,c=r+l,h=1^o,f=o?n-a:a-n;null===this._x1?this._append`M${u},${c}`:(Math.abs(this._x1-u)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${u},${c}`,i&&(f<0&&(f=f%lt+lt),f>lr?this._append`A${i},${i},0,1,${h},${t-s},${r-l}A${i},${i},0,1,${h},${this._x1=u},${this._y1=c}`:f>1e-6&&this._append`A${i},${i},0,${+(f>=le)},${h},${this._x1=t+i*Math.cos(a)},${this._y1=r+i*Math.sin(a)}`)}rect(t,r,i,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${i*=1}v${+n}h${-i}Z`}toString(){return this._}}function la(t=3){return new ln(+t)}function lo(t){let r=3;return t.digits=function(i){if(!arguments.length)return r;if(null==i)r=null;else{let t=Math.floor(i);if(!(t>=0))throw RangeError(`invalid digits: ${i}`);r=t}return t},()=>new ln(r)}ln.prototype;let ls=[nT,nA,nM,nD,nO,nL,nz],ll=[nT,n_,nE,nw,ny,nb,nv],lu=Symbol("impl
5icit");function lc(){var t=new eE,r=[],i=[],n=lu;function a(a){let o=t.get(a);if(void 0===o){if(n!==lu)return n;t.set(a,o=r.push(a)-1)}return i[o%i.length]}return a.domain=function(i){if(!arguments.length)return r.slice();for(let n of(r=[],t=new eE,i))t.has(n)||t.set(n,r.push(n)-1);return a},a.range=function(t){return arguments.length?(i=Array.from(t),a):i.slice()},a.unknown=function(t){return arguments.length?(n=t,a):n},a.copy=function(){return lc(r,i).unknown(n)},aO.initRange.apply(a,arguments),a}function lh(){var t,r,i=lc().unknown(void 0),n=i.domain,a=i.range,o=0,s=1,l=!1,u=0,c=0,h=.5;function f(){var i=n().length,f=s<o,d=f?s:o,p=f?o:s;t=(p-d)/Math.max(1,i-u+2*c),l&&(t=Math.floor(t)),d+=(p-d-t*(i-u))*h,r=t*(1-u),l&&(d=Math.round(d),r=Math.round(r));var m=eK(i).map(function(r){return d+t*r});return a(f?m.reverse():m)}return delete i.unknown,i.domain=function(t){return arguments.length?(n(t),f()):n()},i.range=function(t){return arguments.length?([o,s]=t,o*=1,s*=1,f()):[o,s]},i.rangeRound=function(t){return[o,s]=t,o*=1,s*=1,l=!0,f()},i.bandwidth=function(){return r},i.step=function(){return t},i.round=function(t){return arguments.length?(l=!!t,f()):l},i.padding=function(t){return arguments.length?(u=Math.min(1,c=+t),f()):u},i.paddingInner=function(t){return arguments.length?(u=Math.min(1,t),f()):u},i.paddingOuter=function(t){return arguments.length?(c=+t,f()):c},i.align=function(t){return arguments.length?(h=Math.max(0,Math.min(1,t)),f()):h},i.copy=function(){return lh(n(),[o,s]).round(l).paddingInner(u).paddingOuter(c).align(h)},aO.initRange.apply(f(),arguments)}function lf(){return function t(r){var i=r.copy;return r.padding=r.paddingOuter,delete r.paddingInner,delete r.paddingOuter,r.copy=function(){return t(i())},r}(lh.apply(null,arguments).paddingInner(1))}let ld=Symbol("ordinal");function lp(t,r,i,{type:n,interval:a,domain:o,range:s,reverse:l,hint:u}){return a=iU(a,n),void 0===o&&(o=lg(i,a,t)),("categorical"===n||n===ld)&&(n="ordinal"),l&&(o=aE(o)),o=r.domain(o).domain(),void 0!==s&&("function"==typeof s&&(s=s(o)),r.range(s)),{type:n,domain:o,range:s,scale:r,hint:u,interval:a}}function lm(t,r,i,n){let{round:a}=i;return void 0!==a&&t.round(a=!!a),(t=lp(n,t,r,i)).round=a,t}function lg(t,r,i){let n=new eT;for(let{value:r,domain:i}of t){if(void 0!==i)return i();if(void 0!==r)for(let t of r)n.add(t)}if(void 0!==r){let[t,i]=al(n).map(r.floor,r);return r.range(t,r.offset(i))}if(n.size>1e4&&nn.get(i)===i8)throw Error(`implicit ordinal domain of ${i} scale has more than 10,000 values`);return eq(n,eR)}function ly(t,r){let i;for(let{hint:n}of t){let t=n?.[r];if(void 0!==t){if(void 0===i)i=t;else if(i!==t)return}}return i}function lv(t,{label:r,inset:i=0,insetTop:n=i,insetRight:a=i,insetBottom:o=i,insetLeft:s=i,round:l,nice:u,clamp:c,zero:h,align:f,padding:d,projection:p,facet:{label:m=r}={},...g}={}){let y={};for(let[i,v]of t){let t=g[i],_=function(t,r=[],i={}){var n,a,o,s,l;let u=function(t,r,{type:i,domain:n,range:a,scheme:o,pivot:s,projection:l}){if(i=lC(i),"fx"===t||"fy"===t)return"band";for(let n of(("x"===t||"y"===t)&&null!=l&&(i=lM),r)){let t=lC(n.type);if(void 0!==t){if(void 0===i)i=t;else if(i!==t)throw Error(`scale incompatible with channel: ${i} !== ${t}`)}}if(i===lM)return;if(void 0!==i)return i;if(void 0===n&&!r.some(({value:t})=>void 0!==t))return;let u=nn.get(t);if(u===i9)return"sqrt";if(u===nt||u===ne)return"linear";if(u===nr)return"ordinal";let c=(n??a)?.length;if(c<2||c>2)return lD(u);if(void 0!==n){if(iq(n))return lD(u);if(iH(n))return"utc"}else{let t=r.map(({value:t})=>t).filter(t=>void 0!==t);if(t.some(iq))return lD(u);if(t.some(iH))return"utc"}if(u===i7){if(null!=s||null!=o&&sv.has(`${o}`.toLowerCase()))return"diverging";if(null!=o&&ss.has(`${o}`.toLowerCase()))return"categorical"}return"linear"}(t,r,i);if(void 0===i.type&&void 0===i.domain&&void 0===i.range&&null==i.interval&&"fx"!==t&&"fy"!==t&&lP({type:u})){let i=r.map(({value:t})=>t).filter(t=>void 0!==t);i.some(iH)?sq(`Warning: some data associated with the ${t} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${lS(u)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${t} scale to "${lS(u)}".`):i.some(iW)?sq(`Warning: some data associated with the ${t} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${lS(u)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${t} scale to "${lS(u)}".`):i.some(iZ)&&sq(`Warning: some data associated with the ${t} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${lS(u)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${t} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${t} scale to "${lS(u)}".`)}switch(i.type=u,u){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":i=lO(r,i,iu);break;case"identity":switch(nn.get(t)){case i8:i=lO(r,i,iu);break;case nr:i=lO(r,i,lN)}break;case"utc":case"time":i=lO(r,i,ih)}switch(u){case"diverging":return n=i,sH(t,sz(),sZ,r,n);case"diverging-sqrt":return sW(t,r,{...i,exponent:.5}
5);case"diverging-pow":return sW(t,r,i);case"diverging-log":return function(t,r,{base:i=10,pivot:n=1,domain:a=sC(r,n<0?eU:ej),...o}){return sH(t,sj().base(i*=1),sY,r,{domain:a,pivot:n,...o})}(t,r,i);case"diverging-symlog":return function(t,r,{constant:i=1,...n}){return sH(t,sU().constant(i*=1),function(t){return{apply:r=>Math.sign(r)*Math.log1p(Math.abs(r/t)),invert:r=>Math.sign(r)*Math.expm1(Math.abs(r))*t}}(i),r,n)}(t,r,i);case"categorical":case"ordinal":case ld:return function(t,r,{type:i,interval:n,domain:a,range:o,scheme:s,unknown:l,...u}){let c;if(n=iU(n,i),void 0===a&&(a=lg(r,n,t)),nn.get(t)===nr){var h;c={fill:ly(h=r,"fill"),stroke:ly(h,"stroke")},o=void 0===o?iJ(c.fill)?ll:ls:ix(o,nG)}else if(nn.get(t)===i7&&(void 0===o&&("ordinal"===i||i===ld)&&void 0!==(o=function(t,r="greys"){let i=new Set,[n,a]=sm(r,2);for(let r of t)if(null!=r)if(!0===r)i.add(a);else{if(!1!==r)return;i.add(n)}return[...i]}(a,s))&&(s=void 0),void 0===s&&void 0===o&&(s="ordinal"===i?"turbo":"observable10"),void 0!==s))if(void 0!==o){let t=sy(s),r=o[0],i=o[1]-o[0];o=({length:n})=>aw(n=>t(r+i*n),n)}else o=sp(s);if(l===lu)throw Error(`implicit unknown on ${t} scale is not supported`);return lp(t,lc().unknown(l),r,{...u,type:i,domain:a,range:o,hint:c})}(t,r,i);case"cyclical":case"sequential":case"linear":return a=i,sE(t,(0,aC.scaleLinear)(),r,a);case"sqrt":return sA(t,r,{...i,exponent:.5});case"threshold":return sS(t,r,i);case"quantile":return function(t,r,{range:i,quantiles:n=void 0===i?5:(i=[...i]).length,n:a=n,scheme:o="rdylbu",domain:s=function(t){let r=[];for(let{value:i}of t)if(void 0!==i)for(let t of i)r.push(t);return r}(r),unknown:l,interpolate:u,reverse:c}){return void 0===i&&(i=void 0!==u?aw(u,a):nn.get(t)===i7?sm(o,a):void 0),s.length>0&&(s=aY(s,void 0===i?{length:a}:i).quantiles()),sS(t,r,{domain:s,range:i,reverse:c,unknown:l})}(t,r,i);case"quantize":return function(t,r,{range:i,n=void 0===i?5:(i=[...i]).length,scheme:a="rdylbu",domain:o=sM(t,r),unknown:s,interpolate:l,reverse:u}){let c,[h,f]=al(o);return void 0===i?((c=(0,aM.ticks)(h,f,n))[0]<=h&&c.splice(0,1),c[c.length-1]>=f&&c.pop(),n=c.length+1,i=void 0!==l?aw(l,n):nn.get(t)===i7?sm(a,n):void 0):(c=aw((0,ay.interpolateNumber)(h,f),n+1).slice(1,-1),h instanceof Date&&(c=c.map(t=>new Date(t)))),0>rk(i_(o))&&c.reverse(),sS(t,r,{domain:c,range:i,reverse:u,unknown:s})}(t,r,i);case"pow":return sA(t,r,i);case"log":return function(t,r,{base:i=10,domain:n=function(t){for(let{value:r}of t)if(void 0!==r)for(let i of r){if(i>0)return sC(t,ej);if(i<0)return sC(t,eU)}return[1,10]}(r),...a}){return sE(t,aU().base(i),r,{...a,domain:n})}(t,r,i);case"symlog":return function(t,r,{constant:i=1,...n}){return sE(t,aJ().constant(i),r,n)}(t,r,i);case"utc":return o=i,sE(t,s7(),r,o);case"time":return s=i,sE(t,s8(),r,s);case"point":return function(t,r,{align:i=.5,padding:n=.5,...a}){return lm(lf().align(i).padding(n),r,a,t)}(t,r,i);case"band":return function(t,r,{align:i=.5,padding:n=.1,paddingInner:a=n,paddingOuter:o="fx"===t||"fy"===t?0:n,...s}){return lm(lh().align(i).paddingInner(a).paddingOuter(o),r,s,t)}(t,r,i);case"identity":return{type:"identity",scale:(l=nn.get(t))===i8||l===i9||l===ne||l===nt?aS():t=>t};case void 0:return;default:throw Error(`unknown scale type: ${u}`)}}(i,v,{round:nn.get(i)===i8?l:void 0,nice:u,clamp:c,zero:h,align:f,padding:d,projection:p,...t});if(_){let{label:l="fx"===i||"fy"===i?m:r,percent:u,transform:c,inset:h,insetTop:f=void 0!==h?h:"y"===i?n:0,insetRight:d=void 0!==h?h:"x"===i?a:0,insetBottom:p=void 0!==h?h:"y"===i?o:0,insetLeft:g=void 0!==h?h:"x"===i?s:0}=t||{};if(null==c)c=void 0;else if("function"!=typeof c)throw Error("invalid scale transform; not a function");_.percent=!!u,_.label=void 0===l?function(t=[],r){let i;for(let{label:r}of t)if(void 0!==r){if(void 0===i)i=r;else if(i!==r)return}if(void 0!==i)return!lP(r)&&r.percent&&(i=`${i} (%)`),{inferred:!0,toString:()=>i}}(v,_):l,_.transform=c,"x"===i||"fx"===i?(_.insetLeft=+g,_.insetRight=+d):("y"===i||"fy"===i)&&(_.insetTop=+f,_.insetBottom=+p),y[i]=_}}return y}function l_(t){let r={},i={scales:r};for(let[n,a]of Object.entries(t)){let{scale:t,type:o,interval:s,label:l}=a;r[n]=function({scale:t,type:r,domain:i,range:n,interpolate:a,interval:o,transform:s,percent:l,pivot:u}){if("identity"===r)return{type:"identity",apply:t=>t,invert:t=>t};let c=t.unknown?t.unknown():void 0;return{type:r,domain:iw(i),...void 0!==n&&{range:iw(n)},...void 0!==s&&{transform:s},...l&&{percent:l},...void 0!==c&&{unknown:c},...void 0!==o&&{interval:o},...void 0!==a&&{interpolate:a},...t.clamp&&{clamp:t.clamp()},...void 0!==u&&{pivot:u,symmetric:!1},...t.base&&{base:t.base()},...t.exponent&&{exponent:t.exponent()},...t.constant&&{constant:t.constant()},...t.align&&{align:t.align(),round:t.round()},...t.padding&&(t.paddingInner?{paddingInner:t.paddingInner(),paddingOuter:t.paddingOuter()}:{padding:t.padding()}),...t.bandwidth&&{bandwidth:t.bandwidth(),step:t.step()},apply:r=>t(r),...t.invert&&{invert:r=>t.invert(r)}}}(a),i[n]=t,t.type=o,null!=s&&(t.interval=s),null!=l&&(t.label=l)}return i}function lb(t){let{marginTop:r,marginRight:i,marginBottom:n,marginLeft:a,width:o,height:s,facet:{marginTop:l,marginRight:u,marginBottom:c,marginLeft:h}}=t;return{marginTop:Math.max(r,l),marginRight:Math.max(i,u),marginBottom:Math.max(n,c),marginLeft:Math.max(a,h),width:o,height:s}}function lx({fx:t,fy:r},i){let{marginTop:n,marginRight:a,marginBottom:o,marginLeft:s,width:l,height:u}=lb(i);return{marginTop:n,marginRight:a,marginBottom:o,marginLeft:s,width:t?t.scale.bandwidth()+s+a:l,height:r?r.scale.bandwidth()+n+o:u,facet:{width:l,height:u}}}function lw(t,r){if(void 0===t.range){let{insetLeft:i,insetRight:n}=t,{width:a,marginLeft:o=0,marginRight:s=0}=r,l=o+i;t.range=[l,Math.max(l,a-s-n)],lP(t)||(t.range=lA(t)),t.scale.range(t.range)}lT(t)}function lE(t,r){if(void 0===t.range){let{insetTop:i,insetBottom:n}=t,{height:a,marginTop:o=0,marginBottom:s=0}=r,l=o+i;t.range=[Math.max(l,a-s-n),l],lP(t)?t.range.reverse():t.range=lA(t),t.scale.range(t.range)}lT(t)}function lT(t){void 0===t.round&&function({type:t}){return"point"===t||"band"===t}(t)&&30>=function({scale:t}){let r=t.domain().length,[i,n]=t.range(),a=t.paddingInner?t.paddingInner():1,o=t.paddingOuter?t.paddingOuter():t.padding(),s=r-a,l=Math.abs(n-i)/Math.max(1,s+2*o);return(l-Math.floor(l))*s}(t)&&t.scale.round(!0)}function lA(t){let r=t.scale.domain().length+lI(t);if(!(r>2))return t.range;let[i,n]=t.range;return Array.from({length:r},(t,a)=>i+a/(r-1)*(n-i))}function lS(t){return"symbol"==typeof t?t.description:t}function lC(t){return"string"==typeof t?`${t}`.toLowerCase():t}let lM={toString:()=>"projection"};function lD(t){switch(t){case i8:return"point";case i7:return ld;default:return"ordinal"}}function lP({type:t}){return"ordinal"===t||"point"===t||"band"===t||t===ld}function lI({type:t}){return"threshold"===t}function lk(t){if(void 0===t)return!0;let r=t.domain(),i=t(r[0]);for(let n=1,a=r.length;n<a;++n)if(t(r[n])-i)return!1;return!0}function lO(t,{domain:r,...i},n){for(let i of t)void 0!==i.value&&(void 0===r&&(r=i.value?.domain),i.value=n(i.value));return{domain:void 0===r?r:n(r),...i}}function lN(t){return ix(t,nG)}function lL(t,{fx:r,fy:i}){let n=iO(t),a=r?.value,o=i?.value;return r&&i?eI(n,t=>(t.fx=a[t[0]],t.fy=o[t[0]],t),t=>a[t],t=>o[t]):r?eI(n,t=>(t.fx=a[t[0]],t),t=>a[t]):eI(n,t=>(t.fy=o[t[0]],t),t=>o[t])}let lR=new Map([["top",lU],["right",lG],["bottom",lV],["left",l$],["top-left",lq(lU,l$)],["to
5p-right",lq(lU,lG)],["bottom-left",lq(lV,l$)],["bottom-right",lq(lV,lG)],["top-empty",function(t,{y:r},{x:i,y:n,empty:a}){if(a)return!1;if(!r)return;let o=lz(r,n);if(o>0)return lj(t,i,r[o-1])}],["right-empty",function(t,{x:r},{x:i,y:n,empty:a}){if(a)return!1;if(!r)return;let o=lz(r,i);if(o<r.length-1)return lj(t,r[o+1],n)}],["bottom-empty",function(t,{y:r},{x:i,y:n,empty:a}){if(a)return!1;if(!r)return;let o=lz(r,n);if(o<r.length-1)return lj(t,i,r[o+1])}],["left-empty",function(t,{x:r},{x:i,y:n,empty:a}){if(a)return!1;if(!r)return;let o=lz(r,i);if(o>0)return lj(t,r[o-1],n)}],["empty",function(t,r,{empty:i}){return i}]]),lF=new WeakMap;function lB(t){let r=lF.get(t);return r||lF.set(t,r=new eE(ix(t,(t,r)=>[t,r]))),r}function lz(t,r){return lB(t).get(r)}function lj(t,r,i){var n,a;return(n=r,a=i,n=iL(n),a=iL(a),t.find(t=>Object.is(iL(t.x),n)&&Object.is(iL(t.y),a)))?.empty}function lU(t,{y:r},{y:i}){return!r||0===lz(r,i)}function lV(t,{y:r},{y:i}){return!r||lz(r,i)===r.length-1}function l$(t,{x:r},{x:i}){return!r||0===lz(r,i)}function lG(t,{x:r},{x:i}){return!r||lz(r,i)===r.length-1}function lq(t,r){return function(){return t.apply(null,arguments)&&r.apply(null,arguments)}}function lH(t,{channels:{fx:r,fy:i},groups:n}){return r&&i?t.map(({x:t,y:r})=>n.get(t)?.get(r)??[]):r?t.map(({x:t})=>n.get(t)??[]):t.map(({y:t})=>n.get(t)??[])}var lW=Math.PI,lZ=lW/2,lY=lW/4,lX=2*lW,lK=180/lW,lQ=lW/180,lJ=Math.abs,l0=Math.atan,l1=Math.atan2,l2=Math.cos,l3=Math.exp,l4=Math.log,l6=Math.pow,l5=Math.sin,l8=Math.sign||function(t){return t>0?1:t<0?-1:0},l7=Math.sqrt,l9=Math.tan;function ue(t){return t>1?0:t<-1?lW:Math.acos(t)}function ut(t){return t>1?lZ:t<-1?-lZ:Math.asin(t)}function ur(){}function ui(){var t,r=[];return{point:function(r,i,n){t.push([r,i,n])},lineStart:function(){r.push(t=[])},lineEnd:ur,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var i=r;return r=[],t=null,i}}}function un(t,r){return 1e-6>lJ(t[0]-r[0])&&1e-6>lJ(t[1]-r[1])}function ua(t,r,i,n){this.x=t,this.z=r,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function uo(t,r,i,n,a){var o,s,l=[],u=[];if(t.forEach(function(t){if(!((r=t.length-1)<=0)){var r,i,n=t[0],s=t[r];if(un(n,s)){if(!n[2]&&!s[2]){for(a.lineStart(),o=0;o<r;++o)a.point((n=t[o])[0],n[1]);a.lineEnd();return}s[0]+=2e-6}l.push(i=new ua(n,t,null,!0)),u.push(i.o=new ua(n,null,i,!1)),l.push(i=new ua(s,t,null,!1)),u.push(i.o=new ua(s,null,i,!0))}}),l.length){for(u.sort(r),us(l),us(u),o=0,s=u.length;o<s;++o)u[o].e=i=!i;for(var c,h,f=l[0];;){for(var d=f,p=!0;d.v;)if((d=d.n)===f)return;c=d.z,a.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(o=0,s=c.length;o<s;++o)a.point((h=c[o])[0],h[1]);else n(d.x,d.n.x,1,a);d=d.n}else{if(p)for(o=(c=d.p.z).length-1;o>=0;--o)a.point((h=c[o])[0],h[1]);else n(d.x,d.p.x,-1,a);d=d.p}c=(d=d.o).z,p=!p}while(!d.v)a.lineEnd()}}}function us(t){if(r=t.length){for(var r,i,n=0,a=t[0];++n<r;)a.n=i=t[n],i.p=a,a=i;a.n=i=t[0],i.p=a}}class ul{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let r=this._partials,i=0;for(let n=0;n<this._n&&n<32;n++){let a=r[n],o=t+a,s=Math.abs(t)<Math.abs(a)?t-(o-a):a-(o-t);s&&(r[i++]=s),t=o}return r[i]=t,this._n=i+1,this}valueOf(){let t=this._partials,r=this._n,i,n,a,o=0;if(r>0){for(o=t[--r];r>0&&(o=(i=o)+(n=t[--r]),!(a=n-(o-i))););r>0&&(a<0&&t[r-1]<0||a>0&&t[r-1]>0)&&(i=o+(n=2*a),n==i-o&&(o=i))}return o}}function uu(t){return[l1(t[1],t[0]),ut(t[2])]}function uc(t){var r=t[0],i=t[1],n=l2(i);return[n*l2(r),n*l5(r),l5(i)]}function uh(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]}function uf(t,r){return[t[1]*r[2]-t[2]*r[1],t[2]*r[0]-t[0]*r[2],t[0]*r[1]-t[1]*r[0]]}function ud(t,r){t[0]+=r[0],t[1]+=r[1],t[2]+=r[2]}function up(t,r){return[t[0]*r,t[1]*r,t[2]*r]}function um(t){var r=l7(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=r,t[1]/=r,t[2]/=r}function ug(t){return lJ(t[0])<=lW?t[0]:l8(t[0])*((lJ(t[0])+lW)%lX-lW)}function uy(t){return Array.from(function*(t){for(let r of t)yield*r}(t))}function uv(t,r,i,n){return function(a){var o,s,l,u=r(a),c=ui(),h=r(c),f=!1,d={point:p,lineStart:g,lineEnd:y,polygonStart:function(){d.point=v,d.lineStart=_,d.lineEnd=b,s=[],o=[]},polygonEnd:function(){d.point=p,d.lineStart=g,d.lineEnd=y,s=uy(s);var t=function(t,r){var i=ug(r),n=r[1],a=l5(n),o=[l5(i),-l2(i),0],s=0,l=0,u=new ul;1===a?n=lZ+1e-6:-1===a&&(n=-lZ-1e-6);for(var c=0,h=t.length;c<h;++c)if(d=(f=t[c]).length)for(var f,d,p=f[d-1],m=ug(p),g=p[1]/2+lY,y=l5(g),v=l2(g),_=0;_<d;++_,m=x,y=E,v=T,p=b){var b=f[_],x=ug(b),w=b[1]/2+lY,E=l5(w),T=l2(w),A=x-m,S=A>=0?1:-1,C=S*A,M=C>lW,D=y*E;if(u.add(l1(D*S*l5(C),v*T+D*l2(C))),s+=M?A+S*lX:A,M^m>=i^x>=i){var P=uf(uc(p),uc(b));um(P);var I=uf(o,P);um(I);var k=(M^A>=0?-1:1)*ut(I[2]);(n>k||n===k&&(P[0]||P[1]))&&(l+=M^A>=0?1:-1)}}return(s<-1e-6||s<1e-6&&u<-1e-12)^1&l}(o,n);s.length?(f||(a.polygonStart(),f=!0),uo(s,ub,t,i,a)):t&&(f||(a.polygonStart(),f=!0),a.lineStart(),i(null,null,1,a),a.lineEnd()),f&&(a.polygonEnd(),f=!1),s=o=null},sphere:function(){a.polygonStart(),a.lineStart(),i(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function p(r,i){t(r,i)&&a.point(r,i)}function m(t,r){u.point(t,r)}function g(){d.point=m,u.lineStart()}function y(){d.point=p,u.lineEnd()}function v(t,r){l.push([t,r]),h.point(t,r)}function _(){h.lineStart(),l=[]}function b(){v(l[0][0],l[0][1]),h.lineEnd();var t,r,i,n,u=h.clean(),d=c.result(),p=d.length;if(l.pop(),o.push(l),l=null,p){if(1&u){if((r=(i=d[0]).length-1)>0){for(f||(a.polygonStart(),f=!0),a.lineStart(),t=0;t<r;++t)a.point((n=i[t])[0],n[1]);a.lineEnd()}return}p>1&&2&u&&d.push(d.pop().concat(d.shift())),s.push(d.filter(u_))}}return d}}function u_(t){return t.length>1}function ub(t,r){return((t=t.x)[0]<0?t[1]-lZ-1e-6:lZ-t[1])-((r=r.x)[0]<0?r[1]-lZ-1e-6:lZ-r[1])}let ux=uv(function(){return!0},function(t){var r,i=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),r=1},point:function(o,s){var l,u,c,h,f,d,p,m=o>0?lW:-lW,g=lJ(o-i);1e-6>lJ(g-lW)?(t.point(i,n=(n+s)/2>0?lZ:-lZ),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(m,n),t.point(o,n),r=0):a!==m&&g>=lW&&(1e-6>lJ(i-a)&&(i-=1e-6*a),1e-6>lJ(o-m)&&(o-=1e-6*m),l=i,u=n,c=o,h=s,n=lJ(p=l5(l-c))>1e-6?l0((l5(u)*(d=l2(h))*l5(c)-l5(h)*(f=l2(u))*l5(l))/(f*d*p)):(u+h)/2,t.point(a,n),t.lineEnd(),t.lineStart(),t.point(m,n),r=0),t.point(i=o,n=s),a=m},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-r}}},function(t,r,i,n){var a;if(null==t)a=i*lZ,n.point(-lW,a),n.point(0,a),n.point(lW,a),n.point(lW,0),n.point(lW,-a),n.point(0,-a),n.point(-lW,-a),n.point(-lW,0),n.point(-lW,a);else if(lJ(t[0]-r[0])>1e-6){var o=t[0]<r[0]?lW:-lW;a=i*o/2,n.point(-o,a),n.point(0,a),n.point(o,a)}else n.point(r[0],r[1])},[-lW,-lZ]);function uw(t,r){function i(i,n){return r((i=t(i,n))[0],i[1])}return t.invert&&r.invert&&(i.invert=function(i,n){return(i=r.invert(i,n))&&t.invert(i[0],i[1])}),i}function uE(t,r){return lJ(t)>lW&&(t-=Math.round(t/lX)*lX),[t,r]}function uT(t,r,i){return(t%=lX)?r||i?uw(uS(t),uC(r,i)):uS(t):r||i?uC(r,i):uE}function uA(t){return function(r,i){return lJ(r+=t)>lW&&(r-=Math.round(r/lX)*lX),[r,i]}}function uS(t){var r=uA(t);return r.invert=uA(-t),r}function uC(t,r){var i=l2(t),n=l5(t),a=l2(r),o=l5(r);function s(t,r){var s=l2(r),l=l2(t)*s,u=l5(t)*s,c=l5(r),h=c*i+l*n;return[l1(u*a-h*o,l*i-c*n),ut(h*a+u*o)]}return s.invert=function(t,r){var s=l2(r),l=l2(t)*s,u=l5(t)*s,c=l5(r),h=c*a-u*o;return[l1(u*a+c*o,l*i+h*n),ut(h*i-l*n)]},s}function uM(t,r){r=uc(r),r[0]-=t,um(r);var i=ue(-r[1]);return((0>-r[2]?-i:i)+lX-1e-6)%lX}uE.invert=uE;function uD(t,r,i,n){function a(a,o){return t<=a&&a<=i&&r<=o&&o<=n}function o(a,o,l,c){var h=0,f=0;if(null==a||(h=s(a,l))!==(f=s(o,l))||0>u(a,o)^l>0)do c.point(0===h||3===h?t:i,h>
51?n:r);while((h=(h+l+4)%4)!==f)else c.point(o[0],o[1])}function s(n,a){return 1e-6>lJ(n[0]-t)?a>0?0:3:1e-6>lJ(n[0]-i)?a>0?2:1:1e-6>lJ(n[1]-r)?+(a>0):a>0?3:2}function l(t,r){return u(t.x,r.x)}function u(t,r){var i=s(t,1),n=s(r,1);return i!==n?i-n:0===i?r[1]-t[1]:1===i?t[0]-r[0]:2===i?t[1]-r[1]:r[0]-t[0]}return function(s){var u,c,h,f,d,p,m,g,y,v,_,b=s,x=ui(),w={point:E,lineStart:function(){w.point=T,c&&c.push(h=[]),v=!0,y=!1,m=g=NaN},lineEnd:function(){u&&(T(f,d),p&&y&&x.rejoin(),u.push(x.result())),w.point=E,y&&b.lineEnd()},polygonStart:function(){b=x,u=[],c=[],_=!0},polygonEnd:function(){var r=function(){for(var r=0,i=0,a=c.length;i<a;++i)for(var o,s,l=c[i],u=1,h=l.length,f=l[0],d=f[0],p=f[1];u<h;++u)o=d,s=p,d=(f=l[u])[0],p=f[1],s<=n?p>n&&(d-o)*(n-s)>(p-s)*(t-o)&&++r:p<=n&&(d-o)*(n-s)<(p-s)*(t-o)&&--r;return r}(),i=_&&r,a=(u=uy(u)).length;(i||a)&&(s.polygonStart(),i&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),a&&uo(u,l,r,o,s),s.polygonEnd()),b=s,u=c=h=null}};function E(t,r){a(t,r)&&b.point(t,r)}function T(o,s){var l=a(o,s);if(c&&h.push([o,s]),v)f=o,d=s,p=l,v=!1,l&&(b.lineStart(),b.point(o,s));else if(l&&y)b.point(o,s);else{var u=[m=Math.max(-1e9,Math.min(1e9,m)),g=Math.max(-1e9,Math.min(1e9,g))],x=[o=Math.max(-1e9,Math.min(1e9,o)),s=Math.max(-1e9,Math.min(1e9,s))];!function(t,r,i,n,a,o){var s,l=t[0],u=t[1],c=r[0],h=r[1],f=0,d=1,p=c-l,m=h-u;if(s=i-l,!p&&s>0)return;if(s/=p,p<0){if(s<f)return;s<d&&(d=s)}else if(p>0){if(s>d)return;s>f&&(f=s)}if(s=a-l,p||!(s<0)){if(s/=p,p<0){if(s>d)return;s>f&&(f=s)}else if(p>0){if(s<f)return;s<d&&(d=s)}if(s=n-u,m||!(s>0)){if(s/=m,m<0){if(s<f)return;s<d&&(d=s)}else if(m>0){if(s>d)return;s>f&&(f=s)}if(s=o-u,m||!(s<0)){if(s/=m,m<0){if(s>d)return;s>f&&(f=s)}else if(m>0){if(s<f)return;s<d&&(d=s)}return f>0&&(t[0]=l+f*p,t[1]=u+f*m),d<1&&(r[0]=l+d*p,r[1]=u+d*m),!0}}}}(u,x,t,r,i,n)?l&&(b.lineStart(),b.point(o,s),_=!1):(y||(b.lineStart(),b.point(u[0],u[1])),b.point(x[0],x[1]),l||b.lineEnd(),_=!1)}m=o,g=s,y=l}return w}}let uP=t=>t;function uI(t){return{stream:uk(t)}}function uk(t){return function(r){var i=new uO;for(var n in t)i[n]=t[n];return i.stream=r,i}}function uO(){}function uN(t,r){t&&uR.hasOwnProperty(t.type)&&uR[t.type](t,r)}uO.prototype={constructor:uO,point:function(t,r){this.stream.point(t,r)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var uL={Feature:function(t,r){uN(t.geometry,r)},FeatureCollection:function(t,r){for(var i=t.features,n=-1,a=i.length;++n<a;)uN(i[n].geometry,r)}},uR={Sphere:function(t,r){r.sphere()},Point:function(t,r){t=t.coordinates,r.point(t[0],t[1],t[2])},MultiPoint:function(t,r){for(var i=t.coordinates,n=-1,a=i.length;++n<a;)t=i[n],r.point(t[0],t[1],t[2])},LineString:function(t,r){uF(t.coordinates,r,0)},MultiLineString:function(t,r){for(var i=t.coordinates,n=-1,a=i.length;++n<a;)uF(i[n],r,0)},Polygon:function(t,r){uB(t.coordinates,r)},MultiPolygon:function(t,r){for(var i=t.coordinates,n=-1,a=i.length;++n<a;)uB(i[n],r)},GeometryCollection:function(t,r){for(var i=t.geometries,n=-1,a=i.length;++n<a;)uN(i[n],r)}};function uF(t,r,i){var n,a=-1,o=t.length-i;for(r.lineStart();++a<o;)n=t[a],r.point(n[0],n[1],n[2]);r.lineEnd()}function uB(t,r){var i=-1,n=t.length;for(r.polygonStart();++i<n;)uF(t[i],r,1);r.polygonEnd()}function uz(t,r){t&&uL.hasOwnProperty(t.type)?uL[t.type](t,r):uN(t,r)}var uj=1/0,uU=1/0,uV=-1/0,u$=uV;let uG={point:function(t,r){t<uj&&(uj=t),t>uV&&(uV=t),r<uU&&(uU=r),r>u$&&(u$=r)},lineStart:ur,lineEnd:ur,polygonStart:ur,polygonEnd:ur,result:function(){var t=[[uj,uU],[uV,u$]];return uV=u$=-(uU=uj=1/0),t}};function uq(t,r,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),uz(i,t.stream(uG)),r(uG.result()),null!=n&&t.clipExtent(n),t}function uH(t,r,i){return uq(t,function(i){var n=r[1][0]-r[0][0],a=r[1][1]-r[0][1],o=Math.min(n/(i[1][0]-i[0][0]),a/(i[1][1]-i[0][1])),s=+r[0][0]+(n-o*(i[1][0]+i[0][0]))/2,l=+r[0][1]+(a-o*(i[1][1]+i[0][1]))/2;t.scale(150*o).translate([s,l])},i)}function uW(t,r,i){return uH(t,[[0,0],r],i)}function uZ(t,r,i){return uq(t,function(i){var n=+r,a=n/(i[1][0]-i[0][0]),o=(n-a*(i[1][0]+i[0][0]))/2,s=-a*i[0][1];t.scale(150*a).translate([o,s])},i)}function uY(t,r,i){return uq(t,function(i){var n=+r,a=n/(i[1][1]-i[0][1]),o=-a*i[0][0],s=(n-a*(i[1][1]+i[0][1]))/2;t.scale(150*a).translate([o,s])},i)}var uX=l2(30*lQ);function uK(t,r){var i;return+r?function(t,r){function i(n,a,o,s,l,u,c,h,f,d,p,m,g,y){var v=c-n,_=h-a,b=v*v+_*_;if(b>4*r&&g--){var x=s+d,w=l+p,E=u+m,T=l7(x*x+w*w+E*E),A=ut(E/=T),S=1e-6>lJ(lJ(E)-1)||1e-6>lJ(o-f)?(o+f)/2:l1(w,x),C=t(S,A),M=C[0],D=C[1],P=M-n,I=D-a,k=_*P-v*I;(k*k/b>r||lJ((v*P+_*I)/b-.5)>.3||s*d+l*p+u*m<uX)&&(i(n,a,o,s,l,u,M,D,S,x/=T,w/=T,E,g,y),y.point(M,D),i(M,D,S,x,w,E,c,h,f,d,p,m,g,y))}}return function(r){var n,a,o,s,l,u,c,h,f,d,p,m,g={point:y,lineStart:v,lineEnd:b,polygonStart:function(){r.polygonStart(),g.lineStart=x},polygonEnd:function(){r.polygonEnd(),g.lineStart=v}};function y(i,n){i=t(i,n),r.point(i[0],i[1])}function v(){h=NaN,g.point=_,r.lineStart()}function _(n,a){var o=uc([n,a]),s=t(n,a);i(h,f,c,d,p,m,h=s[0],f=s[1],c=n,d=o[0],p=o[1],m=o[2],16,r),r.point(h,f)}function b(){g.point=y,r.lineEnd()}function x(){v(),g.point=w,g.lineEnd=E}function w(t,r){_(n=t,r),a=h,o=f,s=d,l=p,u=m,g.point=_}
5function E(){i(h,f,c,d,p,m,a,o,n,s,l,u,16,r),g.lineEnd=b,b()}return g}}(t,r):(i=t,uk({point:function(t,r){t=i(t,r),this.stream.point(t[0],t[1])}}))}var uQ=uk({point:function(t,r){this.stream.point(t*lQ,r*lQ)}});function uJ(t,r,i,n,a,o){if(!o){function s(o,s){return[r+t*(o*=n),i-t*(s*=a)]}return s.invert=function(o,s){return[(o-r)/t*n,(i-s)/t*a]},s}var l=l2(o),u=l5(o),c=l*t,h=u*t,f=l/t,d=u/t,p=(u*i-l*r)/t,m=(u*r+l*i)/t;function g(t,o){return[c*(t*=n)-h*(o*=a)+r,i-h*t-c*o]}return g.invert=function(t,r){return[n*(f*t-d*r+p),a*(m-d*t-f*r)]},g}function u0(t){return u1(function(){return t})()}function u1(t){var r,i,n,a,o,s,l,u,c,h,f=150,d=480,p=250,m=0,g=0,y=0,v=0,_=0,b=0,x=1,w=1,E=null,T=ux,A=null,S=uP,C=.5;function M(t){return u(t[0]*lQ,t[1]*lQ)}function D(t){return(t=u.invert(t[0],t[1]))&&[t[0]*lK,t[1]*lK]}function P(){var t=uJ(f,0,0,x,w,b).apply(null,r(m,g)),n=uJ(f,d-t[0],p-t[1],x,w,b);return i=uT(y,v,_),l=uw(r,n),u=uw(i,l),s=uK(l,C),I()}function I(){return c=h=null,M}return M.stream=function(t){var r;return c&&h===t?c:c=uQ((r=i,uk({point:function(t,i){var n=r(t,i);return this.stream.point(n[0],n[1])}}))(T(s(S(h=t)))))},M.preclip=function(t){return arguments.length?(T=t,E=void 0,I()):T},M.postclip=function(t){return arguments.length?(S=t,A=n=a=o=null,I()):S},M.clipAngle=function(t){return arguments.length?(T=+t?function(t){var r=l2(t),i=2*lQ,n=r>0,a=lJ(r)>1e-6;function o(t,i){return l2(t)*l2(i)>r}function s(t,i,n){var a=uc(t),o=uc(i),s=[1,0,0],l=uf(a,o),u=uh(l,l),c=l[0],h=u-c*c;if(!h)return!n&&t;var f=uf(s,l),d=up(s,r*u/h);ud(d,up(l,-r*c/h));var p=uh(d,f),m=uh(f,f),g=p*p-m*(uh(d,d)-1);if(!(g<0)){var y=l7(g),v=up(f,(-p-y)/m);if(ud(v,d),v=uu(v),!n)return v;var _,b=t[0],x=i[0],w=t[1],E=i[1];x<b&&(_=b,b=x,x=_);var T=x-b,A=1e-6>lJ(T-lW);if(!A&&E<w&&(_=w,w=E,E=_),A||T<1e-6?A?w+E>0^v[1]<(1e-6>lJ(v[0]-b)?w:E):w<=v[1]&&v[1]<=E:T>lW^(b<=v[0]&&v[0]<=x)){var S=up(f,(-p+y)/m);return ud(S,d),[v,uu(S)]}}}function l(r,i){var a=n?t:lW-t,o=0;return r<-a?o|=1:r>a&&(o|=2),i<-a?o|=4:i>a&&(o|=8),o}return uv(o,function(t){var r,i,u,c,h;return{lineStart:function(){c=u=!1,h=1},point:function(f,d){var p,m,g=[f,d],y=o(f,d),v=n?y?0:l(f,d):y?l(f+(f<0?lW:-lW),d):0;!r&&(c=u=y)&&t.lineStart(),y!==u&&(!(m=s(r,g))||un(r,m)||un(g,m))&&(g[2]=1),y!==u?(h=0,y?(t.lineStart(),m=s(g,r),t.point(m[0],m[1])):(m=s(r,g),t.point(m[0],m[1],2),t.lineEnd()),r=m):a&&r&&n^y&&!(v&i)&&(p=s(g,r,!0))&&(h=0,n?(t.lineStart(),t.point(p[0][0],p[0][1]),t.point(p[1][0],p[1][1]),t.lineEnd()):(t.point(p[1][0],p[1][1]),t.lineEnd(),t.lineStart(),t.point(p[0][0],p[0][1],3))),!y||r&&un(r,g)||t.point(g[0],g[1]),r=g,u=y,i=v},lineEnd:function(){u&&t.lineEnd(),r=null},clean:function(){return h|(c&&u)<<1}}},function(r,n,a,o){!function(t,r,i,n,a,o){if(i){var s=l2(r),l=l5(r),u=n*i;null==a?(a=r+n*lX,o=r-u/2):(a=uM(s,a),o=uM(s,o),(n>0?a<o:a>o)&&(a+=n*lX));for(var c,h=a;n>0?h>o:h<o;h-=u)c=uu([s,-l*l2(h),-l*l5(h)]),t.point(c[0],c[1])}}(o,t,i,a,r,n)},n?[0,-t]:[-lW,t-lW])}(E=t*lQ):(E=null,ux),I()):E*lK},M.clipExtent=function(t){return arguments.length?(S=null==t?(A=n=a=o=null,uP):uD(A=+t[0][0],n=+t[0][1],a=+t[1][0],o=+t[1][1]),I()):null==A?null:[[A,n],[a,o]]},M.scale=function(t){return arguments.length?(f=+t,P()):f},M.translate=function(t){return arguments.length?(d=+t[0],p=+t[1],P()):[d,p]},M.center=function(t){return arguments.length?(m=t[0]%360*lQ,g=t[1]%360*lQ,P()):[m*lK,g*lK]},M.rotate=function(t){return arguments.length?(y=t[0]%360*lQ,v=t[1]%360*lQ,_=t.length>2?t[2]%360*lQ:0,P()):[y*lK,v*lK,_*lK]},M.angle=function(t){return arguments.length?(b=t%360*lQ,P()):b*lK},M.reflectX=function(t){return arguments.length?(x=t?-1:1,P()):x<0},M.reflectY=function(t){return arguments.length?(w=t?-1:1,P()):w<0},M.precision=function(t){return arguments.length?(s=uK(l,C=t*t),I()):l7(C)},M.fitExtent=function(t,r){return uH(M,t,r)},M.fitSize=function(t,r){return uW(M,t,r)},M.fitWidth=function(t,r){return uZ(M,t,r)},M.fitHeight=function(t,r){return uY(M,t,r)},function(){return r=t.apply(this,arguments),M.invert=r.invert&&D,P()}}function u2(t){var r=0,i=lW/3,n=u1(t),a=n(r,i);return a.parallels=function(t){return arguments.length?n(r=t[0]*lQ,i=t[1]*lQ):[r*lK,i*lK]},a}function u3(t,r){var i=l5(t),n=(i+l5(r))/2;if(1e-6>lJ(n)){var a=l2(t);function o(t,r){return[t*a,l5(r)/a]}return o.invert=function(t,r){return[t/a,ut(r*a)]},o}var s=1+i*(2*n-i),l=l7(s)/n;function u(t,r){var i=l7(s-2*n*l5(r))/n;return[i*l5(t*=n),l-i*l2(t)]}return u.invert=function(t,r){var i=l-r,a=l1(t,lJ(i))*l8(i);return i*n<0&&(a-=lW*l8(t)*l8(i)),[a/n,ut((s-(t*t+i*i)*n*n)/(2*n))]},u}function u4(){return u2(u3).scale(155.424).center([0,33.6442])}function u6(){return u4().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function u5(){var t,r,i,n,a,o,s=u6(),l=u4().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=u4().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,r){o=[t,r]}};function h(t){var r=t[0],s=t[1];return o=null,i.point(r,s),o||(n.point(r,s),o)||(a.point(r,s),o)}function f(){return t=r=null,h}return h.invert=function(t){var r=s.scale(),i=s.translate(),n=(t[0]-i[0])/r,a=(t[1]-i[1])/r;return(a>=.12&&a<.234&&n>=-.425&&n<-.214?l:a>=.166&&a<.234&&n>=-.214&&n<-.115?u:s).invert(t)},h.stream=function(i){var n,a;return t&&r===i?t:(a=(n=[s.stream(r=i),l.stream(i),u.stream(i)]).length,t={point:function(t,r){for(var i=-1;++i<a;)n[i].point(t,r)},sphere:function(){for(var t=-1;++t<a;)n[t].sphere()},lineStart:function(){for(var t=-1;++t<a;)n[t].lineStart()},lineEnd:function(){for(var t=-1;++t<a;)n[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<a;)n[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<a;)n[t].polygonEnd()}})},h.precision=function(t){return arguments.length?(s.precision(t),l.precision(t),u.precision(t),f()):s.precision()},h.scale=function(t){return arguments.length?(s.scale(t),l.scale(.35*t),u.scale(t),h.translate(s.translate())):s.scale()},h.translate=function(t){if(!arguments.length)return s.translate();var r=s.scale(),o=+t[0],h=+t[1];return i=s.translate(t).clipExtent([[o-.455*r,h-.238*r],[o+.455*r,h+.238*r]]).stream(c),n=l.translate([o-.307
5*r,h+.201*r]).clipExtent([[o-.425*r+1e-6,h+.12*r+1e-6],[o-.214*r-1e-6,h+.234*r-1e-6]]).stream(c),a=u.translate([o-.205*r,h+.212*r]).clipExtent([[o-.214*r+1e-6,h+.166*r+1e-6],[o-.115*r-1e-6,h+.234*r-1e-6]]).stream(c),f()},h.fitExtent=function(t,r){return uH(h,t,r)},h.fitSize=function(t,r){return uW(h,t,r)},h.fitWidth=function(t,r){return uZ(h,t,r)},h.fitHeight=function(t,r){return uY(h,t,r)},h.scale(1070)}function u8(t){return function(r,i){var n=l2(r),a=l2(i),o=t(n*a);return o===1/0?[2,0]:[o*a*l5(r),o*l5(i)]}}function u7(t){return function(r,i){var n=l7(r*r+i*i),a=t(n),o=l5(a);return[l1(r*o,n*l2(a)),ut(n&&i*o/n)]}}var u9=u8(function(t){return l7(2/(1+t))});function ce(){return u0(u9).scale(124.75).clipAngle(179.999)}u9.invert=u7(function(t){return 2*ut(t/2)});var ct=u8(function(t){return(t=ue(t))&&t/l5(t)});function cr(){return u0(ct).scale(79.4188).clipAngle(179.999)}function ci(t,r){return[t,l4(l9((lZ+r)/2))]}function cn(){return ca(ci).scale(961/lX)}function ca(t){var r,i,n,a=u0(t),o=a.center,s=a.scale,l=a.translate,u=a.clipExtent,c=null;function h(){var o=lW*s(),l=a((function(t){function r(r){return r=t(r[0]*lQ,r[1]*lQ),r[0]*=lK,r[1]*=lK,r}return t=uT(t[0]*lQ,t[1]*lQ,t.length>2?t[2]*lQ:0),r.invert=function(r){return r=t.invert(r[0]*lQ,r[1]*lQ),r[0]*=lK,r[1]*=lK,r},r})(a.rotate()).invert([0,0]));return u(null==c?[[l[0]-o,l[1]-o],[l[0]+o,l[1]+o]]:t===ci?[[Math.max(l[0]-o,c),r],[Math.min(l[0]+o,i),n]]:[[c,Math.max(l[1]-o,r)],[i,Math.min(l[1]+o,n)]])}return a.scale=function(t){return arguments.length?(s(t),h()):s()},a.translate=function(t){return arguments.length?(l(t),h()):l()},a.center=function(t){return arguments.length?(o(t),h()):o()},a.clipExtent=function(t){return arguments.length?(null==t?c=r=i=n=null:(c=+t[0][0],r=+t[0][1],i=+t[1][0],n=+t[1][1]),h()):null==c?null:[[c,r],[i,n]]},h()}function co(t){return l9((lZ+t)/2)}function cs(t,r){var i=l2(t),n=t===r?l5(t):l4(i/l2(r))/l4(co(r)/co(t)),a=i*l6(co(t),n)/n;if(!n)return ci;function o(t,r){a>0?r<-lZ+1e-6&&(r=-lZ+1e-6):r>lZ-1e-6&&(r=lZ-1e-6);var i=a/l6(co(r),n);return[i*l5(n*t),a-i*l2(n*t)]}return o.invert=function(t,r){var i=a-r,o=l8(n)*l7(t*t+i*i),s=l1(t,lJ(i))*l8(i);return i*n<0&&(s-=lW*l8(t)*l8(i)),[s/n,2*l0(l6(a/o,1/n))-lZ]},o}function cl(){return u2(cs).scale(109.5).parallels([30,30])}function cu(t,r){return[t,r]}function cc(){return u0(cu).scale(152.63)}function ch(t,r){var i=l2(t),n=t===r?l5(t):(i-l2(r))/(r-t),a=i/n+t;if(1e-6>lJ(n))return cu;function o(t,r){var i=a-r,o=n*t;return[i*l5(o),a-i*l2(o)]}return o.invert=function(t,r){var i=a-r,o=l1(t,lJ(i))*l8(i);return i*n<0&&(o-=lW*l8(t)*l8(i)),[o/n,a-l8(n)*l7(t*t+i*i)]},o}function cf(){return u2(ch).scale(131.154).center([0,13.9389])}ct.invert=u7(function(t){return t}),ci.invert=function(t,r){return[t,2*l0(l3(r))-lZ]},cu.invert=cu;var cd=l7(3)/2;function cp(t,r){var i=ut(cd*l5(r)),n=i*i,a=n*n*n;return[t*l2(i)/(cd*(1.340264+-.24331799999999998*n+a*(.0062510000000000005+.034164*n))),i*(1.340264+-.081106*n+a*(893e-6+.003796*n))]}function cm(){return u0(cp).scale(177.158)}function cg(t,r){var i=l2(r),n=l2(t)*i;return[i*l5(t)/n,l5(r)/n]}function cy(){return u0(cg).scale(144.049).clipAngle(60)}function cv(t,r){return[l2(r)*l5(t),l5(r)]}function c_(){return u0(cv).scale(249.5).clipAngle(90.000001)}cp.invert=function(t,r){for(var i,n,a=r,o=a*a,s=o*o*o,l=0;l<12&&(n=a*(1.340264+-.081106*o+s*(893e-6+.003796*o))-r,a-=i=n/(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o)),s=(o=a*a)*o*o,!(1e-12>lJ(i)));++l);return[cd*t*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))/l2(a),ut(l5(a)/cd)]},cg.invert=u7(l0),cv.invert=u7(ut);var cb,cx,cw,cE,cT,cA,cS,cC=new ul,cM=new ul,cD={point:ur,lineStart:ur,lineEnd:ur,polygonStart:function(){cD.lineStart=cP,cD.lineEnd=cO},polygonEnd:function(){cD.lineStart=cD.lineEnd=cD.point=ur,cC.add(lJ(cM)),cM=new ul},result:function(){var t=cC/2;return cC=new ul,t}};function cP(){cD.point=cI}function cI(t,r){cD.point=ck,cE=cA=t,cT=cS=r}function ck(t,r){cM.add(cS*t-cA*r),cA=t,cS=r}function cO(){ck(cE,cT)}var cN,cL,cR,cF,cB=0,cz=0,cj=0,cU=0,cV=0,c$=0,cG=0,cq=0,cH=0,cW={point:cZ,lineStart:cY,lineEnd:cQ,polygonStart:function(){cW.lineStart=cJ,cW.lineEnd=c0},polygonEnd:function(){cW.point=cZ,cW.lineStart=cY,cW.lineEnd=cQ},result:function(){var t=cH?[cG/cH,cq/cH]:c$?[cU/c$,cV/c$]:cj?[cB/cj,cz/cj]:[NaN,NaN];return cB=cz=cj=cU=cV=c$=cG=cq=cH=0,t}};function cZ(t,r){cB+=t,cz+=r,++cj}function cY(){cW.point=cX}function cX(t,r){cW.point=cK,cZ(cR=t,cF=r)}function cK(t,r){var i=t-cR,n=r-cF,a=l7(i*i+n*n);cU+=a*(cR+t)/2,cV+=a*(cF+r)/2,c$+=a,cZ(cR=t,cF=r)}function cQ(){cW.point=cZ}function cJ(){cW.point=c1}function c0(){c2(cN,cL)}function c1(t,r){cW.point=c2,cZ(cN=cR=t,cL=cF=r)}function c2(t,r){var i=t-cR,n=r-cF,a=l7(i*i+n*n);cU+=a*(cR+t)/2,cV+=a*(cF+r)/2,c$+=a,cG+=(a=cF*t-cR*r)*(cR+t),cq+=a*(cF+r),cH+=3*a,cZ(cR=t,cF=r)}function c3(t){this._context=t}c3.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,r){switch(this._point){case 0:this._context.moveTo(t,r),this._point=1;break;case 1:this._context.lineTo(t,r);break;default:this._context.moveTo(t+this._radius,r),this._context.arc(t,r,this._radius,0,lX)}},result:ur};var c4,c6,c5,c8,c7,c9=new ul,he={point:ur,lineStart:function(){he.point=ht},lineEnd:function(){c4&&hr(c6,c5),he.point=ur},polygonStart:function(){c4=!0},polygonEnd:function(){c4=null},result:function(){var t=+c9;return c9=new ul,t}};function ht(t,r){he.point=hr,c6=c8=t,c5=c7=r}function hr(t,r){c8-=t,c7-=r,c9.add(l7(c8*c8+c7*c7)),c8=t,c7=r}class hi{constructor(t){this._append=null==t?hn:function(t){let r=Math.floor(t);if(!(r>=0))throw RangeError(`invalid digits: ${t}`);if(r>15)return hn;if(r!==i){let t=10**r;i=r,n=function(r){let i=1;this._+=r[0];for(let n=r.length;i<n;++i)this._+=Math.round(arguments[i]*t)/t+r[i]}}return n}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,r){switch(this._point){case 0:this._append`M${t},${r}`,this._point=1;break;case 1:this._append`L${t},${r}`;break;default:if(this._append`M${t},${r}`,this._radius!==a||this._append!==n){let t=this._radius,r=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,a=t,n=this._append,o=this._,this._=r}this._+=o}}result(){let t=this._;return this._="",t.length?t:null}}function hn(t){let r=1;this._+=t[0];for(let i=t.length;r<i;++r)this._+=arguments[r]+t[r]}function ha(t,r){let i=3,n=4.5,a,o;function s(t){return t&&("function"==typeof n&&o.pointRadius(+n.apply(this,arguments)),uz(t,a(o))),o.result()}return s.area=function(t){return uz(t,a(cD)),cD.result()},s.measure=function(t){return uz(t,a(he)),he.result()},s.bounds=function(t){return uz(t,a(uG)),uG.result()},s.centroid=function(t){return uz(t,a(cW)),cW.result()},s.projection=function(r){return arguments.length?(a=null==r?(t=null,uP):(t=r).stream,s
5):t},s.context=function(t){return arguments.length?(o=null==t?(r=null,new hi(i)):new c3(r=t),"function"!=typeof n&&o.pointRadius(n),s):r},s.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(o.pointRadius(+t),+t),s):n},s.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{let r=Math.floor(t);if(!(r>=0))throw RangeError(`invalid digits: ${t}`);i=r}return null===r&&(o=new hi(i)),s},s.projection(t).digits(i).context(r)}function ho(t,r){var i=l2(r),n=1+l2(t)*i;return[i*l5(t)/n,l5(r)/n]}function hs(){return u0(ho).scale(250).clipAngle(142)}function hl(t,r){return[l4(l9((lZ+r)/2)),-t]}function hu(){var t=ca(hl),r=t.center,i=t.rotate;return t.center=function(t){return arguments.length?r([-t[1],t[0]]):[(t=r())[1],-t[0]]},t.rotate=function(t){return arguments.length?i([t[0],t[1],t.length>2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}ho.invert=u7(function(t){return 2*l0(t)}),hl.invert=function(t,r){return[-r,2*l0(l3(t))-lZ]};let hc=Math.PI,hh=2*hc;function hf(t){switch(`${t}`.toLowerCase()){case"albers-usa":return hd(u5,.7463,.4673);case"albers":return hp(u6,.7463,.4673);case"azimuthal-equal-area":return hd(ce,4,4);case"azimuthal-equidistant":return hd(cr,hh,hh);case"conic-conformal":return hp(cl,hh,hh);case"conic-equal-area":return hp(u4,6.1702,2.9781);case"conic-equidistant":return hp(cf,7.312,3.6282);case"equal-earth":return hd(cm,5.4133,2.6347);case"equirectangular":return hd(cc,hh,hc);case"gnomonic":return hd(cy,3.4641,3.4641);case"identity":return{type:hm};case"reflect-y":return{type:hg};case"mercator":return hd(cn,hh,hh);case"orthographic":return hd(c_,2,2);case"stereographic":return hd(hs,2,2);case"transverse-mercator":return hd(hu,hh,hh);default:throw Error(`unknown projection type: ${t}`)}}function hd(t,r,i){return{type:({width:n,height:a,rotate:o,precision:s=.15,clip:l})=>{let u=t();return null!=s&&u.precision?.(s),null!=o&&u.rotate?.(o),"number"==typeof l&&u.clipAngle?.(l),null!=n&&(u.scale(Math.min(n/r,a/i)),u.translate([n/2,a/2])),u},aspectRatio:i/r}}function hp(t,r,i){let{type:n,aspectRatio:a}=hd(t,r,i);return{type:t=>{let{parallels:r,domain:i,width:a,height:o}=t,s=n(t);return null!=r&&(s.parallels(r),void 0===i&&null!=a&&s.fitSize([a,o],{type:"Sphere"})),s},aspectRatio:a}}let hm=il({stream:t=>t}),hg=il(uI({point(t,r){this.stream.point(t,-r)}}));var hy=t.i(134449),hy=hy,hv=t.i(723685),h_=t.i(13154),h_=h_;function hb(t={}){let{document:r="u">typeof window?window.document:void 0,clip:i}=t;return{document:r,clip:i4(i)}}function hx(t,{document:r}){return(0,hv.select)((0,h_.default)(t).call(r.documentElement))}function hw(t,r){return`${t}`.padStart(r,"0")}let hE=Symbol("unset");function hT(t){return(1===t.length?function(t){let r,i=hE;return n=>(Object.is(i,n)||(i=n,r=t(n)),r)}:function(t){let r,i;return(...n)=>((i?.length!==n.length||i.some((t,r)=>!Object.is(t,n[r])))&&(i=n,r=t(...n)),r)})(t)}let hA=hT(t=>new Intl.NumberFormat(t));hT((t,r)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...r&&{month:r}})),hT((t,r)=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...r&&{weekday:r}}));let hS=function(t="en-US"){let r=function(t="en-US"){let r=hA(t);return t=>null==t||isNaN(t)?void 0:r.format(t)}(t);return t=>(t instanceof Date?function(t){var r,i=t,n="Invalid Date";if(i instanceof Date||(i=new Date(+i)),isNaN(i))return"function"==typeof n?n(i):n;let a=i.getUTCHours(),o=i.getUTCMinutes(),s=i.getUTCSeconds(),l=i.getUTCMilliseconds();return`${(r=i.getUTCFullYear())<0?`-${hw(-r,6)}`:r>9999?`+${hw(r,6)}`:hw(r,4)}-${hw(i.getUTCMonth()+1,2)}-${hw(i.getUTCDate(),2)}${a||o||s||l?`T${hw(a,2)}:${hw(o,2)}${s||l?`:${hw(s,2)}${l?`.${hw(l,3)}`:""}`:""}Z`:""}`}:"number"==typeof t?r:ii)(t)}(),hC=.5*("u">typeof window?!(window.devicePixelRatio>1):"u">typeof it),hM=0;function hD(){return`plot-clip-${++hM}`}function hP(t,r){r&&t.text(t=>hS(r[t]))}function hI(t,{target:r,tip:i},{ariaLabel:n,title:a,fill:o,fillOpacity:s,stroke:l,strokeOpacity:u,strokeWidth:c,opacity:h,href:f}){var d,p,m;n&&hF(t,"aria-label",t=>n[t]),o&&hF(t,"fill",t=>o[t]),s&&hF(t,"fill-opacity",t=>s[t]),l&&hF(t,"stroke",t=>l[t]),u&&hF(t,"stroke-opacity",t=>u[t]),c&&hF(t,"stroke-width",t=>c[t]),h&&hF(t,"opacity",t=>h[t]),f&&(d=t,p=t=>f[t],m=r,d.each(function(t){let r=p(t);if(null!=r){let t=this.ownerDocument.createElementNS(hy.default.svg,"a");t.setAttribute("fill","inherit"),t.setAttributeNS(hy.default.xlink,"href",r),null!=m&&t.setAttribute("target",m),this.parentNode.insertBefore(t,this).appendChild(this)}})),!i&&a&&t.filter(t=>eB(a[t])).append("title").call(hP,a)}let hk=(u=(t,r,i)=>{let{width:n,height:a,marginLeft:o,marginRight:s,marginTop:l,marginBottom:u}=i;t.append("rect").attr("x",o).attr("y",l).attr("width",n-s-o).attr("height",a-l-u)},s=new WeakMap,(t,r)=>{let i=s.get(t);if(!i){let n=hD();(0,hv.select)(t.ownerSVGElement).append("clipPath").attr("id",n).c
5all(u,t,r),s.set(t,i=`url(#${n})`)}return i}),hO=new WeakMap,hN={type:"Sphere"};function hL(t,r,i,n){!function(t,r,i,n){let a,{clip:o=n.clip}=r;"frame"===o?(t=hx("svg:g",n).each(function(){this.appendChild(t.node()),t.node=()=>this}),a=hk(n,i)):o&&(a=function(t,r){let i,n;if((i=hO.get(r))||hO.set(r,i=new WeakMap),"Sphere"===t.type&&(t=hN),!(n=i.get(t))){let a=hD();(0,hv.select)(r.ownerSVGElement).append("clipPath").attr("id",a).append("path").attr("d",r.path()(t)),i.set(t,n=`url(#${a})`)}return n}(o,n)),hF(t,"aria-label",r.ariaLabel),hF(t,"aria-description",r.ariaDescription),hF(t,"aria-hidden",r.ariaHidden),hF(t,"clip-path",a)}(t,r,i,n),hF(t,"class",r.className),hF(t,"fill",r.fill),hF(t,"fill-opacity",r.fillOpacity),hF(t,"stroke",r.stroke),hF(t,"stroke-width",r.strokeWidth),hF(t,"stroke-opacity",r.strokeOpacity),hF(t,"stroke-linejoin",r.strokeLinejoin),hF(t,"stroke-linecap",r.strokeLinecap),hF(t,"stroke-miterlimit",r.strokeMiterlimit),hF(t,"stroke-dasharray",r.strokeDasharray),hF(t,"stroke-dashoffset",r.strokeDashoffset),hF(t,"shape-rendering",r.shapeRendering),hF(t,"filter",r.imageFilter),hF(t,"paint-order",r.paintOrder);let{pointerEvents:a=!1===n.pointerSticky?"none":void 0}=r;hF(t,"pointer-events",a)}function hR(t,r){var i,n,a;i=t,n="mix-blend-mode",null!=(a=r.mixBlendMode)&&i.style(n,a),hF(t,"opacity",r.opacity)}function hF(t,r,i){null!=i&&t.attr(r,i)}function hB(t,r,{x:i,y:n},a=hC,o=hC){a+=r.dx,o+=r.dy,i?.bandwidth&&(a+=i.bandwidth()/2),n?.bandwidth&&(o+=n.bandwidth()/2),(a||o)&&t.attr("transform",`translate(${a},${o})`)}function hz(t,r){if((t=ii(t))!==r)return t}function hj(t,r){if((t=ia(t))!==r)return t}let hU=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function hV(t){if(void 0===t)return"plot-d6a7b5";if(t=`${t}`,!hU.test(t))throw Error(`invalid class name: ${t}`);return t}function h$(t,r){if("string"==typeof r)t.property("style",r);else if(null!=r)for(let i of t)Object.assign(i.style,r)}function hG({frameAnchor:t},{width:r,height:i,marginTop:n,marginRight:a,marginBottom:o,marginLeft:s}){return[/left$/.test(t)?s:/right$/.test(t)?r-a:(s+r-a)/2,/^top/.test(t)?n:/^bottom/.test(t)?i-o:(n+i-o)/2]}function hq({filter:t,sort:r,reverse:i,transform:n,initializer:a,...o}={},s){if(void 0===n&&(null!=t&&(n=hY(t)),null==r||iD(r)||(n=hW(n,hK(r))),i&&(n=hW(n,hX))),null!=s&&null!=a)throw Error("transforms cannot be applied after initializers");return{...o,...(null===r||iD(r))&&{sort:r},transform:hW(n,s)}}function hH({filter:t,sort:r,reverse:i,initializer:n,...a}={},o){return void 0===n&&(null!=t&&(n=hY(t)),null==r||iD(r)||(n=hZ(n,hK(r))),i&&(n=hZ(n,hX))),{...a,...(null===r||iD(r))&&{sort:r},initializer:hZ(n,o)}}function hW(t,r){return null==t?null===r?void 0:r:null==r?null===t?void 0:t:function(i,n,a){return{data:i,facets:n}=t.call(this,i,n,a),r.call(this,iv(i),n,a)}}function hZ(t,r){return null==t?null===r?void 0:r:null==r?null===t?void 0:t:function(i,n,a,...o){let s,l,u,c,h,f;return{data:l=i,facets:u=n,channels:s}=t.call(this,i,n,a,...o),{data:h=l,facets:f=u,channels:c}=r.call(this,l,u,{...a,...s},...o),{data:h,facets:f,channels:{...s,...c}}}}function hY(t){return(r,i)=>{let n=r1(r,t);return{data:r,facets:i.map(t=>t.filter(t=>n[t]))}}}function hX(t,r){return{data:t,facets:r.map(t=>t.slice().reverse())}}function hK(t){return("function"==typeof t&&1!==t.length?function(t){return(r,i)=>{let n=rK(r)?(i,n)=>t(r[i],r[n]):(i,n)=>t(r.get(i),r.get(n));return{data:r,facets:i.map(t=>t.slice().sort(n))}}}:function(t){let r,i;({channel:r,value:t,order:i}
5={...iV(t)});let n=r?.startsWith("-");if(n&&(r=r.slice(1)),void 0===i&&(i=n?eF:eR),"function"!=typeof i)switch(`${i}`.toLowerCase()){case"ascending":i=eR;break;case"descending":i=eF;break;default:throw Error(`invalid order: ${i}`)}return(n,a,o)=>{let s;if(void 0===r)s=r1(n,t);else{if(void 0===o)throw Error("channel sort requires an initializer");if(!(s=o[r]))return{};s=s.value}let l=(t,r)=>i(s[t],s[r]);return{data:n,facets:a.map(t=>t.slice().sort(l))}}})(t)}class hQ{constructor(t,r={},i={},n){const{facet:a="auto",facetAnchor:o,fx:s,fy:l,sort:u,dx:c=0,dy:h=0,margin:f=0,marginTop:d=f,marginRight:p=f,marginBottom:m=f,marginLeft:g=f,className:y,clip:v=n?.clip,channels:_,tip:b,render:x}=i;if(this.data=t,this.sort=iD(u)?u:null,this.initializer=hH(i).initializer,this.transform=this.initializer?i.transform:hq(i).transform,null===a||!1===a?this.facet=null:(this.facet=iy(!0===a?"include":a,"facet",["auto","include","exclude","super"]),this.fx=t===r5&&"string"==typeof s?[s]:s,this.fy=t===r5&&"string"==typeof l?[l]:l),this.facetAnchor=function(t){if(null==t)return null;let r=lR.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid facet anchor: ${t}`)}(o),r=i3(r),void 0!==_&&(r={...function(t){return Object.fromEntries(Object.entries(i3(t)).map(([t,r])=>(void 0===(r="string"==typeof r?{value:r,label:t}:iV(r)).filter&&null==r.scale&&(r={...r,filter:null}),[t,r])))}(_),...r}),void 0!==n&&(r={...function(t,{title:r,href:i,ariaLabel:n,ariaDescription:a,ariaHidden:o,target:s,fill:l,fillOpacity:u,stroke:c,strokeWidth:h,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:p,strokeMiterlimit:m,strokeDasharray:g,strokeDashoffset:y,opacity:v,mixBlendMode:_,imageFilter:b,paintOrder:x,pointerEvents:w,shapeRendering:E,channels:T},{ariaLabel:A,fill:S="currentColor",fillOpacity:C,stroke:M="none",strokeOpacity:D,strokeWidth:P,strokeLinecap:I,strokeLinejoin:k,strokeMiterlimit:O,paintOrder:N}){null===S&&(l=null,u=null),null===M&&(c=null,f=null),iJ(S)?!iJ(M)&&(!iJ(l)||T?.fill)&&(M="none"):iJ(M)&&(!iJ(c)||T?.stroke)&&(S="none");let[L,R]=ip(l,S),[F,B]=im(u,C),[z,j]=ip(c,M),[U,V]=im(f,D),[$,G]=im(v);if(!i0(j)){var q;void 0===h&&(h=P),void 0===p&&(p=I),void 0===d&&(d=k),void 0!==m||(q=d,/^\s*round\s*$/i.test(q))||(m=O),i0(R)||void 0!==x||(x=N)}let[H,W]=im(h);return null!==S&&(t.fill=hz(R,"currentColor"),t.fillOpacity=hj(B,1)),null!==M&&(t.stroke=hz(j,"none"),t.strokeWidth=hj(W,1),t.strokeOpacity=hj(V,1),t.strokeLinejoin=hz(d,"miter"),t.strokeLinecap=hz(p,"butt"),t.strokeMiterlimit=hj(m,4),t.strokeDasharray=hz(g,"none"),t.strokeDashoffset=hz(y,"0")),t.target=ii(s),t.ariaLabel=ii(A),t.ariaDescription=ii(a),t.ariaHidden=ii(o),t.opacity=hj(G,1),t.mixBlendMode=hz(_,"normal"),t.imageFilter=hz(b,"none"),t.paintOrder=hz(x,"normal"),t.pointerEvents=hz(w,"auto"),t.shapeRendering=hz(E,"auto"),{title:{value:r,optional:!0,filter:null},href:{value:i,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:L,scale:"auto",optional:!0},fillOpacity:{value:F,scale:"auto",optional:!0},stroke:{value:z,scale:"auto",optional:!0},strokeOpacity:{value:U,scale:"auto",optional:!0},strokeWidth:{value:H,optional:!0},opacity:{value:$,scale:"auto",optional:!0}}}(this,i,n),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([r,i])=>{if(iM(i.value)){let{value:t,label:r=i.label,scale:n=i.scale}=i.value;i={...i,label:r,scale:n,value:t}}if(t===r5&&"string"==typeof i.value){let{value:t}=i;i={...i,value:[t]}}return[r,i]}).filter(([t,{value:r,optional:i}])=>{if(null!=r)return!0;if(i)return!1;throw Error(`missing channel value: ${t}`)})),this.dx=+c,this.dy=+h,this.marginTop=+d,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+g,this.clip=i4(v),this.tip=function(t){return!0===t?"xy":!1===t||null==t?null:"string"==typeof t?iy(t,"tip",["x","y","xy"]):t}(b),this.className=ii(y),"super"===this.facet){if(s||l)throw Error("super-faceting cannot use fx or fy");for(const t in this.channels){const{scale:i}=r[t];if("x"===i||"y"===i)throw Error("super-faceting cannot use x or y")}}null!=x&&(this.render=h0(x,this.render))}initialize(t,r,i){var n,a;let o=iv(this.data);void 0===t&&null!=o&&(t=[iO(o)]);let s=t;null!=this.transform&&({facets:t,data:o}=this.transform(o,t,i),o=iv(o)),void 0!==t&&(t.original=s);let l=(n=this.channels,a=o,Object.fromEntries(Object.entries(n).map(([t,r])=>[t,n7(a,r,t)])));return null!=this.sort&&function(t,r,i,n,a){let{order:o,reverse:s,reduce:l=!0,limit:u}=a;for(let c in a){if(!nn.has(c))continue;let{value:h,order:f=o,reverse:d=s,reduce:p=l,limit:m=u}=iV(a[c]),g=h?.startsWith("-");if(g&&(h=h.slice(1)),f=void 0===f?g!==("width"===h||"height"===h)?ai:ar:function(t){if(null==t||"function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"ascending":return ar;case"descending":return ai}throw Error(`invalid order: ${t}`)}(f),null==p||!1===p)continue;let y="fx"===c||"fy"===c?function(t,r){let i=t.original;if(i===t)return r;let n=r.value,a=r.value=[];for(let r=0;r<i.length;++r){let o=n[i[r][0]];for(let i of t[r])a[i]=o}return r}(r,n[c]):function(t,r){for(let i in t){let n=t[i];if(n.scale===r)return n}}(i,c);if(!y)throw Error(`missing channel for scale: ${c}`);let v=y.value,[_=0,b=1/0]=i$(m)?m:m<0?[m]:[0,m];if(null==h)y.domain=()=>{let t=Array.from(new eT(v));return d&&(t=t.reverse()),(0!==_||b!==1/0)&&(t=t.slice(_,b)),t};else{let r="data"===h?t:"height"===h?ae(i,"y1","y2"):"width"===h?ae(i,"x1","x2"):at(i,h,"y"===h?"y2":"x"===h?"x2":void 0),n=function(t,r,i=function(t){throw Error(`invalid reduce: ${t}`)}){if(null==t)return i(t);if("function"==typeof t.reduceIndex)return t;if("function"==typeof t.reduce&&iS(t)){var n;return n=t,console.warn("deprecated reduce interface; implement reduceIndex instead."),{...n,reduceIndex:n.reduce.bind(n)}}if("function"==typeof t)return function(t){return{reduceIndex:(r,i,n)=>t(iN(i,r),n)}}(t);if(/^p\d{2}$/i.test(t)){let r;return nJ((r=`${t}`.slice(1)/100,(t,i)=>eX(t,r,i)))}switch(`${t}`.toLowerCase()){case"first":return n2;case"last":return n3;case"identity":return n1;case"count":return n4;case"distinct":return n6;case"sum":return null==r?n4:n5;case"proportion":return n8(r,"data");case"proportion-facet":return n8(r,"facet");case"deviation":return nJ(nH);case"min":return nJ(e$);case"min-index":return nJ(nX);case"max":return nJ(eV);case"max-index":return nJ(nW);case"mean":return n0(nZ);case"median":return n0(nY);case"variance":return nJ(nq);case"mode":return nJ(nK)}return i(t)}(!0===p?"max":p,r);y.domain=()=>{let t=function(t,r,...i){return ek(t,Array.from,r,i)}(iO(v),t=>n.reduceIndex(t,r),t=>v[t]);return f&&t.sort(f),d&&t.reverse(),(0!==_||b!==1/0)&&(t=t.slice(_,b)),t.map(io)}}}}(o,t,l,r,this.sort),{data:o,facets:t,channels:l}}filter(t,r,i){for(let n in r){let{filter:a=eL}=r[n];if(null!==a){let r=i[n];t=t.filter(t=>a(r[t]))}}return t}project(t,r,i){for(let n in t)if("x"===t[n].scale&&/^x|x$/.test(n)){let a=n.replace(/^x|x$/,"y");a in t&&"y"===t[a].scale&&function(t,r,i,n){let a,o=i[t],s=i[r],l=o.length,u=i[t]=new Float64Array(l).fill(NaN),c=i[r]=new Float64Array(l).fill(NaN),h=n.stream({point(t,r){u[a]=t,c[a]=r}});for(a=0;a<l;++a)h.point(o[a],s[a])}(n,a,r,i.projection)}}scale(t,r,i){let n,a=((n=Object.fromEntries(Object.entries(t).map(([t,{scale:i,value:n}])=>{let a=null==i?null:r[i];return[t,null==a?n:ix(n,a)]}))).channels=t,n);return i.projection&&this.project(t,a,i),a}}function hJ(...t){return t.plot=hQ.prototype.plot,t}function h0(t,r){if(null==t)return null===r?void 0:r;if(null==r)return null===t?void 0:t;if("function"!=typeof t)throw TypeError(`invalid render transform: ${t}`);if("function"!=typeof r)throw TypeError(`invalid render transform: ${r}`);return function(i,n,a,o,s,l){return t.call(this,i,n,a,o,s,(t,i,n,a,o)=>r.call(this,t,i,n,a,o,l))}}function h1(t,r){return t?.tip===!0?{...t,tip:r}:iS(t?.tip)&&void 0===t.tip.pointer?{...t,tip:{...t.tip,pointer:r}}:t}var h_=h_;function h2(t,r){let i;if(!r)throw Error(`aspectRatio requires ${t} scale`);let{type:n,domain:a}=r;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{let t=r.scale.exponent();i=r=>Math.pow(r,t);break}case"log":i=Math.log;break;case"point":case"band":return a.length;default:throw Error(`unsupported ${t} scale for aspectRatio: ${n}`)}let[o,s]=al(a);return Math.abs(i(s)-i(o))}var h3=t.i(100561);let h4=new WeakMap;function h6(t,r,{x:i,y:n,px:a,py:o,maxRadius:s=40,channels:l,render:u,...c}={}){return s*=1,null!=a&&(i??=null,l={...l,px:{value:a,scale:"x"}}),null!=o&&(n??=null,l={...l,py:{value:o,scale:"y"}}),{x:i,y:n,channels:l,...c,render:h0(function(i,n,a,o,l,u){let c,h,f,d,p,m=(l={...l,pointerSticky:!1}).ownerSVGElement,{data:g}=l.getMarkState(this),y=h4.get(m);y||h4.set(m,y={sticky:!1,roots:[],renders:[]});let v=y.renders.push(O)-1,{x:_,y:b,fx:x,fy:w}=n,E=x?x(i.fx)-o.marginLeft:0,T=w?w(i.fy)-o.marginTop:0;_?.bandwidth&&(E+=_.bandwidth()/2),b?.bandwidth&&(T+=b.bandwidth()/2);let A=null!=i.fi;if(A){let t=y.facetStates;t||(y.facetStates=t=new Map),(c=t.get(this))||t.set(this,c=new Map)}let[S,C]=hG(this,o),{px:M,py:D}=a,P=M?t=>M[t]:h9(a,S),I=D?t=>D[t]:fe(a,C);function k(t,r){if(A)if(p&&(p=cancelAnimationFrame(p)),null==t)c.delete(i.fi);else{c.set(i.fi,r),p=requestAnimationFrame(()=>{for(let[n,a]of(p=null,c))if(a<r||a===r&&n<i.fi){t=null;break}O(t)});return}O(t)}function O(t){if(h===t&&d===y.sticky)return;h=t,d=l.pointerSticky=y.sticky;let r=null==h?[]:[h];A&&(r.fx=i.fx,r.fy=i.fy,r.fi=i.fi);let s=u(r,n,a,o,l);if(f){if(A){let t=f.parentNode,r=f.getAttribute("transform"),i=s.getAttribute("transform");r?s.setAttribute("transform",r):s.removeAttribute("transform"),i?t.setAttribute("transform",i):t.removeAttribute("transform"),s.removeAttribute("aria-label"),s.removeAttribute("aria-description"),s.removeAttribute("aria-hidden")}f.replaceWith(s)}if(y.roots[v]=f=s,!(null==h&&c?.size>1)){let t=null==h?null:rK(g)?g[h]:g.get(h);l.dispatchValue(t)}return s}function N(n){if(y.sticky||"mouse"===n.pointerType&&1===n.buttons)return;let[a,l]=(0,h3.pointer)(n);a-=E,l-=T;let u=a<o.marginLeft||a>o.width-o.marginRight?1:t,c=l<o.marginTop||l>o.height-o.marginBottom?1:r,h=null,f=s*s;for(let t of i){let r=u*(P(t)-a),i=c*(I(t)-l),n=r*r+i*i;n<=f&&(h=t,f=n)}if(null!=h&&(1!==t||1!==r)){let t=P(h)-a,r=I(h)-l;f=t*t+r*r}k(h,f)}return m.addEventListener("pointerenter",N),m.addEventListener("pointermove",N),m.addEventListener("pointerdown",function(t){"mouse"!==t.pointerType||null==h||y.sticky&&y.roots.some(r=>
5r?.contains(t.target))||(y.sticky?(y.sticky=!1,y.renders.forEach(t=>t(null))):(y.sticky=!0,O(h)),t.stopImmediatePropagation())}),m.addEventListener("pointerleave",function(t){"mouse"===t.pointerType&&(y.sticky||k(null))}),O(null)},u)}}function h5(t){return h6(1,1,t)}function h8(t){return h6(1,.01,t)}function h7(t){return h6(.01,1,t)}function h9({x1:t,x2:r,x:i=t},n){return t&&r?i=>(t[i]+r[i])/2:i?t=>i[t]:()=>n}function fe({y1:t,y2:r,y:i=t},n){return t&&r?i=>(t[i]+r[i])/2:i?t=>i[t]:()=>n}function ft(t){return t}function fr(t){return"translate("+t+",0)"}function fi(){return!this.__axis}function fn(t){return lP(t)&&void 0===t.interval?void 0:"tabular-nums"}let fa=Math.PI/180;function fo(t,{marker:r,markerStart:i=r,markerMid:n=r,markerEnd:a=r}={}){t.markerStart=fs(i),t.markerMid=fs(n),t.markerEnd=fs(a)}function fs(t){if(null==t||!1===t)return null;if(!0===t)return fc;if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"none":return null;case"arrow":return fl("auto");case"arrow-reverse":return fl("auto-start-reverse");case"dot":return fu;case"circle":case"circle-fill":return fc;case"circle-stroke":return fh;case"tick":return ff("auto");case"tick-x":return ff(90);case"tick-y":return ff(0)}throw Error(`invalid marker: ${t}`)}function fl(t){return(r,i)=>hx("svg:marker",i).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",t).attr("fill","none").attr("stroke",r).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(t=>t.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function fu(t,r){return hx("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","none").call(t=>t.append("circle").attr("r",2.5)).node()}function fc(t,r){return hx("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",t).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(t=>t.append("circle").attr("r",3)).node()}function fh(t,r){return hx("svg:marker",r).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",t).attr("stroke-width",1.5).call(t=>t.append("circle").attr("r",3)).node()}function ff(t){return(r,i)=>hx("svg:marker",i).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",t).attr("stroke",r).call(t=>t.append("path").attr("d","M0,-3v6")).node()}let fd=0;function fp(t,r,{stroke:i},n){return function(t,{markerStart:r,markerMid:i,markerEnd:n,stroke:a},o=()=>a,s){if(!r&&!i&&!n)return;let l=new Map,u=null;function c(t,r,i){return function(n){if(i&&!i(n))return;let a=o(n),u=l.get(r);u||l.set(r,u=new Map);let c=u.get(a);if(!c){let t=this.parentNode.insertBefore(r(a,s),this),i=`plot-marker-${++fd}`;t.setAttribute("id",i),u.set(a,c=`url(#${i})`)}this.setAttribute(t,c)}}r&&t.each(c("marker-start",r,u&&(t=>1&u(t)))),i&&u&&t.each(c("marker-start",i,t=>!(1&u(t)))),i&&t.each(c("marker-mid",i)),n&&t.each(c("marker-end",n,u&&(t=>2&u(t))))}(t,r,i&&(t=>i[t]),n)}function fm({inset:t,insetLeft:r,insetRight:i,...n}={}){return[r,i]=fy(t,r,i),{inset:t,insetLeft:r,insetRight:i,...n}}function fg({inset:t,insetTop:r,insetBottom:i,...n}={}){return[r,i]=fy(t,r,i),{inset:t,insetTop:r,insetBottom:i,...n}}function fy(t,r,i){return void 0===t&&void 0===r&&void 0===i?hC?[1,0]:[.5,.5]:[r,i]}function fv(t,{interval:r}){return(t={...iV(t)}).interval=ij(void 0===t.interval?r:t.interval),t}function f_(t,r,i,n){let a,o,{[t]:s,[`${t}1`]:l,[`${t}2`]:u}=i,{value:c,interval:h}=fv(s,i);if(null==c||null==h&&!n)return i;let f=iF(s);if(null==h){let r,a={transform:t=>r||(r=r1(t,c)),label:f};return{...i,[t]:void 0,[`${t}1`]:void 0===l?a:l,[`${t}2`]:void 0!==u||l===u&&n?u:a}}function d(t){return void 0!==o&&t===a?o:o=ix(r1(a=t,c),t=>h.floor(t))}return r({...i,[t]:void 0,[`${t}1`]:void 0===l?{transform:d,label:f}:l,[`${t}2`]:void 0===u?{transform:t=>d(t).map(t=>h.offset(t)),label:f}:u})}function fb(t,r,i){let{[t]:n}=i,{value:a,interval:o}=fv(n,i);return null==a||null==o?i:r({...i,[t]:{label:iF(n),transform:t=>{let r=ix(r1(t,a),t=>o.floor(t)),i=r.map(t=>o.offset(t));return r.map(iH(r)?(t,r)=>null==t||isNaN(t*=1)||null==(r=i[r])||isNaN(r*=1)?void 0:new Date((t+r)/2):(t,r)=>null==t||null==(r=i[r])?NaN:(+t+ +r)/2)}}})}function fx(t={}){return f_("x",fm,t)}let fw={ariaLabel:"rule",fill:null,stroke:"currentColor"};class fE extends hQ{constructor(t,r={}){const{x:i,y1:n,y2:a,inset:o=0,insetTop:s=o,insetBottom:l=o}=r;super(t,{x:{value:i,scale:"x",optional:!0},y1:{value:n,scale:"y",optional:!0},y2:{value:a,scale:"y",optional:!0}},h1(r,"x"),fw),this.insetTop=ia(s),this.insetBottom=ia(l),fo(this,r)}render(t,r,i,n,a){let{x:o,y:s}=r,{x:l,y1:u,y2:c}=i,{width:h,height:f,marginTop:d,marginRight:p,marginLeft:m,marginBottom:g}=n,{insetTop:y,insetBottom:v}=this;return hx("svg:g",a).call(hL,this,n,a).call(hB,this,{x:l&&o}
5,hC,0).call(r=>r.selectAll().data(t).enter().append("line").call(hR,this).attr("x1",l?t=>l[t]:(m+h-p)/2).attr("x2",l?t=>l[t]:(m+h-p)/2).attr("y1",u&&!lk(s)?t=>u[t]+y:d+y).attr("y2",c&&!lk(s)?s.bandwidth?t=>c[t]+s.bandwidth()-v:t=>c[t]-v:f-g-v).call(hI,this,i).call(fp,this,i,a)).node()}}class fT extends hQ{constructor(t,r={}){const{x1:i,x2:n,y:a,inset:o=0,insetRight:s=o,insetLeft:l=o}=r;super(t,{y:{value:a,scale:"y",optional:!0},x1:{value:i,scale:"x",optional:!0},x2:{value:n,scale:"x",optional:!0}},h1(r,"y"),fw),this.insetRight=ia(s),this.insetLeft=ia(l),fo(this,r)}render(t,r,i,n,a){let{x:o,y:s}=r,{y:l,x1:u,x2:c}=i,{width:h,height:f,marginTop:d,marginRight:p,marginLeft:m,marginBottom:g}=n,{insetLeft:y,insetRight:v}=this;return hx("svg:g",a).call(hL,this,n,a).call(hB,this,{y:l&&s},0,hC).call(r=>r.selectAll().data(t).enter().append("line").call(hR,this).attr("x1",u&&!lk(o)?t=>u[t]+y:m+y).attr("x2",c&&!lk(o)?o.bandwidth?t=>c[t]+o.bandwidth()-v:t=>c[t]-v:h-p-v).attr("y1",l?t=>l[t]:(d+f-g)/2).attr("y2",l?t=>l[t]:(d+f-g)/2).call(hI,this,i).call(fp,this,i,a)).node()}}function fA(t,r){let{x:i=r9,y:n,y1:a,y2:o,...s}=function(t={}){return f_("y",fg,t)}(r);return[a,o]=fC(n,a,o),new fE(t,{...s,x:i,y1:a,y2:o})}function fS(t,r){let{y:i=r9,x:n,x1:a,x2:o,...s}=fx(r);return[a,o]=fC(n,a,o),new fT(t,{...s,y:i,x1:a,x2:o})}function fC(t,r,i){if(null==t){if(void 0===r){if(void 0!==i)return[0,i]}else if(void 0===i)return[0,r]}else if(void 0===r)return void 0===i?[0,t]:[t,i];else if(void 0===i)return[t,r];return[r,i]}var hy=hy;function fM(t,...r){let i=r.length;for(let n=0,a=!0;n<i;++n)"function"!=typeof r[n]&&(a&&(t=t.slice(),a=!1),t.splice(n,2,t[n]+r[n]+t[n+1]),r.splice(n,1),--n,--i);return n=>{let a=t[0];for(let o=0;o<i;++o)a+=r[o](n)+t[o+1];return a}}let fD={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"};class fP extends hQ{constructor(t,r={}){const{x:i,y:n,text:a=i$(t)&&iG(t)?r9:r7,frameAnchor:o,textAnchor:s=/right$/i.test(o)?"end":/left$/i.test(o)?"start":"middle",lineAnchor:l=/^top/i.test(o)?"top":/^bottom/i.test(o)?"bottom":"middle",lineHeight:u=1,lineWidth:c=1/0,textOverflow:h,monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:g,fontWeight:y,rotate:v}=r,[_,b]=im(v,0),[x,w]=function(t){return null==t||"number"==typeof t?[void 0,t]:"string"!=typeof t?[t,void 0]:(t=t.trim().toLowerCase(),fF.has(t)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(t)?[void 0,t]:[t,void 0])}(p);if(super(t,{x:{value:i,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},fontSize:{value:x,optional:!0},rotate:{value:function(t){return null==t?null:{transform:r=>r1(r,t,Float64Array),label:iF(t)}}(_),optional:!0},text:{value:a,filter:eB,optional:!0}},r,fD),this.rotate=b,this.textAnchor=hz(s,"middle"),this.lineAnchor=iy(l,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+u,this.lineWidth=+c,this.textOverflow=fI(h),this.monospace=!!f,this.fontFamily=ii(d),this.fontSize=w,this.fontStyle=ii(m),this.fontVariant=ii(g),this.fontWeight=ii(y),this.frameAnchor=i2(o),!(this.lineWidth>=0))throw Error(`invalid lineWidth: ${c}`);this.splitLines=fU(this),this.clipLine=fV(this)}render(t,r,i,n,a){let{x:o,y:s}=r,{x:l,y:u,rotate:c,text:h,title:f,fontSize:d}=i,{rotate:p}=this,[m,g]=hG(this,n);return hx("svg:g",a).call(hL,this,n,a).call(fR,this,h,n).call(hB,this,{x:l&&o,y:u&&s}).call(r=>r.selectAll().data(t).enter().append("text").call(hR,this).call(fk,this,h,f).attr("transform",fM`translate(${l?t=>l[t]:m},${u?t=>u[t]:g})${c?t=>` rotate(${c[t]})`:p?` rotate(${p})`:""}`).call(hF,"font-size",d&&(t=>d[t])).call(hI,this,i)).node()}}function fI(t){return null==t?null:iy(t,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function fk(t,r,i,n){if(!i)return;let{lineAnchor:a,lineHeight:o,textOverflow:s,splitLines:l,clipLine:u}=r;t.each(function(t){let r=l(hS(i[t])??"").map(u),c=r.length,h="top"===a?.71:"bottom"===a?1-c:(164-100*c)/200;if(c>1){let t=0;for(let i=0;i<c;++i){if(++t,!r[i])continue;let n=this.ownerDocument.createElementNS(hy.default.svg,"tspan");n.setAttribute("x",0),i===t-1?n.setAttribute("y",`${(h+i)*o}em`):n.setAttribute("dy",`${t*o}em`),n.textContent=r[i],this.appendChild(n),t=0}}else h&&this.setAttribute("y",`${h*o}em`),this.textContent=r[0];if(s&&!n&&r[0]!==i[t]){let r=this.ownerDocument.createElementNS(hy.default.svg,"title");r.textContent=i[t],this.appendChild(r)}})}function fO(t,{x:r,y:i,...n}={}){return void 0===n.frameAnchor&&([r,i]=iI(r,i)),new fP(t,{...n,x:r,y:i})}function fN(t,{x:r=r9,...i}={}){return new fP(t,function(t={}){return fb("y",fg,t)}({...i,x:r}))}function fL(t,{y:r=r9,...i}={}){return new fP(t,function(t={}){return fb("x",fm,t)}({...i,y:r}))}function fR(t,r,i){var n;hF(t,"text-anchor",r.textAnchor),hF(t,"font-family",r.fontFamily),hF(t,"font-size",r.fontSize),hF(t,"font-style",r.fontStyle),hF(t,"font-variant",void 0===r.fontVariant?(n=i)&&(function(t){for(let r of t)if(null!=r)return"number"==typeof r}(n)||iH(n))?"tabular-nums":void 0:r.fontVariant),hF(t,"font-weight",r.fontWeight)}
5let fF=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]),fB={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"â":31,"â":31,"â":47,"â":47,"â¦":82};function fz(t,r=0,i=t.length){let n=0;for(let a=r;a<i;a=fY(t,a))n+=fB[t[a]]??(fK(t,a)?120:fB.e);return n}function fj(t,r=0,i=t.length){let n=0;for(let a=r;a<i;a=fY(t,a))n+=fK(t,a)?126:63;return n}function fU({monospace:t,lineWidth:r,textOverflow:i}){if(null!=i||r==1/0)return t=>t.split(/\r\n?|\n/g);let n=t?fj:fz,a=100*r;return t=>(function(t,r,i){let n=[],a,o=0;for(let[s,l,u]of function*(t){let r=0,i=0,n=t.length;for(;i<n;){let n=1;switch(t[i]){case"Â":case"-":++i,yield[r,i,!1],r=i;break;case" ":for(yield[r,i,!1];" "===t[++i];);r=i;break;case"\r":"\n"===t[i+1]&&++n;case"\n":yield[r,i,!0],i+=n,r=i;break;default:++i}}yield[r,i,!0]}(t)){if(void 0===a&&(a=s),o>a&&i(t,a,l)>r&&(n.push(t.slice(a,o)+("Â"===t[o-1]?"-":"")),a=s),u){n.push(t.slice(a,l)),a=void 0;continue}o=l}return n})(t,a,n)}function fV({monospace:t,lineWidth:r,textOverflow:i}){if(null==i||r==1/0)return t=>t;let n=t?fj:fz,a=100*r;switch(i){case"clip-start":return t=>fH(t,a,n,"");case"clip-end":return t=>fq(t,a,n,"");case"ellipsis-start":return t=>fH(t,a,n,f$);case"ellipsis-middle":return t=>(function(t,r,i,n){let a=i(t=t.trim());if(a<=r)return t;let o=i(n)/2,[s,l]=fG(t,r/2,i,o),[u]=fG(t,a-r/2-l+o,i,-o);return u<0?n:t.slice(0,s).trimEnd()+n+t.slice(fY(t,u)).trimStart()})(t,a,n,f$);case"ellipsis-end":return t=>fq(t,a,n,f$)}}let f$="â¦";function fG(t,r,i,n){let a=[],o=0;for(let s=0,l=0,u=t.length;s<u;s=l){l=fY(t,s);let u=i(t,s,l);if(o+u>r){for(o+=n;o>r&&s>0;)l=s,o-=i(t,s=a.pop(),l);return[s,r-o]}o+=u,a.push(s)}return[-1,0]}function fq(t,r,i,n){t=t.trim();let a=i(n),[o]=fG(t,r,i,a);return o<0?t:t.slice(0,o).trimEnd()+n}function fH(t,r,i,n){let a=i(t=t.trim());if(a<=r)return t;let o=i(n),[s]=fG(t,a-r+o,i,-o);return s<0?n:n+t.slice(fY(t,s)).trimStart()}let fW=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,fZ=/\p{Extended_Pictographic}/uy;function fY(t,r){var i,n,a,o;return(r+=!function(t,r){let i=t.charCodeAt(r);if(i>=55296&&i<56320){let i=t.charCodeAt(r+1);return i>=56320&&i<57344}return!1}(t,r)?1:2,!fX(i=t,n=r)&&(fW.lastIndex=n,fW.test(i))&&(r=fW.lastIndex),a=t,o=r,8205===a.charCodeAt(o))?fY(t,r+1):r}function fX(t,r){return 128>t.charCodeAt(r)}function fK(t,r){return!fX(t,r)&&(fZ.lastIndex=r,fZ.test(t))}let fQ={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},fJ={draw(t,r,i){let n=r*i/17.5;t.moveTo(0,0),t.lineTo(0,-r),t.moveTo(-n,n-r),t.lineTo(0,-r),t.lineTo(n,n-r)}},f0=new Map([["arrow",fJ],["spike",{draw(t,r,i){t.moveTo(-i,0),t.lineTo(0,-r),t.lineTo(i,0)}}]]);class f1 extends hQ{constructor(t,r={}){const{x:i,y:n,r:a=3.5,length:o,rotate:s,shape:l=fJ,anchor:u="middle",frameAnchor:c}=r,[h,f]=im(o,12),[d,p]=im(s,0);super(t,{x:{value:i,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},length:{value:h,scale:"length",optional:!0},rotate:{value:d,optional:!0}},r,fQ),this.r=+a,this.length=f,this.rotate=p,this.shape=function(t){if(t&&"function"==typeof t.draw)return t;let r=f0.get(`${t}`.toLowerCase());if(r)return r;throw Error(`invalid shape: ${t}`)}(l),this.anchor=iy(u,"anchor",["start","middle","end"]),this.frameAnchor=i2(c)}render(t,r,i,n,a){let{x:o,y:s}=r,{x:l,y:u,length:c,rotate:h}=i,{length:f,rotate:d,anchor:p,shape:m,r:g}=this,[y,v]=hG(this,n);return hx("svg:g",a).call(hL,this,n,a).call(hB,this,{x:l&&o,y:u&&s}).call(r=>{let n;return r.selectAll().data(t).enter().append("path").call(hR,this).attr("transform",fM`translate(${l?t=>l[t]:y},${u?t=>u[t]:v})${h?t=>` rotate(${h[t]})`:d?` rotate(${d})`:""}${"start"===p?"":"end"===p?c?t=>` translate(0,${c[t]})`:` translate(0,${f})`:c?t=>` translate(0,${c[t]/2})`:` translate(0,${f/2})`}`).attr("d",c?t=>{let r=la();return m.draw(r,c[t],g),r}:(n=la(),m.draw(n,f,g),n)).call(hI,this,i)}).node()}}function f2(t,r={}){let{x:i=r9,...n}=r;return new f1(t,{...n,x:i})}function f3(t,r={}){let{y:i=r9,...n}=r;return new f1(t,{...n,y:i})}function f4(t,r){return arguments.length<2&&!i$(t)&&(r=t,t=null),void 0===r&&(r={}),[t,r]}function f6({anchor:t}={},r){return void 0===t?r[0]:iy(t,"anchor",r)}function f5(t){return f6(t,["left","right"])}function f8(t){return f6(t,["right","left"])}function f7(t){return f6(t,["bottom","top"])}function f9(t){return f6(t,["top","bottom"])}function de(){let[t,r]=f4(...arguments);return dn("y",f5(r),t,r)}function dt(){let[t,r]=f4(...arguments);return dn("fy",f8(r),t,r)}function dr(){let[t,r]=f4(...arguments);return da("x",f7(r),t,r)}function di(){let[t,r]=f4(...arguments);return da("fx",f9(r),t,r)}function dn(t,r,i,{color:n="currentColor",opacity:a=1,stroke:o=n,strokeOpacity:s=a,strokeWidth:l=1,fill:u=n,fillOpacity:c=a,textAnchor:h,textStroke:f,textStrokeOpacity:d,textStrokeWidth:p,tickSize:m=6*("y"===t),tickPadding:g,tickRotate:y,x:v,margin:_,marginTop:b=void 0===_?20:_,marginRight:x=void 0===_?40*("right"===r):_,marginBottom:w=void 0===_?20:_,marginLeft:E=void 0===_?40*("left"===r):_,label:T,labelAnchor:A,labelArrow:S,labelOffset:C,ariaLabel:M=`${t}-axis`,...D}){return m=ia(m),g=ia(g),y=ia(y),void 0!==A&&(A=iy(A,"labelAnchor",["center","top","bottom"])),S=dA(S),hJ(m&&!iJ(o)?function(t,r,i,{strokeWidth:n=1,strokeLinecap:a=null,strokeLinejoin:o=null,facetAnchor:s=r+("y"===t?"-empty":""),frameAnchor:l=r,tickSize:u,inset:c=0,insetLeft:h=c,insetRight:f=c,dx:d=0,y:p="y"===t?void 0:null,ariaLabel:m,...g}){return dm(f3,t,i,{ariaLabel:`${m} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinecap:a,strokeLinejoin:o,facetAnchor:s,frameAnchor:l,y:p,...g,dx:"left"===r?d-hC+ +h:+d+hC-f,anchor:"start",length:u,shape:"left"===r?dx:dw})}(t,r,i,{stroke:o,strokeOpacity:s,strokeWidth:l,tickSize:m,tickPadding:g,tickRotate:y,x:v,ariaLabel:M,...D}):null,iJ(u)?null:function(t,r,i,{facetAnchor:n=r+("y"===t?"-empty":""),frameAnchor:a=r,tickSize:o,tickRotate:s=0,tickPadding:l=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*fa):0),text:u,textAnchor:c=Math.abs(s)>60?"middle":"left"===r?"end":"start",lineAnchor:h=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:p=d,insetRight:m=d,dx:g=0,ariaLabel:y,y:v="y"===t?void 0:null,..._}){return dm(fL,t,i,{ariaLabel:`${y} tick label`},{facetAnchor:n,frameAnchor:a,text:u,textAnchor:c,lineAnchor:h,fontVariant:f,rotate:s,y:v,..._,dx:"left"===r?g-o-l+ +p:+g+ +o+ +l-m},function(t,i,n,a,o){void 0===f&&(this.fontVariant=dE(t)),void 0===u&&(o.text=dg(t,i,n,a,r))})}(t,r,i,{fill:u,fillOpacity:c,stroke:f,strokeOpacity:d,strokeWidth:p,textAnchor:h,tickSize:m,tickPadding:g,tickRotate:y,x:v,marginTop:b,marginRight:x,marginBottom:w,marginLeft:E,ariaLabel:M,...D}),iJ(u)||null===T?null:fO([],dp({fill:u,fillOpacity:c,...D},function(i,n,a,o,s){let l=o[t],{marginTop:u,marginRight:c,marginBottom:h,marginLeft:f}="y"===t&&s.inset||s,d=A??(l.bandwidth?"center":"top"),p=C??("right"===r?c:f)-3;return"center"===d?(this.textAnchor=void 0,this.lineAnchor="right"===r?"bottom":"top",this.frameAnchor=r,this.rotate=-90):(this.textAnchor="right"===r?"end":"start",this.lineAnchor=d,this.frameAnchor=`${d}-${r}`,this.rotate=0),this.dy="top"===d?3-u:"bottom"===d?h-3:0,this.dx="right"===r?p:-p,this.ariaLabel=`${M} label`,{facets:[[0]],channels:{text:{value:[dT(t,l,{anchor:r,label:T,labelAnchor:d,labelArrow:S})]}}}})))}function da(t,r,i,{color:n="currentColor",opacity:a=1,stroke:o=n,strokeOpacity:s=a,strokeWidth:l=1,fill:u=n,fillOpacity:c=a,textAnchor:h,textStroke:f,textStrokeOpacity:d,textStrokeWidth:p,tickSize:m=6*("x"===t),tickPadding:g,tickRotate:y,y:v,margin:_,marginTop:b=void 0===_?30*("top"===r):_,marginRight:x=void 0===_?20:_,marginBottom:w=void 0===_?30*("bottom"===r):_,marginLeft:E=void 0===_?20:_,label:T,labelAnchor:A,labelArrow:S,labelOffset:C,ariaLabel:M=`${t}-axis`,...D}){return m=ia(m),g=ia(g),y=ia(y),void 0!==A&&(A=iy(A,"labelAnchor",["center","left","right"])),S=dA(S),hJ(m&&!iJ(o)?function(t,r,i,{strokeWidth:n=1,strokeLinecap:a=null,strokeLinejoin:o=null,facetAnchor:s=r+("x"===t?"-empty":""),frameAnchor:l=r,tickSize:u,inset:c=0,insetTop:h=c,insetBottom:f=c,dy:d=0,x:p="x"===t?void 0:null,ariaLabel:m,...g}){return dm(f2,t,i,{ariaLabel:`${m} tick`,ariaHidden:!0},{strokeWidth:n,strokeLinejoin:o,strokeLinecap:a,facetAnchor:s,frameAnchor:l,x:p,...g,dy:"bottom"===r?d-hC-f:+d+hC+ +h,anchor:"start",length:u,shape:"bottom"===r?d_:db})}(t,r,i,{stroke:o,strokeOpacity:s,strokeWidth:l,tickSize:m,tickPadding:g,tickRotate:y,y:v,ariaLabel:M,...D}):null,iJ(u)?null:function(t,r,i,{facetAnchor:n=r+("x"===t?"-empty":""),frameAnchor:a=r,tickSize:o,tickRotate:s=0,tickPadding:l=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*fa):0),text:u,textAnchor:c=Math.abs(s)>=10?s<0^"bottom"===r?"start":"end":"middle",lineAnchor:h=Math.abs(s)>=10?"middle":"bottom"===r?"top":"bottom",fontVariant:f,inset:d=0,insetTop:p=d,insetBottom:m=d,dy:g=0,x:y="x"===t?void 0:null,ariaLabel:v,..._}){return dm(fN,t,i,{ariaLabel:`${v} tick label`},{facetAnchor:n,frameAnchor:a,text:void 0===u?null:u,textAnchor:c,lineAnchor:h,fontVariant:f,rotate:s,x:y,..._,dy:"bottom"===r?+g+ +o+ +l-m:g-o-l+ +p},function(t,i,n,a,o){void 0===f&&(this.fontVariant=dE(t)),void 0===u&&(o.text=dg(t,i,n,a,r))})}(t,r,i,{fill:u,fillOpacity:c,stroke:f,strokeOpacity:d,strokeWidth:p,textAnchor:h,tickSize:m,tickPadding:g,tickRotate:y,y:v,marginTop:b,marginRight:x,marginBottom:w,marginLeft:E,ariaLabel:M,...D}),iJ(u)||null===T?null:fO([],dp({fill:u,fillOpacity:c,...D},function(i,n,a,o,s){let l=o[t],{marginTop:u,marginRight:c,marginBottom:h,marginLeft:f}="x"===t&&s.inset||s,d=A??(l.bandwidth?"center":"right"),p=C??("top"===r?u:h)-3;return"center"===d?(this.frameAnchor=r,this.textAnchor=void 0):(this.frameAnchor=`${r}-${d}`,this.textAnchor="right"===d?"end":"start"),this.lineAnchor=r,this.dy="top"===r?-p:p,this.dx="right"===d?c-3:"left"===d?3-f:0,this.ariaLabel=`${M} label`,{facets:[[0]],channels:{text:{value:[dT(t,l,{anchor:r,label:T,labelAnchor:d,labelArrow:S})]}}}})))}function ds(){let[t,r]=f4(...arguments);return dh("y",f5(r),t,r)}function dl(){let[t,r]=f4(...arguments);return dh("fy",f8(r),t,r)}function du(){let[t,r]=f4(...arguments);return df("x",f7(r),t,r)}function dc(){let[t,r]=f4(...arguments);return df("fx",f9(r),t,r)}function dh(t,r,i,{y:n="y"===t?void 0:null,x:a=null,x1:o="left"===r?a:null,x2:s="right"===r?a:null,ariaLabel:l=`${t}-grid`,ariaHidden:u=!0,...c}){return dm(fS,t,i,{ariaLabel:l,ariaHidden:u},{y:n,x1:o,x2:s,...dd(c)})}function df(t,r,i,{x:n="x"===t?void 0:null,y:a=null,y1:o="top"===r?a:null,y2:s="bottom"===r?a:null,ariaLabel:l=`${t}-grid`,ariaHidden:u=!0,...c}){return dm(fA,t,i,{ariaLabel:l,ariaHidden:u},{x:n,y1:o,y2:s,...dd(c)})}function dd({color:t="currentColor",opacity:r=.1,stroke:i=t,strokeOpacity:n=r,strokeWidth:a=1,...o}){return{stroke:i,strokeOpacity:n,strokeWidth:a,...o}}function dp({fill:t,fillOpacity:r,fontFamily:i,fontSize:n,fontStyle:a,fontVariant:o,fontWeight:s,monospace:l,pointerEvents:u,shapeRendering:c,clip:h=!1},f){return[,t]=ip(t),[,r]=im(r),{facet:"super",x:null,y:null,fill:t,fillOpacity:r,fontFamily:i,fontSize:n,fontStyle:a,fontVariant:o,fontWeight:s,monospace:l,pointerEvents:u,shapeRendering:c,clip:h,initializer:f}}function dm(t,r,i,n,a,o){let s,l=hH(a).initializer,u=t(i,hH({...a,initializer:function(t,i,n,l,u,c){let h=null==t&&("fx"===r||"fy"===r),{[r]:f}=l;if(!f)throw Error(`missing scale: ${r}`);let d=f.domain(),{interval:p,ticks:m,tickFormat:g,tickSpacing:y="x"===r?80:35}=a;if("string"==typeof m&&dS(f)&&(p=m,m=void 0),void 0===m&&(m=iU(p,f.type)??function(t,r){let[i,n]=al(t.range());return(n-i)/r}(f,y)),null==t){if(i$(m))t=i_(m);else{var v;if(v=m,"function"==typeof v?.range)t=dv(m,...al(d));else if(f.interval){let r=f.interval;if(f.ticks){let[i,n]=al(d),a=(n-i)/r[rF];t=dv(r=rH(r,a/m)??r,i,n)}else(r=rH(r,(t=d).length/m)??r)!==f.interval&&(t=dv(r,...al(t)));if(r===f.interval){let r=Math.round(t.length/m);r>1&&(t=t.filter((t,i)=>i%r==0))}}else t=f.ticks?f.ticks(m):d}if(!f.ticks&&t.length&&t!==d){let i=new eT(d);(t=t.filter(t=>i.has(t))).length||sq(`Warning: the ${r}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}"y"===r||"x"===r?i=[iO(t)]:s[r]={scale:r,value:r9}}o?.call(this,f,t,m,g,s);let _=Object.fromEntries(Object.entries(s).map(([r,i])=>[r,{...i,value:r1(t,i.value)}]));return h&&(i=c.filterFacets(t,_)),{data:t,facets:i,channels:_}}},l));return null==i?(s=u.channels,u.channels={}):s={},void 0!==n&&Object.assign(u,n),void 0===u.clip&&(u.clip=!1),u}function dg(t,r,i,n,a){return{value:dy(t,r,i,n,a)}}function dy(t,r,i,n,a){return"function"!=typeof n||"log"===t.type&&t.tickFormat?void 0===n&&r&&iH(r)?function(t,r,i){let n=eV(function(t,r=function(t,r){return[t,r]}){let i,n=[],a=!1;
5for(let o of t)a&&n.push(r(i,o)),i=o,a=!0;return n}(r,(t,r)=>Math.abs(r-t)));if(n<1e3)return rW("millisecond","utc",i);for(let[a,o,s,l]of"time"===t?rj:"utc"===t?rz:rU){if(n>l||"hour"===a&&!n)break;if(r.every(t=>o.floor(t)>=t))return rW(a,s,i)}}(t.type,r,a)??hS:t.tickFormat?t.tickFormat("number"==typeof i?i:null,n):"string"==typeof n&&t.domain().length>0?(iH(t.domain())?cw:aD.format)(n):void 0===n?hS:il(n):n}function dv(t,r,i){return t.range(r,t.offset(t.floor(i)))}let d_={draw(t,r){t.moveTo(0,0),t.lineTo(0,r)}},db={draw(t,r){t.moveTo(0,0),t.lineTo(0,-r)}},dx={draw(t,r){t.moveTo(0,0),t.lineTo(-r,0)}},dw={draw(t,r){t.moveTo(0,0),t.lineTo(r,0)}};function dE(t){return t.bandwidth&&!t.interval?void 0:"tabular-nums"}function dT(t,r,{anchor:i,label:n=r.label,labelAnchor:a,labelArrow:o}={}){if(!(null==n||n.inferred&&dS(r)&&/^(date|time|year)$/i.test(n))){if(n=String(n),"auto"===o&&(o=(!r.bandwidth||r.interval)&&!/[ââââ]/.test(n)),!o)return n;if(!0===o){let i=Math.sign(rk(r.domain()))*Math.sign(rk(r.range()));i&&(o=/x$/.test(t)||"center"===a?/x$/.test(t)===i<0?"left":"right":i<0?"up":"down")}switch(o){case"left":return`â ${n}`;case"right":return`${n} â`;case"up":return"right"===i?`${n} â`:`â ${n}`;case"down":return"right"===i?`${n} â`:`â ${n}`}return n}}function dA(t="auto"){return!iJ(t)&&("boolean"==typeof t?t:iy(t,"labelArrow",["auto","up","right","down","left"]))}function dS(t){return iH(t.domain())}function dC(t,r){if(null==r)return r;let i=t(r);if(!i)throw Error(`scale not found: ${r}`);return i}function dM(t,r={},i){let n,{columns:a,tickFormat:o,fontVariant:s=fn(t),swatchSize:l=15,swatchWidth:u=l,swatchHeight:c=l,marginLeft:h=0,className:f,style:d,width:p}=r,m=hb(r);f=hV(f),o=dy(t.scale,t.domain,void 0,o);let g=hx("div",m).attr("class",`${f}-swatches ${f}-swatches-${null!=a?"columns":"wrap"}`);return null!=a?(n=`:where(.${f}-swatches-columns .${f}-swatch) { 6 display: flex; 7 align-items: center; 8 break-inside: avoid; 9 padding-bottom: 1px; 10} 11:where(.${f}-swatches-columns .${f}-swatch::before) { 12 flex-shrink: 0; 13} 14:where(.${f}-swatches-columns .${f}-swatch-label) { 15 white-space: nowrap; 16 overflow: hidden; 17 text-overflow: ellipsis; 18}`,g.style("columns",a).selectAll().data(t.domain).enter().append("div").attr("class",`${f}-swatch`).call(i,t,u,c).call(t=>t.append("div").attr("class",`${f}-swatch-label`).attr("title",o).text(o))):(n=`:where(.${f}-swatches-wrap) { 19 display: flex; 20 align-items: center; 21 min-height: 33px; 22 flex-wrap: wrap; 23} 24:where(.${f}-swatches-wrap .${f}-swatch) { 25 display: inline-flex; 26 align-items: center; 27 margin-right: 1em; 28}`,g.selectAll().data(t.domain).enter().append("span").attr("class",`${f}-swatch`).call(i,t,u,c).append(function(){return this.ownerDocument.createTextNode(o.apply(this,arguments))})),g.call(t=>t.insert("style","*").text(`:where(.${f}-swatches) { 29 font-family: system-ui, sans-serif; 30 font-size: 10px; 31 margin-bottom: 0.5em; 32} 33:where(.${f}-swatch > svg) { 34 margin-right: 0.5em; 35 overflow: visible; 36} 37${n}`)).style("margin-left",h?`${+h}px`:null).style("width",void 0===p?null:`${+p}px`).style("font-variant",hz(s,"normal")).call(h$,d).node()}let dD=new Map([["symbol",function(t,{fill:r=t.hint?.fill!==void 0?t.hint.fill:"none",fillOpacity:i=1,stroke:n=t.hint?.stroke!==void 0?t.hint.stroke:iJ(r)?"currentColor":"none",strokeOpacity:a=1,strokeWidth:o=1.5,r:s=4.5,...l}={},u){let[c,h]=ip(r),[f,d]=ip(n),p=dC(u,c),m=dC(u,f),g=s*s*Math.PI;return i=im(i)[1],a=im(a)[1],o=im(o)[1],dM(t,l,(r,n,s,l)=>r.append("svg").attr("viewBox","-8 -8 16 16").attr("width",s).attr("height",l).attr("fill","color"===c?t=>p.scale(t):h).attr("fill-opacity",i).attr("stroke","color"===f?t=>m.scale(t):d).attr("stroke-opacity",a).attr("stroke-width",o).append("path").attr("d",r=>{let i=la();return t.scale(r).draw(i,g),i}))}],["color",dI],["opacity",function({type:t,interpolate:r,...i},{legend:n=!0,color:a=(0,ad.rgb)(0,0,0),...o}){if(!r)throw Error(`${t} opacity scales are not supported`);if(!0===n&&(n="ramp"),"ramp"!==`${n}`.toLowerCase())throw Error(`${n} opacity legends are not supported`);return dI({type:t,...i,interpolate:function(t){let{r,g:i,b:n}=(0,ad.rgb)(t)||(0,ad.rgb)(0,0,0);return t=>`rgba(${r},${i},${n},${t})`}(a)},{legend:n,...o})}]]);function dP({className:t,...r},{label:i,ticks:n,tickFormat:a}={},o){return function(t={},...r){let i=t;for(let n of r)for(let r in n)if(void 0===i[r]){let a=n[r];i===t?i={...i,[r]:a}:i[r]=a}return i}(o,{className:t,...r},{label:i,ticks:n,tickFormat:a})}function dI(t,{legend:r=!0,...i}){if(!0===r&&(r="ordinal"===t.type?"swatches":"ramp"),void 0!==t.domain)switch(`${r}`.toLowerCase()){case"swatches":return function(t,{opacity:r,...i}={}){if(!lP(t)&&!lI(t))throw Error(`swatches legend requires ordinal or threshold color scale (not ${t.type})`);return dM(t,i,(t,i,n,a)=>t.append("svg").attr("width",n).attr("height",a).attr("fill",i.scale).attr("fill-opacity",im(r)[1]).append("rect").attr("width","100%").attr("height","100%"))}(t,i);case"ramp":return function(t,r){let i,{label:n=t.label,tickSize:a=6,width:o=240,height:s=44+a,marginTop:l=18,marginRight:u=0,marginBottom:c=16+a,marginLeft:h=0,style:f,ticks:d=(o-h-u)/64,tickFormat:p,fontVariant:m=fn(t),round:g=!0,opacity:y,className:v}=r,_=hb(r);v=hV(v),y=im(y)[1],null===p&&(p=()=>null);let b=hx("svg",_).attr("class",`${v}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",o).attr("height",s).attr("viewBox",`0 0 ${o} ${s}`).call(t=>t.append("style").text(`:where(.${v}-ramp) { 38 display: block; 39 height: auto; 40 height: intrinsic; 41 max-width: 100%; 42 overflow: visible; 43} 44:where(.${v}-ramp text) { 45 white-space: pre; 46}`)).call(h$,f),x=t=>t.selectAll(".tick line").attr("y1",l+c-s),w=g?(t,r)=>t.rangeRound(r):(t,r)=>t.range(r),{type:E,domain:T,range:A,interpolate:S,scale:C,pivot:M}=t;if(S){let t=void 0===A?S:ax(1===S.length?sD(S):S,A);i=w(C.copy(),aw((0,ay.interpolateNumber)(h,o-u),Math.min(T.length+(void 0!==M),void 0===A?1/0:A.length)));let r=_.document.createElement("canvas");r.width=256,r.height=1;let n=r.getContext("2d");for(let r=0;r<256;++r)n.fillStyle=t(r/255),n.fillRect(r,0,1,1);b.append("image").attr("opacity",y).attr("x",h).attr("y",l).attr("width",o-h-u).attr("height",s-l-c).attr("preserveAspectRatio","none").attr("xlink:href",r.toDataURL())}else if("threshold"===E){let t=void 0===p?t=>t:"string"==typeof p?(0,aD.format)(p):p;i=w((0,aC.scaleLinear)().domain([-1,A.length-1]),[h,o-u]),b.append("g").attr("fill-opacity",y).selectAll().data(A).enter().append("rect").attr("x",(t,r)=>i(r-1)).attr("y",l).attr("width",(t,r)=>i(r)-i(r-1)).attr("height",s-l-c).attr("fill",t=>t),d=ix(T,(t,r)=>r),p=r=>t(T[r],r)}else i=w(lh().domain(T),[h,o-u]),b.append("g").attr("fill-opacity",y).selectAll().data(T).enter().append("rect").attr("x",i).attr("y",l).attr("width",Math.max(0,i.bandwidth()-1)).attr("height",s-l-c).attr("fill",C),x=()=>{};return b.append("g").attr("transform",`translate(0,${s-c})`).call((function(t){var r=[],i=null,n=null,a=6,o=6,s=3,l="u">typeof window&&window.devicePixelRatio>1?0:.5;function u(u){var c=null==i?t.ticks?t.ticks.apply(t,r):t.domain():i,h=null==n?t.tickFormat?t.tickFormat.apply(t,r):ft:n,f=Math.max(a,0)+s,d=t.range(),p=+d[0]+l,m=+d[d.length-1]+l,g=(t.bandwidth?function(t,r){return r=Math.max(0,t.bandwidth()-2*r)/2,t.round()&&(r=Math.round(r)),i=>+t(i)+r}:function(t){return r=>+t(r)})(t.copy(),l),y=u.selection?u.selection():u,v=y.selectAll(".domain").data([null]),_=y.selectAll(".tick").data(c,t).order(),b=_.exit(),x=_.enter().append("g").attr("class","tick"),w=_.select("line"),E=_.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),_=_.merge(x),w=w.merge
46(x.append("line").attr("stroke","currentColor").attr("y2",+a)),E=E.merge(x.append("text").attr("fill","currentColor").attr("y",+f).attr("dy","0.71em")),u!==y&&(v=v.transition(u),_=_.transition(u),w=w.transition(u),E=E.transition(u),b=b.transition(u).attr("opacity",1e-6).attr("transform",function(t){return isFinite(t=g(t))?fr(t+l):this.getAttribute("transform")}),x.attr("opacity",1e-6).attr("transform",function(t){var r=this.parentNode.__axis;return fr((r&&isFinite(r=r(t))?r:g(t))+l)})),b.remove(),v.attr("d",o?"M"+p+","+ +o+"V"+l+"H"+m+"V"+ +o:"M"+p+","+l+"H"+m),_.attr("opacity",1).attr("transform",function(t){return fr(g(t)+l)}),w.attr("y2",+a),E.attr("y",+f).text(h),y.filter(fi).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","middle"),y.each(function(){this.__axis=g})}return u.scale=function(r){return arguments.length?(t=r,u):t},u.ticks=function(){return r=Array.from(arguments),u},u.tickArguments=function(t){return arguments.length?(r=null==t?[]:Array.from(t),u):r.slice()},u.tickValues=function(t){return arguments.length?(i=null==t?null:Array.from(t),u):i&&i.slice()},u.tickFormat=function(t){return arguments.length?(n=t,u):n},u.tickSize=function(t){return arguments.length?(a=o=+t,u):a},u.tickSizeInner=function(t){return arguments.length?(a=+t,u):a},u.tickSizeOuter=function(t){return arguments.length?(o=+t,u):o},u.tickPadding=function(t){return arguments.length?(s=+t,u):s},u.offset=function(t){return arguments.length?(l=+t,u):l},u})(i).ticks(Array.isArray(d)?null:d,"string"==typeof p?p:void 0).tickFormat("function"==typeof p?p:void 0).tickSize(a).tickValues(Array.isArray(d)?d:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",hz(m,"normal")).call(x).call(t=>t.select(".domain").remove()),void 0!==n&&b.append("text").attr("x",h).attr("y",l-6).attr("fill","currentColor").attr("font-weight","bold").text(n),b.node()}(t,i);default:throw Error(`unknown legend type: ${r}`)}}var dk=eO;function dO(t,r=dk.default){let i,n=!1;if(1===r.length){let a;for(let o of t){let t=r(o);(n?(0,dk.default)(t,a)>0:0===(0,dk.default)(t,t))&&(i=o,a=t,n=!0)}}else for(let a of t)(n?r(a,i)>0:0===r(a,a))&&(i=a,n=!0);return i}var dN=eO;function dL(t,r,i){return(2!==r.length?eq(eI(t,r,i),([t,r],[i,n])=>(0,dN.default)(r,n)||(0,dN.default)(t,i)):eq(eP(t,i),([t,i],[n,a])=>r(i,a)||(0,dN.default)(t,n))).map(([t])=>t)}function dR(t){let{offset:r,order:i,reverse:n,...a}=t;return[{offset:r,order:i,reverse:n},a]}let dF={length:!0};function dB(t,r=ie,i,n,{offset:a,order:o,reverse:s},l){if(null===r)throw Error(`stack requires ${n}`);let u=function({z:t,fill:r,stroke:i}={}){return void 0===t&&([t]=ip(r)),void 0===t&&([t]=ip(i)),t}(l),[c,h]=null==t?[t]:iR(t),[f,d]=iR(r),[p,m]=iR(r);return f.hint=p.hint=dF,a=function(t){if(null!=t){if("function"==typeof t)return t;switch(`${t}`.toLowerCase()){case"expand":case"normalize":return dj;case"center":case"silhouette":return dU;case"wiggle":return dV}throw Error(`unknown offset: ${t}`)}}(a),o=function(t,r,i){if(void 0===t&&r===dV)return dq(eR);if(null!=t){var n,a,o;if("string"==typeof t){let r=t.startsWith("-"),o=r?eF:eR;switch((r?t.slice(1):t).toLowerCase()){case"value":case i:return n=o,(t,r,i)=>(t,r)=>n(i[t],i[r]);case"z":return a=o,(t,r,i,n)=>(t,r)=>a(n[t],n[r]);case"sum":return dW(o,(t,r,i,n)=>dL(iO(t),t=>nQ(t,t=>i[t]),t=>n[t]));case"appearance":return dW(o,(t,r,i,n)=>dL(iO(t),t=>r[dO(t,t=>i[t])],t=>n[t]));case"inside-out":return dq(o)}
46return dH(r8(t))}if("function"==typeof t)return(1===t.length?dH:function(t){return r=>rK(r)?(i,n)=>t(r[i],r[n]):(i,n)=>t(r.get(i),r.get(n))})(t);if(rK(t)){return o=t,dW(eR,()=>o)}throw Error(`invalid order: ${t}`)}}(o,a,n),[hq(l,(n,l,c)=>{var f,p;let g;({data:n,facets:l}=function(t,r){if(1===r.length)return{data:t,facets:r};let i=ik(t),n=new Uint8Array(i),a=0;for(let t of r)for(let r of t)n[r]&&++a,n[r]=1;if(0===a)return{data:t,facets:r};let o=(t=iw(t))[r0]=new Uint32Array(i+a);r=r.map(t=>iw(t,Uint32Array));let s=i;for(let i of(n.fill(0),r))for(let r=0,a=i.length;r<a;++r){let a=i[r];n[a]?(i[r]=s,t[s]=t[a],o[s]=a,++s):o[a]=a,n[a]=1}return{data:t,facets:r}}(n,l));let y=null==t?void 0:h((f=r1(n,t),p=c?.[i],(g=iz(p?.interval,p?.type))?ix(f,g):f)),v=r1(n,r,Float64Array),_=r1(n,u),b=o&&o(n,y,v,_),x=ik(n),w=d(new Float64Array(x)),E=m(new Float64Array(x)),T=[];for(let t of l){let r=y?Array.from(eP(t,t=>y[t]).values()):[t];if(b)for(let t of r)t.sort(b);for(let t of r){let r=0,i=0;for(let n of(s&&t.reverse(),t)){let t=v[n];t<0?r=E[n]=(w[n]=r)+t:t>0?i=E[n]=(w[n]=i)+t:E[n]=w[n]=i}}T.push(r)}return a&&a(T,w,E,_),{data:n,facets:l}}),c,f,p]}function dz(t,r){let i=0,n=0;for(let a of t){let t=r[a];t<i&&(i=t),t>n&&(n=t)}return[i,n]}function dj(t,r,i){for(let n of t)for(let t of n){let[n,a]=dz(t,i);for(let o of t){let t=1/(a-n||1);r[o]=t*(r[o]-n),i[o]=t*(i[o]-n)}}}function dU(t,r,i){for(let n of t){for(let t of n){let[n,a]=dz(t,i);for(let o of t){let t=(a+n)/2;r[o]-=t,i[o]-=t}}d$(n,r,i)}dG(t,r,i)}function dV(t,r,i,n){for(let a of t){let t=new eE,o=0;for(let s of a){let a=-1,l=s.map(t=>Math.abs(i[t]-r[t])),u=s.map(o=>{a=n?n[o]:++a;let s=i[o]-r[o],l=t.has(a)?s-t.get(a):0;return t.set(a,s),l}),c=[0,...function(t){var r=0;return Float64Array.from(t,t=>r+=+t||0)}(u)];for(let t of s)r[t]+=o,i[t]+=o;let h=nQ(l);h&&(o-=nQ(l,(t,r)=>(u[r]/2+c[r])*t)/h)}d$(a,r,i)}dG(t,r,i)}function d$(t,r,i){let n=e$(t,t=>e$(t,t=>r[t]));for(let a of t)for(let t of a)r[t]-=n,i[t]-=n}function dG(t,r,i){let n=t.length;if(1===n)return;let a=t.map(t=>t.flat()),o=a.map(t=>(e$(t,t=>r[t])+eV(t,t=>i[t]))/2),s=e$(o);for(let t=0;t<n;t++){let n=s-o[t];for(let o of a[t])r[o]+=n,i[o]+=n}}function dq(t){return dW(t,(t,r,i,n)=>{let a=iO(t),o=dL(a,t=>r[dO(t,t=>i[t])],t=>n[t]),s=eI(a,t=>nQ(t,t=>i[t]),t=>n[t]),l=[],u=[],c=0;for(let t of o)c<0?(c+=s.get(t),l.push(t)):(c-=s.get(t),u.push(t));return u.reverse().concat(l)})}function dH(t){return r=>{let i=r1(r,t);return(t,r)=>eR(i[t],i[r])}}function dW(t,r){return(i,n,a,o)=>{if(!o)throw Error("missing channel: z");let s=new eE(r(i,n,a,o).map((t,r)=>[t,r]));return(r,i)=>t(s.get(o[r]),s.get(o[i]))}}let dZ={ariaLabel:"rect"};class dY extends hQ{constructor(t,r={}){const{x1:i,y1:n,x2:a,y2:o}=r;super(t,{x1:{value:i,scale:"x",type:null!=i&&null==a?"band":void 0,optional:!0},y1:{value:n,scale:"y",type:null!=n&&null==o?"band":void 0,optional:!0},x2:{value:a,scale:"x",optional:!0},y2:{value:o,scale:"y",optional:!0}},r,dZ),dX(this,r),dK(this,r)}render(t,r,i,n,a){let{x:o,y:s}=r,{x1:l,y1:u,x2:c,y2:h}=i,{marginTop:f,marginRight:d,marginBottom:p,marginLeft:m,width:g,height:y}=n,{projection:v}=a,{insetTop:_,insetRight:b,insetBottom:x,insetLeft:w}=this,{rx:E,ry:T,rx1y1:A,rx1y2:S,rx2y1:C,rx2y2:M}=this;(l||c)&&!v&&lk(o)&&(l=c=null),(u||h)&&!v&&lk(s)&&(u=h=null);let D=o?.bandwidth?o.bandwidth():0,P=s?.bandwidth?s.bandwidth():0;return hx("svg:g",a).call(hL,this,n,a).call(hB,this,{},0,0).call(r=>r.selectAll().data(t).enter().call(A||S||C||M?t=>t.append("path").call(hR,this).call(dQ,l&&c?t=>l[t]+(c[t]<l[t]?-b:w):l?t=>l[t]+w:m+w,u&&h?t=>u[t]+(h[t]<u[t]?-x:_):u?t=>u[t]+_:f+_,l&&c?t=>c[t]-(c[t]<l[t]?-w:b):l?t=>l[t]+D-b:g-d-b,u&&h?t=>h[t]-(h[t]<u[t]?-_:x):u?t=>u[t]+P-x:y-p-x,this).call(hI,this,i):t=>t.append("rect").call(hR,this).attr("x",l?c?t=>Math.min(l[t],c[t])+w:t=>l[t]+w:m+w).attr("y",u?h?t=>Math.min(u[t],h[t])+_:t=>u[t]+_:f+_).attr("width",l?c?t=>Math.max(0,Math.abs(c[t]-l[t])+D-w-b):D-w-b:g-d-m-b-w).attr("height",u?h?t=>Math.max(0,Math.abs(u[t]-h[t])+P-_-x):P-_-x:y-f-p-_-x).call(hF,"rx",E).call(hF,"ry",T).call(hI,this,i))).node()}}
46function dX(t,{inset:r=0,insetTop:i=r,insetRight:n=r,insetBottom:a=r,insetLeft:o=r}={}){t.insetTop=ia(i),t.insetRight=ia(n),t.insetBottom=ia(a),t.insetLeft=ia(o)}function dK(t,{r,rx:i,ry:n,rx1:a=r,ry1:o=r,rx2:s=r,ry2:l=r,rx1y1:u=void 0!==a?+a:void 0!==o?+o:0,rx1y2:c=void 0!==a?+a:void 0!==l?+l:0,rx2y1:h=void 0!==s?+s:void 0!==o?+o:0,rx2y2:f=void 0!==s?+s:void 0!==l?+l:0}={}){u||c||h||f?(t.rx1y1=u,t.rx1y2=c,t.rx2y1=h,t.rx2y2=f):(t.rx=hz(i,"auto"),t.ry=hz(n,"auto"))}function dQ(t,r,i,n,a,o){let{rx1y1:s,rx1y2:l,rx2y1:u,rx2y2:c}=o;"function"!=typeof r&&(r=il(r)),"function"!=typeof i&&(i=il(i)),"function"!=typeof n&&(n=il(n)),"function"!=typeof a&&(a=il(a));let h=Math.max(Math.abs(s+u),Math.abs(l+c)),f=Math.max(Math.abs(s+l),Math.abs(u+c));t.attr("d",t=>{let o=r(t),d=i(t),p=n(t),m=a(t),g=o>p,y=d>m,v=g?p:o,_=g?o:p,b=y?m:d,x=y?d:m,w=Math.min(1,(_-v)/h,(x-b)/f),E=w*(g?y?c:u:y?l:s),T=w*(g?y?l:s:y?c:u),A=w*(g?y?s:l:y?u:c),S=w*(g?y?u:c:y?s:l);return`M${v},${b+d0(E,S)}A${E},${E} 0 0 ${E<0?0:1} ${v+dJ(E,S)},${b}H${_-dJ(T,A)}A${T},${T} 0 0 ${T<0?0:1} ${_},${b+d0(T,A)}V${x-d0(A,T)}A${A},${A} 0 0 ${A<0?0:1} ${_-dJ(A,T)},${x}H${v+dJ(S,E)}A${S},${S} 0 0 ${S<0?0:1} ${v},${x-d0(S,E)}Z`})}function dJ(t,r){return r<0?t:Math.abs(t)}function d0(t,r){return r<0?Math.abs(t):t}let d1={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},d2={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1};class d3 extends hQ{constructor(t={}){const{anchor:r=null}=t;super(r5,void 0,t,null==r?d1:d2),this.anchor=ig(r,"anchor",["top","right","bottom","left"]),dX(this,t),r||dK(this,t)}render(t,r,i,n,a){let{marginTop:o,marginRight:s,marginBottom:l,marginLeft:u,width:c,height:h}=n,{anchor:f,insetTop:d,insetRight:p,insetBottom:m,insetLeft:g}=this,{rx:y,ry:v,rx1y1:_,rx1y2:b,rx2y1:x,rx2y2:w}=this,E=u+g,T=c-s-p,A=o+d,S=h-l-m;return hx(f?"svg:line":_||b||x||w?"svg:path":"svg:rect",a).datum(0).call(hL,this,n,a).call(hR,this).call(hI,this,i).call(hB,this,{}).call("left"===f?t=>t.attr("x1",E).attr("x2",E).attr("y1",A).attr("y2",S):"right"===f?t=>t.attr("x1",T).attr("x2",T).attr("y1",A).attr("y2",S):"top"===f?t=>t.attr("x1",E).attr("x2",T).attr("y1",A).attr("y2",A):"bottom"===f?t=>t.attr("x1",E).attr("x2",T).attr("y1",S).attr("y2",S):_||b||x||w?t=>t.call(dQ,E,A,T,S,this):t=>t.attr("x",E).attr("y",A).attr("width",T-E).attr("height",S-A).attr("rx",y).attr("ry",v)).node()}}let d4={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},d6=new Set(["geometry","href","src","ariaLabel","scales"]);class d5 extends hQ{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),void 0===r.title&&i$(t)&&iG(t)&&(r={...r,title:r9});const{x:i,y:n,x1:a,x2:o,y1:s,y2:l,anchor:u,preferredAnchor:c="bottom",monospace:h,fontFamily:f=h?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:p,fontVariant:m,fontWeight:g,lineHeight:y=1,lineWidth:v
46=20,frameAnchor:_,format:b,textAnchor:x="start",textOverflow:w,textPadding:E=8,title:T,pointerSize:A=12,pathFilter:S="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;for(const b in super(t,{x:{value:null!=a&&null!=o?null:i,scale:"x",optional:!0},y:{value:null!=s&&null!=l?null:n,scale:"y",optional:!0},x1:{value:a,scale:"x",optional:null==o},y1:{value:s,scale:"y",optional:null==l},x2:{value:o,scale:"x",optional:null==a},y2:{value:l,scale:"y",optional:null==s},title:{value:T,optional:!0}},r,d4),this.anchor=i1(u,"anchor"),this.preferredAnchor=i1(c,"preferredAnchor"),this.frameAnchor=i2(_),this.textAnchor=hz(x,"middle"),this.textPadding=+E,this.pointerSize=+A,this.pathFilter=ii(S),this.lineHeight=+y,this.lineWidth=+v,this.textOverflow=fI(w),this.monospace=!!h,this.fontFamily=ii(f),this.fontSize=ia(d),this.fontStyle=ii(p),this.fontVariant=ii(m),this.fontWeight=ii(g),d4)b in this.channels&&(this[b]=d4[b]);this.splitLines=fU(this),this.clipLine=fV(this),this.format="string"==typeof b||"function"==typeof b?{title:b}:{...b}}render(t,r,i,n,a){let o,s,l=this,{x:u,y:c,fx:h,fy:f}=r,{ownerSVGElement:d,document:p}=a,{anchor:m,monospace:g,lineHeight:y,lineWidth:v}=this,{textPadding:_,pointerSize:b,pathFilter:x}=this,{marginTop:w,marginLeft:E}=n,{x1:T,y1:A,x2:S,y2:C,x:M=T??S,y:D=A??C}=i,P=h?h(t.fx)-E:0,I=f?f(t.fy)-w:0,[k,O]=hG(this,n),N=h9(i,k),L=fe(i,O),R=g?fj:fz,F=R(f$);"title"in i?(o=d8.call(this,{title:i.channels.title},r),s=d9):(o=d8.call(this,i.channels,r),s=pe);let B=hx("svg:g",a).call(hL,this,n,a).call(fR,this).call(hB,this,{x:M&&u,y:D&&c}).call(n=>n.selectAll().data(t).enter().append("g").attr("transform",t=>`translate(${Math.round(N(t))},${Math.round(L(t))})`).call(hR,this).call(t=>t.append("path").attr("filter",x)).call(n=>n.append("text").each(function(n){let a=(0,hv.select)(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let u=s.call(l,n,t,o,r,i);if("string"==typeof u)for(let t of l.splitLines(u))z(a,{value:l.clipLine(t)});else{let t=new Set;for(let r of u){let{label:i=""}=r;i&&t.has(i)||(t.add(i),z(a,r))}}})));function z(t,{label:r,value:i,color:n,opacity:a}){let o;r??="",i??="";let s=null!=n||null!=a,l=100*v,[u]=fG(r,l,R,F);if(u>=0)r=r.slice(0,u).trimEnd()+f$,o=i.trim(),i="";else{!r&&(i||s)||(i=" "+i);let[t]=fG(i,l-R(r),R,F);t>=0&&(o=i.trim(),i=i.slice(0,t).trimEnd()+f$)}let c=t.append("tspan").attr("x",0).attr("dy",`${y}em`).text("â");r&&c.append("tspan").attr("font-weight","bold").text(r),i&&c.append(()=>p.createTextNode(i)),s&&c.append("tspan").text(" â ").attr("fill",n).attr("fill-opacity",a).style("user-select","none"),o&&c.append("title").text(o)}function j(){let{width:t,height:r}=n.facet??n;B.selectChildren().each(function(i){var n,a,o;let{x:s,width:u,height:c}=this.getBBox();u=Math.round(u),c=Math.round(c);let h=m;if(void 0===h){let n=N(i)+P,a=L(i)+I,o=n+u+b+2*_<t,s=n-u-b-2*_>0,f=a+c+b+2*_<r,d=a-c-b-2*_>0;h=o&&s?f&&d?l.preferredAnchor:d?"bottom":"top":f&&d?o?"left":"right":(o||s)&&(f||d)?`${d?"bottom":"top"}-${o?"left":"right"}`:l.preferredAnchor}let f=this.firstChild,d=this.lastChild;if(f.setAttribute("d",function(t,r,i,n,a){let o=n+2*i,s=a+2*i;switch(t){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${r},${r}h${o-r}v${s}h${-o}z`;case"top":return`M0,0l${r/2},${r/2}h${(o-r)/2}v${s}h${-o}v${-s}h${(o-r)/2}z`;case"top-right":return`M0,0l${-r},${r}h${r-o}v${s}h${o}z`;case"right":return`M0,0l${-r/2},${-r/2}v${r/2-s/2}h${-o}v${s}h${o}v${r/2-s/2}z`;case"bottom-left":return`M0,0l${r},${-r}h${o-r}v${-s}h${-o}z`;case"bottom":return`M0,0l${r/2},${-r/2}h${(o-r)/2}v${-s}h${-o}v${s}h${(o-r)/2}z`;case"bottom-right":return`M0,0l${-r},${-r}h${r-o}v${-s}h${o}z`;case"left":return`M0,0l${r/2},${-r/2}v${r/2-s/2}h${o}v${s}h${-o}v${r/2-s/2}z`}}(h,b,_,u,c)),s)for(let t of d.childNodes)t.setAttribute("x",-s);d.setAttribute("y",`${+(n=h,a=d.childNodes.length,o=y,/^top(?:-|$)/.test(n)?.94-o:-.29-a*o).toFixed(6)}em`),d.setAttribute("transform",`translate(${function(t,r,i,n,a){switch(t){case"middle":return[-n/2,a/2];case"top-left":return[i,r+i];case"top":return[-n/2,r/2+i];case"top-right":return[-n-i,r+i];case"right":return[-r/2-n-i,a/2];case"bottom-left":return[i,-r-i];case"bottom":return[-n/2,-r/2-i];case"bottom-right":return[-n-i,-r-i];case"left":return[i+r/2,a/2]}}(h,b,_,u,c)})`)}),B.attr("visibility",null)}return t.length&&(B.attr("visibility","hidden"),d.isConnected?Promise.resolve().then(j):"u">typeof requestAnimationFrame&&requestAnimationFrame(j)),B.node()}}function d8(t,r){let i={},n=this.format;for(let r in n=d7(n,t,"x"),n=d7(n,t,"y"),this.format=n,n){let a=n[r];if(null!==a&&!1!==a)if("fx"===r||"fy"===r)i[r]=!0;else{let n=an(t,r);n&&(i[r]=n)}}for(let r in t){if(r in i||r in n||d6.has(r)||("x"===r||"y"===r)&&t.geometry)continue;let a=an(t,r);if(a){if(null==a.scale&&"color"===a.defaultScale)continue;i[r]=a}}for(let t in this.facet&&(!r.fx||"fx"in n||(i.fx=!0),!r.fy||"fy"in n||(i.fy=!0)),i){let n=this.format[t];if("string"==typeof n){let a=i[t]?.value??r[t]?.domain()??[];this.format[t]=(iH(a)?cw:aD.format)(n)}else if(void 0===n||!0===n){let i=r[t];this.format[t]=i?.bandwidth?dy(i,i.domain()):hS}}return i}function d7(t,r,i){if(!(i in t))return t;let n=`${i}1`,a=`${i}2`;if((n in t||!(n in r))&&(a in t||!(a in r)))return t;let o=Object.entries(t),s=t[i];return o.splice(o.findIndex(([t])=>t===i)+1,0,[n,s],[a,s]),Object.fromEntries(o)}function d9(t,r,{title:i}){return this.format.title(i.value[t],t)}function*pe(t,r,i,n,a){for(let o in i){if("fx"===o||"fy"===o){yield{label:pi(n,i,o),value:this.format[o](r[o],t)};continue}if("x1"===o&&"x2"in i||"y1"===o&&"y2"in i)continue;let s=i[o];if("x2"===o&&"x1"in i)yield{label:pr(n,i,"x"),value:pt(this.format.x2,i.x1,s,t)};else if("y2"===o&&"y1"in i)yield{label:pr(n,i,"y"),value:pt(this.format.y2,i.y1,s,t)};else{let r=s.value[t],l=s.scale;if(!eL(r)&&null==l)continue;yield{label:pi(n,i,o),value:this.format[o](r,t),color:"color"===l?a[o][t]:null,opacity:"opacity"===l?a[o][t]:null}}}}function pt(t,r,i,n){return i.hint?.length?`${t(i.value[n]-r.value[n],n)}`:`${t(r.value[n],n)}â${t(i.value[n],n)}`}function pr(t,r,i){let n=pi(t,r,`${i}1`,i),a=pi(t,r,`${i}2`,i);return n===a?n:`${n}â${a}`}function pi(t,r,i,n=i){let a=r[i],o=t[a?.scale??i];return String(o?.label??a?.label??n)}function pn(t={}){var i,n,a,o,s;let l,u,c,h,{facet:f,style:d,title:p,subtitle:m,caption:g,ariaLabel:y,ariaDescription:v}=t,_=hV(t.className),b=void 0===t.marks?[]:po(t.marks);b.push(...function(t){let r=[];for(let i of t){let t=i.tip;if(t){!0===t?t={}:"string"==typeof t&&(t={pointer:t});let{pointer:n,preferredAnchor:a}=t;(t=(n=/^x$/i.test(n)?h8:/^y$/i.test(n)?h7:h5)(function(t,r={}){return hH({...r,x:null,y:null},(r,i,n,a,o,s)=>s.getMarkState(t))}(i,t))).title=null,void 0===a&&(t.preferredAnchor=n===h7?"left":"bottom");let o=function(t,{x:r,y:i,...n}={}){return void 0===n.frameAnchor&&([r,i]=iI(r,i)),new d5(t,{...n,x:r,y:i})}(i.data,t);o.facet=i.facet,o.facetAnchor=i.facetAnchor,r.push(o)}}return r}(b));let x=function(t,r){if(null==t)return;let{x:i,y:n}=t;if(null==i&&null==n)return;let a=iv(t.data);if(null==a)throw Error("missing facet data");let o={};null!=i&&(o.fx=n7(a,{value:i,scale:"fx"})),null!=n&&(o.fy=n7(a,{value:n,scale:"fy"})),pu(o,r);let s=lL(a,o);return{channels:o,groups:s,data:t.data}}(f,t),w=new Map;for(let r of b){let i=pd(r,x,t);i&&w.set(r,i)}let E=new Map;x&&ph(E,[x],t),ph(E,w,t);let T=po(function(t,r,i){let{projection:n,x:a={},y:o={},fx:s={},fy:l={},axis:u,grid:c,facet:h={},facet:{axis:f=u,grid:d}=h,x:{axis:p=u,grid:m=null===p?null:c}=a,y:{axis:g=u,grid:y=null===g?null:c}=o,fx:{axis:v=f,grid:_=null===v?null:d}=s,fy:{axis:b=f,grid:x=null===b?null:d}=l}=i;!n&&(iC(a)||py("x",t))||(p=m=null),!n&&(iC(o)||py("y",t))||(g=y=null),r.has("fx")||(v=_=null),r.has("fy")||(b=x=null),void 0===p&&(p=!pg(t,"x")),void 0===g&&(g=!pg(t,"y")),void 0===v&&(v=!pg(t,"fx")),void 0===b&&(b=!pg(t,"fy")),!0===p&&(p="bottom"),!0===g&&(g="left"),!0===v&&(v="top"===p||null===p?"bottom":"top"),!0===b&&(b="right"===g||null===g?"left":"right");let w=[];return pm(w,x,dl,l),pp(w,b,dt,"right","left",h,l),pm(w,_,dc,s),pp(w,v,di,"top","bottom",h,s),pm(w,y,ds,o),p
46p(w,g,de,"left","right",i,o),pm(w,m,du,a),pp(w,p,dr,"bottom","top",i,a),w}(b,E,t));for(let r of T){let i=pd(r,x,t);i&&w.set(r,i)}b.unshift(...T);let A=function(t,r){let{fx:i,fy:n}=lv(t,r),a=i?.scale.domain(),o=n?.scale.domain();return a&&o?(function(...t){var r;let i="function"==typeof t[t.length-1]&&(r=t.pop(),t=>r(...t)),n=(t=t.map(as)).map(aa),a=t.length-1,o=Array(a+1).fill(0),s=[];if(a<0||n.some(ao))return s;for(;;){s.push(o.map((r,i)=>t[i][r]));let r=a;for(;++o[r]===n[r];){if(0===r)return i?s.map(i):s;o[r--]=0}}})(a,o).map(([t,r],i)=>({x:t,y:r,i})):a?a.map((t,r)=>({x:t,i:r})):o?o.map((t,r)=>({y:t,i:r})):void 0}(E,t);if(void 0!==A){let t=x?lH(A,x):void 0;for(let r of b){if(null===r.facet||"super"===r.facet)continue;let i=w.get(r);void 0!==i&&(i.facetsIndex=null!=r.fx||null!=r.fy?lH(A,i):t)}let r=new Set;for(let{facetsIndex:t}of w.values())t?.forEach((t,i)=>{t?.length>0&&r.add(i)});for(let t of(A.forEach(0<r.size&&r.size<A.length?(t,i)=>t.empty=!r.has(i):t=>t.empty=!1),b))if("exclude"===t.facet){let r=w.get(t);void 0!==r&&(r.facetsIndex=function(t){let r=[],i=new Uint32Array(nQ(t,t=>t.length));for(let n of t){let a=0;for(let r of t)n!==r&&(i.set(r,a),a+=r.length);r.push(i.slice(0,a))}return r}(r.facetsIndex))}}for(let r of nn.keys())iC(t[r])&&"fx"!==r&&"fy"!==r&&E.set(r,[]);let S=new Map;for(let r of b){if(S.has(r))throw Error("duplicate mark; each mark must be unique");let{facetsIndex:i,channels:n}=w.get(r)??{},{data:a,facets:o,channels:s}=r.initialize(i,n,t);pu(s,t),S.set(r,{data:a,facets:o,channels:s})}let C=lv(ph(E,S,t),t),M=function(t,r,i={}){let n=.5-hC,a=.5+hC,o=.5+hC,s=.5-hC;for(let{marginTop:t,marginRight:i,marginBottom:l,marginLeft:u}of r)t>n&&(n=t),i>a&&(a=i),l>o&&(o=l),u>s&&(s=u);let{margin:l,marginTop:u=void 0!==l?l:n,marginRight:c=void 0!==l?l:a,marginBottom:h=void 0!==l?l:o,marginLeft:f=void 0!==l?l:s}=i;u*=1;let{width:d=640,height:p=function({x:t,y:r,fy:i,fx:n},{projection:a,aspectRatio:o},{width:s,marginTopDefault:l,marginRightDefault:u,marginBottomDefault:c,marginLeftDefault:h}){let f=i&&i.scale.domain().length||1,d=function(t){if("function"==typeof t?.stream)return .618;if(iS(t)){let r,i;if({domain:r,type:t,...i}=t,null!=r&&null!=t){let[[n,a],[o,s]]=ha(("string"==typeof t?hf(t).type:t)({...i,width:100,height:100})).bounds(r),l=(s-a)/(o-n);return l&&isFinite(l)?l<.2?.2:l>5?5:l:.618}}if(null!=t){if("function"!=typeof t){let{aspectRatio:r}=hf(t);if(r)return r}return .618}}(a);if(d)return Math.round((s-h-u)*Math.max(.1,Math.min(10,(1.1*f-.1)/(1.1*(n?n.scale.domain().length:1)-.1)*d))+l+c);let p=r?lP(r)?r.scale.domain().length||1:Math.max(7,17/f):1;if(null!=o){if(!(isFinite(o*=1)&&o>0))throw Error(`invalid aspectRatio: ${o}`);let a=h2("y",r)/(h2("x",t)*o),f=n?n.scale.bandwidth():1,d=i?i.scale.bandwidth():1;return(a*(f*(s-h-u)-t.insetLeft-t.insetRight)+r.insetTop+r.insetBottom)/d+l+c}return!!(r||i)*Math.max(1,Math.min(60,p*f))*20+30*!!n+60}(t,i,{width:d,marginTopDefault:n,marginRightDefault:a,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,u-n+h-o)}=i,m={width:d*=1,height:p*=1,marginTop:u,marginRight:c*=1,marginBottom:h*=1,marginLeft:f*=1};if(t.fx||t.fy){let{margin:t,marginTop:r=void 0!==t?t:u,marginRight:n=void 0!==t?t:c,marginBottom:a=void 0!==t?t:h,marginLeft:o=void 0!==t?t:f}=i.facet??{};m.facet={marginTop:r*=1,marginRight:n*=1,marginBottom:a*=1,marginLeft:o*=1}}return m}(C,b,t);!function(t,r){let{x:i,y:n,fx:a,fy:o}=t,s=a||o?lb(r):r;a&&lw(a,s),o&&lE(o,s);let l=a||o?lx(t,r):r;i&&lw(i,l),n&&lE(n,l)}(C,M);let D=l_(C),{fx:P,fy:I}=D,k=P||I?lx(C,M):M,O=P||I?function({fx:t,fy:r},i){let{marginTop:n,marginRight:a,marginBottom:o,marginLeft:s,width:l,height:u}=lb(i),c=t&&pv(t),h=r&&pv(r);return{marginTop:r?h[0]:n,marginRight:t?l-c[1]:a,marginBottom:r?u-h[1]:o,marginLeft:t?c[0]:s,inset:{marginTop:i.marginTop,marginRight:i.marginRight,marginBottom:i.marginBottom,marginLeft:i.marginLeft},width:l,height:u}}(D,M):M,N=hb(t),L=N.document,R=(0,h_.default)("svg").call(L.documentElement),F=R;N.ownerSVGElement=R,N.className=_,N.projection=function({projection:t,inset:r=0,insetTop:i=r,insetRight:n=r,insetBottom:a=r,insetLeft:o=r}={},s){let l,u,c;if(null==t)return;if("function"==typeof t.stream)return t;let h="frame";if(iS(t)){let r;if({type:t,domain:u,inset:r,insetTop:i=undefined!==r?r:i,insetRight:n=undefined!==r?r:n,insetBottom:a=undefined!==r?r:a,insetLeft:o=undefined!==r?r:o,clip:h=h,...l}=t,null==t)return}"function"!=typeof t&&({type:t}=hf(t));let{width:f,height:d,marginLeft:p,marginRight:m,marginTop:g,marginBottom:y}=s,v=f-p-m-o-n,_=d-g-y-i-a;if(null==(t=t?.({width:v,height:_,clip:h,...l})))return;h=function(t,r,i,n,a){if(!1===t||null==t||"number"==typeof t)return t=>t;if(!0===t&&(t="frame"),"frame"===`${t}`.toLowerCase())return uD(r,i,n,a);throw Error(`unknown projection clip type: ${t}`)}(h,p,g,f-m,d-y);let b=p+o,x=g+i;if(null!=u){let[[r,i],[n,a]]=ha(t).bounds(u),o=Math.min(v/(n-r),_/(a-i));o>0?(b-=(o*(r+n)-v)/2,x-=(o*(i+a)-_)/2,c=uI({point(t,r){this.stream.point(t*o+b,r*o+x)}})):sq("Warning: the projection could not be fit to the specified domain; using the default scale.")}return c??=0===b&&0===x?hm():uI({point(t,r){this.stream.point(t+b,r+x)}}),{stream:r=>t.stream(c.stream(h(r)))}}(t,k),N.path=function(){return ha(this.projection??function({x:t,y:r}){if(t||r)return t??=t=>t,r??=t=>t,uI({point(i,n){this.stream.point(t(i),r(n))}})}(D))},N.filterFacets=(t,r)=>lH(A,{channels:r,groups:lL(t,r)}
46),N.getMarkState=t=>{let r=S.get(t),i=w.get(t);return{...r,channels:{...r.channels,...i?.channels}}},N.dispatchValue=t=>{F.value!==t&&(F.value=t,F.dispatchEvent(new N.document.defaultView.Event("input",{bubbles:!0})))};let B=new Set;for(let[r,n]of S)if(null!=r.initializer){let a="super"===r.facet?O:k,o=r.initializer(n.data,n.facets,n.channels,D,a,N);if(void 0!==o.data&&(n.data=o.data),void 0!==o.facets&&(n.facets=o.facets),void 0!==o.channels){let{fx:a,fy:s,...l}=o.channels;for(let r of(function(t){for(let r in t)n9(r,t[r])}(l),Object.assign(n.channels,l),Object.values(l))){let{scale:n}=r;null!=n&&(i=nn.get(n))!==i8&&i!==ni&&(pc(r,t),B.add(n))}(null!=a||null!=s)&&w.set(r,!0)}}if(B.size){let r=new Map;ph(r,S,t,t=>B.has(t)),ph(E,S,t,t=>B.has(t));let i=function(t,r){for(let i in t){let n=t[i],a=r[i];void 0===n.label&&a&&(n.label=a.label)}return t}(lv(r,t),C),{scales:n,...a}=l_(i);Object.assign(C,i),Object.assign(D,a),Object.assign(D.scales,n)}for(let[t,r]of(void 0!==A&&(u={x:P?.domain(),y:I?.domain()},A=function(t,{x:r,y:i}){return r&&=lB(r),i&&=lB(i),t.filter(r&&i?t=>r.has(t.x)&&i.has(t.y):r?t=>r.has(t.x):t=>i.has(t.y)).sort(r&&i?(t,n)=>r.get(t.x)-r.get(n.x)||i.get(t.y)-i.get(n.y):r?(t,i)=>r.get(t.x)-r.get(i.x):(t,r)=>i.get(t.y)-i.get(r.y))}(A,u),c=function(t,r,{marginTop:i,marginLeft:n}){let a=t?({x:r})=>t(r)-n:()=>0,o=r?({y:t})=>r(t)-i:()=>0;return function(t){"svg"===this.tagName?(this.setAttribute("x",a(t)),this.setAttribute("y",o(t))):this.setAttribute("transform",`translate(${a(t)},${o(t)})`)}}(P,I,M)),S))r.values=t.scale(r.channels,D,N);let{width:z,height:j}=M;for(let t of((0,hv.select)(R).attr("class",_).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",z).attr("height",j).attr("viewBox",`0 0 ${z} ${j}`).attr("aria-label",y).attr("aria-description",v).call(t=>t.append("style").text(`:where(.${_}) { 47 --plot-background: white; 48 display: block; 49 height: auto; 50 height: intrinsic; 51 max-width: 100%; 52} 53:where(.${_} text), 54:where(.${_} tspan) { 55 white-space: pre; 56}`)).call(h$,d),b)){let{channels:r,values:i,facets:a}=S.get(t);if(void 0===A||"super"===t.facet){let n=null;if(a&&(n=a[0],0===(n=t.filter(n,r,i)).length))continue;let o=t.render(n,D,i,O,N);if(null==o)continue;R.appendChild(o)}else{let o;for(let s of A){if(!(t.facetAnchor?.(A,u,s)??!s.empty))continue;let l=null;if(a){let o=w.has(t);if(l=a[o?s.i:0],0===(l=t.filter(l,r,i)).length)continue;o||l!==a[0]||(l=(n=l).subarray?n.subarray(void 0,void 0):n.slice(void 0,void 0)),l.fx=s.x,l.fy=s.y,l.fi=s.i}let c=t.render(l,D,i,k,N);if(null!=c)for(let t of((o??=(0,hv.select)(R).append("g")).append(()=>c).datum(s),["aria-label","aria-description","aria-hidden","transform"]))c.hasAttribute(t)&&(o.attr(t,c.getAttribute(t)),c.removeAttribute(t))}o?.selectChildren().each(c)}}let U=function(t,r,i){let n=[];for(let[a,o]of dD){let s=i[a];if(s?.legend&&a in t){let i=o(t[a],dP(r,t[a],s),r=>t[r]);null!=i&&n.push(i)}}return n}(C,N,t),{figure:V=null!=p||null!=m||null!=g||U.length>0}=t;V&&((F=L.createElement("figure")).className=`${_}-figure`,F.style.maxWidth="initial",null!=p&&F.append(pa(L,p,"h2")),null!=m&&F.append(pa(L,m,"h3")),F.append(...U,R),null!=g&&F.append((o=L,s=g,(l=o.createElement("figcaption")).append(s),l)),"value"in R&&(F.value=R.value,delete R.value)),F.scale=(a=D.scales,t=>{if(!nn.has(t=`${t}`))throw Error(`unknown scale: ${t}`);return a[t]}),F.legend=function(t,r,i={}){return(n,a)=>{if(!dD.has(n))throw Error(`unknown legend type: ${n}`);if(n in t)return dD.get(n)(t[n],dP(r,i[n],a),r=>t[r])}}(C,N,t);let $=(h=sG,sG=0,r=void 0,h);return $>0&&(0,hv.select)(R).append("text").attr("x",z).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("â ï¸").append("title").text(`${$.toLocaleString("en-US")} warning${1===$?"":"s"}. Please check the console.`),F}function pa(t,r,i){if(r.ownerDocument)return r;let n=t.createElement(i);return n.append(r),n}function po(t){return t.flat(1/0).filter(t=>null!=t).map(ps)}function ps(t){return"function"==typeof t.render?t:new pl(t)}class pl extends hQ{constructor(t){if("function"!=typeof t)throw TypeError("invalid mark; missing render function");super(),this.render=t}render(){}}function pu(t,r){for(let i in t)pc(t[i],r);return t}function pc(t,r){let{scale:i,transform:n=!0}=t;if(null==i||!n)return;let{type:a,percent:o,interval:s,transform:l=o?t=>null==t?NaN:100*t:iz(s,a)}=r[i]??{};null!=l&&(t.value=ix(t.value,l),t.transform=!1)}function ph(t,r,i,n=ir){for(let{channels:a}of r.values())for(let r in a){let o=a[r],{scale:s}=o;if(null!=s&&n(s))if("projection"===s){if(!function({projection:t}={}){return null!=t&&("function"==typeof t.stream||(iS(t)&&(t=t.type),null!=t))}(i)){let r=i.x?.domain===void 0,n=i.y?.domain===void 0;if(r||n){let[i,a]=function(t){let r=[],i=[],n={point(t,n){r.push(t),i.push(n)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let r of t.value)uz(r,n);return[{scale:"x",value:r},{scale:"y",value:i}]}(o);r&&pf(t,"x",i),n&&pf(t,"y",a)}}}else pf(t,s,o)}return t}function pf(t,r,i){let n=t.get(r);void 0!==n?n.push(i):t.set(r,[i])}function pd(t,r,i){if(null===t.facet||"super"===t.facet)return;let{fx:n,fy:a}=t;if(null!=n||null!=a){let r=iv(t.data??n??a);if(void 0===r)throw Error(`missing facet data in ${t.ariaLabel}`);if(null===r)return;let o={};return null!=n&&(o.fx=n7(r,{value:n,scale:"fx"})),null!=a&&(o.fy=n7(r,{value:a,scale:"fy"})),pu(o,i),{channels:o,groups:lL(r,o)}}if(void 0===r)return;let{channels:o,groups:s,data:l}=r;if("auto"!==t.facet||t.data===l)return{channels:o,groups:s};l.length>0&&(s.size>
561||1===s.size&&o.fx&&o.fy&&[...s][0][1].size>1)&&ik(iv(t.data))===ik(l)&&sq(`Warning: the ${t.ariaLabel} mark appears to use faceted data, but isnât faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function pp(t,r,i,n,a,o,s){var l;if(!r)return;let u=(l=r,/^\s*both\s*$/i.test(l)),{line:c}=s=function(t,r,{line:i=r.line,ticks:n,tickSize:a,tickSpacing:o,tickPadding:s,tickFormat:l,tickRotate:u,fontVariant:c,ariaLabel:h,ariaDescription:f,label:d=r.label,labelAnchor:p,labelArrow:m=r.labelArrow,labelOffset:g}){return{anchor:t,line:i,ticks:n,tickSize:a,tickSpacing:o,tickPadding:s,tickFormat:l,tickRotate:u,fontVariant:c,ariaLabel:h,ariaDescription:f,label:d,labelAnchor:p,labelArrow:m,labelOffset:g}}(u?n:r,o,s);(i===de||i===dr)&&c&&!i0(c)&&t.push(new d3(function(t){let{anchor:r,line:i}=t;return{anchor:r,facetAnchor:r+"-empty",stroke:!0===i?void 0:i}}(s))),t.push(i(s)),u&&t.push(i({...s,anchor:a,label:null}))}function pm(t,r,i,n){!r||i0(r)||t.push(i(function(t,{stroke:r=iK(t)?t:void 0,ticks:i=!function(t){switch(typeof t){case"number":return!0;case"string":return!iK(t)}return i$(t)||"function"==typeof t?.range}(t)?void 0:t,tickSpacing:n,ariaLabel:a,ariaDescription:o}){return{stroke:r,ticks:i,tickSpacing:n,ariaLabel:a,ariaDescription:o}}(r,n)))}function pg(t,r){let i=`${r}-axis `;return t.some(t=>t.ariaLabel?.startsWith(i))}function py(t,r){for(let i of r)for(let r in i.channels){let{scale:n}=i.channels[r];if(n===t||"projection"===n)return!0}return!1}function pv(t){let r=t.domain();if(0===r.length)return[0,t.bandwidth()];let i=t(r[0]),n=t(r[r.length-1]);return n<i&&([i,n]=[n,i]),[i,n+t.bandwidth()]}hQ.prototype.plot=function({marks:t=[],...r}={}){return pn({...r,marks:[...t,this]})};var p_=Array.prototype,pb=p_.slice;p_.map;var px=t.i(547285);function pw(t){return Math.max(1,Math.ceil(Math.log(function(t){let r=0;for(let i of t)null!=i&&(i*=1)>=i&&++r;return r}(t))/Math.LN2)+1)}function pE({data:t,valueAccessor:r,valueFormatter:i=aD.format(",.2f"),title:n,highlightedFeatureIds:a=null,onHoverFeatures:o,highlightColor:s="orange",fixedDomain:l=!1,height:u=160,isLoading:c=!1,disableInteractions:h=!1}){let f=(0,ec.useRef)(null),[d,p]=(0,ec.useState)(300),m=(0,ec.useRef)(!1);t?.length&&(m.current=!0);let g=(0,ec.useRef)(o);(0,ec.useEffect)(()=>{g.current=o},[o]);let y=(0,ec.useRef)(a);(0,ec.useEffect)(()=>{y.current=a},[a]);let v=(0,ec.useRef)([]),_=(0,ec.useRef)(!1);(0,ec.useEffect)(()=>{if(!f.current)return;let t=new ResizeObserver(t=>{p(Math.max(200,t[0].contentRect.width))});return t.observe(f.current),()=>t.disconnect()},[]);let b=(0,ec.useMemo)(()=>{if(!t?.length)return[];let i=t.map(t=>({value:r(t),fillColor:t.__value?.fillColor,id:t.id})).filter(t=>"number"==typeof t.value&&isFinite(t.value));if(!i.length)return[];let n=i.map(t=>t.value),a=l||al(n),o=aC.scaleLinear().domain(a).nice();return(function(){var t=eD,r=al,i=pw;function n(n){Array.isArray(n)||(n=Array.from(n));var a,o,s,l=n.length,u=Array(l);for(a=0;a<l;++a)u[a]=t(n[a],a,n);var c=r(u),h=c[0],f=c[1],d=i(u,h,f);if(!Array.isArray(d)){let t=f,i=+d;if(r===al&&([h,f]=function(t,r,i){let n;for(;;){let a=(0,sK.tickIncrement)(t,r,i);if(a===n||0===a||!isFinite(a))return[t,r];a>0?(t=Math.floor(t/a)*a,r=Math.ceil(r/a)*a):a<0&&(t=Math.ceil(t*a)/a,r=Math.floor(r*a)/a),n=a}}(h,f,i)),(d=(0,sK.default)(h,f,i))[0]<=h&&(s=(0,sK.tickIncrement)(h,f,i)),d[d.length-1]>=f)if(t>=f&&r===al){let t=(0,sK.tickIncrement)(h,f,i);isFinite(t)&&(t>0?f=(Math.floor(f/t)+1)*t:t<0&&(f=-((Math.ceil(-(f*t))+1)/t)))}else d.pop()}for(var p=d.length,m=0,g=p;d[m]<=h;)++m;for(;d[g-1]>f;)--g;(m||g<p)&&(d=d.slice(m,g),p=g-m);var y,v=Array(p+1);for(a=0;a<=p;++a)(y=v[a]=[]).x0=a>0?d[a-1]:h,y.x1=a<p?d[a]:f;if(isFinite(s)){if(s>0)for(a=0;a<l;++a)null!=(o=u[a])&&h<=o&&o<=f&&v[Math.min(p,Math.floor((o-h)/s))].push(n[a]);else if(s<0){for(a=0;a<l;++a)if(null!=(o=u[a])&&h<=o&&o<=f){let t=Math.floor((h-o)*s);v[Math.min(p,t+(d[t]<=o))].push(n[a])}}}else for(a=0;a<l;++a)null!=(o=u[a])&&h<=o&&o<=f&&v[(0,px.default)(d,o,0,p)].push(n[a]);return v}return n.value=function(r){return arguments.length?(t="function"==typeof r?r:()=>r,n):t},n.domain=function(t){var i;return arguments.length?(r="function"==typeof t?t:(i=[t[0],t[1]],()=>i),n):r},n.thresholds=function(t){var r;return arguments.length?(i="function"==typeof t?t:(r=Array.isArray(t)?pb.call(t):t,()=>r),n):i},n})().domain(o.domain()).thresholds(30)(n).map(t=>{let r=t.x0,n=t.x1,a=i.filter(t=>t.value>=r&&t.value<n),o=a.find(t=>t.fillColor);return{x1:r,x2:n,count:t.length,color:o?.fillColor?`rgb(${o.fillColor[0]},${o.fillColor[1]},${o.fillColor[2]})`:"#888",featureIds:a.map(t=>
56t.id).filter(t=>void 0!==t)}})},[t,r,l]),x=(0,ec.useRef)(b);(0,ec.useEffect)(()=>{x.current=b},[b]);let w=(0,ec.useMemo)(()=>{let t=new Map;return b.forEach((r,i)=>{r.featureIds.forEach(r=>t.set(r,i))}),t},[b]),E=(0,ec.useMemo)(()=>{let i=new Map;return t?.length&&t.forEach(t=>{let n=t.id,a=r(t);void 0!==n&&"number"==typeof a&&isFinite(a)&&i.set(n,a)}),i},[t,r]),T=(0,ec.useRef)(w);(0,ec.useEffect)(()=>{T.current=w},[w]);let A=(0,ec.useRef)(E);(0,ec.useEffect)(()=>{A.current=E},[E]);let S=(0,ec.useRef)(null),C=(0,ec.useRef)(null),M=(0,ec.useRef)(24);if((0,ec.useEffect)(()=>{if(!f.current||!b.length)return;f.current.innerHTML="",M.current=24;let t=pn({width:d,height:u,marginLeft:36,marginRight:12,marginTop:24,marginBottom:28,x:{label:null,tickFormat:i,ticks:6},y:{label:null,axis:null},marks:[function(t,r={}){return iA(r)||(r={...r,x:r7,y2:r9,interval:1}),new dY(t,function({y:t,y1:r,y2:i,...n}={}){return(n=h1(n,"x"),void 0===r&&void 0===i)?function(t={},r={}){1==arguments.length&&([t,r]=dR(t));let{x1:i,x:n=i,y:a,...o}=r,[s,l,u,c]=dB(n,a,"x","y",t,o);return{...s,x1:i,x:l,y1:u,y2:c,y:iB(u,c)}}({y:t,...n}):([r,i]=iP(t,r,i),{...n,y1:r,y2:i})}(function(t={}){return f_("x",fm,t,!0)}(function(t={},r="y"){return iT(t)?t:{...t,[r]:r9}}(r))))}(b,{x1:"x1",x2:"x2",y:"count",fill:"color",insetLeft:.5,insetRight:.5})]});f.current.appendChild(t);{let t=b.map(t=>t.x1),r=b.map(t=>t.x2),i=Math.min(...t),n=Math.max(...r);S.current=aC.scaleLinear().domain([i,n]).range([36,d-12])}let r=hv.select(t),n=r.selectAll('g[aria-label="rect"] rect').nodes();v.current=n;let a=n.map(t=>{let r=parseFloat(t.getAttribute("x")||"0");return{left:r,right:r+parseFloat(t.getAttribute("width")||"0")}}),o=t=>{let r=x.current,i=t instanceof Set;n.forEach((n,a)=>{let o=i?t.has(a):a===t;n.setAttribute("fill",o?s:r[a]?.color||"#888")})};C.current=r.append("g").attr("class","value-indicator").style("display","none");let l=t=>{let r=C.current,n=S.current;if(r&&n){if(t&&1===t.length){let a=A.current.get(t[0]);if(void 0!==a){let t=n(a);r.selectAll("*").remove(),r.append("line").attr("x1",t).attr("x2",t).attr("y1",24).attr("y2",u-28).attr("stroke","black").attr("stroke-width",1.5).attr("stroke-dasharray","4,2"),r.append("text").attr("x",t).attr("y",20).attr("text-anchor","middle").attr("font-size",13).attr("font-weight","600").attr("fill","black").text(i(a)),r.style("display",null);return}}r.style("display","none")}};if(!h){let t=y.current;if(t&&t.length>0){let r=T.current,i=new Set;t.forEach(t=>{let n=r.get(t);void 0!==n&&i.add(n)}),i.size>0&&o(i),l(t)}}return h||r.append("rect").attr("x",36).attr("y",24).attr("width",d-36-12).attr("height",u-24-28).attr("fill","transparent").style("cursor","pointer").on("mousemove",t=>{_.current=!0;let[r]=h3.pointer(t);C.current&&C.current.style("display","none");let i=-1;for(let t=0;t<a.length;t++)if(r>=a[t].left&&r<=a[t].right){i=t;break}o(i);let n=x.current;i>=0&&n[i]?g.current?.(n[i].featureIds):g.current?.(null)}).on("mouseleave",()=>{_.current=!1;let t=y.current;if(t&&t.length>0){let r=T.current,i=new Set;t.forEach(t=>{let n=r.get(t);void 0!==n&&i.add(n)}),o(i),l(t)}else o(-1);g.current?.(null)}),()=>{v.current=[],C.current=null,S.current=null,f.current&&(f.current.innerHTML="")}},[b,d,u,i,s,h]),(0,ec.useEffect)(()=>{if(h||_.current)return;let t=v.current;if(!t.length)return;let r=C.current,n=S.current;if(a&&a.length>0){let o=new Set;if(a.forEach(t=>{let r=w.get(t);void 0!==r&&o.add(r)}),t.forEach((t,r)=>{t.setAttribute("fill",o.has(r)?s:b[r]?.color||"#888")}),r&&n&&1===a.length){let t=E.get(a[0]);if(void 0!==t){let a=n(t);r.selectAll("*").remove(),r.append("line").attr("x1",a).attr("x2",a).attr("y1",M.current).attr("y2",u-28).attr("stroke","black").attr("stroke-width",1.5).attr("stroke-dasharray","4,2"),r.append("text").attr("x",a).attr("y",M.current-4).attr("text-anchor","middle").attr("font-size",13).attr("font-weight","600").attr("fill","black").text(i(t)),r.style("display",null)}else r.style("display","none")}else r&&r.style("display","none")}else t.forEach((t,r)=>{t.setAttribute("fill",b[r]?.color||"#888")}),r&&r.style("display","none")},[a,b,s,w,E,i]),!m.current&&(c||!t?.length))return(0,eu.jsx)("div",{ref:f,className:"w-full",children:(0,eu.jsx)("div",{className:"flex items-center justify-center h-40 text-gray-400 text-sm",children:(0,eu.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,eu.jsx)("div",{className:"w-5 h-5 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin"}),(0,eu.jsx)("span",{children:"Loading data..."})]})})});let D=m.current&&(c||!t?.length);return(0,eu.jsxs)("div",{className:"w-full relative",onMouseLeave:()=>{if(h)return;_.current=!1;let t=v.current;if(t.length){let r=y.current,i=x.current;if(r&&r.length>0){let n=T.current,a=new Set;r.forEach(t=>{let r=n.get(t);void 0!==r&&a.add(r)}),t.forEach((t,r)=>{t.setAttribute("fill",a.has(r)?s:i[r]?.color||"#888")})}else t.forEach((t,r)=>{t.setAttribute("fill",i[r]?.color||"#888")})}g.current?.(null)},children:[(0,eu.jsx)("div",{className:"h-6 px-2 pt-1",children:(0,eu.jsx)("div",{className:"text-xs font-semibold text-black truncate",children:n})}),(0,eu.jsx)("div",{ref:f,className:"w-full"}),D&&(0,eu.jsx)("div",{className:"absolute top-0 right-0 w-2 h-2 bg-gray-400 rounded-full animate-pulse",title:"Refreshing..."})]})}t.s(["default",0,pE],490939);let pT={ariaLabel:"bar"};class pA extends hQ{constructor(t,r,i={},n=pT){super(t,r,i,n),dX(this,i),dK(this,i)}render(t,r,i,n,a){let{rx:o,ry:s,rx1y1:l,rx1y2:u,rx2y1:c,rx2y2:h}=this,f=this._x(r,i,n),d=this._y(r,i,n),p=this._width(r,i,n),m=this._height(r,i,n);return hx("svg:g",a).call(hL,this,n,a).call(this._transform,this,r).call(r=>r.selectAll().data(t).enter().call(l||u||c||h?t=>t.append("path").call(hR,this).call(dQ,f,d,pS(f,p),pS(d,m),this).call(hI,this,i):t=>t.append("rect").call(hR,this).attr("x",f).attr("width",p).attr("y",d).attr("height",m).call(hF,"rx",o).call(hF,"ry",s).c
56all(hI,this,i))).node()}_x(t,{x:r},{marginLeft:i}){let{insetLeft:n}=this;return r?t=>r[t]+n:i+n}_y(t,{y:r},{marginTop:i}){let{insetTop:n}=this;return r?t=>r[t]+n:i+n}_width({x:t},{x:r},{marginRight:i,marginLeft:n,width:a}){let{insetLeft:o,insetRight:s}=this;return Math.max(0,(r&&t?t.bandwidth():a-i-n)-o-s)}_height({y:t},{y:r},{marginTop:i,marginBottom:n,height:a}){let{insetTop:o,insetBottom:s}=this;return Math.max(0,(r&&t?t.bandwidth():a-i-n)-o-s)}}function pS(t,r){return"function"==typeof t&&"function"==typeof r?i=>t(i)+r(i):"function"==typeof t?i=>t(i)+r:"function"==typeof r?i=>t+r(i):t+r}class pC extends pA{constructor(t,r={},i){const{x1:n,x2:a,y:o}=r;super(t,{x1:{value:n,scale:"x"},x2:{value:a,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},r,i)}_transform(t,r,{x:i}){t.call(hB,r,{x:i},0,0)}_x({x:t},{x1:r,x2:i},{marginLeft:n}){let{insetLeft:a}=this;return lk(t)?n+a:t=>Math.min(r[t],i[t])+a}_width({x:t},{x1:r,x2:i},{marginRight:n,marginLeft:a,width:o}){let{insetLeft:s,insetRight:l}=this;return lk(t)?o-n-a-s-l:t=>Math.max(0,Math.abs(i[t]-r[t])-s-l)}}function pM(t,r={}){return iA(r)||(r={...r,y:r7,x2:r9}),new pC(t,function({x:t,x1:r,x2:i,...n}={}){return(n=h1(n,"y"),void 0===r&&void 0===i)?function(t={},r={}){1==arguments.length&&([t,r]=dR(t));let{y1:i,y:n=i,x:a,...o}=r,[s,l,u,c]=dB(n,a,"y","x",t,o);return{...s,y1:i,y:l,x1:u,x2:c,x:iB(u,c)}}({x:t,...n}):([r,i]=iP(t,r,i),{...n,x1:r,x2:i})}(fx(function(t={},r="x"){return iE(t)?t:{...t,[r]:r9}}(r))))}var pD=t.i(166832);function pP({values:t,labels:r,tricoloreOptions:i,title:n="",height:a=100,domain:o,valueFormatter:s}){let l=(0,ec.useRef)(null),[u,c]=(0,ec.useState)(300);return(0,ec.useEffect)(()=>{if(!l.current)return;let t=new ResizeObserver(t=>{c(Math.max(200,t[0].contentRect.width))});return t.observe(l.current),()=>t.disconnect()},[]),(0,ec.useEffect)(()=>{if(!l.current)return;if(l.current.innerHTML="",!t){let t=document.createElement("div");t.className="flex items-center justify-center text-gray-400 text-sm",t.style.height=`${a}px`,t.textContent="Hover over a region to see proportions",l.current.appendChild(t);return}let n=!!o,c=t[0]+t[1]+t[2];if(!n&&c<=0){let t=document.createElement("div");t.className="flex items-center justify-center text-gray-400 text-sm",t.style.height=`${a}px`,t.textContent="No data available",l.current.appendChild(t);return}let h=n?t.map(t=>t):t.map(t=>t/c),f=o??[0,1],d=f[1],p=r.map((t,r)=>{let n,a;return{category:t,value:h[r],color:((n=[.1,.1,.1])[r]=.8,(a=(0,pD.tricoloreToRgb)(n,i))?`rgb(${a[0]}, ${a[1]}, ${a[2]})`:"#888")}}),m=pn({width:u,height:a,marginLeft:10,marginRight:50,marginTop:5,marginBottom:5,x:{domain:f,axis:null},y:{domain:r,axis:null,padding:.2},marks:[pM(p,{y:"category",x:d,fill:"#e5e7eb"}),pM(p,{y:"category",x:"value",fill:t=>t.color}),fO(p,{y:"category",x:n?f[0]+(d-f[0])*.02:.02,text:"category",textAnchor:"start",dy:0,fill:"#374151",fontWeight:500,fontSize:12}),fO(p,{y:"category",x:1.02*d,text:t=>{var r;return r=t.value,s?s(r):`${(100*r).toFixed(1)}%`},textAnchor:"start",dy:0,fill:"#374151",fontSize:12})]});return l.current.appendChild(m),()=>{l.current&&(l.current.innerHTML="")}},[t,r,i,u,a,o,s]),(0,eu.jsxs)("div",{className:"tricolore-bar-graph w-full",children:[(0,eu.jsx)("div",{className:"h-6 px-2 pt-1",children:(0,eu.jsx)("div",{className:"text-xs font-semibold text-black truncate",children:n})}),(0,eu.jsx)("div",{ref:l,className:"w-full"})]})}t.s(["default",0,pP],300298);let pI={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};class pk extends hQ{constructor(t,r={}){const{x:i,y:n,r:a,rotate:o,symbol:s=nT,frameAnchor:l}=r,[u,c]=im(o,0),[h,f]=function(t){if(null==t||nV(t))return[void 0,t];if("string"==typeof t){let r=nU.get(`${t}`.toLowerCase());if(r)return[void 0,r]}return[t,void 0]}(s),[d,p]=im(a,null==h?3:4.5);super(t,{x:{value:i,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},r:{value:d,scale:"r",filter:ej,optional:!0},rotate:{value:u,optional:!0},symbol:{value:h,scale:"auto",optional:!0}},function(t){return void 0===t.sort&&void 0===t.reverse?function(t,{sort:r,...i}={}){return{...(iM(t)&&void 0!==t.channel?hH:function(t,r){return(null!=t.initializer?hH:hq)(t,r)})(i,hK(t)),sort:iD(r)?r:null}}({channel:"-r"},t):t}(r),pI),this.r=p,this.rotate=c,this.symbol=f,this.frameAnchor=i2(l);const{channels:m}=this,{symbol:g}=m;if(g){const{fill:t,stroke:r}=m;g.hint={fill:t?t.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:r?r.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,i,n,a){let{x:o,y:s}=r,{x:l,y:u,r:c,rotate:h,symbol:f}=i,{r:d,rotate:p,symbol:m}=this,[g,y]=hG(this,n),v=m===nT,_=c?void 0:d*d*Math.PI;return eU(d)&&(t=[]),hx("svg:g",a).call(hL,this,n,a).call(hB,this,{x:l&&o,y:u&&s}).call(r=>
56r.selectAll().data(t).enter().append(v?"circle":"path").call(hR,this).call(v?t=>{t.attr("cx",l?t=>l[t]:g).attr("cy",u?t=>u[t]:y).attr("r",c?t=>c[t]:d)}:t=>{let r;t.attr("transform",fM`translate(${l?t=>l[t]:g},${u?t=>u[t]:y})${h?t=>` rotate(${h[t]})`:p?` rotate(${p})`:""}`).attr("d",c&&f?t=>{let r=la();return f[t].draw(r,c[t]*c[t]*Math.PI),r}:c?t=>{let r=la();return m.draw(r,c[t]*c[t]*Math.PI),r}:f?t=>{let r=la();return f[t].draw(r,_),r}:(r=la(),m.draw(r,_),r))}).call(hI,this,i)).node()}}let pO=new Set(["CT","DA","EA","DB"]);function pN(t){let r,i=!0;if(t.name&&"CT"!==t.t){if(r=t.name,t.flag){if("CMA"===t.t){let i="B"===t.flag?"CMA":"CA";r+=` (${i})`}else"PR"!==t.t&&(r+=` (${t.flag})`);i=!1}}else(r=t.id??"").startsWith("s_1_")&&(r=r.split("_")[2]||r);return i&&t.t&&pO.has(t.t)&&(r+=` (${t.t})`),r}function pL(t,r,i,n,a,o){let s=t.append("g"),l=s.append("rect").attr("fill","#f9fafb").attr("rx",1).attr("pointer-events","none"),u=s.append("text").attr("x",r).attr("y",i).attr("text-anchor",n).attr("dominant-baseline",a).attr("font-size","0.65rem").attr("fill","#111827").attr("font-weight","600").attr("pointer-events","none").text(o).node();if(u){let t=u.getBBox();l.attr("x",t.x-2).attr("y",t.y-2).attr("width",t.width+4).attr("height",t.height+4)}}function pR(t,r,i,n,a){let o=i.width-i.marginRight,s=i.height-i.marginBottom;t.append("line").attr("x1",r.sx).attr("x2",r.sx).attr("y1",i.marginTop).attr("y2",s).attr("stroke","#374151").attr("stroke-width",1).attr("stroke-dasharray","4,3").attr("pointer-events","none"),t.append("line").attr("x1",i.marginLeft).attr("x2",o).attr("y1",r.sy).attr("y2",r.sy).attr("stroke","#374151").attr("stroke-width",1).attr("stroke-dasharray","4,3").attr("pointer-events","none"),pL(t,r.sx,s+14,"middle","auto",n(r.x)),pL(t,i.marginLeft-4,r.sy,"end","middle",a(r.y)),t.append("circle").attr("cx",r.sx).attr("cy",r.sy).attr("r",3).attr("fill",r.color).attr("stroke","#111827").attr("stroke-width",1.5).attr("pointer-events","none")}function pF({data:t,xLabel:r,yLabel:i,xKey:n,yKey:a,xTickFormat:o,yTickFormat:s,highlightedFeatureIds:l,onHoverFeatures:u,height:c=200,disableInteractions:h=!1}){let f=(0,ec.useRef)(null),[d,p]=(0,ec.useState)(300),m=(0,ec.useRef)(u);(0,ec.useEffect)(()=>{m.current=u},[u]);let g=(0,ec.useRef)([]),y=(0,ec.useRef)(null),v=(0,ec.useRef)(null),_=(0,ec.useRef)(null),b=(0,ec.useRef)(null),x=(0,ec.useRef)({marginLeft:50,marginRight:15,marginTop:15,marginBottom:40,width:300,height:200});(0,ec.useEffect)(()=>{if(!f.current)return;let t=new ResizeObserver(t=>{p(Math.max(200,t[0].contentRect.width))});return t.observe(f.current),()=>t.disconnect()},[]);let w=(0,ec.useMemo)(()=>t?.length?t.map(t=>{let r=t.__value?.variables,i=r?.[n]??t[n],o=r?.[a]??t[a];if(null==i||null==o)return null;let s="object"==typeof i&&null!==i&&"value"in i?i.value:i,l="object"==typeof o&&null!==o&&"value"in o?o.value:o;if(null==s||null==l)return null;let u="number"==typeof s?s:parseFloat(s),c="number"==typeof l?l:parseFloat(l);if(!isFinite(u)||!isFinite(c))return null;let h="rgb(107, 114, 128)",f=t.__value?.fillColor;return f&&(h=`rgb(${f[0]}, ${f[1]}, ${f[2]})`),{x:u,y:c,id:t.id,color:h}}).filter(t=>null!==t):[],[t,n,a]);return(0,ec.useEffect)(()=>{if(!f.current)return;if(f.current.innerHTML="",g.current=[],y.current=null,!w.length){let t=document.createElement("div");t.className="flex items-center justify-center text-gray-400 text-sm",t.style.height=`${c}px`,t.textContent="No data available for scatter plot",f.current.appendChild(t);return}x.current={marginLeft:50,marginRight:15,marginTop:15,marginBottom:40,width:d,height:c};let t=pn({width:d,height:c,marginLeft:50,marginRight:15,marginTop:15,marginBottom:40,x:{label:r,grid:!0,...o&&{tickFormat:o}},y:{label:i,grid:!0,...s&&{tickFormat:s}},marks:[function(t,{x:r,y:i,...n}={}){return void 0===n.frameAnchor&&([r,i]=iI(r,i)),new pk(t,{...n,x:r,y:i})}(w,{x:"x",y:"y",r:3,fill:t=>t.color,fillOpacity:.7})]});if(f.current.appendChild(t),!h){let r=hv.select(t),i=al(w,t=>t.x),n=al(w,t=>t.y),a=aC.scaleLinear().domain(i).range([50,d-15]),l=aC.scaleLinear().domain(n).range([
56c-40,15]),u=w.map(t=>({...t,sx:a(t.x),sy:l(t.y)}));g.current=u;let h=r.append("g").attr("class","highlight-group");v.current=h,y.current=r.append("g").attr("class","ext-highlight-group");let f=r.append("circle").attr("class","hover-radius").attr("r",10).attr("fill","none").attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","3,2").attr("pointer-events","none").style("opacity",0);_.current=f;let p=o??String,b=s??String,E=x.current,T=null;r.append("rect").attr("class","interaction-overlay").attr("x",50).attr("y",15).attr("width",d-50-15).attr("height",c-15-40).attr("fill","transparent").style("cursor","crosshair").on("mousemove",t=>{let[r,i]=h3.pointer(t);f.attr("cx",r).attr("cy",i).style("opacity",1);let n=u.filter(t=>{let n=t.sx-r,a=t.sy-i;return 10>=Math.sqrt(n*n+a*a)});h.selectAll("*").remove(),1===n.length?pR(h,n[0],E,p,b):n.length>1&&h.selectAll("circle").data(n,t=>String(t.id)).join("circle").attr("cx",t=>t.sx).attr("cy",t=>t.sy).attr("r",7).attr("fill",t=>t.color).attr("stroke","#000").attr("stroke-width",2.5);let a=n.map(t=>t.id).filter(t=>void 0!==t),o=a.join(",");o!==T&&(T=o,m.current?.(a.length>0?a:null))}).on("mouseleave",()=>{T=null,f.style("opacity",0),h.selectAll("*").remove(),m.current?.(null)})}return()=>{g.current=[],y.current=null,v.current=null,_.current=null,f.current&&(f.current.innerHTML="")}},[w,r,i,o,s,d,c,h]),(0,ec.useEffect)(()=>{if(h)return;let r=y.current;if(!r)return;if(!l||0===l.length){r.selectAll("*").remove(),b.current&&(b.current.innerHTML="");return}let i=g.current,n=new Set(l),a=i.filter(t=>void 0!==t.id&&n.has(t.id));r.selectAll("*").remove();let u=o??String,c=s??String;if(1===a.length?pR(r,a[0],x.current,u,c):r.selectAll("circle").data(a,t=>String(t.id)).join("circle").attr("cx",t=>t.sx).attr("cy",t=>t.sy).attr("r",7).attr("fill",t=>t.color).attr("stroke","#000").attr("stroke-width",2.5),b.current){let r=(()=>{if(1!==l.length)return"";let r=t.find(t=>t.id===l[0]);return r?pN(r):""})();b.current.textContent=r}},[l,t,r,i,o,s]),(0,eu.jsxs)("div",{className:"scatter-plot-widget w-full my-2 bg-gray-50 rounded border border-gray-200",onMouseLeave:()=>{h||(v.current?.selectAll("*").remove(),_.current?.style("opacity",0),m.current?.(null))},children:[(0,eu.jsx)("div",{ref:b,className:"h-10 px-2 pt-1 text-xs font-semibold text-black truncate"}),(0,eu.jsx)("div",{ref:f,className:"w-full"})]})}t.s(["featureDisplayName",0,pN],710632),t.s(["default",0,pF],58472);var pB=t.i(618566);function pz(){}function pj(){}function pU(t){let r=[],i=String(t||""),n=i.indexOf(","),a=0,o=!1;for(;!o;){-1===n&&(n=i.length,o=!0);let t=i.slice(a,n).trim();(t||!o)&&r.push(t),a=n+1,n=i.indexOf(",",a)}return r}function pV(t,r){let i=r||{};return(""===t[t.length-1]?[...t,""]:t).join((i.padRight?" ":"")+","+(!1===i.padLeft?"":" ")).trim()}let p$=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pq={};function pH(t,r){return((r||pq).jsx?pG:p$).test(t)}let pW=/[ \t\n\f\r]/g;function pZ(t){return""===t.replace(pW,"")}class pY{constructor(t,r){this.attribute=r,this.property=t}}pY.prototype.attribute="",pY.prototype.booleanish=!1,pY.prototype.boolean=!1,pY.prototype.commaOrSpaceSeparated=!1,pY.prototype.commaSeparated=!1,pY.prototype.defined=!1,pY.prototype.mustUseProperty=!1,pY.prototype.number=!1,pY.prototype.overloadedBoolean=!1,pY.prototype.property="",pY.prototype.spaceSeparated=!1,pY.prototype.space=void 0;let pX=0,pK=p4(),pQ=p4(),pJ=p4(),p0=p4(),p1=p4(),p2=p4(),p3=p4();function p4(){return 2**++pX}t.s(["boolean",0,pK,"booleanish",0,pQ,"commaOrSpaceSeparated",0,p3,"commaSeparated",0,p2,"number",0,p0,"overloadedBoolean",0,pJ,"spaceSeparated",0,p1],400744);var p6=t.i(400744);let p5=Object.keys(p6);class p8 extends pY{constructor(t,r,i,n){let a=-1;if(super(t,r),function(t,r,i){i&&(t[r]=i)}(this,"space",n),"number"==typeof i)for(;++a<p5.length;){const t=p5[a];!function(t,r,i){i&&(t[r]=i)}(this,p5[a],(i&p6[t])===p6[t])}}}function p7(t){return t.toLowerCase()}p8.prototype.defined=!0;let p9=/[A-Z]/g,me=/-[a-z]/g,mt=/^data[-\w.:]+$/i;function mr(t,r){let i=p7(r),n=r,a=pY;if(i in t.normal)return t.property[t.normal[i]];if(i.length>4&&"data"===i.slice(0,4)&&mt.test(r)){if("-"===r.charAt(4)){let t=r.slice(5).replace(me,mn);n="data"+t.charAt(0).toUpperCase()+t.slice(1)}else{let t=r.slice(4);if(!me.test(t)){let i=t.replace(p9,mi);
56"-"!==i.charAt(0)&&(i="-"+i),r="data"+i}}a=p8}return new a(n,r)}function mi(t){return"-"+t.toLowerCase()}function mn(t){return t.charAt(1).toUpperCase()}let ma={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class mo{constructor(t,r,i){this.normal=r,this.property=t,i&&(this.space=i)}}function ms(t,r){let i={},n={};for(let r of t)Object.assign(i,r.property),Object.assign(n,r.normal);return new mo(i,n,r)}function ml(t){let r={},i={};for(let[n,a]of Object.entries(t.properties)){let o=new p8(n,t.transform(t.attributes||{},n),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),r[n]=o,i[p7(n)]=n,i[p7(o.attribute)]=n}return new mo(r,i,t.space)}mo.prototype.normal={},mo.prototype.property={},mo.prototype.space=void 0;let mu=ml({properties:{ariaActiveDescendant:null,ariaAtomic:pQ,ariaAutoComplete:null,ariaBusy:pQ,ariaChecked:pQ,ariaColCount:p0,ariaColIndex:p0,ariaColSpan:p0,ariaControls:p1,ariaCurrent:null,ariaDescribedBy:p1,ariaDetails:null,ariaDisabled:pQ,ariaDropEffect:p1,ariaErrorMessage:null,ariaExpanded:pQ,ariaFlowTo:p1,ariaGrabbed:pQ,ariaHasPopup:null,ariaHidden:pQ,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:p1,ariaLevel:p0,ariaLive:null,ariaModal:pQ,ariaMultiLine:pQ,ariaMultiSelectable:pQ,ariaOrientation:null,ariaOwns:p1,ariaPlaceholder:null,ariaPosInSet:p0,ariaPressed:pQ,ariaReadOnly:pQ,ariaRelevant:null,ariaRequired:pQ,ariaRoleDescription:p1,ariaRowCount:p0,ariaRowIndex:p0,ariaRowSpan:p0,ariaSelected:pQ,ariaSetSize:p0,ariaSort:null,ariaValueMax:p0,ariaValueMin:p0,ariaValueNow:p0,ariaValueText:null,role:null},transform:(t,r)=>"role"===r?r:"aria-"+r.slice(4).toLowerCase()});function mc(t,r){return r in t?t[r]:r}function mh(t,r){return mc(t,r.toLowerCase())}let mf=ml({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:p2,acceptCharset:p1,accessKey:p1,action:null,allow:null,allowFullScreen:pK,allowPaymentRequest:pK,allowUserMedia:pK,alpha:pK,alt:null,as:null,async:pK,autoCapitalize:null,autoComplete:p1,autoFocus:pK,autoPlay:pK,blocking:p1,capture:null,charSet:null,checked:pK,cite:null,className:p1,closedBy:null,colorSpace:null,cols:p0,colSpan:p0,command:null,commandFor:null,content:null,contentEditable:pQ,controls:pK,controlsList:p1,coords:p0|p2,crossOrigin:null,data:null,dateTime:null,decoding:null,default:pK,defer:pK,dir:null,dirName:null,disabled:pK,download:pJ,draggable:pQ,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:pK,formTarget:null,headers:p1,height:p0,hidden:pJ,high:p0,href:null,hrefLang:null,htmlFor:p1,httpEquiv:p1,id:null,imageSizes:null,imageSrcSet:null,inert:pK,inputMode:null,integrity:null,is:null,isMap:pK,itemId:null,itemProp:p1,itemRef:p1,itemScope:pK,itemType:p1,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:pK,low:p0,manifest:null,max:null,maxLength:p0,media:null,method:null,min:null,minLength:p0,multiple:pK,muted:pK,name:null,nonce:null,noModule:pK,noValidate:pK,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:pK,optimum:p0,pattern:null,ping:p1,placeholder:null,playsInl
56ine:pK,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:pK,referrerPolicy:null,rel:p1,required:pK,reversed:pK,rows:p0,rowSpan:p0,sandbox:p1,scope:null,scoped:pK,seamless:pK,selected:pK,shadowRootClonable:pK,shadowRootCustomElementRegistry:pK,shadowRootDelegatesFocus:pK,shadowRootMode:null,shadowRootSerializable:pK,shape:null,size:p0,sizes:null,slot:null,span:p0,spellCheck:pQ,src:null,srcDoc:null,srcLang:null,srcSet:null,start:p0,step:null,style:null,tabIndex:p0,target:null,title:null,translate:null,type:null,typeMustMatch:pK,useMap:null,value:pQ,width:p0,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:p1,axis:null,background:null,bgColor:null,border:p0,borderColor:null,bottomMargin:p0,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:pK,declare:pK,event:null,face:null,frame:null,frameBorder:null,hSpace:p0,leftMargin:p0,link:null,longDesc:null,lowSrc:null,marginHeight:p0,marginWidth:p0,noResize:pK,noHref:pK,noShade:pK,noWrap:pK,object:null,profile:null,prompt:null,rev:null,rightMargin:p0,rules:null,scheme:null,scrolling:pQ,standby:null,summary:null,text:null,topMargin:p0,valueType:null,version:null,vAlign:null,vLink:null,vSpace:p0,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:pK,disablePictureInPicture:pK,disableRemotePlayback:pK,exportParts:p2,part:p1,prefix:null,property:null,results:p0,security:null,unselectable:null},space:"html",transform:mh}),md=ml({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
56-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:p3,accentHeight:p0,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:p0,amplitude:p0,arabicForm:null,ascent:p0,attributeName:null,attributeType:null,azimuth:p0,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:p0,by:null,calcMode:null,capHeight:p0,className:p1,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:p0,diffuseConstant:p0,direction:null,display:null,dur:null,divisor:p0,dominantBaseline:null,download:pK,dx:null,dy:null,edgeMode:null,editable:null,elevation:p0,enableBackground:null,end:null,event:null,exponent:p0,externalResourcesRequired:null,fill:null,fillOpacity:p0,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:p2,g2:p2,glyphName:p2,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:p0,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:p0,horizOriginX:p0,horizOriginY:p0,id:null,ideographic:p0,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:p0,k:p0,k1:p0,k2:p0,k3:p0,k4:p0,kernelMatrix:p3,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:p0,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:p0,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
56Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:p0,overlineThickness:p0,paintOrder:null,panose1:null,path:null,pathLength:p0,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:p1,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:p0,pointsAtY:p0,pointsAtZ:p0,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:p3,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:p3,rev:p3,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:p3,requiredFeatures:p3,requiredFonts:p3,requiredFormats:p3,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:p0,specularExponent:p0,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:p0,strikethroughThickness:p0,string:null,stroke:null,strokeDashArray:p3,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:p0,strokeOpacity:p0,strokeWidth:null,style:null,surfaceScale:p0,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:p3,tabIndex:p0,tableValues:null,target:null,targetX:p0,targetY:p0,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:p3,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:p0,underlineThickness:p0,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:p0,values:null,vAlphabetic:p0,vMathematical:p0,vectorEffect:null,vHanging:p0,vIdeographic:p0,version:null,vertAdvY:p0,vertOriginX:p0,vertOriginY:p0,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:p0,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mc}),mp=ml({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(t,r)=>"xlink:"+r.slice(5).toLowerCase()}),mm=ml({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:mh}),mg=ml({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(t,r)=>"xml:"+r.slice(3).toLowerCase()}),my=ms([mu,mf,mp,mm,mg],"html"),mv=ms([mu,md,mp,mm,mg],"svg");function m_(t){let r=String(t||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function mb(t){return t.join(" ").trim()}var mx=t.i(515511);let mw=mT("end"),mE=mT("start");function mT(t){return function(r){let i=r&&r.position&&r.position[t]||{};if("number"==typeof i.line&&i.line>0&&"number"==typeof i.column&&i.column>0)return{line:i.line,column:i.column,offset:"number"==typeof i.offset&&i.offset>-1?i.offset:void 0}}}function mA(t){let r=mE(t),i=mw(t);if(r&&i)return{start:r,end:i}}function mS(t){return t&&"object"==typeof t?"position"in t||"type"in t?mM(t.position):"start"in t||"end"in t?mM(t):"line"in t||"column"in t?mC(t):"":""}function mC(t){return mD(t&&t.line)+":"+mD(t&&t.column)}function mM(t){return mC(t&&t.start)+"-"+mC(t&&t.end)}function mD(t){return t&&"number"==typeof t?t:1}class mP extends Error{constructor(t,r,i){super(),"string"==typeof r&&(i=r,r=void 0);let n="",a={},o=!1;if(r&&(a="line"in r&&"column"in r||"start"in r&&"end"in r?{place:r}:"type"in r?{ancestors:[r],place:r.position}:{...r}),"string"==typeof t?n=t:!a.cause&&t&&(o=!0,n=t.message,a.cause=t),!a.ruleId&&!a.source&&"string"==typeof i){const t=i.indexOf(":");-1===t?a.ruleId=i:(a.source=i.slice(0,t),a.ruleId=i.slice(t+1))}if(!a.place&&a.ancestors&&a.ancestors){const t=a.ancestors[a.ancestors.length-1];t&&(a.place=t.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=s?s.line:void 0,this.name=mS(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&"string"==typeof a.cause.stack?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}mP.prototype.file="",mP.prototype.name="",mP.prototype.reason="",mP.prototype.message="",mP.prototype.stack="",mP.prototype.column=void 0,mP.prototype.line=void 0,mP.prototype.ancestors=void 0,mP.prototype.cause=void 0,mP.prototype.fatal=void 0,mP.prototype.place=void 0,mP.prototype.ruleId=void 0,mP.prototype.source=void 0;let mI={}.hasOwnProperty,mk=new Map,mO=/[A-Z]/g,mN=new Set(["table","tbody","thead","tfoot","tr"]),mL=new Set(["td","th"]),mR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function mF(t,r,i){var n,a,o,s,l,u,c,h,f;let d,p,m,g,y,v,_,b,x,w,E;return"element"===r.type?(n=t,a=r,o=i,p=d=n.schema,"svg"===a.tagName.toLowerCase()&&"html"===d.space&&(n.schema=mv),n.ancestors.push(a),m=mU(n,a.tagName,!1),g=function(t,r){let i,n,a={};for(n in r.properties)if("children"!==n&&mI.call(r.properties,n)){let o=function(t,r,i){let n=mr(t.schema,r);
56if(!(null==i||"number"==typeof i&&Number.isNaN(i))){if(Array.isArray(i)&&(i=n.commaSeparated?pV(i):mb(i)),"style"===n.property){let r="object"==typeof i?i:function(t,r){try{return(0,mx.default)(r,{reactCompat:!0})}catch(i){if(t.ignoreInvalidStyle)return{};let r=new mP("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=mR+"#cannot-parse-style-attribute",r}}(t,String(i));return"css"===t.stylePropertyNameCase&&(r=function(t){let r,i={};for(r in t)mI.call(t,r)&&(i[function(t){let r=t.replace(mO,m$);return"ms-"===r.slice(0,3)&&(r="-"+r),r}(r)]=t[r]);return i}(r)),["style",r]}return["react"===t.elementAttributeNameCase&&n.space?ma[n.property]||n.property:n.attribute,i]}}(t,n,r.properties[n]);if(o){let[n,s]=o;t.tableCellAlignToStyle&&"align"===n&&"string"==typeof s&&mL.has(r.tagName)?i=s:a[n]=s}}return i&&((a.style||(a.style={}))["css"===t.stylePropertyNameCase?"text-align":"textAlign"]=i),a}(n,a),y=mj(n,a),mN.has(a.tagName)&&(y=y.filter(function(t){return"string"!=typeof t||!("object"==typeof t?"text"===t.type&&pZ(t.value):pZ(t))})),mB(n,g,m,a),mz(g,y),n.ancestors.pop(),n.schema=d,n.create(a,m,g,o)):"mdxFlowExpression"===r.type||"mdxTextExpression"===r.type?function(t,r){if(r.data&&r.data.estree&&t.evaluater){let i=r.data.estree.body[0];return pz(i.type),t.evaluater.evaluateExpression(i.expression)}mV(t,r.position)}(t,r):"mdxJsxFlowElement"===r.type||"mdxJsxTextElement"===r.type?(s=t,l=r,u=i,_=v=s.schema,"svg"===l.name&&"html"===v.space&&(s.schema=mv),s.ancestors.push(l),b=null===l.name?s.Fragment:mU(s,l.name,!0),x=function(t,r){let i={};for(let n of r.attributes)if("mdxJsxExpressionAttribute"===n.type)if(n.data&&n.data.estree&&t.evaluater){let r=n.data.estree.body[0];pz(r.type);let a=r.expression;pz(a.type);let o=a.properties[0];pz(o.type),Object.assign(i,t.evaluater.evaluateExpression(o.argument))}else mV(t,r.position);else{let a,o=n.name;if(n.value&&"object"==typeof n.value)if(n.value.data&&n.value.data.estree&&t.evaluater){let r=n.value.data.estree.body[0];pz(r.type),a=t.evaluater.evaluateExpression(r.expression)}else mV(t,r.position);else a=null===n.value||n.value;i[o]=a}return i}(s,l),w=mj(s,l),mB(s,x,b,l),mz(x,w),s.ancestors.pop(),s.schema=v,s.create(l,b,x,u)):"mdxjsEsm"===r.type?function(t,r){if(r.data&&r.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(r.data.estree);mV(t,r.position)}(t,r):"root"===r.type?(c=t,h=r,f=i,mz(E={},mj(c,h)),c.create(h,c.Fragment,E,f)):"text"===r.type?r.value:void 0}function mB(t,r,i,n){"string"!=typeof i&&i!==t.Fragment&&t.passNode&&(r.node=n)}function mz(t,r){if(r.length>0){let i=r.length>1?r:r[0];i&&(t.children=i)}}function mj(t,r){let i=[],n=-1,a=t.passKeys?new Map:mk;for(;++n<r.children.length;){let o,s=r.children[n];if(t.passKeys){let t="element"===s.type?s.tagName:"mdxJsxFlowElement"===s.type||"mdxJsxTextElement"===s.type?s.name:void 0;if(t){let r=a.get(t)||0;o=t+"-"+r,a.set(t,r+1)}}let l=mF(t,s,o);void 0!==l&&i.push(l)}return i}function mU(t,r,i){let n;if(i)if(r.includes(".")){let t,i=r.split("."),a=-1;for(;++a<i.length;){let r=pH(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};t=t?{type:"MemberExpression",object:t,property:r,computed:!!(a&&"Literal"===r.type),optional:!1}:r}pz(),n=t}else n=pH(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};else n={type:"Literal",value:r};if("Literal"===n.type){let r=n.value;return mI.call(t.components,r)?t.components[r]:r}if(t.evaluater)return t.evaluater.evaluateExpression(n);mV(t)}function mV(t,r){let i=new mP("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=mR+"#cannot-handle-mdx-estrees-without-createevaluater",i}function m$(t){return"-"+t.toLowerCase()}let mG={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},mq={};function mH(t,r,i){var n;if((n=t)&&"object"==typeof n){if("value"in t)return"html"!==t.type||i?t.value:"";if(r&&"alt"in t&&t.alt)return t.alt;if("children"in t)return mW(t.children,r,i)}return Array.isArray(t)?mW(t,r,i):""}function mW(t,r,i){let n=[],a=-1;for(;++a<t.length;)n[a]=mH(t[a],r,i);return n.join("")}function mZ(t,r,i,n){let a,o=t.length,s=0;if(r=r<0?-r>o?0:o+r:r>o?o:r,i=i>0?i:0,n.length<1e4)(a=Array.from(n)).unshift(r,i),t.splice(...a);else for(i&&t.splice(r,i);s<n.length;)(a=n.slice(s,s+1e4)).unshift(r,0),t.splice(...a),s+=1e4,r+=1e4}function mY(t,r){return t.length>0?(mZ(t,t.length,0,r),t):r}let mX={}.hasOwnProperty,mK=m9(/[A-Za-z]/),mQ=m9(/[\dA-Za-z]/),mJ=m9(/[#-'*+\--9=?A-Z^-~]/);function m0(t){return null!==t&&(t<32||127===t)}let m1=m9(/\d/),m2=m9(/[\dA-Fa-f]/),m3=m9(/[!-/:-@[-`{-~]/);function m4(t){return null!==t&&t<-2}function m6(t){return null!==t&&(t<0||32===t)}function m5(t){return -2===t||-1===t||32===t}let m8=m9(/\p{P}|\p{S}/u),m7=m9(/\s/);function m9(t){return function(r){return null!==r&&r>-1&&t.test(String.fromCharCode(r))}}
56function ge(t,r,i,n){let a=n?n-1:1/0,o=0;return function(n){return m5(n)?(t.enter(i),function n(s){return m5(s)&&o++<a?(t.consume(s),n):(t.exit(i),r(s))}(n)):r(n)}}let gt={tokenize:function(t){let r,i=t.attempt(this.parser.constructs.contentInitial,function(r){return null===r?void t.consume(r):(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),ge(t,i,"linePrefix"))},function(i){return t.enter("paragraph"),function i(n){let a=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=a),r=a,function r(n){if(null===n){t.exit("chunkText"),t.exit("paragraph"),t.consume(n);return}return m4(n)?(t.consume(n),t.exit("chunkText"),i):(t.consume(n),r)}(n)}(i)});return i}},gr={tokenize:function(t){let r,i,n,a=this,o=[],s=0;return l;function l(r){if(s<o.length){let i=o[s];return a.containerState=i[1],t.attempt(i[0].continuation,u,c)(r)}return c(r)}function u(t){if(s++,a.containerState._closeFlow){let i;a.containerState._closeFlow=void 0,r&&v();let n=a.events.length,o=n;for(;o--;)if("exit"===a.events[o][0]&&"chunkFlow"===a.events[o][1].type){i=a.events[o][1].end;break}y(s);let l=n;for(;l<a.events.length;)a.events[l][1].end={...i},l++;return mZ(a.events,o+1,0,a.events.slice(n)),a.events.length=l,c(t)}return l(t)}
56function c(i){if(s===o.length){if(!r)return d(i);if(r.currentConstruct&&r.currentConstruct.concrete)return m(i);a.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return a.containerState={},t.check(gi,h,f)(i)}function h(t){return r&&v(),y(s),d(t)}function f(t){return a.parser.lazy[a.now().line]=s!==o.length,n=a.now().offset,m(t)}function d(r){return a.containerState={},t.attempt(gi,p,m)(r)}function p(t){return s++,o.push([a.currentConstruct,a.containerState]),d(t)}function m(n){if(null===n){r&&v(),y(0),t.consume(n);return}return r=r||a.parser.flow(a.now()),t.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),function r(i){if(null===i){g(t.exit("chunkFlow"),!0),y(0),t.consume(i);return}return m4(i)?(t.consume(i),g(t.exit("chunkFlow")),s=0,a.interrupt=void 0,l):(t.consume(i),r)}(n)}function g(t,o){let l=a.sliceStream(t);if(o&&l.push(null),t.previous=i,i&&(i.next=t),i=t,r.defineSkip(t.start),r.write(l),a.parser.lazy[t.start.line]){let t,i,o=r.events.length;for(;o--;)if(r.events[o][1].start.offset<n&&(!r.events[o][1].end||r.events[o][1].end.offset>n))return;let l=a.events.length,u=l;for(;u--;)if("exit"===a.events[u][0]&&"chunkFlow"===a.events[u][1].type){if(t){i=a.events[u][1].end;break}t=!0}for(y(s),o=l;o<a.events.length;)a.events[o][1].end={...i},o++;mZ(a.events,u+1,0,a.events.slice(l)),a.events.length=o}}function y(r){let i=o.length;for(;i-- >r;){let r=o[i];a.containerState=r[1],r[0].exit.call(a,t)}o.length=r}function v(){r.write([null]),i=void 0,r=void 0,a.containerState._closeFlow=void 0}}},gi={tokenize:function(t,r,i){return ge(t,t.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},gn={partial:!0,tokenize:function(t,r,i){return function(r){return m5(r)?ge(t,n,"linePrefix")(r):n(r)};function n(t){return null===t||m4(t)?r(t):i(t)}}};class ga{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){let i=null==r?1/0:r;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,r,i){this.setCursor(Math.trunc(t));let n=this.right.splice(this.right.length-(r||0),1/0);return i&&go(this.left,i),n.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(t){this.setCursor(1/0),this.left.push(t)}pushMany(t){this.setCursor(1/0),go(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),go(this.right,t.reverse())}setCursor(t){if(t!==this.left.length&&(!(t>this.left.length)||0!==this.right.length)&&(!(t<0)||0!==this.left.length))if(t<this.left.length){let r=this.left.splice(t,1/0);go(this.right,r.reverse())}else{let r=this.right.splice(this.left.length+this.right.length-t,1/0);go(this.left,r.reverse())}}}function go(t,r){let i=0;if(r.length<1e4)t.push(...r);else for(;i<r.length;)t.push(...r.slice(i,i+1e4)),i+=1e4}function gs(t){let r,i,n,a,o,s,l,u={},c=-1,h=new ga(t);for(;++c<h.length;){for(;c in u;)c=u[c];if(r=h.get(c),c&&"chunkFlow"===r[1].type&&"listItemPrefix"===h.get(c-1)[1].type&&((n=0)<(s=r[1]._tokenizer.events).length&&"lineEndingBlank"===s[n][1].type&&(n+=2),n<s.length&&"content"===s[n][1].type))for(;++n<s.length&&"content"!==s[n][1].type;)"chunkText"===s[n][1].type&&(s[n][1]._isInFirstContentOfListItem=!0,n++);if("enter"===r[0])r[1].contentType&&(Object.assign(u,function(t,r){let i,n,a=t.get(r)[1],o=t.get(r)[2],s=r-1,l=[],u=a._tokenizer;!u&&(u=o.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));let c=u.events,h=[],f={},d=-1,p=a,m=0,g=0,y=[0];for(;p;){for(;t.get(++s)[1]!==p;);l.push(s),!p._tokenizer&&(i=o.sliceStream(p),p.next||i.push(null),n&&u.defineSki
56p(p.start),p._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(i),p._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),n=p,p=p.next}for(p=a;++d<c.length;)"exit"===c[d][0]&&"enter"===c[d-1][0]&&c[d][1].type===c[d-1][1].type&&c[d][1].start.line!==c[d][1].end.line&&(g=d+1,y.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(u.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),d=y.length;d--;){let r=c.slice(y[d],y[d+1]),i=l.pop();h.push([i,i+r.length-1]),t.splice(i,2,r)}for(h.reverse(),d=-1;++d<h.length;)f[m+h[d][0]]=m+h[d][1],m+=h[d][1]-h[d][0]-1;return f}(h,c)),c=u[c],l=!0);else if(r[1]._container){for(n=c,i=void 0;n--;)if("lineEnding"===(a=h.get(n))[1].type||"lineEndingBlank"===a[1].type)"enter"===a[0]&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=n);else if("linePrefix"===a[1].type||"listItemIndent"===a[1].type);else break;i&&(r[1].end={...h.get(i)[1].start},(o=h.slice(i,c)).unshift(r),h.splice(i,c-i+1,o))}}return mZ(t,0,1/0,h.slice(0)),!l}let gl={resolve:function(t){return gs(t),t},tokenize:function(t,r){let i;return function(r){return t.enter("content"),i=t.enter("chunkContent",{contentType:"content"}),n(r)};function n(r){return null===r?a(r):m4(r)?t.check(gu,o,a)(r):(t.consume(r),n)}function a(i){return t.exit("chunkContent"),t.exit("content"),r(i)}function o(r){return t.consume(r),t.exit("chunkContent"),i.next=t.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,n}}},gu={partial:!0,tokenize:function(t,r,i){let n=this;return function(r){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),ge(t,a,"linePrefix")};function a(a){if(null===a||m4(a))return i(a);let o=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?r(a):t.interrupt(n.parser.constructs.flow,i,r)(a)}}},gc={tokenize:function(t){let r=this,i=t.attempt(gn,function(n){return null===n?void t.consume(n):(t.enter("lineEndingBlank"),t.consume(n),t.exit("lineEndingBlank"),r.currentConstruct=void 0,i)},t.attempt(this.parser.constructs.flowInitial,n,ge(t,t.attempt(this.parser.constructs.flow,n,t.attempt(gl,n)),"linePrefix")));return i;function n(n){return null===n?void t.consume(n):(t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),r.currentConstruct=void 0,i)}}},gh={resolveAll:gm()},gf=gp("string"),gd=gp("text");function gp(t){return{resolveAll:gm("text"===t?gg:void 0),tokenize:function(r){let i=this,n=this.parser.constructs[t],a=r.attempt(n,o,s);return o;function o(t){return u(t)?a(t):s(t)}function s(t){return null===t?void r.consume(t):(r.enter("data"),r.consume(t),l)}function l(t){return u(t)?(r.exit("data"),a(t)):(r.consume(t),l)}function u(t){if(null===t)return!0;let r=n[t],a=-1;if(r)for(;++a<r.length;){let t=r[a];if(!t.previous||t.previous.call(i,i.previous))return!0}return!1}}}}function gm(t){return function(r,i){let n,a=-1;for(;++a<=r.length;)void 0===n?r[a]&&"data"===r[a][1].type&&(n=a,a++):r[a]&&"data"===r[a][1].type||(a!==n+2&&(r[n][1].end=r[a-1][1].end,r.splice(n+2,a-n-2),a=n+2),n=void 0);return t?t(r,i):r}}function gg(t,r){let i=0;for(;++i<=t.length;)if((i===t.length||"lineEnding"===t[i][1].type)&&"data"===t[i-1][1].type){let n,a=t[i-1][1],o=r.sliceStream(a),s=o.length,l=-1,u=0;for(;s--;){let t=o[s];if("string"==typeof t){for(l=t.length;32===t.charCodeAt(l-1);)u++,l--;if(l)break;l=-1}else if(-2===t)n=!0,u++;else if(-1===t);else{s++;break}}if(r._contentTypeTextTrailing&&i===t.length&&(u=0),u){let o={type:i===t.length||n||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:a.start._bufferIndex+l,_index:a.start._index+s,line:a.end.line,column:a.end.column-u,offset:a.end.offset-u},end:{...a.end}};a.end={...o.start},a.start.offset===a.end.offset?Object.assign(a,o):(t.splice(i,0,["enter",o,r],["exit",o,r]),i+=2)}i++}return t}function gy(t){return null===t||m6(t)||m7(t)?1:m8(t)?2:void 0}function gv(t,r,i){let n=[],a=-1;for(;++a<t.length;){let o=t[a].resolveAll;o&&!n.includes(o)&&(r=o(r,i),n.push(o))}return r}let g_={name:"attention",resolveAll:function(t,r){let i,n,a,o,s,l,u,c,h=-1;for(;++h<t.length;)if("enter"===t[h][0]&&"attentionSequence"===t[h][1].type&&t[h][1]._close){for(i=h;i--;)if("exit"===t[i][0]&&"attentionSequence"===t[i][1].type&&t[i][1]._open&&r.sliceSerialize(t[i][1]).charCo
56deAt(0)===r.sliceSerialize(t[h][1]).charCodeAt(0)){if((t[i][1]._close||t[h][1]._open)&&(t[h][1].end.offset-t[h][1].start.offset)%3&&!((t[i][1].end.offset-t[i][1].start.offset+t[h][1].end.offset-t[h][1].start.offset)%3))continue;l=t[i][1].end.offset-t[i][1].start.offset>1&&t[h][1].end.offset-t[h][1].start.offset>1?2:1;let f={...t[i][1].end},d={...t[h][1].start};gb(f,-l),gb(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[i][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...t[h][1].start},end:d},a={type:l>1?"strongText":"emphasisText",start:{...t[i][1].end},end:{...t[h][1].start}},n={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},t[i][1].end={...o.start},t[h][1].start={...s.end},u=[],t[i][1].end.offset-t[i][1].start.offset&&(u=mY(u,[["enter",t[i][1],r],["exit",t[i][1],r]])),u=mY(u,[["enter",n,r],["enter",o,r],["exit",o,r],["enter",a,r]]),u=mY(u,gv(r.parser.constructs.insideSpan.null,t.slice(i+1,h),r)),u=mY(u,[["exit",a,r],["enter",s,r],["exit",s,r],["exit",n,r]]),t[h][1].end.offset-t[h][1].start.offset?(c=2,u=mY(u,[["enter",t[h][1],r],["exit",t[h][1],r]])):c=0,mZ(t,i-1,h-i+3,u),h=i+u.length-c-2;break}}for(h=-1;++h<t.length;)"attentionSequence"===t[h][1].type&&(t[h][1].type="data");return t},tokenize:function(t,r){let i,n=this.parser.constructs.attentionMarkers.null,a=this.previous,o=gy(a);return function(s){return i=s,t.enter("attentionSequence"),function s(l){if(l===i)return t.consume(l),s;let u=t.exit("attentionSequence"),c=gy(l),h=!c||2===c&&o||n.includes(l),f=!o||2===o&&c||n.includes(a);return u._open=!!(42===i?h:h&&(o||!f)),u._close=!!(42===i?f:f&&(c||!h)),r(l)}(s)}}};function gb(t,r){t.column+=r,t.offset+=r,t._bufferIndex+=r}let gx={continuation:{tokenize:function(t,r,i){let n=this;return function(r){return m5(r)?ge(t,a,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(r):a(r)};function a(n){return t.attempt(gx,r,i)(n)}}},exit:function(t){t.exit("blockQuote")},name:"blockQuote",tokenize:function(t,r,i){let n=this;return function(r){if(62===r){let i=n.containerState;return i.open||(t.enter("blockQuote",{_container:!0}),i.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(r),t.exit("blockQuoteMarker"),a}return i(r)};function a(i){return m5(i)?(t.enter("blockQuotePrefixWhitespace"),t.consume(i),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),r):(t.exit("blockQuotePrefix"),r(i))}}},gw={name:"characterEscape",tokenize:function(t,r,i){return function(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),n};function n(n){return m3(n)?(t.enter("characterEscapeValue"),t.consume(n),t.exit("characterEscapeValue"),t.exit("characterEscape"),r):i(n)}}},gE=document.createElement("i");function gT(t){let r="&"+t+";";gE.innerHTML=r;let i=gE.textContent;return(59!==i.charCodeAt(i.length-1)||"semi"===t)&&i!==r&&i}let gA={name:"characterReference",tokenize:function(t,r,i){let n,a,o=this,s=0;return function(r){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(r),t.exit("characterReferenceMarker"),l};function l(r){return 35===r?(t.enter("characterReferenceMarkerNumeric"),t.consume(r),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),n=31,a=mQ,c(r))}function u(r){return 88===r||120===r?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(r),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),n=6,a=m2,c):(t.enter("characterReferenceValue"),n=7,a=m1,c(r))}function c(l){if(59===l&&s){let n=t.exit("characterReferenceValue");return a!==mQ||gT(o.sliceSerialize(n))?(t.enter("characterReferenceMarker"),t.consume(l),t.exit("characterReferenceMarker"),t.exit("characterReference"),r):i(l)}return a(l)&&s++<n?(t.consume(l),c):i(l)}}},gS={partial:!0,tokenize:function(t,r,i){let n=this;return function(r){return null===r?i(r):(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),a)};function a(t){return n.parser.lazy[n.now().line]?i(t):r(t)}}},gC={concrete:!0,name:"codeFenced",tokenize:function(t,r,i){let n,a=this,o={partial:!0,tokenize:function(t,r,i){let o=0;return function(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),s};
56function s(r){return t.enter("codeFencedFence"),m5(r)?ge(t,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(r):u(r)}function u(r){return r===n?(t.enter("codeFencedFenceSequence"),function r(a){return a===n?(o++,t.consume(a),r):o>=l?(t.exit("codeFencedFenceSequence"),m5(a)?ge(t,c,"whitespace")(a):c(a)):i(a)}(r)):i(r)}function c(n){return null===n||m4(n)?(t.exit("codeFencedFence"),r(n)):i(n)}}},s=0,l=0;return function(r){var o;let c;return o=r,s=(c=a.events[a.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,n=o,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),function r(a){return a===n?(l++,t.consume(a),r):l<3?i(a):(t.exit("codeFencedFenceSequence"),m5(a)?ge(t,u,"whitespace")(a):u(a))}(o)};function u(o){return null===o||m4(o)?(t.exit("codeFencedFence"),a.interrupt?r(o):t.check(gS,h,m)(o)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),function r(a){return null===a||m4(a)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),u(a)):m5(a)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),ge(t,c,"whitespace")(a)):96===a&&a===n?i(a):(t.consume(a),r)}(o))}function c(r){return null===r||m4(r)?u(r):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),function r(a){return null===a||m4(a)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),u(a)):96===a&&a===n?i(a):(t.consume(a),r)}(r))}function h(r){return t.attempt(o,m,f)(r)}function f(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),d}function d(r){return s>0&&m5(r)?ge(t,p,"linePrefix",s+1)(r):p(r)}function p(r){return null===r||m4(r)?t.check(gS,h,m)(r):(t.enter("codeFlowValue"),function r(i){return null===i||m4(i)?(t.exit("codeFlowValue"),p(i)):(t.consume(i),r)}(r))}function m(i){return t.exit("codeFenced"),r(i)}}},gM={name:"codeIndented",tokenize:function(t,r,i){let n=this;return function(r){return t.enter("codeIndented"),ge(t,a,"linePrefix",5)(r)};function a(r){let a=n.events[n.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?function r(i){return null===i?o(i):m4(i)?t.attempt(gD,r,o)(i):(t.enter("codeFlowValue"),function i(n){return null===n||m4(n)?(t.exit("codeFlowValue"),r(n)):(t.consume(n),i)}(i))}(r):i(r)}function o(i){return t.exit("codeIndented"),r(i)}}},gD={partial:!0,tokenize:function(t,r,i){let n=this;return a;function a(r){return n.parser.lazy[n.now().line]?i(r):m4(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),a):ge(t,o,"linePrefix",5)(r)}function o(t){let o=n.events[n.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?r(t):m4(t)?a(t):i(t)}}};function gP(t,r,i,n,a,o,s,l,u){let c=u||1/0,h=0;return function(r){return 60===r?(t.enter(n),t.enter(a),t.enter(o),t.consume(r),t.exit(o),f):null===r||32===r||41===r||m0(r)?i(r):(t.enter(n),t.enter(s),t.enter(l),t.enter("chunkString",{contentType:"string"}),m(r))};function f(i){return 62===i?(t.enter(o),t.consume(i),t.exit(o),t.exit(a),t.exit(n),r):(t.enter(l),t.enter("chunkString",{contentType:"string"}),d(i))}function d(r){return 62===r?(t.exit("chunkString"),t.exit(l),f(r)):null===r||60===r||m4(r)?i(r):(t.consume(r),92===r?p:d)}function p(r){return 60===r||62===r||92===r?(t.consume(r),d):d(r)}function m(a){return!h&&(null===a||41===a||m6(a))?(t.exit("chunkString"),t.exit(l),t.exit(s),t.exit(n),r(a)):h<c&&40===a?(t.consume(a),h++,m):41===a?(t.consume(a),h--,m):null===a||32===a||40===a||m0(a)?i(a):(t.consume(a),92===a?g:m)}function g(r){return 40===r||41===r||92===r?(t.consume(r),m):m(r)}}function gI(t,r,i,n,a,o){let s,l=this,u=0;return function(r){return t.enter(n),t.enter(a),t.consume(r),t.exit(a),t.enter(o),c};function c(f){return u>999||null===f||91===f||93===f&&!s||94===f&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?i(f):93===f?(t.exit(o),t.enter(a),t.consume(f),t.exit(a),t.exit(n),r):m4(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),h(f))}function h(r){return null===r||91===r||93===r||m4(r)||u++>999?(t.exit("chunkString"),c(r)):(t.consume(r),s||(s=!m5(r)),92===r?f:h)}function f(r){return 91===r||92===r||93===r?(t.consume(r),u++,h):h(r)}}function gk(t,r,i,n,a,o){let s;return function(r){return 34===r||39===r||40===r?(t.enter(n),t.enter(a),t.consume(r),t.exit(a),s=40===r?41:r,l):i(r)};function l(i){return i===s?(t.enter(a),t.consume(i),t.exit(a),t.exit(n),r):(t.enter(o),u(i))}function u(r){return r===s?(t.exit(o),l(s)):null===r?i(r):m4(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),ge(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(r))}function c(r){return r===s||null===r||m4(r)?(t.exit("chunkString"),u(r)):(t.consume(r),92===r?h:c)}function h(r){return r===s||92===r?(t.consume(r),c):c(r)}}function gO(t,r){let i;return function n(a){return m4(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i=!0,n):m5(a)?ge(t,n,i?"linePrefix":"lineSuffix")(a):r(a)}}function gN(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let gL={partial:!0,tokenize:function(t,r,i){return function(r){return m6(r)?gO(t,n)(r):i(r)};function n(r){return gk(t,a,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(r)}function a(r){return m5(r)?ge(t,o,"whitespace")(r):o(r)}function o(t){return null===t||m4(t)?r(t):i(t)}}},gR=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],gF=["pre","script","style","textarea"],gB={partial:!0,tokenize:function(t,r,i){return function(n){return t.enter("lineEnding"),t.consume(n),t.exit("lineEnding"),t.attempt(gn,r,i)}}},gz={partial:!0,tokenize:function(t,r,i){let n=this;return function(r){return m4(r)?(t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),a):i(r)};function a(t){return n.parser.lazy[n.now().line]?i(t):r(t)}}},gj={name:"labelEnd",resolveAll:function(t){let r=-1,i=[];for(;++r<t.length;){let n=t[r][1];if(i.push(t[r]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){let t="labelImage"===n.type?4:2;n.type="data",r+=t}}return t.length!==i.length&&mZ(t,0,t.length,i),t},resolveTo:function(t,r){let i,n,a,o,s=t.length,l=0;for(;s--;
56)if(i=t[s][1],n){if("link"===i.type||"labelLink"===i.type&&i._inactive)break;"enter"===t[s][0]&&"labelLink"===i.type&&(i._inactive=!0)}else if(a){if("enter"===t[s][0]&&("labelImage"===i.type||"labelLink"===i.type)&&!i._balanced&&(n=s,"labelLink"!==i.type)){l=2;break}}else"labelEnd"===i.type&&(a=s);let u={type:"labelLink"===t[n][1].type?"link":"image",start:{...t[n][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[n][1].start},end:{...t[a][1].end}},h={type:"labelText",start:{...t[n+l+2][1].end},end:{...t[a-2][1].start}};return o=mY(o=[["enter",u,r],["enter",c,r]],t.slice(n+1,n+l+3)),o=mY(o,[["enter",h,r]]),o=mY(o,gv(r.parser.constructs.insideSpan.null,t.slice(n+l+4,a-3),r)),o=mY(o,[["exit",h,r],t[a-2],t[a-1],["exit",c,r]]),o=mY(o,t.slice(a+1)),o=mY(o,[["exit",u,r]]),mZ(t,n,t.length,o),t},tokenize:function(t,r,i){let n,a,o=this,s=o.events.length;for(;s--;)if(("labelImage"===o.events[s][1].type||"labelLink"===o.events[s][1].type)&&!o.events[s][1]._balanced){n=o.events[s][1];break}return function(r){return n?n._inactive?h(r):(a=o.parser.defined.includes(gN(o.sliceSerialize({start:n.end,end:o.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(r),t.exit("labelMarker"),t.exit("labelEnd"),l):i(r)};function l(r){return 40===r?t.attempt(gU,c,a?c:h)(r):91===r?t.attempt(gV,c,a?u:h)(r):a?c(r):h(r)}function u(r){return t.attempt(g$,c,h)(r)}function c(t){return r(t)}function h(t){return n._balanced=!0,i(t)}}},gU={tokenize:function(t,r,i){return function(r){return t.enter("resource"),t.enter("resourceMarker"),t.consume(r),t.exit("resourceMarker"),n};function n(r){return m6(r)?gO(t,a)(r):a(r)}function a(r){return 41===r?c(r):gP(t,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(r)}function o(r){return m6(r)?gO(t,l)(r):c(r)}function s(t){return i(t)}function l(r){return 34===r||39===r||40===r?gk(t,u,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(r):c(r)}function u(r){return m6(r)?gO(t,c)(r):c(r)}function c(n){return 41===n?(t.enter("resourceMarker"),t.consume(n),t.exit("resourceMarker"),t.exit("resource"),r):i(n)}}},gV={tokenize:function(t,r,i){let n=this;return function(r){return gI.call(n,t,a,o,"reference","referenceMarker","referenceString")(r)};function a(t){return n.parser.defined.includes(gN(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?r(t):i(t)}function o(t){return i(t)}}},g$={tokenize:function(t,r,i){return function(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),n};function n(n){return 93===n?(t.enter("referenceMarker"),t.consume(n),t.exit("referenceMarker"),t.exit("reference"),r):i(n)}}},gG={name:"labelStartImage",resolveAll:gj.resolveAll,tokenize:function(t,r,i){let n=this;return function(r){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(r),t.exit("labelImageMarker"),a};function a(r){return 91===r?(t.enter("labelMarker"),t.consume(r),t.exit("labelMarker"),t.exit("labelImage"),o):i(r)}function o(t){return 94===t&&"_hiddenFootnoteSupport"in n.parser.constructs?i(t):r(t)}}},gq={name:"labelStartLink",resolveAll:gj.resolveAll,tokenize:function(t,r,i){let n=this;return function(r){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(r),t.exit("labelMarker"),t.exit("labelLink"),a};function a(t){return 94===t&&"_hiddenFootnoteSupport"in n.parser.constructs?i(t):r(t)}}},gH={name:"lineEnding",tokenize:function(t,r){return function(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),ge(t,r,"linePrefix")}}},gW={name:"thematicBreak",tokenize:function(t,r,i){let n,a=0;return function(o){var s;return t.enter("thematicBreak"),n=s=o,function o(s){return s===n?(t.enter("thematicBreakSequence"),function r(i){return i===n?(t.consume(i),a++,r):(t.exit("thematicBreakSequence"),m5(i)?ge(t,o,"whitespace")(i):o(i))}(s)):a>=3&&(null===s||m4(s))?(t.exit("thematicBreak"),r(s)):i(s)}(s)}}},gZ={continuation:{tokenize:function(t,r,i){let n=this;return n.containerState._closeFlow=void 0,t.check(gn,function(i){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ge(t,r,"listItemIndent",n.containerState.size+1)(i)},function(i){return n.containerState.furtherBlankLines||!m5(i)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine
56=void 0,a(i)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,t.attempt(gX,r,a)(i))});function a(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,ge(t,t.attempt(gZ,r,i),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(t){t.exit(this.containerState.type)},name:"list",tokenize:function(t,r,i){let n=this,a=n.events[n.events.length-1],o=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,s=0;return function(r){let a=n.containerState.type||(42===r||43===r||45===r?"listUnordered":"listOrdered");if("listUnordered"===a?!n.containerState.marker||r===n.containerState.marker:m1(r)){if(n.containerState.type||(n.containerState.type=a,t.enter(a,{_container:!0})),"listUnordered"===a)return t.enter("listItemPrefix"),42===r||45===r?t.check(gW,i,l)(r):l(r);if(!n.interrupt||49===r)return t.enter("listItemPrefix"),t.enter("listItemValue"),function r(a){return m1(a)&&++s<10?(t.consume(a),r):(!n.interrupt||s<2)&&(n.containerState.marker?a===n.containerState.marker:41===a||46===a)?(t.exit("listItemValue"),l(a)):i(a)}(r)}return i(r)};function l(r){return t.enter("listItemMarker"),t.consume(r),t.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||r,t.check(gn,n.interrupt?i:u,t.attempt(gY,h,c))}
56function u(t){return n.containerState.initialBlankLine=!0,o++,h(t)}function c(r){return m5(r)?(t.enter("listItemPrefixWhitespace"),t.consume(r),t.exit("listItemPrefixWhitespace"),h):i(r)}function h(i){return n.containerState.size=o+n.sliceSerialize(t.exit("listItemPrefix"),!0).length,r(i)}}},gY={partial:!0,tokenize:function(t,r,i){let n=this;return ge(t,function(t){let a=n.events[n.events.length-1];return!m5(t)&&a&&"listItemPrefixWhitespace"===a[1].type?r(t):i(t)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},gX={partial:!0,tokenize:function(t,r,i){let n=this;return ge(t,function(t){let a=n.events[n.events.length-1];return a&&"listItemIndent"===a[1].type&&a[2].sliceSerialize(a[1],!0).length===n.containerState.size?r(t):i(t)},"listItemIndent",n.containerState.size+1)}},gK={name:"setextUnderline",resolveTo:function(t,r){let i,n,a,o=t.length;for(;o--;)if("enter"===t[o][0]){if("content"===t[o][1].type){i=o;break}"paragraph"===t[o][1].type&&(n=o)}else"content"===t[o][1].type&&t.splice(o,1),a||"definition"!==t[o][1].type||(a=o);let s={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[n][1].type="setextHeadingText",a?(t.splice(n,0,["enter",s,r]),t.splice(a+1,0,["exit",t[i][1],r]),t[i][1].end={...t[a][1].end}):t[i][1]=s,t.push(["exit",s,r]),t},tokenize:function(t,r,i){let n,a=this;return function(r){var s;let l,u=a.events.length;for(;u--;)if("lineEnding"!==a.events[u][1].type&&"linePrefix"!==a.events[u][1].type&&"content"!==a.events[u][1].type){l="paragraph"===a.events[u][1].type;break}return!a.parser.lazy[a.now().line]&&(a.interrupt||l)?(t.enter("setextHeadingLine"),n=r,s=r,t.enter("setextHeadingLineSequence"),function r(i){return i===n?(t.consume(i),r):(t.exit("setextHeadingLineSequence"),m5(i)?ge(t,o,"lineSuffix")(i):o(i))}(s)):i(r)};function o(n){return null===n||m4(n)?(t.exit("setextHeadingLine"),r(n)):i(n)}}};t.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(t,r,i){let n,a=this;return function(r){var n;return t.enter("definition"),n=r,gI.call(a,t,o,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(n)};function o(r){return(n=gN(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),58===r)?(t.enter("definitionMarker"),t.consume(r),t.exit("definitionMarker"),s):i(r)}function s(r){return m6(r)?gO(t,l)(r):l(r)}function l(r){return gP(t,u,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(r)}function u(r){return t.attempt(gL,c,c)(r)}function c(r){return m5(r)?ge(t,h,"whitespace")(r):h(r)}function h(o){return null===o||m4(o)?(t.exit("definition"),a.parser.defined.push(n),r(o)):i(o)}}}},"disable",0,{null:[]},"document",0,{42:gZ,43:gZ,45:gZ,48:gZ,49:gZ,50:gZ,51:gZ,52:gZ,53:gZ,54:gZ,55:gZ,56:gZ,57:gZ,62:gx},"flow",0,{35:{name:"headingAtx",resolve:function(t,r){let i,n,a=t.length-2,o=3;return"whitespace"===t[3][1].type&&(o+=2),a-2>o&&"whitespace"===t[a][1].type&&(a-=2),"atxHeadingSequence"===t[a][1].type&&(o===a-1||a-4>o&&"whitespace"===t[a-2][1].type)&&(a-=o+1===a?2:4),a>o&&(i={type:"atxHeadingText",start:t[o][1].start,end:t[a][1].end},n={type:"chunkText",start:t[o][1].start,end:t[a][1].end,contentType:"text"},mZ(t,o,a-o+1,[["enter",i,r],["enter",n,r],["exit",n,r],["exit",i,r]])),t},tokenize:function(t,r,i){let n=0;return function(a){var o;return t.enter("atxHeading"),o=a,t.enter("atxHeadingSequence"),function a(o){return 35===o&&n++<6?(t.consume(o),a):null===o||m6(o)?(t.exit("atxHeadingSequence"),function i(n){return 35===n?(t.enter("atxHeadingSequence"),function r(n){return 35===n?(t.consume(n),r):(t.exit("atxHeadingSequence"),i(n))}(n)):null===n||m4(n)?(t.exit("atxHeading"),r(n)):m5(n)?ge(t,i,"whitespace")(n):(t.enter("atxHeadingText"),function r(n){return null===n||35===n||m6(n)?(t.exit("atxHeadingText"),i(n)):(t.consume(n),r)}(n))}(o)):i(o)}(o)}}},42:gW,45:[gK,gW],60:{concrete:!0,name:"htmlFlow",resolveTo:function(t){let r=t.length;for(;r--&&("enter"!==t[r][0]||"htmlFlow"!==t[r][1].type););return r>1&&"linePrefix"===t[r-2][1].type&&(t[r][1].start=t[r-2][1].start,t[r+1][1].start=t[r-2][1].start,t.splice(r-2,2)),t},tokenize:function(t,r,i){let n,a,o,s,l,u=this;return function(r){var i;return i=r,t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(i),c};function c(s){return 33===s?(t.consume(s),h):47===s?(t.consume(s),a=!0,p):63===s?(t.consume(s),n=3,u.interrupt?r:O):mK(s)?(t.consume(s),o=String.fromCharCode(s),m):i(s)}function h(a){return 45===a?(t.consume(a),n=2,f):91===a?(t.consume(a),n=5,s=0,d):mK(a)?(t.consume(a),n=4,u.interrupt?r:O):i(a)}function f(n){return 45===n?(t.consume(n),u.interrupt?r:O):i(n)}function d(n){let a="CDATA[";
56return n===a.charCodeAt(s++)?(t.consume(n),s===a.length)?u.interrupt?r:A:d:i(n)}function p(r){return mK(r)?(t.consume(r),o=String.fromCharCode(r),m):i(r)}function m(s){if(null===s||47===s||62===s||m6(s)){let l=47===s,c=o.toLowerCase();return!l&&!a&&gF.includes(c)?(n=1,u.interrupt?r(s):A(s)):gR.includes(o.toLowerCase())?(n=6,l)?(t.consume(s),g):u.interrupt?r(s):A(s):(n=7,u.interrupt&&!u.parser.lazy[u.now().line]?i(s):a?function r(i){return m5(i)?(t.consume(i),r):E(i)}(s):y(s))}return 45===s||mQ(s)?(t.consume(s),o+=String.fromCharCode(s),m):i(s)}function g(n){return 62===n?(t.consume(n),u.interrupt?r:A):i(n)}function y(r){return 47===r?(t.consume(r),E):58===r||95===r||mK(r)?(t.consume(r),v):m5(r)?(t.consume(r),y):E(r)}function v(r){return 45===r||46===r||58===r||95===r||mQ(r)?(t.consume(r),v):_(r)}function _(r){return 61===r?(t.consume(r),b):m5(r)?(t.consume(r),_):y(r)}function b(r){return null===r||60===r||61===r||62===r||96===r?i(r):34===r||39===r?(t.consume(r),l=r,x):m5(r)?(t.consume(r),b):function r(i){return null===i||34===i||39===i||47===i||60===i||61===i||62===i||96===i||m6(i)?_(i):(t.consume(i),r)}(r)}function x(r){return r===l?(t.consume(r),l=null,w):null===r||m4(r)?i(r):(t.consume(r),x)}function w(t){return 47===t||62===t||m5(t)?y(t):i(t)}function E(r){return 62===r?(t.consume(r),T):i(r)}function T(r){return null===r||m4(r)?A(r):m5(r)?(t.consume(r),T):i(r)}function A(r){return 45===r&&2===n?(t.consume(r),D):60===r&&1===n?(t.consume(r),P):62===r&&4===n?(t.consume(r),N):63===r&&3===n?(t.consume(r),O):93===r&&5===n?(t.consume(r),k):m4(r)&&(6===n||7===n)?(t.exit("htmlFlowData"),t.check(gB,L,S)(r)):null===r||m4(r)?(t.exit("htmlFlowData"),S(r)):(t.consume(r),A)}function S(r){return t.check(gz,C,L)(r)}function C(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),M}function M(r){return null===r||m4(r)?S(r):(t.enter("htmlFlowData"),A(r))}function D(r){return 45===r?(t.consume(r),O):A(r)}function P(r){return 47===r?(t.consume(r),o="",I):A(r)}function I(r){if(62===r){let i=o.toLowerCase();return gF.includes(i)?(t.consume(r),N):A(r)}return mK(r)&&o.length<8?(t.consume(r),o+=String.fromCharCode(r),I):A(r)}function k(r){return 93===r?(t.consume(r),O):A(r)}function O(r){return 62===r?(t.consume(r),N):45===r&&2===n?(t.consume(r),O):A(r)}function N(r){return null===r||m4(r)?(t.exit("htmlFlowData"),L(r)):(t.consume(r),N)}function L(i){return t.exit("htmlFlow"),r(i)}}},61:gK,95:gW,96:gC,126:gC},"flowInitial",0,{[-2]:gM,[-1]:gM,32:gM},"insideSpan",0,{null:[g_,gh]},"string",0,{38:gA,92:gw},"text",0,{[-5]:gH,[-4]:gH,[-3]:gH,33:gG,38:gA,42:g_,60:[{name:"autolink",tokenize:function(t,r,i){let n=0;return function(r){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(r),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),a};function a(r){return mK(r)?(t.consume(r),o):64===r?i(r):l(r)}function o(r){return 43===r||45===r||46===r||mQ(r)?(n=1,function r(i){return 58===i?(t.consume(i),n=0,s):(43===i||45===i||46===i||mQ(i))&&n++<32?(t.consume(i),r):(n=0,l(i))}(r)):l(r)}function s(n){return 62===n?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(n),t.exit("autolinkMarker"),t.exit("autolink"),r):null===n||32===n||60===n||m0(n)?i(n):(t.consume(n),s)}function l(r){return 64===r?(t.consume(r),u):mJ(r)?(t.consume(r),l):i(r)}function u(a){return mQ(a)?function a(o){return 46===o?(t.consume(o),n=0,u):62===o?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(o),t.exit("autolinkMarker"),t.exit("autolink"),r):function r(o){if((45===o||mQ(o))&&n++<63){let i=45===o?r:a;return t.consume(o),i}return i(o)}(o)}(a):i(a)}}},{name:"htmlText",tokenize:function(t,r,i){let n,a,o,s=this;return function(r){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(r),l};function l(r){return 33===r?(t.consume(r),u):47===r?(t.consume(r),x):63===r?(t.consume(r),_):mK(r)?(t.consume(r),E):i(r)}function u(r){return 45===r?(t.consume(r),c):91===r?(t.consume(r),a=0,p):mK(r)?(t.consume(r),v):i(r)}function c(r){return 45===r?(t.consume(r),d):i(r)}function h(r){return null===r?i(r):45===r?(t.consume(r),f):m4(r)?(o=h,I(r)):(t.consume(r),h)}function f(r){return 45===r?(t.consume(r),d):h(r)}function d(t){return 62===t?P(t):45===t?f(t):h(t)}function p(r){let n="CDATA[";return r===n.charCodeAt(a++)?(t.consume(r),a===n.length?m:p):i(r)}function m(r){return null===r?i(r):93===r?(t.consume(r),g):m4(r)?(o=m,I(r)):(t.consume(r),m)}function g(r){return 93===r?(t.consume(r),y):m(r)}function y(r){return 62===r?P(r):93===r?(t.consume(r),y):m(r)}function v(r){return null===r||62===r?P(r):m4(r)?(o=v,I(r)):(t.consume(r),v)}function _(r){return null===r?i(r):63===r?(t.consume(r),b):m4(r)?(o=_,I(r)):(t.consume(r),_)}function b(t){return 62===t?P(t):_(t)}function x(r){return mK(r)?(t.consume(r),w):i(r)}function w(r){return 45===r||mQ(r)?(t.consume(r),w):function r(i){return m4(i)?(o=r,I(i)):m5(i)?(t.consume(i),r):P(i)}(r)}function E(r){return 45===r||mQ(r)?(t.consume(r),E):47===r||62===r||m6(r)?T(r):i(r)}function T(r){return 47===r?(t.consume(r),P):58===r||95===r||mK(r)?(t.consume(r),A):m4(r)?(o=T,I(r)):m5(r)?(t.consume(r),T):P(r)}function A(r){return 45===r||46===r||58===r||95===r||mQ(r)?(t.consume(r),A):function r(i){return 61===i?(t.consume(i),S):m4(i)?(o=r,I(i)):m5(i)?(t.consume(i),r):T(i)}(r)}function S(r){return null===r||60===r||61===r||62===r||96===r?i(r):34===r||39===r?(t.consume(r),n=r,C):m4(r)?(o=S,I(r)):m5(r)?(t.consume(r),S):(t.consume(r),M)}function C(r){return r===n?(t.consume(r),n=void 0,D):null===r?i(r):m4(r)?(o=C,I(r)):(t.consume(r),C)}function M(r){return null===r||34===r||39===r||60===r||61===r||96===r?i(r):47===r||62===r||m6(r)?T(r):(t.consume(r),M)}function D(t){return 47===t||62===t||m6(t)?T(t):i(t)}function P(n){return 62===n?(t.consume(n),t.exit("htmlTextData"),t.exit("htmlText"),r):i(n)}function I(r){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),k}function k(r){return m5(r)?ge(t,O,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(r):O(r)}function O(r){return t.enter("htmlTextData"),o(r)}
56}}],91:gq,92:[{name:"hardBreakEscape",tokenize:function(t,r,i){return function(r){return t.enter("hardBreakEscape"),t.consume(r),n};function n(n){return m4(n)?(t.exit("hardBreakEscape"),r(n)):i(n)}}},gw],93:gj,95:g_,96:{name:"codeText",previous:function(t){return 96!==t||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(t){let r,i,n=t.length-4,a=3;if(("lineEnding"===t[3][1].type||"space"===t[a][1].type)&&("lineEnding"===t[n][1].type||"space"===t[n][1].type)){for(r=a;++r<n;)if("codeTextData"===t[r][1].type){t[a][1].type="codeTextPadding",t[n][1].type="codeTextPadding",a+=2,n-=2;break}}for(r=a-1,n++;++r<=n;)void 0===i?r!==n&&"lineEnding"!==t[r][1].type&&(i=r):(r===n||"lineEnding"===t[r][1].type)&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return t},tokenize:function(t,r,i){let n,a,o=0;return function(r){return t.enter("codeText"),t.enter("codeTextSequence"),function r(i){return 96===i?(t.consume(i),o++,r):(t.exit("codeTextSequence"),s(i))}(r)};function s(u){return null===u?i(u):32===u?(t.enter("space"),t.consume(u),t.exit("space"),s):96===u?(a=t.enter("codeTextSequence"),n=0,function i(s){return 96===s?(t.consume(s),n++,i):n===o?(t.exit("codeTextSequence"),t.exit("codeText"),r(s)):(a.type="codeTextData",l(s))}(u)):m4(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),s):(t.enter("codeTextData"),l(u))}function l(r){return null===r||32===r||96===r||m4(r)?(t.exit("codeTextData"),s(r)):(t.consume(r),l)}}}}],304127);var gQ=t.i(304127);let gJ=/[\0\t\n\r]/g;function g0(t,r){let i=Number.parseInt(t,r);return i<9||11===i||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(65535&i)==65535||(65535&i)==65534||i>1114111?"�":String.fromCodePoint(i)}let g1=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function g2(t,r,i){if(r)return r;if(35===i.charCodeAt(0)){let t=i.charCodeAt(1),r=120===t||88===t;return g0(i.slice(r?2:1),r?16:10)}return gT(i)||t}let g3={}.hasOwnProperty;function g4(t){return{line:t.line,column:t.column,offset:t.offset}}function g6(t,r){if(t)throw Error("Cannot close `"+t.type+"` ("+mS({start:t.start,end:t.end})+"): a different token (`"+r.type+"`, "+mS({start:r.start,end:r.end})+") is open");throw Error("Cannot close document, a token (`"+r.type+"`, "+mS({start:r.start,end:r.end})+") is still open")}function g5(t){let r=this;r.parser=function(i){var n,a;let o,s,l,u;return"object"==typeof(n={...r.data("settings"),...t,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})&&(a=n,n=void 0),(function(t){let r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:n(v),autolinkProtocol:c,autolinkEmail:c,atxHeading:n(m),blockQuote:n(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:n(p),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:n(p,a),codeText:n(function(){return{type:"inlineCode",value:""}},a),codeTextData:c,data:c,codeFlowValue:c,definition:n(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:n(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:n(g),hardBreakTrailing:n(g),htmlFlow:n(y,a),htmlFlowData:c,htmlText:n(y,a),htmlTextData:c,image:n(function(){return{type:"image",title:null,url:"",alt:null}}),label:a,link:n(v),listItem:n(function(t){return{type:"listItem",spread:t._spread,checked:null,children:[]}}),listItemValue:function(t){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(t),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:n(_,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:n(_),paragraph:n(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:n(m),strong:n(function(){return{type:"strong",children:[]}}),thematicBreak:n(function(){return{type:"thematicBreak"}})},exit:{atxHeading:s(),atxHeadingSequence:function(t){let r=this.stack[this.stack.length-1];r.depth||(r.depth=this.sliceSerialize(t).length)},autolink:s(),autolinkEmail:function(t){h.call(this,t),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(t)},autolinkProtocol:function(t){h.call(this,t),this.stack[this.stack.length-1].url=this.sliceSerialize(t)},blockQuote:s(),characterEscapeValue:h,characterReferenceMarkerHexadecimal:d,characterReferenceMarkerNumeric:d,characterReferenceValue:function(t){let r,i=this.sliceSerialize(t),n=this.data.characterReferenceType;n?(r=g0(i,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0):r=gT(i);let a=this.stack[this.stack.length-1];a.value+=r},characterReference:function(t){this.stack.pop().position.end=g4(t.end
56)},codeFenced:s(function(){let t=this.resume();this.stack[this.stack.length-1].value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let t=this.resume();this.stack[this.stack.length-1].lang=t},codeFencedFenceMeta:function(){let t=this.resume();this.stack[this.stack.length-1].meta=t},codeFlowValue:h,codeIndented:s(function(){let t=this.resume();this.stack[this.stack.length-1].value=t.replace(/(\r?\n|\r)$/g,"")}),codeText:s(function(){let t=this.resume();this.stack[this.stack.length-1].value=t}),codeTextData:h,data:h,definition:s(),definitionDestinationString:function(){let t=this.resume();this.stack[this.stack.length-1].url=t},definitionLabelString:function(t){let r=this.resume(),i=this.stack[this.stack.length-1];i.label=r,i.identifier=gN(this.sliceSerialize(t)).toLowerCase()},definitionTitleString:function(){let t=this.resume();this.stack[this.stack.length-1].title=t},emphasis:s(),hardBreakEscape:s(f),hardBreakTrailing:s(f),htmlFlow:s(function(){let t=this.resume();this.stack[this.stack.length-1].value=t}),htmlFlowData:h,htmlText:s(function(){let t=this.resume();this.stack[this.stack.length-1].value=t}),htmlTextData:h,image:s(function(){let t=this.stack[this.stack.length-1];if(this.data.inReference){let r=this.data.referenceType||"shortcut";t.type+="Reference",t.referenceType=r,delete t.url,delete t.title}else delete t.identifier,delete t.label;this.data.referenceType=void 0}),label:function(){let t=this.stack[this.stack.length-1],r=this.resume(),i=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===i.type?i.children=t.children:i.alt=r},labelText:function(t){let r=this.sliceSerialize(t),i=this.stack[this.stack.length-2];i.label=r.replace(g1,g2),i.identifier=gN(r).toLowerCase()},lineEnding:function(t){let i=this.stack[this.stack.length-1];if(this.data.atHardBreak){i.children[i.children.length-1].position.end=g4(t.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(i.type)&&(c.call(this,t),h.call(this,t))},link:s(function(){let t=this.stack[this.stack.length-1];if(this.data.inReference){let r=this.data.referenceType||"shortcut";t.type+="Reference",t.referenceType=r,delete t.url,delete t.title}else delete t.identifier,delete t.label;this.data.referenceType=void 0}),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:function(t){let r=this.resume(),i=this.stack[this.stack.length-1];i.label=r,i.identifier=gN(this.sliceSerialize(t)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let t=this.resume();this.stack[this.stack.length-1].url=t},resourceTitleString:function(){let t=this.resume();this.stack[this.stack.length-1].title=t},resource:function(){this.data.inReference=void 0},setextHeading:s(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(t){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(t).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:s(),thematicBreak:s()}};!function t(r,i){let n=-1;for(;++n<i.length;){let a=i[n];Array.isArray(a)?t(r,a):function(t,r){let i;for(i in r)if(g3.call(r,i))switch(i){case"canContainEols":{let n=r[i];n&&t[i].push(...n);break}case"transforms":{let n=r[i];n&&t[i].push(...n);break}case"enter":case"exit":{let n=r[i];n&&Object.assign(t[i],n)}}}(r,a)}}(r,(t||{}).mdastExtensions||[]);let i={};return function(t){let n={type:"root",children:[]},s={stack:[n],tokenStack:[],config:r,enter:o,exit:l,buffer:a,resume:u,data:i},c=[],h=-1;for(;++h<t.length;)("listOrdered"===t[h][1].type||"listUnordered"===t[h][1].type)&&("enter"===t[h][0]?c.push(h):h=function(t,r,i){let n,a,o,s,l=r-1,u=-1,c=!1;for(;++l<=i;){let r=t[l];switch(r[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===r[0]?u++:u--,s=void 0;break;case"lineEndingBlank":"enter"===r[0]&&(!n||s||u||o||(o=l),s=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:s=void 0}
56if(!u&&"enter"===r[0]&&"listItemPrefix"===r[1].type||-1===u&&"exit"===r[0]&&("listUnordered"===r[1].type||"listOrdered"===r[1].type)){if(n){let s=l;for(a=void 0;s--;){let r=t[s];if("lineEnding"===r[1].type||"lineEndingBlank"===r[1].type){if("exit"===r[0])continue;a&&(t[a][1].type="lineEndingBlank",c=!0),r[1].type="lineEnding",a=s}else if("linePrefix"===r[1].type||"blockQuotePrefix"===r[1].type||"blockQuotePrefixWhitespace"===r[1].type||"blockQuoteMarker"===r[1].type||"listItemIndent"===r[1].type);else break}o&&(!a||o<a)&&(n._spread=!0),n.end=Object.assign({},a?t[a][1].start:r[1].end),t.splice(a||l,0,["exit",n,r[2]]),l++,i++}if("listItemPrefix"===r[1].type){let a={type:"listItem",_spread:!1,start:Object.assign({},r[1].start),end:void 0};n=a,t.splice(l,0,["enter",a,r[2]]),l++,i++,o=void 0,s=!0}}}return t[r][1]._spread=c,i}(t,c.pop(),h));for(h=-1;++h<t.length;){let i=r[t[h][0]];g3.call(i,t[h][1].type)&&i[t[h][1].type].call(Object.assign({sliceSerialize:t[h][2].sliceSerialize},s),t[h][1])}if(s.tokenStack.length>0){let t=s.tokenStack[s.tokenStack.length-1];(t[1]||g6).call(s,void 0,t[0])}for(n.position={start:g4(t.length>0?t[0][1].start:{line:1,column:1,offset:0}),end:g4(t.length>0?t[t.length-2][1].end:{line:1,column:1,offset:0})},h=-1;++h<r.transforms.length;)n=r.transforms[h](n)||n;return n};function n(t,r){return function(i){o.call(this,t(i),i),r&&r.call(this,i)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(t,r,i){this.stack[this.stack.length-1].children.push(t),this.stack.push(t),this.tokenStack.push([r,i||void 0]),t.position={start:g4(r.start),end:void 0}}function s(t){return function(r){t&&t.call(this,r),l.call(this,r)}}function l(t,r){let i=this.stack.pop(),n=this.tokenStack.pop();if(n)n[0].type!==t.type&&(r?r.call(this,t,n[0]):(n[1]||g6).call(this,t,n[0]));else throw Error("Cannot close `"+t.type+"` ("+mS({start:t.start,end:t.end})+"): itâs not open");i.position.end=g4(t.end)}function u(){var t;return t=this.stack.pop(),mH(t,"boolean"!=typeof mq.includeImageAlt||mq.includeImageAlt,"boolean"!=typeof mq.includeHtml||mq.includeHtml)}function c(t){let r=this.stack[this.stack.length-1].children,i=r[r.length-1];i&&"text"===i.type||((i={type:"text",value:""}).position={start:g4(t.start),end:void 0},r.push(i)),this.stack.push(i)}function h(t){let r=this.stack.pop();r.value+=this.sliceSerialize(t),r.position.end=g4(t.end)}function f(){this.data.atHardBreak=!0}function d(t){this.data.characterReferenceType=t.type}function p(){return{type:"code",lang:null,meta:null,value:""}}function m(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function y(){return{type:"html",value:""}}function v(){return{type:"link",title:null,url:"",children:[]}}function _(t){return{type:"list",ordered:"listOrdered"===t.type,start:null,spread:t._spread,children:[]}}})(a)(function(t){for(;!gs(t););return t}((function(t){let r={constructs:function(t){let r={},i=-1;for(;++i<t.length;)!function(t,r){let i;for(i in r){let n,a=(mX.call(t,i)?t[i]:void 0)||(t[i]={}),o=r[i];if(o)for(n in o){mX.call(a,n)||(a[n]=[]);let t=o[n];!function(t,r){let i=-1,n=[];for(;++i<r.length;)("after"===r[i].add?t:n).push(r[i]);mZ(t,0,0,n)}(a[n],Array.isArray(t)?t:t?[t]:[])}}}(r,t[i]);return r}([gQ,...(t||{}).extensions||[]]),content:i(gt),defined:[],document:i(gr),flow:i(gc),lazy:{},string:i(gf),text:i(gd)};return r;function i(t){return function(i){return function(t,r,i){let n={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0},a={},o=[],s=[],l=[],u={attempt:m(function(t,r){g(t,r.from)}),check:m(p),consume:function(t){m4(t)?(n.line++,n.column=1,n.offset+=-3===t?2:1,y()):-1!==t&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===s[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=t},enter:function(t,r){let i=r||{};return i.type=t,i.start=d(),c.events.push(["enter",i,c]),l.push(i),i},exit:function(t){let r=l.pop();return r.end=d(),c.events.push(["exit",r,c]),r},interrupt:m(p,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(t){a[t.line]=t.column,y()}
56,events:[],now:d,parser:t,previous:null,sliceSerialize:function(t,r){return function(t,r){let i,n=-1,a=[];for(;++n<t.length;){let o,s=t[n];if("string"==typeof s)o=s;else switch(s){case -5:o="\r";break;case -4:o="\n";break;case -3:o="\r\n";break;case -2:o=r?" ":" ";break;case -1:if(!r&&i)continue;o=" ";break;default:o=String.fromCharCode(s)}i=-2===s,a.push(o)}return a.join("")}(f(t),r)},sliceStream:f,write:function(t){return(s=mY(s,t),function(){let t;for(;n._index<s.length;){let i=s[n._index];if("string"==typeof i)for(t=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===t&&n._bufferIndex<i.length;){var r;r=i.charCodeAt(n._bufferIndex),h=h(r)}else h=h(i)}}(),null!==s[s.length-1])?[]:(g(r,0),c.events=gv(o,c.events,c),c.events)}},h=r.tokenize.call(c,u);return r.resolveAll&&o.push(r),c;function f(t){return function(t,r){let i,n=r.start._index,a=r.start._bufferIndex,o=r.end._index,s=r.end._bufferIndex;if(n===o)i=[t[n].slice(a,s)];else{if(i=t.slice(n,o),a>-1){let t=i[0];"string"==typeof t?i[0]=t.slice(a):i.shift()}s>0&&i.push(t[o].slice(0,s))}return i}(s,t)}function d(){let{_bufferIndex:t,_index:r,line:i,column:a,offset:o}=n;return{_bufferIndex:t,_index:r,line:i,column:a,offset:o}}function p(t,r){r.restore()}function m(t,r){return function(i,a,o){var s;let h,f,p,m;return Array.isArray(i)?g(i):"tokenize"in i?g([i]):(s=i,function(t){let r=null!==t&&s[t],i=null!==t&&s.null;return g([...Array.isArray(r)?r:r?[r]:[],...Array.isArray(i)?i:i?[i]:[]])(t)});
56function g(t){return(h=t,f=0,0===t.length)?o:v(t[f])}function v(t){return function(i){let a,o,s,h,f;return(a=d(),o=c.previous,s=c.currentConstruct,h=c.events.length,f=Array.from(l),m={from:h,restore:function(){n=a,c.previous=o,c.currentConstruct=s,c.events.length=h,l=f,y()}},p=t,t.partial||(c.currentConstruct=t),t.name&&c.parser.constructs.disable.null.includes(t.name))?b(i):t.tokenize.call(r?Object.assign(Object.create(c),r):c,u,_,b)(i)}}function _(r){return t(p,m),a}function b(t){return(m.restore(),++f<h.length)?v(h[f]):o}}}function g(t,r){t.resolveAll&&!o.includes(t)&&o.push(t),t.resolve&&mZ(c.events,r,c.events.length-r,t.resolve(c.events.slice(r),c)),t.resolveTo&&(c.events=t.resolveTo(c.events,c))}function y(){n.line in a&&n.column<2&&(n.column=a[n.line],n.offset+=a[n.line]-1)}}(r,t,i)}}})(a).document().write((s=1,l="",u=!0,function(t,r,i){let n,a,c,h,f,d=[];for(t=l+("string"==typeof t?t.toString():new TextDecoder(r||void 0).decode(t)),c=0,l="",u&&(65279===t.charCodeAt(0)&&c++,u=void 0);c<t.length;){if(gJ.lastIndex=c,h=(n=gJ.exec(t))&&void 0!==n.index?n.index:t.length,f=t.charCodeAt(h),!n){l=t.slice(c);break}if(10===f&&c===h&&o)d.push(-3),o=void 0;else switch(o&&(d.push(-5),o=void 0),c<h&&(d.push(t.slice(c,h)),s+=h-c),f){case 0:d.push(65533),s++;break;case 9:for(a=4*Math.ceil(s/4),d.push(-2);s++<a;)d.push(-1);break;case 10:d.push(-4),s=1;break;default:o=!0,s=1}c=h+1}return i&&(o&&d.push(-5),l&&d.push(l),d.push(null)),d})(i,n,!0))))}}let{defineProperty:g8}=Object,g7="object"==typeof self?self:globalThis,g9=(t,r)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw TypeError("unable to deserialize "+t)}return new g7[t](r)},ye=t=>{var r;let i,n;return(r=new Map,i=(t,i)=>(r.set(i,t),t),n=a=>{if(r.has(a))return r.get(a);let[o,s]=t[a];switch(o){case 0:case -1:return i(s,a);case 1:{let t=i([],a);for(let r of s)t.push(n(r));return t}case 2:{let t=i({},a);for(let[r,i]of s){let a=n(r),o=n(i);"__proto__"===a?g8(t,a,{value:o,configurable:!0,enumerable:!0,writable:!0}):t[a]=o}return t}case 3:return i(new Date(s),a);case 4:{let{source:t,flags:r}=s;return i(new RegExp(t,r),a)}case 5:{let t=i(new Map,a);for(let[r,i]of s)t.set(n(r),n(i));return t}case 6:{let t=i(new Set,a);for(let r of s)t.add(n(r));return t}case 7:{let{name:t,message:r}=s;return i("function"==typeof g7[t]?g9(t,r):Error(r),a)}case 8:return i(BigInt(s),a);case"BigInt":return i(Object(BigInt(s)),a);case"ArrayBuffer":return i(new Uint8Array(s).buffer,s);case"DataView":{let{buffer:t}=new Uint8Array(s);return i(new DataView(t),s)}case"-0":return -0}return i(g9(o,s),a)})(0)},{toString:yt}={},{keys:yr,is:yi}=Object,yn=t=>{let r=typeof t;if("object"!==r||!t)return[0,r];let i=yt.call(t).slice(8,-1);switch(i){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,i]}return i.includes("Array")?[1,i]:t instanceof Error?[7,t.name||"Error"]:[2,i]},ya=([t,r])=>0===t&&("function"===r||"symbol"===r),yo=(t,{json:r,lossy:i}={})=>{var n,a,o;let s,l,u=[];return(n=!(r||i),a=!!r,o=new Map,s=(t,r)=>{let i=u.push(t)-1;return o.set(r,i),i},l=t=>{if(o.has(t))return o.get(t);let[r,i]=yn(t);switch(r){case 0:{let a=t;switch(i){case"bigint":r=8,a=t.toString();break;case"number":if(!t&&yi(t,-0))return u.push(["-0"])-1;break;case"function":case"symbol":if(n)throw TypeError("unable to serialize "+i);a=null;break;case"undefined":return s([-1],t)}return s([r,a],t)}case 1:{if(i){let r=t;return"DataView"===i?r=new Uint8Array(t.buffer):"ArrayBuffer"===i&&(r=new Uint8Array(t)),s([i,[...r]],t)}let n=[],a=s([r,n],t);for(let r of t)n.push(l(r));return a}case 2:{if(i)switch(i){case"BigInt":return s([i,t.toString()],t);case"Boolean":case"Number":case"String":return s([i,t.valueOf()],t)}if(a&&"toJSON"in t)return l(t.toJSON());let o=[],u=s([r,o],t);for(let r of yr(t))(n||!ya(yn(t[r])))&&o.push([l(r),l(t[r])]);return u}case 3:return s([r,isNaN(t.getTime())?"":t.toISOString()],t);case 4:{let{source:i,flags:n}=t;return s([r,{source:i,flags:n}],t)}case 5:{let i=[],a=s([r,i],t);for(let[r,a]of t)(n||!(ya(yn(r))||ya(yn(a))))&&i.push([l(r),l(a)]);return a}case 6:{let i=[],a=s([r,i],t);for(let r of t)(n||!ya(yn(r)))&&i.push(l(r));return a}}let{message:c}=t;return s([r,{name:i,message:c}],t)})(t),u}
56,ys="function"==typeof structuredClone?(t,r)=>r&&("json"in r||"lossy"in r)?ye(yo(t,r)):structuredClone(t):(t,r)=>ye(yo(t,r));function yl(t){let r=[],i=-1,n=0,a=0;for(;++i<t.length;){let o=t.charCodeAt(i),s="";if(37===o&&mQ(t.charCodeAt(i+1))&&mQ(t.charCodeAt(i+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){let r=t.charCodeAt(i+1);o<56320&&r>56319&&r<57344?(s=String.fromCharCode(o,r),a=1):s="�"}else s=String.fromCharCode(o);s&&(r.push(t.slice(n,i),encodeURIComponent(s)),n=i+a+1,s=""),a&&(i+=a,a=0)}return r.join("")+t.slice(n)}function yu(t,r){let i=[{type:"text",value:"â©"}];return r>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),i}function yc(t,r){return"Back to reference "+(t+1)+(r>1?"-"+r:"")}let yh=function(t){var r,i;if(null==t)return yd;if("function"==typeof t)return yf(t);if("object"==typeof t){return Array.isArray(t)?function(t){let r=[],i=-1;for(;++i<t.length;)r[i]=yh(t[i]);return yf(function(...t){let i=-1;for(;++i<r.length;)if(r[i].apply(this,t))return!0;return!1})}(t):(r=t,yf(function(t){let i;for(i in r)if(t[i]!==r[i])return!1;return!0}))}if("string"==typeof t){return i=t,yf(function(t){return t&&t.type===i})}throw Error("Expected function, string, or object as test")};function yf(t){return function(r,i,n){return!!(function(t){return null!==t&&"object"==typeof t&&"type"in t}(r)&&t.call(this,r,"number"==typeof i?i:void 0,n||void 0))}}function yd(){return!0}let yp=[];function ym(t,r,i,n){var a,o,s;let l,u,c,h,f,d;"function"==typeof r&&"function"!=typeof i?(u=void 0,c=r,l=i):(u=r,c=i,l=n),a=u,o=function(t,r){let i=r[r.length-1],n=i?i.children.indexOf(t):void 0;return c(t,n,i)},s=l,"function"==typeof a&&"function"!=typeof o?(s=o,o=a):h=a,f=yh(h),d=s?-1:1,(function t(r,i,n){let l=r&&"object"==typeof r?r:{};if("string"==typeof l.type){let t="string"==typeof l.tagName?l.tagName:"string"==typeof l.name?l.name:void 0;Object.defineProperty(u,"name",{value:"node ("+r.type+(t?"<"+t+">":"")+")"})}return u;function u(){var l;let u,c,h,p=yp;if((!a||f(r,i,n[n.length-1]||void 0))&&!1===(p=Array.isArray(l=o(r,n))?l:"number"==typeof l?[!0,l]:null==l?yp:[l])[0])return p;if("children"in r&&r.children&&r.children&&"skip"!==p[0])for(c=(s?r.children.length:-1)+d,h=n.concat(r);c>-1&&c<r.children.length;){if(!1===(u=t(r.children[c],c,h)())[0])return u;c="number"==typeof u[1]?u[1]:c+d}return p}})(t,void 0,[])()}function yg(t,r){let i=r.referenceType,n="]";if("collapsed"===i?n+="[]":"full"===i&&(n+="["+(r.label||r.identifier)+"]"),"imageReference"===r.type)return[{type:"text",value:"!["+r.alt+n}];let a=t.all(r),o=a[0];o&&"text"===o.type?o.value="["+o.value:a.unshift({type:"text",value:"["});let s=a[a.length-1];return s&&"text"===s.type?s.value+=n:a.push({type:"text",value:n}),a}function yy(t){let r=t.spread;return null==r?t.children.length>1:r}function yv(t,r,i){let n=0,a=t.length;if(r){let r=t.codePointAt(n);for(;9===r||32===r;)n++,r=t.codePointAt(n)}if(i){let r=t.codePointAt(a-1);for(;9===r||32===r;)a--,r=t.codePointAt(a-1)}return a>n?t.slice(n,a):""}let y_={blockquote:function(t,r){let i={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(r),!0)};return t.patch(r,i),t.applyData(r,i)},break:function(t,r){let i={type:"element",tagName:"br",properties:{},children:[]};return t.patch(r,i),[t.applyData(r,i),{type:"text",value:"\n"}]},code:function(t,r){let i=r.value?r.value+"\n":"",n={},a=r.lang?r.lang.split(/\s+/):[];a.length>0&&(n.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:n,children:[{type:"text",value:i}]};return r.meta&&(o.data={meta:r.meta}),t.patch(r,o),o={type:"element",tagName:"pre",properties:{},children:[o=t.applyData(r,o)]},t.patch(r,o),o},delete:function(t,r){let i={type:"element",tagName:"del",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)},emphasis:function(t,r){let i={type:"element",tagName:"em",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)},footnoteReference:function(t,r){let i,n="string"==typeof t.options.clobberPrefix?t.options.clobberPrefix:"user-content-",a=String(r.identifier).toUpperCase(),o=yl(a.toLowerCase()),s=t.footnoteOrder.indexOf(a),l=t.footnoteCounts.get(a);
56void 0===l?(l=0,t.footnoteOrder.push(a),i=t.footnoteOrder.length):i=s+1,l+=1,t.footnoteCounts.set(a,l);let u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};t.patch(r,u);let c={type:"element",tagName:"sup",properties:{},children:[u]};return t.patch(r,c),t.applyData(r,c)},heading:function(t,r){let i={type:"element",tagName:"h"+r.depth,properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)},html:function(t,r){if(t.options.allowDangerousHtml){let i={type:"raw",value:r.value};return t.patch(r,i),t.applyData(r,i)}},imageReference:function(t,r){let i=String(r.identifier).toUpperCase(),n=t.definitionById.get(i);if(!n)return yg(t,r);let a={src:yl(n.url||""),alt:r.alt};null!==n.title&&void 0!==n.title&&(a.title=n.title);let o={type:"element",tagName:"img",properties:a,children:[]};return t.patch(r,o),t.applyData(r,o)},image:function(t,r){let i={src:yl(r.url)};null!==r.alt&&void 0!==r.alt&&(i.alt=r.alt),null!==r.title&&void 0!==r.title&&(i.title=r.title);let n={type:"element",tagName:"img",properties:i,children:[]};return t.patch(r,n),t.applyData(r,n)},inlineCode:function(t,r){let i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};t.patch(r,i);let n={type:"element",tagName:"code",properties:{},children:[i]};return t.patch(r,n),t.applyData(r,n)},linkReference:function(t,r){let i=String(r.identifier).toUpperCase(),n=t.definitionById.get(i);if(!n)return yg(t,r);let a={href:yl(n.url||"")};null!==n.title&&void 0!==n.title&&(a.title=n.title);let o={type:"element",tagName:"a",properties:a,children:t.all(r)};return t.patch(r,o),t.applyData(r,o)},link:function(t,r){let i={href:yl(r.url)};null!==r.title&&void 0!==r.title&&(i.title=r.title);let n={type:"element",tagName:"a",properties:i,children:t.all(r)};return t.patch(r,n),t.applyData(r,n)},listItem:function(t,r,i){let n=t.all(r),a=i?function(t){let r=!1;if("list"===t.type){r=t.spread||!1;let i=t.children,n=-1;for(;!r&&++n<i.length;)r=yy(i[n])}return r}(i):yy(r),o={},s=[];if("boolean"==typeof r.checked){let t,i=n[0];i&&"element"===i.type&&"p"===i.tagName?t=i:(t={type:"element",tagName:"p",properties:{},children:[]},n.unshift(t)),t.children.length>0&&t.children.unshift({type:"text",value:" "}),t.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<n.length;){let t=n[l];(a||0!==l||"element"!==t.type||"p"!==t.tagName)&&s.push({type:"text",value:"\n"}),"element"!==t.type||"p"!==t.tagName||a?s.push(t):s.push(...t.children)}let u=n[n.length-1];u&&(a||"element"!==u.type||"p"!==u.tagName)&&s.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:o,children:s};return t.patch(r,c),t.applyData(r,c)},list:function(t,r){let i={},n=t.all(r),a=-1;for("number"==typeof r.start&&1!==r.start&&(i.start=r.start);++a<n.length;){let t=n[a];if("element"===t.type&&"li"===t.tagName&&t.properties&&Array.isArray(t.properties.className)&&t.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}let o={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:t.wrap(n,!0)};return t.patch(r,o),t.applyData(r,o)},paragraph:function(t,r){let i={type:"element",tagName:"p",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)},root:function(t,r){let i={type:"root",children:t.wrap(t.all(r))};return t.patch(r,i),t.applyData(r,i)},strong:function(t,r){let i={type:"element",tagName:"strong",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)},table:function(t,r){let i=t.all(r),n=i.shift(),a=[];if(n){let i={type:"element",tagName:"thead",properties:{},children:t.wrap([n],!0)};t.patch(r.children[0],i),a.push(i)}if(i.length>0){let n={type:"element",tagName:"tbody",properties:{},children:t.wrap(i,!0)},o=mE(r.children[1]),s=mw(r.children[r.children.length-1]);o&&s&&(n.position={start:o,end:s}),a.push(n)}let o={type:"element",tagName:"table",properties:{},children:t.wrap(a,!0)};return t.patch(r,o),t.applyData(r,o)},tableCell:function(t,r){let i={type:"element",tagName:"td",properties:{},children:t.all(r)};return t.patch(r,i),t.applyData(r,i)},tableRow:function(t,r,i){let n=i?i.children:void 0,a=0===(n?n.indexOf(r):1)?"th":"td",o=i&&"table"===i.type?i.align:void 0,s=o?o.length:r.children.length,l=-1,u=[];for(;++l<s;){let i=r.children[l],n={},s=o?o[l]:void 0;s&&(n.align=s);let c={type:"element",tagName:a,properties:n,children:[]};i&&(c.children=t.all(i),t.patch(i,c),c=t.applyData(i,c)),u.push(c)}let c={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(r,c),t.applyData(r,c)},text:function(t,r){let i={type:"text",value:function(t){let r=String(t),i=/\r?\n|\r/g,n=i.exec(r),a=0,o=[];for(;n;)o.push(yv(r.slice(a,n.index),a>0,!0),n[0]),a=n.index+n[0].length,n=i.exec(r);return o.push(yv(r.slice(a),a>0,!1)),o.join("")}(String(r.value))};return t.patch(r,i),t.applyData(r,i)},thematicBreak:function(t,r){let i={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(r,i),t.applyData(r,i)},toml:yb,yaml:yb,definition:yb,footnoteDefinition:yb};function yb(){}
56let yx={}.hasOwnProperty,yw={};function yE(t,r){t.position&&(r.position=mA(t))}function yT(t,r){let i=r;if(t&&t.data){let r=t.data.hName,n=t.data.hChildren,a=t.data.hProperties;"string"==typeof r&&("element"===i.type?i.tagName=r:i={type:"element",tagName:r,properties:{},children:"children"in i?i.children:[i]}),"element"===i.type&&a&&Object.assign(i.properties,ys(a)),"children"in i&&i.children&&null!=n&&(i.children=n)}return i}function yA(t,r){let i=[],n=-1;for(r&&i.push({type:"text",value:"\n"});++n<t.length;)n&&i.push({type:"text",value:"\n"}),i.push(t[n]);return r&&t.length>0&&i.push({type:"text",value:"\n"}),i}function yS(t){let r=0,i=t.charCodeAt(r);for(;9===i||32===i;)r++,i=t.charCodeAt(r);return t.slice(r)}function yC(t,r){let i,n,a,o,s=(i=r||yw,n=new Map,a=new Map,o={all:function(t){let r=[];if("children"in t){let i=t.children,n=-1;for(;++n<i.length;){let a=o.one(i[n],t);if(a){if(n&&"break"===i[n-1].type&&(Array.isArray(a)||"text"!==a.type||(a.value=yS(a.value)),!Array.isArray(a)&&"element"===a.type)){let t=a.children[0];t&&"text"===t.type&&(t.value=yS(t.value))}Array.isArray(a)?r.push(...a):r.push(a)}}}return r},applyData:yT,definitionById:n,footnoteById:a,footnoteCounts:new Map,footnoteOrder:[],handlers:{...y_,...i.handlers},one:function(t,r){let i=t.type,n=o.handlers[i];if(yx.call(o.handlers,i)&&n)return n(o,t,r);if(o.options.passThrough&&o.options.passThrough.includes(i)){if("children"in t){let{children:r,...i}=t,n=ys(i);return n.children=o.all(t),n}return ys(t)}return(o.options.unknownHandler||function(t,r){let i=r.data||{},n="value"in r&&!(yx.call(i,"hProperties")||yx.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:t.all(r)};return t.patch(r,n),t.applyData(r,n)})(o,t,r)},options:i,patch:yE,wrap:yA},ym(t,function(t){if("definition"===t.type||"footnoteDefinition"===t.type){let r="definition"===t.type?n:a,i=String(t.identifier).toUpperCase();r.has(i)||r.set(i,t)}}),o),l=s.one(t,void 0),u=function(t){let r="string"==typeof t.options.clobberPrefix?t.options.clobberPrefix:"user-content-",i=t.options.footnoteBackContent||yu,n=t.options.footnoteBackLabel||yc,a=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",s=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[],u=-1;for(;++u<t.footnoteOrder.length;){let a=t.footnoteById.get(t.footnoteOrder[u]);if(!a)continue;let o=t.all(a),s=String(a.identifier).toUpperCase(),c=yl(s.toLowerCase()),h=0,f=[],d=t.footnoteCounts.get(s);for(;void 0!==d&&++h<=d;){f.length>0&&f.push({type:"text",value:" "});let t="string"==typeof i?i:i(u,h);"string"==typeof t&&(t={type:"text",value:t}),f.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+c+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(u,h),className:["data-footnote-backref"]},children:Array.isArray(t)?t:[t]})}let p=o[o.length-1];if(p&&"element"===p.type&&"p"===p.tagName){let t=p.children[p.children.length-1];t&&"text"===t.type?t.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...f)}else o.push(...f);let m={type:"element",tagName:"li",properties:{id:r+"fn-"+c},children:t.wrap(o,!0)};t.patch(a,m),l.push(m)}if(0!==l.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ys(s),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:"\n"}]}}(s),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return u&&(pz(),c.children.push({type:"text",value:"\n"},u)),c}function yM(t,r){return t&&"run"in t?async function(i,n){let a=yC(i,{file:n,...r});await t.run(a,n)}:function(i,n){return yC(i,{file:n,...t||r})}}function yD(t){if(t)throw t}var yP=t.i(104100);function yI(t){if("object"!=typeof t||null===t)return!1;let r=Object.getPrototypeOf(t);return(null===r||r===Object.prototype||null===Object.getPrototypeOf(r))&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}let yk=function(t,r){let i;if(void 0!==r&&"string"!=typeof r)throw TypeError('"ext" argument must be a string');yR(t);let n=0,a=-1,o=t.length;if(void 0===r||0===r.length||r.length>t.length){for(;o--;)if(47===t.codePointAt(o)){if(i){n=o+1;break}}else a<0&&(i=!0,a=o+1);return a<0?"":t.slice(n,a)}if(r===t)return"";let s=-1,l=r.length-1;for(;o--;)if(47===t.codePointAt(o)){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),l>-1&&(t.codePointAt(o)===r.codePointAt(l--)?l<0&&(a=o):(l=-1,a=s));return n===a?a=s:a<0&&(a=t.length),t.slice(n,a)},yO=function(t){let r;if(yR(t),0===t.length)return".";let i=-1,n=t.length;for(;--n;)if(47===t.codePointAt(n)){if(r){i=n;break}}else r||(r=!0);return i<0?47===t.codePointAt(0)?"/":".":1===i&&47===t.codePointAt(0)?"//":t.slice(0,i)},yN=function(t){let r;yR(t);let i=t.length,n=-1,a=0,o=-1,s=0;for(;i--;){let l=t.codePointAt(i);if(47===l){if(r){a=i+1;break}continue}n<0&&(r=!0,n=i+1),46===l?o<0?o=i:1!==s&&(s=1):o>-1&&(s=-1)}return o<0||n<0||0===s||1===s&&o===n-1&&o===a+1?"":t.slice(o,n)},yL=function(...t){var r;let i,n,a,o=-1;for(;++o<t.length;
56)yR(t[o]),t[o]&&(a=void 0===a?t[o]:a+"/"+t[o]);return void 0===a?".":(yR(r=a),i=47===r.codePointAt(0),0!==(n=function(t,r){let i,n,a="",o=0,s=-1,l=0,u=-1;for(;++u<=t.length;){if(u<t.length)i=t.codePointAt(u);else if(47===i)break;else i=47;if(47===i){if(s===u-1||1===l);else if(s!==u-1&&2===l){if(a.length<2||2!==o||46!==a.codePointAt(a.length-1)||46!==a.codePointAt(a.length-2)){if(a.length>2){if((n=a.lastIndexOf("/"))!==a.length-1){n<0?(a="",o=0):o=(a=a.slice(0,n)).length-1-a.lastIndexOf("/"),s=u,l=0;continue}}else if(a.length>0){a="",o=0,s=u,l=0;continue}}r&&(a=a.length>0?a+"/..":"..",o=2)}else a.length>0?a+="/"+t.slice(s+1,u):a=t.slice(s+1,u),o=u-s-1;s=u,l=0}else 46===i&&l>-1?l++:l=-1}return a}(r,!i)).length||i||(n="."),n.length>0&&47===r.codePointAt(r.length-1)&&(n+="/"),i?"/"+n:n)};function yR(t){if("string"!=typeof t)throw TypeError("Path must be a string. Received "+JSON.stringify(t))}function yF(t){return!!(null!==t&&"object"==typeof t&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&void 0===t.auth)}let yB=["history","path","basename","stem","extname","dirname"];class yz{constructor(t){let r,i;r=t?yF(t)?{path:t}:"string"==typeof t||function(t){return!!(t&&"object"==typeof t&&"byteLength"in t&&"byteOffset"in t)}(t)?{value:t}:t:{},this.cwd="cwd"in r?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<yB.length;){const t=yB[n];t in r&&void 0!==r[t]&&null!==r[t]&&(this[t]="history"===t?[...r[t]]:r[t])}for(i in r)yB.includes(i)||(this[i]=r[i])}get basename(){return"string"==typeof this.path?yk(this.path):void 0}set basename(t){yU(t,"basename"),yj(t,"basename"),this.path=yL(this.dirname||"",t)}get dirname(){return"string"==typeof this.path?yO(this.path):void 0}set dirname(t){yV(this.basename,"dirname"),this.path=yL(t||"",this.basename)}get extname(){return"string"==typeof this.path?yN(this.path):void 0}set extname(t){if(yj(t,"extname"),yV(this.dirname,"extname"),t){if(46!==t.codePointAt(0))throw Error("`extname` must start with `.`");if(t.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=yL(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){yF(t)&&(t=function(t){if("string"==typeof t)t=new URL(t);else if(!yF(t)){let r=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if("file:"!==t.protocol){let t=TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return function(t){if(""!==t.hostname){let t=TypeError('File URL host must be "localhost" or empty on darwin');throw t.code="ERR_INVALID_FILE_URL_HOST",t}let r=t.pathname,i=-1;for(;++i<r.length;)if(37===r.codePointAt(i)&&50===r.codePointAt(i+1)){let t=r.codePointAt(i+2);if(70===t||102===t){let t=TypeError("File URL path must not include encoded / characters");throw t.code="ERR_INVALID_FILE_URL_PATH",t}}return decodeURIComponent(r)}(t)}(t)),yU(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return"string"==typeof this.path?yk(this.path,this.extname):void 0}set stem(t){yU(t,"stem"),yj(t,"stem"),this.path=yL(this.dirname||"",t+(this.extname||""))}fail(t,r,i){let n=this.message(t,r,i);throw n.fatal=!0,n}info(t,r,i){let n=this.message(t,r,i);return n.fatal=void 0,n}message(t,r,i){let n=new mP(t,r,i);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(t){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(t||void 0).decode(this.value)}}function yj(t,r){if(t&&t.includes("/"))throw Error("`"+r+"` cannot be a path: did not expect `/`")}function yU(t,r){if(!t)throw Error("`"+r+"` cannot be empty")}function yV(t,r){if(!t)throw Error("Setting `"+r+"` requires `path` to be set too")}let y$=function(t){let r=this.constructor.prototype,i=r[t],n=function(){return i.apply(n,arguments)};return Object.setPrototypeOf(n,r),n},yG={}.hasOwnProperty,yq=new class t extends y${constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let t=[],r={run:function(...r){let i=-1,n=r.pop();if("function"!=typeof n)throw TypeError("Expected function as last argument, not "+n);!function a(o,...s){let l=t[++i],u=-1;if(o)return void n(o);for(;++u<r.length;)(null===s[u]||void 0===s[u])&&(s[u]=r[u]);r=s,l?(function(t,r){let i;return function(...r){let o,s=t.length>r.length;s&&r.push(n);try{o=t.apply(this,r)}catch(t){if(s&&i)throw t;return n(t)}s||(o&&o.then&&"function"==typeof o.then?o.then(a,n):o instanceof Error?n(o):a(o)
56)};function n(t,...a){i||(i=!0,r(t,...a))}function a(t){n(null,t)}})(l,a)(...s):n(null,...s)}(null,...r)},use:function(i){if("function"!=typeof i)throw TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),r}};return r}()}copy(){let r=new t,i=-1;for(;++i<this.attachers.length;){let t=this.attachers[i];r.use(...t)}return r.data((0,yP.default)(!0,{},this.namespace)),r}data(t,r){return"string"==typeof t?2==arguments.length?(yZ("data",this.frozen),this.namespace[t]=r,this):yG.call(this.namespace,t)&&this.namespace[t]||void 0:t?(yZ("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[t,...r]=this.attachers[this.freezeIndex];if(!1===r[0])continue;!0===r[0]&&(r[0]=void 0);let i=t.call(this,...r);"function"==typeof i&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(t){this.freeze();let r=yK(t),i=this.parser||this.Parser;return yH("parse",i),i(String(r),r)}process(t,r){let i=this;return this.freeze(),yH("process",this.parser||this.Parser),yW("process",this.compiler||this.Compiler),r?n(void 0,r):new Promise(n);function n(n,a){let o=yK(t),s=i.parse(o);function l(t,i){t||!i?a(t):n?n(i):(pz(),r(void 0,i))}i.run(s,o,function(t,r,n){var a,o;if(t||!r||!n)return l(t);let s=i.stringify(r,n);"string"==typeof(a=s)||(o=a)&&"object"==typeof o&&"byteLength"in o&&"byteOffset"in o?n.value=s:n.result=s,l(t,n)})}}processSync(t){let r,i=!1;return this.freeze(),yH("processSync",this.parser||this.Parser),yW("processSync",this.compiler||this.Compiler),this.process(t,function(t,n){i=!0,yD(t),r=n}),yX("processSync","process",i),pz(),r}run(t,r,i){yY(t),this.freeze();let n=this.transformers;return i||"function"!=typeof r||(i=r,r=void 0),i?a(void 0,i):new Promise(a);function a(a,o){pz();let s=yK(r);n.run(t,s,function(r,n,s){let l=n||t;r?o(r):a?a(l):(pz(),i(void 0,l,s))})}}runSync(t,r){let i,n=!1;return this.run(t,r,function(t,r){yD(t),i=r,n=!0}),yX("runSync","run",n),pz(),i}stringify(t,r){this.freeze();let i=yK(r),n=this.compiler||this.Compiler;return yW("stringify",n),yY(t),n(t,i)}use(t,...r){let i=this.attachers,n=this.namespace;if(yZ("use",this.frozen),null==t);else if("function"==typeof t)s(t,r);else if("object"==typeof t)Array.isArray(t)?o(t):a(t);else throw TypeError("Expected usable value, not `"+t+"`");return this;function a(t){if(!("plugins"in t)&&!("settings"in t))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(t.plugins),t.settings&&(n.settings=(0,yP.default)(!0,n.settings,t.settings))}function o(t){let r=-1;if(null==t);else if(Array.isArray(t))for(;++r<t.length;)!function(t){if("function"==typeof t)s(t,[]);else if("object"==typeof t)if(Array.isArray(t)){let[r,...i]=t;s(r,i)}else a(t);else throw TypeError("Expected usable value, not `"+t+"`")}(t[r]);else throw TypeError("Expected a list of plugins, not `"+t+"`")}function s(t,r){let n=-1,a=-1;for(;++n<i.length;)if(i[n][0]===t){a=n;break}if(-1===a)i.push([t,...r]);else if(r.length>0){let[n,...o]=r,s=i[a][1];yI(s)&&yI(n)&&(n=(0,yP.default)(!0,s,n)),i[a]=[t,n,...o]}}}}().freeze();function yH(t,r){if("function"!=typeof r)throw TypeError("Cannot `"+t+"` without `parser`")}function yW(t,r){if("function"!=typeof r)throw TypeError("Cannot `"+t+"` without `compiler`")}function yZ(t,r){if(r)throw Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yY(t){if(!yI(t)||"string"!=typeof t.type)throw TypeError("Expected node, got `"+t+"`")}function yX(t,r,i){if(!i)throw Error("`"+t+"` finished async. Use `"+r+"` instead")}function yK(t){var r;return(r=t)&&"object"==typeof r&&"message"in r&&"messages"in r?t:new yz(t)}let yQ=[],yJ={allowDangerousHtml:!0},y0=/^(https?|ircs?|mailto|xmpp)$/i,y1=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function y2(t){var r;let i,n,a,o,s,l=(i=(r=t).rehypePlugins||yQ,n=r.remarkPlugins||yQ,a=r.remarkRehypeOptions?{...r.remarkRehypeOptions,...yJ}:yJ,yq().use(g5).use(n).use(yM,a).use(i)),u=(o=t.children||"",s=new yz,"string"==typeof o?s.value=o:pj(),s);return function(t,r){let i=r.allowedElements,n=r.allowElement,a=r.components,o=r.disallowedElements,s=r.skipHtml,l=r.unwrapDisallowed,u=r.urlTransform||y3;for(let t of y1)Object.hasOwn(r,t.from)&&pj((t.from,t.to&&t.to,t.id));return i&&o&&pj(),ym(t,function(t,r,a){if("raw"===t.type&&a&&"number"==typeof r)return s?a.children.splice(r,1):a.children[r]={type:"text",value:t.value},r;if("element"===t.type){let r;for(r in mG)if(Object.hasOwn(mG,r)&&Object.hasOwn(t.properties,r)){let i=t.properties[r],n=mG[r];(null===n||n.includes(t.tagName))&&(t.properties[r]=u(String(i||""),r,t))}}if("element"===t.type){let s=i?!i.includes(t.tagName):!!o&&o.includes(t.tagName);if(!s&&n&&"number"==typeof r&&(s=!n(t,r,a)),s&&a&&"number"==typeof r)return l&&t.children?a.children.splice(r,1,...t.children):a.children.splice(r,1),r}}),function(t,r){var i,n,a,o;let s;if(!r||void 0===r.Fragment)throw TypeError("Expected `Fragment` in options");let l=r.filePath||void 0;if(r.development){if("function"!=typeof r.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");i=l,n=r.jsxDEV,s=function(t,r,a,o){let s=Array.isArray(a.children),l=mE(t);return n(r,a,o,s,{columnNumber:l?l.column-1:void 0,fileName:i,lineNumber:l?l.line:void 0},void 0)}}else{if("function"!=typeof r.jsx)throw TypeError("Expected `jsx` in production options");
56if("function"!=typeof r.jsxs)throw TypeError("Expected `jsxs` in production options");a=r.jsx,o=r.jsxs,s=function(t,r,i,n){let s=Array.isArray(i.children)?o:a;return n?s(r,i,n):s(r,i)}}let u={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:l,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:!1!==r.passKeys,passNode:r.passNode||!1,schema:"svg"===r.space?mv:my,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==r.tableCellAlignToStyle},c=mF(u,t,void 0);return c&&"string"!=typeof c?c:u.create(t,u.Fragment,{children:c||void 0},void 0)}(t,{Fragment:eu.Fragment,components:a,ignoreInvalidStyle:!0,jsx:eu.jsx,jsxs:eu.jsxs,passKeys:!0,passNode:!0})}(l.runSync(l.parse(u),u),t)}function y3(t){let r=t.indexOf(":"),i=t.indexOf("?"),n=t.indexOf("#"),a=t.indexOf("/");return -1===r||-1!==a&&r>a||-1!==i&&r>i||-1!==n&&r>n||y0.test(t.slice(0,r))?t:""}let y4=/[#.]/g;function y6(t,r,i){let n=i?function(t){let r=new Map;for(let i of t)r.set(i.toLowerCase(),i);return r}(i):void 0;return function(i,a,...o){let s;if(null==i)s={type:"root",children:[]},o.unshift(a);else{let l=(s=function(t,r){let i,n,a=t||"",o={},s=0;for(;s<a.length;){y4.lastIndex=s;let t=y4.exec(a),r=a.slice(s,t?t.index:a.length);r&&(i?"#"===i?o.id=r:Array.isArray(o.className)?o.className.push(r):o.className=[r]:n=r,s+=r.length),t&&(i=t[0],s++)}return{type:"element",tagName:n||r||"div",properties:o,children:[]}}(i,r)).tagName.toLowerCase(),u=n?n.get(l):void 0;if(s.tagName=u||l,function(t){if(null===t||"object"!=typeof t||Array.isArray(t))return!0;if("string"!=typeof t.type)return!1;for(let r of Object.keys(t)){let i=t[r];if(i&&"object"==typeof i){if(!Array.isArray(i))return!0;for(let t of i)if("number"!=typeof t&&"string"!=typeof t)return!0}}return!!("children"in t&&Array.isArray(t.children))}(a))o.unshift(a);else for(let[r,i]of Object.entries(a))!function(t,r,i,n){let a,o=mr(t,i);if(null!=n){if("number"==typeof n){if(Number.isNaN(n))return;a=n}else a="boolean"==typeof n?n:"string"==typeof n?o.spaceSeparated?m_(n):o.commaSeparated?pU(n):o.commaOrSpaceSeparated?m_(pU(n).join(" ")):y5(o,o.property,n):Array.isArray(n)?[...n]:"style"===o.property?function(t){let r=[];for(let[i,n]of Object.entries(t))r.push([i,n].join(": "));return r.join("; ")}(n):String(n);if(Array.isArray(a)){let t=[];for(let r of a)t.push(y5(o,o.property,r));a=t}"className"===o.property&&Array.isArray(r.className)&&(a=r.className.concat(a)),r[o.property]=a}}(t,s.properties,r,i)}for(let t of o)!function t(r,i){if(null==i);else if("number"==typeof i||"string"==typeof i)r.push({type:"text",value:String(i)});else if(Array.isArray(i))for(let n of i)t(r,n);else if("object"==typeof i&&"type"in i)"root"===i.type?t(r,i.children):r.push(i);else throw Error("Expected node, nodes, or string, got `"+i+"`")}(s.children,t);return"element"===s.type&&"template"===s.tagName&&(s.content={type:"root",children:s.children},s.children=[]),s}}function y5(t,r,i){if("string"==typeof i){if(t.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((t.boolean||t.overloadedBoolean)&&(""===i||p7(i)===p7(r)))return!0}return i}let y8=y6(my,"div"),y7=y6(mv,"g",["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"]);function y9(t,r){let i=t.indexOf("\r",r),n=t.indexOf("\n",r);return -1===n?i:-1===i||i+1===n?n:i<n?i:n}let ve={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},vt={}.hasOwnProperty,vr=Object.prototype;function vi(t,r){let i;switch(r.nodeName){case"#comment":return i={type:"comment",value:r.data},va(t,r,i),i;case"#document":case"#document-fragment":{let n="mode"in r&&("quirks"===r.mode||"limited-quirks"===r.mode);if(i={type:"root",children:vn(t,r.childNodes),data:{quirksMode:n}},t.file&&t.location){let r,n,a=String(t.file),o=(r=String(a),n=[],{toOffset:function(t){if(t&&"number"==typeof t.line&&"number"==typeof t.column&&!Number.isNaN(t.line)&&!Number.isNaN(t.column)){for(;n.length<t.line;){let t=n[n.length-1],i=y9(r,t),a=-1===i?r.length+1:i+1;if(t===a)break;n.push(a)}let i=(t.line>1?n[t.line-2]:0)+t.column-1;if(i<n[t.line-1])return i}},toPoint:function(t){if("number"==typeof t&&t>-1&&t<=r.length){let i=0;for(;;){let a=n[i];if(void 0===a){let t=y9(r,n[i-1]);a=-1===t?r.length+1:t+1,n[i]=a}if(a>t)return{line:i+1,column:t-(i>
560?n[i-1]:0)+1,offset:t};i++}}}}),s=o.toPoint(0),l=o.toPoint(a.length);pz(),pz(),i.position={start:s,end:l}}return i}case"#documentType":return va(t,r,i={type:"doctype"}),i;case"#text":return i={type:"text",value:r.value},va(t,r,i),i;default:return function(t,r){let i=t.schema;t.schema=r.namespaceURI===ve.svg?mv:my;let n=-1,a={};for(;++n<r.attrs.length;){let t=r.attrs[n],i=(t.prefix?t.prefix+":":"")+t.name;vt.call(vr,i)||(a[i]=t.value)}let o=("svg"===t.schema.space?y7:y8)(r.tagName,a,vn(t,r.childNodes));if(va(t,r,o),"template"===o.tagName){let i=r.sourceCodeLocation,n=i&&i.startTag&&vo(i.startTag),a=i&&i.endTag&&vo(i.endTag),s=vi(t,r.content);n&&a&&t.file&&(s.position={start:n.end,end:a.start}),o.content=s}return t.schema=i,o}(t,r)}}function vn(t,r){let i=-1,n=[];for(;++i<r.length;){let a=vi(t,r[i]);n.push(a)}return n}function va(t,r,i){if("sourceCodeLocation"in r&&r.sourceCodeLocation&&t.file){let n=function(t,r,i){let n=vo(i);if("element"===r.type){let a=r.children[r.children.length-1];if(n&&!i.endTag&&a&&a.position&&a.position.end&&(n.end=Object.assign({},a.position.end)),t.verbose){let n,a={};if(i.attrs)for(n in i.attrs)vt.call(i.attrs,n)&&(a[mr(t.schema,n).property]=vo(i.attrs[n]));pz(i.startTag);let o=vo(i.startTag),s=i.endTag?vo(i.endTag):void 0,l={opening:o};s&&(l.closing=s),l.properties=a,r.data={position:l}}}return n}(t,i,r.sourceCodeLocation);n&&(t.location=!0,i.position=n)}}function vo(t){let r=vs({line:t.startLine,column:t.startCol,offset:t.startOffset}),i=vs({line:t.endLine,column:t.endCol,offset:t.endOffset});return r||i?{start:r,end:i}:void 0}function vs(t){return t.line&&t.column?t:void 0}let vl={}.hasOwnProperty;function vu(t,r){let i=r||{};function n(r,...i){let a=n.invalid,o=n.handlers;if(r&&vl.call(r,t)){let i=String(r[t]);a=vl.call(o,i)?o[i]:n.unknown}if(a)return a.call(this,r,...i)}return n.handlers=i.handlers||{},n.invalid=i.invalid,n.unknown=i.unknown,n}let vc={}.hasOwnProperty,vh=vu("type",{handlers:{root:function(t,r){let i={nodeName:"#document",mode:(t.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return i.childNodes=vf(t.children,i,r),vd(t,i),i},element:function(t,r){var i,n;let a,o,s=r;"element"===t.type&&"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(s=mv);let l=[];if(t.properties){for(a in t.properties)if("children"!==a&&vc.call(t.properties,a)){let r=function(t,r,i){let n=mr(t,r);if(!1===i||null==i||"number"==typeof i&&Number.isNaN(i)||!i&&n.boolean)return;Array.isArray(i)&&(i=n.commaSeparated?pV(i):mb(i));let a={name:n.attribute,value:!0===i?"":String(i)};if(n.space&&"html"!==n.space&&"svg"!==n.space){let t=a.name.indexOf(":");t<0?a.prefix="":(a.name=a.name.slice(t+1),a.prefix=n.attribute.slice(0,t)),a.namespace=ve[n.space]}return a}(s,a,t.properties[a]);r&&l.push(r)}}let u=s.space;pz();let c={nodeName:t.tagName,tagName:t.tagName,attrs:l,namespaceURI:ve[u],childNodes:[],parentNode:null};return c.childNodes=vf(t.children,c,s),vd(t,c),"template"===t.tagName&&t.content&&(i=t.content,n=s,(o={nodeName:"#document-fragment",childNodes:[]}).childNodes=vf(i.children,o,n),vd(i,o),c.content=o),c},text:function(t){let r={nodeName:"#text",value:t.value,parentNode:null};return vd(t,r),r},comment:function(t){let r={nodeName:"#comment",data:t.value,parentNode:null};return vd(t,r),r},doctype:function(t){let r={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return vd(t,r),r}}});function vf(t,r,i){let n=-1,a=[];if(t)for(;++n<t.length;){let o=vh(t[n],i);o.parentNode=r,a.push(o)}return a}function vd(t,r){let i=t.position;i&&i.start&&i.end&&(pz(i.start.offset),pz(i.end.offset),r.sourceCodeLocation={startLine:i.start.line,startCol:i.start.column,startOffset:i.start.offset,endLine:i.end.line,endCol:i.end.column,endOffset:i.end.offset})}let vp=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],vm=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]);(c=M||(M={}))[c.EOF=-1]="EOF",c[c.NULL=0]="NULL",c[c.TABULATION=9]="TABULATION",c[c.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",c[c.LINE_FEED=10]="LINE_FEED",c[c.FORM_FEED=12]="FORM_FEED",c[c.SPACE=32]="SPACE",c[c.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",c[c.QUOTATION_MARK=34]="QUOTATION_MARK",c[c.AMPERSAND=38]="AMPERSAND",c[c.APOSTROPHE=39]="APOSTROPHE",c[c.HYPHEN_MINUS=45]="HYPHEN_MINUS",c[c.SOLIDUS=47]="SOLIDUS",c[c.DIGIT_0=48]="DIGIT_0",c[c.DIGIT_9=57]="DIGIT_9",c[c.SEMICOLON=59]="SEMICOLON",c[c.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",c[c.EQUALS_SIGN=61]="EQUALS_SIGN",c[c.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",c[c.QUESTION_MARK=63]="QUESTION_MARK",c[c.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",c[c.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",c[c.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",c[c.GRAVE_ACCENT=96]="GRAVE_ACCENT",c[c.LATIN_SMALL_A=97]="LATIN_SMALL_A",c[c.LATIN_SMALL_Z=122]="LATIN_SMALL_Z";let vg="[CDATA[",vy="doctype",vv="script";function v_(t){return t>=55296&&t<=57343}function vb(t){return 32!==t&&10!==t&&13!==t&&9!==t&&12!==t&&t>=1&&t<=31||t>=127&&t<=159}function vx(t){return t>=64976&&t<=65007||vm.has(t)}(h=D||(D={})).controlCharacterInInputStream="control-character-in-input-stream",h.noncharacterInInputStream="noncharacter-in-input-stream",h.surrogateInInputStream="surrogate-in-input-stream",h.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",h.endTagWithAttributes="end-tag-with-attributes",h.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",h.unexpectedSolidusInTag="unexpected-solidus-in-tag",h.unexpectedNullCharacter="unexpected-null-character",h.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",h.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",h.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",h.missingEndTagName="missing-end-tag-name",h.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",h.unknownNamedCharacterReference="unknown-named-character-reference",h.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",h.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",h.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",h.eofBeforeTagName="eof-before-tag-name",h.eofInTag="eof-in-tag",h.missingAttributeValue="missing-attribute-value",h.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",h.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",h.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",h.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",h.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",h.missingQuoteBeforeDoctype
56SystemIdentifier="missing-quote-before-doctype-system-identifier",h.missingDoctypePublicIdentifier="missing-doctype-public-identifier",h.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",h.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",h.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",h.cdataInHtmlContent="cdata-in-html-content",h.incorrectlyOpenedComment="incorrectly-opened-comment",h.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",h.eofInDoctype="eof-in-doctype",h.nestedComment="nested-comment",h.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",h.eofInComment="eof-in-comment",h.incorrectlyClosedComment="incorrectly-closed-comment",h.eofInCdata="eof-in-cdata",h.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",h.nullCharacterReference="null-character-reference",h.surrogateCharacterReference="surrogate-character-reference",h.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",h.controlCharacterReference="control-character-reference",h.noncharacterCharacterReference="noncharacter-character-reference",h.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",h.missingDoctypeName="missing-doctype-name",h.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",h.duplicateAttribute="duplicate-attribute",h.nonConformingDoctype="non-conforming-doctype",h.missingDoctype="missing-doctype",h.misplacedDoctype="misplaced-doctype",h.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",h.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",h.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",h.openElementsLeftAfterEof="open-elements-left-after-eof",h.abandonedHeadElementChild="abandoned-head-element-child",h.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",h.nestedNoscriptInHead="nested-noscript-in-head",h.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text";class vw{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,r){let{line:i,col:n,offset:a}=this,o=n+r,s=a+r;return{code:t,startLine:i,endLine:i,startCol:o,endCol:o,startOffset:s,endOffset:s}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){let r=this.html.charCodeAt(this.pos+1);if(r>=56320&&r<=57343)return this.pos++,this._addGap(),(t-55296)*1024+9216+r}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,M.EOF;return this._err(D.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,r){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=r}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,r){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(r)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((32|this.html.charCodeAt(this.pos+r))!==t.charCodeAt(r))return!1;return!0}peek(t){let r=this.pos+t;if(r>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,M.EOF;let i=this.html.charCodeAt(r);return i===M.CARRIAGE_RETURN?M.LINE_FEED:i}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,M.EOF;let t=this.html.charCodeAt(this.pos);return t===M.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,M.LINE_FEED):t===M.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,v_(t)&&(t=this._processSurrogate(t)),null===this.handler.onParseError||t>31&&t<127||t===M.LINE_FEED||t===M.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){vb(t)?this._err(D.controlCharacterInInputStream):vx(t)&&this._err(D.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}function vE(t,r){for(let i=t.attrs.length-1;i>=0;i--)if(t.attrs[i].name===r)return t.attrs[i].value;return null}(f=P||(P={}))[f.CHARACTER=0]="CHARACTER",f[f.NULL_CHARACTER=1]="NULL_CHARACTER",f[f.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",f[f.START_TAG=3]="START_TAG",f[f.END_TAG=4]="END_TAG",f[f.COMMENT=5]="COMMENT",f[f.DOCTYPE=6]="DOCTYPE",f[f.EOF=7]="EOF",f[f.HIBERNATION=8]="HIBERNATION",t.s(["TokenType",0,P,"getTokenAttr",0,vE],382698);let vT=new Uint16Array(
vendor: 5,444 bytes, line 56
56'áµ<ÃıÊÒÕ»×ÙµÛÞ¢ßà à©àªà¶¡à¹à¼à¼¦áá¨á¡ááááá¥\0\0\0\0\0\0á«áá¦á°á·á½¾â â°âââ»ââ ¤â¤â´â¹â¿ããºã¹ã¬ã£¾ã¨¨ã©±ã« 㬮à EMabcfglmnoprstu\\bfms�¦³¹ÃÃligè»ÃäPè»&ä¦cuteè»Ãäreve;äÄiyx}rcè»Ãä;är;ìðraveè»Ãäpha;äacr;äd;æ©Ägp¡on;äf;ìð¸plyFunction;æ¡ingè»Ã
ä
Äcs¾Ãr;ìðign;æildeè»Ãämlè»ÃäÐaceforsuåûþÄÄĢħĪÄcrêòkslash;æÅ¶Ã¶Ã¸;æ«§ed;æy;äÆcrtÄ
ÄÄause;æµnoullis;æ¬a;är;ìð
pf;ìð¹eve;äcòÄmpeq;æÜHOacdefhilorsuÅÅÅÆÆÆ¢ÆµÆ·ÆºÇÈɳɸɾcy;ä§PYè»Â©ä©ÆcpyÅŢźute;äÄ;iŧŨætalDifferentialD;æ
leys;æÈaeioÆÆÆÆron;ädilè»Ãärc;änint;æ°ot;äÄdnƧÆilla;ä¸terDot;ä·Ã²Å¿i;ä§rcleÈDMPTÇÇÇÇot;æinus;ælus;æimes;æoÄcsǢǸkwiseContourIntegral;æ²eCurlyÄDQÈÈoubleQuote;æuote;æÈlnpuÈȨÉÉonÄ;eȥȦæ·;æ©´ÆgitȯȶȺruent;æ¡nt;æ¯ourIntegral;æ®ÄfrÉÉ;æoduct;ænterClockwiseContourIntegral;æ³oss;樯cr;ìðpÄ;CÊÊ
æap;æÖDJSZacefiosÊ Ê¬Ê°Ê´Ê¸ËËˡ˦̳ÒÄ;oŹʥtrahd;æ¤cy;äcy;ä
cy;äÆgrsÊ¿ËËger;æ¡r;æ¡hv;櫤ÄayËËron;ä;älÄ;tËËæa;är;ìðÄaf˫̧Äcm˰̢riticalÈADGTÌÌÌÌcute;ä´oÅ´ÌÌ;äbleAcute;ärave;ä ilde;äond;æferentialD;æ
Ѱ̽\0\0\0ÍÍ\0Ð
f;ìð»Æ;DEÍÍÍä¨ot;æqual;æbleÌCDLRUVͣͲÎÏϢϸontourIntegraìȹoɴ͹\0\0ͻ»ÍnArrow;æÄeoÎΤftÆARTÎÎΡrrow;æightArrow;æeÃ¥ËngÄLRΫÏeftÄARγιrrow;æ¸ightArrow;æºightArrow;æ¹ightÄATÏÏrrow;æee;æ¨pÉÏ©\0\0ϯrrow;æownArrow;æerticalBar;æ¥nÌABLRTaÐЪаÑѿͼrrowÆ;BUÐÐТæar;æ¤pArrow;æµreve;äeftËк\0Ñ\0ÑightVector;æ¥eeVector;æ¥ectorÄ;BÑÑæ½ar;æ¥ightÇѧ\0ѱeeVector;æ¥ectorÄ;BѺѻæar;æ¥eeÄ;AÒÒæ¤rrow;æ§ÄctÒÒr;ìðrok;äà NTacdfglmopqstuxÒ½ÓÓÓÓÓ¢Ó§Ó®ÓµÔ¡Ô¯Ô¶ÕÕÕ Õ¥G;ä
Hè»Ãäcuteè»ÃäÆaiyÓÓÓron;ärcè»Ãä;äot;är;ìðraveè»Ãäement;æÄapÓºÓ¾cr;ätyÉÔ\0\0ÔmallSquare;æ»erySmallSquare;æ«ÄgpÔ¦Ôªon;äf;ìð¼silon;äuÄaiÔ¼ÕlÄ;TÕÕæ©µilde;ælibrium;æÄciÕÕr;æ°m;橳a;ämlè»ÃäÄipÕªÕ¯sts;æonentialE;æ
ÊcfiosÖ
ÖÖÖ²×y;ä¤r;ìðlledÉÖ\0\0Ö£mallSquare;æ¼erySmallSquare;æªÍ°Öº\0Ö¿\0\0×f;ìð½All;æriertrf;æ±cÃ²×ØJTabcdfgorst×¨×¬×¯×ºØØØØØØ£Ù¬Ù²cy;äè»>ä¾mmaÄ;d׷׸ä;äreve;äÆeiyØØØdil;ä¢rc;ä;äot;ä r;ìð;æpf;ìð¾eaterÌEFGLSTصÙÙÙÙÙ¦qualÄ;Lؾؿæ¥ess;æullEqual;æ§reater;檢ess;æ·lantEqual;橾ilde;æ³cr;ìð¢;æ«ÐAacfiosuÚ
ÚÚÚÚÚªÚ¾ÛRDcy;äªÄctÚÚek;ä;äirc;ä¤r;ælbertSpace;æÇ°Ú¯\0Ú²f;æizontalLine;æÄctÛÛ
òکrok;ä¦mpÅÛÛownHumðįqual;æÜEJOacdfgmnostuÛºÛ¾ÜÜÜÜÜܡܨÝݸÞÞÞcy;älig;ä²cy;äcuteè»ÃäÄiyÜÜrcè»Ãä;äot;ä°r;æraveè»ÃäÆ;apÜ Ü¯Ü¿ÄcgÜ´Ü·r;äªinaryI;æ
lieóÏÇ´Ý\0Ý¢Ä;eÝÝæ¬ÄgrÝÝral;æ«section;æisibleÄCTݬݲomma;æ£imes;æ¢ÆgptÝ¿ÞÞon;ä®f;ìða;äcr;æilde;ä¨Ç«Þ\0Þcy;älè»ÃäÊcfosuÞ¬Þ·Þ¼ßßÄiyÞ±Þµrc;ä´;är;ìðpf;ìðÇ£ß\0ßr;ìð¥rcy;äkcy;äÎHJacfosߤߨ߽߬߱à à cy;ä¥cy;äppa;äÄeyß¶ß»dil;ä¶;är;ìðpf;ìðcr;ìð¦ÖJTaceflmostà ¥à ©à ¬à¡à¡£à¦³à¦¸à§à§à¨·à©cy;äè»<ä¼Êcmnprà ·à ¼à¡à¡à¡ute;ä¹bda;äg;æªlacetrf;ær;æÆaeyà¡à¡à¡¡ron;ä½dil;ä»;äÄfsࡨ॰tÔACDFRTUVarࡾࢩࢱࣦ࣠ࣼयà¥Î४Änrà¢à¢gleBracket;æ¨rowÆ;BRà¢à¢à¢æar;æ¤ightArrow;æeiling;æoǵࢷ\0à£bleBracket;æ¦nÇà£\0à£eeVector;楡ectorÄ;Bà£à£æar;æ¥loor;æightÄAV࣯ࣵrrow;æector;æ¥Äerà¤à¤eÆ;AVà¤à¤à¤æ£rrow;æ¤ector;æ¥iangleÆ;BEतथऩæ²ar;æ§qual;æ´pÆDTVषà¥à¥ownVector;æ¥eeVector;æ¥ ectorÄ;Bà¥à¥æ¿ar;æ¥ectorÄ;B॥०æ¼ar;æ¥ightáÎsÌEFGLSTॾà¦à¦à¦à¦¢à¦qualGreater;æullEqual;æ¦reater;æ¶ess;檡lantEqual;橽ilde;æ²r;ìðÄ;eঽাæftarrow;æidot;ä¿Ænpwà§à¨à¨gÈLRlrà§à§·à¨à¨eftÄAR০৬rrow;æµightArrow;æ·ightArrow;æ¶eftÄarγà¨ightáοightáÏf;ìðerÄLRਢਬeftArrow;æightArrow;æÆchtਾà©à©Ã²à¡;æ°rok;ä
;æªÐacefiosuà©à©à© ੷੼àª
àªàªp;æ¤
y;äÄdl੥੯iumSpace;ælintrf;æ³r;ìðnusPlus;æpf;ìðcò੶;äÒJacefostuણધàªà«à¬à¬à¶à¶à¶cy;äcute;ä
Æaey઴હાron;ä
dil;ä
;äÆgswà«à«°à¬ativeÆMTVà«à«à«¨ediumSpace;æhiÄcn૦à«Ã«à«eryThiîà«tedÄGL૸à¬reaterGreateòٳessLesóà©Line;är;ìðÈBnptଢନଷ଺reak;æ BreakingSpace;ä f;æÚ;CDEGHLNPRSTVàààªà¼à®¡à¯«à°à±à²à²¦à³àµ¡à¶
櫬Äouàà¤ngruent;æ¢pCap;æoubleVerticalBar;æ¦Ælqxà®à®à®ement;æualÄ;Tà®à®æ ilde;ìâ̸ists;æreaterÎ;EFGLSTஶஷ஽à¯à¯à¯à¯¥æ¯qual;æ±ullEqual;ìâ§Ì¸reater;ìâ«Ì¸ess;æ¹lantEqual;ì⩾̸ilde;æµumpÅ௲௽ownHump;ìâ̸qual;ìâ̸eÄfsà°à°§tTriangleÆ;BEà°à°à°¡æªar;ìâ§Ì¸qual;æ¬sÌ;EGLSTవశ఼à±à±à±æ®qual;æ°reater;æ¸ess;ìâªÌ¸lantEqual;ì⩽̸ilde;æ´estedÄGL౨౹reaterGreater;ì⪢̸essLess;ì⪡̸recedesÆ;ESà²à²à²æqual;ì⪯̸lantEqual;æ ÄeiಫಹverseElement;æghtTriangleÆ;BEà³à³à³æ«ar;ìâ§Ì¸qual;æÄquà³à´uareSuÄbp೨೹setÄ;Eà³°à³³ìâ̸qual;æ¢ersetÄ;Eà´à´ìâ̸qual;æ£Æbcpà´à´¤àµsetÄ;Eà´à´ìââqual;æceedsÈ;ESTà´²à´³à´»àµæqual;ì⪰̸lantEqual;æ¡ilde;ìâ¿Ì¸ersetÄ;Eàµàµìââqual;æildeÈ;EFT൮൯൵ൿæqual;æullEqual;æilde;æerticalBar;æ¤cr;ìð©ildeè»Ãä;äÜEacdfgmoprstuvà¶½à·à·à·à·à· à·§à·¼à¸à¸ ยา฿à¹lig;ä
cuteè»ÃäÄiyà·à·rcè»Ãä;äblac;ä
r;
vendor: 4,564 bytes, line 56
56ìðraveè»ÃäÆaei෮ෲ෶cr;ä
ga;ä©cron;äpf;ìðenCurlyÄDQà¸à¸oubleQuote;æuote;æ;æ©Äclวฬr;ìðªashè»ÃäiŬื฼deè»Ãäes;樷mlè»ÃäerÄBPà¹à¹ Äarà¹à¹r;æ¾acÄekà¹à¹;æet;æ´arenthesis;æÒacfhilors๿àºàºàºàºàºàºàº°à»¼rtialD;æy;är;ìði;ä¦;ä usMinus;ä±ÄipຢàºncareplanÃ¥Úf;æÈ;eio຺ູ໠໤檻cedesÈ;ESTà»à»à»à»æºqual;檯lantEqual;æ¼ilde;æ¾me;æ³Ädp໩໮uct;æortionÄ;aȥ໹l;æÄcià¼à¼r;ìð«;ä¨ÈUfosà¼à¼à¼à¼OTè»"ä¢r;ìðpf;æcr;ìð¬ØBEacefhiorsu༾à½à½à½ ཱིྦྷྪà¾áá©á´á¾arr;æ¤Gè»Â®ä®Æcnrà½à½à½ute;ä
g;æ«rÄ;tà½à½æ l;æ¤Æaeyཧཬཱron;ä
dil;ä
;ä Ä;vླྀཹæerseÄEUà¾à¾Älqà¾à¾ement;æuilibrium;æpEquilibrium;楯r»ཹo;ä¡ghtÐACDFTUVaà¿à¿«à¿³á¢á¨ááÏÄnrà¿à¿gleBracket;æ©rowÆ;BLà¿à¿à¿¡æar;æ¥eftArrow;æeiling;æoǵ࿹\0á
bleBracket;æ§nÇá\0áeeVector;æ¥ectorÄ;Bááæar;æ¥loor;æÄerááeÆ;AVáµá¶á¼æ¢rrow;æ¦ector;æ¥iangleÆ;BEáááæ³ar;æ§qual;æµpÆDTVá£á®á¸ownVector;æ¥eeVector;æ¥ectorÄ;Bááæ¾ar;æ¥ectorÄ;Bááæar;æ¥Äpuááf;ændImplies;楰ightarrow;æÄchá¹á¼r;æ;æ±leDelayed;æ§´ÚHOacfhimoqstuá¤á±á·á½ááá
á
á
¡á
§áµá»á¿ÄCcá©á®Hcy;ä©y;ä¨FTcy;ä¬cute;ä
Ê;aeiyáááááæª¼ron;ä
dil;ä
rc;ä
;ä¡r;ìðortÈDLRUáªá´á¾á
ownArrow»ÐeftArrow»à¢ightArrow»à¿pArrow;ægma;ä£allCircle;æpf;ìðɲá
\0\0á
°t;æareÈ;ISUá
ȇ
¼áá¯æ¡ntersection;æuÄbpáásetÄ;Eááæqual;æersetÄ;Eá¨á©æqual;ænion;æcr;ìð®ar;æÈbcmpááááÄ;sááæetÄ;Eááqual;æÄchá á
eedsÈ;ESTáá®á´á¿æ»qual;檰lantEqual;æ½ilde;æ¿Tháà¾;æÆ;esááá£ærsetÄ;Eááæqual;æet»áÖHRSacfhiorsá¾ááááá±á¶ááááORNè»ÃäADE;æ¢ÄHcáácy;äy;ä¦Äbuáá;ä;䤯aeyá¥áªá¯ron;ä
¤dil;ä
¢;ä¢r;ìðÄeiá»áDzá\0áefore;æ´a;äÄcnáákSpace;ìââSpace;ældeÈ;EFTá«á¬á²á¼æ¼qual;æullEqual;æ
ilde;æpf;ìðipleDot;æÄctáár;ìð¯rok;ä
¦à«¡á·ááá¦\0á¬á±\0\0\0\0\0á¸á½á·á
\0á¿áááÄcrá»áuteè»ÃärÄ;oááæcir;æ¥rÇ£á\0áy;äve;ä
¬Äiyáá£rcè»Ãä;ä£blac;ä
°r;ìðraveè»Ãäacr;ä
ªÄdiáá©erÄBPááÄaráár;äacÄekáá;æet;æµarenthesis;æonÄ;Pá°á±ælus;æÄgpá»á¿on;ä
²f;ìðÐADETadpsáá®á¸áϨááá³rrowÆ;BDá
á á¤ar;æ¤ownArrow;æ
ownArrow;æquilibrium;楮eeÄ;Aááæ¥rrow;æ¥ownáϳerÄLRáá¨eftArrow;æightArrow;æiÄ;lá¹áºäon;ä¥ing;ä
®cr;ìð°ilde;ä
¨mlè»ÃäÒDbcdefosvá§á¬á°á³á¾á
áááash;æ«ar;æ««y;äashÄ;lá»á¼æ©;櫦Äeráá
;æÆbtyáááºar;æÄ;iáácalÈBLSTá¡á¥áªá´ar;æ£ine;ä¼eparator;æilde;æThinSpace;ær;ìðpf;ìðcr;ìð±dash;æªÊcefosá§á¬á±á¶á¼irc;ä
´dge;ær;ìðpf;ìðcr;ìð²Èfiosáááár;ìð;äpf;ìðcr;ìð³ÒAIUacfosuá±áµá¹á½ááááá cy;ä¯cy;äcy;ä®cuteè»ÃäÄiyáárc;ä
¶;ä«r;ìðpf;ìðcr;ìð´ml;ä
¸ÐHacdefosáµá¹á¿áááá á¤cy;äcute;ä
¹Äayááron;ä
½;äot;ä
»Ç²á\0áoWidtèà«a;är;æ¨pf;æ¤cr;ìðµà¯¡ááá\0á°á¶á¿\0\0\0\0ááá«áá\0ááá²á¹\0á¾cuteè»Ã¡ä¡reve;äÌ;Ediuyááá¡á£á¨áæ¾;ìâ¾Ì³;æ¿rcè»Ã¢ä¢teè»Â´Ì;ä°ligè»Ã¦ä¦Ä;r²áº;ìðraveè»Ã ä ÄepááÄfpáásym;æµÃ¨áha;ä±ÄapácÄclá¤á§r;äg;樿ɤá°\0\0áÊ;adsváºá»á¿ááæ§nd;æ©;æ©lope;æ©;æ©Î;elmrszááááá¿ááæ ;榤e»ásdÄ;aá¥á¦æ¡Ñ¡á°á²á´á¶á¸áºá¼á¾;榨;榩;榪;榫;榬;æ¦;榮;榯tÄ;vá
áæbÄ;dááæ¾;æ¦Äptááh;æ¢Â»Â¹arr;æ¼Ägpá£á§on;ä
f;ìðÎ;Eaeiopáá»á½áááá;æ©°cir;橯;æd;æs;ä§roxÄ;eááñáingè»Ã¥ä¥Æctyá¡á¦á¨r;ìð¶;äªmpÄ;eáá¯Ã±Êildeè»Ã£ä£mlè»Ã¤ä¤Äciááoninôɲnt;æ¨à Nabcdefiklnoprsuáá±á°á¼ááá¸á½á á¦á ¹á¡á᤽á¥á¥°ot;æ«Äcrá¶ákÈcepsáá
ááong;æpsilon;ä¶rime;æµimÄ;eááæ½q;æÅ¶á¢á¦ee;æ½edÄ;gá¬áæ
e»árkÄ;táá·brk;æ¶Äoyáá;ä±quo;æÊcmprtááá¡á¤á¨ausÄ;eÄÄptyv;榰séánoÃµÄÆahwá¯á±á³;ä²;æ¶een;æ¬r;ìðgÎcostuvwááá³ááááÆaiuáááÃ°Ý rc;æ¯pÂ»á±Ædptá¤á¨áot;æ¨lus;æ¨imes;æ¨É±á¹\0\0á¾cup;æ¨ar;æ
riangleÄduááown;æ½p;æ³plus;æ¨eÃ¥áÃ¥áarow;æ¤Æakoáá ¦á µÄcná²á £kÆlstáºÖ«á ozenge;æ§«riangleÈ;dlrá á á á æ´own;æ¾eft;æight;æ¸k;æ£Æ±á «\0á ³Æ²á ¯\0á ±;æ;æ4;æck;æÄeoá ¾á¡Ä;qá¡á¡ì=â¥uiv;ìâ¡â¥t;æÈptwxá¡á¡á¡§á¡¬f;
vendor: 6,122 bytes, line 56
56ìðÄ;táá¡£om»átie;æØDHUVbdhmptuvá¢
á¢á¢ªá¢»á£á£á£¬á£¿á¤
á¤á¤á¤¡ÈLRlrá¢á¢á¢á¢;æ;æ;æ;æÊ;DUduᢡᢢᢤᢦᢨæ;æ¦;æ©;æ¤;æ§ÈLRlrᢳᢵᢷᢹ;æ;æ;æ;æÎ;HLRhlrá£á£á£á£á£á£á£æ;æ¬;æ£;æ ;æ«;æ¢;æox;æ§ÈLRlrᣤᣦᣨᣪ;æ;æ;æ;æÊ;DUduڽ᣷᣹᣻᣽;æ¥;æ¨;æ¬;æ´inus;ælus;æimes;æ ÈLRlrá¤á¤á¤á¤;æ;æ;æ;æÎ;HLRhlrᤰᤱᤳᤵᤷ᤻᤹æ;æª;æ¡;æ;æ¼;æ¤;æÄevÄ£á¥barè»Â¦ä¦Èceioá¥á¥á¥á¥ r;ìð·mi;æmÄ;eáálÆ;bhᥨᥩᥫä;æ§
sub;æÅ¬á¥´á¥¾lÄ;e᥹᥺æ¢t»᥺pÆ;Eeįá¦
á¦;檮Ä;qÛÛೡᦧ\0᧨á¨á¨á¨²\0ᨷá©\0\0᪴\0\0á«\0\0ᬡᬮáá\0᯽\0á°Æcprá¦á¦²á§ute;äÌ;abcdsᦿá§á§á§á§á§æ©nd;æ©rcup;æ©Äauá§á§p;æ©p;æ©ot;æ©;ìâ©ï¸Äeo᧢᧥t;æÃ®ÚÈaeiuá§°á§»á¨á¨
ǰ᧵\0᧸s;æ©on;ädilè»Ã§ä§rc;äpsÄ;sá¨á¨æ©m;æ©ot;äÆdmná¨á¨ ᨦilè»Â¸Æptyv;榲tè¢;eá¨á¨®ä¢räƲr;ìð Æceiᨽá©á©y;äckÄ;má©á©æark»á©;ärÎ;Ecefmsá©á© ᩢᩫ᪤᪪᪮æ;æ§Æ;elᩩᩪá©äq;æeɡᩴ\0\0áªrrowÄlr᩼áªeft;æºight;æ»ÊRSacdáªáªáªáªáªÂ»à½;æst;æirc;æash;ænint;æ¨id;櫯cir;æ§ubsÄ;u᪻᪼æ£it»᪼ˬá«á«á«º\0á¬onÄ;eá«á«äºÄ;qÃÃÉá«\0\0á«¢aÄ;tá«á«ä¬;äÆ;fl᫨᫩᫫æÃ®á
eÄmx᫱᫶ent»᫩eóÉǧ᫾\0á¬Ä;dá»á¬ot;æ©nÃ´ÉÆfryá¬á¬á¬;ìðoäÉè©;sÅá¬r;æÄaoᬥᬩrr;æµss;æÄcuᬲᬷr;ìð¸ÄbpᬼáÄ;eááæ«;æ«Ä;eááæ«;æ«dot;æ¯Îdelprvwá á¬á·á®á®¬á¯á¯¹arrÄlrá¨áª;椸;椵ɰá²\0\0áµr;æc;æarrÄ;pá¿á®æ¶;椽Ì;bcdosá®á®á®á®¡á®¥á®¨æªrcap;æ©Äauá®á®p;æ©p;æ©ot;ær;æ©
;ìâªï¸Èalrv᮵ᮿá¯á¯£rrÄ;mᮼᮽæ·;椼yÆevwá¯á¯á¯qɰá¯\0\0á¯reãá³uãáµee;æedge;æenè»Â¤ä¤earrowÄlrᯮ᯳eft»á®ight»ᮽeäá¯Äciá°á°oninôǷnt;æ±lcty;æà¦AHabcdefhijlorstuwz᰸᰻᰿á±á±©á±µá²á²á²¬á²·á³»á³¿á´áµ»á¶á¶«á¶»á·á·ròÎar;楥Èglrsá±á±á±á±ger;æ eth;æ¸Ã²á³hÄ;vá±á±æÂ»à¤Å«á±¡á±§arow;æ¤aãÌÄayᱮᱳron;ä;ä´Æ;ao̲ᱼá²ÄgrÊ¿á²r;ætseq;æ©·Æglmá²á²á²è»Â°ä°ta;ä´ptyv;榱ÄirᲣᲨsht;楿;ìð¡arÄlrᲳᲵ»à£Â»áÊaegsvá³Í¸á³á³á³ mÆ;oșá³á³ndÄ;șá³uit;æ¦amma;äin;æ²Æ;io᳧᳨᳸ä·deè÷;oá³§á³°ntimes;ænø᳷cy;äcɯá´\0\0á´rn;æop;æÊlptuwá´á´á´¢áµáµlar;ä¤f;ìðÊ;empsÌá´á´·á´½áµqÄ;dÍá´³ot;æinus;æ¸lus;æquare;æ¡blebarwedgåúnÆadhá®áµáµ§ownarrowóá²arpoonÄlrᵲᵶefôᲴighôᲶŢᵿá¶
karo÷à½É¯á¶\0\0á¶rn;æop;æÆcotá¶á¶£á¶¦Äryá¶á¶¡;ìð¹;äl;æ§¶rok;äÄdrá¶°á¶´ot;æ±iÄ;fá¶ºá æ¿Äahá·á·ròЩaòྦangle;榦Äciá·á·y;ägrarr;æ¿à¤Dacdefglmnopqrstuxá¸á¸á¸á¸¸Õ¸á¸¼á¹á¹¡á¹¾áº¥áº¯áº½á»¡á¼ªá¼·á½á½á½ÄDoá¸á´´oôá²Äcsá¸á¸uteè»Ã©ä©ter;æ©®ÈaioyḢḧḱḶron;ärÄ;cá¸á¸®æè»Ãªäªlon;æ;äot;äÄDrá¹á¹
ot;æ;ìð¢Æ;rsá¹á¹á¹æªaveè»Ã¨ä¨Ä;dá¹á¹æªot;æªÈ;ilsṪṫṲṴæªnters;æ§;æÄ;dṹṺæªot;æªÆapsáº
áºáºcr;ätyÆ;sváºáºáºæ
et»áºpÄ1;áºáº¤Ä³áº¡áº£;æ;æ
æÄgsẪẬ;ä
p;æÄgpẴẸon;äf;ìðÆalsá»á»á»rÄ;sá»á»æl;æ§£us;橱iÆ;lvá»á»á»äµon»á»;äµÈcsuvỪỳá¼á¼£Äioữḱrc»Ḯɩỹ\0\0á»»ÃÕantÄglá¼á¼tr»á¹ess»ṺÆaeiá¼á¼á¼ls;ä½st;ævÄ;DȵἠD;橸parsl;æ§¥ÄDaἯἳot;ærr;楱Æcdiá¼¾á½á»¸r;æ¯oôÍÄahá½á½;ä·è»Ã°ä°Ämrá½á½lè»Ã«ä«o;æ¬Æcipὡὤὧl;ä¡sôծÄeoὬὴctatioîÕnentialåչৡá¾\0á¾\0ᾡᾧ\0\0á¿á¿\0á¿\0ῦῪâ\0ââllingdotseñá¹y;ämale;æÆilrá¾á¾³á¿lig;èï¬É©á¾¹\0\0á¾½g;èï¬ig;èï¬;ìð£lig;èï¬lig;ìfjÆaltá¿á¿á¿¡t;æig;èï¬ns;æ±of;äǰ΅\0ῳf;ìðÄakÖ¿á¿·Ä;vῼ´æ;æ«artint;æ¨ÄaoââÄcsââαââ°â¸â
â\0âβâ¢â¥â§âªâ¬\0â®è»Â½ä½;æ
è»Â¼ä¼;æ
;æ
;æ
Ƴâ´\0â¶;æ
;æ
Ê´â¾â\0\0âè»Â¾ä¾;æ
;æ
5;æ
ƶâ\0â;æ
;æ
8;æ
l;æwn;æ¢cr;ìð»à¢Eabcdefgijlnorstvââââ¥â°â´â°âµâºâ¿âââ¸Ìâ¾â
âÄ;lÙâ;æªÆcmpâââute;äµmaÄ;dâá³ä³;æªreve;äÄiyâªâ®rc;ä;ä³ot;ä¡È;lqsؾÙâ½âÆ;qsؾÙâlanô٥È;cdlÙ¥âââ¥c;檩otÄ;oââæªÄ;lâ¢â£æª;æªÄ;eâªâìâï¸s;æªr;ìð¤Ä;gÙ³Ømel;æ·cy;äÈ;EajÙâââ;æª;檥;檤ÈEaesâââ©â´;æ©pÄ;pâ£â¤æªrox»â¤Ä;qâ®â¯æªÄ;qâ®âim;æ§pf;ìðÄciâ
â
r;æmÆ;elÙ«â
â
;æª;æªè>;cdlqr×®â
â
ªâ
®â
³â
¹Äciâ
¥â
§;檧r;橺ot;æPar;æ¦uest;橼Êadelsââ
ªâÙâǰâ\0âproøâr;楸qÄlqØ¿âlesóâiÃÙ«Äenâ£ârtneqq;ìâ©ï¸Ã
âªÔAabcefkosyâââ±âµâºâââ¯â¨â½ròΠÈilmrâââârsðáf»â¤ilôکÄdrâ â¤cy;äÆ;cwࣴâ«â¯ir;æ¥;æar;æirc;䥯alrââârtsÄ;uââæ¥it»âlip;æ¦con;æ¹r;ìð¥sÄewâ£â©arow;椥arow;椦Êamoprâºâ¾âââ£rr;æ¿tht;æ»kÄlrââeftarrow;æ©ightarrow;æªf;ìðbar;æÆcltâ¯â´â¸r;ìð½asèâ´rok;ä§Äbpââull;æhen»á±à«¡â£\0âª\0â¸â
â\0ââ³\0\0â¸â¢â§â¢â¿\0ââªâ´cuteè»ÃäÆ;iyݱâ°âµrcè»Ã®ä®;ä¸Äcxâ¼â¿y;äµclè»Â¡ä¡ÄfrÎâ;ìð¦raveè»Ã¬ä¬È;inoܾââ©â®Äinâ¢â¦nt;æ¨t;æfin;æ§ta;æ©lig;䳯aopâ¾ââÆcgtâ
ââr;䫯elpÜââinÃ¥ÞarÃ´Ü h;ä±f;æ·ed;äµÊ;cfotÓ´â¬â±â½âare;æ
inÄ;tâ¸â¹æie;æ§doôâÊ;celpÝââââ¡al;æºÄgrââeróá£Ã£âarhk;æ¨rod;樼Ècgptâ¯â²â¶â»y;äon;ä¯f;ìða;ä¹uestè»Â¿ä¿Äciââr;ìð¾nÊ;EdsvÓ´âââ¡Ó³;æ¹ot;æµÄ;vâ¦â§æ´;æ³Ä;iÝ·â®lde;ä©Ç«â¸\0â¼cy;älè»Ã¯ä¯Ìcfmosuââââ¡â§âµÄiyâârc;äµ;ä¹r;ìð§ath;ä·pf;ìðÇ£â¬\0â±r;ìð¿rcy;äkcy;äÐacfghjosâââ¢â§ââ±âµâ»ppaÄ;vââäº;ä°Äeyââ dil;ä·;äºr;ìð¨reen;ä¸cy;ä
cy;äpf;ìðcr;ìðà®ABEHabcdefghjlmnoprstuvâ°ââââââ½âââââ¥â¹â½ââ²âââ¨âââ â Æartâ·âºâ¼ròà§Ã²Îail;æ¤arr;æ¤Ä;gà¦â;æªar;楢ॣâ¥\0âª\0â±\0\0\0\0\0âµâº\0âââ\0â¹ute;äºmptyv;榴raîà¡bda;ä»gÆ;dlà¢ââ;æ¦Ã¥à¢;æª
uoè»Â«ä«rÐ;bfhlpstà¢ââ¦â©â«â®â±âµÄ;fà¢â£s;æ¤s;æ¤Ã«âp;æ«l;椹im;楳l;æ¢Æ;aeâ¿ââæª«il;æ¤Ä;sââæª;ìâªï¸Æabrââârr;æ¤rk;æ²Äakâ¢â¬cÄekâ¨âª;ä»;äÄesâ±â³;æ¦lÄduâ¹â»;æ¦;æ¦Èaeuyââââron;ä¾Ädiââil;ä¼Ã¬à¢°Ã¢â©;
vendor: 10,520 bytes, line 56
56ä»Ècqrsâ£â¦ââ½a;椶uoÄ;rà¸áÄduâ²â·har;楧shar;æ¥h;æ²Ê;fgqsââà¦â³â¿æ¤tÊahlrtââ¤â·ââ¨rrowÄ;tà¢â¡aéâ¶arpoonÄduâ¯â´own»Ñp»०eftarrows;æightÆahsââârrowÄ;sࣴࢧarpoonóà¾quigarro÷â°hreetimes;æÆ;qsâà¦âºlanôবÊ;cdgsবââââ¨c;檨otÄ;oââæ©¿Ä;rââæª;æªÄ;eâ¢â¥ìâï¸s;æªÊadegsâ³â¹â½ââpproøâot;æqÄgqââ
ôà¦gtòâôà¦iÃলÆilrâ࣡âsht;楼;ìð©Ä;Eà¦â£;æªÅ¡â©â¶rÄduâ²â®Ä;l॥â³;楪lk;æcy;äÊ;achtà©ââââròâorneòá´ard;楫ri;æºÄioââ¤dot;ä
ustÄ;aâ¬âæ°che»âÈEaesâ»â½ââ;æ¨pÄ;pââæªrox»âÄ;qââæªÄ;qââ»im;æ¦Ðabnoptwzâ©â´â·ââ¯âââÄnrâ®â±g;æ¬r;æ½rëà£gÆlmrâ¿ââeftÄar০âightá৲apsto;æ¼ightá৽parrowÄlrâ¥â©efôâight;æ¬Æaflâ¶â¹â½r;æ¦
;ìðus;æ¨imes;樴šââst;æÃ¡áÆ;efââá ænge»âarÄ;lâ¤â¥ä¨t;æ¦Êachmtâ³â¶â¼â
âròࢨorneòá¶arÄ;dà¾â;æ¥;æri;æ¿Ìachiqtââà©â¢â®â»quo;æ¹r;ìðmÆ;egলâªâ¬;æª;æªÄbuâªâ³oÄ;rà¸â¹;ærok;ä
è<;cdhilqrà «ââ¹ââ â¥âªâ°Äciââ;檦r;橹reÃ¥â²mes;æarr;楶uest;æ©»ÄPiâµâ¹ar;æ¦Æ;efâ à¤á ærÄduâ â shar;æ¥har;楦Äenâ â ¡rtneqq;ìâ¨ï¸Ã
â ÜDacdefhilnopsuâ¡â¡
â¢â¢â¢â¢ ⢥⢨â£â£¢â£¤àªâ£³â¤Dot;æºÈclprâ¡â¡â¡£â¡½rè»Â¯ä¯Äetâ¡â¡;æÄ;eâ¡â¡æ se»â¡Ä;sá»â¡¨toÈ;dluá»â¡³â¡·â¡»owîÒefôà¤Ã°áker;æ®Äoyâ¢â¢mma;権;ä¼ash;æasuredangle»á¦r;ìðªo;æ§Æcdn⢯⢴â£roè»ÂµäµÈ;acdá¤â¢½â£â£sôá§ir;æ«°otè»Â·ÆµusÆ;bdâ£á¤â£æÄ;uá´¼â£;横ţâ£â£¡p;æ«Ã²âðàªÄdp⣩⣮els;æ§f;ìðÄct⣸⣽r;ìðpos»áÆ;lmâ¤â¤â¤ä¼timap;æ¸à°GLRVabcdefghijlmoprstuvwâ¥â¥â¥¾â¦â¦â§â§©â¨â¨â©â©âªâªâª¤âª¨â¬â¬ââ¿â®®â°´â±§â±¼â³©Ägtâ¥â¥;ìâ̸Ä;vâ¥à¯ìâ«âÆeltâ¥â¥²â¥¶ftÄar⥡⥧rrow;æightarrow;æ;ìâ̸Ä;v⥻à±ìâªâightarrow;æÄDdâ¦â¦ash;æ¯ash;æ®Êbcnpt⦣⦧⦬⦱â§la»Ëute;ä
g;ìâ âÊ;Eiopà¶â¦¼â§â§
â§;ì⩰̸d;ìâ̸s;ä
roøà¶urÄ;aâ§â§æ®lÄ;sâ§à¬¸Ç³â§\0â§£pè»Â ଷmpÄ;e௹à°Êaeouyâ§´â§¾â¨â¨â¨Ç°â§¹\0â§»;æ©on;ä
dil;ä
ngÄ;dൾâ¨ot;ìâ©Ì¸p;æ©;ä½ash;æÎ;Aadqsxà®â¨©â¨â¨»â©â©
â©rr;ærÄhr⨳⨶k;椤Ä;oá²á°ot;ìâ̸uiöà£Äeiâ©â©ar;椨Ãà®istÄ;sà® à®r;ìð«ÈEestà¯
⩦⩹⩼Æ;qs஼â©à¯¡Æ;qs஼à¯
â©´lanô௢iÃ௪Ä;rà®¶âªÂ»à®·ÆAapâªâªâªrò⥱rr;æ®ar;櫲Æ;svà¾âªà¾Ä;d⪡⪢æ¼;æºcy;äÎAEadest⪷⪺⪾â«â«
⫶⫹rò⥦;ìâ¦Ì¸rr;ær;æ¥È;fqsà°»â«â«£â«¯tÄarâ«â«rro÷â«ightarroÃ·âªÆ;qs఻⪺⫪lanôà±Ä;sà±â«´Â»à°¶iÃà±Ä;rవ⫾iÄ;eà°à°¥iäà¶Äptâ¬â¬f;ìðè¬;inâ¬â¬â¬¶ä¬nÈ;Edvà®â¬¤â¬¨â¬®;ìâ¹Ì¸ot;ìâµÌ¸Ç¡à®â¬³â¬µ;æ·;æ¶iÄ;vಸ⬼ǡಸââ;æ¾;æ½Æaorââ£â©rÈ;astà»âââlleìà»l;ì⫽â¥;ìâ̸lint;æ¨Æ;ceà²â°â³uåಥÄ;cà²â¸Ä;eà²â½Ã±à²ÈAaitâ®â®â®â®§ròâ¦rrÆ;cwâ®â®â®æ;ì⤳̸;ìâ̸ghtarrow»â®riÄ;eà³à³Îchimpqu⮽â¯â¯â¬à¸â¯¤â¯¯È;cerà´²â¯à´·â¯uÃ¥àµ
;ìðortÉâ¬
\0\0â¯aráâmÄ;e൮â¯Ä;q൴൳suÄbp⯫â¯Ã¥à³¸Ã¥à´Æbcp⯶â°â°È;Ees⯿â°à´¢â°æ;ìâ«
̸etÄ;eà´â°qÄ;qà´£â°cÄ;eà´²â°Ã±à´¸È;EesⰢⰣàµâ°§æ
;ìâ«Ì¸etÄ;eàµâ°®qÄ;qൠⰣÈgilrⰽⰿâ±
â±Ã¬à¯ldeè»Ã±ä±Ã§à±iangleÄlrâ±â±eftÄ;eà°â±Ã±à°¦ightÄ;eà³â±¥Ã±à³Ä;mⱬâ±ä½Æ;esⱴⱵⱹä£ro;æp;æÒDHadgilrsâ²â²â²â²â²£â²°â²¶â³â³£ash;æarr;æ¤p;ìââash;æ¬ÄetⲨⲬ;ìâ¥â;ì>ânfin;æ§ÆAetâ²½â³â³
rr;æ¤;ìâ¤âÄ;râ³â³ì<âie;ìâ´âÄAtâ³â³rr;æ¤rie;ìâµâim;ìâ¼âÆAanâ³°â³´â´rr;ærÄhr⳺⳽k;椣Ä;oá§á¥ear;椧ááª\0\0\0\0\0\0\0\0\0\0\0\0\0â´\0â´¸âµâµ ⵥ⵲â¶á¬\0\0â¶â¶«\0â·â·\0â·â¸â¸«â¸¾â¹Äcsâ´±áªuteè»Ã³ä³Äiyâ´¼âµ
rÄ;cáªâµè»Ã´ä´;ä¾Êabios᪠âµâµÇâµlac;ä
v;樸old;榼lig;ä
Äcr⵩âµir;榿;ìð¬Í¯âµ¹\0\0âµ¼\0â¶n;äaveè»Ã²ä²;æ§Äbmâ¶à·´ar;榵Èacitâ¶â¶â¶¥â¶¨ròáªÄirâ¶â¶ r;榾oss;榻nÃ¥à¹;æ§Æaeiⶱⶵⶹcr;ä
ga;äÆcdnâ·â·
Çron;ä¿;榶pf;ìð Æaelâ·â·Çr;榷rp;榹Î;adiosvⷪⷫⷮâ¸â¸â¸â¸æ¨ròáªÈ;efmâ··â·¸â¸â¸
æ©rÄ;oⷾⷿæ´f»ⷿè»Âªäªè»Âºäºgof;æ¶r;æ©lope;æ©;æ©Æcloâ¸â¸¡â¸§Ã²â¸ashè»Ã¸ä¸l;æiŬⸯ⸴deè»ÃµäµesÄ;aÇ⸺s;樶mlè»Ã¶ä¶bar;æ½à«¡â¹\0â¹½\0âºâº\0⺢⺹\0\0â»àº\0â¼\0\0⼫⾼\0â¿rÈ;astÐâ¹§â¹²àº
è¶;lâ¹â¹®ä¶leìÐɩ⹸\0\0â¹»m;櫳;櫽y;ä¿rÊcimptâºâºâºá¡¥âºnt;ä¥od;ä®il;æ°enk;æ±r;ìðÆimo⺨⺰⺴Ä;vâºâº®ä;ämaô੶ne;æÆ;tv⺿â»â»ächfork»´;äÄauâ»â»nÄckâ»â»kÄ;hâ´â»;æÃ¶â´sÒ;abcdemst⻳⻴á¤â»¹â»½â¼â¼â¼â¼ä«cir;樣ir;樢Äouáµâ¼;樥;橲nè»Â±àºim;樦wo;樧Æipuâ¼â¼ â¼¥ntint;æ¨f;ìð¡ndè»Â£ä£Ô;Eaceinosuà»â¼¿â½â½â½â¾â¾â¾â½¾â¾¶;檳p;檷uÃ¥à»Ä;cà»â½Ì;acensà»â½â½â½¦â½¨â½¾pproøâ½urlyeñà»Ã±à»Æaes⽯⽶⽺pprox;檹qq;檵im;æ¨iÃà»meÄ;sâ¾àº®æ²ÆEas⽸â¾â½ºÃ°â½µÆdfp໬â¾â¾¯Æals⾠⾥⾪lar;æ®ine;æurf;æÄ;t໻⾴ï໻rel;æ°Äciâ¿â¿
r;ìð
;äncsp;æÌfiopsuâ¿â¢â¿â¿¥â¿«â¿±r;ìð®pf;ìð¢rime;æcr;ìðÆaeo⿸ããtÄei⿾ã
rnionóڰnt;æ¨stÄ;eããä¿Ã±á¼Ã´à¼àªABHabcdefhilmnoprstuxããããã ãã«ã
ã
¢ã
²ãããã¤ã©ãã®ã²ãã°ã·Æartãããròá³Ã²Ïail;æ¤aròᱥar;楤Îcdenqrtã¨ãµã¸ã¿ãããÄeuãã±;ìâ½Ì±te;ä
iãá
®mptyv;榳gÈ;delà¿ããã;æ¦;榥åà¿uoè»Â»ä»rÖ;abcfhlpstwà¿ã¬ã¯ã·ã¹ã¼ã¾ããããp;極Ä;fà¿ ã´s;æ¤ ;椳s;æ¤Ã«âðâ®l;æ¥
im;楴l;æ£;æÄaiããil;æ¤oÄ;nããæ¶alÃ³à¼Æabrã§ãªã®ròá¥rk;æ³Äakã³ã½cÄekã¹ã»;ä½;äÄesãã;æ¦lÄduãã;æ¦;æ¦Èaeuyããã§ã©ron;ä
Ädiã¡ã¥il;ä
ì࿲âãº;äÈclqsã´ã·ã½ã
a;椷dhar;楩uoÄ;rÈÈh;æ³Æacgã
ã
à½lÈ;ipsླྀã
ã
ánÃ¥á»arôྩt;æÆilrã
©á£ã
®sht;楽;ìð¯Äaoã
·ãrÄduã
½ã
¿Â»Ñ»Ä;láã;楬Ä;vããä;䱯gnsãã¹ã¼htÌahlrstã¤ã°ããã¤ã®rrowÄ;tà¿ãaéãarpoonÄduã»ã¿owîã
¾p»áeftÄahããrrowó࿪arpoonóÕightarrows;æquigarro÷ãhreetimes;æg;äingdotseñἲÆahmãããrò࿪aòÕ;æoustÄ;aããæ±che»ãmid;æ«®Èabptã²ã½ããÄnrã·ãºg;ær;æ¾rëáÆaflãããr;æ¦;ìð£us;樮imes;樵Äapãã§rÄ;gã£ã¤ä©t;æ¦olint;æ¨aròã£Èachqã»ãá¼ã
quo;æºr;ìðÄbuã»ãoÄ;rÈÈÆhirããã reÃ¥ã¸mes;æiÈ;eflãªáá ¡ã«æ¹tri;æ§luhar;楨;æàµ¡ãããã¬ã¸ã±\0ãºã¤\0\0ã¬ã°\0ã¨ãããã±ãã±\0ã\0\0ã³cute;ä
quïâºÔ;Eaceinpsyáã³ãµã¿ããããã¦ã©;檴ǰãº\0ã¼;檸on;ä
¡uÃ¥á¾Ä;dá³ãil;ä
rc;ä
ÆEasããã;檶p;檺im;æ©olint;æ¨iÃá;äotÆ;beã´áµãµæ
;橦ÎAacmstxãããããã£ãrr;ærÄhrããëâ¨Ä;oਸ਼਴tè»Â§ä§i;ä»war;椩mÄinã©Ã°nuóñt;æ¶rÄ;oã¶âìð°Èacoyãããã rp;æ¯Ähyããcy;ä;ärtÉã\0\0ãiäá¤araì⹯è»ÂäÄgmã¨ã´maÆ;fvã±ã²ã²ä;äÐ;deglnprá«ã
ããããã¡ã¦ot;橪Ä;qá±á°Ä;Eããæª;æª Ä;Eããæª;æªe;ælus;樤arr;楲aròá½Èaeitã¸ãããÄlsã½ãlsetméãªhp;樳parsl;槤Ädlá£ãe;æ£Ä;eããæªªÄ;sã¢ã£æª¬;ìâª¬ï¸Æflpã®ã³ãtcy;äÄ;bã¸ã¹ä¯Ä;aã¾ã¿æ§r;æ¿f;ìð¤aÄdrãÐesÄ;uããæ it»ãÆcsuã ã¹ãÄauã¥ã¯pÄ;sáã«;ìâï¸pÄ;sá´ãµ;ìâï¸uÄbpã¿ãÆ;esááãetÄ;eáãñáÆ;esá¨áãetÄ;eá¨ãÃ±á®Æ;afá
»ã¦Ö°rÅ¥ã«Ö±Â»á
¼aròá
Ècemtã¹ã¾ãã
r;ìðtmîñiìãaræá¾ÄarããrÄ;fãá¿æÄanããightÄepã£ãªpsiloîỠhé⺯s»â¡Êbcmnpã»ãáããÒ;Edemnprsãããããã£ã¬ã±ã¶æ;æ«
ot;檽Ä;dáãot;æ«ult;æ«ÄEeã¨ãª;æ«;ælus;檿arr;楹Æeiuã½ããtÆ;enãã
ãqÄ;qáãeqÄ;qã«ã¨m;æ«Äbpãã;æ«;æ«cÌ;acensáã¬ã²ã¹ã»ã¦pproøãºurlyeñá¾Ã±á³Æaesãããpproøãqñãg;æªÚ123;Edehlmnpsã©ã¬ã¯áã²ã´ãããããã¨ãè»Â¹ä¹è»Â²ä²è»Â³ä³;æ«Äosã¹ã¼t;檾ub;æ«Ä;dá¢ã
ot;æ«sÄouããl;æb;æ«arr;楻ult;æ«ÄEeã¤ã¦;æ«;ælus;æ«Æeiuã´ããtÆ;enáã¼ãqÄ;qá¢ã²eqÄ;qã§ã¤m;æ«Äbpãã;æ«;æ«ÆAanãã ãrr;ærÄhrã¦ã¨Ã«â®Ä;oਫ਩war;椪ligè»Ãä௡ããã áã³ã¹\0ã¾ã\0\0\0\0\0ãã\0ãã¬\0\0\0ãɲã\0\0ãget;æ;ärÃ«à¹Æaeyã¦ã«ã°ron;ä
¥dil;ä
£;älrec;ær;ìð±Èeikoãããµã¼Ç²ã\0ãeÄ4fááaÆ;svãããä¸ym;äÄcnã¢ã²kÄasã¨ã®pproøáim»á¬sðáÄasãºã®Ã°árnè»Ã¾ä¾Ç¬Ìãâ§esèÃ;bdãããäÄ;aá¤ãr;樱;樰Æepsã¡ã£ãáâ©È;bcfÒã¬ã°ã´ot;æ¶ir;櫱Ä;oã¹ã¼ìð¥rk;æ«Ã¡ã¢rime;æ´Æaipããã¤dÃ¥áÎadempstã¡ããããããngleÊ;dlqrã°ã±ã¶ããæµown»ᶻeftÄ;eâ ã¾Ã±à¤®;æightÄ;eãªãñáot;æ¬inus;樺lus;樹b;æ§ime;樻ezium;æ¢Æchtã²ã½ãÄryã·ã»;ìð;äcy;ärok;ä
§Äioããxôá·headÄlrãã eftarro÷à¡ightarrow»à½à¤AHabcdfghlmoprstuwãããã¤ã°ã¼ã ã 㠣㠴ã¡ã¡ã¡«ã¢©ã£ã£ã£ªã£¶ròÏar;楣Äcrãã¢uteè»ÃºäºÃ²á
rÇ£ãª\0ãy;äve;ä
Äiyãµãºrcè»Ã»ä»;äÆabhã ã ã ròálac;ä
±aòáÄirã ã sht;楾;ìð²raveè»Ã¹ä¹Å¡ã §ã ±rÄlr㠬㠮»à¥Â»álk;æÄctã ¹ã¡É¯ã ¿\0\0ã¡rnÄ;eã¡
ã¡ær»ã¡op;æri;æ¸Äalã¡ã¡cr;ä
«è»Â¨ÍÄgp㡢㡦on;ä
³f;ìð¦Ìadhlsuá
㡸㡽á²ã¢ã¢ ownáá³arpoonÄlrã¢ã¢efôã ighô㠯iÆ;hlã¢ã¢ã¢ä
»áºon»ã¢parrows;æÆcit㢰ã£ã£É¯ã¢¶\0\0ã£rnÄ;e㢼㢽ær»㢽op;æng;ä
¯ri;æ¹cr;ìðÆdirã£ã£ã£¢ot;æ°lde;ä
©iÄ;fã°ã£¨Â»á Äam㣯㣲rò㢨lè»Ã¼ä¼angle;榧ÞABDacdeflnoprszã¤ã¤ã¤©ã¤ã¦µã¦¸ã¦½ã§ã§¤ã§¨ã§³ã§¹ã§½ã¨ã¨ ròϷarÄ;v㤦㤧櫨;æ«©asèϡÄnr㤲㤷grt;æ¦Îeknprstã£ã¥ã¥ã¥ã¥ã¥¤ã¦appáâothinÃ§áºÆhirã«â»ã¥opô⾵Ä;há·ã¥¢Ã¯ãÄiu㥩ã¥gmáã³Äbp㥲ã¦setneqÄ;q㥽ã¦ìâï¸;ìâ«ï¸setneqÄ;qã¦ã¦ìâï¸;ìâ«ï¸Ährã¦ã¦etáãiangleÄlr㦪㦯eft»थight»áy;ä²ashÂ»á¶Æelrã§ã§ã§Æ;beâ·ªã§ã§ar;æ»q;ælip;æ®Äbtã§á¨aòá©r;ìð³tré㦮suÄbp㧯㧱»à´Â»àµpf;ìð§roð໻tré㦴Äcuã¨ã¨r;ìðÄbpã¨ã¨nÄEeã¦ã¨Â»ã¥¾nÄEeã¦ã¨Â»ã¦igzag;æ¦Îcefoprs㨶㨻ã©ã©ã©ã©¡ã©ªirc;ä
µÄdiã©ã©Äbgã©
ã©ar;æ©eÄ;qáºã©;æerp;ær;ìð´pf;ìð¨Ä;eá¹ã©¦atèá¹cr;ìðà«£áãª\0ãª\0ãªãª\0\0ãªãª¨ãª«ãª¯\0\0ã«ã«\0ã«áátréár;ìðµÄAaãªãªròÏrò৶;ä¾ÄAa㪡㪤ròθrò৫aðâis;æ»Ædptá¤ãªµãª¾Äfl㪺á©;ìð©imÃ¥á²ÄAaã«ã«ròÏròà¨Äcqã«á¸r;ìðÄptáã«réáÐacefiosu㫰㫽ã¬ã¬ã¬ã¬ã¬ã¬¡cÄuyã«¶ã«»teè»Ã½ä½;äÄiyã¬ã¬rc;ä
·;änè»Â¥ä¥r;ìð¶cy;äpf;ìðªcr;ìðÄcm㬦㬩y;älè»Ã¿ä¿Ôacdefhioswããããã¤ã©ãã´ãºã®cute;ä
ºÄayããron;ä
¾;ä·ot;ä
¼Äetãã¡træáa;ä¶r;ìð·cy;ä¶grarr;æpf;ìð«cr;ìðÄjnã®
ã®;æj;æ'.split("").map(
56t=>t.charCodeAt(0))),vA=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function vS(t){return t>=k.ZERO&&t<=k.NINE}I=String.fromCodePoint,(d=k||(k={}))[d.NUM=35]="NUM",d[d.SEMI=59]="SEMI",d[d.EQUALS=61]="EQUALS",d[d.ZERO=48]="ZERO",d[d.NINE=57]="NINE",d[d.LOWER_A=97]="LOWER_A",d[d.LOWER_F=102]="LOWER_F",d[d.LOWER_X=120]="LOWER_X",d[d.LOWER_Z=122]="LOWER_Z",d[d.UPPER_A=65]="UPPER_A",d[d.UPPER_F=70]="UPPER_F",d[d.UPPER_Z=90]="UPPER_Z",(p=O||(O={}))[p.VALUE_LENGTH=49152]="VALUE_LENGTH",p[p.BRANCH_LENGTH=16256]="BRANCH_LENGTH",p[p.JUMP_TABLE=127]="JUMP_TABLE",(m=N||(N={}))[m.EntityStart=0]="EntityStart",m[m.NumericStart=1]="NumericStart",m[m.NumericDecimal=2]="NumericDecimal",m[m.NumericHex=3]="NumericHex",m[m.NamedEntity=4]="NamedEntity",(g=L||(L={}))[g.Legacy=0]="Legacy",g[g.Strict=1]="Strict",g[g.Attribute=2]="Attribute";class vC{constructor(t,r,i){this.decodeTree=t,this.emitCodePoint=r,this.errors=i,this.state=N.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=L.Strict}startEntity(t){this.decodeMode=t,this.state=N.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,r){switch(this.state){case N.EntityStart:if(t.charCodeAt(r)===k.NUM)return this.state=N.NumericStart,this.consumed+=1,this.stateNumericStart(t,r+1);return this.state=N.NamedEntity,this.stateNamedEntity(t,r);case N.NumericStart:return this.stateNumericStart(t,r);case N.NumericDecimal:return this.stateNumericDecimal(t,r);case N.NumericHex:return this.stateNumericHex(t,r);case N.NamedEntity:return this.stateNamedEntity(t,r)}}stateNumericStart(t,r){return r>=t.length?-1:(32|t.charCodeAt(r))===k.LOWER_X?(this.state=N.NumericHex,this.consumed+=1,this.stateNumericHex(t,r+1)):(this.state=N.NumericDecimal,this.stateNumericDecimal(t,r))}addToNumericResult(t,r,i,n){if(r!==i){let a=i-r;this.result=this.result*Math.pow(n,a)+Number.parseInt(t.substr(r,a),n),this.consumed+=a}}stateNumericHex(t,r){let i=r;for(;r<t.length;){var n;let a=t.charCodeAt(r);if(!vS(a)&&(!((n=a)>=k.UPPER_A)||!(n<=k.UPPER_F))&&(!(n>=k.LOWER_A)||!(n<=k.LOWER_F)))return this.addToNumericResult(t,i,r,16),this.emitNumericEntity(a,3);r+=1}return this.addToNumericResult(t,i,r,16),-1}stateNumericDecimal(t,r){let i=r;for(;r<t.length;){let n=t.charCodeAt(r);if(!vS(n))return this.addToNumericResult(t,i,r,10),this.emitNumericEntity(n,2);r+=1}
56return this.addToNumericResult(t,i,r,10),-1}emitNumericEntity(t,r){var i,n,a;if(this.consumed<=r)return null==(i=this.errors)||i.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===k.SEMI)this.consumed+=1;else if(this.decodeMode===L.Strict)return 0;return this.emitCodePoint((n=this.result)>=55296&&n<=57343||n>1114111?65533:null!=(a=vA.get(n))?a:n,this.consumed),this.errors&&(t!==k.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,r){let{decodeTree:i}=this,n=i[this.treeIndex],a=(n&O.VALUE_LENGTH)>>14;for(;r<t.length;r++,this.excess++){let o=t.charCodeAt(r);if(this.treeIndex=function(t,r,i,n){let a=(r&O.BRANCH_LENGTH)>>7,o=r&O.JUMP_TABLE;if(0===a)return 0!==o&&n===o?i:-1;if(o){let r=n-o;return r<0||r>=a?-1:t[i+r]-1}let s=i,l=s+a-1;for(;s<=l;){let r=s+l>>>1,i=t[r];if(i<n)s=r+1;else{if(!(i>n))return t[r+a];l=r-1}}return -1}(i,n,this.treeIndex+Math.max(1,a),o),this.treeIndex<0)return 0===this.result||this.decodeMode===L.Attribute&&(0===a||function(t){var r;return t===k.EQUALS||(r=t)>=k.UPPER_A&&r<=k.UPPER_Z||r>=k.LOWER_A&&r<=k.LOWER_Z||vS(r)}(o))?0:this.emitNotTerminatedNamedEntity();if(0!=(a=((n=i[this.treeIndex])&O.VALUE_LENGTH)>>14)){if(o===k.SEMI)return this.emitNamedEntityData(this.treeIndex,a,this.consumed+this.excess);this.decodeMode!==L.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return -1}emitNotTerminatedNamedEntity(){var t;let{result:r,decodeTree:i}=this,n=(i[r]&O.VALUE_LENGTH)>>14;return this.emitNamedEntityData(r,n,this.consumed),null==(t=this.errors)||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,r,i){let{decodeTree:n}=this;return this.emitCodePoint(1===r?n[t]&~O.VALUE_LENGTH:n[t+1],i),3===r&&this.emitCodePoint(n[t+2],i),i}end(){var t;switch(this.state){case N.NamedEntity:return 0!==this.result&&(this.decodeMode!==L.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case N.NumericDecimal:return this.emitNumericEntity(0,2);case N.NumericHex:return this.emitNumericEntity(0,3);case N.NumericStart:return null==(t=this.errors)||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case N.EntityStart:return 0}}}(y=R||(R={})).HTML="http://www.w3.org/1999/xhtml",y.MATHML="http://www.w3.org/1998/Math/MathML",y.SVG="http://www.w3.org/2000/svg",y.XLINK="http://www.w3.org/1999/xlink",y.XML="http://www.w3.org/XML/1998/namespace",y.XMLNS="http://www.w3.org/2000/xmlns/",(v=F||(F={})).TYPE="type",v.ACTION="action",v.ENCODING="encoding",v.PROMPT="prompt",v.NAME="name",v.COLOR="color",v.FACE="face",v.SIZE="size",(_=B||(B={})).NO_QUIRKS="no-quirks",_.QUIRKS="quirks",_.LIMITED_QUIRKS="limited-quirks",(b=z||(z={})).A="a",b.ADDRESS="address",b.ANNOTATION_XML="annotation-xml",b.APPLET="applet",b.AREA="area",b.ARTICLE="article",b.ASIDE="aside",b.B="b",b.BASE="base",b.BASEFONT="basefont",b.BGSOUND="bgsound",b.BIG="big",b.BLOCKQUOTE="blockquote",b.BODY="body",b.BR="br",b.BUTTON="button",b.CAPTION="caption",b.CENTER="center",b.CODE="code",b.COL="col",b.COLGROUP="colgroup",b.DD="dd",b.DESC="desc",b.DETAILS="details",b.DIALOG="dialog",b.DIR="dir",b.DIV="div",b.DL="dl",b.DT="dt",b.EM="em",b.EMBED="embed",b.FIELDSET="fieldset",b.FIGCAPTION="figcaption",b.FIGURE="figure",b.FONT="font",b.FOOTER="footer",b.FOREIGN_OBJECT="foreignObject",b.FORM="form",b.FRAME="frame",b.FRAMESET="frameset",b.H1="h1",b.H2="h2",b.H3="h3",b.H4="h4",b.H5="h5",b.H6="h6",b.HEAD="head",b.HEADER="header",b.HGROUP="hgroup",b.HR="hr",b.HTML="html",b.I="i",b.IMG="img",b.IMAGE="image",b.INPUT="input",b.IFRAME="iframe",b.KEYGEN="keygen",b.LABEL="label",b.LI="li",b.LINK="link",b.LISTING="listing",b.MAIN="main",b.MALIGNMARK="malignmark",b.MARQUEE="marquee",b.MATH="math",b.MENU="menu",b.META="meta",b.MGLYPH="mglyph",b.MI="mi",b.MO="mo",b.MN="mn",b.MS="ms",b.MTEXT="mtext",b.NAV="nav",b.NOBR="nobr",b.NOFRAMES="noframes",b.NOEMBED="noembed",b.NOSCRIPT="noscript",b.OBJECT="object",b.OL="ol",b.OPTGROUP="optgroup",b.OPTION="option",b.P="p",b.PARAM="param",b.PLAINTEXT="plaintext",b.PRE="pre",b.RB="rb",b.RP="rp",b.RT="rt",b.RTC="rtc",b.RUBY="ruby",b.S="s",b.SCRIPT="script",b.SEARCH="search",b.SECTION="section",b.SELECT="select",b.SOURCE="source",b.SMALL="small",b.SPAN="span",b.STRIKE="str
56ike",b.STRONG="strong",b.STYLE="style",b.SUB="sub",b.SUMMARY="summary",b.SUP="sup",b.TABLE="table",b.TBODY="tbody",b.TEMPLATE="template",b.TEXTAREA="textarea",b.TFOOT="tfoot",b.TD="td",b.TH="th",b.THEAD="thead",b.TITLE="title",b.TR="tr",b.TRACK="track",b.TT="tt",b.U="u",b.UL="ul",b.SVG="svg",b.VAR="var",b.WBR="wbr",b.XMP="xmp",(x=j||(j={}))[x.UNKNOWN=0]="UNKNOWN",x[x.A=1]="A",x[x.ADDRESS=2]="ADDRESS",x[x.ANNOTATION_XML=3]="ANNOTATION_XML",x[x.APPLET=4]="APPLET",x[x.AREA=5]="AREA",x[x.ARTICLE=6]="ARTICLE",x[x.ASIDE=7]="ASIDE",x[x.B=8]="B",x[x.BASE=9]="BASE",x[x.BASEFONT=10]="BASEFONT",x[x.BGSOUND=11]="BGSOUND",x[x.BIG=12]="BIG",x[x.BLOCKQUOTE=13]="BLOCKQUOTE",x[x.BODY=14]="BODY",x[x.BR=15]="BR",x[x.BUTTON=16]="BUTTON",x[x.CAPTION=17]="CAPTION",x[x.CENTER=18]="CENTER",x[x.CODE=19]="CODE",x[x.COL=20]="COL",x[x.COLGROUP=21]="COLGROUP",x[x.DD=22]="DD",x[x.DESC=23]="DESC",x[x.DETAILS=24]="DETAILS",x[x.DIALOG=25]="DIALOG",x[x.DIR=26]="DIR",x[x.DIV=27]="DIV",x[x.DL=28]="DL",x[x.DT=29]="DT",x[x.EM=30]="EM",x[x.EMBED=31]="EMBED",x[x.FIELDSET=32]="FIELDSET",x[x.FIGCAPTION=33]="FIGCAPTION",x[x.FIGURE=34]="FIGURE",x[x.FONT=35]="FONT",x[x.FOOTER=36]="FOOTER",x[x.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",x[x.FORM=38]="FORM",x[x.FRAME=39]="FRAME",x[x.FRAMESET=40]="FRAMESET",x[x.H1=41]="H1",x[x.H2=42]="H2",x[x.H3=43]="H3",x[x.H4=44]="H4",x[x.H5=45]="H5",x[x.H6=46]="H6",x[x.HEAD=47]="HEAD",x[x.HEADER=48]="HEADER",x[x.HGROUP=49]="HGROUP",x[x.HR=50]="HR",x[x.HTML=51]="HTML",x[x.I=52]="I",x[x.IMG=53]="IMG",x[x.IMAGE=54]="IMAGE",x[x.INPUT=55]="INPUT",x[x.IFRAME=56]="IFRAME",x[x.KEYGEN=57]="KEYGEN",x[x.LABEL=58]="LABEL",x[x.LI=59]="LI",x[x.LINK=60]="LINK",x[x.LISTING=61]="LISTING",x[x.MAIN=62]="MAIN",x[x.MALIGNMARK=63]="MALIGNMARK",x[x.MARQUEE=64]="MARQUEE",x[x.MATH=65]="MATH",x[x.MENU=66]="MENU",x[x.META=67]="META",x[x.MGLYPH=68]="MGLYPH",x[x.MI=69]="MI",x[x.MO=70]="MO",x[x.MN=71]="MN",x[x.MS=72]="MS",x[x.MTEXT=73]="MTEXT",x[x.NAV=74]="NAV",x[x.NOBR=75]="NOBR",x[x.NOFRAMES=76]="NOFRAMES",x[x.NOEMBED=77]="NOEMBED",x[x.NOSCRIPT=78]="NOSCRIPT",x[x.OBJECT=79]="OBJECT",x[x.OL=80]="OL",x[x.OPTGROUP=81]="OPTGROUP",x[x.OPTION=82]="OPTION",x[x.P=83]="P",x[x.PARAM=84]="PARAM",x[x.PLAINTEXT=85]="PLAINTEXT",x[x.PRE=86]="PRE",x[x.RB=87]="RB",x[x.RP=88]="RP",x[x.RT=89]="RT",x[x.RTC=90]="RTC",x[x.RUBY=91]="RUBY",x[x.S=92]="S",x[x.SCRIPT=93]="SCRIPT",x[x.SEARCH=94]="SEARCH",x[x.SECTION=95]="SECTION",x[x.SELECT=96]="SELECT",x[x.SOURCE=97]="SOURCE",x[x.SMALL=98]="SMALL",x[x.SPAN=99]="SPAN",x[x.STRIKE=100]="STRIKE",x[x.STRONG=101]="STRONG",x[x.STYLE=102]="STYLE",x[x.SUB=103]="SUB",x[x.SUMMARY=104]="SUMMARY",x[x.SUP=105]="SUP",x[x.TABLE=106]="TABLE",x[x.TBODY=107]="TBODY",x[x.TEMPLATE=108]="TEMPLATE",x[x.TEXTAREA=109]="TEXTAREA",x[x.TFOOT=110]="TFOOT",x[x.TD=111]="TD",x[x.TH=112]="TH",x[x.THEAD=113]="THEAD",x[x.TITLE=114]="TITLE",x[x.TR=115]="TR",x[x.TRACK=116]="TRACK",x[x.TT=117]="TT",x[x.U=118]="U",x[x.UL=119]="UL",x[x.SVG=120]="SVG",x[x.VAR=121]="VAR",x[x.WBR=122]="WBR",x[x.XMP=123]="XMP";let vM=new Map([[z.A,j.A],[z.ADDRESS,j.ADDRESS],[z.ANNOTATION_XML,j.ANNOTATION_XML],[z.APPLET,j.APPLET],[z.AREA,j.AREA],[z.ARTICLE,j.ARTICLE],[z.ASIDE,j.ASIDE],[z.B,j.B],[z.BASE,j.BASE],[z.BASEFONT,j.BASEFONT],[z.BGSOUND,j.BGSOUND],[z.BIG,j.BIG],[z.BLOCKQUOTE,j.BLOCKQUOTE],[z.BODY,j.BODY],[z.BR,j.BR],[z.BUTTON,j.BUTTON],[z.CAPTION,j.CAPTION],[z.CENTER,j.CENTER],[z.CODE,j.CODE],[z.COL,j.COL],[z.COLGROUP,j.COLGROUP],[z.DD,j.DD],[z.DESC,j.DESC],[z.DETAILS,j.DETAILS],[z.DIALOG,j.DIALOG],[z.DIR,j.DIR],[z.DIV,j.DIV],[z.DL,j.DL],[z.DT,j.DT],[z.EM,j.EM],[z.EMBED,j.EMBED],[z.FIELDSET,j.FIELDSET],[z.FIGCAPTION,j.FIGCAPTION],[z.FIGURE,j.FIGURE],[z.FONT,j.FONT],[z.FOOTER,j.FOOTER],[z.FOREIGN_OBJECT,j.FOREIGN_OBJECT],[z.FORM,j.FORM],[z.FRAME,j.FRAME],[z.FRAMESET,j.FRAMESET],[z.H1,j.H1],[z.H2,j.H2],[z.H3,j.H3],[z.H4,j.H4],[z.H5,j.H5],[z.H6,j.H6],[z.HEAD,j.HEAD],[z.HEADER,j.HEADER],[z.HGROUP,j.HGROUP],[z.HR,j.HR],[z.HTML,j.HTML],[z.I,j.I],[z.IMG,j.IMG],[z.IMAGE,j.IMAGE],[z.INPUT,j.INPUT],[z.IFRAME,j.IFRAME],[z.KEYGEN,j.KEYGEN],[z.LABEL,j.LABEL],[z.LI,j.LI],[z.LINK,j.LINK],[z.LISTING,j.LISTING],[z.MAIN,j.MAIN],[z.MALIGNMARK,j.MALIGNMARK],[z.MARQUEE,j.MARQUEE],[z.MATH,j.MATH],[z.MENU,j.MENU],[z.META,j.META],[z.MGLYPH,j.MGLYPH],[z.MI,j.MI],[z.MO,j.MO],[z.MN,j.MN],[z.MS,j.MS],[z.MTEXT,j.MTEXT],[z.NAV,j.NAV],[z.NOBR,j.NOBR],[z.NOFRAMES,j.NOFRAMES],[z.NOEMBED,j.NOEMBED],[z.NOSCRIPT,j.NOSCRIPT],[z.OBJECT,j.OBJECT],[z.OL,j.OL],[z.OPTGROUP,j.OPTGROUP],[z.OPTION,j.OPTION],[z.P,j.P],[z.PARAM,j.PARAM],[z.PLAINTEXT,j.PLAINTEXT],[z.PRE,j.PRE],[z.RB,j.RB],[z.RP,j.RP],[z.RT,j.RT],[z.RTC,j.RTC],[z.RUBY,j.RUBY],[z.S,j.S],[z.SCRIPT,j.SCRIPT],[z.SEARCH,j.SEARCH],[z.SECTION,j.SECTION],[z.SELECT,j.SELECT],[z.SOURCE,j.SOURCE],[z.SMALL,j.SMALL],[z.SPAN,j.SPAN],[z.STRIKE,j.STRIKE],[z.STRONG,j.STRONG],[z.STYLE,j.STYLE],[z.SUB,j.SUB],[z.SUMMARY,j.SUMMARY],[z.SUP,j.SUP],[z.TABLE,j.TABLE],[z.TBODY,j.TBODY],[z.TEMPLATE,j.TEMPLATE],[z.TEXTAREA,j.TEXTAREA],[z.TFOOT,j.TFOOT],[z.TD,j.TD],[z.TH,j.TH],[z.THEAD,j.THEAD],[z.TITLE,j.TITLE],[z.TR,j.TR],[z.TRACK,j.TRACK],[z.TT,j.TT],[z.U,j.U],[z.UL,j.UL],[z.SVG,j.SVG],[z.VAR,j.VAR],[z.WBR,j.WBR],[z.XMP,j.XMP]]);function vD(t){var r;return null!=(r=vM.get(t))?r:j.UNKNOWN}let vP=j,vI={[R.HTML]:new Set([vP.ADDRESS,vP.APPLET,vP.AREA,vP.ARTICLE,vP.ASIDE,vP.BASE,vP.BASEFONT,vP.BGSOUND,vP.BLOCKQUOTE,vP.BODY,vP.BR,vP.BUTTON,vP.CAPTION,vP.CENT
56ER,vP.COL,vP.COLGROUP,vP.DD,vP.DETAILS,vP.DIR,vP.DIV,vP.DL,vP.DT,vP.EMBED,vP.FIELDSET,vP.FIGCAPTION,vP.FIGURE,vP.FOOTER,vP.FORM,vP.FRAME,vP.FRAMESET,vP.H1,vP.H2,vP.H3,vP.H4,vP.H5,vP.H6,vP.HEAD,vP.HEADER,vP.HGROUP,vP.HR,vP.HTML,vP.IFRAME,vP.IMG,vP.INPUT,vP.LI,vP.LINK,vP.LISTING,vP.MAIN,vP.MARQUEE,vP.MENU,vP.META,vP.NAV,vP.NOEMBED,vP.NOFRAMES,vP.NOSCRIPT,vP.OBJECT,vP.OL,vP.P,vP.PARAM,vP.PLAINTEXT,vP.PRE,vP.SCRIPT,vP.SECTION,vP.SELECT,vP.SOURCE,vP.STYLE,vP.SUMMARY,vP.TABLE,vP.TBODY,vP.TD,vP.TEMPLATE,vP.TEXTAREA,vP.TFOOT,vP.TH,vP.THEAD,vP.TITLE,vP.TR,vP.TRACK,vP.UL,vP.WBR,vP.XMP]),[R.MATHML]:new Set([vP.MI,vP.MO,vP.MN,vP.MS,vP.MTEXT,vP.ANNOTATION_XML]),[R.SVG]:new Set([vP.TITLE,vP.FOREIGN_OBJECT,vP.DESC]),[R.XLINK]:new Set,[R.XML]:new Set,[R.XMLNS]:new Set},vk=new Set([vP.H1,vP.H2,vP.H3,vP.H4,vP.H5,vP.H6]),vO=new Set([z.STYLE,z.SCRIPT,z.XMP,z.IFRAME,z.NOEMBED,z.NOFRAMES,z.PLAINTEXT]);t.s(["ATTRS",0,F,"DOCUMENT_MODE",0,B,"NS",0,R,"NUMBERED_HEADERS",0,vk,"SPECIAL_ELEMENTS",0,vI,"TAG_ID",0,j,"TAG_NAMES",0,z,"getTagID",0,vD,"hasUnescapedText",0,function(t,r){return vO.has(t)||r&&t===z.NOSCRIPT}],615473),(w=U||(U={}))[w.DATA=0]="DATA",w[w.RCDATA=1]="RCDATA",w[w.RAWTEXT=2]="RAWTEXT",w[w.SCRIPT_DATA=3]="SCRIPT_DATA",w[w.PLAINTEXT=4]="PLAINTEXT",w[w.TAG_OPEN=5]="TAG_OPEN",w[w.END_TAG_OPEN=6]="END_TAG_OPEN",w[w.TAG_NAME=7]="TAG_NAME",w[w.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",w[w.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",w[w.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",w[w.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",w[w.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",w[w.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",w[w.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",w[w.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",w[w.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",w[w.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",w[w.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",w[w.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",w[w.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",w[w.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",w[w.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",w[w.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",w[w.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",w[w.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",w[w.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",w[w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",w[w.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",w[w.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",w[w.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",w[w.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",w[w.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",w[w.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",w[w.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",w[w.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",w[w.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",w[w.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",w[w.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",w[w.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",w[w.BOGUS_COMMENT=40]="BOGUS_COMMENT",w[w.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",w[w.COMMENT_START=42]="COMMENT_START",w[w.COMMENT_START_DASH=43]="COMMENT_START_DASH",w[w.COMMENT=44]="COMMENT",w[w.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",w[w.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",w[w.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",w[w.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",w[w.COMMENT_END_DASH=49]="COMMENT_END_DASH",w[w.COMMENT_END=50]="COMMENT_END",w[w.COMMENT_END_BANG=51]="COMMENT_END_BANG",w[w.DOCTYPE=52]="DOCTYPE",w[w.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",w[w.DOCTYPE_NAME=54]="DOCTYPE_NAME",w[w.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",w[w.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",w[w.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",w[w.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",w[w.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",w[w.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",w[w.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",w[w.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",w[w.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",w[w.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",w[w.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",w[w.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",w[w.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",w[w.CDATA_SECTION=68]="CDATA_SECTION",w[w.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",w[w.CDATA_SECTION_END=70]="CDATA_SECTION_END",w[w.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",w[w.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND";let vN={DATA:U.DATA,RCDATA:U.RCDATA,RAWTEXT:U.RAWTEXT,SCRIPT_DATA:U.SCRIPT_DATA,PLAINTEXT:U.PLAINTEXT,CDATA_SECTION:U.CDATA_SECTION};function vL(t){return t>=M.LATIN_CAPITAL_A&&t<=M.LATIN_CAPITAL_Z}function vR(t){return t>=M.LATIN_SMALL_A&&t<=M.LATIN_SMALL_Z||vL(t)}function vF(t){return vR(t)||t>=M.DIGIT_0&&t<=M.DIGIT_9}function vB(t){return t===M.SPACE||t===M.LINE_FEED||t===M.TABULATION||t===M.FORM_FEED}function vz(t){return vB(t)||t===M.SOLIDUS||t===M.GREATER_THAN_SIGN}class vj{constructor(t,r){this.options=t,this.handler=r,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=U.DATA,this.returnState=U.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new vw(r),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new vC(vT,(t,r)=>{this.preprocessor.pos=this.entityStartPos+r-1,this._flushCodePointConsumedAsCharacterReference(t)},r.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(D.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:t=>{this._err(D.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+t)},validateNumericCharacterReference:t=>{let r=function(t){if(t===M.NULL)return D.nullCharacterReference;if(t>1114111)return D.characterReferenceOutsideUnicodeRange;if(v_(t))return D.surrogateCharacterReference;if(vx(t))return D.noncharacterCharacterReference;if(vb(t)||t===M.CARRIAGE_RETURN)return D.controlCharacterReference;return null}(t);r&&this._err(r,1)}}:void 0)}_err(t,r=0){var i,n;null==(n=(i=this.handler).onParseError)||n.call(i,this.preprocessor.getError(t,r))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||null==t||t())}write(t,r,i){this.active=!0,this.preprocessor.write(t,r),this._runParsingLoop(),this.paused||null==i||i()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return!!this.preprocessor.endOfChunkHit&&(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0)}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;
56for(let r=0;r<t;r++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,r){return!!this.preprocessor.startsWith(t,r)&&(this._advanceBy(t.length-1),!0)}_createStartTagToken(){this.currentToken={type:P.START_TAG,tagName:"",tagID:j.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:P.END_TAG,tagName:"",tagID:j.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:P.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:P.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,r){this.currentCharacterToken={type:t,chars:r,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,r;let i=this.currentToken;null===vE(i,this.currentAttr.name)?(i.attrs.push(this.currentAttr),i.location&&this.currentLocation&&((null!=(t=(r=i.location).attrs)?t:r.attrs=Object.create(null))[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue())):this._err(D.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let t=this.currentToken;this.prepareToken(t),t.tagID=vD(t.tagName),t.type===P.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(D.endTagWithAttributes),t.selfClosing&&this._err(D.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case P.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case P.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case P.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:P.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,r){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=r;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,r)}_emitCodePoint(t){let r=vB(t)?P.WHITESPACE_CHARACTER:t===M.NULL?P.NULL_CHARACTER:P.CHARACTER;this._appendCharToCurrentCharacterToken(r,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(P.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=U.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?L.Attribute:L.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===U.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===U.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===U.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case U.DATA:this._stateData(t);break;case U.RCDATA:this._stateRcdata(t);break;case U.RAWTEXT:this._stateRawtext(t);break;case U.SCRIPT_DATA:this._stateScriptData(t);break;case U.PLAINTEXT:this._statePlaintext(t);break;case U.TAG_OPEN:this._stateTagOpen(t);break;case U.END_TAG_OPEN:this._stateEndTagOpen(t);break;case U.TAG_NAME:this._stateTagName(t);break;case U.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(t);break;case U.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(t);break;case U.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(t);break;case U.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(t);break;case U.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(t);break;case U.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(t);break;case U.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(t);break;case U.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(t);break;case U.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(t);break;case U.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(t);break;case U.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(t);break;case U.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(t);break;case U.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(t);break;case U.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(t);break;case U.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(t);break;case U.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(t);break;case U.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(t);break;case U.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscape
vendor: 7,007 bytes, line 56
56Start(t);break;case U.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(t);break;case U.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(t);break;case U.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(t);break;case U.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(t);break;case U.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(t);break;case U.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(t);break;case U.ATTRIBUTE_NAME:this._stateAttributeName(t);break;case U.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(t);break;case U.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(t);break;case U.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(t);break;case U.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(t);break;case U.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(t);break;case U.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(t);break;case U.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(t);break;case U.BOGUS_COMMENT:this._stateBogusComment(t);break;case U.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(t);break;case U.COMMENT_START:this._stateCommentStart(t);break;case U.COMMENT_START_DASH:this._stateCommentStartDash(t);break;case U.COMMENT:this._stateComment(t);break;case U.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(t);break;case U.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(t);break;case U.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(t);break;case U.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(t);break;case U.COMMENT_END_DASH:this._stateCommentEndDash(t);break;case U.COMMENT_END:this._stateCommentEnd(t);break;case U.COMMENT_END_BANG:this._stateCommentEndBang(t);break;case U.DOCTYPE:this._stateDoctype(t);break;case U.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(t);break;case U.DOCTYPE_NAME:this._stateDoctypeName(t);break;case U.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(t);break;case U.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(t);break;case U.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(t);break;case U.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(t);break;case U.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(t);break;case U.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(t);break;case U.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break;case U.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(t);break;case U.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(t);break;case U.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(t);break;case U.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(t);break;case U.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(t);break;case U.BOGUS_DOCTYPE:this._stateBogusDoctype(t);break;case U.CDATA_SECTION:this._stateCdataSection(t);break;case U.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(t);break;case U.CDATA_SECTION_END:this._stateCdataSectionEnd(t);break;case U.CHARACTER_REFERENCE:this._stateCharacterReference();break;case U.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(t);break;default:throw Error("Unknown state")}}_stateData(t){switch(t){case M.LESS_THAN_SIGN:this.state=U.TAG_OPEN;break;case M.AMPERSAND:this._startCharacterReference();break;case M.NULL:this._err(D.unexpectedNullCharacter),this._emitCodePoint(t);break;case M.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case M.AMPERSAND:this._startCharacterReference();break;case M.LESS_THAN_SIGN:this.state=U.RCDATA_LESS_THAN_SIGN;break;case M.NULL:this._err(D.unexpectedNullCharacter),this._emitChars("�");break;case M.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case M.LESS_THAN_SIGN:this.state=U.RAWTEXT_LESS_THAN_SIGN;break;case M.NULL:this._err(D.unexpectedNullCharacter),this._emitChars("�");break;case M.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case M.LESS_THAN_SIGN:this.state=U.SCRIPT_DATA_LESS_THAN_SIGN;break;case M.NULL:this._err(D.unexpectedNullCharacter),this._emitChars("�");break;case M.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case M.NULL:this._err(D.unexpectedNullCharacter),this._emitChars("�");break;case M.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateTagOpen(t){if(vR(t))this._createStartTagToken(),this.state=U.TAG_NAME,this._stateTagName(t);else switch(t){case M.EXCLAMATION_MARK:this.state=U.MARKUP_DECLARATION_OPEN;break;case M.SOLIDUS:this.state=U.END_TAG_OPEN;break;case M.QUESTION_MARK:this._err(D.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=U.BOGUS_COMMENT,this._stateBogusComment(t);break;case M.EOF:this._err(D.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break;default:this._err(D.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=U.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(vR(t))this._createEndTagToken(),this.state=U.TAG_NAME,this._stateTagName(t);else switch(t){case M.GREATER_THAN_SIGN:this._err(D.missingEndTagName),this.state=U.DATA;break;case M.EOF:this._err(D.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break;default:this._err(D.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=U.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:this.state=U.BEFORE_ATTRIBUTE_NAME;break;case M.SOLIDUS:this.state=U.SELF_CLOSING_START_TAG;break;case M.GREATER_THAN_SIGN:this.state=U.DATA,this.emitCurrentTagToken();break;case M.NULL:this._err(D.unexpectedNullCharacter),r.tagName+="�";break;case M.EOF:this._err(D.eofInTag),this._emitEOFToken();break;default:r.tagName+=String.fromCodePoint(vL(t)?t+32:t)}}_stateRcdataLessThanSign(t){t===M.SOLIDUS?this.state=U.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=U.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){vR(t)?(this.state=U.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=U.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();switch(this._createEndTagToken(),this.currentToken.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=U.BEFORE_ATTRIBUTE_NAME,
vendor: 7,207 bytes, line 56
56!1;case M.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=U.SELF_CLOSING_START_TAG,!1;case M.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=U.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=U.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===M.SOLIDUS?this.state=U.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=U.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){vR(t)?(this.state=U.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=U.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=U.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case M.SOLIDUS:this.state=U.SCRIPT_DATA_END_TAG_OPEN;break;case M.EXCLAMATION_MARK:this.state=U.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break;default:this._emitChars("<"),this.state=U.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){vR(t)?(this.state=U.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=U.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=U.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===M.HYPHEN_MINUS?(this.state=U.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=U.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===M.HYPHEN_MINUS?(this.state=U.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=U.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case M.HYPHEN_MINUS:this.state=U.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break;case M.LESS_THAN_SIGN:this.state=U.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case M.NULL:this._err(D.unexpectedNullCharacter),this._emitChars("�");break;case M.EOF:this._err(D.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case M.HYPHEN_MINUS:this.state=U.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break;case M.LESS_THAN_SIGN:this.state=U.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case M.NULL:this._err(D.unexpectedNullCharacter),this.state=U.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case M.EOF:this._err(D.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=U.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case M.HYPHEN_MINUS:this._emitChars("-");break;case M.LESS_THAN_SIGN:this.state=U.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case M.GREATER_THAN_SIGN:this.state=U.SCRIPT_DATA,this._emitChars(">");break;case M.NULL:this._err(D.unexpectedNullCharacter),this.state=U.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case M.EOF:this._err(D.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=U.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===M.SOLIDUS?this.state=U.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:vR(t)?(this._emitChars("<"),this.state=U.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=U.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){vR(t)?(this.state=U.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=U.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=U.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(vv,!1)&&vz(this.preprocessor.peek(vv.length))){this._emitCodePoint(t);for(let t=0;t<vv.length;t++)this._emitCodePoint(this._consume());this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=U.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case M.HYPHEN_MINUS:this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break;case M.LESS_THAN_SIGN:this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case M.NULL:this._err(D.unexpectedNullCharacter),this._emitChars("�");break;case M.EOF:this._err(D.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case M.HYPHEN_MINUS:this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break;case M.LESS_THAN_SIGN:this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case M.NULL:this._err(D.unexpectedNullCharacter),this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case M.EOF:this._err(D.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case M.HYPHEN_MINUS:this._emitChars("-");break;case M.LESS_THAN_SIGN:this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case M.GREATER_THAN_SIGN:this.state=U.SCRIPT_DATA,this._emitChars(">");break;case M.NULL:this._err(D.unexpectedNullCharacter),this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case M.EOF:this._err(D.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===M.SOLIDUS?(this.state=U.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(vv,!1)&&vz(this.preprocessor.peek(vv.length))){this._emitCodePoint(t);for(let t=0;t<vv.length;t++)this._emitCodePoint(this._consume());this.state=U.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=U.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.SOLIDUS:case M.GREATER_THAN_SIGN:case M.EOF:this.state=U.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break;case M.EQUALS_SIGN:this._err(D.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=U.ATTRIBUTE_NAME;break;default:this._createAttr(""),this.state=U.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:case M.SOLIDUS:case M.GREATER_THAN_SIGN:case M.EOF:this._leaveAttrName(),this.state=U.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break;case M.EQUALS_SIGN:this._leaveAttrName(),this.state=U.BEFORE_ATTRIBUTE_VALUE;break;case M.QUOTATION_MARK:case M.APOSTROPHE:case M.LESS_THAN_SIGN:this._err(D.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break;case M.NULL:this._err(D.unexpectedNullCharacter),this.currentAttr.name+="
56�";break;default:this.currentAttr.name+=String.fromCodePoint(vL(t)?t+32:t)}}_stateAfterAttributeName(t){switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.SOLIDUS:this.state=U.SELF_CLOSING_START_TAG;break;case M.EQUALS_SIGN:this.state=U.BEFORE_ATTRIBUTE_VALUE;break;case M.GREATER_THAN_SIGN:this.state=U.DATA,this.emitCurrentTagToken();break;case M.EOF:this._err(D.eofInTag),this._emitEOFToken();break;default:this._createAttr(""),this.state=U.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.QUOTATION_MARK:this.state=U.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case M.APOSTROPHE:this.state=U.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case M.GREATER_THAN_SIGN:this._err(D.missingAttributeValue),this.state=U.DATA,this.emitCurrentTagToken();break;default:this.state=U.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case M.QUOTATION_MARK:this.state=U.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case M.AMPERSAND:this._startCharacterReference();break;case M.NULL:this._err(D.unexpectedNullCharacter),this.currentAttr.value+="�";break;case M.EOF:this._err(D.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case M.APOSTROPHE:this.state=U.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case M.AMPERSAND:this._startCharacterReference();break;case M.NULL:this._err(D.unexpectedNullCharacter),this.currentAttr.value+="�";break;case M.EOF:this._err(D.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:this._leaveAttrValue(),this.state=U.BEFORE_ATTRIBUTE_NAME;break;case M.AMPERSAND:this._startCharacterReference();break;case M.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=U.DATA,this.emitCurrentTagToken();break;case M.NULL:this._err(D.unexpectedNullCharacter),this.currentAttr.value+="�";break;case M.QUOTATION_MARK:case M.APOSTROPHE:case M.LESS_THAN_SIGN:case M.EQUALS_SIGN:case M.GRAVE_ACCENT:this._err(D.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break;case M.EOF:this._err(D.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:this._leaveAttrValue(),this.state=U.BEFORE_ATTRIBUTE_NAME;break;case M.SOLIDUS:this._leaveAttrValue(),this.state=U.SELF_CLOSING_START_TAG;break;case M.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=U.DATA,this.emitCurrentTagToken();break;case M.EOF:this._err(D.eofInTag),this._emitEOFToken();break;default:this._err(D.missingWhitespaceBetweenAttributes),this.state=U.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case M.GREATER_THAN_SIGN:this.currentToken.selfClosing=!0,this.state=U.DATA,this.emitCurrentTagToken();break;case M.EOF:this._err(D.eofInTag),this._emitEOFToken();break;default:this._err(D.unexpectedSolidusInTag),this.state=U.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){let r=this.currentToken;switch(t){case M.GREATER_THAN_SIGN:this.state=U.DATA,this.emitCurrentComment(r);break;case M.EOF:this.emitCurrentComment(r),this._emitEOFToken();break;case M.NULL:this._err(D.unexpectedNullCharacter),r.data+="�";break;default:r.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch("--",!0)?(this._createCommentToken(3),this.state=U.COMMENT_START):this._consumeSequenceIfMatch(vy,!1)?(this.currentLocation=this.getCurrentLocation(vy.length+1),this.state=U.DOCTYPE):this._consumeSequenceIfMatch(vg,!0)?this.inForeignNode?this.state=U.CDATA_SECTION:(this._err(D.cdataInHtmlContent),this._createCommentToken(vg.length+1),this.currentToken.data="[CDATA[",this.state=U.BOGUS_COMMENT):this._ensureHibernation()||(this._err(D.incorrectlyOpenedComment),this._createCommentToken(2),this.state=U.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case M.HYPHEN_MINUS:this.state=U.COMMENT_START_DASH;break;case M.GREATER_THAN_SIGN:{this._err(D.abruptClosingOfEmptyComment),this.state=U.DATA;let t=this.currentToken;this.emitCurrentComment(t);break}default:this.state=U.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){let r=this.currentToken;switch(t){case M.HYPHEN_MINUS:this.state=U.COMMENT_END;break;case M.GREATER_THAN_SIGN:this._err(D.abruptClosingOfEmptyComment),this.state=U.DATA,this.emitCurrentComment(r);break;case M.EOF:this._err(D.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break;default:r.data+="-",this.state=U.COMMENT,this._stateComment(t)}}_stateComment(t){let r=this.currentToken;switch(t){case M.HYPHEN_MINUS:this.state=U.COMMENT_END_DASH;break;case M.LESS_THAN_SIGN:r.data+="<",this.state=U.COMMENT_LESS_THAN_SIGN;break;case M.NULL:this._err(D.unexpectedNullCharacter),r.data+="�";break;case M.EOF:this._err(D.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break;default:r.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){let r=this.currentToken;switch(t){case M.EXCLAMATION_MARK:r.data+="!",this.state=U.COMMENT_LESS_THAN_SIGN_BANG;break;case M.LESS_THAN_SIGN:r.data+="<";break;default:this.state=U.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===M.HYPHEN_MINUS?this.state=U.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=U.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===M.HYPHEN_MINUS?this.state=U.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=U.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==M.GREATER_THAN_SIGN&&t!==M.EOF&&this._err(D.nestedComment),this.state=U.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){let r=this.currentToken;switch(t){case M.HYPHEN_MINUS:this.state=U.COMMENT_END;break;case M.EOF:this._err(D.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break;default:r.data+="-",this.state=U.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){let r=this.currentToken;switch(t){case M.GREATER_THAN_SIGN:this.state=U.DATA,this.emitCurrentComment(r);break;case M.EXCLAMATION_MARK:this.state=U.COMMENT_END_BANG;break;case M.HYPHEN_MINUS:r.data+="-";break;case M.EOF:this._err(D.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break;default:r.data+="--",this.state=U.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){let r=this.currentToken;switch(t){case M.HYPHEN_MINUS:r.data+="--!",this.state=U.COMMENT_END_DASH;break;case M.GREATER_THAN_SIGN:this._err(D.incorrectlyClosedComment),this.state=U.DATA,this.emitCurrentComment(r);break;case M.EOF:this._err(D.eofInComment),this.emitCurrentComment(r),this._emitEOFToken();break;default:r.data+="--!",this.state=U.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:this.state=U.BEFORE_DOCTYPE_NAME;break;case M.GREATER_THAN_SIGN:this.state=U.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break;case M.EOF:{this._err(D.eofInDoctype),this._createDoctypeToken(null);let t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(D.missingWhitespaceBeforeDoctypeName),this.state=U.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(vL(t))this._createDoctypeToken(String.fromCharCode(t+32)),this.state=U.DOCTYPE_NAME;else switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.NULL:this._err(D.unexpectedNullCharacter),this._createDoctypeToken("�"),this.state=U.DOCTYPE_NAME;break;case M.GREATER_THAN_SIGN:{this._err(D.missingDoctypeName),this._createDoctypeToken(null);let t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=U.DATA;break}case M.EOF:{this._err(D.eofInDoctype),this._createDoctypeToken(null);let t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=U.DOCTYPE_NAME}}_stateDoctypeName(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:this.state=U.AFTER_DOCTYPE_NAME;break;case M.GREATER_THAN_SIGN:this.state=U.DATA,this.emitCurrentDoctype(r);break;
vendor: 4,187 bytes, line 56
56case M.NULL:this._err(D.unexpectedNullCharacter),r.name+="�";break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:r.name+=String.fromCodePoint(vL(t)?t+32:t)}}_stateAfterDoctypeName(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.GREATER_THAN_SIGN:this.state=U.DATA,this.emitCurrentDoctype(r);break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:this._consumeSequenceIfMatch("public",!1)?this.state=U.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch("system",!1)?this.state=U.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(D.invalidCharacterSequenceAfterDoctypeName),r.forceQuirks=!0,this.state=U.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:this.state=U.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case M.QUOTATION_MARK:this._err(D.missingWhitespaceAfterDoctypePublicKeyword),r.publicId="",this.state=U.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case M.APOSTROPHE:this._err(D.missingWhitespaceAfterDoctypePublicKeyword),r.publicId="",this.state=U.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case M.GREATER_THAN_SIGN:this._err(D.missingDoctypePublicIdentifier),r.forceQuirks=!0,this.state=U.DATA,this.emitCurrentDoctype(r);break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:this._err(D.missingQuoteBeforeDoctypePublicIdentifier),r.forceQuirks=!0,this.state=U.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.QUOTATION_MARK:r.publicId="",this.state=U.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case M.APOSTROPHE:r.publicId="",this.state=U.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case M.GREATER_THAN_SIGN:this._err(D.missingDoctypePublicIdentifier),r.forceQuirks=!0,this.state=U.DATA,this.emitCurrentDoctype(r);break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:this._err(D.missingQuoteBeforeDoctypePublicIdentifier),r.forceQuirks=!0,this.state=U.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){let r=this.currentToken;switch(t){case M.QUOTATION_MARK:this.state=U.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case M.NULL:this._err(D.unexpectedNullCharacter),r.publicId+="�";break;case M.GREATER_THAN_SIGN:this._err(D.abruptDoctypePublicIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=U.DATA;break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:r.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){let r=this.currentToken;switch(t){case M.APOSTROPHE:this.state=U.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case M.NULL:this._err(D.unexpectedNullCharacter),r.publicId+="�";break;case M.GREATER_THAN_SIGN:this._err(D.abruptDoctypePublicIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=U.DATA;break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:r.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:this.state=U.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case M.GREATER_THAN_SIGN:this.state=U.DATA,this.emitCurrentDoctype(r);break;case M.QUOTATION_MARK:this._err(D.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),r.systemId="",this.state=U.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case M.APOSTROPHE:this._err(D.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),r.systemId="",this.state=U.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;
vendor: 7,464 bytes, line 56
56default:this._err(D.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=U.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.GREATER_THAN_SIGN:this.emitCurrentDoctype(r),this.state=U.DATA;break;case M.QUOTATION_MARK:r.systemId="",this.state=U.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case M.APOSTROPHE:r.systemId="",this.state=U.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:this._err(D.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=U.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:this.state=U.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case M.QUOTATION_MARK:this._err(D.missingWhitespaceAfterDoctypeSystemKeyword),r.systemId="",this.state=U.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case M.APOSTROPHE:this._err(D.missingWhitespaceAfterDoctypeSystemKeyword),r.systemId="",this.state=U.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case M.GREATER_THAN_SIGN:this._err(D.missingDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=U.DATA,this.emitCurrentDoctype(r);break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:this._err(D.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=U.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.QUOTATION_MARK:r.systemId="",this.state=U.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case M.APOSTROPHE:r.systemId="",this.state=U.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case M.GREATER_THAN_SIGN:this._err(D.missingDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=U.DATA,this.emitCurrentDoctype(r);break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:this._err(D.missingQuoteBeforeDoctypeSystemIdentifier),r.forceQuirks=!0,this.state=U.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){let r=this.currentToken;switch(t){case M.QUOTATION_MARK:this.state=U.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case M.NULL:this._err(D.unexpectedNullCharacter),r.systemId+="�";break;case M.GREATER_THAN_SIGN:this._err(D.abruptDoctypeSystemIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=U.DATA;break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:r.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){let r=this.currentToken;switch(t){case M.APOSTROPHE:this.state=U.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case M.NULL:this._err(D.unexpectedNullCharacter),r.systemId+="�";break;case M.GREATER_THAN_SIGN:this._err(D.abruptDoctypeSystemIdentifier),r.forceQuirks=!0,this.emitCurrentDoctype(r),this.state=U.DATA;break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:r.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){let r=this.currentToken;switch(t){case M.SPACE:case M.LINE_FEED:case M.TABULATION:case M.FORM_FEED:break;case M.GREATER_THAN_SIGN:this.emitCurrentDoctype(r),this.state=U.DATA;break;case M.EOF:this._err(D.eofInDoctype),r.forceQuirks=!0,this.emitCurrentDoctype(r),this._emitEOFToken();break;default:this._err(D.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=U.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){let r=this.currentToken;switch(t){case M.GREATER_THAN_SIGN:this.emitCurrentDoctype(r),this.state=U.DATA;break;case M.NULL:this._err(D.unexpectedNullCharacter);break;case M.EOF:this.emitCurrentDoctype(r),this._emitEOFToken()}}_stateCdataSection(t){switch(t){case M.RIGHT_SQUARE_BRACKET:this.state=U.CDATA_SECTION_BRACKET;break;case M.EOF:this._err(D.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===M.RIGHT_SQUARE_BRACKET?this.state=U.CDATA_SECTION_END:(this._emitChars("]"),this.state=U.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case M.GREATER_THAN_SIGN:this.state=U.DATA;break;case M.RIGHT_SQUARE_BRACKET:this._emitChars("]");break;default:this._emitChars("]]"),this.state=U.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}0===t?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(M.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&vF(this.preprocessor.peek(1))?U.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){vF(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===M.SEMICOLON&&this._err(D.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}let vU=new Set([j.DD,j.DT,j.LI,j.OPTGROUP,j.OPTION,j.P,j.RB,j.RP,j.RT,j.RTC]),vV=new Set([...vU,j.CAPTION,j.COLGROUP,j.TBODY,j.TD,j.TFOOT,j.TH,j.THEAD,j.TR]),v$=new Set([j.APPLET,j.CAPTION,j.HTML,j.MARQUEE,j.OBJECT,j.TABLE,j.TD,j.TEMPLATE,j.TH]),vG=new Set([...v$,j.OL,j.UL]),vq=new Set([...v$,j.BUTTON]),vH=new Set([j.ANNOTATION_XML,j.MI,j.MN,j.MO,j.MS,j.MTEXT]),vW=new Set([j.DESC,j.FOREIGN_OBJECT,j.TITLE]),vZ=new Set([j.TR,j.TEMPLATE,j.HTML]),vY=new Set([j.TBODY,j.TFOOT,j.THEAD,j.TEMPLATE,j.HTML]),vX=new Set([j.TABLE,j.TEMPLATE,j.HTML]),vK=new Set([j.TD,j.TH]);class vQ{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,r,i){this.treeAdapter=r,this.handler=i,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=j.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===j.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===R.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,r){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=r,this.currentTagId=r,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,r,!0)}pop(){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,r){let i=this._indexOf(t);this.items[i]=r,i===this.stackTop&&(this.current=r)}insertAfter(t,r,i){let n=this._indexOf(t)+1;this.items.splice(n,0,r),this.tagIDs.splice(n,0,i),this.stackTop++,n===this.stackTop&&this._updateCurrentElement(),this.current&&void 0!==this.currentTagId&&this.handler.onItemPush(this.current,this.currentTagId,n===this.stackTop)}popUntilTagNamePopped(t){let r=this.stackTop+1;do r=this.tagIDs.lastIndexOf(t,r-1);while(r>0&&this.treeAdapter.getNamespaceURI(this.items[r])!==R.HTML)this.shortenToLe
56ngth(Math.max(r,0))}shortenToLength(t){for(;this.stackTop>=t;){let r=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(r,this.stackTop<t)}}popUntilElementPopped(t){let r=this._indexOf(t);this.shortenToLength(Math.max(r,0))}popUntilPopped(t,r){let i=this._indexOfTagNames(t,r);this.shortenToLength(Math.max(i,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(vk,R.HTML)}popUntilTableCellPopped(){this.popUntilPopped(vK,R.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,r){for(let i=this.stackTop;i>=0;i--)if(t.has(this.tagIDs[i])&&this.treeAdapter.getNamespaceURI(this.items[i])===r)return i;return -1}clearBackTo(t,r){let i=this._indexOfTagNames(t,r);this.shortenToLength(i+1)}clearBackToTableContext(){this.clearBackTo(vX,R.HTML)}clearBackToTableBodyContext(){this.clearBackTo(vY,R.HTML)}clearBackToTableRowContext(){this.clearBackTo(vZ,R.HTML)}remove(t){let r=this._indexOf(t);r>=0&&(r===this.stackTop?this.pop():(this.items.splice(r,1),this.tagIDs.splice(r,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===j.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){let r=this._indexOf(t)-1;return r>=0?this.items[r]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.tagIDs[0]===j.HTML}hasInDynamicScope(t,r){for(let i=this.stackTop;i>=0;i--){let n=this.tagIDs[i];switch(this.treeAdapter.getNamespaceURI(this.items[i])){case R.HTML:if(n===t)return!0;if(r.has(n))return!1;break;case R.SVG:if(vW.has(n))return!1;break;case R.MATHML:if(vH.has(n))return!1}}return!0}hasInScope(t){return this.hasInDynamicScope(t,v$)}hasInListItemScope(t){return this.hasInDynamicScope(t,vG)}hasInButtonScope(t){return this.hasInDynamicScope(t,vq)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){let r=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case R.HTML:if(vk.has(r))return!0;if(v$.has(r))return!1;break;case R.SVG:if(vW.has(r))return!1;break;case R.MATHML:if(vH.has(r))return!1}}return!0}hasInTableScope(t){for(let r=this.stackTop;r>=0;r--)if(this.treeAdapter.getNamespaceURI(this.items[r])===R.HTML)switch(this.tagIDs[r]){case t:return!0;case j.TABLE:case j.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===R.HTML)switch(this.tagIDs[t]){case j.TBODY:case j.THEAD:case j.TFOOT:return!0;case j.TABLE:case j.HTML:return!1}return!0}hasInSelectScope(t){for(let r=this.stackTop;r>=0;r--)if(this.treeAdapter.getNamespaceURI(this.items[r])===R.HTML)switch(this.tagIDs[r]){case t:return!0;case j.OPTION:case j.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;void 0!==this.currentTagId&&vU.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;void 0!==this.currentTagId&&vV.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;void 0!==this.currentTagId&&this.currentTagId!==t&&vV.has(this.currentTagId);)this.pop()}}(E=V||(V={}))[E.Marker=0]="Marker",E[E.Element=1]="Element";let vJ={type:V.Marker};class v0{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,r){let i=[],n=r.length,a=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let t=0;t<this.entries.length;t++){let r=this.entries[t];
56if(r.type===V.Marker)break;let{element:s}=r;if(this.treeAdapter.getTagName(s)===a&&this.treeAdapter.getNamespaceURI(s)===o){let r=this.treeAdapter.getAttrList(s);r.length===n&&i.push({idx:t,attrs:r})}}return i}_ensureNoahArkCondition(t){if(this.entries.length<3)return;let r=this.treeAdapter.getAttrList(t),i=this._getNoahArkConditionCandidates(t,r);if(i.length<3)return;let n=new Map(r.map(t=>[t.name,t.value])),a=0;for(let t=0;t<i.length;t++){let r=i[t];r.attrs.every(t=>n.get(t.name)===t.value)&&(a+=1)>=3&&this.entries.splice(r.idx,1)}}insertMarker(){this.entries.unshift(vJ)}pushElement(t,r){this._ensureNoahArkCondition(t),this.entries.unshift({type:V.Element,element:t,token:r})}insertElementAfterBookmark(t,r){let i=this.entries.indexOf(this.bookmark);this.entries.splice(i,0,{type:V.Element,element:t,token:r})}removeEntry(t){let r=this.entries.indexOf(t);-1!==r&&this.entries.splice(r,1)}clearToLastMarker(){let t=this.entries.indexOf(vJ);-1===t?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){let r=this.entries.find(r=>r.type===V.Marker||this.treeAdapter.getTagName(r.element)===t);return r&&r.type===V.Element?r:null}getElementEntry(t){return this.entries.find(r=>r.type===V.Element&&r.element===t)}}let v1={createDocument:()=>({nodeName:"#document",mode:B.NO_QUIRKS,childNodes:[]}),createDocumentFragment:()=>({nodeName:"#document-fragment",childNodes:[]}),createElement:(t,r,i)=>({nodeName:t,tagName:t,attrs:i,namespaceURI:r,childNodes:[],parentNode:null}),createCommentNode:t=>({nodeName:"#comment",data:t,parentNode:null}),createTextNode:t=>({nodeName:"#text",value:t,parentNode:null}),appendChild(t,r){t.childNodes.push(r),r.parentNode=t},insertBefore(t,r,i){let n=t.childNodes.indexOf(i);t.childNodes.splice(n,0,r),r.parentNode=t},setTemplateContent(t,r){t.content=r},getTemplateContent:t=>t.content,setDocumentType(t,r,i,n){let a=t.childNodes.find(t=>"#documentType"===t.nodeName);a?(a.name=r,a.publicId=i,a.systemId=n):v1.appendChild(t,{nodeName:"#documentType",name:r,publicId:i,systemId:n,parentNode:null})},setDocumentMode(t,r){t.mode=r},getDocumentMode:t=>t.mode,detachNode(t){if(t.parentNode){let r=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(r,1),t.parentNode=null}},insertText(t,r){if(t.childNodes.length>0){let i=t.childNodes[t.childNodes.length-1];if(v1.isTextNode(i)){i.value+=r;return}}v1.appendChild(t,v1.createTextNode(r))},insertTextBefore(t,r,i){let n=t.childNodes[t.childNodes.indexOf(i)-1];n&&v1.isTextNode(n)?n.value+=r:v1.insertBefore(t,v1.createTextNode(r),i)},adoptAttributes(t,r){let i=new Set(t.attrs.map(t=>t.name));for(let n=0;n<r.length;n++)i.has(r[n].name)||t.attrs.push(r[n])},getFirstChild:t=>t.childNodes[0],getChildNodes:t=>t.childNodes,getParentNode:t=>t.parentNode,getAttrList:t=>t.attrs,getTagName:t=>t.tagName,getNamespaceURI:t=>t.namespaceURI,getTextNodeContent:t=>t.value,getCommentNodeContent:t=>t.data,getDocumentTypeNodeName:t=>t.name,getDocumentTypeNodePublicId:t=>t.publicId,getDocumentTypeNodeSystemId:t=>t.systemId,isTextNode:t=>"#text"===t.nodeName,isCommentNode:t=>"#comment"===t.nodeName,isDocumentTypeNode:t=>"#documentType"===t.nodeName,isElementNode:t=>Object.prototype.hasOwnProperty.call(t,"tagName"),setNodeSourceCodeLocation(t,r){t.sourceCodeLocation=r},getNodeSourceCodeLocation:t=>t.sourceCodeLocation,updateNodeSourceCodeLocation(t,r){t.sourceCodeLocation={...t.sourceCodeLocation,...r}}},v2="html",v3=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],v4=[...v3,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],v6=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),v5=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],v8=[...v5,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function v7(t,r){return r.some(r=>t.startsWith(r))}
56let v9=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t])),_e=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:R.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:R.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:R.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:R.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:R.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:R.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:R.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:R.XML}],["xml:space",{prefix:"xml",name:"space",namespace:R.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:R.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:R.XMLNS}]]),_t=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),_r=new Set([j.B,j.BIG,j.BLOCKQUOTE,j.BODY,j.BR,j.CENTER,j.CODE,j.DD,j.DIV,j.DL,j.DT,j.EM,j.EMBED,j.H1,j.H2,j.H3,j.H4,j.H5,j.H6,j.HEAD,j.HR,j.I,j.IMG,j.LI,j.LISTING,j.MENU,j.META,j.NOBR,j.OL,j.P,j.PRE,j.RUBY,j.S,j.SMALL,j.SPAN,j.STRONG,j.STRIKE,j.SUB,j.SUP,j.TABLE,j.TT,j.U,j.UL,j.VAR]);function _i(t){for(let r=0;r<t.attrs.length;r++)if("definitionurl"===t.attrs[r].name){t.attrs[r].name="definitionURL";break}}function _n(t){for(let r=0;r<t.attrs.length;r++){let i=v9.get(t.attrs[r].name);null!=i&&(t.attrs[r].name=i)}}function _a(t){for(let r=0;r<t.attrs.length;r++){let i=_e.get(t.attrs[r].name);i&&(t.attrs[r].prefix=i.prefix,t.attrs[r].name=i.name,t.attrs[r].namespace=i.namespace)}}(T=$||($={}))[T.INITIAL=0]="INITIAL",T[T.BEFORE_HTML=1]="BEFORE_HTML",T[T.BEFORE_HEAD=2]="BEFORE_HEAD",T[T.IN_HEAD=3]="IN_HEAD",T[T.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",T[T.AFTER_HEAD=5]="AFTER_HEAD",T[T.IN_BODY=6]="IN_BODY",T[T.TEXT=7]="TEXT",T[T.IN_TABLE=8]="IN_TABLE",T[T.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",T[T.IN_CAPTION=10]="IN_CAPTION",T[T.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",T[T.IN_TABLE_BODY=12]="IN_TABLE_BODY",T[T.IN_ROW=13]="IN_ROW",T[T.IN_CELL=14]="IN_CELL",T[T.IN_SELECT=15]="IN_SELECT",T[T.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",T[T.IN_TEMPLATE=17]="IN_TEMPLATE",T[T.AFTER_BODY=18]="AFTER_BODY",T[T.IN_FRAMESET=19]="IN_FRAMESET",T[T.AFTER_FRAMESET=20]="AFTER_FRAMESET",T[T.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",T[T.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET";let _o={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},_s=new Set([j.TABLE,j.TBODY,j.TFOOT,j.THEAD,j.TR]),_l={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:v1,onParseError:null};class _u{constructor(t,r,i=null,n=null){this.fragmentContext=i,this.scriptHandler=n,this.currentToken=null,this.stopped=!1,this.insertionMode=$.INITIAL,this.originalInsertionMode=$.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={..._l,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=null!=r?r:this.treeAdapter.createDocument(),this.tokenizer=new vj(this.options,this),this.activeFormattingElements=new v0(this.treeAdapter),this.fragmentContextID=i?vD(this.treeAdapter.getTagName(i)):j.UNKNOWN,this._setContextModes(null!=i?i:this.document,this.fragmentContextID),this.openElements=new vQ(this.document,this.treeAdapter,this)}static parse(t,r){let i=new this(r);return i.tokenizer.write(t,!0),i.document}static getFragmentParser(t,r){let i={..._l,...r};null!=t||(t=i.treeAdapter.createElement(z.TEMPLATE,R.HTML,[]));let n=i.treeAdapter.createElement("documentmock",R.HTML,[]),a=new this(i,n,t);return a.fragmentContextID===j.TEMPLATE&&a.tmplInsertionModeStack.unshift($.IN_TEMPLATE),a._initTokenizerForFragmentParsing(),a._insertFakeRootElement(),a._resetInsertionMode(),a._findFormInFragmentContext(),a}getFragment(){let t=this.treeAdapter.getFirstChild(this.document),r=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,r),r}_err(t,r,i){var n;if(!this.onParseError)return;
56let a=null!=(n=t.location)?n:_o,o={code:r,startLine:a.startLine,startCol:a.startCol,startOffset:a.startOffset,endLine:i?a.startLine:a.endLine,endCol:i?a.startCol:a.endCol,endOffset:i?a.startOffset:a.endOffset};this.onParseError(o)}onItemPush(t,r,i){var n,a;null==(a=(n=this.treeAdapter).onItemPush)||a.call(n,t),i&&this.openElements.stackTop>0&&this._setContextModes(t,r)}onItemPop(t,r){var i,n;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),null==(n=(i=this.treeAdapter).onItemPop)||n.call(i,t,this.openElements.current),r){let t,r;0===this.openElements.stackTop&&this.fragmentContext?(t=this.fragmentContext,r=this.fragmentContextID):{current:t,currentTagId:r}=this.openElements,this._setContextModes(t,r)}}_setContextModes(t,r){let i=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===R.HTML;this.currentNotInHTML=!i,this.tokenizer.inForeignNode=!i&&void 0!==t&&void 0!==r&&!this._isIntegrationPoint(r,t)}_switchToTextParsing(t,r){this._insertElement(t,R.HTML),this.tokenizer.state=r,this.originalInsertionMode=this.insertionMode,this.insertionMode=$.TEXT}switchToPlaintextParsing(){this.insertionMode=$.TEXT,this.originalInsertionMode=$.IN_BODY,this.tokenizer.state=vN.PLAINTEXT}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===z.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===R.HTML)switch(this.fragmentContextID){case j.TITLE:case j.TEXTAREA:this.tokenizer.state=vN.RCDATA;break;case j.STYLE:case j.XMP:case j.IFRAME:case j.NOEMBED:case j.NOFRAMES:case j.NOSCRIPT:this.tokenizer.state=vN.RAWTEXT;break;case j.SCRIPT:this.tokenizer.state=vN.SCRIPT_DATA;break;case j.PLAINTEXT:this.tokenizer.state=vN.PLAINTEXT}}_setDocumentType(t){let r=t.name||"",i=t.publicId||"",n=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,r,i,n),t.location){let r=this.treeAdapter.getChildNodes(this.document).find(t=>this.treeAdapter.isDocumentTypeNode(t));r&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}}_attachElementToTree(t,r){if(this.options.sourceCodeLocationInfo){let i=r&&{...r,startTag:r};this.treeAdapter.setNodeSourceCodeLocation(t,i)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{let r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(null!=r?r:this.document,t)}}_appendElement(t,r){let i=this.treeAdapter.createElement(t.tagName,r,t.attrs);this._attachElementToTree(i,t.location)}_insertElement(t,r){let i=this.treeAdapter.createElement(t.tagName,r,t.attrs);this._attachElementToTree(i,t.location),this.openElements.push(i,t.tagID)}_insertFakeElement(t,r){let i=this.treeAdapter.createElement(t,R.HTML,[]);this._attachElementToTree(i,null),this.openElements.push(i,r)}_insertTemplate(t){let r=this.treeAdapter.createElement(t.tagName,R.HTML,t.attrs),i=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(r,i),this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,null)}_insertFakeRootElement(){let t=this.treeAdapter.createElement(z.HTML,R.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,j.HTML)}_appendCommentNode(t,r){let i=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(r,i),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,t.location)}_insertCharacters(t){let r,i;if(this._shouldFosterParentOnInsertion()?({parent:r,beforeElement:i}=this._findFosterParentingLocation(),i?this.treeAdapter.insertTextBefore(r,t.chars,i):this.treeAdapter.insertText(r,t.chars)):(r=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(r,t.chars)),!t.location)return;let n=this.treeAdapter.getChildNodes(r),a=i?n.lastIndexOf(i):n.length,o=n[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){let{endLine:r,endCol:i,endOffset:n}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:r,endCol:i,endOffset:n})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}_adoptNodes(t,r){for(let i=this.treeAdapter.getFirstChild(t);i;i=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(i),this.treeAdapter.appendChild(r,i)}_setEndLocation(t,r){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&r.location){let i=r.location,n=this.treeAdapter.getTagName(t),a=r.type===P.END_TAG&&n===r.tagName?{endTag:{...i},endLine:i.endLine,endCol:i.endCol,endOffset:i.endOffset}:{endLine:i.startLine,endCol:i.startCol,endOffset:i.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,a)}}shouldProcessStartTagTokenInForeignContent(t){let r,i;return!!this.currentNotInHTML&&(0===this.openElements.stackTop&&this.fragmentContext?(r=this.fragmentContext,i=this.fragmentContextID):{current:r,currentTagId:i}=this.openElements,(t.tagID!==j.SVG||this.treeAdapter.getTagName(r)!==z.ANNOTATION_XML||this.treeAdapter.getNamespaceURI(r)!==R.MATHML)&&(this.tokenizer.inForeignNode||(t.tagID===j.MGLYPH||t.tagID===j.MALIGNMARK)&&void 0!==i&&!this._isIntegrationPoint(i,r,R.HTML)))}_processToken(t){switch(t.type){case P.CHARACTER:this.onCharacter(t);break;case P.NULL_CHARACTER:this.onNullCharacter(t);break;case P.COMMENT:this.onComment(t);break;case P.DOCTYPE:this.onDoctype(t);break;case P.START_TAG:this._processStartTag(t);break;case P.END_TAG:this.onEndTag(t);break;case P.EOF:this.onEof(t);break;case P.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(t)}}_isIntegrationPoint(t,r,i){let n=this.treeAdapter.getNamespaceURI(r),a=this.treeAdapter.getAttrList(r);return(!i||i===R.HTML)&&function(t,r,i){if(r===R.MATHML&&t===j.ANNOTATION_XML){for(let t=0;t<i.length;t++)if(i[t].name===F.ENCODING){let r=i[t].value.toLowerCase();return"text/html"===r||"application/xhtml+xml"===r}}return r===R.SVG&&(t===j.FOREIGN_OBJECT||t===j.DESC||t===j.TITLE)}(t,n,a)||(!i||i===R.MATHML)&&n===R.MATHML&&(t===j.MI||t===j.MO||t===j.MN||t===j.MS||t===j.MTEXT)}_reconstructActiveFormattingElements(){let t=this.activeFormattingElements.entries.length;if(t){let r=this.activeFormattingElements.entries.findIndex(t=>t.type===V.Marker||this.openElements.contains(t.element)),i=-1===r?t-1:r-1;for(let t=i;t>=0;t--){let r=this.activeFormattingElements.entries[t];this._insertElement(r.token,this.treeAdapter.getNamespaceURI(r.element)),r.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=$.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(j.P),this.openElements.popUntilTagNamePopped(j.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(0===t&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case j.TR:this.insertionMode=$.IN_ROW;return;case j.TBODY:case j.THEAD:case j.TFOOT:this.insertionMode=$.IN_TABLE_BODY;return;case j.CAPTION:this.insertionMode=$.IN_CAPTION;return;case j.COLGROUP:this.insertionMode=$.IN_COLUMN_GROUP;return;case j.TABLE:this.insertionMode=$.IN_TABLE;return;case j.BODY:this.insertionMode=$.IN_BODY;return;case j.FRAMESET:this.insertionMode=$.IN_FRAMESET;return;case j.SELECT:return void this._resetInsertionModeForSelect(t);case j.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case j.HTML:this.insertionMode=this.headElement?$.AFTER_HEAD:$.BEFORE_HEAD;return;case j.TD:case j.TH:if(t>0){this.insertionMode=$.IN_CELL;return}break;case j.HEAD:if(t>0){this.insertionMode=$.IN_HEAD;return}}this.insertionMode=$.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let r=t-1;r>0;r--){let t=this.openElements.tagIDs[r];if(t===j.TEMPLATE)break;if(t===j.TABLE){this.insertionMode=$.IN_SELECT_IN_TABLE;return}}this.insertionMode=$.IN_SELECT}_isElementCausesFosterParenting(t){return _s.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&void 0!==this.openElements.currentTagId&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){let r=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case j.TEMPLATE:if(this.treeAdapter.getNamespaceURI(r)===R.HTML)return{parent:this.treeAdapter.getTemplateContent(r),beforeElement:null};break;case j.TABLE:{let i=this.treeAdapter.getParentNode(r);if(i)return{parent:i,beforeElement:r};return{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){let r=this._findFosterParentingLocation();r.beforeElement?this.treeAdapter.insertBefore(r.parent,t,r.beforeElement):this.treeAdapter.appendChild(r.parent,t)}_isSpecialElement(t,r){return vI[this.treeAdapter.getNamespaceURI(t)].has(r)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){var r,i;return void(r=this,i=t,r._insertCharacters(i),r.framesetOk=!1)}switch(this.insertionMode){case $.INITIAL:_d(this,t);break;case $.BEFORE_HTML:_p(this,t);break;case $.BEFORE_HEAD:_m(this,t);break;case $.IN_HEAD:_v(this,t);break;case $.IN_HEAD_NO_SCRIPT:__(this,t);break;case $.AFTER_HEAD:_b(this,t);break;case $.IN_BODY:case $.IN_CAPTION:case $.IN_CELL:case $.IN_TEMPLATE:_E(this,t);break;case $.TEXT:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:this._insertCharacters(t);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:_k(this,t);break;case $.IN_TABLE_TEXT:_F(this,t);break;case $.IN_COLUMN_GROUP:_U(this,t);break;case $.AFTER_BODY:_X(this,t);break;case $.AFTER_AFTER_BODY:_K(this,t)}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){var r,i;return void(r=this,(i=t).chars="�",r._insertCharacters(i))}switch(this.insertionMode){case $.INITIAL:_d(this,t);break;case $.BEFORE_HTML:_p(this,t);break;case $.BEFORE_HEAD:_m(this,t);break;case $.IN_HEAD:_v(this,t);break;case $.IN_HEAD_NO_SCRIPT:__(this,t);break;case $.AFTER_HEAD:_b(this,t);break;case $.TEXT:this._insertCharacters(t);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:_k(this,t);break;case $.IN_COLUMN_GROUP:_U(this,t);break;case $.AFTER_BODY:_X(this,t);break;case $.AFTER_AFTER_BODY:_K(this,t)}}onComment(t){var r,i,n,a;
56if(this.skipNextNewLine=!1,this.currentNotInHTML)return void _h(this,t);switch(this.insertionMode){case $.INITIAL:case $.BEFORE_HTML:case $.BEFORE_HEAD:case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:case $.IN_BODY:case $.IN_TABLE:case $.IN_CAPTION:case $.IN_COLUMN_GROUP:case $.IN_TABLE_BODY:case $.IN_ROW:case $.IN_CELL:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:case $.IN_TEMPLATE:case $.IN_FRAMESET:case $.AFTER_FRAMESET:_h(this,t);break;case $.IN_TABLE_TEXT:_B(this,t);break;case $.AFTER_BODY:r=this,i=t,r._appendCommentNode(i,r.openElements.items[0]);break;case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:n=this,a=t,n._appendCommentNode(a,n.document)}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case $.INITIAL:!function(t,r){t._setDocumentType(r);let i=r.forceQuirks?B.QUIRKS:function(t){if(t.name!==v2)return B.QUIRKS;let{systemId:r}=t;if(r&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===r.toLowerCase())return B.QUIRKS;let{publicId:i}=t;if(null!==i){if(i=i.toLowerCase(),v6.has(i))return B.QUIRKS;let t=null===r?v4:v3;if(v7(i,t))return B.QUIRKS;if(v7(i,t=null===r?v5:v8))return B.LIMITED_QUIRKS}return B.NO_QUIRKS}(r);(r.name!==v2||null!==r.publicId||null!==r.systemId&&"about:legacy-compat"!==r.systemId)&&t._err(r,D.nonConformingDoctype),t.treeAdapter.setDocumentMode(t.document,i),t.insertionMode=$.BEFORE_HTML}(this,t);break;case $.BEFORE_HEAD:case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:this._err(t,D.misplacedDoctype);break;case $.IN_TABLE_TEXT:_B(this,t)}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,D.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?function(t,r){let i;if((i=r.tagID)===j.FONT&&r.attrs.some(({name:t})=>t===F.COLOR||t===F.SIZE||t===F.FACE)||_r.has(i))_Q(t),t._startTagOutsideForeignContent(r);else{let i=t._getAdjustedCurrentElement(),n=t.treeAdapter.getNamespaceURI(i);if(n===R.MATHML)_i(r);else if(n===R.SVG){let t;null!=(t=_t.get(r.tagName))&&(r.tagName=t,r.tagID=vD(r.tagName)),_n(r)}_a(r),r.selfClosing?t._appendElement(r,n):t._insertElement(r,n),r.ackSelfClosing=!0}}(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case $.INITIAL:_d(this,t);break;case $.BEFORE_HTML:r=this,(i=t).tagID===j.HTML?(r._insertElement(i,R.HTML),r.insertionMode=$.BEFORE_HEAD):_p(r,i);break;case $.BEFORE_HEAD:var r,i,n,a,o,s,l,u,c,h,f,d,p=this,m=t;switch(m.tagID){case j.HTML:_M(p,m);break;case j.HEAD:p._insertElement(m,R.HTML),p.headElement=p.openElements.current,p.insertionMode=$.IN_HEAD;break;default:_m(p,m)}break;case $.IN_HEAD:_g(this,t);break;case $.IN_HEAD_NO_SCRIPT:var g=this,y=t;switch(y.tagID){case j.HTML:_M(g,y);break;case j.BASEFONT:case j.BGSOUND:case j.HEAD:case j.LINK:case j.META:case j.NOFRAMES:case j.STYLE:_g(g,y);break;case j.NOSCRIPT:g._err(y,D.nestedNoscriptInHead);break;default:__(g,y)}break;case $.AFTER_HEAD:var v=this,_=t;switch(_.tagID){case j.HTML:_M(v,_);break;case j.BODY:v._insertElement(_,R.HTML),v.framesetOk=!1,v.insertionMode=$.IN_BODY;break;case j.FRAMESET:v._insertElement(_,R.HTML),v.insertionMode=$.IN_FRAMESET;break;case j.BASE:case j.BASEFONT:case j.BGSOUND:case j.LINK:case j.META:case j.NOFRAMES:case j.SCRIPT:case j.STYLE:case j.TEMPLATE:case j.TITLE:v._err(_,D.abandonedHeadElementChild),v.openElements.push(v.headElement,j.HEAD),_g(v,_),v.openElements.remove(v.headElement);break;case j.HEAD:v._err(_,D.misplacedStartTagForHeadElement);break;default:_b(v,_)}break;case $.IN_BODY:_M(this,t);break;case $.IN_TABLE:_O(this,t);break;case $.IN_TABLE_TEXT:_B(this,t);break;case $.IN_CAPTION:let b;n=this,b=(a=t).tagID,_z.has(b)?n.openElements.hasInTableScope(j.CAPTION)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(j.CAPTION),n.activeFormattingElements.clearToLastMarker(),n.insertionMode=$.IN_TABLE,_O(n,a)):_M(n,a);break;case $.IN_COLUMN_GROUP:_j(this,t);break;case $.IN_TABLE_BODY:_V(this,t);break;case $.IN_ROW:_G(this,t);break;case $.IN_CELL:let x;o=this,x=(s=t).tagID,_z.has(x)?(o.openElements.hasInTableScope(j.TD)||o.openElements.hasInTableScope(j.TH))&&(o._closeTableCell(),_G(o,s)):_M(o,s);break;case $.IN_SELECT:_H(this,t);break;case $.IN_SELECT_IN_TABLE:let w;l=this,(w=(u=t).tagID)===j.CAPTION||w===j.TABLE||w===j.TBODY||w===j.TFOOT||w===j.THEAD||w===j.TR||w===j.TD||w===j.TH?(l.openElements.popUntilTagNamePopped(j.SELECT),l._resetInsertionMode(),l._processStartTag(u)):_H(l,u);break;case $.IN_TEMPLATE:var E=this,T=t;switch(T.tagID){case j.BASE:case j.BASEFONT:case j.BGSOUND:case j.LINK:case j.META:case j.NOFRAMES:case j.SCRIPT:case j.STYLE:case j.TEMPLATE:case j.TITLE:_g(E,T);break;case j.CAPTION:case j.COLGROUP:case j.TBODY:case j.TFOOT:case j.THEAD:E.tmplInsertionModeStack[0]=$.IN_TABLE,E.insertionMode=$.IN_TABLE,_O(E,T);break;case j.COL:E.tmplInsertionModeStack[0]=$.IN_COLUMN_GROUP,E.insertionMode=$.IN_COLUMN_GROUP,_j(E,T);break;case j.TR:E.tmplInsertionModeStack[0]=$.IN_TABLE_BODY,E.insertionMode=$.IN_TABLE_BODY,_V(E,T);break;case j.TD:case j.TH:E.tmplInsertionModeStack[0]=$.IN_ROW,E.insertionMode=$.IN_ROW,_G(E,T);break;default:E.tmplInsertionModeStack[0]=$.IN_BODY,E.insertionMode=$.IN_BODY,_M(E,T)}break;case $.AFTER_BODY:c=this,(h=t).tagID===j.HTML?_M(c,h):_X(c,h);break;case $.IN_FRAMESET:var A=this,S=t;switch(S.tagID){case j.HTML:_M(A,S);break;case j.FRAMESET:A._insertElement(S,R.HTML);break;case j.FRAME:A._appendElement(S,R.HTML),S.ackSelfClosing=!0;break;case j.NOFRAMES:_g(A,S)}break;case $.AFTER_FRAMESET:var C=this,M=t;switch(M.tagID){case j.HTML:_M(C,M);break;case j.NOFRAMES:_g(C,M)}break;case $.AFTER_AFTER_BODY:f=this,(d=t).tagID===j.HTML?_M(f,d):_K(f,d);break;case $.AFTER_AFTER_FRAMESET:var P=this,I=t;switch(I.tagID){case j.HTML:_M(P,I);break;case j.NOFRAMES:_g(P,I)}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?function(t,r){if(r.tagID===j.P||r.tagID===j.BR){_Q(t),t._endTagOutsideForeignContent(r);return}for(let i=t.openElements.stackTop;i>0;i--){let n=t.openElements.items[i];if(t.treeAdapter.getNamespaceURI(n)===R.HTML){t._endTagOutsideForeignContent(r);break}let a=t.treeAdapter.getTagName(n);if(a.toLowerCase()===r.tagName){r.tagName=a,t.openElements.shortenToLe
56ngth(i);break}}}(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case $.INITIAL:_d(this,t);break;case $.BEFORE_HTML:let r;n=this,((r=(a=t).tagID)===j.HTML||r===j.HEAD||r===j.BODY||r===j.BR)&&_p(n,a);break;case $.BEFORE_HEAD:let i;o=this,(i=(s=t).tagID)===j.HEAD||i===j.BODY||i===j.HTML||i===j.BR?_m(o,s):o._err(s,D.endTagWithoutMatchingOpenElement);break;case $.IN_HEAD:var n,a,o,s,l,u,c,h,f,d,p,m,g=this,y=t;switch(y.tagID){case j.HEAD:g.openElements.pop(),g.insertionMode=$.AFTER_HEAD;break;case j.BODY:case j.BR:case j.HTML:_v(g,y);break;case j.TEMPLATE:_y(g,y);break;default:g._err(y,D.endTagWithoutMatchingOpenElement)}break;case $.IN_HEAD_NO_SCRIPT:var v=this,_=t;switch(_.tagID){case j.NOSCRIPT:v.openElements.pop(),v.insertionMode=$.IN_HEAD;break;case j.BR:__(v,_);break;default:v._err(_,D.endTagWithoutMatchingOpenElement)}break;case $.AFTER_HEAD:var b=this,x=t;switch(x.tagID){case j.BODY:case j.HTML:case j.BR:_b(b,x);break;case j.TEMPLATE:_y(b,x);break;default:b._err(x,D.endTagWithoutMatchingOpenElement)}break;case $.IN_BODY:_P(this,t);break;case $.TEXT:l=this,t.tagID===j.SCRIPT&&(null==(u=l.scriptHandler)||u.call(l,l.openElements.current)),l.openElements.pop(),l.insertionMode=l.originalInsertionMode;break;case $.IN_TABLE:_N(this,t);break;case $.IN_TABLE_TEXT:_B(this,t);break;case $.IN_CAPTION:var w=this,E=t;let T=E.tagID;switch(T){case j.CAPTION:case j.TABLE:w.openElements.hasInTableScope(j.CAPTION)&&(w.openElements.generateImpliedEndTags(),w.openElements.popUntilTagNamePopped(j.CAPTION),w.activeFormattingElements.clearToLastMarker(),w.insertionMode=$.IN_TABLE,T===j.TABLE&&_N(w,E));break;case j.BODY:case j.COL:case j.COLGROUP:case j.HTML:case j.TBODY:case j.TD:case j.TFOOT:case j.TH:case j.THEAD:case j.TR:break;default:_P(w,E)}break;case $.IN_COLUMN_GROUP:var A=this,S=t;switch(S.tagID){case j.COLGROUP:A.openElements.currentTagId===j.COLGROUP&&(A.openElements.pop(),A.insertionMode=$.IN_TABLE);break;case j.TEMPLATE:_y(A,S);break;case j.COL:break;default:_U(A,S)}break;case $.IN_TABLE_BODY:_$(this,t);break;case $.IN_ROW:_q(this,t);break;case $.IN_CELL:var C=this,M=t;let P=M.tagID;switch(P){case j.TD:case j.TH:C.openElements.hasInTableScope(P)&&(C.openElements.generateImpliedEndTags(),C.openElements.popUntilTagNamePopped(P),C.activeFormattingElements.clearToLastMarker(),C.insertionMode=$.IN_ROW);break;case j.TABLE:case j.TBODY:case j.TFOOT:case j.THEAD:case j.TR:C.openElements.hasInTableScope(P)&&(C._closeTableCell(),_q(C,M));break;case j.BODY:case j.CAPTION:case j.COL:case j.COLGROUP:case j.HTML:break;default:_P(C,M)}break;case $.IN_SELECT:_W(this,t);break;case $.IN_SELECT_IN_TABLE:let I;c=this,(I=(h=t).tagID)===j.CAPTION||I===j.TABLE||I===j.TBODY||I===j.TFOOT||I===j.THEAD||I===j.TR||I===j.TD||I===j.TH?c.openElements.hasInTableScope(I)&&(c.openElements.popUntilTagNamePopped(j.SELECT),c._resetInsertionMode(),c.onEndTag(h)):_W(c,h);break;case $.IN_TEMPLATE:f=this,(d=t).tagID===j.TEMPLATE&&_y(f,d);break;case $.AFTER_BODY:_Y(this,t);break;case $.IN_FRAMESET:p=this,t.tagID===j.FRAMESET&&!p.openElements.isRootHtmlElementCurrent()&&(p.openElements.pop(),p.fragmentContext||p.openElements.currentTagId===j.FRAMESET||(p.insertionMode=$.AFTER_FRAMESET));break;case $.AFTER_FRAMESET:m=this,t.tagID===j.HTML&&(m.insertionMode=$.AFTER_AFTER_FRAMESET);break;case $.AFTER_AFTER_BODY:_K(this,t)}}onEof(t){switch(this.insertionMode){case $.INITIAL:_d(this,t);break;case $.BEFORE_HTML:_p(this,t);break;case $.BEFORE_HEAD:_m(this,t);break;case $.IN_HEAD:_v(this,t);break;case $.IN_HEAD_NO_SCRIPT:__(this,t);break;case $.AFTER_HEAD:_b(this,t);break;case $.IN_BODY:case $.IN_TABLE:case $.IN_CAPTION:case $.IN_COLUMN_GROUP:case $.IN_TABLE_BODY:case $.IN_ROW:case $.IN_CELL:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:_I(this,t);break;case $.TEXT:var r,i;r=this,i=t,r._err(i,D.eofInElementThatCanContainOnlyText),r.openElements.pop(),r.insertionMode=r.originalInsertionMode,r.onEof(i);break;case $.IN_TABLE_TEXT:_B(this,t);break;case $.IN_TEMPLATE:_Z(this,t);break;case $.AFTER_BODY:case $.IN_FRAMESET:case $.AFTER_FRAMESET:case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:_f(this,t)}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCo
56deAt(0)===M.LINE_FEED)){if(1===t.chars.length)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode)return void this._insertCharacters(t);switch(this.insertionMode){case $.IN_HEAD:case $.IN_HEAD_NO_SCRIPT:case $.AFTER_HEAD:case $.TEXT:case $.IN_COLUMN_GROUP:case $.IN_SELECT:case $.IN_SELECT_IN_TABLE:case $.IN_FRAMESET:case $.AFTER_FRAMESET:this._insertCharacters(t);break;case $.IN_BODY:case $.IN_CAPTION:case $.IN_CELL:case $.IN_TEMPLATE:case $.AFTER_BODY:case $.AFTER_AFTER_BODY:case $.AFTER_AFTER_FRAMESET:_w(this,t);break;case $.IN_TABLE:case $.IN_TABLE_BODY:case $.IN_ROW:_k(this,t);break;case $.IN_TABLE_TEXT:_R(this,t)}}}function _c(t,r){for(let i=0;i<8;i++){let i=function(t,r){let i=t.activeFormattingElements.getElementEntryInScopeWithTagName(r.tagName);return i?t.openElements.contains(i.element)?t.openElements.hasInScope(r.tagID)||(i=null):(t.activeFormattingElements.removeEntry(i),i=null):_D(t,r),i}(t,r);if(!i)break;let n=function(t,r){let i=null,n=t.openElements.stackTop;for(;n>=0;n--){let a=t.openElements.items[n];if(a===r.element)break;t._isSpecialElement(a,t.openElements.tagIDs[n])&&(i=a)}return i||(t.openElements.shortenToLength(Math.max(n,0)),t.activeFormattingElements.removeEntry(r)),i}(t,i);if(!n)break;t.activeFormattingElements.bookmark=i;let a=function(t,r,i){let n=r,a=t.openElements.getCommonAncestor(r);for(let o=0,s=a;s!==i;o++,s=a){a=t.openElements.getCommonAncestor(s);let i=t.activeFormattingElements.getElementEntry(s),l=i&&o>=3;!i||l?(l&&t.activeFormattingElements.removeEntry(i),t.openElements.remove(s)):(s=function(t,r){let i=t.treeAdapter.getNamespaceURI(r.element),n=t.treeAdapter.createElement(r.token.tagName,i,r.token.attrs);return t.openElements.replace(r.element,n),r.element=n,n}(t,i),n===r&&(t.activeFormattingElements.bookmark=i),t.treeAdapter.detachNode(n),t.treeAdapter.appendChild(s,n),n=s)}return n}(t,n,i.element),o=t.openElements.getCommonAncestor(i.element);t.treeAdapter.detachNode(a),o&&function(t,r,i){let n=vD(t.treeAdapter.getTagName(r));if(t._isElementCausesFosterParenting(n))t._fosterParentElement(i);else{let a=t.treeAdapter.getNamespaceURI(r);n===j.TEMPLATE&&a===R.HTML&&(r=t.treeAdapter.getTemplateContent(r)),t.treeAdapter.appendChild(r,i)}}(t,o,a),function(t,r,i){let n=t.treeAdapter.getNamespaceURI(i.element),{token:a}=i,o=t.treeAdapter.createElement(a.tagName,n,a.attrs);t._adoptNodes(r,o),t.treeAdapter.appendChild(r,o),t.activeFormattingElements.insertElementAfterBookmark(o,a),t.activeFormattingElements.removeEntry(i),t.openElements.remove(i.element),t.openElements.insertAfter(r,o,a.tagID)}(t,n,i)}}function _h(t,r){t._appendCommentNode(r,t.openElements.currentTmplContentOrNode)}function _f(t,r){if(t.stopped=!0,r.location){let i=2*!t.fragmentContext;for(let n=t.openElements.stackTop;n>=i;n--)t._setEndLocation(t.openElements.items[n],r);if(!t.fragmentContext&&t.openElements.stackTop>=0){let i=t.openElements.items[0],n=t.treeAdapter.getNodeSourceCodeLocation(i);if(n&&!n.endTag&&(t._setEndLocation(i,r),t.openElements.stackTop>=1)){let i=t.openElements.items[1],n=t.treeAdapter.getNodeSourceCodeLocation(i);n&&!n.endTag&&t._setEndLocation(i,r)}}}}function _d(t,r){t._err(r,D.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,B.QUIRKS),t.insertionMode=$.BEFORE_HTML,t._processToken(r)}function _p(t,r){t._insertFakeRootElement(),t.insertionMode=$.BEFORE_HEAD,t._processToken(r)}function _m(t,r){t._insertFakeElement(z.HEAD,j.HEAD),t.headElement=t.openElements.current,t.insertionMode=$.IN_HEAD,t._processToken(r)}function _g(t,r){switch(r.tagID){case j.HTML:_M(t,r);break;case j.BASE:case j.BASEFONT:case j.BGSOUND:case j.LINK:case j.META:t._appendElement(r,R.HTML),r.ackSelfClosing=!0;break;case j.TITLE:t._switchToTextParsing(r,vN.RCDATA);break;case j.NOSCRIPT:t.options.scriptingEnabled?t._switchToTextParsing(r,vN.RAWTEXT):(t._insertElement(r,R.HTML),t.insertionMode=$.IN_HEAD_NO_SCRIPT);break;case j.NOFRAMES:case j.STYLE:t._switchToTextParsing(r,vN.RAWTEXT);break;case j.SCRIPT:t._switchToTextParsing(r,vN.SCRIPT_DATA);break;case j.TEMPLATE:t._insertTemplate(r),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=$.IN_TEMPLATE,t.tmplInsertionModeStack.unshift($.IN_TEMPLATE);break;case j.HEAD:t._err(r,D.misplacedStartTagForHeadElement);break;default:_v(t,r)}}function _y(t,r){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==j.TEMPLATE&&t._err(r,D.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(j.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(r,D.endTagWithoutMatchingOpenElement)}function _v(t,r){t.openElements.pop(),t.insertionMode=$.AFTER_HEAD,t._processToken(r)}function __(t,r){let i=r.type===P.EOF?D.openElementsLeftAfterEof:D.disallowedContentInNoscriptInHead;t._err(r,i),t.openElements.pop(),t.insertionMode=$.IN_HEAD,t._processToken(r)}function _b(t,r){t._insertFakeElement(z.BODY,j.BODY),t.insertionMode=$.IN_BODY,_x(t,r)}
56function _x(t,r){switch(r.type){case P.CHARACTER:_E(t,r);break;case P.WHITESPACE_CHARACTER:_w(t,r);break;case P.COMMENT:_h(t,r);break;case P.START_TAG:_M(t,r);break;case P.END_TAG:_P(t,r);break;case P.EOF:_I(t,r)}}function _w(t,r){t._reconstructActiveFormattingElements(),t._insertCharacters(r)}function _E(t,r){t._reconstructActiveFormattingElements(),t._insertCharacters(r),t.framesetOk=!1}function _T(t,r){t._reconstructActiveFormattingElements(),t._appendElement(r,R.HTML),t.framesetOk=!1,r.ackSelfClosing=!0}function _A(t){let r=vE(t,F.TYPE);return null!=r&&"hidden"===r.toLowerCase()}function _S(t,r){t._switchToTextParsing(r,vN.RAWTEXT)}function _C(t,r){t._reconstructActiveFormattingElements(),t._insertElement(r,R.HTML)}function _M(t,r){switch(r.tagID){case j.I:case j.S:case j.B:case j.U:case j.EM:case j.TT:case j.BIG:case j.CODE:case j.FONT:case j.SMALL:case j.STRIKE:case j.STRONG:t._reconstructActiveFormattingElements(),t._insertElement(r,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,r);break;case j.A:let i;(i=t.activeFormattingElements.getElementEntryInScopeWithTagName(z.A))&&(_c(t,r),t.openElements.remove(i.element),t.activeFormattingElements.removeEntry(i)),t._reconstructActiveFormattingElements(),t._insertElement(r,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,r);break;case j.H1:case j.H2:case j.H3:case j.H4:case j.H5:case j.H6:t.openElements.hasInButtonScope(j.P)&&t._closePElement(),void 0!==t.openElements.currentTagId&&vk.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(r,R.HTML);break;case j.P:case j.DL:case j.OL:case j.UL:case j.DIV:case j.DIR:case j.NAV:case j.MAIN:case j.MENU:case j.ASIDE:case j.CENTER:case j.FIGURE:case j.FOOTER:case j.HEADER:case j.HGROUP:case j.DIALOG:case j.DETAILS:case j.ADDRESS:case j.ARTICLE:case j.SEARCH:case j.SECTION:case j.SUMMARY:case j.FIELDSET:case j.BLOCKQUOTE:case j.FIGCAPTION:t.openElements.hasInButtonScope(j.P)&&t._closePElement(),t._insertElement(r,R.HTML);break;case j.LI:case j.DD:case j.DT:t.framesetOk=!1;let n=r.tagID;for(let r=t.openElements.stackTop;r>=0;r--){let i=t.openElements.tagIDs[r];if(n===j.LI&&i===j.LI||(n===j.DD||n===j.DT)&&(i===j.DD||i===j.DT)){t.openElements.generateImpliedEndTagsWithExclusion(i),t.openElements.popUntilTagNamePopped(i);break}if(i!==j.ADDRESS&&i!==j.DIV&&i!==j.P&&t._isSpecialElement(t.openElements.items[r],i))break}t.openElements.hasInButtonScope(j.P)&&t._closePElement(),t._insertElement(r,R.HTML);break;case j.BR:case j.IMG:case j.WBR:case j.AREA:case j.EMBED:case j.KEYGEN:_T(t,r);break;case j.HR:t.openElements.hasInButtonScope(j.P)&&t._closePElement(),t._appendElement(r,R.HTML),t.framesetOk=!1,r.ackSelfClosing=!0;break;case j.RB:case j.RTC:t.openElements.hasInScope(j.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(r,R.HTML);break;case j.RT:case j.RP:t.openElements.hasInScope(j.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(j.RTC),t._insertElement(r,R.HTML);break;case j.PRE:case j.LISTING:t.openElements.hasInButtonScope(j.P)&&t._closePElement(),t._insertElement(r,R.HTML),t.skipNextNewLine=!0,t.framesetOk=!1;break;case j.XMP:t.openElements.hasInButtonScope(j.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(r,vN.RAWTEXT);break;case j.SVG:t._reconstructActiveFormattingElements(),_n(r),_a(r),r.selfClosing?t._appendElement(r,R.SVG):t._insertElement(r,R.SVG),r.ackSelfClosing=!0;break;case j.HTML:0===t.openElements.tmplCount&&t.treeAdapter.adoptAttributes(t.openElements.items[0],r.attrs);break;case j.BASE:case j.LINK:case j.META:case j.STYLE:case j.TITLE:case j.SCRIPT:case j.BGSOUND:case j.BASEFONT:case j.TEMPLATE:_g(t,r);break;case j.BODY:let a;(a=t.openElements.tryPeekProperlyNestedBodyElement())&&0===t.openElements.tmplCount&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(a,r.attrs));break;case j.FORM:let o;o=t.openElements.tmplCount>0,(!t.formElement||o)&&(t.openElements.hasInButtonScope(j.P)&&t._closePElement(),t._insertElement(r,R.HTML),o||(t.formElement=t.openElements.current));break;case j.NOBR:t._reconstructActiveFormattingElements(),t.openElements.hasInScope(j.NOBR)&&(_c(t,r),t._reconstructActiveFormattingElements()),t._insertElement(r,R.HTML),t.activeFormattingElements.pushElement(t.openElements.current,r);break;case j.MATH:t._reconstructActiveFormattingElements(),_i(r),_a(r),r.selfClosing?t._appendElement(r,R.MATHML):t._insertElement(r,R.MATHML),r.ackSelfClosing=!0;break;case j.TABLE:t.treeAdapter.getDocumentMode(t.document)!==B.QUIRKS&&t.openElements.hasInButtonScope(j.P)&&t._closePElement(),t._insertElement(r,R.HTML),t.framesetOk=!1,t.insertionMode=$.IN_TABLE;break;case j.INPUT:t._reconstructActiveFormattingElements(),t._appendElement(r,R.HTML),_A(r)||(t.framesetOk=!1),r.ackSelfClosing=!0;break;case j.PARAM:case j.TRACK:case j.SOURCE:t._appendElement(r,R.HTML),r.ackSelfClosing=!0;break;case j.IMAGE:r.tagName=z.IMG,r.tagID=j.IMG,_T(t,r);break;case j.BUTTON:t.openElements.hasInScope(j.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(j.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(r,R.HTML),t.framesetOk=!1;break;case j.APPLET:case j.OBJECT:case j.MARQUEE:t._reconstructActiveFormattingElements(),t._insertElement(r,R.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1;break;case j.IFRAME:t.framesetOk=!1,t._switchToTextParsing(r,vN.RAWTEXT);break;case j.SELECT:t._reconstructActiveFormattingElements(),t._insertElement(r,R.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===$.IN_TABLE||t.insertionMode===$.IN_CAPTION||t.insertionMode===$.IN_TABLE_BODY||t.insertionMode===$.IN_ROW||t.insertionMode===$.IN_CELL?$.IN_SELECT_IN_TABLE:$.IN_SELECT;break;case j.OPTION:case j.OPTGROUP:t.openElements.currentTagId===j.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(r,R.HTML);break;case j.NOEMBED:case j.NOFRAMES:_S(t,r);break;case j.FRAMESET:let s;s=t.openElements.tryPeekProperlyNestedBodyElement(),t.framesetOk&&s&&(t.treeAdapter.detachNode(s),t.openElements.popAllUpToHtmlElement(),t._insertElement(r,R.HTML),t.insertionMode=$.IN_FRAMESET);break;case j.TEXTAREA:t._insertElement(r,R.HTML),t.skipNextNewLine=!0,t.tokenizer.state=vN.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=$.TEXT;break;case j.NOSCRIPT:t.options.scriptingEnabled?_S(t,r):_C(t,r);break;case j.PLAINTEXT:t.openElements.hasInButtonScope(j.P)&&t._closePElement(),t._insertElement(r,R.HTML),t.tokenizer.state=vN.PLAINTEXT;break;case j.COL:case j.TH:case j.TD:case j.TR:case j.HEAD:case j.FRAME:case j.TBODY:case j.TFOOT:case j.THEAD:case j.CAPTION:case j.COLGROUP:break;default:_C(t,r)}}function _D(t,r){let i=r.tagName,n=r.tagID;for(let r=t.openElements.stackTop;r>0;r--){let a=t.openElements.items[r],o=t.openElements.tagIDs[r];if(n===o&&(n!==j.UNKNOWN||t.treeAdapter.getTagName(a)===i)){t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.stackTop>
56=r&&t.openElements.shortenToLength(r);break}if(t._isSpecialElement(a,o))break}}function _P(t,r){switch(r.tagID){case j.A:case j.B:case j.I:case j.S:case j.U:case j.EM:case j.TT:case j.BIG:case j.CODE:case j.FONT:case j.NOBR:case j.SMALL:case j.STRIKE:case j.STRONG:_c(t,r);break;case j.P:t.openElements.hasInButtonScope(j.P)||t._insertFakeElement(z.P,j.P),t._closePElement();break;case j.DL:case j.UL:case j.OL:case j.DIR:case j.DIV:case j.NAV:case j.PRE:case j.MAIN:case j.MENU:case j.ASIDE:case j.BUTTON:case j.CENTER:case j.FIGURE:case j.FOOTER:case j.HEADER:case j.HGROUP:case j.DIALOG:case j.ADDRESS:case j.ARTICLE:case j.DETAILS:case j.SEARCH:case j.SECTION:case j.SUMMARY:case j.LISTING:case j.FIELDSET:case j.BLOCKQUOTE:case j.FIGCAPTION:let i;i=r.tagID,t.openElements.hasInScope(i)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(i));break;case j.LI:t.openElements.hasInListItemScope(j.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(j.LI),t.openElements.popUntilTagNamePopped(j.LI));break;case j.DD:case j.DT:let n;n=r.tagID,t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n));break;case j.H1:case j.H2:case j.H3:case j.H4:case j.H5:case j.H6:t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped());break;case j.BR:t._reconstructActiveFormattingElements(),t._insertFakeElement(z.BR,j.BR),t.openElements.pop(),t.framesetOk=!1;break;case j.BODY:if(t.openElements.hasInScope(j.BODY)&&(t.insertionMode=$.AFTER_BODY,t.options.sourceCodeLocationInfo)){let i=t.openElements.tryPeekProperlyNestedBodyElement();i&&t._setEndLocation(i,r)}break;case j.HTML:t.openElements.hasInScope(j.BODY)&&(t.insertionMode=$.AFTER_BODY,_Y(t,r));break;case j.FORM:!function(t){let r=t.openElements.tmplCount>0,{formElement:i}=t;r||(t.formElement=null),(i||r)&&t.openElements.hasInScope(j.FORM)&&(t.openElements.generateImpliedEndTags(),r?t.openElements.popUntilTagNamePopped(j.FORM):i&&t.openElements.remove(i))}(t);break;case j.APPLET:case j.OBJECT:case j.MARQUEE:let a;a=r.tagID,t.openElements.hasInScope(a)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(a),t.activeFormattingElements.clearToLastMarker());break;case j.TEMPLATE:_y(t,r);break;default:_D(t,r)}}function _I(t,r){t.tmplInsertionModeStack.length>0?_Z(t,r):_f(t,r)}function _k(t,r){if(void 0!==t.openElements.currentTagId&&_s.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=$.IN_TABLE_TEXT,r.type){case P.CHARACTER:_F(t,r);break;case P.WHITESPACE_CHARACTER:_R(t,r)}else _L(t,r)}function _O(t,r){switch(r.tagID){case j.TD:case j.TH:case j.TR:t.openElements.clearBackToTableContext(),t._insertFakeElement(z.TBODY,j.TBODY),t.insertionMode=$.IN_TABLE_BODY,_V(t,r);break;case j.STYLE:case j.SCRIPT:case j.TEMPLATE:_g(t,r);break;case j.COL:t.openElements.clearBackToTableContext(),t._insertFakeElement(z.COLGROUP,j.COLGROUP),t.insertionMode=$.IN_COLUMN_GROUP,_j(t,r);break;case j.FORM:t.formElement||0!==t.openElements.tmplCount||(t._insertElement(r,R.HTML),t.formElement=t.openElements.current,t.openElements.pop());break;case j.TABLE:t.openElements.hasInTableScope(j.TABLE)&&(t.openElements.popUntilTagNamePopped(j.TABLE),t._resetInsertionMode(),t._processStartTag(r));break;case j.TBODY:case j.TFOOT:case j.THEAD:t.openElements.clearBackToTableContext(),t._insertElement(r,R.HTML),t.insertionMode=$.IN_TABLE_BODY;break;case j.INPUT:_A(r)?t._appendElement(r,R.HTML):_L(t,r),r.ackSelfClosing=!0;break;case j.CAPTION:t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(r,R.HTML),t.insertionMode=$.IN_CAPTION;break;case j.COLGROUP:t.openElements.clearBackToTableContext(),t._insertElement(r,R.HTML),t.insertionMode=$.IN_COLUMN_GROUP;break;default:_L(t,r)}}function _N(t,r){switch(r.tagID){case j.TABLE:t.openElements.hasInTableScope(j.TABLE)&&(t.openElements.popUntilTagNamePopped(j.TABLE),t._resetInsertionMode());break;case j.TEMPLATE:_y(t,r);break;case j.BODY:case j.CAPTION:case j.COL:case j.COLGROUP:case j.HTML:case j.TBODY:case j.TD:case j.TFOOT:case j.TH:case j.THEAD:case j.TR:break;default:_L(t,r)}}function _L(t,r){let i=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,_x(t,r),t.fosterParentingEnabled=i}function _R(t,r){t.pendingCharacterTokens.push(r)}function _F(t,r){t.pendingCharacterTokens.push(r),t.hasNonWhitespacePendingCharacterToken=!0}function _B(t,r){let i=0;if(t.hasNonWhitespacePendingCharacterToken)for(;i<t.pendingCharacterTokens.length;i++)_L(t,t.pendingCharacterTokens[i]);else for(;i<t.pendingCharacterTokens.length;i++)t._insertCharacters(t.pendingCharacterTokens[i]);t.insertionMode=t.originalInsertionMode,t._processToken(r)}let _z=new Set([j.CAPTION,j.COL,j.COLGROUP,j.TBODY,j.TD,j.TFOOT,j.TH,j.THEAD,j.TR]);function _j(t,r){switch(r.tagID){case j.HTML:_M(t,r);break;case j.COL:t._appendElement(r,R.HTML),r.ackSelfClosing=!0;break;case j.TEMPLATE:_g(t,r);break;default:_U(t,r)}}function _U(t,r){t.openElements.currentTagId===j.COLGROUP&&(t.openElements.pop(),t.insertionMode=$.IN_TABLE,t._processToken(r))}function _V(t,r){switch(r.tagID){case j.TR:t.openElements.clearBackToTableBodyContext(),t._insertElement(r,R.HTML),t.insertionMode=$.IN_ROW;break;case j.TH:case j.TD:t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(z.TR,j.TR),t.insertionMode=$.IN_ROW,_G(t,r);break;case j.CAPTION:case j.COL:case j.COLGROUP:case j.TBODY:case j.TFOOT:case j.THEAD:t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=$.IN_TABLE,_O(t,r));break;default:_O(t,r)}}function _$(t,r){let i=r.tagID;switch(r.tagID){case j.TBODY:case j.TFOOT:case j.THEAD:t.openElements.hasInTableScope(i)&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=$.IN_TABLE);break;case j.TABLE:t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=$.IN_TABLE,_N(t,r));break;case j.BODY:case j.CAPTION:case j.COL:case j.COLGROUP:case j.HTML:case j.TD:case j.TH:case j.TR:break;default:_N(t,r)}}function _G(t,r){switch(r.tagID){case j.TH:case j.TD:t.openElements.clearBackToTableRowContext(),t._insertElement(r,R.HTML),t.insertionMode=$.IN_CELL,t.activeFormattingElements.insertMarker();break;case j.CAPTION:case j.COL:case j.COLGROUP:case j.TBODY:case j.TFOOT:case j.THEAD:case j.TR:t.openElements.hasInTableScope(j.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=$.IN_TABLE_BODY,_V(t,r));break;default:_O(t,r)}}function _q(t,r){switch(r.tagID){case j.TR:t.openElements.hasInTableScope(j.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=$.IN_TABLE_BODY);break;case j.TABLE:t.openElements.hasInTableScope(j.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=$.IN_TABLE_BODY,_$(t,r));break;case j.TBODY:case j.TFOOT:case j.THEAD:(t.openElements.hasInTableScope(r.tagID)||t.openElements.hasInTableScope(j.TR))&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=$.IN_TABLE_BODY,_$(t,r));break;case j.BODY:case j.CAPTION:case j.COL:case j.COLGROUP:case j.HTML:case j.TD:case j.TH:break;default:_N(t,r)}}function _H(t,r){switch(r.tagID){case j.HTML:_M(t,r);break;case j.OPTION:t.openElements.currentTagId===j.OPTION&&t.openElements.pop(),t._insertElement(r,R.HTML);break;case j.OPTGROUP:t.openElements.currentTagId===j.OPTION&&t.openElements.pop(),t.openElements.currentTagId===j.OPTGROUP&&t.openElements.pop(),t._insertElement(r,R.HTML);break;
56case j.HR:t.openElements.currentTagId===j.OPTION&&t.openElements.pop(),t.openElements.currentTagId===j.OPTGROUP&&t.openElements.pop(),t._appendElement(r,R.HTML),r.ackSelfClosing=!0;break;case j.INPUT:case j.KEYGEN:case j.TEXTAREA:case j.SELECT:t.openElements.hasInSelectScope(j.SELECT)&&(t.openElements.popUntilTagNamePopped(j.SELECT),t._resetInsertionMode(),r.tagID!==j.SELECT&&t._processStartTag(r));break;case j.SCRIPT:case j.TEMPLATE:_g(t,r)}}function _W(t,r){switch(r.tagID){case j.OPTGROUP:t.openElements.stackTop>0&&t.openElements.currentTagId===j.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===j.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===j.OPTGROUP&&t.openElements.pop();break;case j.OPTION:t.openElements.currentTagId===j.OPTION&&t.openElements.pop();break;case j.SELECT:t.openElements.hasInSelectScope(j.SELECT)&&(t.openElements.popUntilTagNamePopped(j.SELECT),t._resetInsertionMode());break;case j.TEMPLATE:_y(t,r)}}function _Z(t,r){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(j.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(r)):_f(t,r)}function _Y(t,r){var i;if(r.tagID===j.HTML){if(t.fragmentContext||(t.insertionMode=$.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===j.HTML){t._setEndLocation(t.openElements.items[0],r);let n=t.openElements.items[1];!n||(null==(i=t.treeAdapter.getNodeSourceCodeLocation(n))?void 0:i.endTag)||t._setEndLocation(n,r)}}else _X(t,r)}function _X(t,r){t.insertionMode=$.IN_BODY,_x(t,r)}function _K(t,r){t.insertionMode=$.IN_BODY,_x(t,r)}function _Q(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==R.HTML&&void 0!==t.openElements.currentTagId&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}z.AREA,z.BASE,z.BASEFONT,z.BGSOUND,z.BR,z.COL,z.EMBED,z.FRAME,z.HR,z.IMG,z.INPUT,z.KEYGEN,z.LINK,z.META,z.PARAM,z.SOURCE,z.TRACK,z.WBR;var _J=t.i(382698),_J=_J,_0=t.i(615473),_0=_0;let _1=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,_2=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),_3={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function _4(t,r){var i,n;let a,o,s=!!((a="root"===(n=t).type?n.children[0]:n)&&("doctype"===a.type||"element"===a.type&&"html"===a.tagName.toLowerCase())),l=vu("type",{handlers:{root:_5,element:_8,text:_7,comment:be,doctype:_9,raw:bt},unknown:br}),u={parser:s?new _u(_3):_u.getFragmentParser(void 0,_3),handle(t){l(t,u)},stitches:!1,options:r||{}};l(t,u),bi(u,mE());let c=(i=s?u.parser.document:u.parser.getFragment(),vi({file:(o={file:u.options.file}).file||void 0,location:!1,schema:"svg"===o.space?mv:my,verbose:o.verbose||!1},i));return(u.stitches&&ym(c,"comment",function(t,r,i){if(t.value.stitch&&i&&void 0!==r)return i.children[r]=t.value.stitch,r}),"root"===c.type&&1===c.children.length&&c.children[0].type===t.type)?c.children[0]:c}function _6(t,r){let i=-1;if(t)for(;++i<t.length;)r.handle(t[i])}function _5(t,r){_6(t.children,r)}function _8(t,r){(function(t,r){let i=t.tagName.toLowerCase();if(r.parser.tokenizer.state===vN.PLAINTEXT)return;bi(r,mE(t));let n=r.parser.openElements.current,a="namespaceURI"in n?n.namespaceURI:ve.html;a===ve.html&&"svg"===i&&(a=ve.svg);let o=vh({...t,children:[]},"svg"===({space:a===ve.svg?"svg":"html"}).space?mv:my),s={type:_J.TokenType.START_TAG,tagName:i,tagID:_0.getTagID(i),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in o?o.attrs:[],location:ba(t)};r.parser.currentToken=s,r.parser._processToken(r.parser.currentToken),r.parser.tokenizer.lastStartTagName=i})(t,r),_6(t.children,r),function(t,r){let i=t.tagName.toLowerCase();if(!r.parser.tokenizer.inForeignNode&&vp.includes(i)||r.parser.tokenizer.state===vN.PLAINTEXT)return;bi(r,mw(t));let n={type:_J.TokenType.END_TAG,tagName:i,tagID:_0.getTagID(i),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:ba(t)};r.parser.currentToken=n,r.parser._processToken(r.parser.currentToken),i===r.parser.tokenizer.lastStartTagName&&(r.parser.tokenizer.state===vN.RCDATA||r.parser.tokenizer.state===vN.RAWTEXT||r.parser.tokenizer.state===vN.SCRIPT_DATA)&&(r.parser.tokenizer.state=vN.DATA)}(t,r)}function _7(t,r){r.parser.tokenizer.state>4&&(r.parser.tokenizer.state=0);let i={type:_J.TokenType.CHARACTER,chars:t.value,location:ba(t)};bi(r,mE(t)),r.parser.currentToken=i,r.parser._processToken(r.parser.currentToken)}function _9(t,r){let i={type:_J.TokenType.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:ba(t)};bi(r,mE(t)),r.parser.currentToken=i,r.parser._processToken(r.parser.currentToken)}function be(t,r){let i=t.value,n={type:_J.TokenType.COMMENT,data:i,location:ba(t)};bi(r,mE(t)),r.parser.currentToken=n,r.parser._processToken(r.parser.currentToken)}function bt(t,r){if(r.parser.tokenizer.preprocessor.html="",r.parser.tokenizer.preprocessor.pos=-1,r.parser.tokenizer.preprocessor.lastGapPos=-2,r.parser.tokenizer.preprocessor.gapStack=[],r.parser.tokenizer.preprocessor.skipNextNewLine=!1,r.parser.tokenizer.preprocessor.lastChunkWritten=!1,r.parser.tokenizer.preprocessor.endOfChunkHit=!1,r.parser.tokenizer.preprocessor.isEol=!1,bn(r,mE(t)),r.parser.tokenizer.write(r.options.tagfilter?t.value.replace(_1,"<$1$2"):t.value,!1),r.parser.tokenizer._runParsingLoop(),72===r.parser.tokenizer.state||78===r.parser.tokenizer.state){r.parser.tokenizer.preprocessor.lastChunkWritten=!0;let t=r.parser.tokenizer._consume();r.parser.tokenizer._callState(t)}}function br(t,r){if(r.options.passThrough&&r.options.passThrough.includes(t.type)){var i;let n;r.stitches=!0,n="children"in(i=t)?ys({...i,children:[]}
56):ys(i),"children"in t&&"children"in n&&(n.children=_4({type:"root",children:t.children},r.options).children),be({type:"comment",value:{stitch:n}},r)}else{let r="";throw _2.has(t.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+t.type+"` node"+r)}}function bi(t,r){bn(t,r);let i=t.parser.tokenizer.currentCharacterToken;i&&i.location&&(i.location.endLine=t.parser.tokenizer.preprocessor.line,i.location.endCol=t.parser.tokenizer.preprocessor.col+1,i.location.endOffset=t.parser.tokenizer.preprocessor.offset+1,t.parser.currentToken=i,t.parser._processToken(t.parser.currentToken)),t.parser.tokenizer.paused=!1,t.parser.tokenizer.inLoop=!1,t.parser.tokenizer.active=!1,t.parser.tokenizer.returnState=vN.DATA,t.parser.tokenizer.charRefCode=-1,t.parser.tokenizer.consumedAfterSnapshot=-1,t.parser.tokenizer.currentLocation=null,t.parser.tokenizer.currentCharacterToken=null,t.parser.tokenizer.currentToken=null,t.parser.tokenizer.currentAttr={name:"",value:""}}function bn(t,r){if(r&&void 0!==r.offset){let i={startLine:r.line,startCol:r.column,startOffset:r.offset,endLine:-1,endCol:-1,endOffset:-1};t.parser.tokenizer.preprocessor.lineStartPos=-r.column+1,t.parser.tokenizer.preprocessor.droppedBufferSize=r.offset,t.parser.tokenizer.preprocessor.line=r.line,t.parser.tokenizer.currentLocation=i}}function ba(t){let r=mE(t)||{line:void 0,column:void 0,offset:void 0},i=mw(t)||{line:void 0,column:void 0,offset:void 0};return{startLine:r.line,startCol:r.column,startOffset:r.offset,endLine:i.line,endCol:i.column,endOffset:i.offset}}function bo(t){return function(r,i){return _4(r,{...t,file:i})}}let bs=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],bl={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...bs,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...bs],h2:[["className","sr-only"]],img:[...bs,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...bs,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...bs],table:[...bs],ul:[...bs,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},bu={}.hasOwnProperty;function bc(t,r){if(r&&"object"==typeof r)switch("string"==typeof r.type?r.type:""){case"comment":var i,n,a=t,o=r;if(a.schema.allowComments){let t="string"==typeof o.value?o.value:"",r=t.indexOf("-->"),i={type:"comment",value:r<0?t:t.slice(0,r)};return bp(i,o),i}return;case"doctype":var s=t,l=r;if(s.schema.allowDoctypes){let t={type:"doctype"};return bp(t,l),t}return;case"element":return function(t,r){let i="string"==typeof r.tagName?r.tagName:"";t.stack.push(i);let n=bh(t,r.children),a=function(t,r){let i,n=t.stack[t.stack.length-1],a=t.schema.attributes,o=t.schema.required,s=a&&bu.call(a,n)?a[n]:void 0,l=a&&bu.call(a,"*")?a["*"]:void 0,u=r&&"object"==typeof r?r:{},c={};for(i in u)if(bu.call(u,i)){let r=u[i],n=bf(t,bm(s,i),i,r);null==n&&(n=bf(t,bm(l,i),i,r)),null!=n&&(c[i]=n)}
56if(o&&bu.call(o,n)){let t=o[n];for(i in t)bu.call(t,i)&&!bu.call(c,i)&&(c[i]=t[i])}return c}(t,r.properties);t.stack.pop();let o=!1;if(i&&"*"!==i&&(!t.schema.tagNames||t.schema.tagNames.includes(i))&&(o=!0,t.schema.ancestors&&bu.call(t.schema.ancestors,i))){let r=t.schema.ancestors[i],n=-1;for(o=!1;++n<r.length;)t.stack.includes(r[n])&&(o=!0)}if(!o)return t.schema.strip&&!t.schema.strip.includes(i)?n:void 0;let s={type:"element",tagName:i,properties:a,children:n};return bp(s,r),s}(t,r);case"root":let u;return bp(u={type:"root",children:bh(t,(i=r).children)},i),u;case"text":let c;return bp(c={type:"text",value:"string"==typeof(n=r).value?n.value:""},n),c}}function bh(t,r){let i=[];if(Array.isArray(r)){let n=-1;for(;++n<r.length;){let a=bc(t,r[n]);a&&(Array.isArray(a)?i.push(...a):i.push(a))}}return i}function bf(t,r,i,n){return r?Array.isArray(n)?function(t,r,i,n){let a=-1,o=[];for(;++a<n.length;){let s=bd(t,r,i,n[a]);("number"==typeof s||"string"==typeof s)&&o.push(s)}return o}(t,r,i,n):bd(t,r,i,n):void 0}function bd(t,r,i,n){if(("boolean"==typeof n||"number"==typeof n||"string"==typeof n)&&function(t,r,i){let n=t.schema.protocols&&bu.call(t.schema.protocols,r)?t.schema.protocols[r]:void 0;
56if(!n||0===n.length)return!0;let a=String(i),o=a.indexOf(":"),s=a.indexOf("?"),l=a.indexOf("#"),u=a.indexOf("/");if(o<0||u>-1&&o>u||s>-1&&o>s||l>-1&&o>l)return!0;let c=-1;for(;++c<n.length;){let t=n[c];if(o===t.length&&a.slice(0,t.length)===t)return!0}return!1}(t,i,n)){if("object"==typeof r&&r.length>1){let t=!1,i=0;for(;++i<r.length;){let a=r[i];if(a&&"object"==typeof a&&"flags"in a){if(a.test(String(n))){t=!0;break}}else if(a===n){t=!0;break}}if(!t)return}return t.schema.clobber&&t.schema.clobberPrefix&&t.schema.clobber.includes(i)?t.schema.clobberPrefix+n:n}}function bp(t,r){let i=mA(r);r.data&&(t.data=ys(r.data)),i&&(t.position=i)}function bm(t,r){let i,n=-1;if(t)for(;++n<t.length;){let a=t[n],o="string"==typeof a?a:a[0];if(o===r)return a;"data*"===o&&(i=a)}if(r.length>4&&"data"===r.slice(0,4).toLowerCase())return i}function bg(t){return function(r){let i,n;return i={type:"root",children:[]},(n=bc({schema:t?{...bl,...t}:bl,stack:[]},r))&&(Array.isArray(n)?1===n.length?i=n[0]:i.children=n:i=n),i}}var by=Symbol.for("immer-nothing"),bv=Symbol.for("immer-draftable"),b_=Symbol.for("immer-state");function bb(t){throw Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var bx=Object,bw=bx.getPrototypeOf,bE="constructor",bT="prototype",bA="configurable",bS="enumerable",bC="writable",bM="value",bD=t=>!!t&&!!t[b_];function bP(t){return!!t&&(bO(t)||bz(t)||!!t[bv]||!!t[bE]?.[bv]||bj(t)||bU(t))}var bI=bx[bT][bE].toString(),bk=new WeakMap;function bO(t){if(!t||!bV(t))return!1;let r=bw(t);if(null===r||r===bx[bT])return!0;let i=bx.hasOwnProperty.call(r,bE)&&r[bE];if(i===Object)return!0;if(!b$(i))return!1;let n=bk.get(i);return void 0===n&&(n=Function.toString.call(i),bk.set(i,n)),n===bI}function bN(t,r,i=!0){0===bL(t)?(i?Reflect.ownKeys(t):bx.keys(t)).forEach(i=>{r(i,t[i],t)}):t.forEach((i,n)=>r(n,i,t))}function bL(t){let r=t[b_];return r?r.type_:bz(t)?1:bj(t)?2:3*!!bU(t)}var bR=(t,r,i=bL(t))=>2===i?t.has(r):bx[bT].hasOwnProperty.call(t,r),bF=(t,r,i=bL(t))=>2===i?t.get(r):t[r],bB=(t,r,i,n=bL(t))=>{2===n?t.set(r,i):3===n?t.add(i):t[r]=i},bz=Array.isArray,bj=t=>t instanceof Map,bU=t=>t instanceof Set,bV=t=>"object"==typeof t,b$=t=>"function"==typeof t,bG=t=>t.modified_?t.copy_:t.base_;function bq(t,r){if(bj(t))return new Map(t);if(bU(t))return new Set(t);if(bz(t))return Array[bT].slice.call(t);let i=bO(t);if(!0!==r&&("class_only"!==r||i)){let r=bw(t);if(null!==r&&i)return{...t};let n=bx.create(r);return bx.assign(n,t)}{let r=bx.getOwnPropertyDescriptors(t);delete r[b_];let i=Reflect.ownKeys(r);for(let n=0;n<i.length;n++){let a=i[n],o=r[a];!1===o[bC]&&(o[bC]=!0,o[bA]=!0),(o.get||o.set)&&(r[a]={[bA]:!0,[bC]:!0,[bS]:o[bS],[bM]:t[a]})}return bx.create(bw(t),r)}}function bH(t,r=!1){return bZ(t)||bD(t)||!bP(t)||(bL(t)>1&&bx.defineProperties(t,{set:bW,add:bW,clear:bW,delete:bW}),bx.freeze(t),r&&bN(t,(t,r)=>{bH(r,!0)},!1)),t}var bW={[bM]:function(){bb(2)}};function bZ(t){return!(null!==t&&bV(t))||bx.isFrozen(t)}var bY="MapSet",bX="Patches",bK="ArrayMethods",bQ={};function bJ(t){let r=bQ[t];return r||bb(0),r}var b0=t=>!!bQ[t];function b1(t,r){r&&(t.patchPlugin_=bJ(bX),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function b2(t){b3(t),t.drafts_.forEach(b6),t.drafts_=null}function b3(t){t===G&&(G=t.parent_)}var b4=t=>G={drafts_:[],parent_:G,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:b0(bY)?bJ(bY):void 0,arrayMethodsPlugin_:b0(bK)?bJ(bK):void 0};function b6(t){let r=t[b_];0===r.type_||1===r.type_?r.revoke_():r.revoked_=!0}function b5(t,r){r.unfinalizedDrafts_=r.drafts_.length;let i=r.drafts_[0];if(void 0!==t&&t!==i){i[b_].modified_&&(b2(r),bb(4)),bP(t)&&(t=b8(r,t));let{patchPlugin_:n}=r;n&&n.generateReplacementPatches_(i[b_].base_,t,r)}else t=b8(r,i);return function(t,r,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&bH(r,i)}(r,t,!0),b2(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==by?t:void 0}function b8(t,r){if(bZ(r))return r;let i=r[b_];if(!i)return xi(r,t.handledSet_,t);if(!b9(i,t))return r;if(!i.modified_)return i.base_;if(!i.finalized_){let{callbacks_:r}=i;if(r)for(;r.length>0;)r.pop()(t);xr(i,t)}return i.copy_}function b7(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var b9=(t,r)=>t.scope_===r,xe=[];function xt(t,r,i,n){let a=t.copy_||t.base_,o=t.type_;if(void 0!==n&&bF(a,n,o)===r)return void bB(a,n,i,o);if(!t.draftLocations_){let r=t.draftLocations_=new Map;bN(a,(t,i)=>{if(bD(i)){let n=r.get(i)||[];n.push(t),r.set(i,n)}})}for(let n of t.draftLocations_.get(r)??xe)bB(a,n,i,o)}function xr(t,r){if(t.modified_&&!t.finalized_&&(3===t.type_||1===t.type_&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){let{patchPlugin_:i}=r;if(i){let n=i.getPath(t);n&&i.generatePatches_(t,n,r)}b7(t)}}function xi(t,r,i){return!i.immer_.autoFreeze_&&i.unfinalizedDrafts_<1||bD(t)||r.has(t)||!bP(t)||bZ(t)||(r.add(t),bN(t,(n,a)=>
56{if(bD(a)){let r=a[b_];b9(r,i)&&(bB(t,n,bG(r),t.type_),b7(r))}else bP(a)&&xi(a,r,i)})),t}var xn={get(t,r){var i,n,a,o;let s;if(r===b_)return t;let l=t.scope_.arrayMethodsPlugin_,u=1===t.type_&&"string"==typeof r;if(u&&l?.isArrayOperationMethod(r))return l.createMethodInterceptor(t,r);let c=t.copy_||t.base_;if(!bR(c,r,t.type_)){let n;return i=t,(n=xs(c,r))?bM in n?n[bM]:n.get?.call(i.draft_):void 0}let h=c[r];if(t.finalized_||!bP(h)||u&&t.operationMethod&&l?.isMutatingArrayMethod(t.operationMethod)&&Number.isInteger(s=+r)&&String(s)===r)return h;if(h===xo(t.base_,r)||(n=t,a=r,o=h,!(1!==n.type_||!n.allIndicesReassigned_||n.assigned_?.get(a))&&bP(o)&&!o[b_]&&n.baseRefs_.has(o))){xu(t);let i=1===t.type_?+r:r,n=xh(t.scope_,h,t,i);return t.copy_[i]=n}return h},has:(t,r)=>r in(t.copy_||t.base_),ownKeys:t=>Reflect.ownKeys(t.copy_||t.base_),set(t,r,i){let n=xs(t.copy_||t.base_,r);if(n?.set)return n.set.call(t.draft_,i),!0;if(!t.modified_){let n=xo(t.copy_||t.base_,r),a=n?.[b_];if(a&&a.base_===i)return t.copy_[r]=i,t.assigned_.set(r,!1),!0;if((i===n?0!==i||1/i==1/n:i!=i&&n!=n)&&(void 0!==i||bR(t.base_,r,t.type_)))return!0;xu(t),xl(t)}return!!(t.copy_[r]===i&&(void 0!==i||bR(t.copy_,r,t.type_))||Number.isNaN(i)&&Number.isNaN(t.copy_[r]))||(t.copy_[r]=i,t.assigned_.set(r,!0),!function(t,r,i){let{scope_:n}=t;if(bD(i)){let a=i[b_];b9(a,n)&&a.callbacks_.push(function(){xu(t),xt(t,i,bG(a),r)})}else bP(i)&&t.callbacks_.push(function(){let a=t.copy_||t.base_;3===t.type_?a.has(i)&&xi(i,n.handledSet_,n):bF(a,r,t.type_)===i&&n.drafts_.length>1&&(t.assigned_.get(r)??!1)===!0&&t.copy_&&xi(bF(t.copy_,r,t.type_),n.handledSet_,n)})}(t,r,i),!0)},deleteProperty:(t,r)=>(xu(t),void 0!==xo(t.base_,r)||r in t.base_?(t.assigned_.set(r,!1),xl(t)):t.assigned_.delete(r),t.copy_&&delete t.copy_[r],!0),getOwnPropertyDescriptor(t,r){let i=t.copy_||t.base_,n=Reflect.getOwnPropertyDescriptor(i,r);return n?{[bC]:!0,[bA]:1!==t.type_||"length"!==r,[bS]:n[bS],[bM]:i[r]}:n},defineProperty(){bb(11)},getPrototypeOf:t=>bw(t.base_),setPrototypeOf(){bb(12)}},xa={};for(let t in xn){let r=xn[t];xa[t]=function(){let t=arguments;return t[0]=t[0][0],r.apply(this,t)}}function xo(t,r){let i=t[b_];return(i?i.copy_||i.base_:t)[r]}function xs(t,r){if(!(r in t))return;let i=bw(t);for(;i;){let t=Object.getOwnPropertyDescriptor(i,r);if(t)return t;i=bw(i)}}function xl(t){!t.modified_&&(t.modified_=!0,t.parent_&&xl(t.parent_))}function xu(t){t.copy_||(t.assigned_=new Map,t.copy_=bq(t.base_,t.scope_.immer_.useStrictShallowCopy_))}xa.deleteProperty=function(t,r){return xa.set.call(this,t,r,void 0)},xa.set=function(t,r,i){return xn.set.call(this,t[0],r,i,t[0])};var xc=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,i)=>{let n;if(b$(t)&&!b$(r)){let i=r;r=t;let n=this;return function(t=i,...a){return n.produce(t,t=>r.call(this,t,...a))}}if(b$(r)||bb(6),void 0===i||b$(i)||bb(7),bP(t)){let a=b4(this),o=xh(a,t,void 0),s=!0;try{n=r(o),s=!1}finally{s?b2(a):b3(a)}return b1(a,i),b5(n,a)}if(t&&bV(t))bb(1);else{if(void 0===(n=r(t))&&(n=t),n===by&&(n=void 0),this.autoFreeze_&&bH(n,!0),i){let r=[],a=[];bJ(bX).generateReplacementPatches_(t,n,{patches_:r,inversePatches_:a}),i(r,a)}return n}},this.produceWithPatches=(t,r)=>{let i,n;return b$(t)?(r,...i)=>this.produceWithPatches(r,r=>t(r,...i)):[this.produce(t,r,(t,r)=>{i=t,n=r}),i,n]},(t=>"boolean"==typeof t)(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),(t=>"boolean"==typeof t)(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),(t=>"boolean"==typeof t)(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){bP(t)||bb(8),bD(t)&&(t=xf(t));let r=b4(this),i=xh(r,t,void 0);return i[b_].isManual_=!0,b3(r),i}finishDraft(t,r){let i=t&&t[b_];i&&i.isManual_||bb(9);let{scope_:n}=i;return b1(n,r),b5(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let i;for(i=r.length-1;i>=0;i--){let n=r[i];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}i>-1&&(r=r.slice(i+1));let n=bJ(bX).applyPatches_;return bD(t)?n(t,r):this.produce(t,t=>n(t,r))}};function xh(t,r,i,n){let[a,o]=bj(r)?bJ(bY).proxyMap_(r,i):bU(r)?bJ(bY).proxySet_(r,i):function(t,r){let i=bz(t),n={type_:+!!i,scope_:r?r.scope_:G,modified_:!1,finalized_:!1,assigned_:void 0,parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},a=n,o=xn;i&&(a=[n],o=xa);let{revoke:s,proxy:l}=Proxy.revocable(a,o);return n.draft_=l,n.revoke_=s,[l,n]}(r,i);if((i?.scope_??G).drafts_.push(a),o.callbacks_=i?.callbacks_??[],o.key_=n,i&&void 0!==n)i.callbacks_.push(function(t){if(!o||!b9(o,t))return;t.mapSetPlugin_?.fixSetContents(o);let r=bG(o);xt(i,o.draft_??o,r,n),xr(o,t)}
56);else o.callbacks_.push(function(t){t.mapSetPlugin_?.fixSetContents(o);let{patchPlugin_:r}=t;o.modified_&&r&&r.generatePatches_(o,[],t)});return a}function xf(t){return bD(t)||bb(10),function t(r){let i;if(!bP(r)||bZ(r))return r;let n=r[b_],a=!0;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,i=bq(r,n.scope_.immer_.useStrictShallowCopy_),a=n.scope_.immer_.shouldUseStrictIteration()}else i=bq(r,!0);return bN(i,(r,n)=>{bB(i,r,t(n))},a),n&&(n.finalized_=!1),i}(t)}var xd=globalThis.Iterator;xd?.from;var xp=new xc().produce,xm=t=>Array.isArray(t)?t:[t],xg=0,xy=class{revision=xg;_value;_lastValue;_isEqual=xv;constructor(t,r=xv){this._value=this._lastValue=t,this._isEqual=r}get value(){return this._value}set value(t){this.value!==t&&(this._value=t,this.revision=++xg)}};function xv(t,r){return t===r}function x_(t){return t instanceof xy||console.warn("Not a valid cell! ",t),t.value}var xb=(t,r)=>!1;function xx(){return function(t=xv){return new xy(null,t)}(xb)}var xw=t=>{let r=t.collectionTag;null===r&&(r=t.collectionTag=xx()),x_(r)},xE=0,xT=Object.getPrototypeOf({}),xA=class{constructor(t){this.value=t,this.value=t,this.tag.value=t}proxy=new Proxy(this,xS);tag=xx();tags={};children={};collectionTag=null;id=xE++},xS={get:(t,r)=>(function(){let{value:i}=t,n=Reflect.get(i,r);if("symbol"==typeof r||r in xT)return n;if("object"==typeof n&&null!==n){var a;let i=t.children[r];return void 0===i&&(i=t.children[r]=Array.isArray(a=n)?new xC(a):new xA(a)),i.tag&&x_(i.tag),i.proxy}{let i=t.tags[r];return void 0===i&&((i=t.tags[r]=xx()).value=n),x_(i),n}})(),ownKeys:t=>(xw(t),Reflect.ownKeys(t.value)),getOwnPropertyDescriptor:(t,r)=>Reflect.getOwnPropertyDescriptor(t.value,r),has:(t,r)=>Reflect.has(t.value,r)},xC=class{constructor(t){this.value=t,this.value=t,this.tag.value=t}proxy=new Proxy([this],xM);tag=xx();tags={};children={};collectionTag=null;id=xE++},xM={get:([t],r)=>("length"===r&&xw(t),xS.get(t,r)),ownKeys:([t])=>xS.ownKeys(t),getOwnPropertyDescriptor:([t],r)=>xS.getOwnPropertyDescriptor(t,r),has:([t],r)=>xS.has(t,r)},xD="u"<typeof WeakRef?class{constructor(t){this.value=t}deref(){return this.value}}:WeakRef;function xP(){return{s:0,v:void 0,o:null,p:null}}function xI(t,r={}){let i,n=xP(),{resultEqualityCheck:a}=r,o=0;function s(){let r,s=n,{length:l}=arguments;for(let t=0;t<l;t++){let r=arguments[t];if("function"==typeof r||"object"==typeof r&&null!==r){let t=s.o;null===t&&(s.o=t=new WeakMap);let i=t.get(r);void 0===i?(s=xP(),t.set(r,s)):s=i}else{let t=s.p;null===t&&(s.p=t=new Map);let i=t.get(r);void 0===i?(s=xP(),t.set(r,s)):s=i}}let u=s;if(1===s.s)r=s.v;else if(r=t.apply(null,arguments),o++,a){var c;let t=(c=i)instanceof xD?c.deref():c;null!=t&&a(t,r)&&(r=t,0!==o&&o--),i="object"==typeof r&&null!==r||"function"==typeof r?new xD(r):r}return u.s=1,u.v=r,r}return s.clearCache=()=>{n=xP(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}var xk=function(t,...r){let i="function"==typeof t?{memoize:t,memoizeOptions:r}:t,n=(...t)=>{let r,n,a=0,o=0,s={},l=t.pop();"object"==typeof l&&(s=l,l=t.pop()),function(t,r=`expected a function, instead received ${typeof t}`){if("function"!=typeof t)throw TypeError(r)}(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);let{memoize:u,memoizeOptions:c=[],argsMemoize:h=xI,argsMemoizeOptions:f=[]}={...i,...s},d=xm(c),p=xm(f),m=(!function(t,r="expected all items to be functions, instead received the following types: "){if(!t.every(t=>"function"==typeof t)){let i=t.map(t=>"function"==typeof t?`function ${t.name||"unnamed"}()`:typeof t).join(", ");throw TypeError(`${r}[${i}]`)}}(r=Array.isArray(t[0])?t[0]:t,"createSelector expects all input-selectors to be functions, but received the following types: "),r),g=u(function(){return a++,l.apply(null,arguments)},...d);return Object.assign(h(function(){o++;let t=function(t,r){let i=[],{length:n}=t;for(let a=0;a<n;a++)i.push(t[a].apply(null,r));return i}(m,arguments);return n=g.apply(null,t)},...p),{resultFunc:l,memoizedResultFunc:g,dependencies:m,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>n,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:u,argsMemoize:h})};return Object.assign(n,{withTypes:()=>n}),n}(xI),xO=Object.assign((t,r=xk)=>{!function(t,r=`expected an object, instead received ${typeof t}`){if("object"!=typeof t)throw TypeError(r)}(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);let i=Object.keys(t);return r(i.map(r=>t[r]),(...t)=>t.reduce((t,r,n)=>(t[i[n]]=r,t),{}))},{withTypes:()=>xO});function xN(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var xL="function"==typeof Symbol&&Symbol.observable||"@@observable",xR=()=>Math.random().toString(36).substring(7).split("").join("."),xF={INIT:`@@redux/INIT${xR()}`,REPLACE:`@@redux/REPLACE${xR()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${xR()}`};function xB(t){if("object"!=typeof t||null===t)return!1;let r=t;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(t)===r||null===Object.getPrototypeOf(t)}function xz(t){let r,i=Object.keys(t),n={};for(let r=0;r<i.length;r++){let a=i[r];"function"==typeof t[a]&&(n[a]=t[a])}let a=Object.keys(n);
56try{Object.keys(n).forEach(t=>{let r=n[t];if(void 0===r(void 0,{type:xF.INIT}))throw Error(xN(12));if(void 0===r(void 0,{type:xF.PROBE_UNKNOWN_ACTION()}))throw Error(xN(13))})}catch(t){r=t}return function(t={},i){if(r)throw r;let o=!1,s={};for(let r=0;r<a.length;r++){let l=a[r],u=n[l],c=t[l],h=u(c,i);if(void 0===h)throw i&&i.type,Error(xN(14));s[l]=h,o=o||h!==c}return(o=o||a.length!==Object.keys(t).length)?s:t}}function xj(...t){return 0===t.length?t=>t:1===t.length?t[0]:t.reduce((t,r)=>(...i)=>t(r(...i)))}function xU(t){return xB(t)&&"type"in t&&"string"==typeof t.type}function xV(t){return({dispatch:r,getState:i})=>n=>a=>"function"==typeof a?a(r,i,t):n(a)}var x$=xV(),xG="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?xj:xj.apply(null,arguments)};function xq(t,r){function i(...n){if(r){let i=r(...n);if(!i)throw Error(wT(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:n[0]}}return i.toString=()=>`${t}`,i.type=t,i.match=r=>xU(r)&&r.type===t,i}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var xH=class t extends Array{constructor(...r){super(...r),Object.setPrototypeOf(this,t.prototype)}static get[Symbol.species](){return t}concat(...t){return super.concat.apply(this,t)}prepend(...r){return 1===r.length&&Array.isArray(r[0])?new t(...r[0].concat(this)):new t(...r.concat(this))}};function xW(t){return bP(t)?xp(t,()=>{}):t}function xZ(t,r,i){return t.has(r)?t.get(r):t.set(r,i(r)).get(r)}var xY="RTK_autoBatch",xX=()=>t=>({payload:t,meta:{[xY]:!0}}),xK=t=>r=>{setTimeout(r,t)},xQ=(t={type:"raf"})=>r=>(...i)=>{let n,a=r(...i),o=!0,s=!1,l=!1,u=new Set,c="tick"===t.type?queueMicrotask:"raf"===t.type?"u">typeof window&&window.requestAnimationFrame?(n=window.requestAnimationFrame,t=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),t())},a=n(i),o=setTimeout(i,100)}):xK(10):"callback"===t.type?t.queueNotification:xK(t.timeout),h=()=>{l=!1,s&&(s=!1,u.forEach(t=>t()))};return Object.assign({},a,{subscribe(t){let r=a.subscribe(()=>o&&t());return u.add(t),()=>{r(),u.delete(t)}},dispatch(t){try{return(s=!(o=!t?.meta?.[xY]))&&!l&&(l=!0,c(h)),a.dispatch(t)}finally{o=!0}}})};function xJ(t){let r,i={},n=[],a={addCase(t,r){let n="string"==typeof t?t:t.type;if(!n)throw Error(wT(28));if(n in i)throw Error(wT(29));return i[n]=r,a},addAsyncThunk:(t,r)=>(r.pending&&(i[t.pending.type]=r.pending),r.rejected&&(i[t.rejected.type]=r.rejected),r.fulfilled&&(i[t.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:t.settled,reducer:r.settled}),a),addMatcher:(t,r)=>(n.push({matcher:t,reducer:r}),a),addDefaultCase:t=>(r=t,a)};return t(a),[i,n,r]}var x0=Symbol.for("rtk-slice-createasyncthunk"),x1=((A=x1||{}).reducer="reducer",A.reducerWithPrepare="reducerWithPrepare",A.asyncThunk="asyncThunk",A),x2=function({creators:t}={}){let r=t?.asyncThunk?.[x0];return function(t){let i,{name:n,reducerPath:a=n}=t;if(!n)throw Error(wT(11));let o=("function"==typeof t.reducers?t.reducers(function(){function t(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return t.withTypes=()=>t,{reducer:t=>Object.assign({[t.name]:(...r)=>t(...r)}[t.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(t,r)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}),asyncThunk:t}}()):t.reducers)||{},s=Object.keys(o),l={},u={},c={},h=[],f={addCase(t,r){let i="string"==typeof t?t:t.type;if(!i)throw Error(wT(12));if(i in u)throw Error(wT(13));return u[i]=r,f},addMatcher:(t,r)=>(h.push({matcher:t,reducer:r}),f),exposeAction:(t,r)=>(c[t]=r,f),exposeCaseReducer:(t,r)=>(l[t]=r,f)};function d(){let[r={},i=[],n]="function"==typeof t.extraReducers?xJ(t.extraReducers):[t.extraReducers],a={...r,...u};return function(t,r){let i,[n,a,o]=xJ(r);if("function"==typeof t)i=()=>xW(t());else{let r=xW(t);i=()=>r}function s(t=i(),r){let l=[n[r.type],...a.filter(({matcher:t})=>t(r)).map(({reducer:t})=>t)];return 0===l.filter(t=>!!t).length&&(l=[o]),l.reduce((t,i)=>{if(i)if(bD(t)){let n=i(t,r);return void 0===n?t:n}else{if(bP(t))return xp(t,t=>i(t,r));let n=i(t,r);if(void 0===n){if(null===t)return t;throw Error("A case reducer on a non-draftable value must not return undefined")}return n}return t},t)}return s.getInitialState=i,s}(t.initialState,t=>{for(let r in a)t.addCase(r,a[r]);for(let r of h)t.addMatcher(r.matcher,r.reducer);for(let r of i)t.addMatcher(r.matcher,r.reducer);n&&t.addDefaultCase(n)})}s.forEach(i=>
56{let a=o[i],s={reducerName:i,type:`${n}/${i}`,createNotation:"function"==typeof t.reducers};"asyncThunk"===a._reducerDefinitionType?function({type:t,reducerName:r},i,n,a){if(!a)throw Error(wT(18));let{payloadCreator:o,fulfilled:s,pending:l,rejected:u,settled:c,options:h}=i,f=a(t,o,h);n.exposeAction(r,f),s&&n.addCase(f.fulfilled,s),l&&n.addCase(f.pending,l),u&&n.addCase(f.rejected,u),c&&n.addMatcher(f.settled,c),n.exposeCaseReducer(r,{fulfilled:s||x3,pending:l||x3,rejected:u||x3,settled:c||x3})}(s,a,f,r):function({type:t,reducerName:r,createNotation:i},n,a){let o,s;if("reducer"in n){if(i&&"reducerWithPrepare"!==n._reducerDefinitionType)throw Error(wT(17));o=n.reducer,s=n.prepare}else o=n;a.addCase(t,o).exposeCaseReducer(r,o).exposeAction(r,s?xq(t,s):xq(t))}(s,a,f)});let p=t=>t,m=new Map,g=new WeakMap;function y(t,r){return i||(i=d()),i(t,r)}function v(){return i||(i=d()),i.getInitialState()}function _(r,i=!1){function n(t){let a=t[r];return void 0===a&&i&&(a=xZ(g,n,v)),a}function a(r=p){let n=xZ(m,i,()=>new WeakMap);return xZ(n,r,()=>{let n={};for(let[a,o]of Object.entries(t.selectors??{}))n[a]=function(t,r,i,n){function a(o,...s){let l=r(o);return void 0===l&&n&&(l=i()),t(l,...s)}return a.unwrapped=t,a}(o,r,()=>xZ(g,r,v),i);return n})}return{reducerPath:r,getSelectors:a,get selectors(){return a(n)},selectSlice:n}}let b={name:n,reducer:y,actions:c,caseReducers:l,getInitialState:v,..._(a),injectInto(t,{reducerPath:r,...i}={}){let n=r??a;return t.inject({reducerPath:n,reducer:y},i),{...b,..._(n,!0)}}};return b}}();function x3(){}var x4="listener",x6="completed",x5="cancelled",x8=`task-${x5}`,x7=`task-${x6}`,x9=`${x4}-${x5}`,we=`${x4}-${x6}`,wt=class{constructor(t){this.code=t,this.message=`task ${x5} (reason: ${t})`}code;name="TaskAbortError";message},wr=(t,r)=>{if("function"!=typeof t)throw TypeError(wT(32))},wi=()=>{},wn=(t,r=wi)=>(t.catch(r),t),wa=(t,r)=>(t.addEventListener("abort",r,{once:!0}),()=>t.removeEventListener("abort",r)),wo=t=>{if(t.aborted)throw new wt(t.reason)};function ws(t,r){let i=wi;return new Promise((n,a)=>{let o=()=>a(new wt(t.reason));t.aborted?o():(i=wa(t,o),r.finally(()=>i()).then(n,a))}).finally(()=>{i=wi})}var wl=async(t,r)=>{try{await Promise.resolve();let r=await t();return{status:"ok",value:r}}catch(t){return{status:t instanceof wt?"cancelled":"rejected",error:t}}finally{r?.()}},wu=t=>r=>wn(ws(t,r).then(r=>(wo(t),r))),wc=t=>{let r=wu(t);return t=>r(new Promise(r=>setTimeout(r,t)))},{assign:wh}=Object,wf={},wd="listenerMiddleware",wp=t=>{let{type:r,actionCreator:i,matcher:n,predicate:a,effect:o}=t;if(r)a=xq(r).match;else if(i)r=i.type,a=i.match;else if(n)a=n;else if(a);else throw Error(wT(21));return wr(o,"options.listener"),{predicate:a,type:r,effect:o}},wm=wh(t=>{let{type:r,predicate:i,effect:n}=wp(t);return{id:((t=21)=>{let r="",i=t;for(;i--;)r+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return r})(),effect:n,type:r,predicate:i,pending:new Set,unsubscribe:()=>{throw Error(wT(22))}}},{withTypes:()=>wm}),wg=(t,r)=>{let{type:i,effect:n,predicate:a}=wp(r);return Array.from(t.values()).find(t=>("string"==typeof i?t.type===i:t.predicate===a)&&t.effect===n)},wy=t=>{t.pending.forEach(t=>{t.abort(x9)})},wv=(t,r,i)=>{try{t(r,i)}catch(t){setTimeout(()=>{throw t},0)}},w_=wh(xq(`${wd}/add`),{withTypes:()=>w_}),wb=xq(`${wd}/removeAll`),wx=wh(xq(`${wd}/remove`),{withTypes:()=>wx}),ww=(...t)=>{console.error(`${wd}/error`,...t)},wE=(t={})=>{let r=new Map,i=new Map,{extra:n,onError:a=ww}=t;wr(a,"onError");let o=t=>{var i;return(i=wg(r,t)??wm(t)).unsubscribe=()=>r.delete(i.id),r.set(i.id,i),t=>{i.unsubscribe(),t?.cancelActive&&wy(i)}};wh(o,{withTypes:()=>o});let s=t=>{let i=wg(r,t);return i&&(i.unsubscribe(),t.cancelActive&&wy(i)),!!i};wh(s,{withTypes:()=>s});let l=async(t,s,l,u)=>{var c,h;let f,d=new AbortController,p=(c=d.signal,f=async(t,r)=>{wo(c);let i=()=>{},n=[new Promise((r,n)=>{let a=o({predicate:t,effect:(t,i)=>{i.unsubscribe(),r([t,i.getState(),i.getOriginalState()])}});i=()=>{a(),n()}})];null!=r&&n.push(new Promise(t=>setTimeout(t,r,null)));try{let t=await ws(c,Promise.race(n));return wo(c),t}finally{i()}},(t,r)=>wn(f(t,r))),m=[];try{let a;t.pending.add(d),a=i.get(t)??0,i.set(t,a+1),await Promise.resolve(t.effect(s,wh({},l,{getOriginalState:u,condition:(t,r)=>p(t,r).then(Boolean),take:p,delay:wc(d.signal),pause:wu(d.signal),extra:n,signal:d.signal,fork:(h=d.signal,(t,r)=>{wr(t,"taskExecutor");let i=new AbortController;wa(h,()=>i.abort(h.reason));let n=wl(async()=>{wo(h),wo(i.signal);let r=await t({pause:wu(i.signal),delay:wc(i.signal),signal:i.signal});return wo(i.signal),r},()=>i.abort(x7));return r?.autoJoin&&m.push(n.catch(wi)),{result:wu(h)(n),cancel(){i.abort(x8)}}}),unsubscribe:t.unsubscribe,subscribe:()=>
56{r.set(t.id,t)},cancelActiveListeners:()=>{t.pending.forEach((t,r,i)=>{t!==d&&(t.abort(x9),i.delete(t))})},cancel:()=>{d.abort(x9),t.pending.delete(d)},throwIfCancelled:()=>{wo(d.signal)}})))}catch(t){t instanceof wt||wv(a,t,{raisedBy:"effect"})}finally{let r;await Promise.all(m),d.abort(we),1===(r=i.get(t)??1)?i.delete(t):i.set(t,r-1),t.pending.delete(d)}},u=()=>{for(let t of i.keys())wy(t);r.clear()};return{middleware:t=>i=>n=>{let c;if(!xU(n))return i(n);if(w_.match(n))return o(n.payload);if(wb.match(n))return void u();if(wx.match(n))return s(n.payload);let h=t.getState(),f=()=>{if(h===wf)throw Error(wT(23));return h};try{if(c=i(n),r.size>0){let i=t.getState();for(let o of Array.from(r.values())){let r=!1;try{r=o.predicate(n,i,h)}catch(t){r=!1,wv(a,t,{raisedBy:"predicate"})}r&&l(o,n,t,f)}}}finally{h=wf}return c},startListening:o,stopListening:s,clearListeners:u}};function wT(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}function wA(t){return"__proto__"===t}let wS=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function wC(t){switch(typeof t){case"number":case"symbol":default:return!1;case"string":if(""===t||t.startsWith(".")||t.endsWith("."))return!1;return wS.test(t)}}function wM(t){return"string"==typeof t||"symbol"==typeof t?t:Object.is(t?.valueOf?.(),-0)?"-0":String(t)}function wD(t){return"symbol"==typeof t||t instanceof Symbol}function wP(t){var r;if(Array.isArray(t))return t.map(wM);if("symbol"==typeof t)return[t];t=null==(r=t)?"":function t(r){if("string"==typeof r)return r;if(Array.isArray(r))return r.map(t).join(",");if(wD(r))return r.toString();let i=r+"";return"0"===i&&Object.is(Number(r),-0)?"-0":i}(r);let i=[],n=t.length;if(0===n)return i;let a=0,o="",s="",l=!1,u=!1,c=/^-?\d+(?:\.\d+)?$/;for(46===t.charCodeAt(0)&&i.push("");a<n;){let r=t[a];if(s)"\\"===r&&a+1<n?o+=t[++a]:r===s?s="":o+=r;else if(l)if('"'===r||"'"===r)s=r,u=!0;else if("]"===r){if(l=!1,!u&&o.includes(".")&&!c.test(o)){let t=o.split(".");for(let r=0;r<t.length;r++)""!==t[r]&&i.push(t[r])}else i.push(o);o=""}else o+=r;else if("["===r)l=!0,u=!1,o&&(i.push(o),o="");else if("."===r){o&&(i.push(o),o="");let r=t[a+1];(void 0===r||"."===r)&&i.push("")}else o+=r;a++}return o&&i.push(o),i}function wI(t,r,i){if(null==t)return i;switch(typeof r){case"string":{if(wA(r))return i;let n=t[r];if(void 0===n)if(wC(r)&&!Object.hasOwn(t,r))return wI(t,wP(r),i);else return i;return n}case"number":case"symbol":{"number"==typeof r&&(r=wM(r));let n=t[r];if(void 0===n)return i;return n}default:{if(Array.isArray(r)){var n=t,a=r,o=i;if(0===a.length)return o;let s=n;for(let t=0;t<a.length;t++){if(null==s||wA(a[t]))return o;s=s[a[t]]}return void 0===s?o:s}if(wA(r=Object.is(r?.valueOf(),-0)?"-0":String(r)))return i;let s=t[r];if(void 0===s)return i;return s}}}function wk(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,i=10**r,n=Math.round(t*i)/i;return Object.is(n,-0)?0:n}function wO(t){for(var r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return t.reduce((t,r,n)=>{var a=i[n-1];return"string"==typeof a?t+a+r:void 0!==a?t+wk(a)+r:t+r},"")}var wN=t=>0===t?0:t>0?1:-1,wL=t=>"number"==typeof t&&t!=+t,wR=t=>"string"==typeof t&&t.length>1&&t.indexOf("%")===t.length-1,wF=t=>("number"==typeof t||t instanceof Number)&&!wL(t),wB=t=>wF(t)||"string"==typeof t,wz=0,wj=t=>{var r=++wz;return"".concat(t||"").concat(r)},wU=function(t,r){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!wF(t)&&"string"!=typeof t)return n;if(wR(t)){if(null==r)return n;var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return wL(i)&&(i=n),a&&null!=r&&i>r&&(i=r),i},wV=t=>{if(!Array.isArray(t))return!1;for(var r=t.length,i={},n=0;n<r;n++)if(i[String(t[n])])return!0;else i[String(t[n])]=!0;return!1};function w$(t,r,i){return wF(t)&&wF(r)?wk(t+i*(r-t)):r}var wG=t=>null==t?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function wq(t){return null!=t}function wH(){}var wW=(t,r)=>{if(r&&Array.isArray(t)){var i=Number.parseInt(r,10);if(!wL(i))return t[i]}}
56,wZ=x2({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:t=>{null==t.eventEmitter&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),wY=wZ.reducer,wX=wZ.actions.createEventEmitter,wK=(t.i(313027),{notify(){},get:()=>[]}),wQ="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,wJ="u">typeof navigator&&"ReactNative"===navigator.product,w0=wQ||wJ?ec.useLayoutEffect:ec.useEffect;function w1(t,r){return t===r?0!==t||0!==r||1/t==1/r:t!=t&&r!=r}var w2=Symbol.for("react-redux-context"),w3="u">typeof globalThis?globalThis:{},w4=function(){if(!ec.createContext)return{};let t=w3[w2]??=new Map,r=t.get(ec.createContext);return r||(r=ec.createContext(null),t.set(ec.createContext,r)),r}(),w6=function(t){let{children:r,context:i,serverState:n,store:a}=t,o=ec.useMemo(()=>{let t=function(t){let r,i=wK,n=0,a=!1;function o(){u.onStateChange&&u.onStateChange()}function s(){if(n++,!r){let n,a;r=t.subscribe(o),n=null,a=null,i={clear(){n=null,a=null},notify(){let t=n;for(;t;)t.callback(),t=t.next},get(){let t=[],r=n;for(;r;)t.push(r),r=r.next;return t},subscribe(t){let r=!0,i=a={callback:t,next:null,prev:a};return i.prev?i.prev.next=i:n=i,function(){r&&null!==n&&(r=!1,i.next?i.next.prev=i.prev:a=i.prev,i.prev?i.prev.next=i.next:n=i.next)}}}}}function l(){n--,r&&0===n&&(r(),r=void 0,i.clear(),i=wK)}let u={addNestedSub:function(t){s();let r=i.subscribe(t),n=!1;return()=>{n||(n=!0,r(),l())}},notifyNestedSubs:function(){i.notify()},handleChangeWrapper:o,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,s())},tryUnsubscribe:function(){a&&(a=!1,l())},getListeners:()=>i};return u}(a);return{store:a,subscription:t,getServerState:n?()=>n:void 0}},[a,n]),s=ec.useMemo(()=>a.getState(),[a]);return w0(()=>{let{subscription:t}=o;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),s!==a.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}},[o,s]),ec.createElement((i||w4).Provider,{value:o},r)};function w5(t=w4){return function(){return ec.useContext(t)}}var w8=w5(),w7={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},w9=x2({name:"tooltip",initialState:{itemInteraction:{click:w7,hover:w7},axisInteraction:{click:w7,hover:w7},keyboardInteraction:w7,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(t,r){t.tooltipItemPayloads.push(r.payload)},prepare:xX()},replaceTooltipEntrySettings:{reducer(t,r){var i=r.payload,n=i.prev,a=i.next,o=xf(t).tooltipItemPayloads.indexOf(n);o>-1&&(t.tooltipItemPayloads[o]=a)},prepare:xX()},removeTooltipEntrySettings:{reducer(t,r){var i=xf(t).tooltipItemPayloads.indexOf(r.payload);i>-1&&t.tooltipItemPayloads.splice(i,1)},prepare:xX()},setTooltipSettingsState(t,r){t.settings=r.payload},setActiveMouseOverItemIndex(t,r){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=r.payload.activeIndex,t.itemInteraction.hover.dataKey=r.payload.activeDataKey,t.itemInteraction.hover.graphicalItemId=r.payload.activeGraphicalItemId,t.itemInteraction.hover.coordinate=r.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,r){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=r.payload.activeIndex,t.itemInteraction.click.dataKey=r.payload.activeDataKey,t.itemInteraction.click.graphicalItemId=r.payload.activeGraphicalItemId,t.itemInteraction.click.coordinate=r.payload.activeCoordinate},setMouseOverAxisIndex(t,r){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=r.payload.activeIndex,t.axisInteraction.hover.dataKey=r.payload.activeDataKey,t.axisInteraction.hover.coordinate=r.payload.activeCoordinate},setMouseClickAxisIndex(t,r){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=r.payload.activeIndex,t.axisInteraction.click.dataKey=r.payload.activeDataKey,t.axisInteraction.click.coordinate=r.payload.activeCoordinate},setSyncInteraction(t,r){t.syncInteraction=r.payload},setKeyboardInteraction(t,r){t.keyboardInteraction.active=r.payload.active,t.keyboardInteraction.index=r.payload.activeIndex,t.keyboardInteraction.coordinate=r.payload.activeCoordinate}}}),Ee=w9.actions,Et=Ee.addTooltipEntrySettings,Er=Ee.replaceTooltipEntrySettings,Ei=Ee.removeTooltipEntrySettings,En=Ee.setTooltipSettingsState,Ea=Ee.setActiveMouseOverItemIndex,Eo=Ee.mouseLeaveItem,Es=Ee.mouseLeaveChart,El=Ee.setActiveClickItemIndex,Eu=Ee.setMouseOverAxisIndex,Ec=Ee.setMouseClickAxisIndex,Eh=Ee.setSyncInteraction,Ef=Ee.setKeyboardInteraction,Ed=w9.reducer,Ep=x2({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(t,r){if(t.chartData=r.payload,null==r.payload){t.dataStartIndex=0,t.dataEndIndex=0;return}r.payload.length>0&&t.dataEndIndex!==r.payload.length-1&&(t.dataEndIndex=r.payload.length-1)},setComputedData(t,r){t.computedData=r.payload},setDataStartEndIndexes(t,r){var i=r.payload,n=i.startIndex,a=i.endIndex;null!=n&&(t.dataStartIndex=n),null!=a&&(t.dataEndIndex=a)}}}),Em=Ep.actions,Eg=Em.setChartData,Ey=Em.setDataStartEndIndexes;Em.setComputedData;var Ev=Ep.reducer,E_=x2({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(t,r){t.layoutType=r.payload},setChartSize(t,r){t.width=r.payload.width,t.height=r.payload.height},setMargin(t,r){var i,n,a,o;t.margin.top=null!=(i=r.payload.top)?i:0,t.margin.right=null!=(n=r.payload.right)?n:0,t.margin.bottom=null!=(a=r.payload.bottom)?a:0,t.margin.left
56=null!=(o=r.payload.left)?o:0},setScale(t,r){t.scale=r.payload}}}),Eb=E_.actions,Ex=Eb.setMargin,Ew=Eb.setLayout,EE=Eb.setChartSize,ET=Eb.setScale,EA=E_.reducer,ES=t.i(430224),EC=(0,ec.createContext)(null),EM=t=>t,ED=()=>{var t=(0,ec.useContext)(EC);return t?t.store.dispatch:EM},EP=()=>{},EI=()=>EP,Ek=(t,r)=>t===r;function EO(t){var r=(0,ec.useContext)(EC),i=(0,ec.useMemo)(()=>r?r=>{if(null!=r)return t(r)}:EP,[r,t]);return(0,ES.useSyncExternalStoreWithSelector)(r?r.subscription.addNestedSub:EI,r?r.store.getState:EP,r?r.store.getState:EP,i,Ek)}function EN(t,r){return t===r||Number.isNaN(t)&&Number.isNaN(r)}function EL(t){var r;return null!=t&&"function"!=typeof t&&Number.isSafeInteger(r=t.length)&&r>=0}function ER(t){return null!==t&&("object"==typeof t||"function"==typeof t)}let EF=/^(?:0|[1-9]\d*)$/;function EB(t,r=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<r;case"symbol":return!1;case"string":return EF.test(t)}}function Ez(t,r,i){return!!ER(i)&&(!!("number"==typeof r&&EL(i)&&EB(r))&&r<i.length||"string"==typeof r&&r in i)&&EN(i[r],t)}function Ej(t){return"symbol"==typeof t?1:null===t?2:void 0===t?3:4*(t!=t)}let EU=(t,r,i)=>{if(t!==r){let n=Ej(t),a=Ej(r);if(n===a&&0===n){if(t<r)return"desc"===i?1:-1;if(t>r)return"desc"===i?-1:1}return"desc"===i?a-n:n-a}return 0},EV=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,E$=/^\w*$/;function EG(t,...r){let i=r.length;return i>1&&Ez(t,r[0],r[1])?r=[]:i>2&&Ez(r[0],r[1],r[2])&&(r=[r[0]]),function(t,r,i){if(null==t)return[];Array.isArray(t)||(t=EL(t)?Array.from(t):Object.values(t)),Array.isArray(r)||(r=null==r?[null]:[r]),0===r.length&&(r=[null]),Array.isArray(i)||(i=null==i?[]:[i]),i=i.map(t=>String(t));let n=(t,r)=>{let i=t,n=0;for(;n<r.length&&null!=i;++n)i=i[r[n]];return n>0&&n===r.length?i:void 0},a=r.map(t=>{var r;return(Array.isArray(t)&&1===t.length&&(t=t[0]),null==t||"function"==typeof t||Array.isArray(t)||!Array.isArray(r=t)&&("number"==typeof r||"boolean"==typeof r||null==r||wD(r)||"string"==typeof r&&(E$.test(r)||!EV.test(r))||0))?t:{key:t,path:wP(t)}});return t.map(t=>({original:t,criteria:a.map(r=>((t,r)=>{if(null==t)return r;
56if(null!=r)return"object"==typeof t&&"key"in t?Object.hasOwn(r,t.key)?r[t.key]:n(r,t.path):"function"==typeof t?t(r):Array.isArray(t)?n(r,t):r[t]})(r,t))})).slice().sort((t,r)=>{for(let n=0;n<a.length;n++){let a=EU(t.criteria[n],r.criteria[n],i[n]);if(0!==a)return a}return 0}).map(t=>t.original)}(t,function(t,r=1){let i=[],n=Math.floor(r),a=(t,r)=>{for(let o=0;o<t.length;o++){let s=t[o];Array.isArray(s)&&r<n?a(s,r+1):i.push(s)}};return a(t,0),i}(r),["asc"])}var Eq=t=>t.legend.settings;function EH(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function EW(t,r){if((a=t.length)>1)for(var i,n,a,o=1,s=t[r[0]],l=s.length;o<a;++o)for(n=s,s=t[r[o]],i=0;i<l;++i)s[i][1]+=s[i][0]=isNaN(n[i][1])?n[i][0]:n[i][1]}function EZ(t){for(var r=t.length,i=Array(r);--r>=0;)i[r]=r;return i}function EY(t,r){return t[r]}function EX(t){let r=[];return r.key=t,r}function EK(t,r,i){return Array.isArray(t)&&t&&r+i!==0?t.slice(r,i+1):t}function EQ(t){return Number.isFinite(t)}function EJ(t){return"number"==typeof t&&t>0&&Number.isFinite(t)}function E0(t){if(t)return{x:t.x,y:t.y,upperWidth:"upperWidth"in t?t.upperWidth:t.width,lowerWidth:"lowerWidth"in t?t.lowerWidth:t.width,width:t.width,height:t.height}}function E1(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function E2(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?E1(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):E1(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}xk([t=>t.legend.payload,Eq],(t,r)=>{var i=r.itemSorter,n=t.flat(1);return i?EG(n,i):n}),Array.prototype.slice;var E3=["top","left","right","bottom"];function E4(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function E6(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?E4(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):E4(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function E5(t,r,i){return null==t||null==r?i:wB(r)?wI(t,r,i):"function"==typeof r?r(t):i}var E8=(t,r)=>"horizontal"===t&&"xAxis"===r||"vertical"===t&&"yAxis"===r||"centric"===t&&"angleAxis"===r||"radial"===t&&"radiusAxis"===r,E7=(t,r,i,n)=>{if(n)return t.map(t=>t.coordinate);var a,o,s=t.map(t=>(t.coordinate===r&&(a=!0),t.coordinate===i&&(o=!0),t.coordinate));return a||s.push(r),o||s.push(i),s},E9=(t,r,i)=>{if(!t)return null;var n=t.duplicateDomain,a=t.type,o=t.range,s=t.scale,l=t.realScaleType,u=t.isCategorical,c=t.categoricalDomain,h=t.tickCount,f=t.ticks,d=t.niceTicks,p=t.axisType;if(!s)return null;var m="scaleBand"===l&&s.bandwidth?s.bandwidth()/2:2,g=(r||i)&&"category"===a&&s.bandwidth?s.bandwidth()/m:0;return(g="angleAxis"===p&&o&&o.length>=2?2*wN(o[0]-o[1])*g:g,r&&(f||d))?(f||d||[]).map((t,r)=>{var i=n?n.indexOf(t):t,a=s.map(i);return EQ(a)?{coordinate:a+g,value:t,offset:g,index:r}:null}).filter(wq):u&&c?c.map((t,r)=>{var i=s.map(t);return EQ(i)?{coordinate:i+g,value:t,index:r,offset:g}:null}).filter(wq):s.ticks&&!i&&null!=h?s.ticks(h).map((t,r)=>{var i=s.map(t);return EQ(i)?{coordinate:i+g,value:t,index:r,offset:g}:null}).filter(wq):s.domain().map((t,r)=>{var i=s.map(t);return EQ(i)?{coordinate:i+g,value:n?n[t]:t,index:r,offset:g}:null}).filter(wq)},Te={sign:t=>{var r,i=t.length;if(!(i<=0)){var n=null==(r=t[0])?void 0:r.length;if(null!=n&&!(n<=0))for(var a=0;a<n;++a)for(var o=0,s=0,l=0;l<i;++l){var u=t[l],c=null==u?void 0:u[a];if(null!=c){var h=c[1],f=c[0],d=wL(h)?f:h;d>=0?(c[0]=o,o+=d,c[1]=o):(c[0]=s,s+=d,c[1]=s)}}}},expand:function(t,r){if((n=t.length)>0){for(var i,n,a,o=0,s=t[0].length;o<s;++o){for(a=i=0;i<n;++i)a+=t[i][o][1]||0;if(a)for(i=0;i<n;++i)t[i][o][1]/=a}EW(t,r)}},none:EW,silhouette:function(t,r){if((i=t.length)>0){for(var i,n=0,a=t[r[0]],o=a.length;n<o;++n){for(var s=0,l=0;s<i;++s)l+=t[s][n][1]||0;a[n][1]+=a[n][0]=-l/2}EW(t,r)}},wiggle:function(t,r){if((a=t.length)>0&&(n=(i=t[r[0]]).length)>0){for(var i,n,a,o=0,s=1;s<n;++s){for(var l=0,u=0,c=0;l<a;++l){for(var h=t[r[l]],f=h[s][1]||0,d=(f-(h[s-1][1]||0))/2,p=0;p<l;++p){var m=t[r[p]];d+=(m[s][1]||0)-(m[s-1][1]||0)}u+=f,c+=d*f}i[s-1][1]+=i[s-1][0]=o,u&&(o-=c/u)}i[s-1][1]+=i[s-1][0]=o,EW(t,r)}},positive:t=>{var r,i=t.length;if(!(i<=0)){var n=null==(r=t[0])?void 0:r.length;if(null!=n&&!(n<=0))for(var a=0;a<n;++a)for(var o=0,s=0;s<i;++s){var l=t[s],u=null==l?void 0:l[a];if(null!=u){var c=wL(u[1])?u[0]:u[1];c>=0?(u[0]=o,o+=c,u[1]=o):(u[0]=0,u[1]=0)}}}}},Tt=t=>{var r=t.axis,i=t.ticks,n=t.offset,a=t.bandSize,o=t.entry,s=t.index;if("category"===r.type)return i[s]?i[s].coordinate+n:null;var l=E5(o,r.dataKey,r.scale.domain()[s]);if(null==l)return null;var u=r.scale.map(l);return wF(u)?u-a/2+n:null},Tr=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ti=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Tn=(t,r,i)=>{if(t&&t.scale&&t.scale.bandwidth){var n=t.scale.bandwidth();if(!i||n>0)return n}if(t&&r&&r.length>=2){for(var a=EG(r,t=>t.coordinate),o=[],s=0,l=1,u=a.length;l<u;l++){var c,h,f=((null==(c=a[l])?void 0:c.coordinate)||0)-((null==(h=a[l-1])?void 0:h.coordinate)||0);o.push(f),s=Math.max(f,s)}var d=1e-4*s,p=1/0;for(var m of o)m>d&&(p=Math.min(m,p));return p===1/0?0:p}return i?void 0:0};function Ta(t){var r=t.tooltipEntrySettings,i=t.dataKey,n=t.payload,a=t.value,o=t.name;return E6(E6({},r),{},{dataKey:i,payload:n,value:a,name:o})}function To(t,r){return null!=t?String(t):"string"==typeof r?r:void 0}var Ts=t=>t.layout.width,Tl=t=>t.layout.height,Tu=t=>t.layout.scale,Tc=t=>t.layout.margin,Th=xk(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),Tf=xk(t=>t.cartesianAxis.yAxis,t=>Object.values(t));function Td(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Tp(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};
56r%2?Td(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Td(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}var Tm=xk([Ts,Tl,Tc,t=>t.brush.height,function(t){return Tf(t).reduce((t,r)=>"left"!==r.orientation||r.mirror||r.hide?t:t+("number"==typeof r.width?r.width:60),0)},function(t){return Tf(t).reduce((t,r)=>"right"!==r.orientation||r.mirror||r.hide?t:t+("number"==typeof r.width?r.width:60),0)},function(t){return Th(t).reduce((t,r)=>"top"!==r.orientation||r.mirror||r.hide?t:t+("number"==typeof r.height?r.height:30),0)},function(t){return Th(t).reduce((t,r)=>"bottom"!==r.orientation||r.mirror||r.hide?t:t+("number"==typeof r.height?r.height:30),0)},Eq,t=>t.legend.size],(t,r,i,n,a,o,s,l,u,c)=>{var h={left:(i.left||0)+a,right:(i.right||0)+o},f=Tp(Tp({},{top:(i.top||0)+s,bottom:(i.bottom||0)+l}),h),d=f.bottom;f.bottom+=n;var p=t-(f=((t,r,i)=>{if(r&&i){var n=i.width,a=i.height,o=r.align,s=r.verticalAlign,l=r.layout,u=r.position,c=r.offset,h=void 0===c?0:c;if(null!=u){if(null!=u&&("object"==typeof u||E3.includes(u))){if("top"===u&&wF(t.top))return E6(E6({},t),{},{top:t.top+(a||0)+h});if("bottom"===u&&wF(t.bottom))return E6(E6({},t),{},{bottom:t.bottom+(a||0)+h});if("left"===u&&wF(t.left))return E6(E6({},t),{},{left:t.left+(n||0)+h});if("right"===u&&wF(t.right))return E6(E6({},t),{},{right:t.right+(n||0)+h})}return t}if(("vertical"===l||"horizontal"===l&&"middle"===s)&&"center"!==o&&wF(t[o]))return E6(E6({},t),{},{[o]:t[o]+(n||0)});if(("horizontal"===l||"vertical"===l&&"center"===o)&&"middle"!==s&&wF(t[s]))return E6(E6({},t),{},{[s]:t[s]+(a||0)})}return t})(f,u,c)).left-f.right,m=r-f.top-f.bottom;return Tp(Tp({brushBottom:d},f),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Tg=xk(Tm,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),Ty=xk(Ts,Tl,(t,r)=>({x:0,y:0,width:t,height:r})),Tv=(0,ec.createContext)(null),T_=()=>null!=(0,ec.useContext)(Tv),Tb=t=>t.brush,Tx=xk([Tb,Tm,Tc],(t,r,i)=>({height:t.height,x:wF(t.x)?t.x:r.left,y:wF(t.y)?t.y:r.top+r.height+r.brushBottom-((null==i?void 0:i.bottom)||0),width:wF(t.width)?t.width:r.width})),Tw=t.i(207670),TE=function(t,r){for(var i=arguments.length,n=Array(i>2?i-2:0),a=2;a<i;a++)n[a-2]=arguments[a];if("u">typeof console&&console.warn&&(void 0===r&&console.warn("LogUtils requires an error message argument"),!t))if(void 0===r)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(r.replace(/%s/g,()=>n[o++]))}},TT="100%",TA="100%",TS={width:-1,height:-1},TC=(t,r,i)=>{var n=i.width,a=void 0===n?TT:n,o=i.height,s=void 0===o?TA:o,l=i.aspect,u=i.maxHeight,c=wR(a)?t:Number(a),h=wR(s)?r:Number(s);return l&&l>0&&(c?h=c/l:h&&(c=h*l),u&&null!=h&&h>u&&(h=u)),{calculatedWidth:c,calculatedHeight:h}},TM={width:0,height:0,overflow:"visible"},TD={width:0,overflowX:"visible"},TP={height:0,overflowY:"visible"},TI={},Tk=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function TO(){return(TO=Object.assign.bind()).apply(null,arguments)}function TN(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function TL(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?TN(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}
56(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):TN(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function TR(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var TF=(0,ec.createContext)(TS);function TB(t){var r=t.children,i=t.width,n=t.height,a=(0,ec.useMemo)(()=>({width:i,height:n}),[i,n]);return EJ(a.width)&&EJ(a.height)?ec.createElement(TF.Provider,{value:a},r):null}var Tz=()=>(0,ec.useContext)(TF),Tj=(0,ec.forwardRef)((t,r)=>{var i,n,a,o,s,l,u=t.aspect,c=t.initialDimension,h=void 0===c?TS:c,f=t.width,d=t.height,p=t.minWidth,m=void 0===p?0:p,g=t.minHeight,y=t.maxHeight,v=t.children,_=t.debounce,b=void 0===_?0:_,x=t.id,w=t.className,E=t.onResize,T=t.style,A=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,Tk),S=(0,ec.useRef)(null),C=(0,ec.useRef)();C.current=E,(0,ec.useImperativeHandle)(r,()=>S.current);var M=function(t){if(Array.isArray(t))return t}(i=(0,ec.useState)({containerWidth:h.width,containerHeight:h.height}))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(i)||function(t){if(t){if("string"==typeof t)return TR(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?TR(t,2):void 0}}(i)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),D=M[0],P=M[1],I=(0,ec.useCallback)((t,r)=>{P(i=>{var n=Math.round(t),a=Math.round(r);return i.containerWidth===n&&i.containerHeight===a?i:{containerWidth:n,containerHeight:a}})},[]);(0,ec.useEffect)(()=>{if(null==S.current||"u"<typeof ResizeObserver)return wH;var t=t=>{var r,i=t[0];if(null!=i){var n=i.contentRect,a=n.width,o=n.height;I(a,o),null==(r=C.current)||r.call(C,a,o)}};b>0&&(t=function(t,r=0,i={}){let{leading:n=!0,trailing:a=!0}=i;return function(t,r=0,i={}){let n;"object"!=typeof i&&(i={});let{leading:a=!1,trailing:o=!0,maxWait:s}=i,l=[,,];a&&(l[0]="leading"),o&&(l[1]="trailing");let u=null,c=function(t,r,{signal:i,edges:n}={}){let a,o=null,s=null!=n&&n.includes("leading"),l=null==n||n.includes("trailing"),u=()=>{null!==o&&(t.apply(a,o),a=void 0,o=null)},c=null,h=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,l&&u(),f()},r)},f=()=>{null!==c&&(clearTimeout(c),c=null),a=void 0,o=null},d=function(...t){if(i?.aborted)return;a=this,o=t;let r=null==c;h(),s&&r&&u()};return d.schedule=h,d.cancel=f,d.flush=()=>{u()},i?.addEventListener("abort",f,{once:!0}),d}(function(...r){n=t.apply(this,r),u=null},r,{edges:l}),h=function(...r){return null!=s&&(null===u&&(u=Date.now()),Date.now()-u>=s)?((a||o)&&(n=t.apply(this,r)),u=Date.now(),c.cancel(),c.schedule(),n):(c.apply(this,r),n)};return h.cancel=c.cancel,h.flush=()=>(c.flush(),n),h}(t,r,{leading:n,maxWait:r,trailing:a})}(t,b,{trailing:!0,leading:!1}));var r=new ResizeObserver(t),i=S.current.getBoundingClientRect();return I(i.width,i.height),r.observe(S.current),()=>{r.disconnect()}},[I,b]);var k=D.containerWidth,O=D.containerHeight;TE(!u||u>0,"The aspect(%s) must be greater than zero.",u);var N=TC(k,O,{width:f,height:d,aspect:u,maxHeight:y}),L=N.calculatedWidth,R=N.calculatedHeight;return TE(k<0||O<0||null!=L&&L>0||null!=R&&R>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",L,R,f,d,m,g,u),ec.createElement("div",TO({id:x?"".concat(x):void 0,className:(0,Tw.clsx)("recharts-responsive-container",w),style:TL(TL({},void 0===T?{}:T),{},{width:f,height:d,minWidth:m,minHeight:g,maxHeight:y}),ref:S},A),ec.createElement("div",{style:(a=(n={width:f,height:d}).width,o=n.height,s=wR(a),l=wR(o),s&&l?TM:s?TD:l?TP:TI)},ec.createElement(TB,{width:L,height:R},v)))}),TU=(0,ec.forwardRef)((t,r)=>{var i,n,a,o,s,l,u=Tz();if(EJ(u.width)&&EJ(u.height))return t.children;var c=(n=(i={width:t.width,height:t.height,aspect:t.aspect}
56).width,a=i.height,o=i.aspect,s=n,l=a,void 0===s&&void 0===l?(s=TT,l=TA):void 0===s?s=o&&o>0?void 0:TT:void 0===l&&(l=o&&o>0?void 0:TA),{width:s,height:l}),h=c.width,f=c.height,d=TC(void 0,void 0,{width:h,height:f,aspect:t.aspect,maxHeight:t.maxHeight}),p=d.calculatedWidth,m=d.calculatedHeight;return wF(p)&&wF(m)?ec.createElement(TB,{width:p,height:m},t.children):ec.createElement(Tj,TO({},t,{width:h,height:f,ref:r}))}),TV=()=>{var t,r=T_(),i=EO(Tg),n=EO(Tx),a=null==(t=EO(Tb))?void 0:t.padding;return r&&n&&a?{width:n.width-a.left-a.right,height:n.height-a.top-a.bottom,x:a.left,y:a.top}:i},T$={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},TG=()=>{var t;return null!=(t=EO(Tm))?t:T$},Tq=t=>t.layout.layoutType,TH=()=>{var t=EO(Tq);if("horizontal"===t||"vertical"===t)return t},TW=t=>{var r=t.layout.layoutType;if("centric"===r||"radial"===r)return r},TZ=t=>{var r=ED(),i=T_(),n=t.width,a=t.height,o=Tz(),s=n,l=a;return o&&(s=o.width>0?o.width:n,l=o.height>0?o.height:a),(0,ec.useEffect)(()=>{!i&&EJ(s)&&EJ(l)&&r(EE({width:s,height:l}))},[r,i,s,l]),null};function TY(t){var r;return t?(t=wD(r=t)?NaN:Number(r))===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t==t?t:0:0===t?t:0}function TX(t,r,i){i&&"number"!=typeof i&&Ez(t,r,i)&&(r=i=void 0),t=TY(t),void 0===r?(r=t,t=0):r=TY(r),i=void 0===i?t<r?1:-1:TY(i);let n=Math.max(Math.ceil((r-t)/(i||1)),0),a=Array(n);for(let r=0;r<n;r++)a[r]=t,t+=i;return a}var TK=t=>t.chartData,TQ=xk([TK],t=>{var r=null!=t.chartData?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:r,dataStartIndex:0}}),TJ=(t,r,i,n)=>n?TQ(t):TK(t),T0=xk([TJ],t=>{var r=t.chartData,i=t.dataStartIndex,n=t.dataEndIndex;return null!=r?r.slice(i,n+1):[]});xk([TQ],t=>{var r=t.chartData,i=t.dataStartIndex,n=t.dataEndIndex;return null!=r?r.slice(i,n+1):[]});var T1=xk([TK],t=>{var r=t.chartData,i=t.dataStartIndex,n=t.dataEndIndex;return null!=r?r.slice(i,n+1):[]});function T2(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,o,s,l=[],u=!0,c=!1;try{if(o=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return T3(t,r);var i=({}).toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?T3(t,r):void 0}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T3(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function T4(t){if(Array.isArray(t)&&2===t.length){var r=T2(t,2),i=r[0],n=r[1];if(EQ(i)&&EQ(n))return!0}return!1}function T6(t,r,i){return i?t:[Math.min(t[0],r[0]),Math.max(t[1],r[1])]}function T5(t,r){if(r&&"function"!=typeof t&&Array.isArray(t)&&2===t.length){var i,n,a=T2(t,2),o=a[0],s=a[1];if(EQ(o))i=o;else if("function"==typeof o)return;if(EQ(s))n=s;else if("function"==typeof s)return;var l=[i,n];if(T4(l))return l}}var T8=t.i(651655);function T7(t){return 0===t?1:Math.floor(new T8.default(t).abs().log(10).toNumber())+1}function T9(t,r,i){for(var n=new T8.default(t),a=0,o=[];n.lt(r)&&a<1e5;)o.push(n.toNumber()),n=n.add(i),a++;return o}function Ae(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,o,s,l=[],u=!0,c=!1;try{if(o=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return At(t,r);var i=({}).toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?At(t,r):void 0}}
56(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function At(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var Ar=t=>{var r=Ae(t,2),i=r[0],n=r[1],a=i,o=n;return i>n&&(a=n,o=i),[a,o]},Ai=(t,r,i)=>{if(t.lte(0))return new T8.default(0);var n=T7(t.toNumber()),a=new T8.default(10).pow(n),o=t.div(a),s=1!==n?.05:.1,l=new T8.default(Math.ceil(o.div(s).toNumber())).add(i).mul(s).mul(a);return new T8.default(r?l.toNumber():Math.ceil(l.toNumber()))},An=(t,r,i)=>{if(t.lte(0))return new T8.default(0);var n,a=[1,2,2.5,5],o=t.toNumber(),s=Math.floor(new T8.default(o).abs().log(10).toNumber()),l=new T8.default(10).pow(s),u=t.div(l).toNumber(),c=a.findIndex(t=>t>=u-1e-10);if(-1===c&&(l=l.mul(10),c=0),(c+=i)>=a.length){var h=Math.floor(c/a.length);c%=a.length,l=l.mul(new T8.default(10).pow(h))}var f=null!=(n=a[c])?n:1,d=new T8.default(f).mul(l);return r?d:new T8.default(Math.ceil(d.toNumber()))},Aa=function(t,r,i,n){var a,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Ai;if(!Number.isFinite((r-t)/(i-1)))return{step:new T8.default(0),tickMin:new T8.default(0),tickMax:new T8.default(0)};var l=s(new T8.default(r).sub(t).div(i-1),n,o),u=Math.ceil((a=t<=0&&r>=0?new T8.default(0):(a=new T8.default(t).add(r).div(2)).sub(new T8.default(a).mod(l))).sub(t).div(l).toNumber()),c=Math.ceil(new T8.default(r).sub(a).div(l).toNumber()),h=u+c+1;return h>i?Aa(t,r,i,n,o+1,s):(h<i&&(c=r>0?c+(i-h):c,u=r>0?u:u+(i-h)),{step:l,tickMin:a.sub(new T8.default(u).mul(l)),tickMax:a.add(new T8.default(c).mul(l))})},Ao=function(t){var r=Ae(t,2),i=r[0],n=r[1],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,o=!(arguments.length>2)||void 0===arguments[2]||arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"auto",l=Math.max(a,2),u=Ae(Ar([i,n]),2),c=u[0],h=u[1];if(c===-1/0||h===1/0){var f=h===1/0?[c,...Array(a-1).fill(1/0)]:[...Array(a-1).fill(-1/0),h];return i>n?f.reverse():f}if(c===h)return((t,r,i)=>{var n=new T8.default(1),a=new T8.default(t);if(!a.isint()&&i){var o=Math.abs(t);o<1?(n=new T8.default(10).pow(T7(t)-1),a=new T8.default(Math.floor(a.div(n).toNumber())).mul(n)):o>1&&(a=new T8.default(Math.floor(t)))}else 0===t?a=new T8.default(Math.floor((r-1)/2)):i||(a=new T8.default(Math.floor(t)));for(var s=Math.floor((r-1)/2),l=[],u=0;u<r;u++)l.push(a.add(new T8.default(u-s).mul(n)).toNumber());return l})(c,a,o);var d=Aa(c,h,l,o,0,"snap125"===s?An:Ai),p=d.step,m=T9(d.tickMin,d.tickMax.add(new T8.default(.1).mul(p)),p);return i>n?m.reverse():m},As=function(t,r){var i=Ae(t,2),n=i[0],a=i[1],o=!(arguments.length>2)||void 0===arguments[2]||arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"auto",l=Ae(Ar([n,a]),2),u=l[0],c=l[1];if(u===-1/0||c===1/0)return[n,a];if(u===c)return[u];var h=Math.max(r,2),f=("snap125"===s?An:Ai)(new T8.default(c).sub(u).div(h-1),o,0),d=[...T9(new T8.default(u),new T8.default(c),f),c];if(!1===o){var p=(d=d.map(t=>Math.round(t))).length-1;p>0&&d[p]===d[p-1]&&(d=d.slice(0,p))}return n>a?d.reverse():d},Al=t=>t.rootProps.maxBarSize,Au=t=>t.rootProps.barCategoryGap,Ac=t=>t.rootProps.stackOffset,Ah=t=>t.rootProps.reverseStackOrder,Af=t=>t.options.chartName,Ad=t=>t.rootProps.syncId,Ap=t=>t.rootProps.syncMethod,Am=t=>t.options.eventEmitter;function Ag(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Ay(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Ag(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}
56(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ag(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}var Av=Math.PI/180,A_=(t,r,i,n)=>({x:t+Math.cos(-Av*n)*i,y:r+Math.sin(-Av*n)*i}),Ab={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Ax={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:"polygon",cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:"auto",orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"auto",zIndex:Ab.axis},Aw={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:"auto",label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,tickLine:!0,type:"auto",zIndex:Ab.axis},AE=(t,r)=>{if(t&&r)return null!=t&&t.reversed?[r[1],r[0]]:r};function AT(t,r,i){return"auto"!==i?i:null!=t?E8(t,r)?"category":"number":void 0}function AA(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function AS(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?AA(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):AA(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}var AC={allowDataOverflow:Ax.allowDataOverflow,allowDecimals:Ax.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Ax.angleAxisId,includeHidden:!1,name:void 0,reversed:Ax.reversed,scale:Ax.scale,tick:Ax.tick,tickCount:void 0,ticks:void 0,type:Ax.type,unit:void 0,niceTicks:"auto"},AM={allowDataOverflow:Aw.allowDataOverflow,allowDecimals:Aw.allowDecimals,allowDuplicatedCategory:Aw.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Aw.radiusAxisId,includeHidden:Aw.includeHidden,name:void 0,reversed:Aw.reversed,scale:Aw.scale,tick:Aw.tick,tickCount:Aw.tickCount,ticks:void 0,type:Aw.type,unit:void 0,niceTicks:"auto"},AD=xk([(t,r)=>{if(null!=r)return t.polarAxis.angleAxis[r]},TW],(t,r)=>{if(null!=t)return t;var i,n=null!=(i=AT(r,"angleAxis",AC.type))?i:"category";return AS(AS({},AC),{},{type:n})}),AP=xk([(t,r)=>t.polarAxis.radiusAxis[r],TW],(t,r)=>{if(null!=t)return t;var i,n=null!=(i=AT(r,"radiusAxis",AM.type))?i:"category";return AS(AS({},AM),{},{type:n})}),AI=t=>t.polarOptions,Ak=xk([Ts,Tl,Tm],function(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(t-(i.left||0)-(i.right||0)),Math.abs(r-(i.top||0)-(i.bottom||0)))/2}),AO=xk([AI,Ak],(t,r)=>{if(null!=t)return wU(t.innerRadius,r,0)}),AN=xk([AI,Ak],(t,r)=>{if(null!=t)return wU(t.outerRadius,r,.8*r)}),AL=xk([AI],t=>null==t?[0,0]:[t.startAngle,t.endAngle]);xk([AD,AL],AE);var AR=xk([Ak,AO,AN],(t,r,i)=>{if(null!=t&&null!=r&&null!=i)return[r,i]});xk([AP,AR],AE);var AF=xk([Tq,AI,AO,AN,Ts,Tl],(t,r,i,n,a,o)=>{if(("centric"===t||"radial"===t)&&null!=r&&null!=i&&null!=n){var s=r.cx,l=r.cy,u=r.startAngle,c=r.endAngle;return{cx:wU(s,a,a/2),cy:wU(l,o,o/2),innerRadius:i,outerRadius:n,startAngle:u,endAngle:c,clockWise:!1}}}),AB=(t,r)=>r,Az=(t,r,i)=>i;function Aj(t){return null==t?void 0:t.id}function AU(t,r,i){var n=r.chartData,a=void 0===n?[]:n,o=i.allowDuplicatedCategory,s=i.dataKey,l=new Map;return t.forEach(t=>{var r,i=null!=(r=t.data)?r:a;if(null!=i&&0!==i.length){var n=Aj(t);
56i.forEach((r,i)=>{var a,u=null==s||o?i:String(E5(r,s,null)),c=E5(r,t.dataKey,0);Object.assign(a=l.has(u)?l.get(u):{},{[n]:c}),l.set(u,a)})}}),Array.from(l.values())}function AV(t){return"stackId"in t&&null!=t.stackId&&null!=t.dataKey}var A$=(t,r)=>t===r||null!=t&&null!=r&&t[0]===r[0]&&t[1]===r[1];function AG(t,r){return!!(Array.isArray(t)&&Array.isArray(r))&&0===t.length&&0===r.length||t===r}var Aq=t=>{var r=Tq(t);return"horizontal"===r?"xAxis":"vertical"===r?"yAxis":"centric"===r?"angleAxis":"radiusAxis"},AH=t=>t.tooltip.settings.axisId;function AW(t){if(null!=t){var r=t.ticks,i=t.bandwidth,n=t.range(),a=[Math.min(...n),Math.max(...n)];return{domain:()=>t.domain(),range:function(t){function r(){return t.apply(this,arguments)}return r.toString=function(){return t.toString()},r}(()=>a),rangeMin:()=>a[0],rangeMax:()=>a[1],isInRange(t){var r=a[0],i=a[1];return r<=i?t>=r&&t<=i:t>=i&&t<=r},bandwidth:i?()=>i.call(t):void 0,ticks:r?i=>r.call(t,i):void 0,map:(r,i)=>{var n=t(r);if(null!=n){if(t.bandwidth&&null!=i&&i.position){var a=t.bandwidth();switch(i.position){case"middle":n+=a/2;break;case"end":n+=a}}return n}}}}}function AZ(t){return Math.sign(t)*t*t}function AY(){var t,r=(0,ak.default)(),i=[0,1],n=!1;function a(i){var a,o=Math.sign(a=r(i))*Math.sqrt(Math.abs(a));return isNaN(o)?t:n?Math.round(o):o}return a.invert=function(t){return r.invert(AZ(t))},a.domain=function(t){return arguments.length?(r.domain(t),a):r.domain()},a.range=function(t){return arguments.length?(r.range((i=Array.from(t,aA.default)).map(AZ)),a):i.slice()},a.rangeRound=function(t){return a.range(t).round(!0)},a.round=function(t){return arguments.length?(n=!!t,a):n},a.clamp=function(t){return arguments.length?(r.clamp(t),a):r.clamp()},a.unknown=function(r){return arguments.length?(t=r,a):t},a.copy=function(){return AY(r.domain(),i).round(n).clamp(r.clamp()).unknown(t)},aO.initRange.apply(a,arguments),(0,aT.linearish)(a)}function AX(){var t,r=0,i=1,n=1,a=[.5],o=[0,1];function s(r){return null!=r&&r<=r?o[(0,aZ.bisect)(a,r,0,n)]:t}function l(){var t=-1;for(a=Array(n);++t<n;)a[t]=((t+1)*i-(t-n)*r)/(n+1);return s}return s.domain=function(t){return arguments.length?([r,i]=t,r*=1,i*=1,l()):[r,i]},s.range=function(t){return arguments.length?(n=(o=Array.from(t)).length-1,l()):o.slice()},s.invertExtent=function(t){var s=o.indexOf(t);return s<0?[NaN,NaN]:s<1?[r,a[0]]:s>=n?[a[n-1],i]:[a[s-1],a[s]]},s.unknown=function(r){return arguments.length&&(t=r),s},s.thresholds=function(){return a.slice()},s.copy=function(){return AX().domain([r,i]).range(o).unknown(t)},aO.initRange.apply((0,aT.linearish)(s),arguments)}t.s([],925212),t.i(925212),t.s([],267155),t.i(267155);var AK=t.i(833766),eO=eO;function AQ(){var t=[],r=ak.identity;function i(i){if(null!=i&&!isNaN(i*=1))return r(((0,aZ.bisect)(t,i,1)-1)/(t.length-1))}return i.domain=function(r){if(!arguments.length)return t.slice();for(let i of(t=[],r))null==i||isNaN(i*=1)||t.push(i);return t.sort(eO.default),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.range=function(){return t.map((i,n)=>r(n/(t.length-1)))},i.quantiles=function(r){return Array.from({length:r+1},(i,n)=>eX(t,n/r))},i.copy=function(){return AQ(r).domain(t)},aO.initInterpolator.apply(i,arguments)}var AJ=t.i(579892);t.s(["scaleBand",0,lh,"scaleDiverging",0,sz,"scaleDivergingLog",0,sj,"scaleDivergingPow",0,sV,"scaleDivergingSqrt",0,s$,"scaleDivergingSymlog",0,sU,"scaleIdentity",0,aS,"scaleImplicit",0,lu,"scaleLinear",()=>aT.default,"scaleLog",0,aU,"scaleOrdinal",0,lc,"scalePoint",0,lf,"scalePow",0,aH,"scaleQuantile",0,aY,"scaleQuantize",0,AX,"scaleRadial",0,AY,"scaleSequential",0,sO,"scaleSequentialLog",0,sN,"scaleSequentialPow",0,sR,"scaleSequentialQuantile",0,AQ,"scaleSequentialSqrt",0,sF,"scaleSequentialSymlog",0,sL,"scaleSqrt",0,aW,"scaleSymlog",0,aJ,"scaleThreshold",()=>AK.default,"scaleTime",0,s8,"scaleUtc",0,s7,"tickFormat",()=>AJ.default],429061),t.i(429061),t.s(["scaleBand",0,lh,"scaleDiverging",0,sz,"scaleDivergingLog",0,sj,"scaleDivergingPow",0,sV,"scaleDivergingSqrt",0,s$,"scaleDivergingSymlog",0,sU,"scaleIdentity",0,aS,"scaleImplicit",0,lu,"scaleLinear",()=>
56aT.default,"scaleLog",0,aU,"scaleOrdinal",0,lc,"scalePoint",0,lf,"scalePow",0,aH,"scaleQuantile",0,aY,"scaleQuantize",0,AX,"scaleRadial",0,AY,"scaleSequential",0,sO,"scaleSequentialLog",0,sN,"scaleSequentialPow",0,sR,"scaleSequentialQuantile",0,AQ,"scaleSequentialSqrt",0,sF,"scaleSequentialSymlog",0,sL,"scaleSqrt",0,aW,"scaleSymlog",0,aJ,"scaleThreshold",()=>AK.default,"scaleTime",0,s8,"scaleUtc",0,s7,"tickFormat",()=>AJ.default],979357);var A0=t.i(979357);function A1(t,r,i){if("function"==typeof t)return t.copy().domain(r).range(i);if(null!=t){var n=function(t){if(t in A0&&"function"==typeof A0[t])return A0[t]();var r="scale".concat(wG(t));if(r in A0&&"function"==typeof A0[r])return A0[r]()}(t);if(null!=n)return n.domain(r).range(i),n}}function A2(t,r,i,n){if(null!=i&&null!=n)return"function"==typeof t.scale?A1(t.scale,i,n):A1(r,i,n)}var A3=(t,r,i)=>{if(null!=t){var n=t.scale,a=t.type;if("auto"===n)return"category"===a&&i&&(i.indexOf("LineChart")>=0||i.indexOf("AreaChart")>=0||i.indexOf("ComposedChart")>=0&&!r)?"point":"category"===a?"band":"linear";if("string"==typeof n)return"scale".concat(wG(n))in A0?n:"point"}};function A4(t,r){if(t){var i=null!=r?r:t.domain(),n=i.map(r=>{var i;return null!=(i=t(r))?i:0}),a=t.range();if(0!==i.length&&!(a.length<2))return t=>{var r,a,o=function(t,r){for(var i=0,n=t.length,a=t[0]<t[t.length-1];i<n;){var o=Math.floor((i+n)/2);(a?t[o]<r:t[o]>r)?i=o+1:n=o}return i}(n,t);return o<=0?i[0]:o>=i.length?i[i.length-1]:Math.abs(t-(null!=(r=n[o-1])?r:0))<=Math.abs(t-(null!=(a=n[o])?a:0))?i[o-1]:i[o]}}}function A6(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function A5(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?A6(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):A6(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function A8(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,o,s,l=[],u=!0,c=!1;try{if(o=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return A7(t,r);var i=({}).toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?A7(t,r):void 0}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A7(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var A9=[0,"auto"],Se={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0,niceTicks:"auto"},St=(t,r)=>t.cartesianAxis.xAxis[r],Sr=(t,r)=>{var i=St(t,r);return null==i?Se:i},Si={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:A9,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:60},Sn=(t,r)=>t.cartesianAxis.yAxis[r],Sa=(t,r)=>{var i=Sn(t,r);return null==i?Si:i},So={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},Ss=(t,r)=>{var i=t.cartesianAxis.zAxis[r];return null==i?So:i},Sl=(t,r,i)=>{switch(r){case"xAxis":return Sr(t,i);case"yAxis":return Sa(t,i);case"zAxis":return Ss(t,i);case"angleAxis":return AD(t,i);case"radiusAxis":return AP(t,i);default:throw Error("Unexpected axis type: ".concat(r))}},Su=(t,r,i)=>{switch(r){case"xAxis":return Sr(t,i);case"yAxis":return Sa(t,i);case"angleAxis":return AD(t,i);case"radiusAxis":return AP(t,i);default:throw Error("Unexpected axis type: ".concat(r))}},Sc=t=>t.graphicalItems.cartesianItems.some(t=>"bar"===t.type)||t.graphicalItems.polarItems.some(t=>"radialBar"===t.type);function Sh(t,r){return i=>{switch(t){case"xAxis":return"xAxisId"in i&&i.xAxisId===r;case"yAxis":return"yAxisId"in i&&i.yAxisId===r;case"zAxis":return"zAxisId"in i&&i.zAxisId===r;case"angleAxis":return"angleAxisId"in i&&i.angleAxisId===r;case"radiusAxis":return"radiusAxisId"in i&&i.radiusAxisId===r;default:return!1}}}var Sf=t=>t.graphicalItems.cartesianItems,Sd=xk([AB,Az],Sh),Sp=(t,r,i)=>t.filter(i).filter(t=>(null==r?void 0:r.includeHidden)===!0||!t.hide),Sm=xk([Sf,Sl,Sd],Sp,{memoizeOptions:{resultEqualityCheck:AG}}),Sg=xk([Sm],t=>t.filter(t=>"area"===t.type||"bar"===t.type).filter(AV)),Sy=t=>t.filter(t=>!("stackId"in t)||void 0===t.stackId),Sv=xk([Sm],Sy),S_=t=>t.map(t=>
56t.data).filter(Boolean).flat(1),Sb=xk([Sm],t=>t.some(t=>!t.data)),Sx=xk([Sm],S_,{memoizeOptions:{resultEqualityCheck:AG}}),Sw=(t,r)=>{var i=r.chartData,n=r.dataStartIndex,a=r.dataEndIndex;return t.length>0?t:(void 0===i?[]:i).slice(n,a+1)},SE=xk([Sx,TJ],Sw),ST=(t,r,i,n,a,o)=>{var s=n.chartData,l=n.dataStartIndex,u=n.dataEndIndex,c=(null==r?void 0:r.dataKey)!=null?t.map(t=>({value:E5(t,r.dataKey)})):i.length>0?i.map(t=>t.dataKey).flatMap(r=>t.map(t=>({value:E5(t,r)}))):t.map(t=>({value:t}));return a&&(null==r?void 0:r.dataKey)!=null&&o.length>0?[...(void 0===s?[]:s).slice(l,u+1).map(t=>({value:E5(t,r.dataKey)})).filter(t=>null!=t.value),...c]:c},SA=xk([SE,Sl,Sm,TJ,Sb,Sx],ST);function SS(t){if(wB(t)||t instanceof Date){var r=Number(t);if(EQ(r))return r}}function SC(t){if(Array.isArray(t)){var r=[SS(t[0]),SS(t[1])];return T4(r)?r:void 0}var i=SS(t);if(null!=i)return[i,i]}function SM(t){return t.map(SS).filter(wq)}function SD(t,r){var i=SS(t),n=SS(r);return null==i&&null==n?0:null==i?-1:null==n?1:i-n}var SP=xk([SA],t=>null==t?void 0:t.map(t=>t.value).sort(SD));function SI(t,r){switch(t){case"xAxis":return"x"===r.direction;case"yAxis":return"y"===r.direction;default:return!1}}var Sk=t=>{var r=Aq(t),i=AH(t);return Su(t,r,i)},SO=xk([Sk],t=>null==t?void 0:t.dataKey),SN=xk([Sg,TJ,Sk],AU),SL=(t,r,i,n)=>Object.fromEntries(Object.entries(r.reduce((t,r)=>{if(null==r.stackId)return t;var i=t[r.stackId];return null==i&&(i=[]),i.push(r),t[r.stackId]=i,t},{})).map(r=>{var a,o,s,l=A8(r,2),u=l[0],c=l[1],h=n?[...c].reverse():c,f=h.map(Aj);return[u,{stackedData:(o=null!=(a=Te[i])?a:EW,(s=(function(){var t=s9([]),r=EZ,i=EW,n=EY;function a(a){var o,s,l=Array.from(t.apply(this,arguments),EX),u=l.length,c=-1;for(let t of a)for(o=0,++c;o<u;++o)(l[o][c]=[0,+n(t,l[o].key,c,a)]).data=t;for(o=0,s=EH(r(l));o<u;++o)l[s[o]].index=o;return i(l,s),l}return a.keys=function(r){return arguments.length?(t="function"==typeof r?r:s9(Array.from(r)),a):t},a.value=function(t){return arguments.length?(n="function"==typeof t?t:s9(+t),a):n},a.order=function(t){return arguments.length?(r=null==t?EZ:"function"==typeof t?t:s9(Array.from(t)),a):r},a.offset=function(t){return arguments.length?(i=null==t?EW:t,a):i},a})().keys(f).value((t,r)=>Number(E5(t,r,0))).order(EZ).offset(o)(t)).forEach((r,i)=>{r.forEach((r,n)=>{var a=E5(t[n],f[i],0);Array.isArray(a)&&2===a.length&&wF(a[0])&&wF(a[1])&&(r[0]=a[0],r[1]=a[1])})}),s),graphicalItems:h}]})),SR=xk([SN,Sg,Ac,Ah],SL),SF=(t,r,i,n)=>{var a=r.dataStartIndex,o=r.dataEndIndex;if(null==n&&"zAxis"!==i){if(null!=t&&0!==Object.keys(t).length){let r;return[(r=Object.keys(t).reduce((r,i)=>{var n=t[i];if(!n)return r;var s=n.stackedData.reduce((t,r)=>{var i,n=[Math.min(...i=EK(r,a,o).flat(2).filter(wF)),Math.max(...i)];return EQ(n[0])&&EQ(n[1])?[Math.min(t[0],n[0]),Math.max(t[1],n[1])]:t},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]}return}},SB=xk([Sl],t=>t.allowDataOverflow),Sz=t=>{var r;if(null==t||!("domain"in t))return A9;if(null!=t.domain)return t.domain;if("ticks"in t&&null!=t.ticks){if("number"===t.type){var i=SM(t.ticks);return[Math.min(...i),Math.max(...i)]}if("category"===t.type)return t.ticks.map(String)}return null!=(r=null==t?void 0:t.domain)?r:A9},Sj=xk([Sl],Sz),SU=xk([Sj,SB],T5),SV=xk([SR,TK,AB,SU],SF,{memoizeOptions:{resultEqualityCheck:A$}}),S$=t=>t.errorBars,SG=function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];var n=r.filter(Boolean);if(0!==n.length){var a=n.flat();return[Math.min(...a),Math.max(...a)]}},Sq=function(t,r,i,n,a){var o,s,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];if(i.length>0&&i.forEach(t=>{var i,u=null!=t.data?[...t.data]:l,c=null==(i=n[t.id])?void 0:i.filter(t=>SI(a,t));u.forEach(i=>{var n,a=E5(i,null!=(n=r.dataKey)?n:t.dataKey),l=function(t,r,i){if(!i||!i.length)return[];if("number"!=typeof r||wL(r)){if(Array.isArray(r)){var n,a=SM(r);a.length>0&&(n=Math.max(...a))}}else n=r;return null==n?[]:SM(i.flatMap(r=>{var i,a,o=E5(t,r.dataKey);if(Array.isArray(o)){var s=A8(o,2);i=s[0],a=s[1]}else i=a=o;if(EQ(i)&&EQ(a))return[n-i,n+a]}))}(i,a,c);if(l.length>=2){var u=Math.min(...l),h=Math.max(...l);(null==o||u<o)&&(o=u),(null==s||h>s)&&(s=h)}var f=SC(a);null!=f&&(o=null==o?f[0]:Math.min(o,f[0]),s=null==s?f[1]:Math.max(s,f[1]))})}),(null==r?void 0:r.dataKey)!=null&&0===i.length&&t.forEach(t=>{var i=SC(E5(t,r.dataKey));null!=i&&(o=null==o?i[0]:Math.min(o,i[0]),s=null==s?i[1]:Math.max(s,i[1]))}),EQ(o)&&EQ(s))return[o,s]},SH=xk([SE,Sl,Sv,S$,AB,T0],Sq,{memoizeOptions:{resultEqualityCheck:A$}});function SW(t){var r=t.value;if(wB(r)||r instanceof Date)return r}var SZ=t=>t.referenceElements.dots,SY=(t,r,i)=>t.filter(t=>"extendDomain"===t.ifOverflow).filter(t=>"xAxis"===r?t.xAxisId===i:t.yAxisId===i),SX=xk([SZ,AB,Az],SY),SK=t=>t.referenceElements.areas,SQ=xk([SK,AB,Az],SY),SJ=t=>t.referenceElements.lines,S0=xk([SJ,AB,Az],SY),S1=(t,r)=>{if(null!=t){var i=SM(t.map(t=>"xAxis"===r?t.x:t.y));if(0!==i.length)return[Math.min(...i),Math.max(...i)]}},S2=xk(SX,AB,S1),S3=(t,r)=>{if(null!=t){var i=SM(t.flatMap(t=>["xAxis"===r?t.x1:t.y1,"xAxis"===r?t.x2:t.y2]));if(0!==i.length)return[Math.min(...i),Math.max(...i)]}},S4=xk([SQ,AB],S3),S6=(t,r)=>{if(null!=t){var i=t.flatMap(t=>"xAxis"===r?function(t){if(null!=t.x)return SM([t.x]);var r,i=null==(r=t.segment)?void 0:r.map(t=>t.x);return null==i||0===i.length?[]:SM(i)}(t):function(t){if(null!=t.y)return SM([t.y]);var r,i=null==(r=t.segment)?void 0:r.map(t=>t.y);return null==i||0===i.length?[]:SM(i)}(t));if(0!==i.length)return[Math.min(...i),Math.max(...i)]}},S5=xk([S0,AB],S6),S8=xk(S2,S5,S4,(t,r,i)=>SG(t,i,r)),S7=(t,r,i,n,a,o,s,l,u)=>{if(null!=i)return i;var c="vertical"===s&&"xAxis"===l||"horizontal"===s&&"yAxis"===l?SG(n,o,a):SG(o,a),h=function(t,r,i){if(i||null!=r){if("function"==typeof t&&null!=r)try{var n=t(r,i);if(T4(n))return T6(n,r,i)}catch(t){}if(Array.isArray(t)&&2===t.length){var a,o,s=T2(t,2),l=s[0],u=s[1];if("auto"===l)null!=r&&(a=Math.min(...r));else if(wF(l))a=l;else if("function"==typeof l)try{null!=r&&(a=l(null==r?void 0:r[0]))}catch(t){}else if("string"==typeof l&&Tr.test(l)){var c=Tr.exec(l);if(null==c||null==c[1]||null==r)a=void 0;else{var h=+c[1];a=r[0]-h}}else a=null==r?void 0:r[0];if("auto"===u)null!=r&&(o=Math.max(...r));else if(wF(u))o=u;else if("function"==typeof u)try{null!=r&&(o=u(null==r?void 0:r[1]))}catch(t){}else if("string"==typeof u&&Ti.test(u)){var f=Ti.exec(u);if(null==f||null==f[1]||null==r)o=void 0;else{var d=+f[1];o=r[1]+d}}else o=null==r?void 0:r[1];var p=[a,o];if(T4(p))return null==r?p:T6(p,r,i)}}}(r,c,t.allowDataOverflow);return null!=h?h:t.allowDataOverflow&&null==c&&null!=u?u:h},S9=xk([Sl],t=>{if(null!=t&&"number"===t.type&&"ticks"in t&&null!=t.ticks){var r=SM(t.ticks);if(0!==r.length)return[Math.min(...r),Math.max(...r)]}},{memoizeOptions:{resultEqualityCheck:A$}}),Ce=xk([Sl,Sj,SU,SV,SH,S8,Tq,AB,S9],S7,{memoizeOptions:{resultEqualityCheck:A$}}),Ct=[0,1],Cr=(t,r,i,n,a,o,s)=>{if(null!=t&&null!=i&&0!==i.length||void 0!==s){var l,u,c=t.dataKey,h=t.type,f=E8(r,o);return f&&null==c?TX(0,null!=(u=null==i?void 0:i.length)?u:0):"category"===h?(l=n.map(SW).filter(t=>null!=t),f&&(null==t.dataKey||t.allowDuplicatedCategory&&wV(l))?TX(0,n.length):t.allowDuplicatedCategory?l:Array.from(new Set(l))):"expand"!==a||f?s:Ct}},Ci=xk([Sl,Tq,SE,SA,Ac,AB,Ce],Cr),Cn=xk([Sl,Sc,Af],A3),Ca=(t,r,i)=>{var n=r.niceTicks;if("none"!==n){var a=Sz(r),o=Array.isArray(a)&&("auto"===a[0]||"auto"===a[1]);if(("snap125"===n||"adaptive"===n)&&null!=r&&r.tickCount&&T4(t)){if(o)return Ao(t,r.tickCount,r.allowDecimals,n);if("number"===r.type)return As(t,r.tickCount,r.allowDecimals,n)}if("auto"===n&&"linear"===i&&null!=r&&r.tickCount){if(o&&T4(t))return Ao(t,r.tickCount,r.allowDecimals,"adaptive");if("number"===r.type&&T4(t))return As(t,r.tickCount,r.allowDecimals,"adaptive")}}}
56,Co=xk([Ci,Su,Cn],Ca),Cs=(t,r,i,n)=>{if("angleAxis"!==n&&(null==t?void 0:t.type)==="number"&&T4(r)&&Array.isArray(i)&&i.length>0){var a,o;return[Math.min(r[0],null!=(a=i[0])?a:0),Math.max(r[1],null!=(o=i[i.length-1])?o:0)]}return r},Cl=xk([Sl,Ci,Co,AB],Cs),Cu=xk(SA,Sl,(t,r)=>{if(r&&"number"===r.type){var i=1/0,n=Array.from(SM(t.map(t=>t.value))).sort((t,r)=>t-r),a=n[0],o=n[n.length-1];if(null==a||null==o)return 1/0;var s=o-a;if(0===s)return 1/0;for(var l=0;l<n.length-1;l++){var u=n[l],c=n[l+1];null!=u&&null!=c&&(i=Math.min(i,c-u))}return i/s}}),Cc=xk(Cu,Tq,Au,Tm,(t,r,i,n,a)=>a,(t,r,i,n,a)=>{if(!EQ(t))return 0;var o="vertical"===r?n.height:n.width;if("gap"===a)return t*o/2;if("no-gap"===a){var s=wU(i,t*o),l=t*o/2;return l-s-(l-s)/o*s}return 0}),Ch=xk(Sr,(t,r,i)=>{var n=Sr(t,r);return null==n||"string"!=typeof n.padding?0:Cc(t,"xAxis",r,i,n.padding)},(t,r)=>{if(null==t)return{left:0,right:0};var i,n,a=t.padding;return"string"==typeof a?{left:r,right:r}:{left:(null!=(i=a.left)?i:0)+r,right:(null!=(n=a.right)?n:0)+r}}),Cf=xk(Sa,(t,r,i)=>{var n=Sa(t,r);return null==n||"string"!=typeof n.padding?0:Cc(t,"yAxis",r,i,n.padding)},(t,r)=>{if(null==t)return{top:0,bottom:0};var i,n,a=t.padding;return"string"==typeof a?{top:r,bottom:r}:{top:(null!=(i=a.top)?i:0)+r,bottom:(null!=(n=a.bottom)?n:0)+r}}),Cd=xk([Tm,Ch,Tx,Tb,(t,r,i)=>i],(t,r,i,n,a)=>{var o=n.padding;return a?[o.left,i.width-o.right]:[t.left+r.left,t.left+t.width-r.right]}),Cp=xk([Tm,Tq,Cf,Tx,Tb,(t,r,i)=>i],(t,r,i,n,a,o)=>{var s=a.padding;return o?[n.height-s.bottom,s.top]:"horizontal"===r?[t.top+t.height-i.bottom,t.top+i.top]:[t.top+i.top,t.top+t.height-i.bottom]}),Cm=(t,r,i,n)=>{var a;switch(r){case"xAxis":return Cd(t,i,n);case"yAxis":return Cp(t,i,n);case"zAxis":return null==(a=Ss(t,i))?void 0:a.range;case"angleAxis":return AL(t);case"radiusAxis":return AR(t,i);default:return}},Cg=xk([Sl,Cm],AE),Cy=xk([Cn,Cl],(t,r)=>{if(null!=r)if("linear"!==t)return r;else{if(!T4(r)){for(var i,n,a=0;a<r.length;a++){var o=r[a];EQ(o)&&((void 0===i||o<i)&&(i=o),(void 0===n||o>n)&&(n=o))}return void 0!==i&&void 0!==n?[i,n]:void 0}return r}}),Cv=xk([Sl,Cn,Cy,Cg],A2),C_=(t,r,i,n)=>{if(null!=i&&null!=i.dataKey){var a=i.type,o=i.scale;if(E8(t,n)&&("number"===a||"auto"!==o))return r.map(t=>t.value)}},Cb=xk([Tq,SA,Su,AB],C_),Cx=xk([Cv],AW);function Cw(t,r){return t.id<r.id?-1:+(t.id>r.id)}xk([Cv],function(t){if(null!=t)return"invert"in t&&"function"==typeof t.invert?t.invert.bind(t):A4(t,void 0)}),xk([Cv,SP],A4),xk([Sm,S$,AB],(t,r,i)=>t.flatMap(t=>r[t.id]).filter(Boolean).filter(t=>SI(i,t)));var CE=(t,r)=>r,CT=(t,r,i)=>i,CA=xk(Th,CE,CT,(t,r,i)=>t.filter(t=>t.orientation===r).filter(t=>t.mirror===i).sort(Cw)),CS=xk(Tf,CE,CT,(t,r,i)=>t.filter(t=>t.orientation===r).filter(t=>t.mirror===i).sort(Cw)),CC=(t,r)=>{var i="number"==typeof r.height?r.height:30;return{width:t.width,height:i}},CM=xk(Tm,Sr,CC),CD=xk(Tl,Tm,CA,CE,CT,(t,r,i,n,a)=>{var o,s={};return i.forEach(i=>{var l=CC(r,i);null==o&&(o=((t,r,i)=>{switch(r){case"top":return t.top;case"bottom":return i-t.bottom;default:return 0}})(r,n,t));var u="top"===n&&!a||"bottom"===n&&a;s[i.id]=o-Number(u)*l.height,o+=(u?-1:1)*l.height}),s}),CP=xk(Ts,Tm,CS,CE,CT,(t,r,i,n,a)=>{var o,s={};return i.forEach(i=>{var l={width:"number"==typeof i.width?i.width:60,height:r.height};null==o&&(o=((t,r,i)=>{switch(r){case"left":return t.left;case"right":return i-t.right;default:return 0}})(r,n,t));var u="left"===n&&!a||"right"===n&&a;s[i.id]=o-Number(u)*l.width,o+=(u?-1:1)*l.width}),s}),CI=xk([Tm,Sr,(t,r)=>{var i=Sr(t,r);if(null!=i)return CD(t,i.orientation,i.mirror)},(t,r)=>r],(t,r,i,n)=>{if(null!=r){var a=null==i?void 0:i[n];return null==a?{x:t.left,y:0}:{x:t.left,y:a}}}),Ck=xk([Tm,Sa,(t,r)=>{var i=Sa(t,r);if(null!=i)return CP(t,i.orientation,i.mirror)},(t,r)=>r],(t,r,i,n)=>{if(null!=r){var a=null==i?void 0:i[n];return null==a?{x:0,y:t.top}:{x:a,y:t.top}}}),CO=xk(Tm,Sa,(t,r)=>({width:"number"==typeof r.width?r.width:60,height:t.height})),CN=(t,r,i)=>{switch(r){case"xAxis":return CM(t,i).width;case"yAxis":return CO(t,i).height;default:return}},CL=(t,r,i,n)=>{if(null!=i){var a=i.allowDuplicatedCategory,o=i.type,s=i.dataKey,l=E8(t,n),u=r.map(t=>t.value),c=u.filter(t=>null!=t);if(s&&l&&"category"===o&&a&&wV(c))return u}},CR=xk([Tq,SA,Sl,AB],CL),CF=xk([Tq,(t,r,i)=>{switch(r){case"xAxis":return Sr(t,i);case"yAxis":return Sa(t,i);default:throw Error("Unexpected axis type: ".concat(r))}},Cn,Cx,CR,Cb,Cm,Co,AB],(t,r,i,n,a,o,s,l,u)=>{if(null!=r){var c=E8(t,u);return{angle:r.angle,interval:r.interval,minTickGap:r.minTickGap,orientation:r.orientation,tick:r.tick,tickCount:r.t
56ickCount,tickFormatter:r.tickFormatter,ticks:r.ticks,type:r.type,unit:r.unit,axisType:u,categoricalDomain:o,duplicateDomain:a,isCategorical:c,niceTicks:l,range:s,realScaleType:i,scale:n}}}),CB=xk([Tq,Su,Cn,Cx,Co,Cm,CR,Cb,AB],(t,r,i,n,a,o,s,l,u)=>{if(null!=r&&null!=n){var c=E8(t,u),h=r.type,f=r.ticks,d=r.tickCount,p="scaleBand"===i&&"function"==typeof n.bandwidth?n.bandwidth()/2:2,m="category"===h&&n.bandwidth?n.bandwidth()/p:0;m="angleAxis"===u&&null!=o&&o.length>=2?2*wN(o[0]-o[1])*m:m;var g=f||a;return g?g.map((t,r)=>{var i=s?s.indexOf(t):t,a=n.map(i);return EQ(a)?{index:r,coordinate:a+m,value:t,offset:m}:null}).filter(wq):c&&l?l.map((t,r)=>{var i=n.map(t);return EQ(i)?{coordinate:i+m,value:t,index:r,offset:m}:null}).filter(wq):n.ticks?n.ticks(d).map((t,r)=>{var i=n.map(t);return EQ(i)?{coordinate:i+m,value:t,index:r,offset:m}:null}).filter(wq):n.domain().map((t,r)=>{var i=n.map(t);return EQ(i)?{coordinate:i+m,value:s?s[t]:t,index:r,offset:m}:null}).filter(wq)}}),Cz=xk([Tq,Su,Cx,Cm,CR,Cb,AB],(t,r,i,n,a,o,s)=>{if(null!=r&&null!=i&&null!=n&&n[0]!==n[1]){var l=E8(t,s),u=r.tickCount,c=0;return(c="angleAxis"===s&&(null==n?void 0:n.length)>=2?2*wN(n[0]-n[1])*c:c,l&&o)?o.map((t,r)=>{var n=i.map(t);return EQ(n)?{coordinate:n+c,value:t,index:r,offset:c}:null}).filter(wq):i.ticks?i.ticks(u).map((t,r)=>{var n=i.map(t);return EQ(n)?{coordinate:n+c,value:t,index:r,offset:c}:null}).filter(wq):i.domain().map((t,r)=>{var n=i.map(t);return EQ(n)?{coordinate:n+c,value:a?a[t]:t,index:r,offset:c}:null}).filter(wq)}}),Cj=xk(Sl,Cx,(t,r)=>{if(null!=t&&null!=r)return A5(A5({},t),{},{scale:r})}),CU=xk([Sl,Cn,Ci,Cg],A2),CV=xk([CU],AW);xk((t,r,i)=>Ss(t,i),CV,(t,r)=>{if(null!=t&&null!=r)return A5(A5({},t),{},{scale:r})});var C$=xk([Tq,Th,Tf],(t,r,i)=>{switch(t){case"horizontal":return r.some(t=>t.reversed)?"right-to-left":"left-to-right";case"vertical":return i.some(t=>t.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}});xk([(t,r,i)=>{var n;return null==(n=t.renderedTicks[r])?void 0:n[i]}],t=>{if(t&&0!==t.length)return r=>{var i,n=1/0,a=t[0];for(var o of t){var s=Math.abs(o.coordinate-r);s<n&&(n=s,a=o)}return null==(i=a)?void 0:i.value}});var CG=t=>t.options.defaultTooltipEventType,Cq=t=>t.options.validateTooltipEventTypes;function CH(t,r,i){if(null==t)return r;var n=t?"axis":"item";return null==i?r:i.includes(n)?n:r}function CW(t,r){return CH(r,CG(t),Cq(t))}var CZ=(t,r)=>{var i,n=Number(r);if(!wL(n)&&null!=r)return n>=0?null==t||null==(i=t[n])?void 0:i.value:void 0};function CY(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function CX(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?CY(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):CY(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}var CK=(t,r,i,n)=>{if(null==r)return w7;var a,o,s,l=(a=t,o=r,s=i,"axis"===o?"click"===s?a.axisInteraction.click:a.axisInteraction.hover:"click"===s?a.itemInteraction.click:a.itemInteraction.hover);if(null==l)return w7;if(l.active)return l;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&null!=t.syncInteraction.index)return t.syncInteraction;var u=!0===t.settings.active;if(null!=l.index){if(u)return CX(CX({},l),{},{active:!0})}else if(null!=n)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return CX(CX({},w7),{}
56,{coordinate:l.coordinate})},CQ=(t,r,i,n)=>{var a=null==t?void 0:t.index;if(null==a)return null;var o=Number(a);if(!EQ(o))return a;var s=Infinity;r.length>0&&(s=r.length-1);var l=Math.max(0,Math.min(o,s)),u=r[l];return null==u?String(l):!function(t,r,i){if(null==i||null==r)return!0;var n=E5(t,r);return!(null!=n&&T4(i))||function(t,r){var i=function(t){if("number"==typeof t)return Number.isFinite(t)?t:void 0;if(t instanceof Date){var r=t.valueOf();return Number.isFinite(r)?r:void 0}var i=Number(t);return Number.isFinite(i)?i:void 0}(t),n=r[0],a=r[1];if(void 0===i)return!1;var o=Math.min(n,a),s=Math.max(n,a);return i>=o&&i<=s}(n,i)}(u,i,n)?null:String(l)},CJ=(t,r,i,n,a,o,s)=>{if(null!=o){var l=s[0],u=null==l?void 0:l.getPosition(o);if(null!=u)return u;var c=null==a?void 0:a[Number(o)];if(c)if("horizontal"===i)return{x:c.coordinate,y:(n.top+r)/2};else return{x:(n.left+t)/2,y:c.coordinate}}},C0=(t,r,i,n)=>{if("axis"===r)return t.tooltipItemPayloads;if(0===t.tooltipItemPayloads.length)return[];if(a="hover"===i?t.itemInteraction.hover.graphicalItemId:t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&null==a)return t.tooltipItemPayloads;if(null==a&&(null!=n||t.keyboardInteraction.active)){var a,o=t.tooltipItemPayloads[0];return null!=o?[o]:[]}return t.tooltipItemPayloads.filter(t=>{var r;return(null==(r=t.settings)?void 0:r.graphicalItemId)===a})},C1=t=>t.options.tooltipPayloadSearcher,C2=t=>t.tooltip;function C3(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function C4(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?C3(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):C3(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function C6(t){if("string"==typeof t)return t}var C5=(t,r,i,n,a,o,s)=>{if(null!=r&&null!=o){var l=i.chartData,u=i.computedData,c=i.dataStartIndex,h=i.dataEndIndex;return t.reduce((t,i)=>{var f,d,p,m=i.dataDefinedOnItem,g=i.settings,y=null!=m?m:l,v=Array.isArray(y)?EK(y,c,h):y,_=null!=(f=null==g?void 0:g.dataKey)?f:n,b=null==g?void 0:g.nameKey;return n&&Array.isArray(v)&&!Array.isArray(v[0])&&"axis"===s?null==(d=function(t,r,i){if(t&&t.length)return t.find(t=>t&&("function"==typeof r?r(t):wI(t,r))===i)}(v,n,a))&&(d=o(v,r,u,b)):d=o(v,r,u,b),Array.isArray(d)?d.forEach(r=>{var i,n,a=function(t){if(null!=t&&"object"==typeof t){var r,i="name"in t?function(t){if("string"==typeof t||"number"==typeof t)return t}(t.name):void 0,n="unit"in t?function(t){if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}(t.unit):void 0,a="dataKey"in t?"string"==typeof(r=t.dataKey)||"number"==typeof r?r:"function"==typeof r?t=>r(t):void 0:void 0,o="payload"in t?t.payload:void 0;return{name:i,unit:n,dataKey:a,payload:o,color:"color"in t?C6(t.color):void 0,fill:"fill"in t?C6(t.fill):void 0}}}(r),o=null==a?void 0:a.name,s=null==a?void 0:a.dataKey,l=null==a?void 0:a.payload,u=C4(C4({},g),{},{name:o,unit:null==a?void 0:a.unit,color:null!=(i=null==a?void 0:a.color)?i:null==g?void 0:g.color,fill:null!=(n=null==a?void 0:a.fill)?n:null==g?void 0:g.fill});t.push(Ta({tooltipEntrySettings:u,dataKey:s,payload:l,value:E5(l,s),name:null==o?void 0:String(o)}))}):t.push(Ta({tooltipEntrySettings:g,dataKey:_,payload:d,value:E5(d,_),name:null!=(p=E5(d,b))?p:null==g?void 0:g.name})),t},[])}},C8=xk([Sk,Sc,Af],A3),C7=xk([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,r)=>[...t,...r]),C9=xk([Aq,AH],Sh),Me=xk([C7,Sk,C9],Sp,{memoizeOptions:{resultEqualityCheck:AG}}),Mt=xk([Me],t=>t.filter(AV)),Mr=xk([Me],S_,{memoizeOptions:{resultEqualityCheck:AG}}),Mi=xk([Me],t=>t.some(t=>!t.data)),Mn=xk([Mr,TK],Sw),Ma=xk([Mt,TK,Sk],AU),Mo=xk([Mn,Sk,Me,TK,Mi,Mr],ST),Ms=xk([Sk],Sz),Ml=xk([Sk],t=>t.allowDataOverflow),Mu=xk([Ms,Ml],T5),Mc=xk([Me],t=>t.filter(AV)),Mh=xk([Ma,Mc,Ac,Ah],SL),Mf=xk([Mh,TK,Aq,Mu],SF),Md=xk([Me],Sy),Mp=xk([Mn,Sk,Md,S$,Aq,T1],Sq,{memoizeOptions:{resultEqualityCheck:A$}}),Mm=xk([SZ,Aq,AH],SY),Mg=xk([Mm,Aq],S1),My=xk([SK,Aq,AH],SY),Mv=xk([My,Aq],S3),M_=xk([SJ,Aq,AH],SY),Mb=xk([M_,Aq],S6),Mx=xk([Mg,Mb,Mv],SG),Mw=xk([Sk,Ms,Mu,Mf,Mp,Mx,Tq,Aq],S7),ME=xk([Sk,Tq,Mn,Mo,Ac,Aq,Mw],
56Cr),MT=xk([ME,Sk,C8],Ca),MA=xk([Sk,ME,MT,Aq],Cs),MS=t=>{var r=Aq(t),i=AH(t);return Cm(t,r,i,!1)},MC=xk([Sk,MS],AE),MM=xk([Sk,C8,MA,MC],A2),MD=xk([MM],AW),MP=xk([Tq,Mo,Sk,Aq],CL),MI=xk([Tq,Mo,Sk,Aq],C_),Mk=xk([Tq,Sk,C8,MD,MS,MP,MI,Aq],(t,r,i,n,a,o,s,l)=>{if(r){var u=r.type,c=E8(t,l);if(n){var h="scaleBand"===i&&n.bandwidth?n.bandwidth()/2:2,f="category"===u&&n.bandwidth?n.bandwidth()/h:0;return(f="angleAxis"===l&&null!=a&&(null==a?void 0:a.length)>=2?2*wN(a[0]-a[1])*f:f,c&&s)?s.map((t,r)=>{var i=n.map(t);return EQ(i)?{coordinate:i+f,value:t,index:r,offset:f}:null}).filter(wq):n.domain().map((t,r)=>{var i=n.map(t);return EQ(i)?{coordinate:i+f,value:o?o[t]:t,index:r,offset:f}:null}).filter(wq)}}}),MO=xk([CG,Cq,t=>t.tooltip.settings],(t,r,i)=>CH(i.shared,t,r)),MN=t=>t.tooltip.settings.trigger,ML=t=>t.tooltip.settings.defaultIndex,MR=xk([C2,MO,MN,ML],CK),MF=xk([MR,Mn,SO,ME],CQ),MB=xk([Mk,MF],CZ),Mz=xk([MR],t=>{if(t)return t.dataKey}),Mj=xk([MR],t=>{if(t)return t.graphicalItemId}),MU=xk([C2,MO,MN,ML],C0),MV=xk([Ts,Tl,Tq,Tm,Mk,ML,MU],CJ),M$=xk([MR,MV],(t,r)=>null!=t&&t.coordinate?t.coordinate:r),MG=xk([MR],t=>{var r;return null!=(r=null==t?void 0:t.active)&&r}),Mq=xk([MU,MF,TK,SO,MB,C1,MO],C5);function MH(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function MW(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?MH(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):MH(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}xk([Mq],t=>{if(null!=t)return Array.from(new Set(t.map(t=>t.payload).filter(t=>null!=t)))});var MZ=(t,r,i,n,a)=>{var o=null!=(m=null==r?void 0:r.length)?m:0;if(o<=1||null==t)return 0;if("angleAxis"===n&&null!=a&&1e-6>=Math.abs(Math.abs(a[1]-a[0])-360))for(var s=a[1]-a[0],l=(r,i,n)=>[t,t+s,t-s].some(t=>(n?t>=r:t>r)&&t<=i),u=0;u<o;u++){var c,h=u>0?null==(g=i[u-1])?void 0:g.coordinate:null==(y=i[o-1])?void 0:y.coordinate,f=null==(v=i[u])?void 0:v.coordinate,d=u>=o-1?null==(_=i[0])?void 0:_.coordinate:null==(b=i[u+1])?void 0:b.coordinate,p=void 0;if(null!=h&&null!=f&&null!=d){if(wN(f-h)!==wN(d-f)){var m,g,y,v,_,b,x,w=[];if(wN(d-f)===wN(a[1]-a[0])){p=d;var E=f+a[1]-a[0];w[0]=Math.min(E,(E+h)/2),w[1]=Math.max(E,(E+h)/2)}else{p=h;var T=d+a[1]-a[0];w[0]=Math.min(f,(T+f)/2),w[1]=Math.max(f,(T+f)/2)}var A=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(l(A[0],A[1],!1)||l(w[0],w[1],!0))return null==(x=i[u])?void 0:x.index}else if(l((Math.min(h,d)+f)/2,(Math.max(h,d)+f)/2,!1))return null==(c=i[u])?void 0:c.index}}else if(r)for(var S=0;S<o;S++){var C=r[S];if(null!=C){var M=r[S+1],D=r[S-1];if(0===S&&null!=M&&t<=(C.coordinate+M.coordinate)/2||S===o-1&&null!=D&&t>(C.coordinate+D.coordinate)/2||S>0&&S<o-1&&null!=D&&null!=M&&t>(C.coordinate+D.coordinate)/2&&t<=(C.coordinate+M.coordinate)/2)return C.index}}return -1},MY=(t,r)=>r,MX=(t,r,i)=>i,MK=(t,r,i,n)=>n,MQ=xk(Mk,t=>EG(t,t=>t.coordinate)),MJ=xk([C2,MY,MX,MK],CK),M0=xk([MJ,Mn,SO,ME],CQ),M1=xk([C2,MY,MX,MK],C0),M2=xk([Ts,Tl,Tq,Tm,Mk,MK,M1],CJ),M3=xk([MJ,M2],(t,r)=>{var i;return null!=(i=t.coordinate)?i:r}),M4=xk([Mk,M0],CZ),M6=xk([M1,M0,TK,SO,M4,C1,MY],C5),M5=xk([MJ,M0],(t,r)=>({isActive:t.active&&null!=r,activeIndex:r})),M8=xk([(t,r)=>r,Tq,AF,Aq,MC,Mk,MQ,Tm],(t,r,i,n,a,o,s,l)=>{if(t&&r&&n&&a&&o){if("horizontal"===r||"vertical"===r){var u=t,c=r,h=n,f=a,d=o,p=s,m=l;if(u&&h&&f&&d&&(g=u.relativeX,y=u.relativeY,g>=m.left&&g<=m.left+m.width&&y>=m.top&&y<=m.top+m.height)){var g,y,v=MZ("horizontal"===c?u.relativeX:"vertical"===c?u.relativeY:void 0,p,d,h,f),_=((t,r,i,n)=>{var a=r.find(t=>t&&t.index===i);if(a){if("horizontal"===t)return{x:a.coordinate,y:n.relativeY};if("vertical"===t)return{x:n.relativeX,y:a.coordinate}}return{x:0,y:0}})(c,d,v,u);return{activeIndex:String(v),activeCoordinate:_}}return}if(t&&n&&a&&o&&i){var b=((t,r)=>{var i,n,a,o,s=((t,r)=>{var i,n,a,o,s=t.x,l=t.y,u=r.cx,c=r.cy,h=(i={x:s,y:l},n={x:u,y:c},a=i.x,o=i.y,Math.sqrt((a-n.x)**2+(o-n.y)**2));if(h<=0)return{radius:h,angle:0};var f=Math.acos((s-u)/h);return l>c&&(f=2*Math.PI-f),{radius:h,angle:180*f/Math.PI,angleInRadian:f}})({x:t.relativeX,y:t.relativeY},r),l=s.radius,u=s.angle,c=r.innerRadius,h=r.outerRadius;if(l<c||l>h||0===l)return null;var f=(a=Math.min(Math.floor((i=r.startAngle)/360),Math.floor((n=r.endAngle)/360)),{startAngle:i-360*a,endAngle:n-360*a}),d=f.startAngle,p=f.endAngle,m=u;if(d<=p){for(;m>p;)m-=360;for(;m<d;)m+=360;o=m>=d&&m<=p}else{for(;m>d;)m-=360;for(;m<p;)m+=360;o=m>=p&&m<=d}return o?Ay(Ay({},r),{},{radius:l,angle:m+360*Math.min(Math.floor(r.startAngle/360),Math.floor(r.endAngle/360))}):null})(t,i);if(b){var x=MZ("centric"===r?b.angle:b.radius,s,o,n,a),w=((t,r,i,n)=>{var a=r.find(t=>t&&t.index===i);
56if(a){if("centric"===t){var o=a.coordinate,s=n.radius;return MW(MW(MW({},n),A_(n.cx,n.cy,s,o)),{},{angle:o,radius:s})}var l=a.coordinate,u=n.angle;return MW(MW(MW({},n),A_(n.cx,n.cy,l,u)),{},{angle:u,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(r,o,x,b);return{activeIndex:String(x),activeCoordinate:w}}return}}});function M7(t){var r,i,n=t.currentTarget.getBoundingClientRect();if("getBBox"in t.currentTarget&&"function"==typeof t.currentTarget.getBBox){var a=t.currentTarget.getBBox();r=a.width>0?n.width/a.width:1,i=a.height>0?n.height/a.height:1}else{var o=t.currentTarget;r=o.offsetWidth>0?n.width/o.offsetWidth:1,i=o.offsetHeight>0?n.height/o.offsetHeight:1}var s=(t,a)=>({relativeX:Math.round((t-n.left)/r),relativeY:Math.round((a-n.top)/i)});return"touches"in t?Array.from(t.touches).map(t=>s(t.clientX,t.clientY)):s(t.clientX,t.clientY)}var M9=xq("mouseClick"),De=wE();De.startListening({actionCreator:M9,effect:(t,r)=>{var i=t.payload,n=M8(r.getState(),M7(i));(null==n?void 0:n.activeIndex)!=null&&r.dispatch(Ec({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Dt=xq("mouseMove"),Dr=wE(),Di=null,Dn=null,Da=null;function Do(t,r){return r instanceof HTMLElement?"HTMLElement <".concat(r.tagName,' class="').concat(r.className,'">'):r===window?"global.window":"children"===t&&"object"==typeof r&&null!==r?"<<CHILDREN>>":r}function Ds(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Dl(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Ds(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ds(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}Dr.startListening({actionCreator:Dt,effect:(t,r)=>{var i=t.payload,n=r.getState().eventSettings,a=n.throttleDelay,o=n.throttledEvents,s="all"===o||(null==o?void 0:o.includes("mousemove"));null!==Di&&(cancelAnimationFrame(Di),Di=null),null===Dn||"number"==typeof a&&s||(clearTimeout(Dn),Dn=null),Da=M7(i);var l=()=>{var t=r.getState(),i=CW(t,t.tooltip.settings.shared);if(!Da){Di=null,Dn=null;return}if("axis"===i){var n=M8(t,Da);(null==n?void 0:n.activeIndex)!=null?r.dispatch(Eu({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):r.dispatch(Es())}Di=null,Dn=null};s?"raf"===a?Di=requestAnimationFrame(l):"number"==typeof a&&null===Dn&&(Dn=setTimeout(l,a)):l()}});var Du=x2({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(t,r){t.xAxis[r.payload.id]=r.payload},prepare:xX()},replaceXAxis:{reducer(t,r){var i=r.payload,n=i.prev,a=i.next;void 0!==t.xAxis[n.id]&&(n.id!==a.id&&delete t.xAxis[n.id],t.xAxis[a.id]=a)},prepare:xX()},removeXAxis:{reducer(t,r){delete t.xAxis[r.payload.id]},prepare:xX()},addYAxis:{reducer(t,r){t.yAxis[r.payload.id]=r.payload},prepare:xX()},replaceYAxis:{reducer(t,r){var i=r.payload,n=i.prev,a=i.next;void 0!==t.yAxis[n.id]&&(n.id!==a.id&&delete t.yAxis[n.id],t.yAxis[a.id]=a)},prepare:xX()},removeYAxis:{reducer(t,r){delete t.yAxis[r.payload.id]},prepare:xX()},addZAxis:{reducer(t,r){t.zAxis[r.payload.id]=r.payload},prepare:xX()},replaceZAxis:{reducer(t,r){var i=r.payload,n=i.prev,a=i.next;void 0!==t.zAxis[n.id]&&(n.id!==a.id&&delete t.zAxis[n.id],t.zAxis[a.id]=a)},prepare:xX()},removeZAxis:{reducer(t,r){delete t.zAxis[r.payload.id]},prepare:xX()},updateYAxisWidth(t,r){var i=r.payload,n=i.id,a=i.width,o=t.yAxis[n];if(o){var s,l=o.widthHistory||[];if(3===l.length&&l[0]===l[2]&&a===l[1]&&a!==o.width&&1>=Math.abs(a-(null!=(s=l[0])?s:0)))return;var u=[...l,a].slice(-3);t.yAxis[n]=Dl(Dl({},o),{},{width:a,widthHistory:u})}},updateXAxisHeight(t,r){var i=r.payload,n=i.id,a=i.height,o=t.xAxis[n];if(o){var s,l=o.heightHistory||[];if(3===l.length&&l[0]===l[2]&&a===l[1]&&a!==o.height&&1>=Math.abs(a-(null!=(s=l[0])?s:0)))return;var u=[...l,a].slice(-3);t.xAxis[n]=Dl(Dl({},o),{},{height:a,heightHistory:u})}}}}),Dc=Du.actions,Dh=Dc.addXAxis,Df=Dc.replaceXAxis,Dd=Dc.removeXAxis,Dp=Dc.addYAxis,Dm=Dc.replaceYAxis,Dg=Dc.removeYAxis,Dy=(Dc.addZAxis,Dc.replaceZAxis,Dc.removeZAxis,Dc.updateYAxisWidth),Dv=Dc.updateXAxisHeight,D_=Du.reducer,Db=x2({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(t,r){t.cartesianItems.push(r.payload)},prepare:xX()},replaceCartesianGraphicalItem:{reducer(t,r){var i=r.payload,n=i.prev,a=i.next,o=xf(t).cartesianItems.indexOf(n);o>-1&&(t.cartesianItems[o]=a)},prepare:xX()},removeCartesianGraphicalItem:{reducer(t,r){var i=xf(t).cartesianItems.indexOf(r.payload);i>-1&&t.cartesianItems.splice(i,1)},prepare:xX()},addPolarGraphicalItem:{reducer(t,r){t.polarItems.push(r.payload)},prepare:xX()},removePolarGraphicalItem:{reducer(t,r){var i=xf(t).polarItems.indexOf(r.payload);i>-1&&t.polarItems.splice(i,1)},prepare:xX()},replacePolarGraphicalItem:{reducer(t,r){var i=r.payload,n=i.prev,a=i.next,o=xf(t).polarItems.indexOf(n);o>-1&&(t.polarItems[o]=a)},prepare:xX()}}}),Dx=Db.actions,Dw=Dx.addCartesianGraphicalItem,DE=Dx.replaceCartesianGraphicalItem,DT=Dx.removeCartesianGraphicalItem,DA=(Dx.addPolarGraphicalItem,Dx.removePolarGraphicalItem,Dx.replacePolarGraphicalItem,Db.reducer),DS=x2({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(t,r)=>{t.dots.push(r.payload)},removeDot:(t,r)=>{var i=xf(t).dots.findIndex(t=>t===r.payload);-1!==i&&t.dots.splice(i,1)},addArea:(t,r)=>{t.areas.push(r.payload)},removeArea:(t,r)=>{var i=xf(t).areas.findIndex(t=>t===r.payload);-1!==i&&t.areas.splice(i,1)},addLine:(t,r)=>{t.lines.push(r.payload)},removeLine:(t,r)=>{var i=xf(t).lines.findIndex(t=>t===r.payload);-1!==i&&t.lines.splice(i,1)}}}),DC=DS.actions,DM=(DC.addDot,DC.removeDot,DC.addArea,DC.removeArea,DC.addLine),DD=DC.removeLine,DP=DS.reducer,DI={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}}
56,Dk=x2({name:"brush",initialState:DI,reducers:{setBrushSettings:(t,r)=>null==r.payload?DI:r.payload}});Dk.actions.setBrushSettings;var DO=Dk.reducer,DN=x2({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value",position:void 0,offset:0},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(t,r){t.size.width=r.payload.width,t.size.height=r.payload.height},setLegendSettings(t,r){t.settings.align=r.payload.align,t.settings.layout=r.payload.layout,t.settings.verticalAlign=r.payload.verticalAlign,t.settings.itemSorter=r.payload.itemSorter,t.settings.position=r.payload.position,t.settings.offset=r.payload.offset},addLegendPayload:{reducer(t,r){t.payload.push(r.payload)},prepare:xX()},replaceLegendPayload:{reducer(t,r){var i=r.payload,n=i.prev,a=i.next,o=xf(t).payload.indexOf(n);o>-1&&(t.payload[o]=a)},prepare:xX()},removeLegendPayload:{reducer(t,r){var i=xf(t).payload.indexOf(r.payload);i>-1&&t.payload.splice(i,1)},prepare:xX()}}}),DL=DN.actions,DR=(DL.setLegendSize,DL.setLegendSettings,DL.addLegendPayload),DF=DL.replaceLegendPayload,DB=DL.removeLegendPayload,Dz=DN.reducer,Dj={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},DU=x2({name:"rootProps",initialState:Dj,reducers:{updateOptions:(t,r)=>{var i;t.accessibilityLayer=r.payload.accessibilityLayer,t.barCategoryGap=r.payload.barCategoryGap,t.barGap=null!=(i=r.payload.barGap)?i:Dj.barGap,t.barSize=r.payload.barSize,t.maxBarSize=r.payload.maxBarSize,t.stackOffset=r.payload.stackOffset,t.syncId=r.payload.syncId,t.syncMethod=r.payload.syncMethod,t.className=r.payload.className,t.baseValue=r.payload.baseValue,t.reverseStackOrder=r.payload.reverseStackOrder}}}),DV=DU.reducer,D$=DU.actions.updateOptions,DG=x2({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(t,r){t.radiusAxis[r.payload.id]=r.payload},removeRadiusAxis(t,r){delete t.radiusAxis[r.payload.id]},addAngleAxis(t,r){t.angleAxis[r.payload.id]=r.payload},removeAngleAxis(t,r){delete t.angleAxis[r.payload.id]}}}),Dq=DG.actions;Dq.addRadiusAxis,Dq.removeRadiusAxis,Dq.addAngleAxis,Dq.removeAngleAxis;var DH=DG.reducer,DW=x2({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(t,r)=>null===t?r.payload:(t.startAngle=r.payload.startAngle,t.endAngle=r.payload.endAngle,t.cx=r.payload.cx,t.cy=r.payload.cy,t.innerRadius=r.payload.innerRadius,t.outerRadius=r.payload.outerRadius,t)}});DW.actions.updatePolarOptions;var DZ=DW.reducer,DY=xq("keyDown"),DX=xq("focus"),DK=xq("blur"),DQ=wE(),DJ=null,D0=null,D1=null;function D2(t){t.persist();var r=t.currentTarget;return new Proxy(t,{get:(t,i)=>{if("currentTarget"===i)return r;var n=Reflect.get(t,i);return"function"==typeof n?n.bind(t):n}})}DQ.startListening({actionCreator:DY,effect:(t,r)=>{D1=t.payload,null!==DJ&&(cancelAnimationFrame(DJ),DJ=null);var i=r.getState().eventSettings,n=i.throttleDelay,a=i.throttledEvents,o="all"===a||a.includes("keydown");null===D0||"number"==typeof n&&o||(clearTimeout(D0),D0=null);var s=()=>{try{var t,i=r.getState();if(!1===i.rootProps.accessibilityLayer)return;var n=i.tooltip.keyboardInteraction,a=D1;
56if("ArrowRight"!==a&&"ArrowLeft"!==a&&"Enter"!==a)return;var o=CQ(n,Mn(i),SO(i),ME(i)),s=null==o?-1:Number(o),l=!Number.isFinite(s)||s<0,u=Mk(i),c=Mn(i),h=CW(i,i.tooltip.settings.shared);if("Enter"===a){if(l)return;var f=M2(i,h,"hover",String(n.index));r.dispatch(Ef({active:!n.active,activeIndex:n.index,activeCoordinate:f}));return}var d=C$(i),p="left-to-right"===d?1:-1,m="ArrowRight"===a?1:-1;if(l){var g=SO(i),y=ME(i),v=t=>({active:!1,index:String(t),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(t=-1,m*p>0){for(var _=0;_<c.length;_++)if(null!=CQ(v(_),c,g,y)){t=_;break}}else for(var b=c.length-1;b>=0;b--)if(null!=CQ(v(b),c,g,y)){t=b;break}if(t<0)return}else{t=s+m*p;var x=(null==u?void 0:u.length)||c.length;if(0===x||t>=x||t<0)return}var w=M2(i,h,"hover",String(t));r.dispatch(Ef({active:!0,activeIndex:t.toString(),activeCoordinate:w}))}finally{DJ=null,D0=null}};o?"raf"===n?DJ=requestAnimationFrame(s):"number"==typeof n&&null===D0&&(s(),D1=null,D0=setTimeout(()=>{D1?s():(D0=null,DJ=null)},n)):s()}}),DQ.startListening({actionCreator:DX,effect:(t,r)=>{var i=r.getState();if(!1!==i.rootProps.accessibilityLayer){var n=i.tooltip.keyboardInteraction;if(!n.active&&null==n.index){var a=CW(i,i.tooltip.settings.shared),o=M2(i,a,"hover",String("0"));r.dispatch(Ef({active:!0,activeIndex:"0",activeCoordinate:o}))}}}}),DQ.startListening({actionCreator:DK,effect:(t,r)=>{var i=r.getState();if(!1!==i.rootProps.accessibilityLayer){var n=i.tooltip.keyboardInteraction;n.active&&r.dispatch(Ef({active:!1,activeIndex:n.index,activeCoordinate:n.coordinate}))}}});var D3=xq("externalEvent"),D4=wE(),D6=new Map,D5=new Map,D8=new Map;D4.startListening({actionCreator:D3,effect:(t,r)=>{var i=t.payload,n=i.handler,a=i.reactEvent;if(null!=n){var o=a.type,s=D2(a);D8.set(o,{handler:n,reactEvent:s});var l=D6.get(o);void 0!==l&&(cancelAnimationFrame(l),D6.delete(o));var u=r.getState().eventSettings,c=u.throttleDelay,h=u.throttledEvents,f="all"===h||(null==h?void 0:h.includes(o)),d=D5.get(o);void 0===d||"number"==typeof c&&f||(clearTimeout(d),D5.delete(o));var p=()=>{var t=D8.get(o);try{if(!t)return;var i=t.handler,n=t.reactEvent,a=r.getState(),s={activeCoordinate:M$(a),activeDataKey:Mz(a),activeIndex:MF(a),activeLabel:MB(a),activeTooltipIndex:MF(a),isTooltipActive:MG(a)};i&&i(s,n)}finally{D6.delete(o),D5.delete(o),D8.delete(o)}};if(!f)return void p();if("raf"===c){var m=requestAnimationFrame(p);D6.set(o,m)}else if("number"==typeof c){if(!D5.has(o)){p();var g=setTimeout(p,c);D5.set(o,g)}}else p()}}});var D7=xk([C2],t=>t.tooltipItemPayloads),D9=xk([D7,(t,r)=>r,(t,r,i)=>i],(t,r,i)=>{if(null!=r){var n=t.find(t=>t.settings.graphicalItemId===i);if(null!=n){var a=n.getPosition;if(null!=a)return a(r)}}}),Pe=xq("touchMove"),Pt=wE(),Pr=null,Pi=null,Pn=null,Pa=null;Pt.startListening({actionCreator:Pe,effect:(t,r)=>{var i=t.payload;if(null!=i.touches&&0!==i.touches.length){Pa=D2(i);var n=r.getState().eventSettings,a=n.throttleDelay,o=n.throttledEvents,s="all"===o||o.includes("touchmove");null!==Pr&&(cancelAnimationFrame(Pr),Pr=null),null===Pi||"number"==typeof a&&s||(clearTimeout(Pi),Pi=null),Pn=Array.from(i.touches).map(t=>M7({clientX:t.clientX,clientY:t.clientY,currentTarget:i.currentTarget}));var l=()=>{if(null!=Pa){var t=r.getState(),i=CW(t,t.tooltip.settings.shared);if("axis"===i){var n,a=null==(n=Pn)?void 0:n[0];if(null==a){Pr=null,Pi=null;return}var o=M8(t,a);(null==o?void 0:o.activeIndex)!=null&&r.dispatch(Eu({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if("item"===i){var s,l=Pa.touches[0];if(null==document.elementFromPoint||null==l)return;var u=document.elementFromPoint(l.clientX,l.clientY);if(!u||!u.getAttribute)return;var c=u.getAttribute("data-recharts-item-index"),h=null!=(s=u.getAttribute("data-recharts-item-id"))?s:void 0,f=Me(t).find(t=>t.id===h);if(null==c||null==f||null==h)return;var d=f.dataKey,p=D9(t,c,h);r.dispatch(Ea({activeDataKey:d,activeIndex:c,activeCoordinate:p,activeGraphicalItemId:h}))}Pr=null,Pi=null}};if(!s)return void l();"raf"===a?Pr=requestAnimationFrame(l):"number"==typeof a&&null===Pi&&(l(),Pa=null,Pi=setTimeout(()=>{Pa?l():(Pi=null,Pr=null)},a))}}});
56var Po=x2({name:"errorBars",initialState:{},reducers:{addErrorBar:(t,r)=>{var i=r.payload,n=i.itemId,a=i.errorBar;t[n]||(t[n]=[]),t[n].push(a)},replaceErrorBar:(t,r)=>{var i=r.payload,n=i.itemId,a=i.prev,o=i.next;t[n]&&(t[n]=t[n].map(t=>t.dataKey===a.dataKey&&t.direction===a.direction?o:t))},removeErrorBar:(t,r)=>{var i=r.payload,n=i.itemId,a=i.errorBar;t[n]&&(t[n]=t[n].filter(t=>t.dataKey!==a.dataKey||t.direction!==a.direction))}}}),Ps=Po.actions;Ps.addErrorBar,Ps.replaceErrorBar,Ps.removeErrorBar;var Pl=Po.reducer,Pu={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Pc(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Ph(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Pc(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Pc(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}var Pf={zIndexMap:Object.values(Ab).reduce((t,r)=>Ph(Ph({},t),{},{[r]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Pd=new Set(Object.values(Ab)),Pp=x2({name:"zIndex",initialState:Pf,reducers:{registerZIndexPortal:{reducer:(t,r)=>{var i=r.payload.zIndex;t.zIndexMap[i]?t.zIndexMap[i].consumers+=1:t.zIndexMap[i]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:xX()},unregisterZIndexPortal:{reducer:(t,r)=>{var i=r.payload.zIndex;t.zIndexMap[i]&&(t.zIndexMap[i].consumers-=1,t.zIndexMap[i].consumers<=0&&!Pd.has(i)&&delete t.zIndexMap[i])},prepare:xX()},registerZIndexPortalElement:{reducer:(t,r)=>{var i=r.payload,n=i.zIndex,a=i.element,o=i.isPanorama;t.zIndexMap[n]?o?t.zIndexMap[n].panoramaElement=a:t.zIndexMap[n].element=a:t.zIndexMap[n]={consumers:0,element:o?void 0:a,panoramaElement:o?a:void 0}},prepare:xX()},unregisterZIndexPortalElement:{reducer:(t,r)=>{var i=r.payload.zIndex;t.zIndexMap[i]&&(r.payload.isPanorama?t.zIndexMap[i].panoramaElement=void 0:t.zIndexMap[i].element=void 0)},prepare:xX()}}}),Pm=Pp.actions,Pg=Pm.registerZIndexPortal,Py=Pm.unregisterZIndexPortal,Pv=Pm.registerZIndexPortalElement,P_=Pm.unregisterZIndexPortalElement,Pb=Pp.reducer,Px={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},Pw=x2({name:"eventSettings",initialState:Px,reducers:{setEventSettings:(t,r)=>{null!=r.payload.throttleDelay&&(t.throttleDelay=r.payload.throttleDelay),null!=r.payload.throttledEvents&&(t.throttledEvents=r.payload.throttledEvents)}}}),PE=Pw.actions.setEventSettings,PT=Pw.reducer,PA=x2({name:"renderedTicks",initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(t,r)=>{var i=r.payload,n=i.axisType,a=i.axisId,o=i.ticks;t[n][a]=o},removeRenderedTicks:(t,r)=>{var i=r.payload,n=i.axisType,a=i.axisId;delete t[n][a]}}}),PS=PA.actions,PC=PS.setRenderedTicks,PM=PS.removeRenderedTicks,PD=xz({brush:DO,cartesianAxis:D_,chartData:Ev,errorBars:Pl,eventSettings:PT,graphicalItems:DA,layout:EA,legend:Dz,options:wY,polarAxis:DH,polarOptions:DZ,referenceElements:DP,renderedTicks:PA.reducer,rootProps:DV,tooltip:Ed,zIndex:Pb}),PP=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart";return function(t){let r,i,n,a=function(t){let{thunk:r=!0,immutableCheck:i=!0,serializableCheck:n=!0,actionCreatorCheck:a=!0}=t??{},o=new xH;return r&&("boolean"==typeof r?o.push(x$):o.push(xV(r.extraArgument))),o},{reducer:o,middleware:s,devTools:l=!0,duplicateMiddlewareCheck:u=!0,preloadedState:c,enhancers:h}=t||{};if("function"==typeof o)r=o;else if(xB(o))r=xz(o);else throw Error(wT(1));i="function"==typeof s?s(a):a();let f=xj;l&&(f=xG({trace:!1,..."object"==typeof l&&l}));let d=(n=function(...t){return r=>(i,n)=>{let a=r(i,n),o=()=>{throw Error(xN(15))},s={getState:a.getState,dispatch:(t,...r)=>o(t,...r)};return o=xj(...t.map(t=>t(s)))(a.dispatch),{...a,dispatch:o}}}(...i),function(t){let{autoBatch:r=!0}=t??{},i=new xH(n);return r&&i.push(xQ("object"==typeof r?r:void 0)),i});return function t(r,i,n){if("function"!=typeof r)throw Error(xN(2));if("function"==typeof i&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw Error(xN(0));if("function"==typeof i&&void 0===n&&(n=i,i=void 0),void 0!==n){
56if("function"!=typeof n)throw Error(xN(1));return n(t)(r,i)}let a=r,o=i,s=new Map,l=s,u=0,c=!1;function h(){l===s&&(l=new Map,s.forEach((t,r)=>{l.set(r,t)}))}function f(){if(c)throw Error(xN(3));return o}function d(t){if("function"!=typeof t)throw Error(xN(4));if(c)throw Error(xN(5));let r=!0;h();let i=u++;return l.set(i,t),function(){if(r){if(c)throw Error(xN(6));r=!1,h(),l.delete(i),s=null}}}function p(t){if(!xB(t))throw Error(xN(7));if(void 0===t.type)throw Error(xN(8));if("string"!=typeof t.type)throw Error(xN(17));if(c)throw Error(xN(9));try{c=!0,o=a(o,t)}finally{c=!1}return(s=l).forEach(t=>{t()}),t}return p({type:xF.INIT}),{dispatch:p,subscribe:d,getState:f,replaceReducer:function(t){if("function"!=typeof t)throw Error(xN(10));a=t,p({type:xF.REPLACE})},[xL]:function(){return{subscribe(t){if("object"!=typeof t||null===t)throw Error(xN(11));function r(){t.next&&t.next(f())}return r(),{unsubscribe:d(r)}},[xL](){return this}}}}}(r,c,f(..."function"==typeof h?h(d):d()))}({reducer:PD,preloadedState:t,middleware:t=>t({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([De.middleware,Dr.middleware,DQ.middleware,D4.middleware,Pt.middleware]),enhancers:t=>{var r=t;return"function"==typeof t&&(r=t()),r.concat(xQ({type:"raf"}))},devTools:Pu.devToolsEnabled&&{serialize:{replacer:Do},name:"recharts-".concat(r)}})};function PI(t){var r=t.preloadedState,i=t.children,n=t.reduxStoreName,a=T_(),o=(0,ec.useRef)(null);return a?i:(null==o.current&&(o.current=PP(r,n)),ec.createElement(w6,{context:EC,store:o.current},i))}var Pk=t=>{var r=t.chartData,i=ED(),n=T_();return(0,ec.useEffect)(()=>n?()=>{}:(i(Eg(r)),()=>{i(Eg(void 0))}),[r,i,n]),null},PO=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function PN(t,r){for(var i of new Set([...Object.keys(t),...Object.keys(r)]))if(PO.has(i)){if(null==t[i]&&null==r[i])continue;if(!function(t,r){if(w1(t,r))return!0;if("object"!=typeof t||null===t||"object"!=typeof r||null===r)return!1;let i=Object.keys(t),n=Object.keys(r);if(i.length!==n.length)return!1;for(let n=0;n<i.length;n++)if(!Object.prototype.hasOwnProperty.call(r,i[n])||!w1(t[i[n]],r[i[n]]))return!1;return!0}(t[i],r[i]))return!1}else{var n,a;if(n=t[i],a=r[i],(null!=n||null!=a)&&("number"==typeof n&&"number"==typeof a?n!==a&&(n==n||a==a):n!==a))return!1}return!0}var PL=(0,ec.memo)(function(t){var r=t.layout,i=t.margin,n=ED(),a=T_();return(0,ec.useEffect)(()=>{a||(n(Ew(r)),n(Ex(i)))},[n,a,r,i]),null},PN);function PR(t){var r=ED();return(0,ec.useEffect)(()=>{r(D$(t))},[r,t]),null}var PF=(0,ec.memo)(t=>{var r=ED();return(0,ec.useEffect)(()=>{r(PE(t))},[r,t]),null},PN),PB=()=>{var t;return null==(t=EO(t=>t.rootProps.accessibilityLayer))||t},Pz=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdate
56Capture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Pj(t){return"string"==typeof t&&Pz.includes(t)}var PU=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"]);function PV(t){return"string"==typeof t&&PU.has(t)}function P$(t){return"string"==typeof t&&t.startsWith("data-")}function PG(t){if("object"!=typeof t||null===t)return{};var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(PV(i)||P$(i))&&(r[i]=t[i]);return r}function Pq(t){return null==t?null:(0,ec.isValidElement)(t)&&"object"==typeof t.props&&null!==t.props?PG(t.props):"object"!=typeof t||Array.isArray(t)?null:PG(t)}function PH(t){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(PV(i)||P$(i)||Pj(i))&&(r[i]=t[i]);return r}var PW=["children","width","height","viewBox","className","style","title","desc"];function PZ(){return(PZ=Object.assign.bind()).apply(null,arguments)}var PY=(0,ec.forwardRef)((t,r)=>{var i=t.children,n=t.width,a=t.height,o=t.viewBox,s=t.className,l=t.style,u=t.title,c=t.desc,h=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,PW),f=o||{width:n,height:a,x:0,y:0},d=(0,Tw.clsx)("recharts-surface",s);return ec.createElement("svg",PZ({},PH(h),{className:d,width:n,height:a,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:r}),ec.createElement("title",null,u),ec.createElement("desc",null,c),i)}),PX=xk(t=>t.zIndex.zIndexMap,(t,r)=>r,(t,r,i)=>i,(t,r,i)=>{if(null!=r){var n=t[r];
56if(null!=n)return i?n.panoramaElement:n.element}}),PK=xk(t=>t.zIndex.zIndexMap,t=>Array.from(new Set(Object.keys(t).map(t=>parseInt(t,10)).concat(Object.values(Ab)))).sort((t,r)=>t-r),{memoizeOptions:{resultEqualityCheck:function(t,r){if(t.length===r.length){for(var i=0;i<t.length;i++)if(t[i]!==r[i])return!1;return!0}return!1}}});function PQ(t){var r=t.zIndex,i=t.isPanorama,n=(0,ec.useRef)(null),a=ED();return(0,ec.useLayoutEffect)(()=>(n.current&&a(Pv({zIndex:r,element:n.current,isPanorama:i})),()=>{a(P_({zIndex:r,isPanorama:i}))}),[a,r,i]),ec.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(r)})}function PJ(t){var r=t.children,i=t.isPanorama,n=EO(PK);if(!n||0===n.length)return r;var a=n.filter(t=>t<0),o=n.filter(t=>t>0);return ec.createElement(ec.Fragment,null,a.map(t=>ec.createElement(PQ,{key:t,zIndex:t,isPanorama:i})),r,o.map(t=>ec.createElement(PQ,{key:t,zIndex:t,isPanorama:i})))}var P0=["children"];function P1(){return(P1=Object.assign.bind()).apply(null,arguments)}var P2={width:"100%",height:"100%",display:"block"},P3=(0,ec.forwardRef)((t,r)=>{var i,n,a=EO(Ts),o=EO(Tl),s=PB();if(!EJ(a)||!EJ(o))return null;var l=t.children,u=t.otherAttributes,c=t.title,h=t.desc;return null!=u&&(i="number"==typeof u.tabIndex?u.tabIndex:s?0:void 0,n="string"==typeof u.role?u.role:s?"application":void 0),ec.createElement(PY,P1({},u,{title:c,desc:h,role:n,tabIndex:i,width:a,height:o,style:P2,ref:r}),l)}),P4=t=>{var r=t.children,i=EO(Tx);if(!i)return null;var n=i.width,a=i.height,o=i.y,s=i.x;return ec.createElement(PY,{width:n,height:a,x:s,y:o},r)},P6=(0,ec.forwardRef)((t,r)=>{var i=t.children,n=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,P0);return T_()?ec.createElement(P4,null,ec.createElement(PJ,{isPanorama:!0},i)):ec.createElement(P3,P1({ref:r},n),ec.createElement(PJ,{isPanorama:!1},i))}),P5=new(t.i(478492)).default,P8="recharts.syncEvent.tooltip",P7="recharts.syncEvent.brush";function P9(t){return t.tooltip.syncInteraction}var Ie=["x","y"];function It(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Ir(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?It(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):It(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function Ii(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var In=(0,ec.createContext)(null),Ia=(0,ec.createContext)(null);function Io(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Is(){return(Is=Object.assign.bind()).apply(null,arguments)}function Il(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,o,s,l=[],u=!0,c=!1;try{if(o=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,a=t}
56finally{try{if(!u&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return Iu(t,r);var i=({}).toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Iu(t,r):void 0}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Iu(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var Ic=()=>{var t,r,i,n,a,o,s,l,u,c,h,f;return t=ED(),(0,ec.useEffect)(()=>{t(wX())},[t]),r=EO(Ad),i=EO(Am),n=ED(),a=EO(Ap),o=EO(Mk),s=EO(Tq),l=TV(),u=EO(t=>t.rootProps.className),(0,ec.useEffect)(()=>{if(null==r)return wH;var t=(t,u,c)=>{if(i!==c&&r===t){if(!1===u.payload.active)return void n(Eh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));if("index"===a){if(l&&null!=u&&null!=(h=u.payload)&&h.coordinate&&u.payload.sourceViewBox){var h,f,d=u.payload.coordinate,p=d.x,m=d.y,g=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(d,Ie),y=u.payload.sourceViewBox,v=y.x,_=y.y,b=y.width,x=y.height,w=Ir(Ir({},g),{},{x:l.x+(b?(p-v)/b:0)*l.width,y:l.y+(x?(m-_)/x:0)*l.height});n(Ir(Ir({},u),{},{payload:Ir(Ir({},u.payload),{},{coordinate:w})}))}else n(u);return}if(null!=o){if("function"==typeof a){var E=a(o,{activeTooltipIndex:null==u.payload.index?void 0:Number(u.payload.index),isTooltipActive:u.payload.active,activeIndex:null==u.payload.index?void 0:Number(u.payload.index),activeLabel:u.payload.label,activeDataKey:u.payload.dataKey,activeCoordinate:u.payload.coordinate});f=o[E]}else"value"===a&&(f=o.find(t=>String(t.value)===u.payload.label));var T=u.payload.coordinate;if(null==T||null==l)return void n(Eh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));if(null==f)return void n(Eh({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:u.payload.sourceViewBox,graphicalItemId:void 0}));var A=T.x,S=T.y,C=Math.min(A,l.x+l.width),M=Math.min(S,l.y+l.height),D={x:"horizontal"===s?f.coordinate:C,y:"horizontal"===s?M:f.coordinate};n(Eh({active:u.payload.active,coordinate:D,dataKey:u.payload.dataKey,index:String(f.index),label:u.payload.label,sourceViewBox:u.payload.sourceViewBox,graphicalItemId:u.payload.graphicalItemId}))}}};return P5.on(P8,t),()=>{P5.off(P8,t)}},[u,n,i,r,a,o,s,l]),c=EO(Ad),h=EO(Am),f=ED(),(0,ec.useEffect)(()=>{if(null==c)return wH;var t=(t,r,i)=>{h!==i&&c===t&&f(Ey(r))};return P5.on(P7,t),()=>{P5.off(P7,t)}},[f,h,c]),null};function Ih(t){if("number"==typeof t)return t;if("string"==typeof t){var r=parseFloat(t);if(!Number.isNaN(r))return r}return 0}var If=(0,ec.forwardRef)((t,r)=>{var i,n,a=(0,ec.useRef)(null),o=Il((0,ec.useState)({containerWidth:Ih(null==(i=t.style)?void 0:i.width),containerHeight:Ih(null==(n=t.style)?void 0:n.height)}),2),s=o[0],l=o[1],u=(0,ec.useCallback)((t,r)=>{l(i=>{var n=Math.round(t),a=Math.round(r);return i.containerWidth===n&&i.containerHeight===a?i:{containerWidth:n,containerHeight:a}})},[]),c=(0,ec.useCallback)(t=>{if("function"==typeof r&&r(t),null!=a.current&&(a.current.disconnect(),a.current=null),null!=t&&"u">typeof ResizeObserver){var i=t.getBoundingClientRect();u(i.width,i.height);var n=new ResizeObserver(t=>{var r=t[0];if(null!=r){var i=r.contentRect;u(i.width,i.height)}});n.observe(t),a.current=n}},[r,u]);return(0,ec.useEffect)(()=>()=>{var t=a.current;null!=t&&t.disconnect()},[u]),ec.createElement(ec.Fragment,null,ec.createElement(TZ,{width:s.containerWidth,height:s.containerHeight}),ec.createElement("div",Is({ref:c},t)))}),Id=(0,ec.forwardRef)((t,r)=>{var i=t.width,n=t.height,a=Il((0,ec.useState)({containerWidth:Ih(i),containerHeight:Ih(n)}),2),o=a[0],s=a[1],l=(0,ec.useCallback)((t,r)=>{s(i=>
56{var n=Math.round(t),a=Math.round(r);return i.containerWidth===n&&i.containerHeight===a?i:{containerWidth:n,containerHeight:a}})},[]),u=(0,ec.useCallback)(t=>{if("function"==typeof r&&r(t),null!=t){var i=t.getBoundingClientRect();l(i.width,i.height)}},[r,l]);return ec.createElement(ec.Fragment,null,ec.createElement(TZ,{width:o.containerWidth,height:o.containerHeight}),ec.createElement("div",Is({ref:u},t)))}),Ip=(0,ec.forwardRef)((t,r)=>{var i=t.width,n=t.height;return ec.createElement(ec.Fragment,null,ec.createElement(TZ,{width:i,height:n}),ec.createElement("div",Is({ref:r},t)))}),Im=(0,ec.forwardRef)((t,r)=>{var i=t.width,n=t.height;return"string"==typeof i||"string"==typeof n?ec.createElement(Id,Is({},t,{ref:r})):"number"==typeof i&&"number"==typeof n?ec.createElement(Ip,Is({},t,{width:i,height:n,ref:r})):ec.createElement(ec.Fragment,null,ec.createElement(TZ,{width:i,height:n}),ec.createElement("div",Is({ref:r},t)))}),Ig=(0,ec.forwardRef)((t,r)=>{var i,n,a,o,s,l,u=t.children,c=t.className,h=t.height,f=t.onClick,d=t.onContextMenu,p=t.onDoubleClick,m=t.onMouseDown,g=t.onMouseEnter,y=t.onMouseLeave,v=t.onMouseMove,_=t.onMouseUp,b=t.onTouchEnd,x=t.onTouchMove,w=t.onTouchStart,E=t.style,T=t.width,A=t.responsive,S=t.dispatchTouchEvents,C=void 0===S||S,M=(0,ec.useRef)(null),D=ED(),P=Il((0,ec.useState)(null),2),I=P[0],k=P[1],O=Il((0,ec.useState)(null),2),N=O[0],L=O[1],R=(i=ED(),o=(a=function(t){if(Array.isArray(t))return t}(n=(0,ec.useState)(null))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(n)||function(t){if(t){if("string"==typeof t)return Ii(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ii(t,2):void 0}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],s=a[1],l=EO(Tu),(0,ec.useEffect)(()=>{if(null!=o){var t=o.getBoundingClientRect().width/o.offsetWidth;EQ(t)&&t!==l&&i(ET(t))}},[o,i,l]),s),F=Tz(),B=(null==F?void 0:F.width)>0?F.width:T,z=(null==F?void 0:F.height)>0?F.height:h,j=(0,ec.useCallback)(t=>{R(t),"function"==typeof r&&r(t),k(t),L(t),null!=t&&(M.current=t)},[R,r,k,L]),U=(0,ec.useCallback)(t=>{D(M9(t)),D(D3({handler:f,reactEvent:t}))},[D,f]),V=(0,ec.useCallback)(t=>{D(Dt(t)),D(D3({handler:g,reactEvent:t}))},[D,g]),$=(0,ec.useCallback)(t=>{D(Es()),D(D3({handler:y,reactEvent:t}))},[D,y]),G=(0,ec.useCallback)(t=>{D(Dt(t)),D(D3({handler:v,reactEvent:t}))},[D,v]),q=(0,ec.useCallback)(()=>{D(DX())},[D]),H=(0,ec.useCallback)(()=>{D(DK())},[D]),W=(0,ec.useCallback)(t=>{D(DY(t.key))},[D]),Z=(0,ec.useCallback)(t=>{D(D3({handler:d,reactEvent:t}))},[D,d]),Y=(0,ec.useCallback)(t=>{D(D3({handler:p,reactEvent:t}))},[D,p]),X=(0,ec.useCallback)(t=>{D(D3({handler:m,reactEvent:t}))},[D,m]),K=(0,ec.useCallback)(t=>{D(D3({handler:_,reactEvent:t}))},[D,_]),Q=(0,ec.useCallback)(t=>{D(D3({handler:w,reactEvent:t}))},[D,w]),J=(0,ec.useCallback)(t=>{C&&D(Pe(t)),D(D3({handler:x,reactEvent:t}))},[D,C,x]),ee=(0,ec.useCallback)(t=>{D(D3({handler:b,reactEvent:t}))},[D,b]);return ec.createElement(In.Provider,{value:I},ec.createElement(Ia.Provider,{value:N},ec.createElement(A?If:Im,{width:null!=B?B:null==E?void 0:E.width,height:null!=z?z:null==E?void 0:E.height,className:(0,Tw.clsx)("recharts-wrapper",c),style:function(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Io(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}
56(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Io(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}({position:"relative",cursor:"default",width:B,height:z},E),onClick:U,onContextMenu:Z,onDoubleClick:Y,onFocus:q,onBlur:H,onKeyDown:W,onMouseDown:X,onMouseEnter:V,onMouseLeave:$,onMouseMove:G,onMouseUp:K,onTouchEnd:ee,onTouchMove:J,onTouchStart:Q,ref:j},ec.createElement(Ic,null),u)))}),Iy=xk([Tm],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),Iv=xk([Iy,Ts,Tl],(t,r,i)=>{if(t&&null!=r&&null!=i)return{x:t.left,y:t.top,width:Math.max(0,r-t.left-t.right),height:Math.max(0,i-t.top-t.bottom)}});function I_(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var Ib=(0,ec.createContext)(void 0),Ix=t=>{var r,i=t.children,n=(function(t){if(Array.isArray(t))return t}(r=(0,ec.useState)("".concat(wj("recharts"),"-clip")))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),1!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(r)||function(t){if(t){if("string"==typeof t)return I_(t,1);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I_(t,1):void 0}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],a=EO(Iv);if(null==a)return null;var o=a.x,s=a.y,l=a.width,u=a.height;return ec.createElement(Ib.Provider,{value:n},ec.createElement("defs",null,ec.createElement("clipPath",{id:n},ec.createElement("rect",{x:o,y:s,height:u,width:l}))),i)},Iw=["width","height","responsive","children","className","style","compact","title","desc"],IE=(0,ec.forwardRef)((t,r)=>{var i=t.width,n=t.height,a=t.responsive,o=t.children,s=t.className,l=t.style,u=t.compact,c=t.title,h=t.desc,f=PG(function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,Iw));return u?ec.createElement(ec.Fragment,null,ec.createElement(TZ,{width:i,height:n}),ec.createElement(P6,{otherAttributes:f,title:c,desc:h},o)):ec.createElement(Ig,{className:s,style:l,width:i,height:n,responsive:null!=a&&a,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},ec.createElement(P6,{otherAttributes:f,title:c,desc:h,ref:r},ec.createElement(Ix,null,o)))});function IT(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function IA(t,r){var i=function(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?IT(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):IT(Object(i)).forEac
56h(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}({},t);return Object.keys(r).reduce((t,i)=>(void 0===t[i]&&void 0!==r[i]&&(t[i]=r[i]),t),i)}function IS(){return(IS=Object.assign.bind()).apply(null,arguments)}function IC(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}var IM=function(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?IC(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):IC(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Px),ID=(0,ec.forwardRef)(function(t,r){var i,n=IA(t.categoricalChartProps,IM),a=t.chartName,o=t.defaultTooltipEventType,s=t.validateTooltipEventTypes,l=t.tooltipPayloadSearcher,u=t.categoricalChartProps;return ec.createElement(PI,{preloadedState:{options:{chartName:a,defaultTooltipEventType:o,validateTooltipEventTypes:s,tooltipPayloadSearcher:l,eventEmitter:void 0}},reduxStoreName:null!=(i=u.id)?i:a},ec.createElement(Pk,{chartData:u.data}),ec.createElement(PL,{layout:n.layout,margin:n.margin}),ec.createElement(PF,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),ec.createElement(PR,{baseValue:n.baseValue,accessibilityLayer:n.accessibilityLayer,barCategoryGap:n.barCategoryGap,maxBarSize:n.maxBarSize,stackOffset:n.stackOffset,barGap:n.barGap,barSize:n.barSize,syncId:n.syncId,syncMethod:n.syncMethod,className:n.className,reverseStackOrder:n.reverseStackOrder}),ec.createElement(IE,IS({},n,{ref:r})))}),IP=["axis","item"],II=(0,ec.forwardRef)((t,r)=>ec.createElement(ID,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:IP,tooltipPayloadSearcher:wW,categoricalChartProps:t,ref:r})),Ik=ec,IO=["children","className"];function IN(){return(IN=Object.assign.bind()).apply(null,arguments)}var IL=ec.forwardRef((t,r)=>{var i=t.children,n=t.className,a=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,IO),o=(0,Tw.clsx)("recharts-layer",n);return ec.createElement("g",IN({className:o},PH(a),{ref:r}),i)}),IR=t=>null;function IF(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}IR.displayName="Cell";var IB=function(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?IF(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):IF(Object(i)).forEac
56h(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}({},{cacheSize:2e3,enableCache:!0}),Iz=new class{constructor(t){!function(t,r,i){var n;(r="symbol"==typeof(n=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(r,"string"))?n:n+"")in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return void 0!==r&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var i=this.cache.keys().next().value;null!=i&&this.cache.delete(i)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}(IB.cacheSize),Ij={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},IU="recharts_measurement_span",IV=(t,r)=>{try{var i=document.getElementById(IU);i||((i=document.createElement("span")).setAttribute("id",IU),i.setAttribute("aria-hidden","true"),document.body.appendChild(i)),Object.assign(i.style,Ij,r),i.textContent="".concat(t);var n=i.getBoundingClientRect();return{width:n.width,height:n.height}}catch(t){return{width:0,height:0}}},I$=function(t){var r,i,n,a,o,s,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||Pu.isSsr)return{width:0,height:0};if(!IB.enableCache)return IV(t,l);var u=(r=l.fontSize||"",i=l.fontFamily||"",n=l.fontWeight||"",a=l.fontStyle||"",o=l.letterSpacing||"",s=l.textTransform||"","".concat(t,"|").concat(r,"|").concat(i,"|").concat(n,"|").concat(a,"|").concat(o,"|").concat(s)),c=Iz.get(u);if(c)return c;var h=IV(t,l);return Iz.set(u,h),h};function IG(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,o,s,l=[],u=!0,c=!1;try{if(o=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return Iq(t,r);var i=({}).toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Iq(t,r):void 0}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Iq(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var IH=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,IW=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,IZ=/^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/,IY=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,IX={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},IK=["cm","mm","pt","pc","in","Q","px"];class IQ{static parse(t){var r,i=IG(null!=(r=IY.exec(t))?r:[],3),n=i[1],a=i[2];return null==n?IQ.NaN:new IQ(parseFloat(n),null!=a?a:"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,wL(t)&&(this.unit=""),""===r||IZ.test(r)||(this.num=NaN,this.unit=""),function(t){return IK.includes(t)}(r)&&(this.num=function(t,r){return t*IX[r]}(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new IQ(NaN,""):new IQ(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new IQ(NaN,""):new IQ(this.num-t.num,this.unit)}multiply(t){return""!==this.unit&&""!==t.unit&&this.unit!==t.unit?new IQ(NaN,""):new IQ(this.num*t.num,this.unit||t.unit)}divide(t){return""!==this.unit&&""!==t.unit&&this.unit!==t.unit?new IQ(NaN,""):new IQ(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return wL(this.num)}}function IJ(t){if(null==t||t.includes("NaN"))return"NaN";for(var r=t;r.includes("*")||r.includes("/");){var i,n=IG(null!=(i=IH.exec(r))?i:[],4),a=n[1],o=n[2],s=n[3],l=IQ.parse(null!=a?a:""),u=IQ.parse(null!=s?s:""),c="*"===o?l.multiply(u):l.divi
56de(u);if(c.isNaN())return"NaN";r=r.replace(IH,c.toString())}for(;r.includes("+")||/.-\d+(?:\.\d+)?/.test(r);){var h,f=IG(null!=(h=IW.exec(r))?h:[],4),d=f[1],p=f[2],m=f[3],g=IQ.parse(null!=d?d:""),y=IQ.parse(null!=m?m:""),v="+"===p?g.add(y):g.subtract(y);if(v.isNaN())return"NaN";r=r.replace(IW,v.toString())}return r}S="NaN",C=new IQ(NaN,""),(S="symbol"==typeof(l=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(S,"string"))?l:l+"")in IQ?Object.defineProperty(IQ,S,{value:C,enumerable:!0,configurable:!0,writable:!0}):IQ[S]=C;var I0=/\(([^()]*)\)/;function I1(t){var r=function(t){try{var r;return r=t.replace(/\s+/g,""),r=function(t){for(var r,i=t;null!=(r=I0.exec(i));){var n=IG(r,2)[1];i=i.replace(I0,IJ(n))}return i}(r),r=IJ(r)}catch(t){return"NaN"}}(t.slice(5,-1));return"NaN"===r?"":r}var I2=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],I3=["dx","dy","angle","className","breakAll"];function I4(){return(I4=Object.assign.bind()).apply(null,arguments)}function I6(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}function I5(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,o,s,l=[],u=!0,c=!1;try{if(o=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return I8(t,r);var i=({}).toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?I8(t,r):void 0}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I8(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var I7=/[ \f\n\r\t\v\u2028\u2029]+/,I9=t=>{var r=t.children,i=t.breakAll,n=t.style;try{var a=[];null!=r&&(a=i?r.toString().split(""):r.toString().split(I7));var o=a.map(t=>({word:t,width:I$(t,n).width})),s=i?0:I$(" ",n).width;return{wordsWithComputedWidth:o,spaceWidth:s}}catch(t){return null}};function ke(t){return"start"===t||"middle"===t||"end"===t||"inherit"===t}var kt=(t,r,i,n)=>t.reduce((t,a)=>{var o=a.word,s=a.width,l=t[t.length-1];return l&&null!=s&&(null==r||n||l.width+s+i<Number(r))?(l.words.push(o),l.width+=s+i):t.push({words:[o],width:s}),t},[]),kr=t=>t.reduce((t,r)=>t.width>r.width?t:r),ki=(t,r,i,n,a,o,s,l)=>{var u=I9({breakAll:i,style:n,children:t.slice(0,r)+"â¦"});if(!u)return[!1,[]];var c=kt(u.wordsWithComputedWidth,o,s,l);return[c.length>a||kr(c).width>Number(o),c]},kn=t=>[{words:null==t?[]:t.toString().split(I7),width:void 0}],ka="#808080",ko={angle:0,breakAll:!1,capHeight:"0.71em",fill:ka,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},ks=(0,ec.forwardRef)((t,r)=>{var i,n=IA(t,ko),a=n.x,o=n.y,s=n.lineHeight,l=n.capHeight,u=n.fill,c=n.scaleToFit,h=n.textAnchor,f=n.verticalAnchor,d=I6(n,I2),p=(0,ec.useMemo)(()=>(t=>{var r=t.width,i=t.scaleToFit,n=t.children,a=t.style,o=t.breakAll,s=t.maxLines;if((r||i)&&!Pu.isSsr){var l=I9({breakAll:o,children:n,style:a});if(!l)return kn(n);var u=l.wordsWithComputedWidth,c=l.spaceWidth;return((t,r,i,n,a)=>{var o,s=t.maxLines,l=t.children,u=t.style,c=t.breakAll,h=wF(s),f=String(l),d=kt(r,n,i,a);if(!h||a||!(d.length>s||kr(d).width>Number(n)))return d;for(var p=0,m=f.length-1,g=0;p<=m&&g<=f.length-1;){var y=Math.floor((p+m)/2),v=I5(ki(f,y-1,c,u,s,n,i,a),2),_=v[0],b=v[1],x=I5(ki(f,y,c,u,s,n,i,a),1)[0];if(_||x||(p=y+1),_&&x&&(m=y-1),!_&&x){o=b;break}g++}return o||d})({breakAll:o,children:n,maxLines:s,style:a},u,c,r,!!i)}return kn(n)})({breakAll:d.breakAll,children:d.children,maxLines:d.maxLines,scaleToFit:c,style:d.style,width:d.width}),[d.breakAll,d.children,d.maxLines,c,d.style,d.width]),m=d.dx,g=d.dy,y=d.angle,v=d.className,_=d.breakAll,b=I6(d,I3);if(!wB(a)||!wB(o)||0===p.length)return null;var x=Number(a)+(wF(m)?m:0),w=Number(o)+(wF(g)?g:0);if(!EQ(x)||!EQ(w))return null;switch(f){case"start":i=I1("calc(".concat(l,")"));break;case"middle":i=I1("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(l," / 2))"));break;default:i=I1("calc(".concat(p.length-1," * -").concat(s,")"))}var E=[],T=p[0];if(c&&null!=T){var A=T.width,S=d.width;E.push("scale(".concat(wF(S)&&wF(A)?S/A:1,")"))}return y&&E.push("rotate(".concat(y,", ").concat(x,", ").concat(w,")")),E.length&&(b.transform=E.join(" ")),ec.createElement("text",I4({},PH(b),{ref:r,x:x,y:w,className:(0,Tw.clsx)("recharts-text",v),textAnchor:h,fill:u.includes("url")?ka:u}),p.map((t,r)=>
56{var n=t.words.join(_?"":" ");return ec.createElement("tspan",{x:x,dy:0===r?i:s,key:"".concat(n,"-").concat(r)},n)}))});ks.displayName="Text";var kl=t.i(174080);function ku(t){var r=t.zIndex,i=t.children,n=void 0!==EO(Tq)&&void 0!==r&&0!==r,a=T_(),o=(0,ec.useRef)(void 0),s=(0,ec.useRef)(new Set),l=ED(),u=EO(t=>PX(t,r,a));if((0,ec.useLayoutEffect)(()=>{if(!n){var t=s.current;t.forEach(t=>{l(Py({zIndex:t}))}),t.clear(),o.current=void 0;return}if(s.current.has(r)||(l(Pg({zIndex:r})),s.current.add(r)),u){o.current=u;var i=s.current;i.forEach(t=>{t!==r&&(l(Py({zIndex:t})),i.delete(t))})}},[l,r,n,u]),(0,ec.useLayoutEffect)(()=>{var t=s.current;return()=>{t.forEach(t=>{l(Py({zIndex:t}))}),t.clear()}},[l]),!n)return i;var c=null!=u?u:o.current;return c?(0,kl.createPortal)(i,c):null}var kc=["labelRef"],kh=["content"];function kf(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}function kd(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function kp(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?kd(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):kd(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function km(){return(km=Object.assign.bind()).apply(null,arguments)}var kg=(0,ec.createContext)(null),ky=t=>{var r=t.x,i=t.y,n=t.upperWidth,a=t.lowerWidth,o=t.width,s=t.height,l=t.children,u=(0,ec.useMemo)(()=>({x:r,y:i,upperWidth:n,lowerWidth:a,width:o,height:s}),[r,i,n,a,o,s]);return ec.createElement(kg.Provider,{value:u},l)},kv=()=>{var t=(0,ec.useContext)(kg),r=TV();return t||(r?E0(r):void 0)},k_=(0,ec.createContext)(null),kb=t=>null!=t&&"function"==typeof t,kx=t=>null!=t&&"cx"in t&&wF(t.cx),kw={angle:0,offset:5,zIndex:Ab.label,position:"middle",textBreakAll:!1};function kE(t){var r,i,n,a,o,s,l,u,c,h,f=IA(t,kw),d=f.viewBox,p=f.parentViewBox,m=f.position,g=f.value,y=f.children,v=f.content,_=f.className,b=f.textBreakAll,x=f.labelRef,w=(r=(0,ec.useContext)(k_),i=EO(AF),r||i),E=kv(),T=function(t){if(!kx(t))return t;var r=t.cx,i=t.cy,n=t.outerRadius,a=2*n;return{x:r-n,y:i-n,width:a,upperWidth:a,lowerWidth:a,height:a}}(u=null==d?"center"===m?E:null!=w?w:E:kx(d)?d:E0(d));if(!u||null==g&&null==y&&!(0,ec.isValidElement)(v)&&"function"!=typeof v)return null;var A=kx(u)&&("insideStart"===m||"insideEnd"===m||"end"===m);if(kx(u))A||(h=((t,r,i)=>{var n=t.cx,a=t.cy,o=t.innerRadius,s=t.outerRadius,l=(t.startAngle+t.endAngle)/2;if("outside"===i){var u=A_(n,a,s+r,l),c=u.x;return{x:c,y:u.y,textAnchor:c>=n?"start":"end",verticalAnchor:"middle"}}if("center"===i)return{x:n,y:a,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===i)return{x:n,y:a,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===i)return{x:n,y:a,textAnchor:"middle",verticalAnchor:"end"};var h=A_(n,a,(o+s)/2,l);return{x:h.x,y:h.y,textAnchor:"middle",verticalAnchor:"middle"}})(u,f.offset,f.position));else if(T){var S=(t=>{var r=t.viewBox,i=t.position,n=t.offset,a=void 0===n?0:n,o=t.parentViewBox,s=t.clamp,l=E0(r),u=l.x,c=l.y,h=l.height,f=l.upperWidth,d=l.lowerWidth,p=u+(f-d)/2,m=(u+p)/2,g=(f+d)/2,y=h>=0?1:-1,v=y*a,_=y>0?"end":"start",b=y>0?"start":"end",x=f>=0?1:-1,w=x*a,E=x>0?"end":"start",T=x>0?"start":"end";if("top"===i){var A={x:u+f/2,y:c-v,horizontalAnchor:"middle",verticalAnchor:_};return s&&o&&(A.height=Math.max(c-o.y,0),A.width=f),A}if("bottom"===i){var S={x:p+d/2,y:c+h+v,horizontalAnchor:"middle",verticalAnchor:b};return s&&o&&(S.height=Math.max(o.y+o.height-(c+h),0),S.width=d),S}if("left"===i){var C={x:m-w,y:c+h/2,horizontalAnchor:E,verticalAnchor:"middle"};return s&&o&&(C.width=Math.max(C.x-o.x,0),C.height=h),C}if("right"===i){var M={x:m+g+w,y:c+h/2,horizontalAnchor:T,verticalAnchor:"middle"};return s&&o&&(M.width=Math.max(o.x+o.width-M.x,0),M.height=h),M}var D=s&&o?{width:g,height:h}:{};return"insideLeft"===i?E2({x:m+w,y:c+h/2,horizontalAnchor:T,verticalAnchor:"middle"},D):"insideRight"===i?E2({x:m+g-w,y:c+h/2,horizontalAnchor:E,verticalAnchor:"middle"},D):"insideTop"===i?E2({x:u+f/2,y:c+v,horizontalAnchor:"middle",verticalAnchor:b},D):"insideBottom"===i?E2({x:p+d/2,y:c+h-v,horizontalAnchor:"middle",verticalAnchor:_},D):"insideTopLeft"===i?E2({x:u+w,y:c+v,horizontalAnchor:T,verticalAnchor:b},D):"insideTopRight"===i?E2({x:u+f-w,y:c+v,horizontalAnchor:E,verticalAnchor:b},D):"insideBottomLeft"===i?E2({x:p+w,y:c+h-v,horizontalAnchor:T,verticalAnchor:_},D):"insideBottomRight"===i?E2({x:p+d-w,y:c+h-v,horizontalAnchor:E,verticalAnchor:_},D):i&&"object"==typeof i&&(wF(i.x)||wR(i.x))&&(wF(i.y)||wR(i.y))?E2({x:u+wU(i.x,g),y:c+wU(i.y,h),horizontalAnchor:"end",verticalAnchor:"end"},D):E2({x:u+f/2,y:c+h/2,horizontalAnchor:"middle",verticalAnchor:"middle"},D)})({viewBox:T,position:m,offset:f.offset,parentViewBox:kx(p)?void 0:p,clamp:!0});h=kp(kp({x:S.x,y:S.y,textAnchor:S.horizontalAnchor,verticalAnchor:S.verticalAnchor},void 0!==S.width?{width:S.width}:{}),void 0!==S.height?{height:S.height}:{})}var C=kp(kp(kp(kp({},(null==(s=h)?void 0:s.x)!==void 0?{x:h.x}:{}),(null==(l=h)?void 0:l.y)!==void 0?{y:h.y}:{}),f),{},{viewBox:u});if((0,ec.isValidElement)(v)){C.labelRef;var M=kf(C,kc);return(0,ec.cloneElement)(v,M)}if("function"==typeof v){C.content;var D=kf(C,kh);if(c=(0,ec.createElement)(v,D),(0,ec.isValidElement)(c))return c}else n=f.value,a=f.formatter,o=null==f.children?n:f.children,c="function"==typeof a?a(o):o;var P=PH(f);return A&&kx(u)?((t,r,i,n,a)=>{var o,s,l=t.offset,u=t.className,c=a.cx,h=a.cy,f=a.innerRadius,d=a.outerRadius,p=a.startAngle,m=a.endAngle,g=a.clockWise,y=(f+d)/2,v=wN(m-p)*Math.min(Math.abs(m-p),360),_=v>=0?1:-1;switch(r){case"insideStart":o=p+_*l,s=g;break;case"insideEnd":o=m-_*l,s=!g;break;case"end":o=m+_*l,s=g;break;default:throw Error("Unsupported position ".concat(r))}s=v<=0?s:!s;var b=A_(c,h,y,o),x=A_(c,h,y,o+(s?1:-1)*359),w="M".concat(b.x,",").concat(b.y,"\n A").concat(y,",").concat(y,",0,1,").concat(+!s,",\n ").concat(x.x,",").concat(x.y),E=null==t.id?wj("recharts-radial-line-"):t.id;return ec.createElement("text",km({},n,{dominantBaseline:"central",className:(0,Tw.clsx)("recharts-radial-bar-label",u)}),ec.createElement("defs",null,ec.createElement("path",{id:E,d:w})),ec.createElement("textPath",{xlinkHref:"#".concat(E)},i))})(f,m,c,P,u):null==h?null:ec.createElement(ku,{zIndex:f.zIndex},ec.createElement(ks,km({ref:x,className:(0,Tw.clsx)("recharts-label",void 0===_?"":_)},P,h,{textAnchor:ke(P.textAnchor)?P.textAnchor:h.textAnchor,breakAll:b}),c))}function kT(t){var r=t.label,i=t.labelRef;return((t,r,i)=>{if(!t)return null;var n={viewBox:r,labelRef:i};return!0===t?ec.createElement(kE,km({key:"label-implicit"},n)):wB(t)?ec.createElement(kE,km({key:"label-implicit",value:t},n)):(0,ec.isValidElement)(t)?t.type===kE?(0,ec.cloneElement)(t,kp({key:"label-implicit"},n)):ec.createElement(kE,km({key:"label-implicit",content:t},n)):kb(t)?ec.createElement(kE,km({key:"label-implicit",content:t},n)):t&&"object"==typeof t?ec.createElement(kE,km({},t,{key:"label-implicit"},n)):null})(r,kv(),i)||null}kE.displayName="Label";var kA=["valueAccessor"],kS=["dataKey","clockWise","id","textBreakAll","zIndex"];function kC(){return(kC=Object.assign.bind()).apply(null,arguments)}function kM(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}var kD=t=>{var r=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(null==r||"string"==typeof r||"number"==typeof r||"boolean"==typeof r)return r},kP=(0,ec.createContext)(void 0),kI=kP.Provider,kk=(0,ec.createContext)(void 0);function kO(t){var r=t.valueAccessor,i=void 0===r?kD:r,n=kM(t,kA),a=n.dataKey,o=(n.clockWise,n.id),s=n.textBreakAll,l=n.zIndex,u=kM(n,kS),c=(0,ec.useContext)(kP),h=(0,ec.useContext)(kk),f=c||h;return f&&f.length?ec.createElement(ku,{zIndex:null!=l?l:Ab.label},ec.createElement(IL,{className:"recharts-label-list"},f.map((t,r)=>{var l,c=null==a?i(t,r):E5(t.payload,a),h=null==o?{}:{id:"".concat(o,"-").concat(r)};return ec.createElement(kE,kC({key:"label-".concat(r)},PH(t),u,h,{fill:null!=(l=n.fill)?l:t.fill,parentViewBox:t.parentViewBox,value:c,textBreakAll:s,viewBox:t.viewBox,index:r,zIndex:0}))}))):null}function kN(t){var r=t.label;return r?!0===r?ec.createElement(kO,{key:"labelList-implicit"}):ec.isValidElement(r)||kb(r)?ec.createElement(kO,{key:"labelList-implicit",content:r}):"object"==typeof r?ec.createElement(kO,kC({key:"labelList-implicit"},r,{type:String(r.type)})):null:null}kk.Provider,kO.displayName="LabelList";var kL=t.i(179684),kR=t=>
56"string"==typeof t?t:t?t.displayName||t.name||"Component":"",kF=null,kB=null,kz=t=>{if(t===kF&&Array.isArray(kB))return kB;var r=[];return ec.Children.forEach(t,t=>{null!=t&&((0,kL.isFragment)(t)?r=r.concat(kz(t.props.children)):r.push(t))}),kB=r,kF=t,r},kj=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,kU=(t,r,i)=>{if(null===t||"object"!=typeof t&&"function"!=typeof t)return null;var n=null;return Object.keys(t).forEach(a=>{var o=t[a];Pj(a)&&"function"==typeof o&&(n||(n={}),n[a]=t=>(o(r,i,t),null))}),n},kV=(t,r)=>[0,3*t,3*r-6*t,3*t-3*r+1],k$=(t,r)=>t.map((t,i)=>t*r**i).reduce((t,r)=>t+r),kG=(t,r)=>i=>k$(kV(t,r),i),kq=function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];if(1===r.length)switch(r[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:var n=(t=>{var r,i=t.split("(");if(2!==i.length||"cubic-bezier"!==i[0])return null;var n=null==(r=i[1])||null==(r=r.split(")")[0])?void 0:r.split(",");if(null==n||4!==n.length)return null;var a=n.map(t=>parseFloat(t));return[a[0],a[1],a[2],a[3]]})(r[0]);if(n)return n}return 4===r.length?r:[0,0,1,1]},kH=function(){return((t,r,i,n)=>{var a=kG(t,i),o=kG(r,n),s=r=>k$([...kV(t,i).map((t,r)=>t*r).slice(1),0],r),l=t=>t>1?1:t<0?0:t,u=t=>{for(var r=t>1?1:t,i=r,n=0;n<8;++n){var u=a(i)-r,c=s(i);if(1e-4>Math.abs(u-r)||c<1e-4)break;i=l(i-u/c)}return o(i)};return u.isStepper=!1,u})(...kq(...arguments))},kW=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.stiff,i=void 0===r?100:r,n=t.damping,a=void 0===n?8:n,o=t.dt,s=void 0===o?16.67:o,l=[0],u=0,c=0,h=0;h<1e4;){var f=c*a;if(c+=(-(u-1)*i-f)*s/1e3,u+=c*s/1e3,l.push(u),1e-4>Math.abs(u-1)&&1e-4>Math.abs(c))break;h++}l[l.length-1]=1;var d=l.length-1;return t=>{if(t<=0)return 0;if(t>=1)return 1;var r,i,n,a=t*d,o=Math.floor(a);return(null!=(r=l[o])?r:0)+((null!=(i=l[o+1])?i:0)-(null!=(n=l[o])?n:0))*(a-o)}},kZ=(0,ec.createContext)((t,r,i)=>{var n,a=o=>{var s=r.tick(o);if("active"===r.getState()){if(i(r.getInterpolated()),1===r.getProgress()){r.complete(),n=void 0;return}n=t.setTimeout(a,s);return}n=t.setTimeout(a,s)};return n=t.setTimeout(a,0),()=>{var t;return null==(t=n)?void 0:t()}});function kY(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function kX(){var t,r=function(t){if(Array.isArray(t))return t}(t=(0,ec.useState)(()=>!Pu.isSsr&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(t)||function(t){if(t){if("string"==typeof t)return kY(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kY(t,2):void 0}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=r[0],n=r[1];return(0,ec.useEffect)(()=>{if(window.matchMedia){var t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=()=>{n(t.matches)};return t.addEventListener("change",r),()=>{t.removeEventListener("change",r)}}},[]),i}kZ.Provider;var kK="init",kQ="pending",kJ="active";function k0(t){return Math.max(0,t)}class k1{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(t){var r;!function(t,r,i){var n;(r="symbol"==typeof(n=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(r,"string"))?n:n+"")in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}(this,"state",kK),this.animationId=t.animationId,this.onAnimationEnd=t.onAnimationEnd,this.animationDuration=k0(t.animationDuration),this.animationBegin=k0(t.animationBegin),this.progress=0,this.from=t.from,this.to=t.to,this.easing=t.easing,null==(r=t.onAnimationStart)||r.call(t)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(t){if(this.getState()===kK)return this.state=kQ,this.beginStartedTime=t,this.animationBegin;if(this.getState()===kQ){if(null==this.beginStartedTime)throw Error();var r=t-this.beginStartedTime;return r>=this.animationBegin?(this.state=kJ,this.animationStartedTime=t,this.nextAnimationUpdate(0)):k0(this.animationBegin-r)}if(this.getState()===kJ){if(null==this.animationStartedTime)throw Error();var i=t-this.animationStartedTime;return this.setProgress(i/this.animationDuration),this.nextAnimationUpdate(i)}return 0}setProgress(t){this.progress=Math.min(1,Math.max(0,t))}getProgress(){return this.progress}complete(){if(this.progress=1,"active"===this.state){var t;null==(t=this.onAnimationEnd)||t.call(this)}this.state="completed"}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class k2 extends k1{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(w$(this.getFrom(),this.getTo(),this.getProgress()))}}class k3{setTimeout(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=performance.now(),n=null,a=o=>{o-i>=r?t(o):n=requestAnimationFrame(a)};return n=requestAnimationFrame(a),()=>{null!=n&&cancelAnimationFrame(n)}}}function k4(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var k6={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}};function k5(t){var r,i,n,a=IA(t,k6),o=a.animationId,s=a.isActive,l=a.canBegin,u=a.duration,c=a.easing,h=a.begin,f=a.onAnimationEnd,d=a.onAnimationStart,p=a.children,m=kX(),g="auto"===s?!Pu.isSsr&&!m:s,y=(r=a.animationController,i=(0,ec.useContext)(kZ),(0,ec.useMemo)(()=>null!=r?r:i,[r,i])),v=function(t){if(Array.isArray(t))return t}(n=(0,ec.useState)(+!g))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}
56finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(n)||function(t){if(t){if("string"==typeof t)return k4(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k4(t,2):void 0}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),_=v[0],b=v[1];return(0,ec.useEffect)(()=>{g||b(1)},[g]),(0,ec.useEffect)(()=>{var t=(t=>{if("string"==typeof t)switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return kH(t);case"spring":return kW();default:if("cubic-bezier"===t.split("(")[0])return kH(t)}return"function"==typeof t?t:null})(c);return g&&l&&null!=t?y(new k3,new k2({animationId:o,easing:t,animationDuration:u,animationBegin:h,onAnimationStart:d,onAnimationEnd:f,from:0,to:1}),b):wH},[y,o,g,l,u,c,h,d,f]),p(Number(_))}function k8(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",i=(0,ec.useRef)(wj(r)),n=(0,ec.useRef)(t);return n.current!==t&&(i.current=wj(r),n.current=t),i.current}var k7=["radius"],k9=["radius"];function Oe(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Ot(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Oe(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Oe(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function Or(){return(Or=Object.assign.bind()).apply(null,arguments)}function Oi(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}function On(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function Oa(t,r){return r||(r=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))}var Oo=(t,r,i,n,a)=>{var o=wk(i),s=wk(n),l=Math.min(Math.abs(o)/2,Math.abs(s)/2),u=s>=0?1:-1,c=o>=0?1:-1,h=+(s>=0&&o>=0||s<0&&o<0);if(l>0&&Array.isArray(a)){for(var f=[0,0,0,0],d=0;d<4;d++){var p,m,g=null!=(m=a[d])?m:0;f[d]=g>l?l:g}p=wO(q||(q=Oa(["M",",",""])),t,r+u*f[0]),f[0]>0&&(p+=wO(H||(H=Oa(["A ",",",",0,0,",",",",",""])),f[0],f[0],h,t+c*f[0],r)),p+=wO(W||(W=Oa(["L ",",",""])),t+i-c*f[1],r),f[1]>0&&(p+=wO(Z||(Z=Oa(["A ",",",",0,0,",",\n ",",",""])),f[1],f[1],h,t+i,r+u*f[1])),p+=wO(Y||(Y=Oa(["L ",",",""])),t+i,r+n-u*f[2]),f[2]>0&&(p+=wO(X||(X=Oa(["A ",",",",0,0,",",\n ",",",""])),f[2],f[2],h,t+i-c*f[2],r+n)),p+=wO(K||(K=Oa(["L ",",",""])),t+c*f[3],r+n),f[3]>0&&(p+=wO(Q||(Q=Oa(["A ",",",",0,0,",",\n ",",",""])),f[3],f[3],h,t,r+n-u*f[3])),p+="Z"}else if(l>0&&a===+a&&a>0){var y=Math.min(l,a);p=wO(J||(J=Oa(["M ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",","," Z"])),t,r+u*y,y,y,h,t+c*y,r,t+i-c*y,r,y,y,h,t+i,r+u*y,t+i,r+n-u*y,y,y,h,t+i-c*y,r+n,t+c*y,r+n,y,y,h,t,r+n-u*y)}else p=wO(ee||(ee=Oa(["M ",","," h "," v "," h "," Z"])),t,r,i,n,-i);return p},Os={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Ol=t=>{let r,i;
56var n,a=IA(t,Os),o=(0,ec.useRef)(null),s=function(t){if(Array.isArray(t))return t}(n=(0,ec.useState)(-1))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(n)||function(t){if(t){if("string"==typeof t)return On(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?On(t,2):void 0}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=s[0],u=s[1];(0,ec.useEffect)(()=>{if(o.current&&o.current.getTotalLength)try{var t=o.current.getTotalLength();t&&u(t)}catch(t){}},[]);var c=a.x,h=a.y,f=a.width,d=a.height,p=a.radius,m=a.className,g=a.animationEasing,y=a.animationDuration,v=a.animationBegin,_=a.isAnimationActive,b=a.isUpdateAnimationActive,x=(0,ec.useRef)(f),w=(0,ec.useRef)(d),E=(0,ec.useRef)(c),T=(0,ec.useRef)(h),A=k8((0,ec.useMemo)(()=>({x:c,y:h,width:f,height:d,radius:p}),[c,h,f,d,p]),"rectangle-");if(c!==+c||h!==+h||f!==+f||d!==+d||0===f||0===d)return null;var S=(0,Tw.clsx)("recharts-rectangle",m);if(!b){var C=PH(a),M=(C.radius,Oi(C,k7));return ec.createElement("path",Or({},M,{x:wk(c),y:wk(h),width:wk(f),height:wk(d),radius:"number"==typeof p?p:void 0,className:S,d:Oo(c,h,f,d,p)}))}var D=x.current,P=w.current,I=E.current,k=T.current,O="0px ".concat(-1===l?1:l,"px"),N="".concat(l,"px ").concat(l,"px"),L=(r=["strokeDasharray"],i="string"==typeof g?g:Os.animationEasing,r.map(t=>"".concat(t.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase()))," ").concat(y,"ms ").concat(i)).join(","));return ec.createElement(k5,{animationId:A,key:A,canBegin:l>0,duration:y,easing:g,isActive:b,begin:v},t=>{var r,i=w$(D,f,t),n=w$(P,d,t),s=w$(I,c,t),l=w$(k,h,t);o.current&&(x.current=i,w.current=n,E.current=s,T.current=l),r=_?t>0?{transition:L,strokeDasharray:N}:{strokeDasharray:O}:{strokeDasharray:N};var u=PH(a),m=(u.radius,Oi(u,k9));return ec.createElement("path",Or({},m,{radius:"number"==typeof p?p:void 0,className:S,d:Oo(s,l,i,n,p),ref:o,style:Ot(Ot({},r),a.style)}))})};function Ou(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Oc(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Ou(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ou(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function Oh(t){var r,i,n=t.option,a=t.DefaultShape,o=t.shapeProps,s=t.activeClassName,l=t.inActiveClassName,u=function(t){if("index"in t){var r=t.index;return"number"==typeof r||"string"==typeof r?r:void 0}}(o);return i=(0,ec.isValidElement)(n)?(0,ec.cloneElement)(n,(r=(0,ec.isValidElement)(n)?n.props:n,Oc(Oc({},o),r))):n===a?ec.createElement(a,o):"function"==typeof n?n(o,u):"object"==typeof n?ec.createElement(a,Oc(Oc({},o),n)):ec.createElement(a,o),"isActive"in o&&!0===o.isActive?ec.createElement(IL,{className:void 0===s?"recharts-active-shape":s},i):ec.createElement(IL,{className:void 0===l?"recharts-shape":l},i)}var Of=["option"];function Od(t){var r=t.option,i=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,Of);return ec.createElement(Oh,{option:r,DefaultShape:Ol,shapeProps:i,activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"})}var Op=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(i,n)=>{if(wF(t))return t;var a=wF(i)||null==i;return a?t(i,n):(a||function(t,r){if(!t)throw Error("Invariant failed")}(!1,"minPointSize callback function received a value with type of ".concat(typeof i,". Currently only numbers or null/undefined are supported.")),r)}},Om=(t,r,i)=>{var n=ED();return(a,o)=>s=>{null==t||t(a,o,s),n(Ea({activeIndex:String(o),activeDataKey:r,activeCoordinate:a.tooltipPosition,activeGraphicalItemId:i}))}},Og=t=>{var r=ED();return(i,n)=>a=>{null==t||t(i,n,a),r(Eo())}},Oy=(t,r,i)=>{var n=ED();return(a,o)=>s=>{null==t||t(a,o,s),n(El({activeIndex:String(o),activeDataKey:r,activeCoordinate:a.tooltipPosition,activeGraphicalItemId:i}))}};function Ov(t){var r=t.tooltipEntrySettings,i=ED(),n=T_(),a=(0,ec.useRef)(null);return(0,ec.useLayoutEffect)(()=>{n||(null===a.current?i(Et(r)):a.current!==r&&i(Er({prev:a.current,next:r})),a.current=r)},[r,i,n]),(0,ec.useLayoutEffect)(()=>()=>{a.current&&(i(Ei(a.current)),a.current=null)},[i]),null}var O_=["children"],Ob=(0,ec.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function Ox(t){var r=t.children,i=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,O_);return ec.createElement(Ob.Provider,{value:i},r)}function Ow(t,r){var i,n,a=EO(r=>Sr(r,t)),o=EO(t=>Sa(t,r)),s=null!=(i=null==a?void 0:a.allowDataOverflow)?i:Se.allowDataOverflow,l=null!=(n=null==o?void 0:o.allowDataOverflow)?n:Si.allowDataOverflow;return{needClip:s||l,needClipX:s,needClipY:l}}function OE(t){var r=t.xAxisId,i=t.yAxisId,n=t.clipPathId,a=EO(Iv),o=Ow(r,i),s=o.needClipX,l=o.needClipY,u=o.needClip,c=EO(t=>Cd(t,r,!1)),h=EO(t=>Cp(t,i,!1));if(!u||!a)return null;var f=a.x,d=a.y,p=a.width,m=a.height,g=s&&c?Math.min(c[0],c[1]):f-p/2,y=l&&h?Math.min(h[0],h[1]):d-m/2,v=s&&
56c?Math.abs(c[1]-c[0]):2*p,_=l&&h?Math.abs(h[1]-h[0]):2*m;return ec.createElement("clipPath",{id:"clipPath-".concat(n)},ec.createElement("rect",{x:g,y:y,width:v,height:_}))}function OT(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var OA=(t,r,i)=>{var n=null!=i?i:t;if(null!=n)return wU(n,r,0)};function OS(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function OC(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?OS(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):OS(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function OM(t,r){var i,n;return null!=(i=null==(n=t.graphicalItems.cartesianItems.find(t=>t.id===r))?void 0:n.xAxisId)?i:0}function OD(t,r){var i,n;return null!=(i=null==(n=t.graphicalItems.cartesianItems.find(t=>t.id===r))?void 0:n.yAxisId)?i:0}var OP=xk([Sf,(t,r)=>r],(t,r)=>t.filter(t=>"bar"===t.type).find(t=>t.id===r)),OI=xk([OP],t=>null==t?void 0:t.maxBarSize),Ok=xk([Tq,Sf,OM,OD,(t,r,i)=>i],(t,r,i,n,a)=>r.filter(r=>"horizontal"===t?r.xAxisId===i:r.yAxisId===n).filter(t=>t.isPanorama===a).filter(t=>!1===t.hide).filter(t=>"bar"===t.type)),OO=xk([Ok,t=>t.rootProps.barSize,(t,r)=>{var i=Tq(t),n=OM(t,r),a=OD(t,r);if(null!=n&&null!=a)return"horizontal"===i?CN(t,"xAxis",n):CN(t,"yAxis",a)}],(t,r,i)=>{var n=t.filter(AV),a=t.filter(t=>null==t.stackId);return[...Object.entries(n.reduce((t,r)=>{var i=t[r.stackId];return null==i&&(i=[]),i.push(r),t[r.stackId]=i,t},{})).map(t=>{var n,a=function(t){if(Array.isArray(t))return t}(t)||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(t)||function(t){if(t){if("string"==typeof t)return OT(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?OT(t,2):void 0}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=a[0],s=a[1];return{stackId:o,dataKeys:s.map(t=>t.dataKey),barSize:OA(r,i,null==(n=s[0])?void 0:n.barSize)}}),...a.map(t=>({stackId:void 0,dataKeys:[t.dataKey].filter(t=>null!=t),barSize:OA(r,i,t.barSize)}))]}),ON=(t,r,i)=>{var n,a,o=Tq(t),s=OM(t,r),l=OD(t,r);if(null!=s&&null!=l)return"horizontal"===o?(n=Cj(t,"xAxis",s,i),a=Cz(t,"xAxis",s,i)):(n=Cj(t,"yAxis",l,i),a=Cz(t,"yAxis",l,i)),Tn(n,a)},OL=xk([OO,Al,t=>t.rootProps.barGap,Au,(t,r,i)=>{var n,a,o,s,l=OP(t,r);if(null==l)return 0;var u=OM(t,r),c=OD(t,r);if(null==u||null==c)return 0;var h=Tq(t),f=Al(t),d=l.maxBarSize;return"horizontal"===h?(o=Cj(t,"xAxis",u,i),s=Cz(t,"xAxis",u,i)):(o=Cj(t,"yAxis",c,i),s=Cz(t,"yAxis",c,i)),null!=(n=null!=(a=Tn(o,s,!0))?a:null==d?f:d)?n:0},ON,OI],(t,r,i,n,a,o,s)=>{var l=function(t,r,i,n,a){var o,s,l=n.length;if(!(l<1)){var u=wU(t,i,0,!0),c=[];if(EQ(null==(o=n[0])?void 0:o.barSize)){var h=!1,f=i/l,d=n.reduce((t,r)=>t+(r.barSize||0),0);(d+=(l-1)*u)>=i&&(d-=(l-1)*u,u=0),d>=i&&f>0&&(h=!0,f*=.9,d=l*f);var p={offset:Math.round((i-d)/2)-u,size:0};s=n.reduce((t,r)=>{var i,n={stackId:r.stackId,dataKeys:r.dataKeys,position:{offset:p.offset+p.size+u,size:h?f:null!=(i=r.barSize)?i:0}},a=[...t,n];return p=n.position,a},c)}else{var m=wU(r,i,0,!0);i-2*m-(l-1)*u<=0&&(u=0);var g=(i-2*m-(l-1)*u)/l;g>1&&(g=Math.round(g));var y=EQ(a)?Math.min(g,a):g;s=n.reduce((t,r,i)=>[...t,{stackId:r.stackId,dataKeys:r.dataKeys,position:{offset:m+l*(g-y)/2+(y+u)*i,size:y}}],c)}return s}}(i,n,a!==o?a:o,t,null==s?r:s);return a!==o&&null!=l&&(l=l.map(t=>OC(OC({},t),{},{position:OC(OC({},t.position),{},{offset:t.position.offset-a/2})}))),l}),OR=xk([OL,OP],(t,r)=>{if(null!=t&&null!=r){var i=t.find(t=>t.stackId===r.stackId&&null!=r.dataKey&&t.dataKeys.includes(r.dataKey));if(null!=i)return i.position}}),OF=xk([(t,r,i)=>{var n=Tq(t),a=OM(t,r),o=OD(t,r);if(null!=a&&null!=o)return"horizontal"===n?SR(t,"yAxis",o,i):SR(t,"xAxis",a,i)},OP],(t,r)=>{var i=Aj(r);if(!t||null==i||null==r)return;var n=r.stackId;if(null!=n){var a=t[n];if(a){var o=a.stackedData;if(o)return o.find(t=>t.key===i)}}}),OB=xk([Tm,Ty,(t,r,i)=>{var n=OM(t,r);if(null!=n)return Cj(t,"xAxis",n,i)},(t,r,i)=>{var n=OD(t,r);if(null!=n)return Cj(t,"yAxis",n,i)},(t,r,i)=>{var n=OM(t,r);if(null!=n)return Cz(t,"xAxis",n,i)},(t,r,i)=>{var n=OD(t,r);if(null!=n)return Cz(t,"yAxis",n,i)},OR,Tq,(t,r,i)=>i?TQ(t):TK(t),ON,OF,OP,(t,r,i,n)=>n],(t,r,i,n,a,o,s,l,u,c,h,f,d)=>{var p,m=u.chartData,g=u.dataStartIndex,y=u.dataEndIndex;if(null!=f&&null!=s&&null!=r&&("horizontal"===l||"vertical"===l)&&null!=i&&null!=n&&null!=a&&null!=o&&null!=c){var v,_,b,x,w,E,T,A,S,C,M,D,P,I,k,O,N,L,R,F,B,z,j=f.data;if(null!=(p=null!=j&&j.length>0?j:null==m?void 0:m.slice(g,y+1))){return _=(v={layout:l,barSettings:f,pos:s,parentViewBox:r,bandSize:c,xAxis:i,yAxis:n,xAxisTicks:a,yAxisTicks:o,stackedData:h,displayedData:p,offset:t,cells:d,dataStartIndex:g}).layout,x=(b=v.barSettings).dataKey,w=b.minPointSize,E=b.hasCustomShape,T=v.pos,A=v.bandSize,S=v.xAxis,C=v.yAxis,M=v.xAxisTicks,D=v.yAxisTicks,P=v.stackedData,I=v.displayedData,k=v.offset,O=v.cells,N=v.parentViewBox,L=v.dataStartIndex,R="horizontal"===_?C:S,F=P?R.scale.domain():null,B=(t=>{var r=t.numericAxis,i=r.scale.domain();if("number"===r.type){var n=Math.min(i[0],i[1]),a=Math.max(i[0],i[1]);return n<=0&&a>=0?0:a<0?a:n}return i[0]})({numericAxis:R}),z=R.scale.map(B),I.map((t,r)=>{if(P){var i=P[r+L];if(null==i)return null;a=((t,r)=>
56{if(!r||2!==r.length||!wF(r[0])||!wF(r[1]))return t;var i=Math.min(r[0],r[1]),n=Math.max(r[0],r[1]),a=[t[0],t[1]];return(!wF(t[0])||t[0]<i)&&(a[0]=i),(!wF(t[1])||t[1]>n)&&(a[1]=n),a[0]>n&&(a[0]=n),a[1]<i&&(a[1]=i),a})(i,F)}else Array.isArray(a=E5(t,x))||(a=[B,a]);var n=Op(w,0)(a[1],r);if("horizontal"===_){var a,o,s,l,u,c,h,f=C.scale.map(a[0]),d=C.scale.map(a[1]);if(null==f||null==d)return null;o=Tt({axis:S,ticks:M,bandSize:A,offset:T.offset,entry:t,index:r}),s=null!=(h=null!=d?d:f)?h:void 0,l=T.size;var p=f-d;if(u=wL(p)?0:p,c={x:o,y:k.top,width:l,height:k.height},Math.abs(n)>0&&Math.abs(u)<Math.abs(n)){var m=wN(u||n)*(Math.abs(n)-Math.abs(u));s-=m,u+=m}}else{var g=S.scale.map(a[0]),y=S.scale.map(a[1]);if(null==g||null==y)return null;if(o=g,s=Tt({axis:C,ticks:D,bandSize:A,offset:T.offset,entry:t,index:r}),l=y-g,u=T.size,c={x:k.left,y:s,width:k.width,height:u},Math.abs(n)>0&&Math.abs(l)<Math.abs(n)){var v=wN(l||n)*(Math.abs(n)-Math.abs(l));l+=v}}return null!=o&&null!=s&&null!=l&&null!=u&&(E||0!==l&&0!==u)?Na(Na({},t),{},{stackedBarStart:z,x:o,y:s,width:l,height:u,value:P?a:a[1],payload:t,background:c,tooltipPosition:{x:o+l/2,y:s+u/2},parentViewBox:N,originalDataIndex:r},O&&O[r]&&O[r].props):null}).filter(Boolean)}}});function Oz(t){var r=t.legendPayload,i=ED(),n=T_(),a=(0,ec.useRef)(null);return(0,ec.useLayoutEffect)(()=>{n||(null===a.current?i(DR(r)):a.current!==r&&i(DF({prev:a.current,next:r})),a.current=r)},[i,n,r]),(0,ec.useLayoutEffect)(()=>()=>{a.current&&(i(DB(a.current)),a.current=null)},[i]),null}function Oj(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var OU=null!=(et=ec["useId".toString()])?et:()=>{var t;return(function(t){if(Array.isArray(t))return t}(t=ec.useState(()=>wj("uid-")))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),1!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(t)||function(t){if(t){if("string"==typeof t)return Oj(t,1);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Oj(t,1):void 0}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0]},OV=(0,ec.createContext)(void 0),O$=t=>{var r,i,n,a=t.id,o=t.type,s=t.children,l=(r="recharts-".concat(o),i=a,n=OU(),i||(r?"".concat(r,"-").concat(n):n));return ec.createElement(OV.Provider,{value:l},s(l))},OG=(0,ec.memo)(t=>{var r=ED(),i=(0,ec.useRef)(null);return(0,ec.useLayoutEffect)(()=>{null===i.current?r(Dw(t)):i.current!==t&&r(DE({prev:i.current,next:t})),i.current=t},[r,t]),(0,ec.useLayoutEffect)(()=>()=>{i.current&&(r(DT(i.current)),i.current=null)},[r]),null});function Oq(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var OH="index",OW="append";function OZ(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=[];for(var a of i)n.push({status:"removed",prev:a});for(var o=0;o<r.length;o++){var s=t[o],l=r[o];null!=s?n.push({status:"matched",prev:s,next:l}):n.push({status:"added",next:l})}return n}function OY(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function OX(t){var r,i,n,a,o,s=t.animationInput,l=t.animationIdPrefix,u=t.items,c=t.previousItemsRef,h=t.isAnimationActive,f=t.animationBegin,d=t.animationDuration,p=t.animationEasing,m=t.onAnimationStart,g=t.onAnimationEnd,y=t.animationInterpolateFn,v=t.animationMatchBy,_=t.shouldUpdatePreviousRef,b=t.children,x=t.layout,w=k8(s,l),E=(r=(0,ec.useRef)(w),i=(0,ec.useRef)(c.current),n=(0,ec.useRef)(!0),r.current!==w&&(r.current=w,i.current=c.current,n.current=!1),a=(0,ec.useCallback)(function(t,r){var a=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(0===r){n.current=!0;return}1===r&&(i.current=t),r>0&&n.current&&a&&(c.current=t)},[c]),{startValue:i.current,syncStepValue:a}),T=null!=(o=E.startValue)?o:null,A=function(t,r,i){var n;return null==r?null:null==t?r.map(t=>({status:"added",next:t})):i===OH?(n=t.length/r.length,OZ(r.map((r,i)=>t[Math.floor(i*n)]),r)):i===OW?OZ(r.map((r,i)=>t[i]),r):function(t,r,i){var n=function(t,r){for(var i=new Map,n=0;n<t.length;n++){var a=t[n];if(null!=a){var o=r(a,n);null==o||i.has(o)||i.set(o,a)}}return i}(t,i),a=new Set,o=r.map((t,r)=>{var o=i(t,r);if(null!=o){var s=n.get(o);if(void 0!==s)return a.add(o),s}}),s=[];for(var l of n){var u=function(t){if(Array.isArray(t))return t}(l)||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}
56finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(l)||function(t){if(t){if("string"==typeof t)return Oq(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Oq(t,2):void 0}}(l)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),c=u[0],h=u[1];a.has(c)||s.push(h)}return OZ(o,r,s)}(t,r,i)}(T,u,null!=v?v:OH);return ec.createElement(k5,{animationId:w,begin:f,duration:d,isActive:h,easing:p,onAnimationEnd:g,onAnimationStart:m,key:w},t=>{var r=null==u?u:y(A,t,x),i=_?_(t):t>0;return(E.syncStepValue(r,t,i),null==r)?null:b(r,t,null==T)})}var OK=(t,r)=>r,OQ=(t,r,i)=>i,OJ=xk([OK,Sf,OQ],(t,r,i)=>r.filter(t=>"bar"===t.type).filter(r=>r.stackId===t).filter(t=>t.isPanorama===i).filter(t=>!t.hide)),O0=xk([OJ],t=>t.map(t=>t.id)),O1=xk([t=>t,OK,OQ],(t,r,i)=>{var n=O0(t,r,i),a=[];return n.forEach(r=>{var n=OB(t,r,i,void 0);null==n||n.forEach(t=>{var r=t.originalDataIndex;a[r]=((t,r)=>{if(!t)return r;if(!r)return t;var i=Math.min(t.x,t.x+t.width,r.x,r.x+r.width),n=Math.min(t.y,t.y+t.height,r.y,r.y+r.height);return{x:i,y:n,width:Math.max(t.x,t.x+t.width,r.x,r.x+r.width)-i,height:Math.max(t.y,t.y+t.height,r.y,r.y+r.height)-n}})(a[r],t)})}),a}),O2=["index"];function O3(){return(O3=Object.assign.bind()).apply(null,arguments)}var O4=(0,ec.createContext)(void 0),O6=(t,r)=>"recharts-bar-stack-clip-path-".concat(t,"-").concat(r),O5=t=>{var r=t.index,i=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,O2),n=(t=>{var r=(0,ec.useContext)(O4);if(null!=r){var i=r.stackId;return"url(#".concat(O6(i,t),")")}})(r);return ec.createElement(IL,O3({className:"recharts-bar-stack-layer",clipPath:n},i))},O8=["onMouseEnter","onMouseLeave","onClick"],O7=["value","background","tooltipPosition"],O9=["id"],Ne=["onMouseEnter","onClick","onMouseLeave"];function Nt(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,o,s,l=[],u=!0,c=!1;try{if(o=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return Nr(t,r);var i=({}).toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Nr(t,r):void 0}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nr(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function Ni(){return(Ni=Object.assign.bind()).apply(null,arguments)}function Nn(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Na(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Nn(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}
56(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Nn(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function No(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}var Ns=Ik.memo(t=>{var r=t.dataKey,i=t.stroke,n=t.strokeWidth,a=t.fill,o=t.name,s=t.hide,l=t.unit,u=t.formatter,c=t.tooltipType,h=t.id,f={dataDefinedOnItem:void 0,getPosition:wH,settings:{stroke:i,strokeWidth:n,fill:a,dataKey:r,nameKey:void 0,name:To(o,r),hide:s,type:c,color:a,unit:l,formatter:u,graphicalItemId:h}};return Ik.createElement(Ov,{tooltipEntrySettings:f})});function Nl(t){var r,i=EO(MF),n=t.data,a=t.dataKey,o=t.background,s=t.allOtherBarProps,l=s.onMouseEnter,u=s.onMouseLeave,c=s.onClick,h=No(s,O8),f=Om(l,a,s.id),d=Og(u),p=Oy(c,a,s.id);if(!o||null==n)return null;var m=Pq(o);return Ik.createElement(ku,{zIndex:(r=Ab.barBackground,o&&"object"==typeof o&&"zIndex"in o&&"number"==typeof o.zIndex&&EQ(o.zIndex)?o.zIndex:r)},n.map((t,r)=>{t.value;var n=t.background,s=(t.tooltipPosition,No(t,O7));if(!n)return null;var l=f(t,t.originalDataIndex),u=d(t,t.originalDataIndex),c=p(t,t.originalDataIndex),g=Na(Na(Na(Na(Na({option:o,isActive:String(t.originalDataIndex)===i},s),{},{fill:"#eee"},n),m),kU(h,t,r)),{},{onMouseEnter:l,onMouseLeave:u,onClick:c,dataKey:a,index:r,className:"recharts-bar-background-rectangle"});return Ik.createElement(Od,Ni({key:"background-bar-".concat(r)},g))}))}function Nu(t){var r=t.showLabels,i=t.children,n=t.rects,a=null==n?void 0:n.map(t=>{var r={x:t.x,y:t.y,width:t.width,lowerWidth:t.width,upperWidth:t.width,height:t.height};return Na(Na({},r),{},{value:t.value,payload:t.payload,parentViewBox:t.parentViewBox,viewBox:r,fill:t.fill})});return Ik.createElement(kI,{value:r?a:void 0},i)}function Nc(t){var r,i=t.shape,n=t.activeBar,a=t.baseProps,o=t.entry,s=t.index,l=t.dataKey,u=EO(MF),c=EO(Mz),h=n&&String(o.originalDataIndex)===u&&(null==c||l===c),f=null!=u&&(String(o.originalDataIndex)!==u||null!=c&&l!==c),d=Nt((0,Ik.useState)(!1),2),p=d[0],m=d[1],g=Nt((0,Ik.useState)(!1),2),y=g[0],v=g[1];(0,Ik.useEffect)(()=>{var t;return h?(m(!0),t=requestAnimationFrame(()=>{v(!0)})):(v(!1),f&&m(!1)),()=>{cancelAnimationFrame(t)}},[h,f]);var _=(0,Ik.useCallback)(()=>{h||m(!1)},[h]),b=h&&y,x=h||p;r=h?!0===n?i:n:i;var w=Ik.createElement(Od,Ni({},a,{name:String(a.name)},o,{isActive:b,option:r,index:s,dataKey:l,animationElapsedTime:t.animationElapsedTime,isAnimating:t.isAnimating,isEntrance:t.isEntrance,onTransitionEnd:_}));return x?Ik.createElement(ku,{zIndex:Ab.activeBar},Ik.createElement(O5,{index:o.originalDataIndex},w)):w}function Nh(t){var r=t.shape,i=t.baseProps,n=t.entry,a=t.index,o=t.dataKey;return Ik.createElement(Od,Ni({},i,{name:String(i.name)},n,{isActive:!1,option:r,index:a,dataKey:o,animationElapsedTime:t.animationElapsedTime,isAnimating:t.isAnimating,isEntrance:t.isEntrance}))}function Nf(t){var r,i=t.data,n=t.props,a=t.animationElapsedTime,o=t.isAnimating,s=t.isEntrance,l=null!=(r=PG(n))?r:{},u=l.id,c=No(l,O9),h=n.shape,f=n.dataKey,d=n.activeBar,p=n.onMouseEnter,m=n.onClick,g=n.onMouseLeave,y=No(n,Ne),v=Om(p,f,u),_=Og(g),b=Oy(m,f,u);return i?Ik.createElement(Ik.Fragment,null,i.map((t,r)=>Ik.createElement(O5,Ni({index:t.originalDataIndex,key:"rectangle-".concat(null==t?void 0:t.x,"-").concat(null==t?void 0:t.y,"-").concat(null==t?void 0:t.value,"-").concat(r),className:"recharts-bar-rectangle"},kU(y,t,r),{onMouseEnter:v(t,t.originalDataIndex),onMouseLeave:_(t,t.originalDataIndex),onClick:b(t,t.originalDataIndex)}),d?Ik.createElement(Nc,{shape:h,activeBar:d,baseProps:c,entry:t,index:r,dataKey:f,animationElapsedTime:a,isAnimating:o,isEntrance:s}):Ik.createElement(Nh,{shape:h,baseProps:c,entry:t,index:r,dataKey:f,animationElapsedTime:a,isAnimating:o,isEntrance:s})))):null}function Nd(t){var r,i,n,a,o,s,l=t.props,u=t.previousRectanglesRef,c=l.data,h=l.isAnimationActive,f=l.animationBegin,d=l.animationDuration,p=l.animationEasing,m=l.animationInterpolateFn,g=l.layout,y=(r=l.onAnimationStart,i=l.onAnimationEnd,o=(a=function(t){if(Array.isArray(t))return t}(n=(0,ec.useState)(!1))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}
56finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(n)||function(t){if(t){if("string"==typeof t)return OY(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?OY(t,2):void 0}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],s=a[1],{isAnimating:o,handleAnimationStart:(0,ec.useCallback)(()=>{"function"==typeof r&&r(),s(!0)},[r]),handleAnimationEnd:(0,ec.useCallback)(()=>{"function"==typeof i&&i(),s(!1)},[i])}),v=y.isAnimating,_=y.handleAnimationStart,b=y.handleAnimationEnd;return Ik.createElement(Nu,{showLabels:!v,rects:c},Ik.createElement(OX,{animationInput:c,animationIdPrefix:"recharts-bar-",items:c,previousItemsRef:u,isAnimationActive:h,animationBegin:f,animationDuration:d,animationEasing:p,onAnimationStart:_,onAnimationEnd:b,animationInterpolateFn:m,animationMatchBy:l.animationMatchBy,layout:g},(t,r,i)=>Ik.createElement(IL,null,Ik.createElement(Nf,{props:l,data:t,animationElapsedTime:r,isAnimating:v||r<1,isEntrance:i}))),Ik.createElement(kN,{label:l.label}),l.children)}function Np(t){var r=(0,Ik.useRef)(null);return Ik.createElement(Nd,{previousRectanglesRef:r,props:t})}var Nm=(t,r)=>{var i=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:i,errorVal:E5(t,r)}};class Ng extends Ik.PureComponent{render(){var t=this.props,r=t.hide,i=t.data,n=t.dataKey,a=t.className,o=t.xAxisId,s=t.yAxisId,l=t.needClip,u=t.background,c=t.id;if(r||null==i)return null;var h=(0,Tw.clsx)("recharts-bar",a);return Ik.createElement(IL,{className:h,id:c},l&&Ik.createElement("defs",null,Ik.createElement(OE,{clipPathId:c,xAxisId:o,yAxisId:s})),Ik.createElement(IL,{className:"recharts-bar-rectangles",clipPath:l?"url(#clipPath-".concat(c,")"):void 0},Ik.createElement(Nl,{data:i,dataKey:n,background:u,allOtherBarProps:this.props}),Ik.createElement(Np,this.props)))}}var Ny={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",animationInterpolateFn:(t,r,i)=>null==t?[]:1===r?t.flatMap(t=>"removed"===t.status?[]:[t.next]):t.flatMap(t=>{if("removed"===t.status)return"horizontal"===i?[Na(Na({},t.prev),{},{height:w$(t.prev.height,0,r),y:w$(t.prev.y,t.prev.y+t.prev.height,r)})]:[Na(Na({},t.prev),{},{width:w$(t.prev.width,0,r)})];if("matched"===t.status)return[Na(Na({},t.next),{},{x:w$(t.prev.x,t.next.x,r),y:w$(t.prev.y,t.next.y,r),width:w$(t.prev.width,t.next.width,r),height:w$(t.prev.height,t.next.height,r)})];var n=t.next;return"horizontal"===i?[Na(Na({},n),{},{height:w$(0,n.height,r),y:w$(n.stackedBarStart,n.y,r)})]:[Na(Na({},n),{},{width:w$(0,n.width,r),x:w$(n.stackedBarStart,n.x,r)})]}),animationMatchBy:OW,background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:0,shape:Ol,xAxisId:0,yAxisId:0,zIndex:Ab.bar};function Nv(t){var r,i,n,a,o=t.xAxisId,s=t.yAxisId,l=t.hide,u=t.legendType,c=t.minPointSize,h=t.activeBar,f=t.animationBegin,d=t.animationDuration,p=t.animationEasing,m=t.isAnimationActive,g=Ow(o,s).needClip,y=EO(Tq),v=T_(),_=(r=t.children,i=[],n=[],n=Array.isArray(IR)?IR.map(t=>kR(t)):[kR(IR)],kz(r).forEach(t=>{var r=wI(t,"type.displayName")||wI(t,"type.name");r&&-1!==n.indexOf(r)&&i.push(t)}),i),b=EO(r=>OB(r,t.id,v,_));if("vertical"!==y&&"horizontal"!==y)return null;var x=null==b?void 0:b[0];return a=null==x||null==x.height||null==x.width?0:"vertical"===y?x.height/2:x.width/2,Ik.createElement(Ox,{xAxisId:o,yAxisId:s,data:b,dataPointFormatter:Nm,errorBarOffset:a},Ik.createElement(Ng,Ni({},t,{layout:y,needClip:g,data:b,xAxisId:o,yAxisId:s,hide:l,legendType:u,minPointSize:c,activeBar:h,animationBegin:f,animationDuration:d,animationEasing:p,isAnimationActive:m})))}var N_=Ik.memo(function(t){var r,i,n,a=IA(t,Ny),o=(i=a.stackId,null!=(n=(0,ec.useContext)(O4))?n.stackId:null!=i?null==(r=i)?void 0:String(r):void 0),s=T_();return Ik.createElement(O$,{id:a.id,type:"bar"},t=>{var r,i,n,l;return Ik.createElement(Ik.Fragment,null,Ik.createElement(Oz,{legendPayload:(r=a.dataKey,i=a.name,n=a.fill,l=a.legendT
56ype,[{inactive:a.hide,dataKey:r,type:l,color:n,value:To(i,r),payload:a}])}),Ik.createElement(Ns,{dataKey:a.dataKey,stroke:a.stroke,strokeWidth:a.strokeWidth,fill:a.fill,name:a.name,hide:a.hide,unit:a.unit,formatter:a.formatter,tooltipType:a.tooltipType,id:t}),Ik.createElement(OG,{type:"bar",id:t,data:void 0,xAxisId:a.xAxisId,yAxisId:a.yAxisId,zAxisId:0,dataKey:a.dataKey,stackId:o,hide:a.hide,barSize:a.barSize,minPointSize:a.minPointSize,maxBarSize:a.maxBarSize,isPanorama:s,hasCustomShape:null!=a.shape&&a.shape!==Ol}),Ik.createElement(ku,{zIndex:a.zIndex},Ik.createElement(Nv,Ni({},a,{id:t}))))})},PN);function Nb(){}function Nx(t){return Object.getOwnPropertySymbols(t).filter(r=>Object.prototype.propertyIsEnumerable.call(t,r))}function Nw(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}N_.displayName="Bar";let NE="[object RegExp]",NT="[object String]",NA="[object Number]",NS="[object Boolean]",NC="[object Arguments]",NM="[object Symbol]",ND="[object Date]",NP="[object Map]",NI="[object Set]",Nk="[object Array]",NO="[object ArrayBuffer]",NN="[object Object]",NL="[object DataView]",NR="[object Uint8Array]",NF="[object Uint8ClampedArray]",NB="[object Uint16Array]",Nz="[object Uint32Array]",Nj="[object Int8Array]",NU="[object Int16Array]",NV="[object Int32Array]",N$="[object Float32Array]",NG="[object Float64Array]",Nq="object"==typeof globalThis&&globalThis||"object"==typeof window&&window||"object"==typeof self&&self||t.g||function(){return this}();function NH(t){return void 0!==Nq.Buffer&&Nq.Buffer.isBuffer(t)}function NW(t){if(!t||"object"!=typeof t)return!1;let r=Object.getPrototypeOf(t);return(null===r||r===Object.prototype||null===Object.getPrototypeOf(r))&&"[object Object]"===Object.prototype.toString.call(t)}var NZ=function(t){var r=t.width,i=t.height,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(n%180+180)%180*Math.PI/180,o=Math.atan(i/r);return Math.abs(a>o&&a<Math.PI-o?i/Math.sin(a):r/Math.cos(a))};function NY(t,r){if(r<1)return[];if(1===r)return t;for(var i=[],n=0;n<t.length;n+=r){var a=t[n];void 0!==a&&i.push(a)}return i}function NX(t,r,i,n,a){if(t*r<t*n||t*r>t*a)return!1;var o=i();return t*(r-t*o/2-n)>=0&&t*(r+t*o/2-a)<=0}function NK(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function NQ(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?NK(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):NK(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function NJ(t,r,i){var n,a,o,s,l,u,c=t.tick,h=t.ticks,f=t.viewBox,d=t.minTickGap,p=t.orientation,m=t.interval,g=t.tickFormatter,y=t.unit,v=t.angle;if(!h||!h.length||!c)return[];if(wF(m)||Pu.isSsr)return null!=(u=NY(h,(wF(m)?m:0)+1))?u:[];var _="top"===p||"bottom"===p?"width":"height",b=y&&"width"===_?I$(y,{fontSize:r,letterSpacing:i}):{width:0,height:0},x=(t,n)=>{var a,o="function"==typeof g?g(t.value,n):t.value;return"width"===_?(a=I$(o,{fontSize:r,letterSpacing:i}),NZ({width:a.width+b.width,height:a.height+b.height},v)):I$(o,{fontSize:r,letterSpacing:i})[_]},w=h[0],E=h[1],T=h.length>=2&&null!=w&&null!=E?wN(E.coordinate-w.coordinate):1,A=(n="width"===_,a=f.x,o=f.y,s=f.width,l=f.height,1===T?{start:n?a:o,end:n?a+s:o+l}:{start:n?a+s:o+l,end:n?a:o});return"equidistantPreserveStart"===m?function(t,r,i,n,a){for(var o,s=(n||[]).slice(),l=r.start,u=r.end,c=0,h=1,f=l;h<=s.length;)if(o=function(){var r,o=null==n?void 0:n[c];if(void 0===o)return{v:NY(n,h)};var s=c,d=()=>(void 0===r&&(r=i(o,s)),r),p=o.coordinate,m=0===c||NX(t,p,d,f,u);m||(c=0,f=l,h+=1),m&&(f=p+t*(d()/2+a),c+=h)}())return o.v;return[]}(T,A,x,h,d):"equidistantPreserveEnd"===m?function(t,r,i,n,a){var o=(n||[]).slice().length;if(0===o)return[];for(var s=r.start,l=r.end,u=1;u<=o;u++){for(var c,h=(o-1)%u,f=s,d=!0,p=h;p<o&&(0===(c=function(){var r,o=n[p];if(null==o)return 0;var s=p,u=()=>
56(void 0===r&&(r=i(o,s)),r),c=o.coordinate,m=p===h||NX(t,c,u,f,l);if(!m)return d=!1,1;m&&(f=c+t*(u()/2+a))}())||1!==c);p+=u);if(d){for(var m=[],g=h;g<o;g+=u){var y=n[g];null!=y&&m.push(y)}return m}}return[]}(T,A,x,h,d):("preserveStart"===m||"preserveStartEnd"===m?function(t,r,i,n,a,o){var s=(n||[]).slice(),l=s.length,u=r.start,c=r.end;if(o){var h=n[l-1];if(null!=h){var f=i(h,l-1),d=t*(h.coordinate+t*f/2-c);s[l-1]=h=NQ(NQ({},h),{},{tickCoord:d>0?h.coordinate-d*t:h.coordinate}),null!=h.tickCoord&&NX(t,h.tickCoord,()=>f,u,c)&&(c=h.tickCoord-t*(f/2+a),s[l-1]=NQ(NQ({},h),{},{isShow:!0}))}}for(var p=o?l-1:l,m=function(r){var n,o=s[r];if(null==o)return 1;var l=o,h=()=>(void 0===n&&(n=i(o,r)),n);if(0===r){var f=t*(l.coordinate-t*h()/2-u);s[r]=l=NQ(NQ({},l),{},{tickCoord:f<0?l.coordinate-f*t:l.coordinate})}else s[r]=l=NQ(NQ({},l),{},{tickCoord:l.coordinate});null!=l.tickCoord&&NX(t,l.tickCoord,h,u,c)&&(u=l.tickCoord+t*(h()/2+a),s[r]=NQ(NQ({},l),{},{isShow:!0}))},g=0;g<p;g++)if(m(g))continue;return s}(T,A,x,h,d,"preserveStartEnd"===m):function(t,r,i,n,a){for(var o=(n||[]).slice(),s=o.length,l=r.start,u=r.end,c=function(r){var n,c=o[r];if(null==c)return 1;var h=c,f=()=>(void 0===n&&(n=i(c,r)),n);if(r===s-1){var d=t*(h.coordinate+t*f()/2-u);o[r]=h=NQ(NQ({},h),{},{tickCoord:d>0?h.coordinate-d*t:h.coordinate})}else o[r]=h=NQ(NQ({},h),{},{tickCoord:h.coordinate});null!=h.tickCoord&&NX(t,h.tickCoord,f,l,u)&&(u=h.tickCoord-t*(f()/2+a),o[r]=NQ(NQ({},h),{},{isShow:!0}))},h=s-1;h>=0;h--)if(c(h))continue;return o}(T,A,x,h,d)).filter(t=>t.isShow)}var N0=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function N1(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,a,o,s,l=[],u=!0,c=!1;try{if(o=(i=i.call(t)).next,0===r){if(Object(i)!==i)return;u=!1}else for(;!(u=(n=o.call(i)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw a}}return l}}(t,r)||function(t,r){if(t){if("string"==typeof t)return N2(t,r);var i=({}).toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?N2(t,r):void 0}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N2(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function N3(){return(N3=Object.assign.bind()).apply(null,arguments)}function N4(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function N6(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?N4(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):N4(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}var N5={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Ab.axis};function N8(t){var r=t.x,i=t.y,n=t.width,a=t.height,o=t.orientation,s=t.mirror,l=t.axisLine,u=t.otherSvgProps;if(!l)return null;var c=N6(N6(N6({},u),PG(l)),{},{fill:"none"});if("top"===o||"bottom"===o){var h=+("top"===o&&!s||"bottom"===o&&s);c=N6(N6({},c),{}
56,{x1:r,y1:i+h*a,x2:r+n,y2:i+h*a})}else{var f=+("left"===o&&!s||"right"===o&&s);c=N6(N6({},c),{},{x1:r+f*n,y1:i,x2:r+f*n,y2:i+a})}return ec.createElement("line",N3({},c,{className:(0,Tw.clsx)("recharts-cartesian-axis-line",wI(l,"className"))}))}function N7(t){var r,i=t.option,n=t.tickProps,a=t.value,o=(0,Tw.clsx)(n.className,"recharts-cartesian-axis-tick-value");if(ec.isValidElement(i))r=ec.cloneElement(i,N6(N6({},n),{},{className:o}));else if("function"==typeof i)r=i(N6(N6({},n),{},{className:o}));else{var s="recharts-cartesian-axis-tick-value";"boolean"!=typeof i&&(s=(0,Tw.clsx)(s,i&&"object"==typeof i&&"className"in i&&"string"==typeof i.className?i.className:"")),r=ec.createElement(ks,N3({},n,{className:s}),a)}return r}function N9(t){var r=t.ticks,i=t.axisType,n=t.axisId,a=ED(),o=(0,ec.useRef)(null);return(0,ec.useEffect)(()=>{if(null!=n&&null!=i){var t,s=r.map(t=>({value:t.value,coordinate:t.coordinate,offset:t.offset,index:t.index})),l=o.current;null!=l&&l.axisId===n&&l.axisType===i&&(t=l.ticks,function t(r,i,n,a,o,s,l){let u=l(r,i,n,a,o,s);if(void 0!==u)return u;if(typeof r==typeof i)switch(typeof r){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return r===i;case"number":return r===i||Object.is(r,i)}return function r(i,n,a,o){if(Object.is(i,n))return!0;let s=Nw(i),l=Nw(n);if("[object Arguments]"===s&&(s=NN),"[object Arguments]"===l&&(l=NN),s!==l)return!1;switch(s){case NT:return i.toString()===n.toString();case NA:return EN(i.valueOf(),n.valueOf());case NS:case ND:case NM:return Object.is(i.valueOf(),n.valueOf());case NE:return i.source===n.source&&i.flags===n.flags;case"[object Function]":return i===n}let u=(a=a??new Map).get(i),c=a.get(n);if(null!=u&&null!=c)return u===n;a.set(i,n),a.set(n,i);try{switch(s){case NP:if(i.size!==n.size)return!1;for(let[r,s]of i.entries())if(!n.has(r)||!t(s,n.get(r),r,i,n,a,o))return!1;return!0;case NI:{if(i.size!==n.size)return!1;let r=Array.from(i.values()),s=Array.from(n.values());for(let l=0;l<r.length;l++){let u=r[l],c=s.findIndex(r=>t(u,r,void 0,i,n,a,o));if(-1===c)return!1;s.splice(c,1)}return!0}case Nk:case NR:case NF:case NB:case Nz:case"[object BigUint64Array]":case Nj:case NU:case NV:case"[object BigInt64Array]":case N$:case NG:if(NH(i)!==NH(n)||i.length!==n.length)return!1;for(let r=0;r<i.length;r++)if(!t(i[r],n[r],r,i,n,a,o))return!1;return!0;case NO:if(i.byteLength!==n.byteLength)return!1;return r(new Uint8Array(i),new Uint8Array(n),a,o);case NL:if(i.byteLength!==n.byteLength||i.byteOffset!==n.byteOffset)return!1;return r(new Uint8Array(i),new Uint8Array(n),a,o);case"[object Error]":return i.name===n.name&&i.message===n.message;case NN:{if(!(r(i.constructor,n.constructor,a,o)||NW(i)&&NW(n)))return!1;let s=[...Object.keys(i),...Nx(i)],l=[...Object.keys(n),...Nx(n)];if(s.length!==l.length)return!1;for(let r=0;r<s.length;r++){let l=s[r],u=i[l];if(!Object.hasOwn(n,l))return!1;let c=n[l];if(!t(u,c,l,i,n,a,o))return!1}return!0}default:return!1}}finally{a.delete(i),a.delete(n)}}(r,i,s,l)}(t,s,void 0,void 0,void 0,void 0,Nb))||(o.current={ticks:s,axisId:n,axisType:i},a(PC({ticks:s,axisId:n,axisType:i})))}},[a,r,n,i]),(0,ec.useEffect)(()=>null==n||null==i?wH:()=>{a(PM({axisId:n,axisType:i}))},[a,n,i]),null}var Le=(0,ec.forwardRef)((t,r)=>{var i=t.ticks,n=t.tick,a=t.tickLine,o=t.stroke,s=t.tickFormatter,l=t.unit,u=t.padding,c=t.tickTextProps,h=t.orientation,f=t.mirror,d=t.x,p=t.y,m=t.width,g=t.height,y=t.tickSize,v=t.tickMargin,_=t.fontSize,b=t.letterSpacing,x=t.getTicksConfig,w=t.events,E=t.axisType,T=t.axisId,A=NJ(N6(N6({},x),{},{ticks:void 0===i?[]:i}),_,b),S=PG(x),C=Pq(n),M=ke(S.textAnchor)?S.textAnchor:function(t,r){switch(t){case"left":return r?"start":"end";case"right":return r?"end":"start";default:return"middle"}}(h,f),D=function(t,r){switch(t){case"left":case"right":return"middle";case"top":return r?"start":"end";default:return r?"end":"start"}}(h,f),P={};"object"==typeof a&&(P=a);var I=N6(N6({},S),{},{fill:"none"},P),k=A.map(t=>N6({entry:t},function(t,r,i,n,a,o,s,l,u){var c,h,f,d,p,m,g=l?-1:1,y=t.tickSize||s,v=wF(t.tickCoord)?t.tickCoord:t.coordinate;switch(o){case"top":c=h=t.coordinate,m=(f=(d=i+!l*a)-g*y)-g*u,p=v;break;case"left":f=d=t.coordinate,p=(c=(h=r+!l*n)-g*y)-g*u,m=v;break;case"right":f=d=t.coordinate,p=(c=(h=r+l*n)+g*y)+g*u,m=v;break;default:c=h=t.coordinate,m=(f=(d=i+l*a)+g*y)+g*u,p=v}return{line:{x1:c,y1:f,x2:h,y2:d},tick:{x:p,y:m}}}(t,d,p,m,g,h,y,f,v))),O=k.map(t=>{var r=t.entry,i=t.line;return ec.createElement(IL,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(r.value,"-").concat(r.coordinate,"-").concat(r.tickCoord)},a&&ec.createElement("line",N3({},I,i,{className:(0,Tw.clsx)("recharts-cartesian-axis-tick-line",wI(a,"className"))})))}),N=k.map((t,r)=>{var i,a,h=t.entry,f=t.tick,d=N6(N6(N6(N6({verticalAnchor:D},S),{},{textAnchor:M,stroke:"none",fill:o},f),{},{index:r,payload:h,visibleTicksCount:A.length,tickFormatter:s,padding:u},c),{},{angle:null!=(i=null!=(a=null==c?void 0:c.angle)?a:S.angle)?i:0}),p=N6(N6({},d),C);return ec.createElement(IL,N3({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(h.value,"-").concat(h.coordinate,"-").concat(h.tickCoord)},kU(w,h,r)),n&&ec.createElement(N7,{option:n,tickProps:p,value:"".concat("function"==typeof s?s(h.value,r):h.value).concat(l||"")}))});return ec.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(E,"-ticks")},ec.createElement(N9,{ticks:A,axisId:T,axisType:E}
56),N.length>0&&ec.createElement(ku,{zIndex:Ab.label},ec.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(E,"-tick-labels"),ref:r},N)),O.length>0&&ec.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(E,"-tick-lines")},O))}),Lt=(0,ec.forwardRef)((t,r)=>{var i=t.axisLine,n=t.width,a=t.height,o=t.className,s=t.hide,l=t.ticks,u=t.axisType,c=t.axisId,h=function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,N0),f=N1((0,ec.useState)(""),2),d=f[0],p=f[1],m=N1((0,ec.useState)(""),2),g=m[0],y=m[1],v=(0,ec.useRef)(null);(0,ec.useImperativeHandle)(r,()=>({getCalculatedWidth:()=>{var r;return(t=>{var r=t.ticks,i=t.label,n=t.labelGapWithTick,a=t.tickSize,o=t.tickMargin,s=0;if(r){Array.from(r).forEach(t=>{if(t){var r=t.getBoundingClientRect();r.width>s&&(s=r.width)}});var l=i?i.getBoundingClientRect().width:0;return Math.round(s+((void 0===a?0:a)+(void 0===o?0:o))+l+(i?void 0===n?5:n:0))}return 0})({ticks:v.current,label:null==(r=t.labelRef)?void 0:r.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})},getCalculatedHeight:()=>{var r;return(t=>{var r=t.ticks,i=t.label,n=t.labelGapWithTick,a=t.tickSize,o=t.tickMargin,s=0;if(r){Array.from(r).forEach(t=>{if(t){var r=t.getBoundingClientRect();r.height>s&&(s=r.height)}});var l=i?i.getBoundingClientRect().height:0;return Math.round(s+((void 0===a?0:a)+(void 0===o?0:o))+l+(i?void 0===n?5:n:0))}return 0})({ticks:v.current,label:null==(r=t.labelRef)?void 0:r.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var _=(0,ec.useCallback)(t=>{if(t){var r=t.getElementsByClassName("recharts-cartesian-axis-tick-value");v.current=r;var i=r[0];if(i){var n=window.getComputedStyle(i),a=n.fontSize,o=n.letterSpacing;(a!==d||o!==g)&&(p(a),y(o))}}},[d,g]);return s||null!=n&&n<=0||null!=a&&a<=0?null:ec.createElement(ku,{zIndex:t.zIndex},ec.createElement(IL,{className:(0,Tw.clsx)("recharts-cartesian-axis",o)},ec.createElement(N8,{x:t.x,y:t.y,width:n,height:a,orientation:t.orientation,mirror:t.mirror,axisLine:i,otherSvgProps:PG(t)}),ec.createElement(Le,{ref:_,axisType:u,events:h,fontSize:d,getTicksConfig:t,height:t.height,letterSpacing:g,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:l,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),ec.createElement(ky,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},ec.createElement(kT,{label:t.label,labelRef:t.labelRef}),t.children)))}),Lr=ec.forwardRef((t,r)=>{var i=IA(t,N5);return ec.createElement(Lt,N3({},i,{ref:r}))});Lr.displayName="CartesianAxis";var Li=["domain","range"],Ln=["domain","range"];function La(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}function Lo(t,r){return t===r||!!(Array.isArray(t)&&2===t.length&&Array.isArray(r))&&2===r.length&&t[0]===r[0]&&t[1]===r[1]}function Ls(t,r){if(t===r)return!0;var i=t.domain,n=t.range,a=La(t,Li),o=r.domain,s=r.range,l=La(r,Ln);return!!Lo(i,o)&&!!Lo(n,s)&&PN(a,l)}var Ll=["type"],Lu=["dangerouslySetInnerHTML","ticks","scale"],Lc=["id","scale"];function Lh(){return(Lh=Object.assign.bind()).apply(null,arguments)}function Lf(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Ld(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};
56r%2?Lf(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Lf(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function Lp(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}function Lm(t){var r=ED(),i=(0,ec.useRef)(null),n=TH(),a=t.type,o=Lp(t,Ll),s=AT(n,"xAxis",a),l=(0,ec.useMemo)(()=>{if(null!=s)return Ld(Ld({},o),{},{type:s})},[o,s]);return(0,ec.useLayoutEffect)(()=>{null!=l&&(null===i.current?r(Dh(l)):i.current!==l&&r(Df({prev:i.current,next:l})),i.current=l)},[l,r]),(0,ec.useLayoutEffect)(()=>()=>{i.current&&(r(Dd(i.current)),i.current=null)},[r]),null}var Lg=t=>{var r=t.xAxisId,i=t.className,n=t.height,a=t.label,o=(0,ec.useRef)(null),s=(0,ec.useRef)(null),l=EO(Ty),u=T_(),c=ED(),h="xAxis",f=EO(t=>CB(t,h,r,u)),d=EO(t=>CM(t,r)),p=EO(t=>CI(t,r)),m=EO(t=>St(t,r));if((0,ec.useLayoutEffect)(()=>{if(!("auto"!==n||!d||kb(a)||(0,ec.isValidElement)(a))&&null!=m){var t=o.current;if(t){var i=t.getCalculatedHeight();Math.round(d.height)!==Math.round(i)&&c(Dv({id:r,height:i}))}}},[f,d,c,a,r,n,m]),null==d||null==p||null==m)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var g=Lp(t,Lu);m.id,m.scale;var y=Lp(m,Lc);return ec.createElement(Lr,Lh({},g,y,{ref:o,labelRef:s,x:p.x,y:p.y,width:d.width,height:d.height,className:(0,Tw.clsx)("recharts-".concat(h," ").concat(h),i),viewBox:l,ticks:f,axisType:h,axisId:r}))},Ly={allowDataOverflow:Se.allowDataOverflow,allowDecimals:Se.allowDecimals,allowDuplicatedCategory:Se.allowDuplicatedCategory,angle:Se.angle,axisLine:N5.axisLine,height:Se.height,hide:!1,includeHidden:Se.includeHidden,interval:Se.interval,label:!1,minTickGap:Se.minTickGap,mirror:Se.mirror,orientation:Se.orientation,padding:Se.padding,reversed:Se.reversed,scale:Se.scale,tick:Se.tick,tickCount:Se.tickCount,tickLine:N5.tickLine,tickSize:N5.tickSize,type:Se.type,niceTicks:Se.niceTicks,xAxisId:0},Lv=ec.memo(t=>{var r=IA(t,Ly);return ec.createElement(ec.Fragment,null,ec.createElement(Lm,{allowDataOverflow:r.allowDataOverflow,allowDecimals:r.allowDecimals,allowDuplicatedCategory:r.allowDuplicatedCategory,angle:r.angle,dataKey:r.dataKey,domain:r.domain,height:r.height,hide:r.hide,id:r.xAxisId,includeHidden:r.includeHidden,interval:r.interval,minTickGap:r.minTickGap,mirror:r.mirror,name:r.name,orientation:r.orientation,padding:r.padding,reversed:r.reversed,scale:r.scale,tick:r.tick,tickCount:r.tickCount,tickFormatter:r.tickFormatter,ticks:r.ticks,type:r.type,unit:r.unit,niceTicks:r.niceTicks}),ec.createElement(Lg,r))},Ls);Lv.displayName="XAxis";var L_=["type"],Lb=["dangerouslySetInnerHTML","ticks","scale"],Lx=["id","scale"];function Lw(){return(Lw=Object.assign.bind()).apply(null,arguments)}function LE(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function LT(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?LE(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}
56(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):LE(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function LA(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}function LS(t){var r=ED(),i=(0,ec.useRef)(null),n=TH(),a=t.type,o=LA(t,L_),s=AT(n,"yAxis",a),l=(0,ec.useMemo)(()=>{if(null!=s)return LT(LT({},o),{},{type:s})},[s,o]);return(0,ec.useLayoutEffect)(()=>{null!=l&&(null===i.current?r(Dp(l)):i.current!==l&&r(Dm({prev:i.current,next:l})),i.current=l)},[l,r]),(0,ec.useLayoutEffect)(()=>()=>{i.current&&(r(Dg(i.current)),i.current=null)},[r]),null}function LC(t){var r=t.yAxisId,i=t.className,n=t.width,a=t.label,o=(0,ec.useRef)(null),s=(0,ec.useRef)(null),l=EO(Ty),u=T_(),c=ED(),h="yAxis",f=EO(t=>CO(t,r)),d=EO(t=>Ck(t,r)),p=EO(t=>CB(t,h,r,u)),m=EO(t=>Sn(t,r));if((0,ec.useLayoutEffect)(()=>{if(!("auto"!==n||!f||kb(a)||(0,ec.isValidElement)(a))&&null!=m){var t=o.current;if(t){var i=t.getCalculatedWidth();Math.round(f.width)!==Math.round(i)&&c(Dy({id:r,width:i}))}}},[p,f,c,a,r,n,m]),null==f||null==d||null==m)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var g=LA(t,Lb);m.id,m.scale;var y=LA(m,Lx);return ec.createElement(Lr,Lw({},g,y,{ref:o,labelRef:s,x:d.x,y:d.y,tickTextProps:"auto"===n?{width:void 0}:{width:n},width:f.width,height:f.height,className:(0,Tw.clsx)("recharts-".concat(h," ").concat(h),i),viewBox:l,ticks:p,axisType:h,axisId:r}))}var LM={allowDataOverflow:Si.allowDataOverflow,allowDecimals:Si.allowDecimals,allowDuplicatedCategory:Si.allowDuplicatedCategory,angle:Si.angle,axisLine:N5.axisLine,hide:!1,includeHidden:Si.includeHidden,interval:Si.interval,label:!1,minTickGap:Si.minTickGap,mirror:Si.mirror,orientation:Si.orientation,padding:Si.padding,reversed:Si.reversed,scale:Si.scale,tick:Si.tick,tickCount:Si.tickCount,tickLine:N5.tickLine,tickSize:N5.tickSize,type:Si.type,niceTicks:Si.niceTicks,width:Si.width,yAxisId:0},LD=ec.memo(t=>{var r=IA(t,LM);return ec.createElement(ec.Fragment,null,ec.createElement(LS,{interval:r.interval,id:r.yAxisId,scale:r.scale,type:r.type,domain:r.domain,allowDataOverflow:r.allowDataOverflow,dataKey:r.dataKey,allowDuplicatedCategory:r.allowDuplicatedCategory,allowDecimals:r.allowDecimals,tickCount:r.tickCount,padding:r.padding,includeHidden:r.includeHidden,reversed:r.reversed,ticks:r.ticks,width:r.width,orientation:r.orientation,mirror:r.mirror,hide:r.hide,unit:r.unit,name:r.name,angle:r.angle,minTickGap:r.minTickGap,tick:r.tick,tickFormatter:r.tickFormatter,niceTicks:r.niceTicks}),ec.createElement(LC,r))},Ls);function LP(){return(LP=Object.assign.bind()).apply(null,arguments)}function LI(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Lk(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?LI(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):LI(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function LO(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function LN(t){return Array.isArray(t)&&wB(t[0])&&wB(t[1])?t.join(" ~ "):t}LD.displayName="YAxis";var LL={margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"}
56,LR={display:"block",paddingTop:4,paddingBottom:4,color:"#000"},LF={},LB=t=>{var r=t.separator,i=void 0===r?" : ":r,n=t.contentStyle,a=t.itemStyle,o=t.labelStyle,s=t.payload,l=t.formatter,u=t.itemSorter,c=t.wrapperClassName,h=t.labelClassName,f=t.label,d=t.labelFormatter,p=t.accessibilityLayer,m=Lk(Lk({},LL),n),g=Lk({margin:0},void 0===o?LF:o),y=null!=f,v=y?f:"",_=(0,Tw.clsx)("recharts-default-tooltip",c),b=(0,Tw.clsx)("recharts-tooltip-label",h);return y&&d&&null!=s&&(v=d(f,s)),ec.createElement("div",LP({className:_,style:m},void 0!==p&&p?{role:"status","aria-live":"assertive"}:{}),ec.createElement("p",{className:b,style:g},ec.isValidElement(v)?v:"".concat(v)),(()=>{if(s&&s.length){var t=(null==u?s:EG(s,u)).map((t,r)=>{if(!t||"none"===t.type)return null;var n=t.formatter||l||LN,o=t.value,u=t.name,c=o,h=u,f=n(o,u,t,r,s);if(Array.isArray(f)){var d=function(t){if(Array.isArray(t))return t}(f)||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(f)||function(t){if(t){if("string"==typeof t)return LO(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?LO(t,2):void 0}}(f)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();c=d[0],h=d[1]}else{if(null==f)return null;c=f}var p=Lk(Lk({},LR),{},{color:t.color||LR.color},a);return ec.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(r),style:p},wB(h)?ec.createElement("span",{className:"recharts-tooltip-item-name"},h):null,wB(h)?ec.createElement("span",{className:"recharts-tooltip-item-separator"},i):null,ec.createElement("span",{className:"recharts-tooltip-item-value"},c),ec.createElement("span",{className:"recharts-tooltip-item-unit"},t.unit||""))});return ec.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},t)}return null})())},Lz="recharts-tooltip-wrapper",Lj={visibility:"hidden"};function LU(t){var r=t.allowEscapeViewBox,i=t.coordinate,n=t.key,a=t.offset,o=t.position,s=t.reverseDirection,l=t.tooltipDimension,u=t.viewBox,c=t.viewBoxDimension;if(o&&wF(o[n]))return o[n];var h=i[n]-l-(a>0?a:0),f=i[n]+a;if(r[n])return s[n]?h:f;var d=u[n];return null==d?0:s[n]?h<d?Math.max(f,d):Math.max(h,d):null==c?0:f+l>d+c?Math.max(h,d):Math.max(f,d)}function LV(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function L$(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?LV(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):LV(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function LG(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}var Lq=ec.memo(function(t){var r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D=kX(),P=function(t){if(Array.isArray(t))return t}(w=ec.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}
56finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(w)||function(t){if(t){if("string"==typeof t)return LG(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?LG(t,2):void 0}}(w)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),I=P[0],k=P[1];ec.useEffect(()=>{var r=r=>{if("Escape"===r.key){var i,n,a,o;k({dismissed:!0,dismissedAtCoordinate:{x:null!=(i=null==(n=t.coordinate)?void 0:n.x)?i:0,y:null!=(a=null==(o=t.coordinate)?void 0:o.y)?a:0}})}};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[null==(E=t.coordinate)?void 0:E.x,null==(T=t.coordinate)?void 0:T.y]),I.dismissed&&((null!=(A=null==(S=t.coordinate)?void 0:S.x)?A:0)!==I.dismissedAtCoordinate.x||(null!=(C=null==(M=t.coordinate)?void 0:M.y)?C:0)!==I.dismissedAtCoordinate.y)&&k(L$(L$({},I),{},{dismissed:!1}));var O=(d=(r={allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:"number"==typeof t.offset?t.offset:t.offset.x,offsetTop:"number"==typeof t.offset?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:t.lastBoundingBox,useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}).allowEscapeViewBox,p=r.coordinate,m=r.offsetTop,g=r.offsetLeft,y=r.position,v=r.reverseDirection,_=r.tooltipBox,b=r.useTranslate3d,x=r.viewBox,_&&_.height>0&&_.width>0&&p?(n=(i={translateX:h=LU({allowEscapeViewBox:d,coordinate:p,key:"x",offset:g,position:y,reverseDirection:v,tooltipDimension:_.width,viewBox:x,viewBoxDimension:x.width}),translateY:f=LU({allowEscapeViewBox:d,coordinate:p,key:"y",offset:m,position:y,reverseDirection:v,tooltipDimension:_.height,viewBox:x,viewBoxDimension:x.height}),useTranslate3d:b}).translateX,a=i.translateY,c={transform:i.useTranslate3d?"translate3d(".concat(n,"px, ").concat(a,"px, 0)"):"translate(".concat(n,"px, ").concat(a,"px)")}):c=Lj,{cssProperties:c,cssClasses:(s=(o={translateX:h,translateY:f,coordinate:p}).coordinate,l=o.translateX,u=o.translateY,(0,Tw.clsx)(Lz,{["".concat(Lz,"-right")]:wF(l)&&s&&wF(s.x)&&l>=s.x,["".concat(Lz,"-left")]:wF(l)&&s&&wF(s.x)&&l<s.x,["".concat(Lz,"-bottom")]:wF(u)&&s&&wF(s.y)&&u>=s.y,["".concat(Lz,"-top")]:wF(u)&&s&&wF(s.y)&&u<s.y}))}),N=O.cssClasses,L=O.cssProperties,R=t.hasPortalFromProps?{}:L$(L$({transition:function(t){if((!t.prefersReducedMotion||"auto"!==t.isAnimationActive)&&t.isAnimationActive&&t.active){var r="string"==typeof t.animationEasing?t.animationEasing:"ease";return"transform ".concat(t.animationDuration,"ms ").concat(r)}}({prefersReducedMotion:D,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},L),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),F=L$(L$({},R),{},{visibility:!I.dismissed&&t.active&&t.hasPayload?"visible":"hidden"},t.wrapperStyle);return ec.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:N,style:F,ref:t.innerRef},t.children)});function LH(t){return t}function LW(t){return null==t||"object"!=typeof t&&"function"!=typeof t}function LZ(t,r,i,n=new Map,a){let o=a?.(t,r,i,n);if(void 0!==o)return o;if(LW(t))return t;if(n.has(t))return n.get(t);if(Array.isArray(t)){let r=Array(t.length);n.set(t,r);for(let o=0;o<t.length;o++)r[o]=LZ(t[o],o,i,n,a);return Object.hasOwn(t,"index")&&(r.index=t.index),Object.hasOwn(t,"input")&&(r.input=t.input),r}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){let r=new RegExp(t.source,t.flags);return r.lastIndex=t.lastIndex,r}if(t instanceof Map){let r=new Map;for(let[o,s]of(n.set(t,r),t))r.set(o,LZ(s,o,i,n,a));return r}if(t instanceof Set){let r=new Set;for(let o of(n.set(t,r),t))r.add(LZ(o,void 0,i,n,a));return r}if(NH(t))return t.subarray();if(ArrayBuffer.isView(t)&&!(t instanceof DataView)){let r=new(Object.getPrototypeOf(t)).constructor(t.length);n.set(t,r);for(let o=0;o<t.length;o++)r[o]=LZ(t[o],o,i,n,a);return r}if(t instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){let r=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return n.set(t,r),LY(r,t,i,n,a),r}if("u">typeof File&&t instanceof File){let r=new File([t],t.name,{type:t.type});return n.set(t,r),LY(r,t,i,n,a),r}if("u">typeof Blob&&t instanceof Blob){let r=new Blob([t],{type:t.type});return n.set(t,r),LY(r,t,i,n,a),r}if(t instanceof Error){let r=structuredClone(t);return n.set(t,r),r.message=t.message,r.name=t.name,r.stack=t.stack,r.cause=t.cause,r.constructor=t.constructor,LY(r,t,i,n,a),r}if(t instanceof Boolean){let r=new Boolean(t.valueOf());return n.set(t,r),LY(r,t,i,n,a),r}if(t instanceof Number){let r=new Number(t.valueOf());return n.set(t,r),LY(r,t,i,n,a),r}if(t instanceof String){let r=new String(t.valueOf());return n.set(t,r),LY(r,t,i,n,a),r}if("object"==typeof t&&function(t){switch(Nw(t)){case NC:case Nk:case NO:case NL:case NS:case ND:case N$:case NG:case Nj:case NU:case NV:case NP:case NA:case NN:case NE:case NI:case NT:case NM:case NR:case NF:case NB:case Nz:return!0;default:return!1}}(t)){let r=Object.create(Object.getPrototypeOf(t));return n.set(t,r),LY(r,t,i,n,a),r}return t}
56function LY(t,r,i=t,n,a){let o=[...Object.keys(r),...Nx(r)];for(let s=0;s<o.length;s++){let l=o[s],u=Object.getOwnPropertyDescriptor(t,l);(null==u||u.writable)&&(t[l]=LZ(r[l],l,i,n,a))}}function LX(t,r,i,n,a=!1){if(r===t)return!0;switch(typeof r){case"object":return function(t,r,i,n,a=!1){if(null==r)return!0;if(Array.isArray(r))return LK(t,r,i,n);if(r instanceof Map){var o,s,l,u,c=t,h=r,f=i,d=n;if(0===h.size)return!0;if(!(c instanceof Map))return!1;for(let[t,r]of h.entries())if(!1===f(c.get(t),r,t,c,h,d))return!1;return!0}if(r instanceof Set){return o=t,s=r,l=i,u=n,0===s.size||o instanceof Set&&LK([...o],[...s],l,u)}let p=Object.keys(r);if(null==t)return a&&0===p.length;if(a)LW(t)&&(t=Object(t));else{let r=Nw(t);if("[object Object]"!==r&&"[object Arguments]"!==r)return!1}if(0===p.length)return!0;if(n?.has(r))return n.get(r)===t;n?.set(r,t);try{for(let a=0;a<p.length;a++){let o=p[a];if(!(o in t)||void 0===r[o]&&void 0!==t[o]||null===r[o]&&null!==t[o]||!i(t[o],r[o],o,t,r,n))return!1}return!0}finally{n?.delete(r)}}(t,r,i,n,a);case"function":if(Object.keys(r).length>0)return LX(t,{...r},i,n,a);return EN(t,r);default:if(!ER(t))return EN(t,r);if(a){if("string"==typeof r)return""===r;return!0}return EN(t,r)}}function LK(t,r,i,n){if(0===r.length)return!0;if(!Array.isArray(t))return!1;let a=new Set;for(let o=0;o<r.length;o++){let s=r[o],l=!1;for(let u=0;u<t.length;u++){if(a.has(u))continue;let c=t[u],h=!1;if(i(c,s,o,t,r,n)&&(h=!0),h){a.add(u),l=!0;break}}if(!l)return!1}return!0}function LQ(t,r){return function t(r,i,n){return"function"!=typeof n?t(r,i,()=>void 0):LX(r,i,function t(r,i,a,o,s,l){let u=n(r,i,a,o,s,l);return void 0!==u?!!u:LX(r,i,t,l,!1)},new Map,!0)}(t,r,()=>void 0)}function LJ(t){return 0===t?0:t}function L0(t,r=LH){var i;return EL(t)?(function(t,r){let i=new Map;for(let n=0;n<t.length;n++){let a=t[n],o=r(a,n,t);i.has(o)||i.set(o,a)}return Array.from(i.values())})(Array.from(t),(i=function(t){var r,i;if(null==t)return LH;switch(typeof t){case"function":return t;case"object":if(Array.isArray(t)&&2===t.length)return function(t,r){var i,n,a;switch(typeof t){case"object":Object.is(t?.valueOf(),-0)&&(t="-0");break;case"number":t=wM(t)}return n=i=r,a=(t,r,n,a)=>{let o;if(void 0!==o)return o;if("object"==typeof i){if("[object Object]"===Nw(i)&&"function"!=typeof i.constructor){let t={};return a.set(i,t),LY(t,i,n,a),t}switch(Object.prototype.toString.call(i)){case NA:case NT:case NS:{let t=new i.constructor(i?.valueOf());return LY(t,i),t}case NC:{let t={};return LY(t,i),t.length=i.length,t[Symbol.iterator]=i[Symbol.iterator],t}default:return}}},r=LZ(n,void 0,n,new Map,a),function(i){let n=wI(i,t);return void 0===n?function(t,r){let i;if(0===(i=Array.isArray(r)?r:"string"==typeof r&&wC(r)&&!(r in Object(t))?wP(r):[r]).length)return!1;let n=t;for(let t=0;t<i.length;t++){var a;let r=wM(i[t]);if((null==n||!Object.hasOwn(n,r))&&!((Array.isArray(n)||null!==(a=n)&&"object"==typeof a&&"[object Arguments]"===Nw(a))&&EB(r)&&Number(r)<n.length))return!1;n=n[r]}return!0}(i,t):void 0===r?void 0===n:LQ(n,r)}}(t[0],t[1]);return r=LZ(i=r=t,void 0,i,new Map,void 0),t=>LQ(t,r);default:return function(r){return wI(r,t)}}}(r),function(...t){return i.apply(this,t.slice(0,1))})).map(LJ):[]}function L1(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function L2(t,r){return Math.abs(t.height-r.height)>1||Math.abs(t.left-r.left)>1||Math.abs(t.top-r.top)>1||Math.abs(t.width-r.width)>1}function L3(t){var r=t.getBoundingClientRect();return{height:r.height,left:r.left,top:r.top,width:r.width}}function L4(t){this._context=t}function L6(t){return new L4(t)}function L5(t){return t[0]}function L8(t){return t[1]}function L7(t,r){var i=s9(!0),n=null,a=L6,o=null,s=lo(l);function l(l){var u,c,h,f=(l=EH(l)).length,d=!1;for(null==n&&(o=a(h=s())),u=0;u<=f;++u)!(u<f&&i(c=l[u],u,l))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+t(c,u,l),+r(c,u,l));if(h)return o=null,h+""||null}return t="function"==typeof t?t:void 0===t?L5:s9(t),r="function"==typeof r?r:void 0===r?L8:s9(r),l.x=function(r){return arguments.length?(t="function"==typeof r?r:s9(+r),l):t},l.y=function(t){return arguments.length?(r="function"==typeof t?t:s9(+t),l):r},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:s9(!!t),l):i},l.curve=function(t){return arguments.length?(a=t,null!=n&&(o=a(n)),l):a},l.context=function(t){return arguments.length?(null==t?n=o=null:o=a(n=t),l):n},l}function L9(t,r,i){var n=null,a=s9(!0),o=null,s=L6,l=null,u=lo(c);function c(c){var h,f,d,p,m,g=(c=EH(c)).length,y=!1,v=Array(g),_=Array(g);for(null==o&&(l=s(m=u())),h=0;h<=g;++h){if(!(h<g&&a(p=c[h],h,c))===y)if(y=!y)f=h,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),d=h-1;d>=f;--d)l.point(v[d],_[d]);l.lineEnd(),l.areaEnd()}y&&(v[h]=+t(p,h,c),_[h]=+r(p,h,c),l.point(n?+n(p,h,c):v[h],i?+i(p,h,c):_[h]))}if(m)return l=null,m+""||null}
vendor: 6,240 bytes, line 56
56function h(){return L7().defined(a).curve(s).context(o)}return t="function"==typeof t?t:void 0===t?L5:s9(+t),r="function"==typeof r?r:void 0===r?s9(0):s9(+r),i="function"==typeof i?i:void 0===i?L8:s9(+i),c.x=function(r){return arguments.length?(t="function"==typeof r?r:s9(+r),n=null,c):t},c.x0=function(r){return arguments.length?(t="function"==typeof r?r:s9(+r),c):t},c.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:s9(+t),c):n},c.y=function(t){return arguments.length?(r="function"==typeof t?t:s9(+t),i=null,c):r},c.y0=function(t){return arguments.length?(r="function"==typeof t?t:s9(+t),c):r},c.y1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:s9(+t),c):i},c.lineX0=c.lineY0=function(){return h().x(t).y(r)},c.lineY1=function(){return h().x(t).y(i)},c.lineX1=function(){return h().x(n).y(r)},c.defined=function(t){return arguments.length?(a="function"==typeof t?t:s9(!!t),c):a},c.curve=function(t){return arguments.length?(s=t,null!=o&&(l=s(o)),c):s},c.context=function(t){return arguments.length?(null==t?o=l=null:l=s(o=t),c):o},c}function Re(t,r,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+r)/6,(t._y0+4*t._y1+i)/6)}function Rt(t){this._context=t}function Rr(){}function Ri(t){this._context=t}function Rn(t){this._context=t}L4.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:this._context.lineTo(t,r)}}},Rt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Re(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Re(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}},Ri.prototype={areaStart:Rr,areaEnd:Rr,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._x2=t,this._y2=r;break;case 1:this._point=2,this._x3=t,this._y3=r;break;case 2:this._point=3,this._x4=t,this._y4=r,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+r)/6);break;default:Re(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}},Rn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var i=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+r)/6;this._line?this._context.lineTo(i,n):this._context.moveTo(i,n);break;case 3:this._point=4;default:Re(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};class Ra{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r)}this._x0=t,this._y0=r}}function Ro(t){this._context=t}Ro.prototype={areaStart:Rr,areaEnd:Rr,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,r){t*=1,r*=1,this._point?this._context.lineTo(t,r):(this._point=1,this._context.moveTo(t,r))}};function Rs(t,r,i){var n=t._x1-t._x0,a=r-t._x1,o=(t._y1-t._y0)/(n||a<0&&-0),s=(i-t._y1)/(a||n<0&&-0);return((o<0?-1:1)+(s<0?-1:1))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs((o*a+s*n)/(n+a)))||0}function Rl(t,r){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-r)/2:r}function Ru(t,r,i){var n=t._x0,a=t._y0,o=t._x1,s=t._y1,l=(o-n)/3;t._context.bezierCurveTo(n+l,a+l*r,o-l,s-l*i,o,s)}function Rc(t){this._context=t}function Rh(t){this._context=new Rf(t)}function Rf(t){this._context=t}function Rd(t){this._context=t}function Rp(t){var r,i,n=t.length-1,a=Array(n),o=Array(n),s=Array(n);for(a[0]=0,o[0]=2,s[0]=t[0]+2*t[1],r=1;r<n-1;++r)a[r]=1,o[r]=4,s[r]=4*t[r]+2*t[r+1];for(a[n-1]=2,o[n-1]=7,s[n-1]=8*t[n-1]+t[n],r=1;r<n;++r)i=a[r]/o[r-1],o[r]-=i,s[r]-=i*s[r-1];for(a[n-1]=s[n-1]/o[n-1],r=n-2;r>=0;--r)a[r]=(s[r]-a[r+1])/o[r];for(o[n-1]=(t[n]+a[n-1])/2,r=0;r<n-1;++r)o[r]=2*t[r+1]-a[r+1];return[a,o]}function Rm(t,r){this._context=t,this._t=r}function Rg(){return(Rg=Object.assign.bind()).apply(null,arguments)}function Ry(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Rv(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};
56r%2?Ry(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ry(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}Rc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ru(this,this._t0,Rl(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){var i=NaN;if(r*=1,(t*=1)!==this._x1||r!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,Ru(this,Rl(this,i=Rs(this,t,r)),i);break;default:Ru(this,this._t0,i=Rs(this,t,r))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r,this._t0=i}}},(Rh.prototype=Object.create(Rc.prototype)).point=function(t,r){Rc.prototype.point.call(this,r,t)},Rf.prototype={moveTo:function(t,r){this._context.moveTo(r,t)},closePath:function(){this._context.closePath()},lineTo:function(t,r){this._context.lineTo(r,t)},bezierCurveTo:function(t,r,i,n,a,o){this._context.bezierCurveTo(r,t,n,i,o,a)}},Rd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,r=this._y,i=t.length;if(i)if(this._line?this._context.lineTo(t[0],r[0]):this._context.moveTo(t[0],r[0]),2===i)this._context.lineTo(t[1],r[1]);else for(var n=Rp(t),a=Rp(r),o=0,s=1;s<i;++o,++s)this._context.bezierCurveTo(n[0][o],a[0][o],n[1][o],a[1][o],t[s],r[s]);(this._line||0!==this._line&&1===i)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,r){this._x.push(+t),this._y.push(+r)}},Rm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,r),this._context.lineTo(t,r);else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,r)}}this._x=t,this._y=r}};var R_={curveBasisClosed:function(t){return new Ri(t)},curveBasisOpen:function(t){return new Rn(t)},curveBasis:function(t){return new Rt(t)},curveBumpX:function(t){return new Ra(t,!0)},curveBumpY:function(t){return new Ra(t,!1)},curveLinearClosed:function(t){return new Ro(t)},curveLinear:L6,curveMonotoneX:function(t){return new Rc(t)},curveMonotoneY:function(t){return new Rh(t)},curveNatural:function(t){return new Rd(t)},curveStep:function(t){return new Rm(t,.5)},curveStepAfter:function(t){return new Rm(t,1)},curveStepBefore:function(t){return new Rm(t,0)}},Rb=t=>EQ(t.x)&&EQ(t.y),Rx=t=>null!=t.base&&Rb(t.base)&&Rb(t),Rw=t=>t.x,RE=t=>t.y,RT=t=>{var r=t.className,i=t.points,n=t.path,a=t.pathRef,o=EO(Tq);if((!i||!i.length)&&!n)return null;var s={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||o,connectNulls:t.connectNulls},l=i&&i.length?(t=>{var r=t.type,i=t.points,n=void 0===i?[]:i,a=t.baseLine,o=t.layout,s=t.connectNulls,l=void 0!==s&&s,u=((t,r)=>{if("function"==typeof t)return t;var i="curve".concat(wG(t));if(("curveMonotone"===i||"curveBump"===i)&&r){var n=R_["".concat(i).c
56oncat("vertical"===r?"Y":"X")];if(n)return n}return R_[i]||L6})(void 0===r?"linear":r,o),c=l?n.filter(Rb):n;if(Array.isArray(a)){var h=n.map((t,r)=>Rv(Rv({},t),{},{base:a[r]}));return("vertical"===o?L9().y(RE).x1(Rw).x0(t=>t.base.x):L9().x(Rw).y1(RE).y0(t=>t.base.y)).defined(Rx).curve(u)(l?h.filter(Rx):h)}return("vertical"===o&&wF(a)?L9().y(RE).x1(Rw).x0(a):wF(a)?L9().x(Rw).y1(RE).y0(a):L7().x(Rw).y(RE)).defined(Rb).curve(u)(c)})(s):n;return ec.createElement("path",Rg({},PG(t),(t=>{if(!t||"function"==typeof t||"boolean"==typeof t)return null;var r=t;if((0,ec.isValidElement)(t)&&(r=t.props),"object"!=typeof r&&"function"!=typeof r)return null;var i={};return Object.keys(r).forEach(t=>{Pj(t)&&"function"==typeof r[t]&&(i[t]=i=>r[t](r,i))}),i})(t),{className:(0,Tw.clsx)("recharts-curve",r),d:null===l?void 0:l,ref:a}))},RA=["x","y","top","left","width","height","className"];function RS(){return(RS=Object.assign.bind()).apply(null,arguments)}function RC(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}var RM=t=>
56{var r=t.x,i=void 0===r?0:r,n=t.y,a=void 0===n?0:n,o=t.top,s=void 0===o?0:o,l=t.left,u=void 0===l?0:l,c=t.width,h=void 0===c?0:c,f=t.height,d=void 0===f?0:f,p=t.className,m=function(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?RC(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):RC(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}({x:i,y:a,top:s,left:u,width:h,height:d},function(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}(t,RA));return wF(i)&&wF(a)&&wF(h)&&wF(d)&&wF(s)&&wF(u)?ec.createElement("path",RS({},PH(m),{className:(0,Tw.clsx)("recharts-cross",p),d:"M".concat(i,",").concat(s,"v").concat(d,"M").concat(u,",").concat(a,"h").concat(h)})):null};function RD(t){var r=t.cx,i=t.cy,n=t.radius,a=t.startAngle,o=t.endAngle;return{points:[A_(r,i,n,a),A_(r,i,n,o)],cx:r,cy:i,radius:n,startAngle:a,endAngle:o}}function RP(){return(RP=Object.assign.bind()).apply(null,arguments)}function RI(t,r){return r||(r=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(r)}}))}var Rk=t=>{var r=t.cx,i=t.cy,n=t.radius,a=t.angle,o=t.sign,s=t.isExternal,l=t.cornerRadius,u=t.cornerIsExternal,c=l*(s?1:-1)+n,h=Math.asin(l/c)/Av,f=u?a:a+o*h,d=A_(r,i,c,f);return{center:d,circleTangency:A_(r,i,n,f),lineTangency:A_(r,i,c*Math.cos(h*Av),u?a-o*h:a),theta:h}},RO=t=>{var r=t.cx,i=t.cy,n=t.innerRadius,a=t.outerRadius,o=t.startAngle,s=t.endAngle,l=wN(s-o)*Math.min(Math.abs(s-o),359.999),u=o+l,c=A_(r,i,a,o),h=A_(r,i,a,u),f=wO(er||(er=RI(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,a,a,+(Math.abs(l)>180),+(o>u),h.x,h.y);if(n>0){var d=A_(r,i,n,o),p=A_(r,i,n,u);f+=wO(ei||(ei=RI(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),p.x,p.y,n,n,+(Math.abs(l)>180),+(o<=u),d.x,d.y)}else f+=wO(en||(en=RI(["L ",","," Z"])),r,i);return f},RN={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},RL=t=>{var r,i=IA(t,RN),n=i.cx,a=i.cy,o=i.innerRadius,s=i.outerRadius,l=i.cornerRadius,u=i.forceCornerRadius,c=i.cornerIsExternal,h=i.startAngle,f=i.endAngle,d=i.className;if(s<o||h===f)return null;var p=(0,Tw.clsx)("recharts-sector",d),m=s-o,g=wU(l,m,0,!0);return r=g>0&&360>Math.abs(h-f)?(t=>{var r=t.cx,i=t.cy,n=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,l=t.cornerIsExternal,u=t.startAngle,c=t.endAngle,h=wN(c-u),f=Rk({cx:r,cy:i,radius:a,angle:u,sign:h,cornerRadius:o,cornerIsExternal:l}),d=f.circleTangency,p=f.lineTangency,m=f.theta,g=Rk({cx:r,cy:i,radius:a,angle:c,sign:-h,cornerRadius:o,cornerIsExternal:l}),y=g.circleTangency,v=g.lineTangency,_=g.theta,b=l?Math.abs(u-c):Math.abs(u-c)-m-_;if(b<0)return s?wO(ea||(ea=RI(["M ",",","\n a",",",",0,0,1,",",0\n a",",",",0,0,1,",",0\n "])),p.x,p.y,o,o,2*o,o,o,-(2*o)):RO({cx:r,cy:i,innerRadius:n,outerRadius:a,startAngle:u,endAngle:c});var x=wO(eo||(eo=RI(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),p.x,p.y,o,o,+(h<0),d.x,d.y,a,a,+(b>180),+(h<0),y.x,y.y,o,o,+(h<0),v.x,v.y);if(n>0){var w=Rk({cx:r,cy:i,radius:n,angle:u,sign:h,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),E=w.circleTangency,T=w.lineTangency,A=w.theta,S=Rk({cx:r,cy:i,radius:n,angle:c,sign:-h,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),C=S.circleTangency,M=S.lineTangency,D=S.theta,P=l?Math.abs(u-c):Math.abs(u-c)-A-D;if(P<0&&0===o)return"".concat(x,"L").concat(r,",").concat(i,"Z");x+=wO(es||(es=RI(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),M.x,M.y,o,o,+(h<0),C.x,C.y,n,n,+(P>180),+(h>0),E.x,E.y,o,o,+(h<0),T.x,T.y)}
56else x+=wO(el||(el=RI(["L",",","Z"])),r,i);return x})({cx:n,cy:a,innerRadius:o,outerRadius:s,cornerRadius:Math.min(g,m/2),forceCornerRadius:u,cornerIsExternal:c,startAngle:h,endAngle:f}):RO({cx:n,cy:a,innerRadius:o,outerRadius:s,startAngle:h,endAngle:f}),ec.createElement("path",RP({},PH(i),{className:p,d:r}))};function RR(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function RF(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?RR(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):RR(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function RB(){return(RB=Object.assign.bind()).apply(null,arguments)}function Rz(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Rj(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Rz(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Rz(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function RU(t){var r=t.cursor,i=t.cursorComp,n=t.cursorProps;return(0,ec.isValidElement)(r)?(0,ec.cloneElement)(r,n):(0,ec.createElement)(i,n)}function RV(t){var r,i,n,a,o,s=t.coordinate,l=t.payload,u=t.index,c=t.offset,h=t.tooltipAxisBandSize,f=t.layout,d=t.cursor,p=t.tooltipEventType,m=t.chartName;if(!d||!s||"ScatterChart"!==m&&"axis"!==p)return null;if("ScatterChart"===m)n=s,a=RM,o=Ab.cursorLine;else if("BarChart"===m)r=h/2,n={stroke:"none",fill:"#ccc",x:"horizontal"===f?s.x-r:c.left+.5,y:"horizontal"===f?c.top+.5:s.y-r,width:"horizontal"===f?h:c.width-1,height:"horizontal"===f?c.height-1:h},a=Ol,o=Ab.cursorRectangle;else if("radial"===f&&kj(s)){var g=RD(s),y=g.cx,v=g.cy,_=g.radius;n={cx:y,cy:v,startAngle:g.startAngle,endAngle:g.endAngle,innerRadius:_,outerRadius:_},a=RL,o=Ab.cursorLine}else n={points:function(t,r,i){if("horizontal"===t)return[{x:r.x,y:i.top},{x:r.x,y:i.top+i.height}];if("vertical"===t)return[{x:i.left,y:r.y},{x:i.left+i.width,y:r.y}];if(kj(r)){if("centric"===t){var n=r.cx,a=r.cy,o=r.innerRadius,s=r.outerRadius,l=r.angle,u=A_(n,a,o,l),c=A_(n,a,s,l);return[{x:u.x,y:u.y},{x:c.x,y:c.y}]}return RD(r)}}(f,s,c)},a=RT,o=Ab.cursorLine;var b="object"==typeof d&&"className"in d?d.className:void 0,x=Rj(Rj(Rj(Rj({stroke:"#ccc",pointerEvents:"none"},c),n),Pq(d)),{},{payload:l,payloadIndex:u,className:(0,Tw.clsx)("recharts-tooltip-cursor",b)});return ec.createElement(ku,{zIndex:null!=(i=t.zIndex)?i:o},ec.createElement(RU,{cursor:d,cursorComp:a,cursorProps:x}))}function R$(t){var r,i,n,a=(r=EO(Sk),i=EO(Mk),n=EO(MD),r&&n?Tn(RF(RF({},r),{},{scale:n}),i):Tn(void 0,i)),o=TG(),s=EO(Tq),l=EO(Af);return null==a||null==o||null==s||null==l?null:ec.createElement(RV,RB({},t,{offset:o,layout:s,tooltipAxisBandSize:a,chartName:l}))}function RG(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Rq(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};
56r%2?RG(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):RG(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function RH(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,n=Array(r);i<r;i++)n[i]=t[i];return n}function RW(t){return t.dataKey}var RZ=[],RY={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function RX(t){var r,i,n,a,o,s,l,u,c,h,f,d,p=IA(t,RY),m=p.active,g=p.allowEscapeViewBox,y=p.animationDuration,v=p.animationEasing,_=p.content,b=p.filterNull,x=p.isAnimationActive,w=p.offset,E=p.payloadUniqBy,T=p.position,A=p.reverseDirection,S=p.useTranslate3d,C=p.wrapperStyle,M=p.cursor,D=p.shared,P=p.trigger,I=p.defaultIndex,k=p.portal,O=p.axisId,N=ED(),L="number"==typeof I?String(I):I;(0,ec.useEffect)(()=>{N(En({shared:D,trigger:P,axisId:O,active:m,defaultIndex:L}))},[N,D,P,O,m,L]);var R=TV(),F=PB(),B=EO(t=>CW(t,D)),z=null!=(f=EO(t=>M5(t,B,P,L)))?f:{},j=z.activeIndex,U=z.isActive,V=EO(t=>M6(t,B,P,L)),$=EO(t=>M4(t,B,P,L)),G=EO(t=>M3(t,B,P,L)),q=(0,ec.useContext)(In),H=null!=(d=null!=m?m:U)&&d,W=function(t){if(Array.isArray(t))return t}(r=function(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=function(t){if(Array.isArray(t))return t}(t=(0,ec.useState)({height:0,left:0,top:0,width:0}))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(t)||function(t){if(t){if("string"==typeof t)return L1(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L1(t,2):void 0}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=i[0],a=i[1],o=(0,ec.useRef)(null),s=(0,ec.useRef)(n);s.current=n;var l=(0,ec.useCallback)(t=>{if(null!=o.current&&(o.current.disconnect(),o.current=null),null!=t){var r=L3(t);if(L2(r,s.current)&&a(r),"u">typeof ResizeObserver){var i=new ResizeObserver(()=>{var r=L3(t);L2(r,s.current)&&a(r)});i.observe(t),o.current=i}}},[...r]);return(0,ec.useEffect)(()=>()=>{var t;null==(t=o.current)||t.disconnect()},[]),[n,l]}([V,H]))||function(t){var r=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{a=(r=r.call(t)).next,!1;for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),2!==s.length);l=!0);}catch(t){u=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(r)||function(t){if(t){if("string"==typeof t)return RH(t,2);var r=({}).toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?RH(t,2):void 0}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),Z=W[0],Y=W[1],X="axis"===B?$:void 0;i=EO(t=>((t,r,i)=>{if(null!=r){var n=C2(t);return"axis"===r?"hover"===i?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:"hover"===i?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}})(t,B,P)),n=EO(Mj),a=EO(Am),o=EO(Ad),s=EO(Ap),u=(null==(l=EO(P9))?void 0:l.sourceViewBox)!=null,c=TV(),(0,ec.useEffect)(()=>
56{if(!u&&null!=o&&null!=a){var t=Eh({active:H,coordinate:G,dataKey:i,index:j,label:"number"==typeof X?String(X):X,sourceViewBox:c,graphicalItemId:n});P5.emit(P8,o,t,a)}},[u,G,i,n,j,X,a,o,s,H,c]);var K=null!=k?k:q;if(null==K||null==R||null==B)return null;var Q=null!=V?V:RZ;H||(Q=RZ),b&&Q.length&&(h=Q.filter(t=>null!=t.value&&(!0!==t.hide||p.includeHidden)),Q=!0===E?L0(h,RW):"function"==typeof E?L0(h,E):h);var J=Q.length>0,ee=Rq(Rq({},p),{},{payload:Q,label:X,active:H,activeIndex:j,coordinate:G,accessibilityLayer:F}),et=ec.createElement(Lq,{allowEscapeViewBox:g,animationDuration:y,animationEasing:v,isAnimationActive:x,active:H,coordinate:G,hasPayload:J,offset:w,position:T,reverseDirection:A,useTranslate3d:S,viewBox:R,wrapperStyle:C,lastBoundingBox:Z,innerRef:Y,hasPortalFromProps:!!k},ec.isValidElement(_)?ec.cloneElement(_,ee):"function"==typeof _?ec.createElement(_,ee):ec.createElement(LB,ee));return ec.createElement(ec.Fragment,null,(0,kl.createPortal)(et,K),H&&ec.createElement(R$,{cursor:M,tooltipEventType:B,coordinate:G,payload:Q,index:j}))}var RK=(0,ec.createContext)({grid:{stroke:"#ccc",fill:"none"}});RK.Provider;var RQ=["x1","y1","x2","y2","key"],RJ=["offset"],R0=["xAxisId","yAxisId"],R1=["xAxisId","yAxisId"];function R2(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function R3(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?R2(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):R2(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function R4(){return(R4=Object.assign.bind()).apply(null,arguments)}function R6(t,r){if(null==t)return{};var i,n,a=function(t,r){if(null==t)return{};var i={};for(var n in t)if(({}).hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;i[n]=t[n]}return i}(t,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)i=o[n],-1===r.indexOf(i)&&({}).propertyIsEnumerable.call(t,i)&&(a[i]=t[i])}return a}var R5=t=>{var r=t.fill;if(!r||"none"===r)return null;var i=t.fillOpacity,n=t.x,a=t.y,o=t.width,s=t.height,l=t.ry;return ec.createElement("rect",{x:n,y:a,ry:l,width:o,height:s,stroke:"none",fill:r,fillOpacity:i,className:"recharts-cartesian-grid-bg"})};function R8(t){var r=t.option,i=t.lineItemProps;if(ec.isValidElement(r))n=ec.cloneElement(r,i);else if("function"==typeof r)n=r(i);else{var n,a,o=i.x1,s=i.y1,l=i.x2,u=i.y2,c=i.key,h=null!=(a=PG(R6(i,RQ)))?a:{},f=(h.offset,R6(h,RJ)),d=Array.isArray(f.strokeDasharray)?f.strokeDasharray.join(","):f.strokeDasharray;n=ec.createElement("line",R4({},f,{strokeDasharray:d,x1:o,y1:s,x2:l,y2:u,fill:"none",key:c}))}return n}function R7(t){var r=t.x,i=t.width,n=t.horizontal,a=void 0===n||n,o=t.horizontalPoints;if(!a||!o||!o.length)return null;t.xAxisId,t.yAxisId;var s=R6(t,R0),l=o.map((t,n)=>{var o=R3(R3({},s),{},{x1:r,y1:t,x2:r+i,y2:t,key:"line-".concat(n),index:n});return ec.createElement(R8,{key:"line-".concat(n),option:a,lineItemProps:o})});return ec.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function R9(t){var r=t.y,i=t.height,n=t.vertical,a=void 0===n||n,o=t.verticalPoints;if(!a||!o||!o.length)return null;t.xAxisId,t.yAxisId;var s=R6(t,R1),l=o.map((t,n)=>{var o=R3(R3({},s),{},{x1:t,y1:r,x2:t,y2:r+i,key:"line-".concat(n),index:n});return ec.createElement(R8,{option:a,lineItemProps:o,key:"line-".concat(n)})});return ec.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function Fe(t){var r=t.horizontalFill,i=t.fillOpacity,n=t.x,a=t.y,o=t.width,s=t.height,l=t.horizontalPoints,u=t.horizontal;if(!(void 0===u||u)||!r||!r.length||null==l)return null;var c=l.map(t=>Math.round(t+a-a)).sort((t,r)=>t-r);a!==c[0]&&c.unshift(0);var h=c.map((t,l)=>{var u=c[l+1],h=null==u?a+s-t:u-t;if(h<=0)return null;var f=l%r.length;return ec.createElement("rect",{key:"react-".concat(l),y:t,x:n,height:h,width:o,stroke:"none",fill:r[f],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return ec.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},h)}function Ft(t){var r=t.vertical,i=t.verticalFill,n=t.fillOpacity,a=t.x,o=t.y,s=t.width,l=t.height,u=t.verticalPoints;if(!(void 0===r||r)||!i||!i.length)return null;var c=u.map(t=>Math.round(t+a-a)).sort((t,r)=>t-r);a!==c[0]&&c.unshift(0);var h=c.map((t,r)=>{var u=c[r+1],h=null==u?a+s-t:u-t;if(h<=0)return null;var f=r%i.length;return ec.createElement("rect",{key:"react-".concat(r),x:t,y:o,width:h,height:l,stroke:"none",fill:i[f],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return ec.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},h)}var Fr=(t,r)=>{var i=t.xAxis,n=t.width,a=t.height,o=t.offset;return E7(NJ(R3(R3(R3({},N5),i),{}
56,{ticks:E9(i,!0),viewBox:{x:0,y:0,width:n,height:a}})),o.left,o.left+o.width,r)},Fi=(t,r)=>{var i=t.yAxis,n=t.width,a=t.height,o=t.offset;return E7(NJ(R3(R3(R3({},N5),i),{},{ticks:E9(i,!0),viewBox:{x:0,y:0,width:n,height:a}})),o.top,o.top+o.height,r)},Fn={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ab.grid};function Fa(t){var r,i,n,a,o,s,l=EO(Ts),u=EO(Tl),c=TG(),h=R3(R3({},IA(t,Fn)),{},{x:wF(t.x)?t.x:c.left,y:wF(t.y)?t.y:c.top,width:wF(t.width)?t.width:c.width,height:wF(t.height)?t.height:c.height}),f=h.xAxisId,d=h.yAxisId,p=h.x,m=h.y,g=h.width,y=h.height,v=h.syncWithTicks,_=h.horizontalValues,b=h.verticalValues,x=T_(),w=EO(t=>CF(t,"xAxis",f,x)),E=EO(t=>CF(t,"yAxis",d,x)),T=(0,ec.useContext)(RK),A={stroke:null!=(r=h.stroke)?r:T.grid.stroke,strokeWidth:null!=(i=h.strokeWidth)?i:T.grid.strokeWidth,strokeOpacity:null!=(n=h.strokeOpacity)?n:T.grid.strokeOpacity,strokeDasharray:null!=(a=h.strokeDasharray)?a:T.grid.strokeDasharray};if(!EJ(g)||!EJ(y)||!wF(p)||!wF(m))return null;var S=h.verticalCoordinatesGenerator||Fr,C=h.horizontalCoordinatesGenerator||Fi,M=h.horizontalPoints,D=h.verticalPoints;if((!M||!M.length)&&"function"==typeof C){var P=_&&_.length,I=C({yAxis:E?R3(R3({},E),{},{ticks:P?_:E.ticks}):void 0,width:null!=l?l:g,height:null!=u?u:y,offset:c},!!P||v);TE(Array.isArray(I),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof I,"]")),Array.isArray(I)&&(M=I)}if((!D||!D.length)&&"function"==typeof S){var k=b&&b.length,O=S({xAxis:w?R3(R3({},w),{},{ticks:k?b:w.ticks}):void 0,width:null!=l?l:g,height:null!=u?u:y,offset:c},!!k||v);TE(Array.isArray(O),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof O,"]")),Array.isArray(O)&&(D=O)}return ec.createElement(ku,{zIndex:h.zIndex},ec.createElement("g",{className:"recharts-cartesian-grid"},ec.createElement(R5,{fill:null!=(o=h.fill)?o:T.grid.fill,fillOpacity:null!=(s=h.fillOpacity)?s:T.grid.fillOpacity,x:h.x,y:h.y,width:h.width,height:h.height,ry:h.ry}),ec.createElement(Fe,R4({},h,{horizontalPoints:M})),ec.createElement(Ft,R4({},h,{verticalPoints:D})),ec.createElement(R7,R4({},h,A,{offset:c,horizontalPoints:M,xAxis:w,yAxis:E})),ec.createElement(R9,R4({},h,A,{offset:c,verticalPoints:D,xAxis:w,yAxis:E}))))}Fa.displayName="CartesianGrid";class Fo{constructor(t){var r=t.x,i=t.y;this.xAxisScale=r,this.yAxisScale=i}map(t,r){var i,n,a=r.position;return{x:null!=(i=this.xAxisScale.map(t.x,{position:a}))?i:0,y:null!=(n=this.yAxisScale.map(t.y,{position:a}))?n:0}}mapWithFallback(t,r){var i,n,a,o,s=r.position,l=r.fallback;return a="rangeMin"===l?this.yAxisScale.rangeMin():"rangeMax"===l?this.yAxisScale.rangeMax():0,o="rangeMin"===l?this.xAxisScale.rangeMin():"rangeMax"===l?this.xAxisScale.rangeMax():0,{x:null!=(i=this.xAxisScale.map(t.x,{position:s}))?i:o,y:null!=(n=this.yAxisScale.map(t.y,{position:s}))?n:a}}isInRange(t){var r=t.x,i=t.y,n=null==r||this.xAxisScale.isInRange(r),a=null==i||this.yAxisScale.isInRange(i);return n&&a}}function Fs(t,r){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),i.push.apply(i,n)}return i}function Fl(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?Fs(Object(i),!0).forEach(function(r){var n,a,o;n=t,a=r,o=i[r],(a=function(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:r+""}(a))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Fs(Object(i)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(i,r))})}return t}function Fu(){return(Fu=Object.assign.bind()).apply(null,arguments)}function Fc(t){var r=ED();return(0,ec.useEffect)(()=>(r(DM(t)),()=>{r(DD(t))})),null}function Fh(t){var r,i,n,a,o,s,l,u,c,h,f,d=t.xAxisId,p=t.yAxisId,m=t.shape,g=t.className,y=t.ifOverflow,v=T_(),_=(0,ec.useContext)(Ib),b=EO(t=>Sr(t,d)),x=EO(t=>Sa(t,p)),w=EO(t=>Cx(t,"xAxis",d,v)),E=EO(t=>Cx(t,"yAxis",p,v)),T=TV();if(!_||!T||null==b||null==x||null==w||null==E)return null;var A=((t,r,i,n,a,o,s)=>{var l,u,c=s.x,h=s.y,f=s.segment,d=s.ifOverflow,p=wB(c);if(wB(h)){var m=i.x,g=i.width,y=r.map(h,{position:n});if(!EQ(y)||"discard"===d&&!r.isInRange(y))return null;var v=[{x:m+g,y:y},{x:m,y:y}];return"left"===o?v.reverse():v}if(p){var _=i.y,b=i.height,x=t.map(c,{position:n});if(!EQ(x)||"discard"===d&&!t.isInRange(x))return null;var w=[{x:x,y:_+b},{x:x,y:_}];return"top"===a?w.reverse():w}return null!=f&&2===f.length?(u=[(l=new Fo({x:t,y:r})).mapWithFallback(f[0],{position:n,fallback:"rangeMin"}),l.mapWithFallback(f[1],{position:n,fallback:"rangeMax"})],"discard"===d&&u.some(t=>!l.isInRange(t))?null:u):null})(w,E,T,t.position,b.orientation,x.orientation,t);if(!A)return null;var S=A[0],C=A[1];if(null==S||null==C)return null;var M=S.x,D=S.y,P=C.x,I=C.y,k=Fl(Fl({clipPath:"hidden"===y?"url(#".concat(_,")"):void 0},PH(t)),{},{x1:M,y1:D,x2:P,y2:I}),O=(i=(r={x1:M,y1:D,x2:P,y2:I}).x1,n=r.y1,a=r.x2,o=r.y2,s={x:i,y:n},l={x:a,y:o},u=s.x,c=s.y,{x:Math.min(u,h=l.x),y:Math.min(c,f=l.y),width:Math.abs(h-u),height:Math.abs(f-c)});return ec.createElement(ku,{zIndex:t.zIndex},ec.createElement(IL,{className:(0,Tw.clsx)("recharts-reference-line",g)},((t,r)=>{var i;if(ec.isValidElement(t))i=ec.cloneElement(t,r);else if("function"==typeof t)i=t(r);else{if(!EQ(r.x1)||!EQ(r.y1)||!EQ(r.x2)||!EQ(r.y2))return null;i=ec.createElement("line",Fu({},r,{className:"recharts-reference-line-line"}))}return i})(m,k),ec.createElement(ky,Fu({},O,{lowerWidth:O.width,upperWidth:O.width}),ec.createElement(kT,{label:t.label}),t.children)))}var Ff={ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",label:!1,stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle",zIndex:Ab.line};function Fd(t){var r=IA(t,Ff);return ec.createElement(ec.Fragment,null,ec.createElement(Fc,{yAxisId:r.yAxisId,xAxisId:r.xAxisId,ifOverflow:r.ifOverflow,x:r.x,y:r.y,segment:r.segment}),ec.createElement(Fh,r))}Fd.displayName="ReferenceLine";let Fp=({labels:t,values:r,title:i,colors:n,domain:a,valueFormatter:o})=>{if(null===r||0===r.length)return(0,eu.jsx)("div",{className:"mt-4 h-[250px] flex items-center justify-center",children:(0,eu.jsx)("p",{children:"No data available"})});let s=t.map((t,i)=>
56({label:t,value:r[i]??0}));return(0,eu.jsxs)("div",{className:"mt-4 h-[250px]",children:[(0,eu.jsx)("div",{className:"h-6 px-2 pt-1",children:i&&(0,eu.jsx)("div",{className:"text-xs font-semibold text-black truncate",children:i})}),(0,eu.jsx)(TU,{width:"100%",height:"100%",children:(0,eu.jsxs)(II,{data:s,layout:"vertical",children:[(0,eu.jsx)(Fa,{strokeDasharray:"3 3"}),(0,eu.jsx)(Lv,{type:"number",domain:a,tickFormatter:o}),(0,eu.jsx)(LD,{type:"category",dataKey:"label",width:100}),(0,eu.jsx)(RX,{formatter:o?t=>o(Number(t)):void 0}),a&&a[0]<=0&&a[1]>=0&&(0,eu.jsx)(Fd,{x:0,stroke:"#666",strokeWidth:1}),(0,eu.jsx)(N_,{dataKey:"value",fill:"#8884d8",children:s.map((t,r)=>{let i=n?n[r]??"#8884d8":r%2==0?"#8884d8":"#b8b5ef";return(0,eu.jsx)(IR,{fill:i},r)})})]})})]})};function Fm({values:t,labels:r,domain:i=null,zeroCentred:n=!1,valueFormatter:a=t=>t.toString(),title:o="",height:s=120,color:l}){let u=(0,ec.useRef)(null),[c,h]=(0,ec.useState)(300);return s=Math.min(s=Math.max(120,25*r.length),400),(0,ec.useEffect)(()=>{if(!u.current)return;let t=new ResizeObserver(t=>{h(Math.max(200,t[0].contentRect.width))});return t.observe(u.current),()=>t.disconnect()},[]),(0,ec.useEffect)(()=>{let o;if(!u.current)return;if(u.current.innerHTML="",!t||0===t.length){let t=document.createElement("div");t.className="flex items-center justify-center text-gray-400 text-sm",t.style.height=`${s}px`,t.textContent="Hover over a region to see values",u.current.appendChild(t);return}let h=r.map((r,i)=>{let n=t[i],a="object"==typeof n&&null!==n,o=a?n.value:n;return{label:r,colour:l??(i%2==0?"#1294da":"#124eda"),value:o,uncertainty:a?n.error:null,low:o,high:o,max:o,anchor:0}}),f=h.filter(t=>null!==t.uncertainty).length>0;if(f?h.forEach(t=>{null!==t.uncertainty?(t.low=t.value-t.uncertainty,t.high=t.value+t.uncertainty,t.max=t.value>0?t.high:t.low):(t.low=t.value,t.high=t.value,t.max=t.value),t.anchor=t.value>0?Math.min(0,t.low):Math.max(0,t.high)}):h.forEach(t=>{t.low=t.value,t.high=t.value,t.max=t.value,t.anchor=t.value>0?Math.min(0,t.low):Math.max(0,t.high)}),i)if(n){let t=Math.max(Math.abs(i[0]),Math.abs(i[1]),.001);o=[-t,t]}else o=i;else o=i=[Math.min(0,...h.map(t=>t.low)),Math.max(0,...h.map(t=>t.high))];let d=o[1]-o[0],p=t=>Math.abs(t.value)/d>.25,m=h.filter(t=>t.value>=0&&p(t)),g=h.filter(t=>t.value>=0&&!p(t)),y=h.filter(t=>t.value<0&&p(t)),v=h.filter(t=>t.value<0&&!p(t)),_=h.filter(t=>t.value>=0),b=h.filter(t=>t.value<0),x=pn({width:c,height:s,marginLeft:10,marginRight:60,marginTop:5,marginBottom:20,x:{domain:o,label:null,tickFormat:t=>a(t)},y:{domain:r,axis:null,padding:.4}
56,marks:[pM(h,{y:"label",x:"value",fill:"colour"}),f?pM(h,{y:"label",x1:"low",x2:"high",fill:"#dd522b88",stroke:"#dd522b",strokeWidth:2}):null,fO(_,{y:"label",x:"anchor",text:"label",textAnchor:"end",dx:-4,fill:"#374151",fontWeight:500,fontSize:12}),fO(b,{y:"label",x:"anchor",text:"label",textAnchor:"start",dx:4,fill:"#374151",fontWeight:500,fontSize:12}),fO(m,{y:"label",x:"high",text:t=>a(t.value),textAnchor:"end",dx:-4,fill:"white",fontSize:12}),fO(g,{y:"label",x:"high",text:t=>a(t.value),textAnchor:"start",dx:4,fill:"#374151",fontSize:12}),fO(y,{y:"label",x:"low",text:t=>a(t.value),textAnchor:"start",dx:4,fill:"white",fontSize:12}),fO(v,{y:"label",x:"low",text:t=>a(t.value),textAnchor:"end",dx:-4,fill:"#374151",fontSize:12})]});return u.current.appendChild(x),()=>{u.current&&(u.current.innerHTML="")}},[t,r,i,n,a,o,c,s,l]),(0,eu.jsxs)("div",{className:"bar-graph-pm w-full",children:[(0,eu.jsx)("div",{className:"h-6 px-2 pt-1",children:o&&(0,eu.jsx)("div",{className:"text-xs font-semibold text-black truncate",children:o})}),(0,eu.jsx)("div",{ref:u,className:"w-full"})]})}function Fg(t,r){let i,n;try{if(t.startsWith("/")||t.startsWith("./")||t.startsWith("../"))i=new URL(t,"https://placeholder.invalid").pathname,n=!1;else{let r=new URL(t);n=!r.hostname.endsWith("censusmapper.ca")&&"localhost"!==r.hostname&&!r.hostname.match(/^(127\.|192\.168\.|10\.)/),i=r.pathname}}catch{return"external"}if(n)return"external";let a=i.match(/^\/maps\/(\d+)$/);return a&&null!=r&&String(a[1])===String(r)?"same-map":"other-map"}t.s(["default",0,Fp],150693),t.s(["default",0,Fm],829162);let Fy={"same-map":"text-green-700 underline decoration-green-700","other-map":"text-blue-600 underline decoration-blue-600",external:"text-amber-700 underline decoration-amber-700"};function Fv({message:t}){return(0,eu.jsxs)("div",{className:"p-2 my-2 bg-red-50 border border-red-200 rounded text-red-600 text-sm",children:["Widget error: ",t]})}t.s(["LINK_KIND_CHIP_CLASSES",0,{"same-map":"border-green-300 bg-green-50 text-green-800","other-map":"border-blue-300 bg-blue-50 text-blue-700",external:"border-amber-700 bg-amber-50 text-amber-800"},"LINK_KIND_CLASSES",0,Fy,"classifyLink",0,Fg,"normalizeUrl",0,function(t){try{let r=new URL(t);if("censusmapper.ca"===r.hostname||"www.censusmapper.ca"===r.hostname)return r.pathname+r.search+r.hash}catch{}return t}],39300);let F_={...bl,tagNames:[...bl.tagNames??[],"table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","ul","ol","li","h1","h2","h3","h4","h5","h6","p","a","strong","em","b","i","br","hr","blockquote","code","pre","sup","sub","span","div","img","details","summary"],attributes:{...bl.attributes,"*":[...bl.attributes?.["*"]??[],"className","class","id","style"],table:["border","cellPadding","cellSpacing"],th:["colSpan","rowSpan","scope","colspan","rowspan"],td:["colSpan","rowSpan","colspan","rowspan"],a:["href","target","rel"],img:["src","alt","width","height"],ol:["start","type"],col:["span"],colgroup:["span"]}};function Fb(t,r){let i=t.find(t=>t.key===r);return i?.label??r}function Fx({description:t,mapState:r,visibleFeatures:i,highlightedFeatureIds:n,onHoverFeatures:a}){let o=(0,pB.useRouter)(),{segments:s,hasWidgets:l}=(0,ec.useMemo)(()=>(function(t){let r,i=/<div\s+class="widget\s+([^"]+)"([^>]*)><\/div>/gi,n=[],a=0,o=!1;for(;null!==(r=i.exec(t));){let i;o=!0,r.index>a&&n.push(t.slice(a,r.index));let s=r[1].trim(),l=r[2],u={},c=/data-(\w+)="([^"]*)"/gi;for(;null!==(i=c.exec(l));)u[i[1]]=i[2];n.push({type:s,...u}),a=r.index+r[0].length}return a<t.length&&n.push(t.slice(a)),{segments:n,hasWidgets:o}})(t),[t]),u={h1:({node:t,...r})=>(0,eu.jsx)("h1",{className:"text-xl font-bold mt-3 mb-1",...r}),h2:({node:t,...r})=>(0,eu.jsx)("h2",{className:"text-lg font-semibold mt-2 mb-1",...r}),h3:({node:t,...r})=>(0,eu.jsx)("h3",{className:"text-md font-semibold mt-2 mb-1",...r}),h4:({node:t,...r})=>(0,eu.jsx)("h4",{className:"text-sm font-semibold mt-1 mb-0.5",...r}),p:({node:t,...r})=>(0,eu.jsx)("p",{className:"text-md my-1",...r}),a:({node:t,href:i,...n})=>{let a=r.state?.id??r.geo_set_identifier??"",s=i?Fg(i,a):"external",l=Fy[s],u=i?function(t,r){let i;try{i=new URL(t,window.location.origin)}catch{return null}let n=i.pathname.match(/^\/maps\/(\d+)$/);if(!n||n[1]!==String(r))return null;let a=parseFloat(i.searchParams.get("lat")??""),o=parseFloat(i.searchParams.get("lng")??""),s=parseFloat(i.searchParams.get("z")??i.searchParams.get("zoom")??"");if(isFinite(a)&&isFinite(o)&&isFinite(s))return{lat:a,lng:o,zoom:s};let l=i.hash.replace("#","").split("/").map(Number);return 3===l.length&&l.every(t=>!isNaN(t))?{zoom:l[0],lat:l[1],lng:l[2]}:null}(i,a):null;return u?(0,eu.jsx)("a",{className:`${l} cursor-pointer`,...n,href:i,onClick:t=>{t.preventDefault(),window.dispatchEvent(new CustomEvent("censusmapper:flyto",{detail:u}))}}):"other-map"===s?(0,eu.jsx)("a",{className:`${l} cursor-pointer`,...n,href:i,onClick:t=>{t.preventDefault(),o.push(i)}}):(0,eu.jsx)("a",{className:l,target:"_blank",rel:"noopener noreferrer",href:i,...n})},table:({node:t,...r})=>(0,eu.jsx)("div",{className:"overflow-x-auto my-2",children:(0,eu.jsx)("table",{className:"min-w-full border-collapse border border-gray-300 text-sm",...r})}),thead:({node:t,...r})=>(0,eu.jsx)("thead",{className:"bg-gray-100",...r}),tbody:({node:t,...r})=>(0,eu.jsx)("tbody",{...r}),tr:({node:t,...r})=>(0,eu.jsx)("tr",{className:"border-b border-gray-200",...r}),th:({node:t,...r})=>(0,eu.jsx)("th",{className:"border border-gray-300 px-2 py-1 text-left font-semibold",...r}),td:({node:t,...r})=>(0,eu.jsx)("td",{className:"border border-gray-300 px-2 py-1",...r}),ul:({node:t,...r})=>(0,eu.jsx)("ul",{className:"list-disc pl-5 my-1 space-y-0.5",...r}),ol:({node:t,...r})=>(0,eu.jsx)("ol",{className:"list-decimal pl-5 my-1 space-y-0.5",...r}),li:({node:t,...r})=>(0,eu.jsx)("li",{className:"text-sm",...r}),blockquote:({node:t,...r})=>(0,eu.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-3 my-2 italic text-gray-600",...r}
56),code:({node:t,inline:r,...i})=>r?(0,eu.jsx)("code",{className:"bg-gray-100 rounded px-1 py-0.5 text-sm font-mono",...i}):(0,eu.jsx)("code",{...i}),pre:({node:t,...r})=>(0,eu.jsx)("pre",{className:"bg-gray-100 rounded p-2 my-2 overflow-x-auto text-sm font-mono",...r}),img:({node:t,...r})=>(0,eu.jsx)("img",{className:"max-w-full h-auto my-1 rounded",...r}),hr:({node:t,...r})=>(0,eu.jsx)("hr",{className:"my-3 border-gray-300",...r})};return l?(0,eu.jsx)("div",{className:"description-with-widgets",children:s.map((t,o)=>{if("string"==typeof t)return(0,eu.jsx)(y2,{rehypePlugins:[bo,[bg,F_]],components:u,children:t},o);if("scatter-plot"===t.type){let s=t.domain||"",l=t.range||"";if(!s||!l)return(0,eu.jsx)("div",{className:"p-2 my-2 bg-red-50 border border-red-200 rounded text-red-600 text-sm",children:"Scatter plot error: Missing data-domain or data-range attribute"},o);let u=Fb(r.variables,s),c=Fb(r.variables,l),h=r.variables.find(t=>t.key===s),f=r.variables.find(t=>t.key===l),d=h?r.shortFormatterForUnits(h.units):void 0,p=f?r.shortFormatterForUnits(f.units):void 0;return(0,eu.jsx)(pF,{data:i,xLabel:u,yLabel:c,xKey:s,yKey:l,xTickFormat:d,yTickFormat:p,highlightedFeatureIds:n,onHoverFeatures:a},o)}if("histogram"===t.type){let s=t.variable||"";if(!s)return(0,eu.jsx)(Fv,{message:"Missing data-variable"},o);let l=Fb(r.variables,s),u=r.variables.find(t=>t.key===s),c=u?r.shortFormatterForUnits(+u.units):r.shortValueFormatter;return(0,eu.jsx)(pE,{data:i,valueAccessor:t=>t.__value?.variables?.[s]??null,valueFormatter:c,title:t.title||`Distribution: ${l}`,onHoverFeatures:a,highlightedFeatureIds:n?Array.from(n):null},o)}if("bar-graph"===t.type){let n=t.variable||"";if(!n)return(0,eu.jsx)(Fv,{message:"Missing data-variable"},o);let a=Fb(r.variables,n),s=i.map(t=>({name:String(t.name||t.id||"Unknown"),value:t.__value?.variables?.[n]??null})).filter(t=>null!==t.value&&!isNaN(t.value)).sort((t,r)=>r.value-t.value).slice(0,10),l=s.map(t=>t.name),u=s.map(t=>t.value);return(0,eu.jsx)(Fp,{labels:l,values:u,title:t.title||`Top 10: ${a}`},o)}if("bar-graph-pm"===t.type){let n=t.variable||"";if(!n)return(0,eu.jsx)(Fv,{message:"Missing data-variable"},o);let a=Fb(r.variables,n),s=i.map(t=>({name:String(t.name||t.id||"Unknown"),value:t.__value?.variables?.[n]??null})).filter(t=>null!==t.value&&!isNaN(t.value)).sort((t,r)=>r.value-t.value).slice(0,10),l=s.map(t=>t.name),u=s.map(t=>t.value),c=u.filter(t=>null!==t),h=c.length>0?[Math.min(...c),Math.max(...c)]:null;return(0,eu.jsx)(Fm,{labels:l,values:u,domain:h,valueFormatter:r.shortValueFormatter,title:t.title||`Top 10: ${a}`},o)}if("tricolore-bar"===t.type){let n=t.var1||"",a=t.var2||"",s=t.var3||"";if(!n||!a||!s)return(0,eu.jsx)(Fv,{message:"Missing data-var1, data-var2, or data-var3"},o);let l=Fb(r.variables,n),u=Fb(r.variables,a),c=Fb(r.variables,s),h=0,f=0,d=0;i.forEach(t=>{let r=t.__value?.variables?.[n]??0,i=t.__value?.variables?.[a]??0,o=t.__value?.variables?.[s]??0;h+=r,f+=i,d+=o});let p=h+f+d,m=p>0?[h/p,f/p,d/p]:null;return(0,eu.jsx)(pP,{values:m,labels:[l,u,c],tricoloreOptions:r.getTricoloreOptions(),title:t.title||"Composition"},o)}return(0,eu.jsxs)("div",{className:"p-2 my-2 bg-yellow-50 border border-yellow-200 rounded text-yellow-700 text-sm",children:["Unknown widget type: ",t.type]},o)})}):(0,eu.jsx)(y2,{rehypePlugins:[bo,[bg,F_]],components:u,children:t})}var Fw=t.i(76734),FE=t.i(513021);let FT={name:"share-2",size:24,node:[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]};FT.node;let FA=(0,ep.default)(FT),FS={name:"link",size:24,node:[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]};FS.node;let FC=(0,ep.default)(FS);var FM=t.i(643957),FM=FM,FD=t.i(96315),FP=t.i(630374),FI=t.i(167881);function Fk({className:t}){return(0,eu.jsx)("svg",{viewBox:"0 0 24 24",className:t,fill:"currentColor",children:(0,eu.jsx)("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}function FO({className:t}){return(0,eu.jsx)("svg",{viewBox:"0 0 24 24",className:t,fill:"currentColor",children:(0,eu.jsx)("path",{d:"M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565.139 1.908
560 3.08 0 3.768c0 .69.378 5.65.624 6.479.785 2.627 3.59 3.501 6.138 3.088-4.476.766-8.32 3.084-3.138 7.665 5.468 4.797 7.212-1.205 8.376-4.457.143-.4.253-.753.317-.978a.466.466 0 0 1 .049-.073l.02.073c.064.225.174.578.317.978 1.164 3.252 2.908 9.254 8.376 4.457 5.182-4.58 1.338-6.899-3.138-7.665 2.548.413 5.353-.461 6.138-3.088C24.325 9.418 24.703 4.458 24.703 3.768c0-.688-.139-1.86-.902-2.203-.659-.299-1.664-.621-4.3 1.24C16.753 4.747 13.794 8.686 12.707 10.8z"})})}function FN({className:t}){return(0,eu.jsx)("svg",{viewBox:"0 0 24 24",className:t,fill:"currentColor",children:(0,eu.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})})}function FL({className:t}){return(0,eu.jsx)("svg",{viewBox:"0 0 24 24",className:t,fill:"currentColor",children:(0,eu.jsx)("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})}function FR({className:t}){return(0,eu.jsx)("svg",{viewBox:"0 0 24 24",className:t,fill:"currentColor",children:(0,eu.jsx)("path",{d:"M12 0C5.373 0 0 5.373 0 12c0 6.627 5.373 12 12 12s12-5.373 12-12C24 5.373 18.627 0 12 0zm6.066 13.52c.028.238.042.478.042.722 0 3.688-4.296 6.68-9.596 6.68-5.3 0-9.596-2.992-9.596-6.68 0-.244.014-.484.042-.722A1.795 1.795 0 0 1 .084 12.2a1.794 1.794 0 0 1 3.042-1.283c1.576-1.14 3.752-1.876 6.172-1.964l1.18-5.546a.39.39 0 0 1 .466-.296l3.924.83a1.281 1.281 0 1 1-.145.67l-3.504-.74-1.054 4.948c2.39.1 4.538.84 6.094 1.972a1.793 1.793 0 1 1 1.81 2.73zM8.37 12.408a1.281 1.281 0 1 0 0 2.562 1.281 1.281 0 0 0 0-2.562zm7.26 0a1.281 1.281 0 1 0 0 2.562 1.281 1.281 0 0 0 0-2.562zm-6.464 4.26c-.058-.057-.058-.152 0-.21a.15.15 0 0 1 .21 0 4.588 4.588 0 0 0 5.248 0 .15.15 0 0 1 .21 0c.058.058.058.153 0 .21a4.888 4.888 0 0 1-5.668 0z"})})}function FF({className:t}){return(0,eu.jsx)("svg",{viewBox:"0 0 24 24",className:t,fill:"currentColor",children:(0,eu.jsx)("path",{d:"M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054 19.648 19.648 0 0 0 4.636.536c.564 0 1.127-.028 1.687-.083 1.867-.18 3.64-.503 4.084-1.502.14-.316.26-.643.36-.978.23-.762.44-1.89.44-1.89s.01-.066.01-.15c.04-1.347.04-2.864-.14-4.207z"})})}function FB({title:t,text:r,url:i,className:n,disabled:a=!1}){let[o,s]=(0,ec.useState)(!1),[l,u]=(0,ec.useState)(!1),c=(0,ec.useCallback)(()=>i||window.location.href,[i]),h=(0,ec.useCallback)(()=>t||("u">typeof document?document.title:""),[t]),f=(0,ec.useCallback)(()=>r||h(),[r,h]),d=(0,ec.useCallback)(async()=>{let t=navigator.maxTouchPoints>1;if(navigator.share&&t)try{await navigator.share({title:h(),text:f(),url:c()});return}catch(t){if("AbortError"===t.name)return}s(!0)},[h,f,c]),p=(0,ec.useCallback)(async()=>{await navigator.clipboard.writeText(c()),u(!0),setTimeout(()=>u(!1),2e3)},[c]),m=[{name:"X",icon:(0,eu.jsx)(Fk,{className:"w-5 h-5"}),href:`https://x.com/intent/tweet?url=${encodeURIComponent(c())}&text=${encodeURIComponent(f())}`},{name:"Bluesky",icon:(0,eu.jsx)(FO,{className:"w-5 h-5"}),href:`https://bsky.app/intent/compose?text=${encodeURIComponent(f()+" "+c())}`},{name:"Facebook",icon:(0,eu.jsx)(FN,{className:"w-5 h-5"}),href:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(c())}`},{name:"LinkedIn",icon:(0,eu.jsx)(FL,{className:"w-5 h-5"}),href:`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(c())}`},{name:"Reddit",icon:(0,eu.jsx)(FR,{className:"w-5 h-5"}),href:`https://www.reddit.com/submit?url=${encodeURIComponent(c())}&title=${encodeURIComponent(h())}`},{name:"Mastodon",icon:(0,eu.jsx)(FF,{className:"w-5 h-5"}),href:`https://mastodonshare.com/?url=${encodeURIComponent(c())}&text=${encodeURIComponent(f())}`},{name:"Email",icon:(0,eu.jsx)(FD.Mail,{className:"w-5 h-5"}),href:`mailto:?subject=${encodeURIComponent(h())}&body=${encodeURIComponent(f()+"\n\n"+c())}`}],g="This map is private. Set visibility to public to share it.";return(0,eu.jsxs)(eu.Fragment,{children:[(0,eu.jsxs)("button",{onClick:a?void 0:d,className:a?n?`${n} opacity-40 cursor-not-allowed`:"flex items-center gap-1.5 text-sm text-gray-400 cursor-not-allowed opacity-40":n??"flex items-center gap-1.5 text-sm text-gray-600 hover:text-gray-900 cursor-pointer",title:a?g:"Share","aria-label":a?g:"Share","aria-disabled":a,children:[(0,eu.jsx)(FA,{className:"w-4 h-4"}),(0,eu.jsx)("span",{children:"Share"})]}),(0,eu.jsx)(FP.Dialog,{open:o,onOpenChange:s,children:(0,eu.jsxs)(FP.DialogContent,{className:"sm:max-w-sm bg-white",children:[(0,eu.jsx)(FP.DialogHeader,{children:(0,eu.jsx)(FP.DialogTitle,{children:"Share"})}),(0,eu.jsx)("div",{className:"grid grid-cols-4 gap-3 py-2",children:m.map(t=>(0,eu.jsxs)("a",{href:t.href,target:"Email"===t.name?void 0:"_blank",rel:"noopener noreferrer",onClick:()=>s(!1),className:"flex flex-col items-center gap-1.5 p-2 rounded-lg hover:bg-gray-100 transition-colors",children:[(0,eu.jsx)("div",{className:"w-10 h-10 rounded-full bg-gray-100 flex items-center justify-center text-gray-700",children:t.icon}),(0,eu.jsx)("span",{className:"text-xs text-gray-600",children:t.name})]},t.name))}),(0,eu.jsx)(FI.Button,{variant:"outline",className:"w-full mt-1",onClick:p,children:l?(0,eu.jsxs)(eu.Fragment,{children:[(0,eu.jsx)(FM.default,{className:"w-4 h-4 mr-2"})," Copied!"]}):(0,eu.jsxs)(eu.Fragment,{children:[(0,eu.jsx)(FC,{className:"w-4 h-4 mr-2"})," Copy link"]})})]})})]})}function Fz({mapStateRef:t,visibleFeatures:r,highlightedFeatureIds:i,hoveredFeature:n,tileHighlightCallback:a=()=>{},subMapOptions:o,subMapSelectedIndex:s,subMapCallback:l,getMapPosition:u}){let c,h,f,d,p,m;if(!t?.current)return(0,eu.jsx)("h3",{className:"font-bold",children:"Welcome to Census Mapper"});let g=t.current.mainWidgetType(),y=t.current;!(y.range.length>0)||y.rgbColors()||y.categoryColors()||y.bivariateColors()||(c="steelblue");let v=(()=>
56{if("tricolore"!==g||!n)return null;let t=n.__value?.mapValue;return Array.isArray(t)&&t.length>=3?[t[0],t[1],t[2]]:null})(),_=(()=>{if("bargraph"!==g&&"bargraphPM"!==g||!n)return null;let t=n.__value?.value;return Array.isArray(t)?t:null})(),b=(()=>{if(!t.current.fixedBarDomain()||0===r.length)return null;let i=-1/0,n=0;for(let t of r){let r=t.__value?.value;if(Array.isArray(r))for(let t of r)"number"==typeof t&&isFinite(t)&&t>i&&(i=t),"number"==typeof t&&isFinite(t)&&t<n&&(n=t)}return isFinite(i)?[n,i]:null})(),x=(()=>{if("bargraphPM"!==g||0===r.length)return null;let t=1/0,i=-1/0;for(let n of r){let r=n.__value?.value;if(Array.isArray(r)){for(let n of r)if("number"==typeof n&&isFinite(n))n<t&&(t=n),n>i&&(i=n);else if("object"==typeof r){let r=n.value,a=n.error;r>0?r+=a:r-=a,r<t&&(t=r),r>i&&(i=r)}}}return isFinite(t)&&isFinite(i)?[t,i]:null})(),w=(()=>{if(n)return pN(n);if(!i||1!==i.length)return"";let t=i[0],a=r.find(r=>r.id===t);return a?pN(a):""})();return(0,eu.jsxs)("div",{className:"map-details max-w-full min-h-full",children:[(0,eu.jsx)("h3",{className:"text-lg font-bold text-center leading-snug",children:t.current.title}),(h=t.current.label&&t.current.label!==t.current.title,f=s??null,h||f?(0,eu.jsxs)("div",{className:"text-sm text-center text-gray-600 mt-0.5",children:[h&&t.current.label,f&&` (${f.label})`]}):null),(d=t.current.data_set_identifiers?.[0]?(0,FE.datasetLabel)(t.current.data_set_identifiers[0]):null,(0,eu.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-x-2 gap-y-0.5 mt-1 mb-3 text-xs text-gray-400",children:[d&&(0,eu.jsxs)(eu.Fragment,{children:[(0,eu.jsx)("span",{children:d}),(0,eu.jsx)("span",{className:"text-gray-300",children:"·"})]}),(0,eu.jsxs)("span",{children:["by ",t.current.author??"Anonymous Mapper"]}),(0,eu.jsx)("span",{className:"text-gray-300",children:"·"}),(0,eu.jsx)(FB,{title:t.current.title,text:`${t.current.title} \u2014 Explore on #CensusMapper`,disabled:!t.current.isPubliclyShareable(),url:(p=new URL(window.location.href),t.current.status===Fw.MapStatus.Shared&&t.current.share_hash&&p.searchParams.set("share_hash",t.current.share_hash),(m=u?.())&&(p.searchParams.set("z",m.zoom.toFixed(2)),p.searchParams.set("lat",m.lat.toFixed(4)),p.searchParams.set("lng",m.lng.toFixed(4))),p.toString())})]})),(0,eu.jsx)("div",{className:"sidebar-graph-container bg-gray-200 rounded border border-gray-200","data-tutorial":"sidebar-chart",children:"tricolore"===g?(0,eu.jsx)(pP,{values:v,labels:t.current.getRgbLabels(),tricoloreOptions:t.current.getTricoloreOptions(),title:w,domain:b??void 0,valueFormatter:t.current.shortValueFormatter}):"bivariate"===g?(()=>{let n=t.current,[o,s]=n.getBivariateLabels(),l=n.displayedVariables?.[0]??"__var1",u=n.displayedVariables?.[1]??"__var2",c=n.shortFormatterForUnits(n.unitsForVariableIndex(0)),h=n.shortFormatterForUnits(n.unitsForVariableIndex(1));return(0,eu.jsx)(pF,{data:r,xLabel:o,yLabel:s,xKey:l,yKey:u,xTickFormat:c,yTickFormat:h,highlightedFeatureIds:i,onHoverFeatures:a})})():"histogram"==g?(0,eu.jsx)(pE,{data:r,valueAccessor:t=>t.__value?.mapValue??null,valueFormatter:t.current.shortValueFormatter,title:w,highlightColor:`rgb(${t.current.widgetHighlightColor.join(",")})`,highlightedFeatureIds:i,onHoverFeatures:a}):"bargraph"==g?(0,eu.jsx)(Fp,{values:_,labels:t.current.getBarGraphLabels(),title:w,colors:t.current.categoryColors()?t.current.range:void 0,domain:b??void 0,valueFormatter:t.current.shortValueFormatter}):"bargraphPM"==g?(0,eu.jsx)(Fm,{values:_,labels:t.current.getBarGraphLabels(),domain:x,zeroCentred:41==t.current.units||!0,valueFormatter:t.current.shortValueFormatter,title:w,color:c}):null}),o&&l&&o.length>0&&(0,eu.jsx)("div",{className:"flex flex-wrap gap-1 mt-3",children:o.map(t=>{let r=t.key===s?.key;return(0,eu.jsx)("button",{onClick:()=>l(t),className:`px-2 py-1 text-sm rounded border transition-colors cursor-pointer ${r?"bg-blue-600 text-white border-blue-700":"bg-gray-100 text-gray-700 border-gray-300 hover:bg-gray-200"}`,children:t.label},t.key)})}),(0,eu.jsx)("div",{className:"map-description mt-3",children:(0,eu.jsx)(Fx,{description:t.current.description,mapState:t.current,visibleFeatures:r,highlightedFeatureIds:i,onHoverFeatures:a})})]})}var Fj=t.i(905151);function FU(t){return(0,ec.useMemo)(()=>new URLSearchParams(window.location.search),[]).get(t)}function FV(t,r){let i=new Set,n=[];for(let a of t){let t=a?.[r];void 0===t?n.push(a):i.has(t)||(i.add(t),n.push(a))}return n}function F$(t){var r=0,i=t.children,n=i&&i.length;if(n)for(;--n>=0;)r+=i[n].value;else r=1;t.value=r}function FG(t,r){t instanceof Map?(t=[void 0,t],void 0===r&&(r=FH)
56):void 0===r&&(r=Fq);for(var i,n,a,o,s,l=new FY(t),u=[l];i=u.pop();)if((a=r(i.data))&&(s=(a=Array.from(a)).length))for(i.children=a,o=s-1;o>=0;--o)u.push(n=a[o]=new FY(a[o])),n.parent=i,n.depth=i.depth+1;return l.eachBefore(FZ)}function Fq(t){return t.children}function FH(t){return Array.isArray(t)?t[1]:null}function FW(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function FZ(t){var r=0;do t.height=r;while((t=t.parent)&&t.height<++r)}function FY(t){this.data=t,this.depth=this.height=0,this.parent=null}function FX(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function FK(t){return t.innerRadius}function FQ(t){return t.outerRadius}function FJ(t){return t.startAngle}function F0(t){return t.endAngle}function F1(t){return t&&t.padAngle}function F2(t,r,i,n,a,o,s){var l=t-i,u=r-n,c=(s?o:-o)/nh(l*l+u*u),h=c*u,f=-c*l,d=t+h,p=r+f,m=i+h,g=n+f,y=(d+m)/2,v=(p+g)/2,_=m-d,b=g-p,x=_*_+b*b,w=a-o,E=d*g-m*p,T=(b<0?-1:1)*nh(nl(0,w*w*x-E*E)),A=(E*b-_*T)/x,S=(-E*_-b*T)/x,C=(E*b+_*T)/x,M=(-E*_+b*T)/x,D=A-y,P=S-v,I=C-y,k=M-v;return D*D+P*P>I*I+k*k&&(A=C,S=M),{cx:A,cy:S,x01:-h,y01:-f,x11:A*(a/w-1),y11:S*(a/w-1)}}t.s(["ResizableSidebar",0,({mapStateRef:t,visibleFeatures:r,highlightedFeatureIds:i,hoveredFeature:n,tileHighlightCallback:a=()=>{},subMapOptions:o,subMapCallback:s,subMapDefaultIndex:l,minSpan:u=200,maxSpan:c=600,isMobile:h,defaultWidth:f=Fj.SIDEBAR_CONFIG.DEFAULT_WIDTH,onEffectiveSizeChange:d,isOwner:p=!1,mapId:m,showMapActions:g=!1,onHomeClick:y,hasDefaultLocation:v=!1,getMapPosition:_,sidebarContent:b})=>{let[x,w]=(0,ec.useState)("");(0,ec.useEffect)(()=>{let t=new URLSearchParams(window.location.search),r=t.get("z"),i=t.get("lat"),n=t.get("lng");r&&i&&n&&w(`&z=${r}&lat=${i}&lng=${n}`)},[]);let[E,T]=(0,ec.useState)(f),[A,S]=(0,ec.useState)(!1),[C,M]=(0,ec.useState)(!1),D=(0,ec.useRef)(null),P=(0,ec.useRef)(0),I=(0,ec.useRef)(0),k=(0,ec.useRef)(0),O=(0,ec.useRef)(0),N=(0,ec.useRef)(0),[L,R]=(0,ec.useState)(f),F=(0,ec.useCallback)((t,r)=>{let i=r?Math.max(u,Math.min(c,O.current+t)):Math.max(u,Math.min(c,N.current-t));requestAnimationFrame(()=>{r?T(i):R(i)})},[u,c]),B=(0,ec.useCallback)(t=>{M(!0),I.current=t.clientX,O.current=E,t.preventDefault()},[E]),z=(0,ec.useCallback)(t=>{C&&F(I.current-t.clientX,!0)},[C,F]),j=(0,ec.useCallback)(t=>{M(!0),k.current=t,N.current=L},[L]),U=(0,ec.useCallback)(t=>{j(t.touches[0].clientY),t.preventDefault()},[j]),V=(0,ec.useCallback)(t=>{j(t.clientY),t.preventDefault()},[j]),$=(0,ec.useCallback)(t=>{C&&F(t.touches[0].clientY-k.current,!1)},[C,F]),G=(0,ec.useCallback)(t=>{C&&F(t.clientY-k.current,!1)},[C,F]),q=(0,ec.useCallback)(()=>{M(!1)},[]);(0,ec.useEffect)(()=>(C&&!h&&(document.addEventListener("mousemove",z),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect=""}),[C,h,z,q]),(0,ec.useEffect)(()=>(C&&h&&(document.addEventListener("touchmove",$,{passive:!1}),document.addEventListener("touchend",q),document.addEventListener("mousemove",G),document.addEventListener("mouseup",q),document.body.style.userSelect="none",document.body.style.cursor="row-resize"),()=>{document.removeEventListener("touchmove",$),document.removeEventListener("touchend",q),document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",q),document.body.style.userSelect="",document.body.style.cursor=""}),[C,h,$,G,q]);let H=()=>{S(!A)};(0,ec.useEffect)(()=>{T(Math.min(Fj.SIDEBAR_CONFIG.CLAMP_MAX,Math.max(Fj.SIDEBAR_CONFIG.CLAMP_MIN,Math.round(window.innerWidth*Fj.SIDEBAR_CONFIG.CLAMP_VW)))),R(Math.min(Fj.SIDEBAR_CONFIG.CLAMP_MAX,Math.max(Fj.SIDEBAR_CONFIG.MOBILE_CLAMP_MIN,Math.round(window.innerHeight*Fj.SIDEBAR_CONFIG.MOBILE_CLAMP_VH))))},[]);let W=(0,ec.useRef)(d);return((0,ec.useEffect)(()=>{W.current=d}),(0,ec.useEffect)(()=>{W.current?.(A?0:h?L:E)},[E,L,A,h]),(0,ec.useEffect)(()=>{if(h)return;let t=D.current;if(!t)return;let r=!1,i=()=>{r=!0},n=()=>
56{r&&(P.current=t.scrollTop,r=!1)};return t.addEventListener("wheel",i,{passive:!0}),t.addEventListener("touchmove",i,{passive:!0}),t.addEventListener("scroll",n,{passive:!0}),()=>{t.removeEventListener("wheel",i),t.removeEventListener("touchmove",i),t.removeEventListener("scroll",n)}},[h]),(0,ec.useEffect)(()=>{if(h)return;let t=D.current;t&&t.scrollTop!==P.current&&(t.scrollTop=P.current)}),h)?(0,eu.jsx)("div",{children:(0,eu.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-20",children:[(0,eu.jsx)("button",{onClick:H,className:"absolute left-1/2 transform -translate-x-1/2 bg-white border border-gray-200 rounded-t-md px-3 py-1 hover:bg-gray-50 transition-colors duration-200 shadow-sm",style:{bottom:A?"0px":`${L}px`,transform:A?"translate(-50%, 0)":"translate(-50%, -0px)"},title:A?"Expand bottom sheet":"Collapse bottom sheet",children:A?(0,eu.jsx)(eg,{className:"w-4 h-4 text-gray-600"}):(0,eu.jsx)(ed.ChevronDown,{className:"w-4 h-4 text-gray-600"})}),(0,eu.jsxs)("div",{ref:D,className:"bg-white border-t border-gray-200 will-change-transform overflow-hidden",style:{height:A?"0px":`${L}px`,minHeight:A?"0px":`${u}px`,opacity:+!A,transition:C?"none":"all 0.3s ease-in-out"},children:[!A&&(0,eu.jsxs)("div",{className:"h-1 bg-gray-200 active:bg-blue-400 cursor-row-resize transition-colors duration-200 relative group will-change-transform",onTouchStart:U,onMouseDown:V,children:[(0,eu.jsx)("div",{className:"absolute inset-0 h-4 -mt-1.5"}),(0,eu.jsx)("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 h-1 w-8 bg-gray-400 rounded-full opacity-0 group-active:opacity-100 transition-opacity duration-200"})]}),(0,eu.jsxs)("div",{className:"p-4 overflow-y-auto",style:{height:A?"0px":`${L-4}px`},children:[g&&(void 0!==m||v)&&(0,eu.jsxs)("div",{className:"flex justify-end items-center gap-1 mb-1",children:[v&&y&&(0,eu.jsx)("button",{onClick:y,className:"text-gray-400 hover:text-gray-700 transition-colors",title:"Go to default location",children:(0,eu.jsx)(eb,{className:"w-4 h-4"})}),void 0!==m&&(0,eu.jsxs)(ew.DropdownMenu,{children:[(0,eu.jsx)(ew.DropdownMenuTrigger,{asChild:!0,children:(0,eu.jsx)("button",{className:"text-gray-400 hover:text-gray-700 transition-colors",title:"Map actions",children:(0,eu.jsx)(ev,{className:"w-4 h-4"})})}),(0,eu.jsxs)(ew.DropdownMenuContent,{align:"end",children:[p&&(0,eu.jsx)(ew.DropdownMenuItem,{asChild:!0,children:(0,eu.jsx)(ex.default,{href:`/maps/new?id=${m}${x}`,children:"Edit map"})}),(0,eu.jsx)(ew.DropdownMenuItem,{asChild:!0,children:(0,eu.jsx)(ex.default,{href:`/maps/new?sourceId=${m}${x}`,children:"Clone map"})})]})]})]}),b??(0,eu.jsx)(Fz,{mapStateRef:t,visibleFeatures:r,highlightedFeatureIds:i,hoveredFeature:n,tileHighlightCallback:a,subMapOptions:o,subMapSelectedIndex:l,subMapCallback:s,getMapPosition:_})]})]})]})}):(0,eu.jsx)("div",{className:"h-full overflow-hidden bg-white",children:(0,eu.jsxs)("div",{className:"flex h-full",children:[!A&&(0,eu.jsxs)("div",{className:"w-1 bg-gray-200 hover:bg-blue-400 cursor-col-resize transition-colors duration-200 relative group will-change-transform",onMouseDown:B,children:[(0,eu.jsx)("div",{className:"absolute inset-0 w-2 -ml-0.5"}),(0,eu.jsx)("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-1 h-8 bg-gray-400 rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-200"})]}),(0,eu.jsx)("button",{onClick:H,className:"absolute top-4 z-10 bg-white border border-gray-200 rounded-l-md p-1 hover:bg-gray-50 transition-colors duration-200 shadow-sm",style:{right:A?"0px":`${E}px`,transform:A?"translateX(0)":"translateX(1px)"},title:A?"Expand sidebar":"Collapse sidebar",children:A?(0,eu.jsx)(ef.ChevronRight,{className:"w-4 h-4 text-gray-600"}):(0,eu.jsx)(eh.ChevronLeft,{className:"w-4 h-4 text-gray-600"})}),(0,eu.jsxs)("div",{ref:D,className:"p-4 overflow-y-scroll overscroll-contain h-full bg-white border-r border-gray-200 will-change-transform [overflow-anchor:none]",style:{width:A?"0px":`${E}px`,minWidth:A?"0px":`${u}px`,opacity:+!A,padding:A?"0":void 0,transition:C?"none":"all 0.3s ease-in-out"},children:[g&&(void 0!==m||v)&&(0,eu.jsxs)("div",{className:"flex justify-end items-center gap-1 mb-1",children:[v&&y&&(0,eu.jsx)("button",{onClick:y,className:"text-gray-400 hover:text-gray-700 transition-colors",title:"Go to default location",children:(0,eu.jsx)(eb,{className:"w-4 h-4"})}),void 0!==m&&(0,eu.jsxs)(ew.DropdownMenu,{children:[(0,eu.jsx)(ew.DropdownMenuTrigger,{asChild:!0,children:(0,eu.jsx)("button",{className:"text-gray-400 hover:text-gray-700 transition-colors",title:"Map actions",children:(0,eu.jsx)(ev,{className:"w-4 h-4"})})}),(0,eu.jsxs)(ew.DropdownMenuContent,{align:"end",children:[p&&(0,eu.jsx)(ew.DropdownMenuItem,{asChild:!0,children:(0,eu.jsx)(ex.default,{href:`/maps/new?id=${m}${x}`,children:"Edit map"})}),(0,eu.jsx)(ew.DropdownMenuItem,{asChild:!0,children:(0,eu.jsx)(ex.default,{href:`/maps/new?sourceId=${m}${x}`,children:"Clone map"})})]})]})]}),b??(0,eu.jsx)(Fz,{mapStateRef:t,visibleFeatures:r,highlightedFeatureIds:i,hoveredFeature:n,tileHighlightCallback:a,subMapOptions:o,subMapSelectedIndex:l,subMapCallback:s,getMapPosition:_})]})]})})}],641705),t.s(["useMapLayers",0,function(){let[t,r]=(0,ec.useState)({}),i=(0,ec.useRef)({}),n=(0,ec.useMemo)(()=>Object.keys(t).sort((r,i)=>t[r].native-t[i].native),[t]),a=(0,ec.useMemo)(()=>n.map(r=>[r,t[r].native]).sort((t,r)=>r[1]-t[1]),[n,t]),o=(0,ec.useCallback)(t=>{i.current=t,r(t)},[]),s=(0,ec.useCallback)(t=>Object.keys(t).sort((r,i)=>t[r].native-t[i].native),[]),l=(0,ec.useCallback)(t=>{if(0===a.length)return null;let r=0;for(;r<a.length-1&&a[r][1]>t;)r++;return a[r][0]},[a]),u=(0,ec.useCallback)(t=>s(t).map(r=>[r,t[r].native]).sort((t,r)=>r[1]-t[1]),[s]);return{dataLayers:t,dataLayersRef:i,layerKeys:n,zoomBreaks:a,setDataLayers:o,getKeyForZoom:l,computeLayerKeys:s,computeZoomBreaks:u,getKeyForZoomWithBreaks:(0,ec.useCallback)((t,r)=>{if(0===r.length)return null;let i=0;for(;i<r.length-1&&r[i][1]>t;)i++;return r[i][0]},[])}}],142722),t.s(["useMapEventHandlers",0,function({setHoveredFeature:t,setHoveredMapValue:r,setSelectedFeature:i,setHighlightedFeatureIds:n,isMapHoveredRef:a,setClickPosition:o}){let s=(0,ec.useRef)(null),l=(0,ec.useRef)(null),u=(0,ec.useRef)(0),c=(0,ec.useRef)(null),h=(0,ec.useRef)({setHoveredFeature:t,setHoveredMapValue:r,setHighlightedFeatureIds:n,isMapHoveredRef:a});return h.current={setHoveredFeature:t,setHoveredMapValue:r,setHighlightedFeatureIds:n,isMapHoveredRef:a},(0,ec.useEffect)(()=>()=>{u.current&&cancelAnimationFrame(u.current)},[]),{handleHover:(0,ec.useCallback)(t=>{if(t.object){let r=t.object.properties,i=r.id;if(s.current===i){let t=r.__value?.value,n="number"==typeof t&&isFinite(t)?t:null;if(l.current!==n&&(l.current=n,c.current={feature:r,featureId:i,mapValue:n}),!c.current)return}else{s.current=i;let t=r.__value?.value,n="number"==typeof t&&isFinite(t)?t:null;l.current=n,c.current={feature:r,featureId:i,mapValue:n}}}else{if(null===s.current)return;s.current=null,l.current=null,c.current={feature:null,featureId:null,mapValue:null}}u.current||(u.current=requestAnimationFrame(()=>{u.current=0;let t=c.current;if(!t)return;c.current=null;let{setHoveredFeature:r,setHoveredMapValue:i,setHighlightedFeatureIds:n,isMapHoveredRef:a}=h.current;(0,kl.unstable_batchedUpdates)(()=>
56{if(r(t.feature),i(t.mapValue),n)if(t.feature){let r=t.featureId;n(t=>t&&1===t.length&&t[0]===r?t:[r])}else a?.current&&n(null)})}))},[]),handleClick:(0,ec.useCallback)(t=>{if(t.object){let r=t.object.properties;i(i=>i?.id===r.id?(o?.(null),null):(o&&void 0!==t.x&&void 0!==t.y&&o({x:t.x,y:t.y}),r))}else i(null),o?.(null)},[i,o])}}],477713),t.s(["useURLParam",0,FU,"useURLParamNumber",0,function(t,r){let i=FU(t);if(null===i)return r;let n=Number(i);return isNaN(n)?r:n}],891844),t.s(["useFeatureWorker",0,function(){let r=(0,ec.useRef)(null),i=(0,ec.useRef)(null);return(0,ec.useEffect)(()=>(r.current=t.r(855614)(Worker),r.current.onmessage=t=>{"result"===t.data.type&&i.current&&(i.current(t.data.features),i.current=null)},r.current.onerror=t=>{console.error("Feature worker error:",t),i.current=null},()=>{r.current?.terminate(),r.current=null}),[]),{deduplicateFeatures:(0,ec.useCallback)(async(t,n="id")=>r.current?new Promise(a=>{i.current=a,r.current.postMessage({type:"deduplicate",features:t,uniqueIdProperty:n}),setTimeout(()=>{i.current&&(console.warn("Feature worker timeout, falling back to sync"),i.current=null,a(FV(t,n)))},5e3)}):FV(t,n),[])}}],969353),FY.prototype=FG.prototype={constructor:FY,count:function(){return this.eachAfter(F$)},each:function(t,r){let i=-1;for(let n of this)t.call(r,n,++i,this);return this},eachAfter:function(t,r){for(var i,n,a,o=this,s=[o],l=[],u=-1;o=s.pop();)if(l.push(o),i=o.children)for(n=0,a=i.length;n<a;++n)s.push(i[n]);for(;o=l.pop();)t.call(r,o,++u,this);return this},eachBefore:function(t,r){for(var i,n,a=this,o=[a],s=-1;a=o.pop();)if(t.call(r,a,++s,this),i=a.children)for(n=i.length-1;n>=0;--n)o.push(i[n]);return this},find:function(t,r){let i=-1;for(let n of this)if(t.call(r,n,++i,this))return n},sum:function(t){return this.eachAfter(function(r){for(var i=+t(r.data)||0,n=r.children,a=n&&n.length;--a>=0;)i+=n[a].value;r.value=i})},sort:function(t){return this.eachBefore(function(r){r.children&&r.children.sort(t)})},path:function(t){for(var r=this,i=function(t,r){if(t===r)return t;var i=t.ancestors(),n=r.ancestors(),a=null;for(t=i.pop(),r=n.pop();t===r;)a=t,t=i.pop(),r=n.pop();return a}(r,t),n=[r];r!==i;)n.push(r=r.parent);for(var a=n.length;t!==i;)n.splice(a,0,t),t=t.parent;return n},ancestors:function(){for(var t=this,r=[t];t=t.parent;)r.push(t);return r},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(r){r.children||t.push(r)}),t},links:function(){var t=this,r=[];return t.each(function(i){i!==t&&r.push({source:i.parent,target:i})}),r},copy:function(){return FG(this).eachBefore(FW)},[Symbol.iterator]:function*(){var t,r,i,n,a=this,o=[a];do for(t=o.reverse(),o=[];a=t.pop();)if(yield a,r=a.children)for(i=0,n=r.length;i<n;++i)o.push(r[i]);while(o.length)}},t.s(["hierarchy",0,FG],479220),t.s(["partition",0,function(){var t=1,r=1,i=0,n=!1;function a(a){var o,s,l=a.height+1;return a.x0=a.y0=i,a.x1=t,a.y1=r/l,a.eachBefore((o=r,s=l,function(t){t.children&&function(t,r,i,n,a){for(var o,s=t.children,l=-1,u=s.length,c=t.value&&(n-r)/t.value;++l<u;)(o=s[l]).y0=i,o.y1=a,o.x0=r,o.x1=r+=o.value*c}(t,t.x0,o*(t.depth+1)/s,t.x1,o*(t.depth+2)/s);var r=t.x0,n=t.y0,a=t.x1-i,l=t.y1-i;a<r&&(r=a=(r+a)/2),l<n&&(n=l=(n+l)/2),t.x0=r,t.y0=n,t.x1=a,t.y1=l})),n&&a.eachBefore(FX),a}return a.round=function(t){return arguments.length?(n=!!t,a):n},a.size=function(i){return arguments.length?(t=+i[0],r=+i[1],a):[t,r]},a.padding=function(t){return arguments.length?(i=+t,a):i},a}],253913),t.s(["arc",0,function(){var t=FK,r=FQ,i=s9(0),n=null,a=FJ,o=F0,s=F1,l=null,u=lo(c);function c(){var c,h,f=+t.apply(this,arguments),d=+r.apply(this,arguments),p=a.apply(this,arguments)-nd,m=o.apply(this,arguments)-nd,g=na(m-p),y=m>p;if(l||(l=c=u()),d<f&&(h=d,d=f,f=h),d>1e-12)if(g>np-1e-12)l.moveTo(d*ns(p),d*nc(p)),l.arc(0,0,d,p,m,!y),f>1e-12&&(l.moveTo(f*ns(m),f*nc(m)),l.arc(0,0,f,m,p,y));else{var v,_,b=p,x=m,w=p,E=m,T=g,A=g,S=s.apply(this,arguments)/2,C=S>1e-12&&(n?+n.apply(this,arguments):nh(f*f+d*d)),M=nu(na(d-f)/2,+i.apply(this,arguments)),D=M,P=M;if(C>1e-12){var I=nm(C/f*nc(S)),k=nm(C/d*nc(S));(T-=2*I)>1e-12?(I*=y?1:-1,w+=I,E-=I):(T=0,w=E=(p+m)/2),(A-=2*k)>1e-12?(k*=y?1:-1,b+=k,x-=k):(A=0,b=x=(p+m)/2)}var O=d*ns(b),N=d*nc(b),L=f*ns(E),R=f*nc(E);if(M>1e-12){var F,B=d*ns(x),z=d*nc(x),j=f*ns(w),U=f*nc(w);if(g<nf)if(F=function(t,r,i,n,a,o,s,l){var u=i-t,c=n-r,h=s-a,f=l-o,d=f*u-h*c;if(!(d*d<1e-12))return d=(h*(r-o)-f*(t-a))/d,[t+d*u,r+d*c]}(O,N,j,U,B,z,L,R)){var V,$=O-F[0],G=N-F[1],q=B-F[0],H=z-F[1],W=1/nc(((V=($*q+G*H
56)/(nh($*$+G*G)*nh(q*q+H*H)))>1?0:V<-1?nf:Math.acos(V))/2),Z=nh(F[0]*F[0]+F[1]*F[1]);D=nu(M,(f-Z)/(W-1)),P=nu(M,(d-Z)/(W+1))}else D=P=0}A>1e-12?P>1e-12?(v=F2(j,U,O,N,d,P,y),_=F2(B,z,L,R,d,P,y),l.moveTo(v.cx+v.x01,v.cy+v.y01),P<M?l.arc(v.cx,v.cy,P,no(v.y01,v.x01),no(_.y01,_.x01),!y):(l.arc(v.cx,v.cy,P,no(v.y01,v.x01),no(v.y11,v.x11),!y),l.arc(0,0,d,no(v.cy+v.y11,v.cx+v.x11),no(_.cy+_.y11,_.cx+_.x11),!y),l.arc(_.cx,_.cy,P,no(_.y11,_.x11),no(_.y01,_.x01),!y))):(l.moveTo(O,N),l.arc(0,0,d,b,x,!y)):l.moveTo(O,N),f>1e-12&&T>1e-12?D>1e-12?(v=F2(L,R,B,z,f,-D,y),_=F2(O,N,j,U,f,-D,y),l.lineTo(v.cx+v.x01,v.cy+v.y01),D<M?l.arc(v.cx,v.cy,D,no(v.y01,v.x01),no(_.y01,_.x01),!y):(l.arc(v.cx,v.cy,D,no(v.y01,v.x01),no(v.y11,v.x11),!y),l.arc(0,0,f,no(v.cy+v.y11,v.cx+v.x11),no(_.cy+_.y11,_.cx+_.x11),y),l.arc(_.cx,_.cy,D,no(_.y11,_.x11),no(_.y01,_.x01),!y))):l.arc(0,0,f,E,w,y):l.lineTo(L,R)}else l.moveTo(0,0);if(l.closePath(),c)return l=null,c+""||null}return c.centroid=function(){var i=(+t.apply(this,arguments)+ +r.apply(this,arguments))/2,n=(+a.apply(this,arguments)+ +o.apply(this,arguments))/2-nf/2;return[ns(n)*i,nc(n)*i]},c.innerRadius=function(r){return arguments.length?(t="function"==typeof r?r:s9(+r),c):t},c.outerRadius=function(t){return arguments.length?(r="function"==typeof t?t:s9(+t),c):r},c.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:s9(+t),c):i},c.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:s9(+t),c):n},c.startAngle=function(t){return arguments.length?(a="function"==typeof t?t:s9(+t),c):a},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:s9(+t),c):o},c.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:s9(+t),c):s},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}],279769)},523915,t=>{"use strict";let r=new Set(["available data","all data"]);t.s(["collapseGenericWrappers",0,function t(i){return i.children&&(i.children.forEach(r=>t(r)),i.children=i.children.flatMap(t=>{var i;return"string"==typeof(i=t.name)&&r.has(i.trim().toLowerCase())&&t.children?.length?t.children:[t]})),i}])},651655,(t,r,i)=>{!function(i){"use strict";var n,a={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},o=!0,s="[DecimalError] ",l=s+"Invalid argument: ",u=s+"Exponent out of range: ",c=Math.floor,h=Math.pow,f=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=c(1286742750677284.5),p={};function m(t,r){var i,n,a,s,l,u,c,h,f=t.constructor,d=f.precision;if(!t.s||!r.s)return r.s||(r=new f(t)),o?A(r,d):r;if(c=t.d,h=r.d,l=t.e,a=r.e,c=c.slice(),s=l-a){for(s<0?(n=c,s=-s,u=h.length):(n=h,a=l,u=c.length),s>(u=(l=Math.ceil(d/7))>u?l+1:u+1)&&(s=u,n.length=1),n.reverse();s--;)n.push(0);n.reverse()}for((u=c.length)-(s=h.length)<0&&(s=u,n=h,h=c,c=n),i=0;s;)i=(c[--s]=c[s]+h[s]+i)/1e7|0,c[s]%=1e7;for(i&&(c.unshift(i),++a),u=c.length;0==c[--u];)c.pop();return r.d=c,r.e=a,o?A(r,d):r}function g(t,r,i){if(t!==~~t||t<r||t>i)throw Error(l+t)}function y(t){var r,i,n,a=t.length-1,o="",s=t[0];if(a>0){for(o+=s,r=1;r<a;r++)(i=7-(n=t[r]+"").length)&&(o+=w(i)),o+=n;(i=7-(n=(s=t[r])+"").length)&&(o+=w(i))}else if(0===s)return"0";for(;s%10==0;)s/=10;return o+s}p.absoluteValue=p.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t},p.comparedTo=p.cmp=function(t){var r,i,n,a;if(t=new this.constructor(t),this.s!==t.s)return this.s||-t.s;if(this.e!==t.e)return this.e>t.e^this.s<0?1:-1;for(n=this.d.length,r=0,i=n<(a=t.d.length)?n:a;r<i;++r)if(this.d[r]!==t.d[r])return this.d[r]>t.d[r]^this.s<0?1:-1;return n===a?0:n>a^this.s<0?1:-1},p.decimalPlaces=p.dp=function(){var t=this.d.length-1,r=(t-this.e)*7;if(t=this.d[t])for(;t%10==0;t/=10)r--;return r<0?0:r},p.dividedBy=p.div=function(t){return v(this,new this.constructor(t))},p.dividedToIntegerBy=p.idiv=function(t){var r=this.constructor;return A(v(this,new r(t),0,1),r.precision)},p.equals=p.eq=function(t){return!this.cmp(t)},p.exponent=function(){return b(this)},p.greaterThan=p.gt=function(t){return this.cmp(t)>0},p.greaterThanOrEqualTo=p.gte=function(t){return this.cmp(t)>=0},p.isInteger=p.isint=function(){return this.e>this.d.length-2},p.isNegative=p.isneg=function(){return this.s<0},p.isPositive=p.ispos=function(){return this.s>0},p.isZero=function(){return 0===this.s},p.lessThan=p.lt=function(t){return 0>this.cmp(t)},p.lessThanOrEqualTo=p.lte=function(t){return 1>this.cmp(t)},p.logarithm=p.log=function(t){var r,i=this.constructor,a=i.precision,l=a+5;if(void 0===t)t=new i(10);else if((t=new i(t)).s<1||t.eq(n))throw Error(s+"NaN");if(this.s<1)throw Error(s+(this.s?"NaN":"-Infinity"));return this.eq(n)?new i(0):(o=!1,r=v(E(this,l),E(t,l),l),o=!0,A(r,a))},p.minus=p.sub=function(t){return t=new this.constructor(t),this.s==t.s?S(this,t):m(this,(t.s=-t.s,t))},p.modulo=p.mod=function(t){var r,i=this.constructor,n=i.precision;if(!(t=new i(t)).s)throw Error(s+"NaN");return this.s?(o=!1,r=v(this,t,0,1).times(t),o=!0,this.minus(r)):A(new i(this),n)},p.naturalExponential=p.exp=function(){return _(this)},p.naturalLogarithm=p.ln=function(){return E(this)},p.negated=p.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t},p.plus=p.add=function(t){return t=new this.constructor(t),this.s==t.s?m(this,t):S(this,(t.s=-t.s,t))},p.precision=p.sd=function(t){var r,i,n;if(void 0!==t&&!!t!==t&&1!==t&&0!==t)throw Error(l+t);if(r=b(this)+1,i=7*(n=this.d.length-1)+1,n=this.d[n]){for(;n%10==0;n/=10)i--;for(n=this.d[0];n>=10;n/=10)i++}return t&&r>i?r:i},p.squareRoot=p.sqrt=function(){var t,r,i,n,a,l,u,h=this.constructor;if(this.s<1){if(!this.s)return new h(0);throw Error(s+"NaN")}for(t=b(this),o=!1,0==(a=Math.sqrt(+this))||a==1/0?(((r=y(this.d)).length+t)%2==0&&(r+="0"),a=Math.sqrt(r),t=c((t+1)/2)-(t<0||t%2),n=new h(r=a==1/0?"5e"+t:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+t)):n=new h(a.toString()),a=u=(i=h.precision)+3;;)if(n=(l=n).plus(v(this,l,u+2)).times(.5),y(l.d).slice(0,u)===(r=y(n.d)).slice(0,u)){if(r=r.slice(u-3,u+1),a==u&&"4999"==r){if(A(l,i+1,0),l.times(l).eq(this)){n=l;break}}else if("9999"!=r)break;u+=4}return o=!0,A(n,i)},p.times=p.mul=function(t){var r,i,n,a,s,l,u,c,h,f=this.constructor,d=this.d,p=(t=new f(t)).d;if(!this.s||!t.s)return new f(0);for(t.s*=this.s,i=this.e+t.e,(c=d.length)<(h=p.length)&&(s=d,d=p,p=s,l=c,c=h,h=l),s=[],n=l=c+h;n--;)s.push(0);for(n=h;--n>=0;){for(r=0,a=c+n;a>n;)u=s[a]+p[n]*d[a-n-1]+r,s[a--]=u%1e7|0,r=u/1e7|0;s[a]=(s[a]+r)%1e7|0}for(;!s[--l];)s.pop();return r?++i:s.shift(),t.d=s,t.e=i,o?A(t,f.precision):t},p.toDecimalPlaces=p.todp=function(t,r){var i=this,n=i.constructor;return(i=new n(i),void 0===t)?i:(g(t,0,1e9),void 0===r?r=n.rounding:g(r,0,8),A(i,t+b(i)+1,r))},p.toExponential=function(t,r){var i,n=this,a=n.constructor;return void 0===t?i=C(n,!0):(g(t,0,1e9),void 0===r?r=a.rounding:g(r,0,8),i=C(n=A(new a(n),t+1,r),!0,t+1)),i},p.toFixed=function(t,r){var i,n,a=this.constructor;return void 0===t?C(this):(g(t,0,1e9),void 0===r?r=a.rounding:g(r,0,8),i=C((n=A(new a(this),t+b(this)+1,r)).abs(),!1,t+b(n)+1),this.isneg()&&!this.isZero()?"-"+i:i)},p.toInteger=p.toint=function(){var t=this.constructor;return A(new t(this),b(this)+1,t.rounding)},p.toNumber=function(){return+this},p.toPower=p.pow=function(t){var r,i,a,l,u,h,f=this,d=f.constructor,p=+(t=new d(t));if(!t.s)return new d(n);if(!(f=new d(f)).s){if(t.s<1)throw Error(s+"Infinity");return f}if(f.eq(n))return f;if(a=d.precision,t.eq(n))return A(f,a);if(h=(r=t.e)>=(i=t.d.length-1),u=f.s,h){if((i=p<0?-p:p)<=0x1fffffffffffff){for(l=new d(n),r=Math.ceil(a/7+4),o=!1;i%2&&M((l=l.times(f)).d,r),0!==(i=c(i/2));)M((f=f.times(f)).d,r);return o=!0,t.s<0?new d(n).div(l):A(l,a)}}else if(u<0)throw Error(s+"NaN");
56return u=u<0&&1&t.d[Math.max(r,i)]?-1:1,f.s=1,o=!1,l=t.times(E(f,a+12)),o=!0,(l=_(l)).s=u,l},p.toPrecision=function(t,r){var i,n,a=this,o=a.constructor;return void 0===t?(i=b(a),n=C(a,i<=o.toExpNeg||i>=o.toExpPos)):(g(t,1,1e9),void 0===r?r=o.rounding:g(r,0,8),i=b(a=A(new o(a),t,r)),n=C(a,t<=i||i<=o.toExpNeg,t)),n},p.toSignificantDigits=p.tosd=function(t,r){var i=this.constructor;return void 0===t?(t=i.precision,r=i.rounding):(g(t,1,1e9),void 0===r?r=i.rounding:g(r,0,8)),A(new i(this),t,r)},p.toString=p.valueOf=p.val=p.toJSON=function(){var t=b(this),r=this.constructor;return C(this,t<=r.toExpNeg||t>=r.toExpPos)};var v=function(){function t(t,r){var i,n=0,a=t.length;for(t=t.slice();a--;)i=t[a]*r+n,t[a]=i%1e7|0,n=i/1e7|0;return n&&t.unshift(n),t}function r(t,r,i,n){var a,o;if(i!=n)o=i>n?1:-1;else for(a=o=0;a<i;a++)if(t[a]!=r[a]){o=t[a]>r[a]?1:-1;break}return o}function i(t,r,i){for(var n=0;i--;)t[i]-=n,n=+(t[i]<r[i]),t[i]=1e7*n+t[i]-r[i];for(;!t[0]&&t.length>1;)t.shift()}return function(n,a,o,l){var u,c,h,f,d,p,m,g,y,v,_,x,w,E,T,S,C,M,D=n.constructor,P=n.s==a.s?1:-1,I=n.d,k=a.d;if(!n.s)return new D(n);if(!a.s)throw Error(s+"Division by zero");for(c=n.e-a.e,C=k.length,T=I.length,g=(m=new D(P)).d=[],h=0;k[h]==(I[h]||0);)++h;if(k[h]>(I[h]||0)&&--c,(x=null==o?o=D.precision:l?o+(b(n)-b(a))+1:o)<0)return new D(0);if(x=x/7+2|0,h=0,1==C)for(f=0,k=k[0],x++;(h<T||f)&&x--;h++)w=1e7*f+(I[h]||0),g[h]=w/k|0,f=w%k|0;else{for((f=1e7/(k[0]+1)|0)>1&&(k=t(k,f),I=t(I,f),C=k.length,T=I.length),E=C,v=(y=I.slice(0,C)).length;v<C;)y[v++]=0;(M=k.slice()).unshift(0),S=k[0],k[1]>=1e7/2&&++S;do f=0,(u=r(k,y,C,v))<0?(_=y[0],C!=v&&(_=1e7*_+(y[1]||0)),(f=_/S|0)>1?(f>=1e7&&(f=1e7-1),p=(d=t(k,f)).length,v=y.length,1==(u=r(d,y,p,v))&&(f--,i(d,C<p?M:k,p))):(0==f&&(u=f=1),d=k.slice()),(p=d.length)<v&&d.unshift(0),i(y,d,v),-1==u&&(v=y.length,(u=r(k,y,C,v))<1&&(f++,i(y,C<v?M:k,v))),v=y.length):0===u&&(f++,y=[0]),g[h++]=f,u&&y[0]?y[v++]=I[E]||0:(y=[I[E]],v=1);while((E++<T||void 0!==y[0])&&x--)}return g[0]||g.shift(),m.e=c,A(m,l?o+b(m)+1:o)}}();function _(t,r){var i,a,s,l,c,f=0,d=0,p=t.constructor,m=p.precision;if(b(t)>16)throw Error(u+b(t));if(!t.s)return new p(n);for(null==r?(o=!1,c=m):c=r,l=new p(.03125);t.abs().gte(.1);)t=t.times(l),d+=5;for(c+=Math.log(h(2,d))/Math.LN10*2+5|0,i=a=s=new p(n),p.precision=c;;){if(a=A(a.times(t),c),i=i.times(++f),y((l=s.plus(v(a,i,c))).d).slice(0,c)===y(s.d).slice(0,c)){for(;d--;)s=A(s.times(s),c);return p.precision=m,null==r?(o=!0,A(s,m)):s}s=l}}function b(t){for(var r=7*t.e,i=t.d[0];i>=10;i/=10)r++;return r}function x(t,r,i){if(r>t.LN10.sd())throw o=!0,i&&(t.precision=i),Error(s+"LN10 precision limit exceeded");return A(new t(t.LN10),r)}function w(t){for(var r="";t--;)r+="0";return r}function E(t,r){var i,a,l,u,c,h,f,d,p,m=1,g=t,_=g.d,w=g.constructor,T=w.precision;if(g.s<1)throw Error(s+(g.s?"NaN":"-Infinity"));if(g.eq(n))return new w(0);if(null==r?(o=!1,d=T):d=r,g.eq(10))return null==r&&(o=!0),x(w,d);if(w.precision=d+=10,a=(i=y(_)).charAt(0),!(15e14>Math.abs(u=b(g))))return f=x(w,d+2,T).times(u+""),g=E(new w(a+"."+i.slice(1)),d-10).plus(f),w.precision=T,null==r?(o=!0,A(g,T)):g;for(;a<7&&1!=a||1==a&&i.charAt(1)>3;)a=(i=y((g=g.times(t)).d)).charAt(0),m++;for(u=b(g),a>1?(g=new w("0."+i),u++):g=new w(a+"."+i.slice(1)),h=c=g=v(g.minus(n),g.plus(n),d),p=A(g.times(g),d),l=3;;){if(c=A(c.times(p),d),y((f=h.plus(v(c,new w(l),d))).d).slice(0,d)===y(h.d).slice(0,d))return h=h.times(2),0!==u&&(h=h.plus(x(w,d+2,T).times(u+""))),h=v(h,new w(m),d),w.precision=T,null==r?(o=!0,A(h,T)):h;h=f,l+=2}}function T(t,r){var i,n,a;for((i=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(i<0&&(i=n),i+=+r.slice(n+1),r=r.substring(0,n)):i<0&&(i=r.length),n=0;48===r.charCodeAt(n);)++n;for(a=r.length;48===r.charCodeAt(a-1);)--a;if(r=r.slice(n,a)){if(a-=n,t.e=c((i=i-n-1)/7),t.d=[],n=(i+1)%7,i<0&&(n+=7),n<a){for(n&&t.d.push(+r.slice(0,n)),a-=7;n<a;)t.d.push(+r.slice(n,n+=7));n=7-(r=r.slice(n)).length}else n-=a;for(;n--;)r+="0";if(t.d.push(+r),o&&(t.e>d||t.e<-d))throw Error(u+i)}else t.s=0,t.e=0,t.d=[0];return t}function A(t,r,i){var n,a,s,l,f,p,m,g,y=t.d;for(l=1,s=y[0];s>=10;s/=10)l++;if((n=r-l)<0)n+=7,a=r,m=y[g=0];else{if((g=Math.ceil((n+1)/7))>=(s=y.length))return t;for(m=s=y[g],l=1;s>=10;s/=10)l++;n%=7,a=n-7+l}if(void 0!==i&&(f=m/(s=h(10,l-a-1))%10|0,p=r<0||void 0!==y[g+1]||m%s,p=i<4?(f||p)&&(0==i||i==(t.s<0?3:2)):f>5||5==f&&(4==i||p||6==i&&(n>0?a>0?m/h(10,l-a):0:y[g-1])%10&1||i==(t.s<0?8:7))),r<1||!y[0])return p?(s=b(t),y.length=1,r=r-s-1,y[0]=h(10,(7-r%7)%7),t.e=c(-r/7)||0):(y.length=1,y[0]=t.e=t.s=0),t;if(0==n?(y.length=g,s=1,g--):(y.length=g+1,s=h(10,7-n),y[g]=a>0?(m/h(10,l-a)%h(10,a)|0)*s:0),p)for(;;)if(0==g){1e7==(y[0]+=s)&&(y[0]=1,++t.e);break}else{if(y[g]+=s,1e7!=y[g])break;
56y[g--]=0,s=1}for(n=y.length;0===y[--n];)y.pop();if(o&&(t.e>d||t.e<-d))throw Error(u+b(t));return t}function S(t,r){var i,n,a,s,l,u,c,h,f,d,p=t.constructor,m=p.precision;if(!t.s||!r.s)return r.s?r.s=-r.s:r=new p(t),o?A(r,m):r;if(c=t.d,d=r.d,n=r.e,h=t.e,c=c.slice(),l=h-n){for((f=l<0)?(i=c,l=-l,u=d.length):(i=d,n=h,u=c.length),l>(a=Math.max(Math.ceil(m/7),u)+2)&&(l=a,i.length=1),i.reverse(),a=l;a--;)i.push(0);i.reverse()}else{for((f=(a=c.length)<(u=d.length))&&(u=a),a=0;a<u;a++)if(c[a]!=d[a]){f=c[a]<d[a];break}l=0}for(f&&(i=c,c=d,d=i,r.s=-r.s),u=c.length,a=d.length-u;a>0;--a)c[u++]=0;for(a=d.length;a>l;){if(c[--a]<d[a]){for(s=a;s&&0===c[--s];)c[s]=1e7-1;--c[s],c[a]+=1e7}c[a]-=d[a]}for(;0===c[--u];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(r.d=c,r.e=n,o?A(r,m):r):new p(0)}function C(t,r,i){var n,a=b(t),o=y(t.d),s=o.length;return r?(i&&(n=i-s)>0?o=o.charAt(0)+"."+o.slice(1)+w(n):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+w(-a-1)+o,i&&(n=i-s)>0&&(o+=w(n))):a>=s?(o+=w(a+1-s),i&&(n=i-a-1)>0&&(o=o+"."+w(n))):((n=a+1)<s&&(o=o.slice(0,n)+"."+o.slice(n)),i&&(n=i-s)>0&&(a+1===s&&(o+="."),o+=w(n))),t.s<0?"-"+o:o}function M(t,r){if(t.length>r)return t.length=r,!0}function D(t){if(!t||"object"!=typeof t)throw Error(s+"Object expected");var r,i,n,a=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(r=0;r<a.length;r+=3)if(void 0!==(n=t[i=a[r]]))if(c(n)===n&&n>=a[r+1]&&n<=a[r+2])this[i]=n;else throw Error(l+i+": "+n);if(void 0!==(n=t[i="LN10"]))if(n==Math.LN10)this[i]=new this(n);else throw Error(l+i+": "+n);return this}if((a=function t(r){var i,n,a;function o(t){if(!(this instanceof o))return new o(t);if(this.constructor=o,t instanceof o){this.s=t.s,this.e=t.e,this.d=(t=t.d)?t.slice():t;return}if("number"==typeof t){if(0*t!=0)throw Error(l+t);if(t>0)this.s=1;else if(t<0)t=-t,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(t===~~t&&t<1e7){this.e=0,this.d=[t];return}return T(this,t.toString())}if("string"!=typeof t)throw Error(l+t);if(45===t.charCodeAt(0)?(t=t.slice(1),this.s=-1):this.s=1,f.test(t))T(this,t);else throw Error(l+t)}if(o.prototype=p,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.clone=t,o.config=o.set=D,void 0===r&&(r={}),r)for(i=0,a=["precision","rounding","toExpNeg","toExpPos","LN10"];i<a.length;)r.hasOwnProperty(n=a[i++])||(r[n]=this[n]);return o.config(r),o}(a)).default=a.Decimal=a,n=new a(1),"function"==typeof define&&define.amd){let r;t.r,void 0!==(r=a)&&t.v(r)}else r.exports?r.exports=a:(i||(i="u">typeof self&&self&&self.self==self?self:Function("return this")()),i.Decimal=a)}(t.e)},54008,(t,r,i)=>{"use strict";function n(t,r,i){i=i||2;var n,d,p,y,_,b,x,w=r&&r.length,E=w?r[0]*i:t.length,T=a(t,0,E,i,!0),A=[];if(!T||T.next===T.prev)return A;if(w&&(T=function(t,r,i,n){var l,h,f,d,p,y=[];for(l=0,h=r.length;l<h;l++)f=r[l]*n,d=l<h-1?r[l+1]*n:t.length,(p=a(t,f,d,n,!1))===p.next&&(p.steiner=!0),y.push(function(t){var r=t,i=t;do(r.x<i.x||r.x===i.x&&r.y<i.y)&&(i=r),r=r.next;while(r!==t)return i}(p));for(y.sort(s),l=0;l<y.length;l++)i=function(t,r){var i=function(t,r){var i,n,a,o=r,s=t.x,l=t.y,h=-1/0;do{if(l<=o.y&&l>=o.next.y&&o.next.y!==o.y){var f=o.x+(l-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(f<=s&&f>h&&(h=f,a=o.x<o.next.x?o:o.next,f===s))return a}o=o.next}while(o!==r)if(!a)return null;var d,p=a,g=a.x,y=a.y,v=1/0;o=a;do{s>=o.x&&o.x>=g&&s!==o.x&&u(l<y?s:h,l,g,y,l<y?h:s,l,o.x,o.y)&&(d=Math.abs(l-o.y)/(s-o.x),m(o,t)&&(d<v||d===v&&(o.x>a.x||o.x===a.x&&(i=a,n=o,0>c(i.prev,i,n.prev)&&0>c(n.next,i,i.next))))&&(a=o,v=d)),o=o.next}while(o!==p)return a}(t,r);if(!i)return r;var n=g(i,t);return o(n,n.next),o(i,i.next)}(y[l],i);return i}(t,r,T,i)),t.length>80*i){n=p=t[0],d=y=t[1];for(var S=i;S<E;S+=i)_=t[S],b=t[S+1],_<n&&(n=_),b<d&&(d=b),_>p&&(p=_),b>y&&(y=b);x=0!==(x=Math.max(p-n,y-d))?32767/x:0}return function t(r,i,n,a,s,d,p){if(r){!p&&d&&function(t,r,i,n){var a=t;do 0===a.z&&(a.z=l(a.x,a.y,r,i,n)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==t)a.prevZ.nextZ=null,a.prevZ=null,function(t){var r,i,n,a,o,s,l,u,c=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,n=i,l=0,r=0;r<c&&(l++,n=n.nextZ);r++);for(u=c;l>0||u>0&&n;)0!==l&&(0===u||!n||i.z<=n.z)?(a=i,i=i.nextZ,l--):(a=n,n=n.nextZ,u--),o?o.nextZ=a:t=a,a.prevZ=o,o=a;i=n}o.nextZ=null,c*=2}while(s>1)}(a)}(r,a,s,d);
56for(var y,_,b=r;r.prev!==r.next;){if(y=r.prev,_=r.next,d?function(t,r,i,n){var a=t.prev,o=t.next;if(c(a,t,o)>=0)return!1;for(var s=a.x,h=t.x,f=o.x,d=a.y,p=t.y,m=o.y,g=s<h?s<f?s:f:h<f?h:f,y=d<p?d<m?d:m:p<m?p:m,v=s>h?s>f?s:f:h>f?h:f,_=d>p?d>m?d:m:p>m?p:m,b=l(g,y,r,i,n),x=l(v,_,r,i,n),w=t.prevZ,E=t.nextZ;w&&w.z>=b&&E&&E.z<=x;){if(w.x>=g&&w.x<=v&&w.y>=y&&w.y<=_&&w!==a&&w!==o&&u(s,d,h,p,f,m,w.x,w.y)&&c(w.prev,w,w.next)>=0||(w=w.prevZ,E.x>=g&&E.x<=v&&E.y>=y&&E.y<=_&&E!==a&&E!==o&&u(s,d,h,p,f,m,E.x,E.y)&&c(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;w&&w.z>=b;){if(w.x>=g&&w.x<=v&&w.y>=y&&w.y<=_&&w!==a&&w!==o&&u(s,d,h,p,f,m,w.x,w.y)&&c(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;E&&E.z<=x;){if(E.x>=g&&E.x<=v&&E.y>=y&&E.y<=_&&E!==a&&E!==o&&u(s,d,h,p,f,m,E.x,E.y)&&c(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}(r,a,s,d):function(t){var r=t.prev,i=t.next;if(c(r,t,i)>=0)return!1;for(var n=r.x,a=t.x,o=i.x,s=r.y,l=t.y,h=i.y,f=n<a?n<o?n:o:a<o?a:o,d=s<l?s<h?s:h:l<h?l:h,p=n>a?n>o?n:o:a>o?a:o,m=s>l?s>h?s:h:l>h?l:h,g=i.next;g!==r;){if(g.x>=f&&g.x<=p&&g.y>=d&&g.y<=m&&u(n,s,a,l,o,h,g.x,g.y)&&c(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}(r)){i.push(y.i/n|0),i.push(r.i/n|0),i.push(_.i/n|0),v(r),r=_.next,b=_.next;continue}if((r=_)===b){p?1===p?t(r=function(t,r,i){var n=t;do{var a=n.prev,s=n.next.next;!h(a,s)&&f(a,n,n.next,s)&&m(a,s)&&m(s,a)&&(r.push(a.i/i|0),r.push(n.i/i|0),r.push(s.i/i|0),v(n),v(n.next),n=t=s),n=n.next}while(n!==t)return o(n)}(o(r),i,n),i,n,a,s,d,2):2===p&&function(r,i,n,a,s,l){var u=r;do{for(var d,p,y=u.next.next;y!==u.prev;){if(u.i!==y.i&&(d=u,p=y,d.next.i!==p.i&&d.prev.i!==p.i&&!function(t,r){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==r.i&&i.next.i!==r.i&&f(i,i.next,t,r))return!0;i=i.next}while(i!==t)return!1}(d,p)&&(m(d,p)&&m(p,d)&&function(t,r){var i=t,n=!1,a=(t.x+r.x)/2,o=(t.y+r.y)/2;do i.y>o!=i.next.y>o&&i.next.y!==i.y&&a<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next;while(i!==t)return n}(d,p)&&(c(d.prev,d,p.prev)||c(d,p.prev,p))||h(d,p)&&c(d.prev,d,d.next)>0&&c(p.prev,p,p.next)>0))){var v=g(u,y);u=o(u,u.next),v=o(v,v.next),t(u,i,n,a,s,l,0),t(v,i,n,a,s,l,0);return}y=y.next}u=u.next}while(u!==r)}(r,i,n,a,s,d):t(o(r),i,n,a,s,d,1);break}}}}(T,A,i,n,d,x,0),A}function a(t,r,i,n,a){var o,s;if(a===b(t,r,i,n)>0)for(o=r;o<i;o+=n)s=y(o,t[o],t[o+1],s);else for(o=i-n;o>=r;o-=n)s=y(o,t[o],t[o+1],s);return s&&h(s,s.next)&&(v(s),s=s.next),s}function o(t,r){if(!t)return t;r||(r=t);var i,n=t;do if(i=!1,!n.steiner&&(h(n,n.next)||0===c(n.prev,n,n.next))){if(v(n),(n=r=n.prev)===n.next)break;i=!0}else n=n.next;while(i||n!==r)return r}function s(t,r){return t.x-r.x}function l(t,r,i,n,a){return(t=((t=((t=((t=((t=(t-i)*a|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(r=((r=((r=((r=((r=(r-n)*a|0)|r<<8)&0xff00ff)|r<<4)&0xf0f0f0f)|r<<2)&0x33333333)|r<<1)&0x55555555)<<1}function u(t,r,i,n,a,o,s,l){return(a-s)*(r-l)>=(t-s)*(o-l)&&(t-s)*(n-l)>=(i-s)*(r-l)&&(i-s)*(o-l)>=(a-s)*(n-l)}function c(t,r,i){return(r.y-t.y)*(i.x-r.x)-(r.x-t.x)*(i.y-r.y)}function h(t,r){return t.x===r.x&&t.y===r.y}function f(t,r,i,n){var a=p(c(t,r,i)),o=p(c(t,r,n)),s=p(c(i,n,t)),l=p(c(i,n,r));return!!(a!==o&&s!==l||0===a&&d(t,i,r)||0===o&&d(t,n,r)||0===s&&d(i,t,n)||0===l&&d(i,r,n))}function d(t,r,i){return r.x<=Math.max(t.x,i.x)&&r.x>=Math.min(t.x,i.x)&&r.y<=Math.max(t.y,i.y)&&r.y>=Math.min(t.y,i.y)}function p(t){return t>0?1:t<0?-1:0}function m(t,r){return 0>c(t.prev,t,t.next)?c(t,r,t.next)>=0&&c(t,t.prev,r)>=0:0>c(t,r,t.prev)||0>c(t,t.next,r)}function g(t,r){var i=new _(t.i,t.x,t.y),n=new _(r.i,r.x,r.y),a=t.next,o=r.prev;return t.next=r,r.prev=t,i.next=a,a.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function y(t,r,i,n){var a=new _(t,r,i);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function v(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 _(t,r,i){this.i=t,this.x=r,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function b(t,r,i,n){for(var a=0,o=r,s=i-n;o<i;o+=n)a+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return a}r.exports=n,r.exports.default=n,n.deviation=function(t,r,i,n){var a=r&&r.length,o=a?r[0]*i:t.length,s=Math.abs(b(t,0,o,i));if(a)for(var l=0,u=r.length;l<u;l++){var c=r[l]*i,h=l<u-1?r[l+1]*i:t.length;s-=Math.abs(b(t,c,h,i))}var f=0;for(l=0;l<n.length;l+=3){var d=n[l]*i,p=n[l+1]*i,m=n[l+2]*i;f+=Math.abs((t[d]-t[m])*(t[p+1]-t[d+1])-(t[d]-t[p])*(t[m+1]-t[d+1]))}return 0===s&&0===f?0:Math.abs((f-s)/s)},n.flatten=function(t){for(var r=t[0][0].length,i={vertices:[],holes:[],dimensions:r},n=0,a=0;a<t.length;a++){for(var o=0;o<t[a].length;o++)for(var s=0;s<r;s++)i.vertices.push(t[a][o][s]);a>0&&(n+=t[a-1].length,i.holes.push(n))}return i}},638492,(t,r,i)=>
56{i.read=function(t,r,i,n,a){var o,s,l=8*a-n-1,u=(1<<l)-1,c=u>>1,h=-7,f=i?a-1:0,d=i?-1:1,p=t[r+f];for(f+=d,o=p&(1<<-h)-1,p>>=-h,h+=l;h>0;o=256*o+t[r+f],f+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[r+f],f+=d,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},i.write=function(t,r,i,n,a,o){var s,l,u,c=8*o-a-1,h=(1<<c)-1,f=h>>1,d=5960464477539062e-23*(23===a),p=n?0:o-1,m=n?1:-1,g=+(r<0||0===r&&1/r<0);for(isNaN(r=Math.abs(r))||r===1/0?(l=+!!isNaN(r),s=h):(s=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+f>=1?r+=d/u:r+=d*Math.pow(2,1-f),r*u>=2&&(s++,u/=2),s+f>=h?(l=0,s=h):s+f>=1?(l=(r*u-1)*Math.pow(2,a),s+=f):(l=r*Math.pow(2,f-1)*Math.pow(2,a),s=0));a>=8;t[i+p]=255&l,p+=m,l/=256,a-=8);for(s=s<<a|l,c+=a;c>0;t[i+p]=255&s,p+=m,s/=256,c-=8);t[i+p-m]|=128*g}},404109,(t,r,i)=>{"use strict";r.exports=a;var n=t.r(638492);function a(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}a.Varint=0,a.Fixed64=1,a.Bytes=2,a.Fixed32=5;var o="u"<typeof TextDecoder?null:new TextDecoder("utf-8");function s(t){return t.type===a.Bytes?t.readVarint()+t.pos:t.pos+1}function l(t,r,i){return i?0x100000000*r+(t>>>0):(r>>>0)*0x100000000+(t>>>0)}function u(t,r,i){var n=r<=16383?1:r<=2097151?2:r<=0xfffffff?3:Math.floor(Math.log(r)/(7*Math.LN2));i.realloc(n);for(var a=i.pos-1;a>=t;a--)i.buf[a+n]=i.buf[a]}function c(t,r){for(var i=0;i<t.length;i++)r.writeVarint(t[i])}function h(t,r){for(var i=0;i<t.length;i++)r.writeSVarint(t[i])}function f(t,r){for(var i=0;i<t.length;i++)r.writeFloat(t[i])}function d(t,r){for(var i=0;i<t.length;i++)r.writeDouble(t[i])}function p(t,r){for(var i=0;i<t.length;i++)r.writeBoolean(t[i])}function m(t,r){for(var i=0;i<t.length;i++)r.writeFixed32(t[i])}function g(t,r){for(var i=0;i<t.length;i++)r.writeSFixed32(t[i])}function y(t,r){for(var i=0;i<t.length;i++)r.writeFixed64(t[i])}function v(t,r){for(var i=0;i<t.length;i++)r.writeSFixed64(t[i])}function _(t,r){return(t[r]|t[r+1]<<8|t[r+2]<<16)+0x1000000*t[r+3]}function b(t,r,i){t[i]=r,t[i+1]=r>>>8,t[i+2]=r>>>16,t[i+3]=r>>>24}function x(t,r){return(t[r]|t[r+1]<<8|t[r+2]<<16)+(t[r+3]<<24)}a.prototype={destroy:function(){this.buf=null},readFields:function(t,r,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),a=n>>3,o=this.pos;this.type=7&n,t(a,r,this),this.pos===o&&this.skip(n)}return r},readMessage:function(t,r){return this.readFields(t,r,this.readVarint()+this.pos)},readFixed32:function(){var t=_(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_(this.buf,this.pos)+0x100000000*_(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=_(this.buf,this.pos)+0x100000000*x(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var r,i,n=this.buf;return(r=127&(i=n[this.pos++]),i<128||(r|=(127&(i=n[this.pos++]))<<7,i<128||(r|=(127&(i=n[this.pos++]))<<14,i<128||(r|=(127&(i=n[this.pos++]))<<21,i<128))))?r:function(t,r,i){var n,a,o=i.buf;if(n=(112&(a=o[i.pos++]))>>4,a<128||(n|=(127&(a=o[i.pos++]))<<3,a<128)||(n|=(127&(a=o[i.pos++]))<<10,a<128)||(n|=(127&(a=o[i.pos++]))<<17,a<128)||(n|=(127&(a=o[i.pos++]))<<24,a<128)||(n|=(1&(a=o[i.pos++]))<<31,a<128))return l(t,n,r);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(i=n[this.pos]))<<28,t,this)},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?-((t+1)/2):t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t,r,i,n=this.readVarint()+this.pos,a=this.pos;return(this.pos=n,n-a>=12&&o)?(t=this.buf,r=a,i=n,o.decode(t.subarray(r,i))):function(t,r,i){for(var n="",a=r;a<i;){var o,s,l,u=t[a],c=null,h=u>239?4:u>223?3:u>191?2:1;if(a+h>i)break;1===h?u<128&&(c=u):2===h?(192&(o=t[a+1]))==128&&(c=(31&u)<<6|63&o)<=127&&(c=null):3===h?(o=t[a+1],s=t[a+2],(192&o)==128&&(192&s)==128&&((c=(15&u)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===h&&(o=t[a+1],s=t[a+2],l=t[a+3],(192&o)==128&&(192&s)==128&&(192&l)==128&&((c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&l)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,h=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),a+=h}return n}(this.buf,a,n)},readBytes:function(){var t=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,t);return this.pos=t,r}
56,readPackedVarint:function(t,r){if(this.type!==a.Bytes)return t.push(this.readVarint(r));var i=s(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(r));return t},readPackedSVarint:function(t){if(this.type!==a.Bytes)return t.push(this.readSVarint());var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==a.Bytes)return t.push(this.readBoolean());var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==a.Bytes)return t.push(this.readFloat());var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==a.Bytes)return t.push(this.readDouble());var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==a.Bytes)return t.push(this.readFixed32());var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==a.Bytes)return t.push(this.readSFixed32());var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==a.Bytes)return t.push(this.readFixed64());var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==a.Bytes)return t.push(this.readSFixed64());var r=s(this);for(t=t||[];this.pos<r;)t.push(this.readSFixed64());return t},skip:function(t){var r=7&t;if(r===a.Varint)for(;this.buf[this.pos++]>127;);else if(r===a.Bytes)this.pos=this.readVarint()+this.pos;else if(r===a.Fixed32)this.pos+=4;else if(r===a.Fixed64)this.pos+=8;else throw Error("Unimplemented type: "+r)},writeTag:function(t,r){this.writeVarint(t<<3|r)},realloc:function(t){for(var r=this.length||16;r<this.pos+t;)r*=2;if(r!==this.length){var i=new Uint8Array(r);i.set(this.buf),this.buf=i,this.length=r}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),b(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),b(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),b(this.buf,-1&t,this.pos),b(this.buf,Math.floor(23283064365386963e-26*t),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),b(this.buf,-1&t,this.pos),b(this.buf,Math.floor(23283064365386963e-26*t),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>0xfffffff||t<0?function(t,r){var i,n,a,o,s,l,u;if(t>=0?(i=t%0x100000000|0,n=t/0x100000000|0):(i=~(-t%0x100000000),n=~(-t/0x100000000),0xffffffff^i?i=i+1|0:(i=0,n=n+1|0)),t>=0xffffffffffffffff||t<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),a=i,(o=r).buf[o.pos++]=127&a|128,a>>>=7,o.buf[o.pos++]=127&a|128,a>>>=7,o.buf[o.pos++]=127&a|128,a>>>=7,o.buf[o.pos++]=127&a|128,a>>>=7,o.buf[o.pos]=127&a,s=n,l=r,u=(7&s)<<4,l.buf[l.pos++]|=u|128*!!(s>>>=3),s&&(l.buf[l.pos++]=127&s|128*!!(s>>>=7),!s||(l.buf[l.pos++]=127&s|128*!!(s>>>=7),s&&(l.buf[l.pos++]=127&s|128*!!(s>>>=7),!s||(l.buf[l.pos++]=127&s|128*!!(s>>>=7),s&&(l.buf[l.pos++]=127&s)))))}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|128*(t>127),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|128*(t>127),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|128*(t>127),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?-(2*t)-1:2*t)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var r=this.pos;this.pos=function(t,r,i){for(var n,a,o=0;o<r.length;o++){if((n=r.charCodeAt(o))>55295&&n<57344)if(a)if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,a=n;continue}else n=a-55296<<10|n-56320|65536,a=null;else{n>56319||o+1===r.length?(t[i++]=239,t[i++]=191,t[i++]=189):a=n;continue}else a&&(t[i++]=239,t[i++]=191,t[i++]=189,a=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-r;i>=128&&u(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var r=t.length;this.writeVarint(r),this.realloc(r);for(var i=0;i<r;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,r){this.pos++;var i=this.pos;t(r,this);var n=this.pos-i;n>=128&&u(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,r,i){this.writeTag(t,a.Bytes),this.writeRawMessage(r,i)},writePackedVarint:function(t,r){r.length&&this.writeMessage(t,c,r)},writePackedSVarint:function(t,r){r.length&&this.writeMessage(t,h,r)},writePackedBoolean:function(t,r){r.length&&this.writeMessage(t,p,r)},writePackedFloat:function(t,r){r.length&&this.writeMessage(t,f,r)},writePackedDouble:function(t,r){r.length&&this.writeMessage(t,d,r)},writePackedFixed32:function(t,r){r.length&&this.writeMessage(t,m,r)},writePackedSFixed32:function(t,r){r.length&&this.writeMessage(t,g,r)},writePackedFixed64:function(t,r){r.length&&this.writeMessage(t,y,r)},writePackedSFixed64:function(t,r){r.length&&this.writeMessage(t,v,r)},writeBytesField:function(t,r){this.writeTag(t,a.Bytes),this.writeBytes(r)},writeFixed32Field:function(t,r){this.writeTag(t,a.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(t,r){this.writeTag(t,a.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(t,r){this.writeTag(t,a.Fixed64),this.writeFixed64
56(r)},writeSFixed64Field:function(t,r){this.writeTag(t,a.Fixed64),this.writeSFixed64(r)},writeVarintField:function(t,r){this.writeTag(t,a.Varint),this.writeVarint(r)},writeSVarintField:function(t,r){this.writeTag(t,a.Varint),this.writeSVarint(r)},writeStringField:function(t,r){this.writeTag(t,a.Bytes),this.writeString(r)},writeFloatField:function(t,r){this.writeTag(t,a.Fixed32),this.writeFloat(r)},writeDoubleField:function(t,r){this.writeTag(t,a.Fixed64),this.writeDouble(r)},writeBooleanField:function(t,r){this.writeVarintField(t,!!r)}}},856166,(t,r,i)=>{"use strict";var n=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},a={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},o={"â":"\\--","â":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"};r.exports=function(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.preserveFormatting,s=r.escapeMapFn,l=String(t),u="",c=(void 0===s?function(t,r){return n({},t,r)}:s)(n({},a),void 0!==i&&i?n({},o):{}),h=Object.keys(c);l;)!function(){var t=!1;h.forEach(function(r,i){!t&&l.length>=r.length&&l.slice(0,r.length)===r&&(u+=c[h[i]],l=l.slice(r.length,l.length),t=!0)}),t||(u+=l.slice(0,1),l=l.slice(1,l.length))}();return u}},478492,(t,r,i)=>{"use strict";var n=Object.prototype.hasOwnProperty,a="~";function o(){}function s(t,r,i){this.fn=t,this.context=r,this.once=i||!1}function l(t,r,i,n,o){if("function"!=typeof i)throw TypeError("The listener must be a function");var l=new s(i,n||t,o),u=a?a+r:r;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],l]:t._events[u].push(l):(t._events[u]=l,t._eventsCount++),t}function u(t,r){0==--t._eventsCount?t._events=new o:delete t._events[r]}function c(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(a=!1)),c.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)n.call(t,r)&&i.push(a?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},c.prototype.listeners=function(t){var r=a?a+t:t,i=this._events[r];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,s=Array(o);n<o;n++)s[n]=i[n].fn;return s},c.prototype.listenerCount=function(t){var r=a?a+t:t,i=this._events[r];return i?i.fn?1:i.length:0},c.prototype.emit=function(t,r,i,n,o,s){var l=a?a+t:t;if(!this._events[l])return!1;var u,c,h=this._events[l],f=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),f){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,r),!0;case 3:return h.fn.call(h.context,r,i),!0;case 4:return h.fn.call(h.context,r,i,n),!0;case 5:return h.fn.call(h.context,r,i,n,o),!0;case 6:return h.fn.call(h.context,r,i,n,o,s),!0}for(c=1,u=Array(f-1);c<f;c++)u[c-1]=arguments[c];h.fn.apply(h.context,u)}else{var d,p=h.length;for(c=0;c<p;c++)switch(h[c].once&&this.removeListener(t,h[c].fn,void 0,!0),f){case 1:h[c].fn.call(h[c].context);break;case 2:h[c].fn.call(h[c].context,r);break;case 3:h[c].fn.call(h[c].context,r,i);break;case 4:h[c].fn.call(h[c].context,r,i,n);break;default:if(!u)for(d=1,u=Array(f-1);d<f;d++)u[d-1]=arguments[d];h[c].fn.apply(h[c].context,u)}}return!0},c.prototype.on=function(t,r,i){return l(this,t,r,i,!1)},c.prototype.once=function(t,r,i){return l(this,t,r,i,!0)},c.prototype.removeListener=function(t,r,i,n){var o=a?a+t:t;if(!this._events[o])return this;if(!r)return u(this,o),this;var s=this._events[o];if(s.fn)s.fn!==r||n&&!s.once||i&&s.context!==i||u(this,o);else{for(var l=0,c=[],h=s.length;l<h;l++)(s[l].fn!==r||n&&!s[l].once||i&&s[l].context!==i)&&c.push(s[l]);c.length?this._events[o]=1===c.length?c[0]:c:u(this,o)}return this},c.prototype.removeAllListeners=function(t){var r;return t?(r=a?a+t:t,this._events[r]&&u(this,r)):(this._events=new o,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=a,c.EventEmitter=c,r.exports=c},126568,(t,r,i)=>{"use strict";var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,o=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;
56\s]*/,h=/^\s+|\s+$/g;function f(t){return t?t.replace(h,""):""}r.exports=function(t,r){if("string"!=typeof t)throw TypeError("First argument must be a string");if(!t)return[];r=r||{};var i=1,h=1;function d(t){var r=t.match(a);r&&(i+=r.length);var n=t.lastIndexOf("\n");h=~n?t.length-n:h+t.length}function p(){var t={line:i,column:h};return function(r){return r.position=new m(t),y(o),r}}function m(t){this.start=t,this.end={line:i,column:h},this.source=r.source}function g(n){var a=Error(r.source+":"+i+":"+h+": "+n);if(a.reason=n,a.filename=r.source,a.line=i,a.column=h,a.source=t,r.silent);else throw a}function y(r){var i=r.exec(t);if(i){var n=i[0];return d(n),t=t.slice(n.length),i}}function v(t){var r;for(t=t||[];r=_();)!1!==r&&t.push(r);return t}function _(){var r=p();if("/"==t.charAt(0)&&"*"==t.charAt(1)){for(var i=2;""!=t.charAt(i)&&("*"!=t.charAt(i)||"/"!=t.charAt(i+1));)++i;if(i+=2,""===t.charAt(i-1))return g("End of comment missing");var n=t.slice(2,i-2);return h+=2,d(n),t=t.slice(i),h+=2,r({type:"comment",comment:n})}}m.prototype.content=t,y(o);var b,x=[];for(v(x);b=function(){var t=p(),r=y(s);if(r){if(_(),!y(l))return g("property missing ':'");var i=y(u),a=t({type:"declaration",property:f(r[0].replace(n,"")),value:i?f(i[0].replace(n,"")):""});return y(c),a}}();)!1!==b&&(x.push(b),v(x));return x}},270454,(t,r,i)=>{"use strict";var n=t.e&&t.e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(t,r){let i=null;if(!t||"string"!=typeof t)return i;let n=(0,a.default)(t),o="function"==typeof r;return n.forEach(t=>{if("declaration"!==t.type)return;let{property:n,value:a}=t;o?r(n,a,t):a&&((i=i||{})[n]=a)}),i};let a=n(t.r(126568))},965185,(t,r,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,a=/-([a-z])/g,o=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(t,r){return r.toUpperCase()},c=function(t,r){return"".concat(r,"-")};i.camelCase=function(t,r){var i;return(void 0===r&&(r={}),!(i=t)||o.test(i)||n.test(i))?t:(t=t.toLowerCase(),(t=r.reactCompat?t.replace(l,c):t.replace(s,c)).replace(a,u))}},515511,(t,r,i)=>{"use strict";var n=(t.e&&t.e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(t.r(270454)),a=t.r(965185);function o(t,r){var i={};return t&&"string"==typeof t&&(0,n.default)(t,function(t,n){t&&n&&(i[(0,a.camelCase)(t,r)]=n)}),i}o.default=o,r.exports=o},104100,(t,r,i)=>{"use strict";var n=Object.prototype.hasOwnProperty,a=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===a.call(t)},u=function(t){if(!t||"[object Object]"!==a.call(t))return!1;var r,i=n.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&n.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!i&&!o)return!1;for(r in t);return void 0===r||n.call(t,r)},c=function(t,r){o&&"__proto__"===r.name?o(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},h=function(t,r){if("__proto__"===r){if(!n.call(t,r))return;else if(s)return s(t,r).value}return t[r]};r.exports=function t(){var r,i,n,a,o,s,f=arguments[0],d=1,p=arguments.length,m=!1;for("boolean"==typeof f&&(m=f,f=arguments[1]||{},d=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});d<p;++d)if(r=arguments[d],null!=r)for(i in r)n=h(f,i),f!==(a=h(r,i))&&(m&&a&&(u(a)||(o=l(a)))?(o?(o=!1,s=n&&l(n)?n:[]):s=n&&u(n)?n:{},c(f,{name:i,newValue:t(m,s,a)})):void 0!==a&&c(f,{name:i,newValue:a}));return f}},123180,(t,r,i)=>{r.exports=function t(r,i){"use strict";var n,a,o=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,s=/(^[ ]*|[ ]*$)/g,l=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,c=/^0/,h=function(r){return t.insensitive&&(""+r).toLowerCase()||""+r},f=h(r).replace(s,"")||"",d=h(i).replace(s,"")||"",p=f.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=d.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),g=parseInt(f.match(u),16)||1!==p.length&&f.match(l)&&Date.parse(f),y=parseInt(d.match(u),16)||g&&d.match(l)&&Date.parse(d)||null;if(y){if(g<y)return -1;else if(g>y)return 1}for(var v=0,_=Math.max(p.length,m.length);v<_;v++){if(n=!(p[v]||"").match(c)&&parseFloat(p[v])||p[v]||0,a=!(m[v]||"").match(c)&&parseFloat(m[v])||m[v]||0,isNaN(n)!==isNaN(a))return isNaN(n)?1:-1;
56if(typeof n!=typeof a&&(n+="",a+=""),n<a)return -1;if(n>a)return 1}return 0}},716327,t=>{"use strict";var r=t.i(456420);let i={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};i.node;let n=(0,r.default)(i);t.s(["ChevronDown",0,n],716327)},24071,t=>{"use strict";var r=t.i(456420);let i={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};i.node;let n=(0,r.default)(i);t.s(["ChevronLeft",0,n],24071)},867927,t=>{"use strict";var r=t.i(986253);t.s(["ChevronRight",()=>r.default])},112316,t=>{t.q("/_next/static/media/maplibre-gl.3eba20-hz30dt.css")},264360,90522,429525,837866,338646,273447,t=>{"use strict";let r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D,P,I,k,O,N,L,R,F,B,z,j,U,V,$,G,q,H,W,Z,Y,X,K,Q,J,ee,et,er;var ei,en,ea,eo,es,el,eu,ec,eh,ef,ed,ep,em,eg,ey=Object.create,ev=Object.defineProperty,e_=Object.getOwnPropertyDescriptor,eb=Object.getOwnPropertyNames,ex=Object.getPrototypeOf,ew=Object.prototype.hasOwnProperty,eE=(t,r)=>()=>(r||(t((r={exports:{}}).exports,r),t=null),r.exports);function eT(t,r){this.x=t,this.y=r}function eA(){return r??="u">typeof OffscreenCanvas&&!!new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap}function eS(){if(null==i&&(i=!1,eA())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let r=0;r<25;r++){let i=4*r;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(r%5,Math.floor(r/5),1,1)}let r=t.getImageData(0,0,5,5).data;for(let t=0;t<100;t++)if(t%4!=3&&r[t]!==t){i=!0;break}}}return i||!1}eT.prototype={clone(){return new eT(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,r){return this.clone()._rotateAround(t,r)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let r=t.x-this.x,i=t.y-this.y;return r*r+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult(t){let r=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=r,this.y=i,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let r=Math.cos(t),i=Math.sin(t),n=r*this.x-i*this.y,a=i*this.x+r*this.y;return this.x=n,this.y=a,this},_rotateAround(t,r){let i=Math.cos(t),n=Math.sin(t),a=r.x+i*(this.x-r.x)-n*(this.y-r.y),o=r.y+n*(this.x-r.x)+i*(this.y-r.y);return this.x=a,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:eT},eT.convert=function(t){if(t instanceof eT)return t;if(Array.isArray(t))return new eT(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new eT(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};var eC="u">typeof Float32Array?Float32Array:Array;function eM(){var t=new eC(9);return eC!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function eD(){var t=new eC(16);return eC!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function eP(t){var r=new eC(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function eI(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ek(t,r){var i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],l=r[5],u=r[6],c=r[7],h=r[8],f=r[9],d=r[10],p=r[11],m=r[12],g=r[13],y=r[14],v=r[15],_=i*l-n*s,b=i*u-a*s,x=i*c-o*s,w=n*u-a*l,E=n*c-o*l,T=a*c-o*u,A=h*g-f*m,S=h*y-d*m,C=h*v-p*m,M=f*y-d*g,D=f*v-p*g,P=d*v-p*y,I=_*P-b*D+x*M+w*C-E*S+T*A;return I?(I=1/I,t[0]=(l*P-u*D+c*M)*I,t[1]=(a*D-n*P-o*M)*I,t[2]=(g*T-y*E+v*w)*I,t[3]=(d*E-f*T-p*w)*I,t[4]=(u*C-s*P-c*S)*I,t[5]=(i*P-a*C+o*S)*I,t[6]=(y*x-m*T-v*b)*
vendor: 4,591 bytes, line 56
56I,t[7]=(h*T-d*x+p*b)*I,t[8]=(s*D-l*C+c*A)*I,t[9]=(n*C-i*D-o*A)*I,t[10]=(m*E-g*x+v*_)*I,t[11]=(f*x-h*E-p*_)*I,t[12]=(l*S-s*M-u*A)*I,t[13]=(i*M-n*S+a*A)*I,t[14]=(g*b-m*w-y*_)*I,t[15]=(h*w-f*b+d*_)*I,t):null}function eO(t,r,i){var n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],u=r[5],c=r[6],h=r[7],f=r[8],d=r[9],p=r[10],m=r[11],g=r[12],y=r[13],v=r[14],_=r[15],b=i[0],x=i[1],w=i[2],E=i[3];return t[0]=b*n+x*l+w*f+E*g,t[1]=b*a+x*u+w*d+E*y,t[2]=b*o+x*c+w*p+E*v,t[3]=b*s+x*h+w*m+E*_,b=i[4],x=i[5],w=i[6],E=i[7],t[4]=b*n+x*l+w*f+E*g,t[5]=b*a+x*u+w*d+E*y,t[6]=b*o+x*c+w*p+E*v,t[7]=b*s+x*h+w*m+E*_,b=i[8],x=i[9],w=i[10],E=i[11],t[8]=b*n+x*l+w*f+E*g,t[9]=b*a+x*u+w*d+E*y,t[10]=b*o+x*c+w*p+E*v,t[11]=b*s+x*h+w*m+E*_,b=i[12],x=i[13],w=i[14],E=i[15],t[12]=b*n+x*l+w*f+E*g,t[13]=b*a+x*u+w*d+E*y,t[14]=b*o+x*c+w*p+E*v,t[15]=b*s+x*h+w*m+E*_,t}function eN(t,r,i){var n,a,o,s,l,u,c,h,f,d,p,m,g=i[0],y=i[1],v=i[2];return r===t?(t[12]=r[0]*g+r[4]*y+r[8]*v+r[12],t[13]=r[1]*g+r[5]*y+r[9]*v+r[13],t[14]=r[2]*g+r[6]*y+r[10]*v+r[14],t[15]=r[3]*g+r[7]*y+r[11]*v+r[15]):(n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],u=r[5],c=r[6],h=r[7],f=r[8],d=r[9],p=r[10],m=r[11],t[0]=n,t[1]=a,t[2]=o,t[3]=s,t[4]=l,t[5]=u,t[6]=c,t[7]=h,t[8]=f,t[9]=d,t[10]=p,t[11]=m,t[12]=n*g+l*y+f*v+r[12],t[13]=a*g+u*y+d*v+r[13],t[14]=o*g+c*y+p*v+r[14],t[15]=s*g+h*y+m*v+r[15]),t}function eL(t,r,i){var n=i[0],a=i[1],o=i[2];return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=r[3]*n,t[4]=r[4]*a,t[5]=r[5]*a,t[6]=r[6]*a,t[7]=r[7]*a,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=r[11]*o,t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t}function eR(t,r,i){var n=Math.sin(i),a=Math.cos(i),o=r[4],s=r[5],l=r[6],u=r[7],c=r[8],h=r[9],f=r[10],d=r[11];return r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*a+c*n,t[5]=s*a+h*n,t[6]=l*a+f*n,t[7]=u*a+d*n,t[8]=c*a-o*n,t[9]=h*a-s*n,t[10]=f*a-l*n,t[11]=d*a-u*n,t}function eF(t,r,i){var n=Math.sin(i),a=Math.cos(i),o=r[0],s=r[1],l=r[2],u=r[3],c=r[8],h=r[9],f=r[10],d=r[11];return r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a-c*n,t[1]=s*a-h*n,t[2]=l*a-f*n,t[3]=u*a-d*n,t[8]=o*n+c*a,t[9]=s*n+h*a,t[10]=l*n+f*a,t[11]=u*n+d*a,t}function eB(t,r,i){var n=Math.sin(i),a=Math.cos(i),o=r[0],s=r[1],l=r[2],u=r[3],c=r[4],h=r[5],f=r[6],d=r[7];return r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a+c*n,t[1]=s*a+h*n,t[2]=l*a+f*n,t[3]=u*a+d*n,t[4]=c*a-o*n,t[5]=h*a-s*n,t[6]=f*a-l*n,t[7]=d*a-u*n,t}var ez=function(t,r,i,n,a){var o=1/Math.tan(r/2);if(t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=a&&a!==1/0){var s=1/(n-a);t[10]=(a+n)*s,t[14]=2*a*n*s}else t[10]=-1,t[14]=-2*n;return t},ej=function(t,r,i,n,a,o,s){var l=1/(r-i),u=1/(n-a),c=1/(o-s);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(r+i)*l,t[13]=(a+n)*u,t[14]=(s+o)*c,t[15]=1,t};function eU(){var t=new eC(3);return eC!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function eV(t){var r=new eC(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function e$(t){var r=t[0],i=t[1],n=t[2];return Math.sqrt(r*r+i*i+n*n)}function eG(t,r,i){var n=new eC(3);return n[0]=t,n[1]=r,n[2]=i,n}function eq(t,r,i){return t[0]=r[0]+i[0],t[1]=r[1]+i[1],t[2]=r[2]+i[2],t}function eH(t,r,i){return t[0]=r[0]-i[0],t[1]=r[1]-i[1],t[2]=r[2]-i[2],t}function eW(t,r,i){return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t}function eZ(t,r,i,n){return t[0]=r[0]+i[0]*n,t[1]=r[1]+i[1]*n,t[2]=r[2]+i[2]*n,t}function eY(t,r){var i=r[0],n=r[1],a=r[2],o=i*i+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),t[0]=r[0]*o,t[1]=r[1]*o,t[2]=r[2]*o,t}function eX(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]}function eK(t,r,i){var n=r[0],a=r[1],o=r[2],s=i[0],l=i[1],u=i[2];return t[0]=a*u-o*l,t[1]=o*s-n*u,t[2]=n*l-a*s,t}function eQ(t,r,i){var n=i[0],a=i[1],o=i[2],s=i[3],l=r[0],u=r[1],c=r[2],h=a*c-o*u,f=o*l-n*c,d=n*u-a*l;return h+=h,f+=f,d+=d,t[0]=l+s*h+a*d-o*f,t[1]=u+s*f+o*h-n*d,t[2]=c+s*d+n*f-a*h,t}function eJ(t,r,i,n){var a=[],o=[];return a[0]=r[0]-i[0],a[1]=r[1]-i[1],a[2]=r[2]-i[2],o[0]=a[0],o[1]=a[1]*Math.cos(n)-a[2]*Math.sin(n),o[2]=a[1]*Math.sin(n)+a[2]*Math.cos(n),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function e0(t,r,i,n){var a=[],o=[];return a[0]=r[0]-i[0],a[1]=r[1]-i[1],a[2]=r[2]-i[2],o[0]=a[2]*Math.sin(n)+a[0]*Math.cos(n),o[1]=a[1],o[2]=a[2]*Math.cos(n)-a[0]*Math.sin(n),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function e1(t,r,i,n){var a=[],o=[];return a[0]=r[0]-i[0],a[1]=r[1]-i[1],a[2]=r[2]-i[2],o[0]=a[0]*Math.cos(n)-a[1]
56*Math.sin(n),o[1]=a[0]*Math.sin(n)+a[1]*Math.cos(n),o[2]=a[2],t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function e2(t,r,i){var n=r[0],a=r[1],o=r[2],s=r[3];return t[0]=i[0]*n+i[4]*a+i[8]*o+i[12]*s,t[1]=i[1]*n+i[5]*a+i[9]*o+i[13]*s,t[2]=i[2]*n+i[6]*a+i[10]*o+i[14]*s,t[3]=i[3]*n+i[7]*a+i[11]*o+i[15]*s,t}function e3(){var t=new eC(4);return eC!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function e4(t,r,i,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;r*=o,n*=o,i*=o;var s=Math.sin(r),l=Math.cos(r),u=Math.sin(i),c=Math.cos(i),h=Math.sin(n),f=Math.cos(n);switch(a){case"xyz":t[0]=s*c*f+l*u*h,t[1]=l*u*f-s*c*h,t[2]=l*c*h+s*u*f,t[3]=l*c*f-s*u*h;break;case"xzy":t[0]=s*c*f-l*u*h,t[1]=l*u*f-s*c*h,t[2]=l*c*h+s*u*f,t[3]=l*c*f+s*u*h;break;case"yxz":t[0]=s*c*f+l*u*h,t[1]=l*u*f-s*c*h,t[2]=l*c*h-s*u*f,t[3]=l*c*f+s*u*h;break;case"yzx":t[0]=s*c*f+l*u*h,t[1]=l*u*f+s*c*h,t[2]=l*c*h-s*u*f,t[3]=l*c*f-s*u*h;break;case"zxy":t[0]=s*c*f-l*u*h,t[1]=l*u*f+s*c*h,t[2]=l*c*h+s*u*f,t[3]=l*c*f-s*u*h;break;case"zyx":t[0]=s*c*f-l*u*h,t[1]=l*u*f+s*c*h,t[2]=l*c*h-s*u*f,t[3]=l*c*f+s*u*h;break;default:throw Error("Unknown angle order "+a)}return t}eU(),hA=new eC(4),eC!=Float32Array&&(hA[0]=0,hA[1]=0,hA[2]=0,hA[3]=0);var e6=function(t,r,i,n){var a=new eC(4);return a[0]=t,a[1]=r,a[2]=i,a[3]=n,a};function e5(){var t=new eC(2);return eC!=Float32Array&&(t[0]=0,t[1]=0),t}function e8(t,r){var i=new eC(2);return i[0]=t,i[1]=r,i}function e7(t,r,i){return t[0]=r[0]*i,t[1]=r[1]*i,t}function e9(t){var r=t[0],i=t[1];return Math.sqrt(r*r+i*i)}function te(t){return t[0]=0,t[1]=0,t}eU(),eG(1,0,0),eG(0,1,0),e3(),e3(),eM();var tt=function(t){var r=t[0],i=t[1];return r*r+i*i};function tr(t,r,i){return r*(8192/(t.tileSize*2**(i-t.tileID.overscaledZ)))}function ti(t){return t instanceof Error?t:Error("string"==typeof t?t:String(t))}function tn(){return new Float64Array(4)}function ta(){return new Float64Array(3)}function to(){return new Float64Array(16)}function ts(){let t=new Float64Array(16);return eI(t),t}function tl(){let t=new Float32Array(16);return eI(t),t}function tu(t,r,i,n,a=!1){if(!i[0]&&!i[1])return[0,0];let o=a?"map"===n?-t.bearingInRadians:0:"viewport"===n?t.bearingInRadians:0;if(o){let t=Math.sin(o),r=Math.cos(o);i=[i[0]*r-i[1]*t,i[0]*t+i[1]*r]}return[a?i[0]:tr(r,i[0],t.zoom),a?i[1]:tr(r,i[1],t.zoom)]}function tc(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]}function th(t,r,i){var n,a,o,s,l,u,c,h,f,d;let p=(a=(n=[t[0],t[1],t[2],r[0],r[1],r[2],i[0],i[1],i[2]])[0],o=n[1],s=n[2],l=n[3],u=n[4],c=n[5],h=n[6],f=n[7],a*((d=n[8])*u-c*f)+o*(-d*l+c*h)+s*(f*l-u*h));if(0===p)return null;let m=eK([],[r[0],r[1],r[2]],[i[0],i[1],i[2]]),g=eK([],[i[0],i[1],i[2]],[t[0],t[1],t[2]]),y=eK([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),v=eW([],m,-t[3]);return eq(v,v,eW([],g,-r[3])),eq(v,v,eW([],y,-i[3])),eW(v,v,1/p),v}function tf(t,r,i,n){let a=Math.sqrt(t*t+r*r),o=Math.sqrt(i*i+n*n);t/=a,r/=a;let s=Math.acos(t*(i/=o)+r*(n/=o));return-r*i+t*n>0?s:-s}function td(t,r){let i=(t%360+360)%360,n=(r%360+360)%360,a=n-i,o=n>i?a-360:a+360;return Math.abs(a)<Math.abs(o)?a:o}function tp(t,r){var i,n;let a=(t%(i=2*Math.PI)+i)%i,o=(r%(n=2*Math.PI)+n)%n;return Math.min(Math.abs(a-o),Math.abs(a-o+2*Math.PI),Math.abs(a-o-2*Math.PI))}e5();function tm(t,r,i,n,a){var o,s,l;return o=n,s=a,o*(1-(l=tv((t-r)/(i-r),0,1)))+s*l}function tg(t,r,i,n){let a,o,s,l,u,c;return a=3*t,o=3*(i-t)-a,s=1-a-o,l=3*r,u=3*(n-r)-l,c=1-l-u,function(t,r=1e-6){if(t<=0)return 0;if(t>=1)return 1;let i=t;for(let n=0;n<8;n++){let n=((s*i+o)*i+a)*i-t;if(Math.abs(n)<r)return((c*i+u)*i+l)*i;let h=(3*s*i+2*o)*i+a;if(1e-6>Math.abs(h))break;i-=n/h}let n=0,h=1;i=t;for(let l=0;l<20;l++){let l=((s*i+o)*i+a)*i;if(Math.abs(l-t)<r)break;t>l?n=i:h=i,i=(n+h)*.5}return((c*i+u)*i+l)*i}}let ty=tg(.25,.1,.25,1);function tv(t,r,i){return Math.min(i,Math.max(r,t))}function t_(t,r,i){let n=i-r,a=((t-r)%n+n)%n+r;return a===r?i:a}function tb(t,...r){for(let i of r)for(let r in i)t[r]=i[r];return t}function tx(t,r){let i={};for(let n of r)n in t&&(i[n]=t[n]);return i}let tw=1;function tE(t){return 2**t}function tT(t){return Math.log(t)/Math.LN2}function tA(t,r,i){if(r<=0)return t;let n=1/r;return void 0===i||1e-10>Math.abs(i)?Math.round(t*n)/n:(i>0?Math.ceil(t*n-1e-9):Math.floor(t*n+1e-10))/n}function tS(t,r,i){let n={};for(let a in t)n[a]=r.call(i||this,t[a],a,t);return n}function tC(t,r,i){let n={};for(let a in t)r.call(i||this,t[a],a,t)&&(n[a]=t[a]);return n}function tM(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let i=0;i<t.length;i++)if(!tM(t[i],r[i]))return!1;return!0}if("object"==typeof t&&t&&null!==r){if("object"!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(let i in t)if(!tM(t[i],r[i]))return!1;return!0}return t===r}function tD(t){return Array.isArray(t)?t.map(tD):"object"==typeof t&&t?tS(t,tD):t}let tP={};function tI(t){tP[t]||("u">typeof console&&console.warn(t),tP[t]=!0)}function tk(t,r,i){return(i.y-t.y)*(r.x-t.x)>(r.y-t.y)*(i.x-t.x)}function tO(t){return"u">typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let tN=null;function tL(t){return"u">typeof ImageBitmap&&t instanceof ImageBitmap}let tR=async(t,r)=>{let i=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(i,r)}catch(t){throw Error(`Could not load image because of ${ti(t).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}};async function tF(t,r,i,n,a){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let o=new VideoFrame(t,{timestamp:0});try{let s,l,u,c=o?.format;if(!c||!(c.startsWith("BGR")||c.startsWith("RGB")))throw Error(`Unrecognized format ${c}`);let h=c.startsWith("BGR"),f=new Uint8ClampedArray(n*a*4);if(await o.copyTo(f,(s=(Math.max(0,i)-i)*n*4+4*Math.max(-r,0),l=Math.max(0,r),u=Math.max(0,i),{rect:{x:l,y:u,width:Math.min(t.width,r+n)-l,height:Math.min(t.height,i+a)-u},layout:[{offset:s,stride:4*n}]})),h)for(let t=0;t<f.length;t+=4){let r=f[t];f[t]=f[t+2],f[t+2]=r}return f}finally{o.close()}}function tB(t,r,i,n){return t.addEventListener(r,i,n),{unsubscribe:()=>{t.removeEventListener(r,i,n)}}}function tz(t){return t*Math.PI/180}function tj(t){return t/Math.PI*180}function tU(t,r){return t.roll==r.roll&&t.pitch==r.pitch&&t.bearing==r.bearing}function tV(t,r,i){let n=e8(r.x-i.x,r.y-i.y),a=e8(t.x-i.x,t.y-i.y);
56return tj(Math.atan2(n[0]*a[1]-n[1]*a[0],n[0]*a[0]+n[1]*a[1]))}function t$(t,r,i){let n=new Float64Array(4);return e4(n,t,r-90,i),n}let tG={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},tq={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},tH="AbortError";var tW=class extends Error{constructor(t=tH){super(t instanceof Error?t.message:t),this.name=tH,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function tZ(t){return t instanceof Error&&"AbortError"===t.name}function tY(t){if(t.aborted)throw new tW(t.reason)}let tX={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function tK(t){return tX.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}let tQ="global-dispatcher";var tJ=class extends Error{constructor(t,r,i,n){super(`AJAXError: ${r} (${t}): ${i}`),this.status=t,this.statusText=r,this.url=i,this.body=n}};function t0(){if(tO(self))return self.worker?.referrer;if("blob:"===window.location.protocol)try{return window.parent.location.href}catch{}return window.location.href}async function t1(t,r){let i,n,a=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:t0(),referrerPolicy:t.referrerPolicy,signal:r.signal});"json"!==t.type||a.headers.has("Accept")||a.headers.set("Accept","application/json");try{i=await fetch(a)}catch(r){throw tZ(r)?r:new tJ(0,ti(r).message,t.url,new Blob)}if(!i.ok){let r=await i.blob();throw new tJ(i.status,i.statusText,t.url,r)}n="arrayBuffer"===t.type||"image"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text();let o=await n;return tY(r.signal),{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}}let t2=async function(t,r){let i;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let i=tK(t.url);if(i){let n=await i(t,r);return n.data||"arrayBuffer"!==t.type?n:tb(n,{data:new ArrayBuffer(0)})}if(tO(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:tQ},r)}if(!((i=t.url).startsWith("file:")||t0()?.startsWith("file:")&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return t1(t,r);if(tO(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:tQ},r)}return new Promise((i,n)=>{let a=new XMLHttpRequest;for(let r in a.open(t.method||"GET",t.url,!0),("arrayBuffer"===t.type||"image"===t.type)&&(a.responseType="arraybuffer"),t.headers)a.setRequestHeader(r,t.headers[r]);"json"===t.type&&(a.responseType="text",t.headers?.Accept||a.setRequestHeader("Accept","application/json")),a.withCredentials="include"===t.credentials,a.onerror=()=>{n(Error(a.statusText))},a.onload=()=>{if(!r.signal.aborted)if((a.status>=200&&a.status<300||0===a.status)&&null!==a.response){let r=a.response;if("json"===t.type)try{r=JSON.parse(a.response)}catch(t){n(t);return}i({data:r,cacheControl:a.getResponseHeader("Cache-Control"),expires:a.getResponseHeader("Expires"),etag:a.getResponseHeader("ETag")})}else{let r=new Blob([a.response],{type:a.getResponseHeader("Content-Type")});n(new tJ(a.status,a.statusText,t.url,r))}},r.signal.addEventListener("abort",()=>{a.abort(),n(new tW(r.signal.reason))}),a.send(t.body)})},t3=(t,r)=>t2(tb(t,{type:"json"}),r),t4=(t,r)=>t2(tb(t,{type:"arrayBuffer"}),r);function t6(t){if(!t||t.startsWith("data:image/"))return!0;if(t.startsWith("blob:")&&(t=t.slice(5)).startsWith("null"))return!1;if(0>=t.indexOf("://"))return!0;let r=new URL(t),i=window.location;return r.protocol===i.protocol&&r.host===i.host}function t5(t,r,i){i[t]?.includes(r)||(i[t]||=[],i[t].push(r))}function t8(t,r,i){if(i?.[t]){let n=i[t].indexOf(r);-1!==n&&i[t].splice(n,1)}}var t7=class{constructor(t,r={}){tb(this,r),this.type=t}},t9=class extends t7{constructor(t,r={}){super("error",tb({error:t},r))}},re=class{on(t,r){return this._listeners||={},t5(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return t8(t,r,this._listeners),t8(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners||={},t5(t,r,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,r){let i="string"==typeof t?new t7(t,r||{}):t,n=i.type;if(this.listens(n)){for(let t of(i.target=this,this._listeners?.[n]?.slice()??[]))t.call(this,i);for(let t of this._oneTimeListeners?.[n]?.slice()??[])t8(n,t,this._oneTimeListeners),t.call(this,i);let t=this._eventedParent;t&&(tb(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),t.fire(i))}else i instanceof t9&&console.error(i.error);return this}listens(t){return!!(this._listeners?.[t]?.length||this._oneTimeListeners?.[t]?.length||this._eventedParent?.listens(t))}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}},rt
vendor: 34,760 bytes, line 56
56={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}}
56;let rr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var ri=class{constructor(t,r,i,n,a="error"){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),this.severity=a,null!=r&&r.__line__&&(this.line=r.__line__)}};let rn={kind:"null"},ra={kind:"number"},ro={kind:"string"},rs={kind:"boolean"},rl={kind:"color"},ru={kind:"projectionDefinition"},rc={kind:"object"},rh={kind:"value"},rf={kind:"collator"},rd={kind:"formatted"},rp={kind:"padding"},rm={kind:"colorArray"},rg={kind:"numberArray"},ry={kind:"resolvedImage"},rv={kind:"variableAnchorOffsetCollection"};function r_(t,r){return{kind:"array",itemType:t,N:r}}function rb(t){if("array"===t.kind){let r=rb(t.itemType);return"number"==typeof t.N?`array<${r}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${r}>`}return t.kind}
56let rx=[rn,ra,ro,rs,rl,ru,rd,rc,r_(rh),rp,rg,rm,ry,rv];function rw(t,r){if("error"===r.kind)return null;if("array"===t.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!rw(t.itemType,r.itemType))&&("number"!=typeof t.N||t.N===r.N))return null}else if(t.kind===r.kind)return null;else if("value"===t.kind){for(let t of rx)if(!rw(t,r))return null}return`Expected ${rb(t)} but found ${rb(r)} instead.`}function rE(t,r){return r.some(r=>r.kind===t.kind)}function rT(t,r){return r.some(r=>"null"===r?null===t:"array"===r?Array.isArray(t):"object"===r?t&&!Array.isArray(t)&&"object"==typeof t:r===typeof t)}function rA(t,r){return"array"===t.kind&&"array"===r.kind?t.itemType.kind===r.itemType.kind&&"number"==typeof t.N:t.kind===r.kind}let rS=4/29,rC=6/29,rM=6/29*3*(6/29),rD=Math.PI/180,rP=180/Math.PI;function rI(t){return(t%=360)<0&&(t+=360),t}function rk([t,r,i,n]){t=rO(t);let a,o,s=rN((.2225045*t+.7168786*(r=rO(r))+.0606169*(i=rO(i)))/1);t===r&&r===i?a=o=s:(a=rN((.4360747*t+.3850649*r+.1430804*i)/.96422),o=rN((.0139322*t+.0971045*r+.7141733*i)/.82521));let l=116*s-16;return[l<0?0:l,500*(a-s),200*(s-o),n]}function rO(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function rN(t){return t>.008856451679035631?t**(1/3):t/rM+rS}function rL([t,r,i,n]){let a=(t+16)/116,o=isNaN(r)?a:a+r/500,s=isNaN(i)?a:a-i/200;return a=+rF(a),[rR(3.1338561*(o=.96422*rF(o))-1.6168667*a-.4906146*(s=.82521*rF(s))),rR(-.9787684*o+1.9161415*a+.033454*s),rR(.0719453*o-.2289914*a+1.4052427*s),n]}function rR(t){return(t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055)<0?0:t>1?1:t}function rF(t){return t>rC?t*t*t:rM*(t-rS)}let rB=Object.hasOwn||function(t,r){return Object.prototype.hasOwnProperty.call(t,r)};function rz(t,r){return rB(t,r)?t[r]:void 0}function rj(t){return parseInt(t.padEnd(2,t),16)/255}function rU(t,r){return rV(r?t/100:t,0,1)}function rV(t,r,i){return Math.min(Math.max(r,t),i)}function r$(t){return!t.some(Number.isNaN)}let rG={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],ol
56ive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function rq(t,r,i){return t.map((t,n)=>t+i*(r[n]-t))}var rH=class t{constructor(t,r,i,n=1,a=!0){this.r=t,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,r,i,n]))}static{this.black=new t(0,0,0,1)}static{this.white=new t(1,1,1,1)}static{this.transparent=new t(0,0,0,0)}static{this.red=new t(1,0,0,1)}static parse(r){if(r instanceof t)return r;if("string"!=typeof r)return;let i=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];let r=rz(rG,t);if(r){let[t,i,n]=r;return[t/255,i/255,n/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let r=t.length<6?1:2,i=1;return[rj(t.slice(i,i+=r)),rj(t.slice(i,i+=r)),rj(t.slice(i,i+=r)),rj(t.slice(i,i+r)||"ff")]}if(t.startsWith("rgb")){let r=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[t,i,n,a,o,s,l,u,c,h,f,d]=r,p=[a||" ",l||" ",h].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){let t=[n,s,c].join(""),r="%%%"===t?100:255*(""===t);if(r){let t=[rV(i/r,0,1),rV(o/r,0,1),rV(u/r,0,1),f?rU(+f,d):1];if(r$(t))return t}}return}}let i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[t,r,n,a,o,s,l,u,c]=i,h=[n||" ",o||" ",l].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){let t=[+r,rV(+a,0,100),rV(+s,0,100),u?rU(+u,c):1];if(r$(t))return function([t,r,i,n]){function a(n){let a=(n+t/30)%12,o=r*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(a-3,9-a,1))}return t=rI(t),r/=100,i/=100,[a(0),a(8),a(4),n]}(t)}}}(r);if(i)return new t(...i,!1)}get rgb(){let{r:t,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[t/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter("hcl",function(t){let[r,i,n,a]=rk(t),o=Math.sqrt(i*i+n*n);return[Math.round(1e4*o)?rI(Math.atan2(n,i)*rP):NaN,o,r,a]}(this.rgb))}get lab(){return this.overwriteGetter("lab",rk(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,i,n]=this.rgb;return`rgba(${[t,r,i].map(t=>Math.round(255*t)).join(",")},${n})`}static interpolate(r,i,n,a="rgb"){switch(a){case"rgb":{let[a,o,s,l]=rq(r.rgb,i.rgb,n);return new t(a,o,s,l,!1)}case"hcl":{let[a,o,s,l]=r.hcl,[u,c,h,f]=i.hcl,d,p;if(isNaN(a)||isNaN(u))isNaN(a)?isNaN(u)?d=NaN:(d=u,(1===s||0===s)&&(p=c)):(d=a,(1===h||0===h)&&(p=o));else{let t=u-a;u>a&&t>180?t-=360:u<a&&a-u>180&&(t+=360),d=a+n*t}let[m,g,y,v]=function([t,r,i,n]){return rL([i,Math.cos(t=isNaN(t)?0:t*rD)*r,Math.sin(t)*r,n])}([d,p??o+n*(c-o),s+n*(h-s),l+n*(f-l)]);return new t(m,g,y,v,!1)}case"lab":{let[a,o,s,l]=rL(rq(r.lab,i.lab,n));return new t(a,o,s,l,!1)}}}};let rW=["bottom","center","top"];var rZ=class{constructor(t,r,i,n,a,o){this.text=t,this.image=r,this.scale=i,this.fontStack=n,this.textColor=a,this.verticalAlign=o}},rY=class t{constructor(t){this.sections=t}static fromString(r){return new t([new rZ(r,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(r){return r instanceof t?r:t.fromString(r)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}},rX=class t{constructor(t){this.values=t.slice()}static parse(r){if(r instanceof t)return r;if("number"==typeof r)return new t([r,r,r,r]);if(Array.isArray(r)&&!(r.length<1||r.length>4)){for(let t of r)if("number"!=typeof t)return;switch(r.length){case 1:r=[r[0],r[0],r[0],r[0]];break;case 2:r=[r[0],r[1],r[0],r[1]];break;case 3:r=[r[0],r[1],r[2],r[1]]}return new t(r)}}toString(){return JSON.stringify(this.values)}
vendor: 6,129 bytes, line 56
56static interpolate(r,i,n){return new t(rq(r.values,i.values,n))}},rK=class t{constructor(t){this.values=t.slice()}static parse(r){if(r instanceof t)return r;if("number"==typeof r)return new t([r]);if(Array.isArray(r)){for(let t of r)if("number"!=typeof t)return;return new t(r)}}toString(){return JSON.stringify(this.values)}static interpolate(r,i,n){return new t(rq(r.values,i.values,n))}},rQ=class t{constructor(t){this.values=t.slice()}static parse(r){if(r instanceof t)return r;if("string"==typeof r){let i=rH.parse(r);return i?new t([i]):void 0}if(!Array.isArray(r))return;let i=[];for(let t of r){if("string"!=typeof t)return;let r=rH.parse(t);if(!r)return;i.push(r)}return new t(i)}toString(){return JSON.stringify(this.values)}static interpolate(r,i,n,a="rgb"){let o=[];if(r.values.length!=i.values.length)throw Error(`colorArray: Arrays have mismatched length (${r.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let t=0;t<r.values.length;t++)o.push(rH.interpolate(r.values[t],i.values[t],n,a));return new t(o)}},rJ=class extends Error{constructor(t,r){super(t),this.name="RuntimeError",this.path=r}toJSON(){return this.message}};let r0=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var r1=class t{constructor(t){this.values=t.slice()}static parse(r){if(r instanceof t)return r;if(!(!Array.isArray(r)||r.length<1||r.length%2!=0)){for(let t=0;t<r.length;t+=2){let i=r[t],n=r[t+1];if("string"!=typeof i||!r0.has(i)||!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new t(r)}}toString(){return JSON.stringify(this.values)}static interpolate(r,i,n,a){let o=r.values,s=i.values;if(o.length!==s.length)throw new rJ(`Cannot interpolate values of different length. from: ${r.toString()}, to: ${i.toString()}`,a);let l=[];for(let t=0;t<o.length;t+=2){if(o[t]!==s[t])throw new rJ(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${o[t]}, to[${t}]: ${s[t]}`,a);l.push(o[t]);let[r,i]=o[t+1],[u,c]=s[t+1];l.push([r+n*(u-r),i+n*(c-i)])}return new t(l)}},r2=class t{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(r){return r?new t({name:r,available:!1}):null}},r3=class t{constructor(t,r,i){this.from=t,this.to=r,this.transition=i}toString(){return this.from===this.to&&1===this.transition?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(r,i,n){return new t(r,i,n)}static parse(r){return r instanceof t?r:Array.isArray(r)&&3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]&&"number"==typeof r[2]?new t(r[0],r[1],r[2]):"object"==typeof r&&"string"==typeof r.from&&"string"==typeof r.to&&"number"==typeof r.transition?new t(r.from,r.to,r.transition):"string"==typeof r?new t(r,r,1):void 0}},r4=class{constructor(t,r,i){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function r6(t,r,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,r,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,r,i,n]:[t,r,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function r5(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof r3||t instanceof rH||t instanceof r4||t instanceof rY||t instanceof rX||t instanceof rK||t instanceof rQ||t instanceof r1||t instanceof r2)return!0;if(Array.isArray(t)){for(let r of t)if(!r5(r))return!1;return!0}if("object"==typeof t){for(let r in t)if(!r5(t[r]))return!1;return!0}return!1}function r8(t){if(null===t)return rn;if("string"==typeof t)return ro;if("boolean"==typeof t)return rs;if("number"==typeof t)return ra;if(t instanceof rH)return rl;if(t instanceof r3)return ru;if(t instanceof r4)return rf;if(t instanceof rY)return rd;if(t instanceof rX)return rp;if(t instanceof rK)return rg;if(t instanceof rQ)return rm;if(t instanceof r1)return rv;if(t instanceof r2)return ry;if(Array.isArray(t)){let r=t.length,i;for(let r of t){let t=r8(r);if(i){if(i===t)continue;i=rh;break}i=t}return r_(i||rh,r)}return rc}function r7(t){let r=typeof t;return null===t?"":"string"===r||"number"===r||"boolean"===r?String(t):t instanceof rH||t instanceof r3||t instanceof rY||t instanceof rX||t instanceof rK||t instanceof rQ||t instanceof r1||t instanceof r2?t.toString():JSON.stringify(t)}var r9=class t{constructor(t,r){this.type=t,this.value=r}static parse(r,i){if(2!==r.length)return i.error(`'literal' expression requires exactly one argument, but found ${r.length-1} instead.`);if(!r5(r[1]))return i.error(`invalid value of type "${typeof r[1]}"`);let n=r[1],a=r8(n),o=i.expectedType;return"array"===a.kind&&0===a.N&&o&&"array"===o.kind&&("number"!=typeof o.N||0===o.N)&&(a=o),new t(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};let ie=["Unknown","Point","LineString","Polygon"];var ir=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ie[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache.get(t);return r||(r=rH.parse(t),this._parseColorCache.set(t,r)),r}};function ii(t,r,i){let n=t.length-1,a=0,o=n,s=0,l,u;for(;a<=o;)if(l=t[s=Math.floor((a+o)/2)],u=t[s+1],l<=r){if(s===n||r<u)return s;a=s+1}else if(l>r)o=s-1;else throw new rJ("Input is not a number.",i);return 0}
56var ia=class t{constructor(t,r,i,n){for(let[a,o]of(this.type=t,this.input=r,this.key=n,this.labels=[],this.outputs=[],i))this.labels.push(a),this.outputs.push(o)}static parse(r,i){if(r.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return i.error("Expected an even number of arguments.");let n=i.parse(r[1],1,ra);if(!n)return null;let a=[],o=null;i.expectedType&&"value"!==i.expectedType.kind&&(o=i.expectedType);for(let t=1;t<r.length;t+=2){let n=1===t?-1/0:r[t],s=r[t+1],l=t,u=t+1;if("number"!=typeof n)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',l);if(a.length&&a[a.length-1][0]>=n)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);let c=i.parse(s,u,o);if(!c)return null;o||=c.type,a.push([n,c])}return new t(o,n,a,i.key)}evaluate(t){let r=this.labels,i=this.outputs;if(1===r.length)return i[0].evaluate(t);let n=this.input.evaluate(t);if(n<=r[0])return i[0].evaluate(t);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(t):i[ii(r,n,this.key)].evaluate(t)}eachChild(t){for(let r of(t(this.input),this.outputs))t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}},io=class t{constructor(t,r,i,n,a,o){for(let[s,l]of(this.type=t,this.operator=r,this.interpolation=i,this.input=n,this.key=o,this.labels=[],this.outputs=[],a))this.labels.push(s),this.outputs.push(l)}static interpolationFactor(t,r,i,n){let a=0;if("exponential"===t.name)a=is(r,t.base,i,n);else if("linear"===t.name)a=is(r,1,i,n);else if("cubic-bezier"===t.name){var o,s,l,u;let c,h,f,d,p,m,g=t.controlPoints;a=(o=g[0],s=g[1],l=g[2],u=g[3],c=3*o,h=3*(l-o)-c,f=1-c-h,d=3*s,p=3*(u-s)-d,m=1-d-p,function(t,r=1e-6){if(t<=0)return 0;if(t>=1)return 1;let i=t;for(let n=0;n<8;n++){let n=((f*i+h)*i+c)*i-t;if(Math.abs(n)<r)return((m*i+p)*i+d)*i;let a=(3*f*i+2*h)*i+c;if(1e-6>Math.abs(a))break;i-=n/a}let n=0,a=1;i=t;for(let o=0;o<20;o++){let o=((f*i+h)*i+c)*i;if(Math.abs(o-t)<r)break;t>o?n=i:a=i,i=(n+a)*.5}return((m*i+p)*i+d)*i}
56)(is(r,1,i,n))}return a}static parse(r,i){let[n,a,o,...s]=r;if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let t=a[1];if("number"!=typeof t)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:t}}else{if("cubic-bezier"!==a[0])return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);let t=a.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:t}}if(r.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(o=i.parse(o,2,ra)))return null;let l=[],u=null;("interpolate-hcl"===n||"interpolate-lab"===n)&&i.expectedType!=rm?u=rl:i.expectedType&&"value"!==i.expectedType.kind&&(u=i.expectedType);for(let t=0;t<s.length;t+=2){let r=s[t],n=s[t+1],a=t+3,o=t+4;if("number"!=typeof r)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(l.length&&l[l.length-1][0]>=r)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',a);let c=i.parse(n,o,u);if(!c)return null;u||=c.type,l.push([r,c])}return rA(u,ra)||rA(u,ru)||rA(u,rl)||rA(u,rp)||rA(u,rg)||rA(u,rm)||rA(u,rv)||rA(u,r_(ra))?new t(u,n,a,o,l,i.key):i.error(`Type ${rb(u)} is not interpolatable.`)}evaluate(r){let i=this.labels,n=this.outputs;if(1===i.length)return n[0].evaluate(r);let a=this.input.evaluate(r);if(a<=i[0])return n[0].evaluate(r);let o=i.length;if(a>=i[o-1])return n[o-1].evaluate(r);let s=ii(i,a,this.key),l=i[s],u=i[s+1],c=t.interpolationFactor(this.interpolation,a,l,u),h=n[s].evaluate(r),f=n[s+1].evaluate(r);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return h+c*(f-h);case"color":return rH.interpolate(h,f,c);case"padding":return rX.interpolate(h,f,c);case"colorArray":return rQ.interpolate(h,f,c);case"numberArray":return rK.interpolate(h,f,c);case"variableAnchorOffsetCollection":return r1.interpolate(h,f,c,this.key);case"array":return rq(h,f,c);case"projectionDefinition":return r3.interpolate(h,f,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return rH.interpolate(h,f,c,"hcl");case"colorArray":return rQ.interpolate(h,f,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return rH.interpolate(h,f,c,"lab");case"colorArray":return rQ.interpolate(h,f,c,"lab")}}}eachChild(t){for(let r of(t(this.input),this.outputs))t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function is(t,r,i,n){let a=n-i,o=t-i;return 0===a?0:1===r?o/a:(r**o-1)/(r**a-1)}let il={color:rH.interpolate,number:function(t,r,i){return t+i*(r-t)},padding:rX.interpolate,numberArray:rK.interpolate,colorArray:rQ.interpolate,variableAnchorOffsetCollection:r1.interpolate,array:rq};var iu=class t{constructor(t){this.type=rd,this.sections=t}static parse(r,i){if(r.length<2)return i.error("Expected at least one argument.");let n=r[1];if(!Array.isArray(n)&&"object"==typeof n)return i.error("First argument must be an image or text section.");let a=[],o=!1;for(let t=1;t<=r.length-1;++t){let n=r[t];if(o&&"object"==typeof n&&!Array.isArray(n)){o=!1;let t=null;if(n["font-scale"]&&!(t=i.parse(n["font-scale"],1,ra)))return null;let r=null;if(n["text-font"]&&!(r=i.parse(n["text-font"],1,r_(ro))))return null;let s=null;if(n["text-color"]&&!(s=i.parse(n["text-color"],1,rl)))return null;let l=null;if(n["vertical-align"]){if("string"==typeof n["vertical-align"]&&!rW.includes(n["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${n["vertical-align"]}' instead.`);if(!(l=i.parse(n["vertical-align"],1,ro)))return null}let u=a[a.length-1];u.scale=t,u.font=r,u.textColor=s,u.verticalAlign=l}else{let n=i.parse(r[t],1,rh);if(!n)return null;let s=n.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,a.push({content:n,scale:null,font:null,textColor:null,verticalAlign:null})}}return new t(a)}evaluate(t){return new rY(this.sections.map(r=>{let i=r.content.evaluate(t);return r8(i)===ry?new rZ("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new rZ(r7(i),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}};function ic(t,r,i){let n=t[r];t[r]=t[i],t[i]=n}function ih(t,r){if(t.length<=1)return[t];let i=[],n,a;for(let r of t){let t=function(t){let r=0;for(let i=0,n=t.length,a=n-1,o,s;i<n;
56a=i++)o=t[i],r+=((s=t[a]).x-o.x)*(o.y+s.y);return r}(r);0!==t&&(r.area=Math.abs(t),void 0===a&&(a=t<0),a===t<0?(n&&i.push(n),n=[r]):n.push(r))}if(n&&i.push(n),r>1)for(let t=0;t<i.length;t++)i[t].length<=r||(function t(r,i,n=0,a=r.length-1,o=function(t,r){return t<r?-1:+(t>r)}){for(;a>n;){if(a-n>600){let s=a-n+1,l=i-n+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(r,i,Math.max(n,Math.floor(i-l*c/s+h)),Math.min(a,Math.floor(i+(s-l)*c/s+h)),o)}let s=r[i],l=n,u=a;for(ic(r,n,i),o(r[a],s)>0&&ic(r,n,a);l<u;){for(ic(r,l,u),l++,u--;0>o(r[l],s);)l++;for(;o(r[u],s)>0;)u--}0===o(r[n],s)?ic(r,n,u):ic(r,++u,a),u<=i&&(n=u+1),i<=u&&(a=u-1)}}(i[t],r,1,i[t].length-1,id),i[t]=i[t].slice(0,r));return i}function id(t,r){return r.area-t.area}let ip={string:ro,number:ra,boolean:rs,object:rc};var im=class t{constructor(t,r,i){this.type=t,this.args=r,this.key=i}static parse(r,i){if(r.length<2)return i.error("Expected at least one argument.");let n=1,a,o=r[0];if("array"===o){let t,o;if(r.length>2){let a=r[1];if("string"!=typeof a||!(a in ip)||"object"===a)return i.error('The item type argument of "array" must be one of string, number, boolean',1);t=ip[a],n++}else t=rh;if(r.length>3){if(null!==r[2]&&("number"!=typeof r[2]||r[2]<0||r[2]!==Math.floor(r[2])))return i.error('The length argument to "array" must be a positive integer literal',2);o=r[2],n++}a=r_(t,o)}else{if(!ip[o])throw Error(`Types doesn't contain name = ${o}`);a=ip[o]}let s=[];for(;n<r.length;n++){let t=i.parse(r[n],n,rh);if(!t)return null;s.push(t)}return new t(a,s,i.key)}evaluate(t){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(t);if(!rw(this.type,r8(i)))return i;if(r===this.args.length-1)throw new rJ(`Expected value to be of type ${rb(this.type)}, but found ${rb(r8(i))} instead.`,this.key)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};let ig={"to-boolean":rs,"to-color":rl,"to-number":ra,"to-string":ro};var iy=class t{constructor(t,r,i){this.type=t,this.args=r,this.key=i}static parse(r,i){if(r.length<2)return i.error("Expected at least one argument.");let n=r[0];if(!ig[n])throw Error(`Can't parse ${n} as it is not part of the known types`);if(("to-boolean"===n||"to-string"===n)&&2!==r.length)return i.error("Expected one argument.");let a=ig[n],o=[];for(let t=1;t<r.length;t++){let n=i.parse(r[t],t,rh);if(!n)return null;o.push(n)}return new t(a,o,i.key)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,i;for(let n of this.args){if(r=n.evaluate(t),i=null,r instanceof rH)return r;if("string"==typeof r){let i=t.parseColor(r);if(i)return i}else if(Array.isArray(r)&&!(i=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:r6(r[0],r[1],r[2],r[3])))return new rH(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new rJ(i||`Could not parse color from value '${"string"==typeof r?r:JSON.stringify(r)}'`,this.key)}case"padding":{let r;for(let i of this.args){r=i.evaluate(t);let n=rX.parse(r);if(n)return n}throw new rJ(`Could not parse padding from value '${"string"==typeof r?r:JSON.stringify(r)}'`,this.key)}case"numberArray":{let r;for(let i of this.args){r=i.evaluate(t);let n=rK.parse(r);if(n)return n}throw new rJ(`Could not parse numberArray from value '${"string"==typeof r?r:JSON.stringify(r)}'`,this.key)}case"colorArray":{let r;for(let i of this.args){r=i.evaluate(t);let n=rQ.parse(r);if(n)return n}throw new rJ(`Could not parse colorArray from value '${"string"==typeof r?r:JSON.stringify(r)}'`,this.key)}case"variableAnchorOffsetCollection":{let r;for(let i of this.args){r=i.evaluate(t);let n=r1.parse(r);if(n)return n}throw new rJ(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof r?r:JSON.stringify(r)}'`,this.key)}case"number":{let r=null;for(let i of this.args){if(null===(r=i.evaluate(t)))return 0;let n=Number(r);if(!isNaN(n))return n}throw new rJ(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return rY.fromString(r7(this.args[0].evaluate(t)));case"resolvedImage":return r2.fromString(r7(this.args[0].evaluate(t)));case"projectionDefinition":{let r=this.args[0].evaluate(t);if(r3.parse(r))return r;throw new rJ(`Could not parse projectionDefinition from value '${"string"==typeof r?r:JSON.stringify(r)}'`,this.key)}default:return r7(this.args[0].evaluate(t))}}
vendor: 5,584 bytes, line 56
56eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},iv=class t{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(r,i){if(r.length<4)return i.error(`Expected at least 3 arguments, but found ${r.length-1} instead.`);let n=[];for(let t=1;t<r.length-1;t+=2){let a=r[t];if("string"!=typeof a)return i.error(`Expected string, but found ${typeof a} instead.`,t);if(/[^a-zA-Z0-9_]/.test(a))return i.error("Variable names must contain only alphanumeric characters or '_'.",t);let o=i.parse(r[t+1],t+1);if(!o)return null;n.push([a,o])}let a=i.parse(r[r.length-1],r.length-1,i.expectedType,n);return a?new t(n,a):null}outputDefined(){return this.result.outputDefined()}},i_=class t{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(r,i){if(2!==r.length||"string"!=typeof r[1])return i.error("'var' expression requires exactly one string literal argument.");let n=r[1];return i.scope.has(n)?new t(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},ib=class t{constructor(t,r,i,n){this.type=t,this.index=r,this.input=i,this.key=n}static parse(r,i){if(3!==r.length)return i.error(`Expected 2 arguments, but found ${r.length-1} instead.`);let n=i.parse(r[1],1,ra),a=i.parse(r[2],2,r_(i.expectedType||rh));return n&&a?new t(a.type.itemType,n,a,i.key):null}evaluate(t){let r=this.index.evaluate(t),i=this.input.evaluate(t);if(r<0)throw new rJ(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new rJ(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new rJ(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},ix=class t{constructor(t,r,i){this.needle=t,this.haystack=r,this.key=i,this.type=rs}static parse(r,i){if(3!==r.length)return i.error(`Expected 2 arguments, but found ${r.length-1} instead.`);let n=i.parse(r[1],1,rh),a=i.parse(r[2],2,rh);return n&&a?rE(n.type,[rs,ro,ra,rn,rh])?new t(n,a,i.key):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${rb(n.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!rT(r,["boolean","string","number","null"]))throw new rJ(`Expected first argument to be of type boolean, string, number or null, but found ${rb(r8(r))} instead.`,this.key);if(!rT(i,["string","array"]))throw new rJ(`Expected second argument to be of type array or string, but found ${rb(r8(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},iw=class t{constructor(t,r,i,n){this.needle=t,this.haystack=r,this.key=i,this.fromIndex=n,this.type=ra}static parse(r,i){if(r.length<=2||r.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${r.length-1} instead.`);let n=i.parse(r[1],1,rh),a=i.parse(r[2],2,rh);if(!n||!a)return null;if(!rE(n.type,[rs,ro,ra,rn,rh]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${rb(n.type)} instead`);if(4===r.length){let o=i.parse(r[3],3,ra);return o?new t(n,a,i.key,o):null}return new t(n,a,i.key)}evaluate(t){let r,i=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!rT(i,["boolean","string","number","null"]))throw new rJ(`Expected first argument to be of type boolean, string, number or null, but found ${rb(r8(i))} instead.`,this.key);if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),rT(n,["string"])){let t=n.indexOf(i,r);return -1===t?-1:[...n.slice(0,t)].length}if(rT(n,["array"]))return n.indexOf(i,r);throw new rJ(`Expected second argument to be of type array or string, but found ${rb(r8(n))} instead.`,this.key)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},iE=class t{constructor(t,r,i,n,a,o){this.inputType=t,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=o}static parse(r,i){let n,a;if(r.length<5)return i.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length%2!=1)return i.error("Expected an even number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);let o={},s=[];for(let t=2;t<r.length-1;t+=2){let l=r[t],u=r[t+1];Array.isArray(l)||(l=[l]);let c=i.concat(t);if(0===l.length)return c.error("Expected at least one branch label.");for(let t of l){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>0x20000000000000-1)return c.error(`Branch labels must be integers no larger than ${0x20000000000000-1}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,r8(t)))return null}else n=r8(t);if(void 0!==o[String(t)])return c.error("Branch labels must be unique.");o[String(t)]=s.length}let h=i.parse(u,t,a);if(!h)return null;a||=h.type,s.push(h)}let l=i.parse(r[1],1,rh);if(!l)return null;let u=i.parse(r[r.length-1],r.length-1,a);return!u||"value"!==l.type.kind&&i.concat(1).checkSubtype(n,l.type)?null:new t(n,a,l,o,s,u)}evaluate(t){let r=this.input.evaluate(t);return(r8(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}
56eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},iT=class t{constructor(t,r,i){this.type=t,this.branches=r,this.otherwise=i}static parse(r,i){let n;if(r.length<4)return i.error(`Expected at least 3 arguments, but found only ${r.length-1}.`);if(r.length%2!=0)return i.error("Expected an odd number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);let a=[];for(let t=1;t<r.length-1;t+=2){let o=i.parse(r[t],t,rs);if(!o)return null;let s=i.parse(r[t+1],t+1,n);if(!s)return null;a.push([o,s]),n||=s.type}let o=i.parse(r[r.length-1],r.length-1,n);if(!o)return null;if(!n)throw Error("Can't infer output type");return new t(n,a,o)}evaluate(t){for(let[r,i]of this.branches)if(r.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,i]of this.branches)t(r),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},iA=class t{constructor(t,r,i,n,a){this.type=t,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(r,i){if(r.length<=2||r.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${r.length-1} instead.`);let n=i.parse(r[1],1,rh),a=i.parse(r[2],2,ra);if(!n||!a)return null;if(!rE(n.type,[r_(rh),ro,rh]))return i.error(`Expected first argument to be of type array or string, but found ${rb(n.type)} instead`);if(4===r.length){let o=i.parse(r[3],3,ra);return o?new t(n.type,n,a,i.key,o):null}return new t(n.type,n,a,i.key)}evaluate(t){let r=this.input.evaluate(t),i=this.beginIndex.evaluate(t),n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),rT(r,["string"]))return[...r].slice(i,n).join("");if(rT(r,["array"]))return r.slice(i,n);throw new rJ(`Expected first argument to be of type array or string, but found ${rb(r8(r))} instead.`,this.key)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},iS=class t{constructor(t,r){this.type=t,this.args=r}static parse(r,i){if(r.length<2)return i.error("Expected at least one argument.");let n=null,a=i.expectedType;a&&"value"!==a.kind&&(n=a);let o=[];for(let t of r.slice(1)){let r=i.parse(t,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!r)return null;n||=r.type,o.push(r)}if(!n)throw Error("No output type");return a&&o.some(t=>rw(a,t.type))?new t(rh,o):new t(n,o)}evaluate(t){let r=null,i=0,n;for(let a of this.args)if(i++,(r=a.evaluate(t))&&r instanceof r2&&!r.available&&(n||=r.name,r=null,i===this.args.length&&(r=n)),null!==r)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function iC(t,r){return"=="===t||"!="===t?"boolean"===r.kind||"string"===r.kind||"number"===r.kind||"null"===r.kind||"value"===r.kind:"string"===r.kind||"number"===r.kind||"value"===r.kind}function iM(t,r,i,n){return 0===n.compare(r,i)}function iD(t,r,i){let n="=="!==t&&"!="!==t;return class a{constructor(t,r,i,n){this.lhs=t,this.rhs=r,this.key=i,this.collator=n,this.type=rs,this.hasUntypedArgument="value"===t.type.kind||"value"===r.type.kind}static parse(t,r){if(3!==t.length&&4!==t.length)return r.error("Expected two or three arguments.");let i=t[0],o=r.parse(t[1],1,rh);if(!o)return null;if(!iC(i,o.type))return r.concat(1).error(`"${i}" comparisons are not supported for type '${rb(o.type)}'.`);let s=r.parse(t[2],2,rh);if(!s)return null;if(!iC(i,s.type))return r.concat(2).error(`"${i}" comparisons are not supported for type '${rb(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return r.error(`Cannot compare types '${rb(o.type)}' and '${rb(s.type)}'.`);n&&("value"===o.type.kind&&"value"!==s.type.kind?o=new im(s.type,[o],r.key):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new im(o.type,[s],r.key)));let l=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return r.error("Cannot use collator to compare non-string types.");if(!(l=r.parse(t[3],3,rf)))return null}return new a(o,s,r.key,l)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(n&&this.hasUntypedArgument){let r=r8(o),i=r8(s);if(r.kind!==i.kind||"string"!==r.kind&&"number"!==r.kind)throw new rJ(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${r.kind}, ${i.kind}) instead.`,this.key)}if(this.collator&&!n&&this.hasUntypedArgument){let t=r8(o),i=r8(s);if("string"!==t.kind||"string"!==i.kind)return r(a,o,s)}return this.collator?i(a,o,s,this.collator.evaluate(a)):r(a,o,s)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}let iP=iD("==",function(t,r,i){return r===i},iM),iI=iD("!=",function(t,r,i){return r!==i},function(t,r,i,n){return!iM(t,r,i,n)}),ik=iD("<",function(t,r,i){return r<i},function(t,r,i,n){return 0>n.compare(r,i)}),iO=iD(">",function(t,r,i){return r>i},function(t,r,i,n){return n.compare(r,i)>0}),iN=iD("<=",function(t,r,i){return r<=i},function(t,r,i,n){return 0>=n.compare(r,i)}),iL=iD(">=",function(t,r,i){return r>=i},function(t,r,i,n){return n.compare(r,i)>=0});var iR=class t{constructor(t,r,i){this.type=rf,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=r}static parse(r,i){if(2!==r.length)return i.error("Expected one argument.");let n=r[1];if("object"!=typeof n||Array.isArray(n))return i.error("Collator options argument must be an object.");let a=i.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,rs);if(!a)return null;let o=i.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,rs);if(!o)return null;let s=null;return!n.locale||(s=i.parse(n.locale,1,ro))?new t(a,o,s):null}evaluate(t){return new r4(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},iF=class t{constructor(t,r,i,n,a,o){this.type=ro,this.number=t,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=o}static parse(r,i){if(3!==r.length)return i.error("Expected two arguments.");let n=i.parse(r[1],1,ra);if(!n)return null;let a=r[2];if("object"!=typeof a||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let o=null;if(a.locale&&!(o=i.parse(a.locale,1,ro)))return null;let s=null;if(a.currency&&!(s=i.parse(a.currency,1,ro)))return null;let l=null;if(a.unit&&!(l=i.parse(a.unit,1,ro)))return null;if(s&&l)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let u=null;if(a["min-fraction-digits"]&&!(u=i.parse(a["min-fraction-digits"],1,ra)))return null;
56let c=null;return!a["max-fraction-digits"]||(c=i.parse(a["max-fraction-digits"],1,ra))?new t(n,o,s,l,u,c):null}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},iB=class t{constructor(t){this.type=ry,this.input=t}static parse(r,i){if(2!==r.length)return i.error("Expected two arguments.");let n=i.parse(r[1],1,ro);return n?new t(n):i.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),i=r2.fromString(r);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(r)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}},iz=class t{constructor(t,r){this.input=t,this.key=r,this.type=ra}static parse(r,i){if(2!==r.length)return i.error(`Expected 1 argument, but found ${r.length-1} instead.`);let n=i.parse(r[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?i.error(`Expected argument of type string or array, but found ${rb(n.type)} instead.`):new t(n,i.key):null}evaluate(t){let r=this.input.evaluate(t);if("string"==typeof r)return[...r].length;if(Array.isArray(r))return r.length;throw new rJ(`Expected value to be of type string or array, but found ${rb(r8(r))} instead.`,this.key)}eachChild(t){t(this.input)}outputDefined(){return!1}};function ij(t,r){let i=2**r.z;return[360*((t[0]/8192+r.x)/i)-180,360/Math.PI*Math.atan(Math.exp((180-360*((t[1]/8192+r.y)/i))*Math.PI/180))-90]}function iU(t,r){t[0]=Math.min(t[0],r[0]),t[1]=Math.min(t[1],r[1]),t[2]=Math.max(t[2],r[0]),t[3]=Math.max(t[3],r[1])}function iV(t,r){return!(t[0]<=r[0]||t[2]>=r[2]||t[1]<=r[1]||t[3]>=r[3])}function i$(t,r,i,n){var a,o;let s=[r[0]-t[0],r[1]-t[1]];return 0!=(a=[n[0]-i[0],n[1]-i[1]],a[0]*(o=s)[1]-a[1]*o[0])&&!!(iH(t,r,i,n)&&iH(i,n,t,r))}function iG(t,r,i=!1){let n=!1;for(let s of r)for(let r=0;r<s.length-1;r++){var a,o;if(function(t,r,i){let n=t[0]-r[0],a=t[1]-r[1],o=t[0]-i[0],s=t[1]-i[1];return n*s-o*a==0&&n*o<=0&&a*s<=0}(t,s[r],s[r+1]))return i;a=s[r],o=s[r+1],a[1]>t[1]!=o[1]>t[1]&&t[0]<(o[0]-a[0])*(t[1]-a[1])/(o[1]-a[1])+a[0]&&(n=!n)}return n}function iq(t,r){for(let i of t)if(!iG(i,r))return!1;for(let i=0;i<t.length-1;++i)if(function(t,r,i){for(let n of i)for(let i=0;i<n.length-1;++i)if(i$(t,r,n[i],n[i+1]))return!0;return!1}(t[i],t[i+1],r))return!1;return!0}function iH(t,r,i,n){let a=t[0]-i[0],o=t[1]-i[1],s=r[0]-i[0],l=r[1]-i[1],u=n[0]-i[0],c=n[1]-i[1],h=a*c-u*o,f=s*c-u*l;return h>0&&f<0||h<0&&f>0}function iW(t,r,i){let n=[];for(let a=0;a<t.length;a++){let o=[];for(let n=0;n<t[a].length;n++){let s=function(t,r){let i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,a=2**r.z;return[Math.round(i*a*8192),Math.round(n*a*8192)]}(t[a][n],i);iU(r,s),o.push(s)}n.push(o)}return n}function iZ(t,r,i){let n=[];for(let a=0;a<t.length;a++){let o=iW(t[a],r,i);n.push(o)}return n}function iY(t,r,i,n){if(t[0]<i[0]||t[0]>i[2]){let r=.5*n,a=t[0]-i[0]>r?-n:i[0]-t[0]>r?n:0;0===a&&(a=t[0]-i[2]>r?-n:i[2]-t[0]>r?n:0),t[0]+=a}iU(r,t)}function iX(t,r,i,n){let a=2**n.z*8192,o=[8192*n.x,8192*n.y],s=[];for(let n of t)for(let t of n){let n=[t.x+o[0],t.y+o[1]];iY(n,r,i,a),s.push(n)}return s}function iK(t,r,i,n){let a=2**n.z*8192,o=[8192*n.x,8192*n.y],s=[];for(let i of t){let t=[];for(let n of i){let i=[n.x+o[0],n.y+o[1]];iU(r,i),t.push(i)}s.push(t)}if(r[2]-r[0]<=a/2){for(let t of(r[0]=r[1]=1/0,r[2]=r[3]=-1/0,s))for(let n of t)iY(n,r,i,a)}return s}var iQ=class t{constructor(t,r){this.type=rs,this.geojson=t,this.geometries=r}static parse(r,i){if(2!==r.length)return i.error(`'within' expression requires exactly one argument, but found ${r.length-1} instead.`);if(r5(r[1])){let i=r[1];
56if("FeatureCollection"===i.type){let r=[];for(let t of i.features){let{type:i,coordinates:n}=t.geometry;"Polygon"===i&&r.push(n),"MultiPolygon"===i&&r.push(...n)}if(r.length)return new t(i,{type:"MultiPolygon",coordinates:r})}else if("Feature"===i.type){let r=i.geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new t(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new t(i,i)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,r){let i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],a=t.canonicalID();if("Polygon"===r.type){let o=iW(r.coordinates,n,a),s=iX(t.geometry(),i,n,a);if(!iV(i,n))return!1;for(let t of s)if(!iG(t,o))return!1}if("MultiPolygon"===r.type){let o=iZ(r.coordinates,n,a),s=iX(t.geometry(),i,n,a);if(!iV(i,n))return!1;for(let t of s)if(!function(t,r){for(let i of r)if(iG(t,i))return!0;return!1}(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,r){let i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],a=t.canonicalID();if("Polygon"===r.type){let o=iW(r.coordinates,n,a),s=iK(t.geometry(),i,n,a);if(!iV(i,n))return!1;for(let t of s)if(!iq(t,o))return!1}if("MultiPolygon"===r.type){let o=iZ(r.coordinates,n,a),s=iK(t.geometry(),i,n,a);if(!iV(i,n))return!1;for(let t of s)if(!function(t,r){for(let i of r)if(iq(t,i))return!0;return!1}(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},iJ=class{constructor(t=[],r=(t,r)=>t<r?-1:+(t>r)){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:i}=this,n=r[t];for(;t>0;){let a=t-1>>1,o=r[a];if(i(n,o)>=0)break;r[t]=o,t=a}r[t]=n}_down(t){let{data:r,compare:i}=this,n=this.length>>1,a=r[t];for(;t<n;){let n=(t<<1)+1,o=n+1;if(o<this.length&&0>i(r[o],r[n])&&(n=o),i(r[n],a)>=0)break;r[t]=r[n],t=n}r[t]=a}};let i0=Math.PI/180;var i1=class{constructor(t){let r=6378.137*i0*1e3,i=Math.cos(t*i0),n=1/(1-.0066943799901413165*(1-i*i)),a=Math.sqrt(n);this.kx=r*a*i,this.ky=r*a*n*.9933056200098587}distance(t,r){let i=this.wrap(t[0]-r[0])*this.kx,n=(t[1]-r[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(t,r){let i=1/0,n,a,o,s;for(let l=0;l<t.length-1;l++){let u=t[l][0],c=t[l][1],h=this.wrap(t[l+1][0]-u)*this.kx,f=(t[l+1][1]-c)*this.ky,d=0;(0!==h||0!==f)&&((d=(this.wrap(r[0]-u)*this.kx*h+(r[1]-c)*this.ky*f)/(h*h+f*f))>1?(u=t[l+1][0],c=t[l+1][1]):d>0&&(u+=h/this.kx*d,c+=f/this.ky*d));let p=(h=this.wrap(r[0]-u)*this.kx)*h+(f=(r[1]-c)*this.ky)*f;p<i&&(i=p,n=u,a=c,o=l,s=d)}return{point:[n,a],index:o,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function i2(t,r){return r[0]-t[0]}function i3(t){return t[1]-t[0]+1}function i4(t,r){return t[1]>=t[0]&&t[1]<r}function i6(t,r){if(t[0]>t[1])return[null,null];let i=i3(t);if(r){if(2===i)return[t,null];let r=Math.floor(i/2);return[[t[0],t[0]+r],[t[0]+r,t[1]]]}if(1===i)return[t,null];let n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function i5(t,r){if(!i4(r,t.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let n=r[0];n<=r[1];++n)iU(i,t[n]);return i}function i8(t){let r=[1/0,1/0,-1/0,-1/0];for(let i of t)for(let t of i)iU(r,t);return r}function i7(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function i9(t,r,i){if(!i7(t)||!i7(r))return NaN;let n=0,a=0;return t[2]<r[0]&&(n=r[0]-t[2]),t[0]>r[2]&&(n=t[0]-r[2]),t[1]>r[3]&&(a=t[1]-r[3]),t[3]<r[1]&&(a=r[1]-t[3]),i.distance([0,0],[n,a])}function ne(t,r,i){let n=i.pointOnLine(r,t);return i.distance(t,n.point)}function nt(t,r,i,n,a){return Math.min(Math.min(ne(t,[i,n],a),ne(r,[i,n],a)),Math.min(ne(i,[t,r],a),ne(n,[t,r],a)))}function nr(t,r){for(let i of t)for(let t of i)if(iG(t,r,!0))return!0;return!1}function ni(t,r,i,n,a,o){if(!o)return;let s=i9(i5(n,o),a,i);s<r&&t.push([s,o,[0,0]])}
56function nn(t,r,i,n,a,o,s){if(!o||!s)return;let l=i9(i5(n,o),i5(a,s),i);l<r&&t.push([l,o,s])}function na(t,r,i,n,a=1/0){let o=Math.min(n.distance(t[0],i[0][0]),a);if(0===o)return o;let s=new iJ([[0,[0,t.length-1],[0,0]]],i2),l=i8(i);for(;s.length>0;){let a=s.pop();if(a[0]>=o)continue;let u=a[1],c=r?50:100;if(i3(u)<=c){if(!i4(u,t.length))return NaN;if(r){let r=function(t,r,i,n){if(!i4(r,t.length))return NaN;for(let n=r[0];n<=r[1];++n)if(iG(t[n],i,!0))return 0;let a=1/0;for(let o=r[0];o<r[1];++o){let r=t[o],s=t[o+1];for(let t of i)for(let i=0,o=t.length,l=o-1;i<o;l=i++){let o=t[l],u=t[i];if(i$(r,s,o,u))return 0;a=Math.min(a,nt(r,s,o,u,n))}}return a}(t,u,i,n);if(isNaN(r)||0===r)return r;o=Math.min(o,r)}else for(let r=u[0];r<=u[1];++r)if(0===(o=Math.min(o,function(t,r,i){if(iG(t,r,!0))return 0;let n=1/0;for(let a of r){let r=a[0],o=a[a.length-1];if(r!==o&&0===(n=Math.min(n,ne(t,[o,r],i))))break;let s=i.pointOnLine(a,t);if(0===(n=Math.min(n,i.distance(t,s.point))))break}return n}(t[r],i,n))))return 0}else{let i=i6(u,r);ni(s,o,n,t,l,i[0]),ni(s,o,n,t,l,i[1])}}return o}function no(t,r,i,n,a,o=1/0){let s=Math.min(o,a.distance(t[0],i[0]));if(0===s)return s;let l=new iJ([[0,[0,t.length-1],[0,i.length-1]]],i2);for(;l.length>0;){let o=l.pop();if(o[0]>=s)continue;let u=o[1],c=o[2],h=r?50:100,f=n?50:100;if(i3(u)<=h&&i3(c)<=f){if(!i4(u,t.length)&&i4(c,i.length))return NaN;if(r&&n)s=Math.min(s,function(t,r,i,n,a){if(!(i4(r,t.length)&&i4(n,i.length)))return 1/0;let o=1/0;for(let s=r[0];s<r[1];++s){let r=t[s],l=t[s+1];for(let t=n[0];t<n[1];++t){let n=i[t],s=i[t+1];if(i$(r,l,n,s))return 0;o=Math.min(o,nt(r,l,n,s,a))}}return o}(t,u,i,c,a));else if(r&&!n){let r=t.slice(u[0],u[1]+1);for(let t=c[0];t<=c[1];++t)if(0===(s=Math.min(s,ne(i[t],r,a))))return s}else if(!r&&n){let r=i.slice(c[0],c[1]+1);for(let i=u[0];i<=u[1];++i)if(0===(s=Math.min(s,ne(t[i],r,a))))return s}else s=Math.min(s,function(t,r,i,n,a){if(!(i4(r,t.length)&&i4(n,i.length)))return NaN;let o=1/0;for(let s=r[0];s<=r[1];++s)for(let r=n[0];r<=n[1];++r)if(0===(o=Math.min(o,a.distance(t[s],i[r]))))return o;return o}(t,u,i,c,a))}else{let o=i6(u,r),h=i6(c,n);nn(l,s,a,t,i,o[0],h[0]),nn(l,s,a,t,i,o[0],h[1]),nn(l,s,a,t,i,o[1],h[0]),nn(l,s,a,t,i,o[1],h[1])}}return s}function ns(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}var nl=class t{constructor(t,r){this.type=ra,this.geojson=t,this.geometries=r}static parse(r,i){if(2!==r.length)return i.error(`'distance' expression requires exactly one argument, but found ${r.length-1} instead.`);if(r5(r[1])){let i=r[1];if("FeatureCollection"===i.type)return new t(i,i.features.map(t=>ns(t.geometry)).flat());if("Feature"===i.type)return new t(i,ns(i.geometry));if("type"in i&&"coordinates"in i)return new t(i,ns(i))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,r){let i=t.geometry(),n=i.flat().map(r=>ij([r.x,r.y],t.canonical));if(0===i.length)return NaN;let a=new i1(n[0][1]),o=1/0;for(let t of r){switch(t.type){case"Point":o=Math.min(o,no(n,!1,[t.coordinates],!1,a,o));break;case"LineString":o=Math.min(o,no(n,!1,t.coordinates,!0,a,o));break;case"Polygon":o=Math.min(o,na(n,!1,t.coordinates,a,o))}if(0===o)break}return o}(t,this.geometries);if("LineString"===t.geometryType())return function(t,r){let i=t.geometry(),n=i.flat().map(r=>ij([r.x,r.y],t.canonical));if(0===i.length)return NaN;let a=new i1(n[0][1]),o=1/0;for(let t of r){switch(t.type){case"Point":o=Math.min(o,no(n,!0,[t.coordinates],!1,a,o));break;case"LineString":o=Math.min(o,no(n,!0,t.coordinates,!0,a,o));break;case"Polygon":o=Math.min(o,na(n,!0,t.coordinates,a,o))}if(0===o)break}return o}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,r){let i=t.geometry();if(0===i.length||0===i[0].length)return NaN;let n=ih(i,0).map(r=>r.map(r=>r.map(r=>ij([r.x,r.y],t.canonical)))),a=new i1(n[0][0][0][1]),o=1/0;for(let t of r)for(let r of n){switch(t.type){case"Point":o=Math.min(o,na([t.coordinates],!1,r,a,o));break;case"LineString":o=Math.min(o,na(t.coordinates,!0,r,a,o));break;case"Polygon":o=Math.min(o,function(t,r,i,n=1/0){let a=i8(t),o=i8(r);if(n!==1/0&&i9(a,o,i)>=n)return n;if(iV(a,o)){if(nr(t,r))return 0}else if(nr(r,t))return 0;let s=1/0;for(let n of t)for(let t=0,a=n.length,o=a-1;t<a;o=t++){let a=n[o],l=n[t];for(let t of r)for(let r=0,n=t.length,o=n-1;r<n;o=r++){let n=t[o],u=t[r];if(i$(a,l,n,u))return 0;s=Math.min(s,nt(a,l,n,u,i))}}return s}(r,t.coordinates,a,o))}if(0===o)return o}return o}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},nu=class t{constructor(t){let r=null;
56for(let i of t)if(r){if(r===i.type)continue;r=rh;break}else r=i.type;this.type=r_(r??rh,t.length),this.arr=t}static parse(r,i){if(2!==r.length)return i.error(`'semiliteral' expression requires exactly one argument, but found ${r.length-1} instead.`);if(!r5(r[1]))return i.error(`invalid value of type "${typeof r[1]}"`);let n=r[1],a=r8(n);if("array"===a.kind){let r=i.concat(1),a=[];for(let t=0;t<n.length;t++){let i=r.parse(n[t],t,rh);if(!i)return null;a.push(i)}return new t(a)}return new r9(a,n)}evaluate(t){return this.arr.map(r=>r.evaluate(t))}eachChild(t){this.arr.forEach(t)}outputDefined(){return this.arr.every(t=>t.outputDefined())}},nc=class t{constructor(t){this.key=t,this.type=rh}static parse(r,i){if(2!==r.length)return i.error(`Expected 1 argument, but found ${r.length-1} instead.`);let n=r[1];return null==n?i.error("Global state property must be defined."):"string"==typeof n?new t(n):i.error(`Global state property must be string, but found ${typeof r[1]} instead.`)}evaluate(t){let r=t.globals?.globalState;return r&&0!==Object.keys(r).length?rz(r,this.key)??null:null}eachChild(){}outputDefined(){return!1}};let nh={"==":iP,"!=":iI,">":iO,"<":ik,">=":iL,"<=":iN,array:im,at:ib,boolean:im,case:iT,coalesce:iS,collator:iR,format:iu,image:iB,in:ix,"index-of":iw,interpolate:io,"interpolate-hcl":io,"interpolate-lab":io,length:iz,let:iv,literal:r9,match:iE,number:im,"number-format":iF,object:im,semiliteral:nu,slice:iA,step:ia,string:im,"to-boolean":iy,"to-color":iy,"to-number":iy,"to-string":iy,var:i_,within:iQ,distance:nl,"global-state":nc};var nf=class extends Error{constructor(t,r){super(r),this.message=r,this.key=t}},nd=class t{constructor(t,r=[]){for(let[i,n]of(this.parent=t,this.bindings={},r))this.bindings[i]=n}concat(r){return new t(this,r)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}},np=class t{constructor(t,r,i=[],n,a=new nd,o=[]){this.registry=t,this.path=i,this.key=i.map(t=>`[${t}]`).join(""),this.scope=a,this.errors=o,this.expectedType=n,this._isConstant=r}parse(t,r,i,n,a={}){return null==r?this._parse(t,a):this.concat(r,i,n)._parse(t,a)}_parse(t,r){(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t)&&(t=["literal",t]);let i=this.key;function n(t,r,n){return"assert"===n?new im(r,[t],i):"coerce"===n?new iy(r,[t],i):t}if(Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let i=t[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let a=this.registry[i];if(a){let i=a.parse(t,this);if(!i)return null;if(this.expectedType){let t=this.expectedType,a=i.type;if(("string"===t.kind||"number"===t.kind||"boolean"===t.kind||"object"===t.kind||"array"===t.kind)&&"value"===a.kind)i=n(i,t,r.typeAnnotation||"assert");else if("projectionDefinition"===t.kind&&["string","array","value"].includes(a.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(a.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(a.kind)||"colorArray"===t.kind&&["value","string","array"].includes(a.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(a.kind))i=n(i,t,r.typeAnnotation||"coerce");else if(this.checkSubtype(t,a))return null}if(!(i instanceof r9)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){let t=new ir;try{i=new r9(i.type,i.evaluate(t))}catch(t){return this.error(t.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(r,i,n){let a="number"==typeof r?this.path.concat(r):this.path,o=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,a,i||null,o,this.errors)}error(t,...r){let i=`${this.key}${r.map(t=>`[${t}]`).join("")}`;this.errors.push(new nf(i,t))}checkSubtype(t,r){let i=rw(t,r);return i&&this.error(i),i}},nm=class t{constructor(t,r,i,n,a){this.name=t,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(t){return this._evaluate(t,this.args,this.key)}
56eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(r,i){let n=r[0],a=t.definitions[n];if(!a)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,l=s.filter(([t])=>!Array.isArray(t)||t.length===r.length-1),u=null;for(let[a,s]of l){u=new np(i.registry,nb,i.path,null,i.scope);let l=[],c=!1;for(let t=1;t<r.length;t++){let i=r[t],n=Array.isArray(a)?a[t-1]:a.type,o=u.parse(i,1+l.length,n);if(!o){c=!0;break}l.push(o)}if(!c){if(Array.isArray(a)&&a.length!==l.length){u.error(`Expected ${a.length} arguments, but found ${l.length} instead.`);continue}for(let t=0;t<l.length;t++){let r=Array.isArray(a)?a[t]:a.type,i=l[t];u.concat(t+1).checkSubtype(r,i.type)}if(0===u.errors.length)return new t(n,o,s,l,i.key)}}if(1===l.length)i.errors.push(...u.errors);else{let t=(l.length?l:s).map(([t])=>{var r;return Array.isArray(r=t)?`(${r.map(rb).join(", ")})`:`(${rb(r.type)}...)`}).join(" | "),n=[];for(let t=1;t<r.length;t++){let a=i.parse(r[t],1+n.length);if(!a)return null;n.push(rb(a.type))}i.error(`Expected arguments of type ${t}, but found (${n.join(", ")}) instead.`)}return null}static register(r,i){for(let n in t.definitions=i,i)r[n]=t}};function ng(t,[r,i,n,a],o){r=r.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);let s=a?a.evaluate(t):1,l=r6(r,i,n,s);if(l)throw new rJ(l,o);return new rH(r/255,i/255,n/255,s,!1)}function ny(t,r){return t in r&&void 0!==r[t]}function nv(t,r){let i=r[t];return void 0===i?null:i}function n_(t){return{type:t}}
vendor: 4,970 bytes, line 56
56function nb(t){if(t instanceof i_)return nb(t.boundExpression);if(t instanceof nm&&"error"===t.name||t instanceof iR||t instanceof iQ||t instanceof nl||t instanceof nc)return!1;let r=t instanceof iy||t instanceof im,i=!0;return t.eachChild(t=>{i&&=r?nb(t):t instanceof r9}),!!i&&nx(t)&&nE(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function nx(t){if(t instanceof nm&&("get"===t.name&&1===t.args.length||"feature-state"===t.name||"has"===t.name&&1===t.args.length||"properties"===t.name||"geometry-type"===t.name||"id"===t.name||/^filter-/.test(t.name))||t instanceof iQ||t instanceof nl)return!1;let r=!0;return t.eachChild(t=>{r&&!nx(t)&&(r=!1)}),r}function nw(t){if(t instanceof nm&&"feature-state"===t.name)return!1;let r=!0;return t.eachChild(t=>{r&&!nw(t)&&(r=!1)}),r}function nE(t,r){if(t instanceof nm&&r.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(t=>{i&&!nE(t,r)&&(i=!1)}),i}function nT(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function nA(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function nS(t){return!!t.expression&&t.expression.interpolated}nm.register(nh,{error:[{kind:"error"},[ro],(t,[r],i)=>{throw new rJ(r.evaluate(t),i)}],typeof:[ro,[rh],(t,[r])=>rb(r8(r.evaluate(t)))],"to-rgba":[r_(ra,4),[rl],(t,[r])=>{let[i,n,a,o]=r.evaluate(t).rgb;return[255*i,255*n,255*a,o]}],rgb:[rl,[ra,ra,ra],ng],rgba:[rl,[ra,ra,ra,ra],ng],has:{type:rs,overloads:[[[ro],(t,[r])=>ny(r.evaluate(t),t.properties())],[[ro,rc],(t,[r,i])=>ny(r.evaluate(t),i.evaluate(t))]]},get:{type:rh,overloads:[[[ro],(t,[r])=>nv(r.evaluate(t),t.properties())],[[ro,rc],(t,[r,i])=>nv(r.evaluate(t),i.evaluate(t))]]},"feature-state":[rh,[ro],(t,[r])=>nv(r.evaluate(t),t.featureState||{})],properties:[rc,[],t=>t.properties()],"geometry-type":[ro,[],t=>t.geometryType()],id:[rh,[],t=>t.id()],zoom:[ra,[],t=>t.globals.zoom],"heatmap-density":[ra,[],t=>t.globals.heatmapDensity||0],elevation:[ra,[],t=>t.globals.elevation||0],"line-progress":[ra,[],t=>t.globals.lineProgress||0],accumulated:[rh,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[ra,n_(ra),(t,r)=>{let i=0;for(let n of r)i+=n.evaluate(t);return i}],"*":[ra,n_(ra),(t,r)=>{let i=1;for(let n of r)i*=n.evaluate(t);return i}],"-":{type:ra,overloads:[[[ra,ra],(t,[r,i])=>r.evaluate(t)-i.evaluate(t)],[[ra],(t,[r])=>-r.evaluate(t)]]},"/":[ra,[ra,ra],(t,[r,i])=>r.evaluate(t)/i.evaluate(t)],"%":[ra,[ra,ra],(t,[r,i])=>r.evaluate(t)%i.evaluate(t)],ln2:[ra,[],()=>Math.LN2],pi:[ra,[],()=>Math.PI],e:[ra,[],()=>Math.E],"^":[ra,[ra,ra],(t,[r,i])=>r.evaluate(t)**i.evaluate(t)],sqrt:[ra,[ra],(t,[r])=>Math.sqrt(r.evaluate(t))],log10:[ra,[ra],(t,[r])=>Math.log(r.evaluate(t))/Math.LN10],ln:[ra,[ra],(t,[r])=>Math.log(r.evaluate(t))],log2:[ra,[ra],(t,[r])=>Math.log(r.evaluate(t))/Math.LN2],sin:[ra,[ra],(t,[r])=>Math.sin(r.evaluate(t))],cos:[ra,[ra],(t,[r])=>Math.cos(r.evaluate(t))],tan:[ra,[ra],(t,[r])=>Math.tan(r.evaluate(t))],asin:[ra,[ra],(t,[r])=>Math.asin(r.evaluate(t))],acos:[ra,[ra],(t,[r])=>Math.acos(r.evaluate(t))],atan:[ra,[ra],(t,[r])=>Math.atan(r.evaluate(t))],min:[ra,n_(ra),(t,r)=>Math.min(...r.map(r=>r.evaluate(t)))],max:[ra,n_(ra),(t,r)=>Math.max(...r.map(r=>r.evaluate(t)))],abs:[ra,[ra],(t,[r])=>Math.abs(r.evaluate(t))],round:[ra,[ra],(t,[r])=>{let i=r.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[ra,[ra],(t,[r])=>Math.floor(r.evaluate(t))],ceil:[ra,[ra],(t,[r])=>Math.ceil(r.evaluate(t))],"filter-==":[rs,[ro,rh],(t,[r,i])=>t.properties()[r.value]===i.value],"filter-id-==":[rs,[rh],(t,[r])=>t.id()===r.value],"filter-type-==":[rs,[ro],(t,[r])=>t.geometryType()===r.value],"filter-<":[rs,[ro,rh],(t,[r,i])=>{let n=t.properties()[r.value],a=i.value;return typeof n==typeof a&&n<a}],"filter-id-<":[rs,[rh],(t,[r])=>{let i=t.id(),n=r.value;return typeof i==typeof n&&i<n}],"filter->":[rs,[ro,rh],(t,[r,i])=>{let n=t.properties()[r.value],a=i.value;return typeof n==typeof a&&n>a}],"filter-id->":[rs,[rh],(t,[r])=>{let i=t.id(),n=r.value;return typeof i==typeof n&&i>n}],"filter-<=":[rs,[ro,rh],(t,[r,i])=>{let n=t.properties()[r.value],a=i.value;return typeof n==typeof a&&n<=a}],"filter-id-<=":[rs,[rh],(t,[r])=>{let i=t.id(),n=r.value;return typeof i==typeof n&&i<=n}],"filter->=":[rs,[ro,rh],(t,[r,i])=>{let n=t.properties()[r.value],a=i.value;return typeof n==typeof a&&n>=a}],"filter-id->=":[rs,[rh],(t,[r])=>{let i=t.id(),n=r.value;return typeof i==typeof n&&i>=n}],"filter-has":[rs,[rh],(t,[r])=>{let i=r.value,n=t.properties();return i in n&&void 0!==n[i]}],"filter-has-id":[rs,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[rs,[r_(ro)],(t,[r])=>r.value.indexOf(t.geometryType())>=0],"filter-id-in":[rs,[r_(rh)],(t,[r])=>r.value.indexOf(t.id())>=0],"filter-in-small":[rs,[ro,r_(rh)],(t,[r,i])=>i.value.indexOf(t.properties()[r.value])>=0],"filter-in-large":[rs,[ro,r_(rh)],(t,[r,i])=>(function(t,r,i,n){for(;i<=n;){let a=i+n>>1;
56if(r[a]===t)return!0;r[a]>t?n=a-1:i=a+1}return!1})(t.properties()[r.value],i.value,0,i.value.length-1)],all:{type:rs,overloads:[[[rs,rs],(t,[r,i])=>r.evaluate(t)&&i.evaluate(t)],[n_(rs),(t,r)=>{for(let i of r)if(!i.evaluate(t))return!1;return!0}]]},any:{type:rs,overloads:[[[rs,rs],(t,[r,i])=>r.evaluate(t)||i.evaluate(t)],[n_(rs),(t,r)=>{for(let i of r)if(i.evaluate(t))return!0;return!1}]]},"!":[rs,[rs],(t,[r])=>!r.evaluate(t)],"is-supported-script":[rs,[ro],(t,[r])=>{let i=t.globals&&t.globals.isSupportedScript;return!i||i(r.evaluate(t))}],upcase:[ro,[ro],(t,[r])=>r.evaluate(t).toUpperCase()],downcase:[ro,[ro],(t,[r])=>r.evaluate(t).toLowerCase()],concat:[ro,n_(rh),(t,r)=>r.map(r=>r7(r.evaluate(t))).join("")],split:[r_(ro),[ro,ro],(t,[r,i])=>r.evaluate(t).split(i.evaluate(t))],join:[ro,[r_(ro),ro],(t,[r,i])=>r.evaluate(t).join(i.evaluate(t))],"resolved-locale":[ro,[rf],(t,[r])=>r.evaluate(t).resolvedLocale()]});let nC=/^(.*)-transition$/;function nM(t,...r){for(let i of r)for(let r in i)t[r]=i[r];return t}function nD(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function nP(t){return"object"==typeof t&&!!t&&!Array.isArray(t)&&r8(t)===rc}function nI(t){return t}function nk(t,r,i){return void 0!==t?t:void 0!==r?r:void 0!==i?i:void 0}function nO(t,r,i,n,a){return nk(typeof i===a?n[i]:void 0,t.default,r.default)}function nN(t,r,i){if("number"!==nD(i))return nk(t.default,r.default);let n=t.stops.length;if(1===n||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];let a=ii(t.stops.map(t=>t[0]),i,"");return t.stops[a][1]}function nL(t,r,i){var n,a,o;let s,l,u=void 0===t.base?1:t.base;if("number"!==nD(i))return nk(t.default,r.default);let c=t.stops.length;if(1===c||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[c-1][0])return t.stops[c-1][1];let h=ii(t.stops.map(t=>t[0]),i,""),f=(n=i,a=u,o=t.stops[h][0],s=t.stops[h+1][0]-o,l=n-o,0===s?0:1===a?l/s:(a**l-1)/(a**s-1)),d=t.stops[h][1],p=t.stops[h+1][1],m=il[r.type]||nI;return"function"==typeof d.evaluate?{evaluate(...r){let i=d.evaluate.apply(void 0,r),n=p.evaluate.apply(void 0,r);if(void 0!==i&&void 0!==n)return m(i,n,f,t.colorSpace)}}:m(d,p,f,t.colorSpace)}function nR(t,r,i){switch(r.type){case"color":i=rH.parse(i);break;case"formatted":i=rY.fromString(i.toString());break;case"resolvedImage":i=r2.fromString(i.toString());break;case"padding":i=rX.parse(i);break;case"colorArray":i=rQ.parse(i);break;case"numberArray":i=rK.parse(i);break;default:nD(i)===r.type||"enum"===r.type&&r.values[i]||(i=void 0)}return nk(i,t.default,r.default)}function nF(t){return{result:"success",value:t}}function nB(t){return{result:"error",value:t}}var nz=class{constructor(t,r,i,n){this.expression=t,this._warningHistory={},this._evaluator=new ir,this._defaultValue=i?nY(i):null,this._enumValues=i&&"enum"===i.type?i.values:null,this._globalState=n,this._rootKey=r}evaluateWithoutErrorHandling(t,r,i,n,a,o){return this._globalState&&(t=nX(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,r,i,n,a,o){this._globalState&&(t=nX(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=o||null;try{let t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new rJ(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`,"");return t}catch(i){let t=i instanceof rJ?i.path:"",r=`${t}|${i.message}`;return this._warningHistory[r]||(this._warningHistory[r]=!0,"u">typeof console&&console.warn(nj(this._rootKey,t,i.message,this._defaultValue))),this._defaultValue}}};function nj(t,r,i,n){return`${t}${r}: ${i}${null==n?"":` Falling back to ${String(n)}.`}`}function nU(t){if(!t)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".')}function nV(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in nh}function n$(t,r,i,n){var a;let o;nU(r);let s=new np(nh,nb,[],i?(a=i,o={color:rl,string:ro,number:ra,enum:ro,boolean:rs,formatted:rd,padding:rp,numberArray:rg,colorArray:rm,projectionDefinition:ru,resolvedImage:ry,variableAnchorOffsetCollection:rv},"array"===a.type?r_(o[a.value]||rh,a.length):o[a.type]):void 0),l=s.parse(t,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return l?nF(new nz(l,r,i,n)):nB(s.errors)}var nG=class{constructor(t,r,i){this.kind=t,this._styleExpression=r,this.isStateDependent="constant"!==t&&!nw(r.expression),this.globalStateRefs=nZ(r.expression),this._globalState=i}evaluateWithoutErrorHandling(t,r,i,n,a,o){return this._globalState&&(t=nX(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,r,i,n,a,o)}evaluate(t,r,i,n,a,o){return this._globalState&&(t=nX(t,this._globalState)),this._styleExpression.evaluate(t,r,i,n,a,o)}},nq=class{constructor(t,r,i,n,a){this.kind=t,this.zoomStops=i,this._styleExpression=r,this.isStateDependent="camera"!==t&&!nw(r.expression),this.globalStateRefs=nZ(r.expression),this.interpolationType=n,this._globalState=a}evaluateWithoutErrorHandling(t,r,i,n,a,o){return this._globalState&&(t=nX(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,r,i,n,a,o)}evaluate(t,r,i,n,a,o){return this._globalState&&(t=nX(t,this._globalState)),this._styleExpression.evaluate(t,r,i,n,a,o)}interpolationFactor(t,r,i){return this.interpolationType?io.interpolationFactor(this.interpolationType,t,r,i
vendor: 13,655 bytes, line 56
56):0}};function nH(t,r,i,n){let a=n$(t,r,i,n);if("error"===a.result)return a;let o=a.value.expression,s=nx(o);if(!s&&!nT(i))return nB([new nf("","data expressions not supported")]);let l=nE(o,["zoom"]);if(!l&&!nA(i))return nB([new nf("","zoom expressions not supported")]);let u=function t(r){let i=null;if(r instanceof iv)i=t(r.result);else if(r instanceof iS){for(let n of r.args)if(i=t(n))break}else(r instanceof ia||r instanceof io)&&r.input instanceof nm&&"zoom"===r.input.name&&(i=r);return i instanceof nf||r.eachChild(r=>{let n=t(r);n instanceof nf?i=n:!i&&n?i=new nf("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&n&&i!==n&&(i=new nf("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}(o);if(!u&&!l)return nB([new nf("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(u instanceof nf)return nB([u]);if(u instanceof io&&!nS(i))return nB([new nf("",'"interpolate" expressions cannot be used with this property')]);if(!u)return nF(s?new nG("constant",a.value,n):new nG("source",a.value,n));let c=u instanceof io?u.interpolation:void 0;return nF(s?new nq("camera",a.value,u.labels,c,n):new nq("composite",a.value,u.labels,c,n))}var nW=class t{constructor(t,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,nU(r),this._parameters=t,this._specification=i,this._rootKey=r,this._defaultValue=nY(i),this._warningHistory={};let n=function t(r,i){var n;let a=r.stops&&"object"==typeof r.stops[0][0],o=a||void 0!==r.property,s=r.type||(nS(i)?"exponential":"interval"),l=function(t){switch(t.type){case"color":return rH.parse;case"padding":return rX.parse;case"numberArray":return rK.parse;case"colorArray":return rQ.parse;default:return null}}(i);if(l&&((r=nM({},r)).stops&&(r.stops=r.stops.map(t=>[t[0],l(t[1])])),r.default?r.default=l(r.default):r.default=l(i.default)),r.colorSpace&&"rgb"!==(n=r.colorSpace)&&"hcl"!==n&&"lab"!==n)throw Error(`Unknown color space: "${r.colorSpace}"`);let u=function(t){switch(t){case"exponential":return nL;case"interval":return nN;case"categorical":return nO;case"identity":return nR;default:throw Error(`Unknown function type "${t}"`)}}(s),c,h;if("categorical"===s){for(let t of(c=Object.create(null),r.stops))c[t[0]]=t[1];h=typeof r.stops[0][0]}if(a){let n={},a=[];for(let t=0;t<r.stops.length;t++){let i=r.stops[t],o=i[0].zoom;void 0===n[o]&&(n[o]={zoom:o,type:r.type,property:r.property,default:r.default,stops:[]},a.push(o)),n[o].stops.push([i[0].value,i[1]])}let o=[];for(let r of a)o.push([n[r].zoom,t(n[r],i)]);let s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:io.interpolationFactor.bind(void 0,s),zoomStops:o.map(t=>t[0]),evaluate:({zoom:t},n)=>nL({stops:o,base:r.base},i,t).evaluate(t,n)}}if(a||!o){let t="exponential"===s?{name:"exponential",base:void 0===r.base?1:r.base}:null;return{kind:"camera",interpolationType:t,interpolationFactor:io.interpolationFactor.bind(void 0,t),zoomStops:r.stops.map(t=>t[0]),evaluate:({zoom:t})=>u(r,i,t,c,h)}}return{kind:"source",evaluate(t,n){let a=n&&n.properties?n.properties[r.property]:void 0;return void 0===a?nk(r.default,i.default):u(r,i,a,c,h)}}}(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(t,r){try{return this._innerEvaluate(t,r)}catch(i){let t=i instanceof Error?i.message:String(i),r=`|${t}`;return this._warningHistory[r]||(this._warningHistory[r]=!0,"u">typeof console&&console.warn(nj(this._rootKey,"",t,this._defaultValue))),this._defaultValue}}static deserialize(r){return new t(r._parameters,r._rootKey,r._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification,_rootKey:t._rootKey}}};function nZ(t,r=new Set){return t instanceof nc&&r.add(t.key),t.eachChild(t=>{nZ(t,r)}),r}function nY(t){if("color"===t.type&&nP(t.default))return new rH(0,0,0,0);switch(t.type){case"color":return rH.parse(t.default)||null;case"padding":return rX.parse(t.default)||null;case"numberArray":return rK.parse(t.default)||null;case"colorArray":return rQ.parse(t.default)||null;case"variableAnchorOffsetCollection":return r1.parse(t.default)||null;case"projectionDefinition":return r3.parse(t.default)||null;default:return void 0===t.default?null:t.default}}function nX(t,r){let{zoom:i,heatmapDensity:n,elevation:a,lineProgress:o,isSupportedScript:s,accumulated:l}=t??{};return{zoom:i,heatmapDensity:n,elevation:a,lineProgress:o,isSupportedScript:s,accumulated:l,globalState:r}}function nK(t){return"legacy"!==function t(r){if("boolean"==typeof r)return"neutral";if(!Array.isArray(r)||0===r.length)return"legacy";switch(r[0]){case"has":return r.length<2||"$id"===r[1]||"$type"===r[1]?"legacy":2===r.length?"neutral":"expression";case"in":return r.length>=3&&("string"!=typeof r[1]||Array.isArray(r[2]))?"expression":"legacy";case"!in":case"!has":case"none":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==r.length||Array.isArray(r[1])||Array.isArray(r[2])?"expression":"legacy";case"any":case"all":var i=r.slice(1);let n=!1;for(let r of i){let i=t(r);if("expression"===i)return"expression";"legacy"===i&&(n=!0)}return n?"legacy":"neutral";default:return"expression"}}(t)}function nQ(t){return"$type"===t?["geometry-type"]:"$id"===t?["id"]:["get",t]}function nJ(t){if(("<"===t[0]||"<="===t[0]||">"===t[0]||">="===t[0])&&"$type"===t[1])return`"$type" cannot be use with operator "${t[0]}"`;let r=function(t){switch(t[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return 3!==t.length||"string"!=typeof t[1]?null:[t[0],nQ(t[1]),t[2]];case"in":case"!in":{if(t.length<2||"string"!=typeof t[1])return null;let r=["in",nQ(t[1]),["literal",t.slice(2)]];return"!in"===t[0]?["!",r]:r}case"has":case"!has":{if(2!==t.length||"string"!=typeof t[1]||"$type"===t[1]||"$id"===t[1])return null;let r=["has",t[1]];return"!has"===t[0]?["!",r]:r}default:return null}}(t);return r?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(r)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function n0(t,r,i){let n=i[t];return Array.isArray(n)?nK(n)?n1(n,r.concat(t)):{path:r.concat(t),legacyFilter:n}:null}function n1(t,r=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case"all":case"any":case"none":for(let i=1;i<t.length;i++){let n=n0(i,r,t);if(n)return n}break;case"!":{let i=n0(1,r,t);if(i)return i;break}case"case":for(let i=1;i<t.length-1;i+=2){let n=n0(i,r,t);if(n)return n}}return null}let n2={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function n3(t,r,i){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};nK(t)?function(t,r){let i=n1(t);if(!i||typeof console>"u")return;let n=i.path.map(t=>`[${t}]`).join("");console.warn(`${r}${n}: ${nJ(i.legacyFilter)}`)}(t,r):t=function t(r){if(!r)return!0;let i=r[0];return r.length<=1?"any"!==i:"=="===i?n6(r[1],r[2],"=="):"!="===i?n7(n6(r[1],r[2],"==")):"<"===i||">"===i||"<="===i||">="===i?n6(r[1],r[2],i):"any"===i?["any"].concat(r.slice(1).map(t)):"all"===i?["all"].concat(r.slice(1).map(t)):"none"===i?["all"].concat(r.slice(1).map(t).map(n7)):"in"===i?n5(r[1],r.slice(2)):"!in"===i?n7(n5(r[1],r.slice(2))):"has"===i?n8(r[1]):"!has"!==i||n7(n8(r[1]))}(t);let n=n$(t,r,n2,i);if("error"===n.result)throw Error(n.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,r,i)=>n.value.evaluate(t,r,{},i),needGeometry:function t(r){if(!Array.isArray(r))return!1;if("within"===r[0]||"distance"===r[0])return!0;for(let i=1;i<r.length;i++)if(t(r[i]))return!0;return!1}(t),getGlobalStateRefs:()=>nZ(n.value.expression)}}function n4(t,r){return t<r?-1:+(t>r)}function n6(t,r,i){switch(t){case"$type":return[`filter-type-${i}`,r];case"$id":return[`filter-id-${i}`,r];default:return[`filter-${i}`,t,r]}}function n5(t,r){if(0===r.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(t=>typeof t!=typeof r[0])?["filter-in-large",t,["literal",r.sort(n4)]]:["filter-in-small",t,["literal",r]]}}function n8(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function n7(t){return["!",t]}function n9(t){let r=t.key,i=t.value;return i?[new ri(r,i,"constants have been deprecated as of v8")]:[]}function ae(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function at(t){if(Array.isArray(t))return t.map(at);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let r={};for(let i in t)r[i]=at(t[i]);return r}return ae(t)}function ar(t){let r=t.key,i=t.value,n=t.valueSpec||{},a=t.objectElementValidators||{},o=t.style,s=t.styleSpec,l=t.validateSpec,u=[],c=nD(i);if("object"!==c)return[new ri(r,i,`object expected, ${c} found`)];for(let t in i){let c=t.split(".")[0],h=rz(n,c)||n["*"],f;if(rz(a,c))f=a[c];else if(rz(n,c)){if(void 0===i[t])continue;f=l}else if(a["*"])f=a["*"];else if(n["*"])f=l;else{u.push(new ri(r,i[t],`unknown property "${t}"`));continue}u=u.concat(f({key:(r&&`${r}.`)+t,value:i[t],valueSpec:h,style:o,styleSpec:s,object:i,objectKey:t,validateSpec:l},i))}for(let t in n)a[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&u.push(new ri(r,i,`missing required property "${t}"`));return u}function ai(t){let r=t.value,i=t.valueSpec,n=t.validateSpec,a=t.style,o=t.styleSpec,s=t.key,l=t.arrayElementValidator||n;if("array"!==nD(r))return[new ri(s,r,`array expected, ${nD(r)} found`)];if(i.length&&r.length!==i.length)return[new ri(s,r,`array length ${i.length} expected, length ${r.length} found`)];let u={type:i.value,values:i.values};o.$version<7&&(u.function=i.function),"object"===nD(i.value)&&(u=i.value);let c=[];for(let i=0;i<r.length;i++)c=c.concat(l({array:r,arrayIndex:i,value:r[i],valueSpec:u,validateSpec:t.validateSpec,style:a,styleSpec:o,key:`${s}[${i}]`}));return c}function an(t){let r=t.key,i=t.value,n=t.valueSpec,a=nD(i);return"number"===a&&i!=i&&(a="NaN"),"number"===a?"minimum"in n&&i<n.minimum?[new ri(r,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new ri(r,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]:[new ri(r,i,`number expected, ${a} found`)]}function aa(t){let r=t.valueSpec,i=ae(t.value.type),n,a={},o,s,l="categorical"!==i&&void 0===t.value.property,u="array"===nD(t.value.stops)&&"array"===nD(t.value.stops[0])&&"object"===nD(t.value.stops[0][0]),c=ar({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new ri(t.key,t.value,'identity function may not have a "stops" property')];let r=[],n=t.value;return r=r.concat(ai({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===nD(n)&&0===n.length&&r.push(new ri(t.key,n,"array must have at least one stop")),r},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:r,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&l&&c.push(new ri(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||c.push(new ri(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!nS(t.valueSpec)&&c.push(new ri(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l||nT(t.valueSpec)?l&&!nA(t.valueSpec)&&c.push(new ri(t.key,t.value,"zoom functions not supported")):c.push(new ri(t.key,t.value,"property functions not supported"))),("categorical"===i||u)&&void 0===t.value.property&&c.push(new ri(t.key,t.value,'"property" property is required')),c;function h(t){let i=[],n=t.value,l=t.key;if("array"!==nD(n))return[new ri(l,n,`array expected, ${nD(n)} found`)];if(2!==n.length)return[new ri(l,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==nD(n[0]))return[new ri(l,n,`object expected, ${nD(n[0])} found`)];if(void 0===n[0].zoom)return[new ri(l,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new ri(l,n,"object stop key must have value")];if(s&&s>ae(n[0].zoom))return[new ri(l,n[0].zoom,"stop zoom values must appear in ascending order")];ae(n[0].zoom)!==s&&(s=ae(n[0].zoom),o=void 0,a={}),i=i.concat(ar({key:`${l}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:an,value:f}}))}else i=i.concat(f({key:`${l}[0]`,value:n[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return nV(at(n[1]))?i.concat([new ri(`${l}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${l}[1]`,value:n[1],valueSpec:r,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function f(t,s){let l=nD(t.value),u=ae(t.value),c=null===t.value?s:t.value;if(n){if(l!==n)return[new ri(t.key,c,`${l} stop domain type must match previous stop domain type ${n}`)]}else n=l;if("number"!==l&&"string"!==l&&"boolean"!==l)return[new ri(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==i){let n=`number expected, ${l}
56 found`;return nT(r)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ri(t.key,c,n)]}return"categorical"!==i||"number"!==l||isFinite(u)&&Math.floor(u)===u?"categorical"!==i&&"number"===l&&void 0!==o&&u<o?[new ri(t.key,c,"stop domain values must appear in ascending order")]:(o=u,"categorical"===i&&u in a?[new ri(t.key,c,"stop domain values must be unique")]:(a[u]=!0,[])):[new ri(t.key,c,`integer expected, found ${u}`)]}}function ao(t){let r=("property"===t.expressionContext?nH:n$)(at(t.value),t.key,t.valueSpec);if("error"===r.result)return r.value.map(r=>new ri(`${t.key}${r.key}`,t.value,r.message));let i=r.value.expression||r.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new ri(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!nw(i))return[new ri(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!nw(i))return[new ri(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!nE(i,["zoom","feature-state"]))return[new ri(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!nx(i))return[new ri(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function as(t){let r=t.key,i=t.value,n=nD(i);return"string"===n?rH.parse(String(i))?[]:[new ri(r,i,`color expected, "${i}" found`)]:[new ri(r,i,`color expected, ${n} found`)]}function al(t){let r=t.key,i=t.value,n=t.valueSpec,a=[];return Array.isArray(n.values)?-1===n.values.indexOf(ae(i))&&a.push(new ri(r,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(ae(i))&&a.push(new ri(r,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function au(t){let r,i=at(t.value);return nK(i)?[...(r=n1(i))?[new ri(`${t.key}${r.path.map(t=>`[${t}]`).join("")}`,function(t,r){let i=t;for(let t of r)i=i[t];return i}(t.value,r.path),nJ(r.legacyFilter),null,"warning")]:[],...ao(nM({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:function t(r){let i=r.value,n=r.key;if("array"!==nD(i))return[new ri(n,i,`array expected, ${nD(i)} found`)];let a=r.styleSpec,o,s=[];if(i.length<1)return[new ri(n,i,"filter array must have at least 1 element")];switch(s=s.concat(al({key:`${n}[0]`,value:i[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),ae(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===ae(i[1])&&s.push(new ri(n,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&s.push(new ri(n,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&"string"!==(o=nD(i[1]))&&s.push(new ri(`${n}[1]`,i[1],`string expected, ${o} found`));for(let t=2;t<i.length;t++)o=nD(i[t]),"$type"===ae(i[1])?s=s.concat(al({key:`${n}[${t}]`,value:i[t],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):"string"!==o&&"number"!==o&&"boolean"!==o&&s.push(new ri(`${n}[${t}]`,i[t],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let a=1;a<i.length;a++)s=s.concat(t({key:`${n}[${a}]`,value:i[a],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":o=nD(i[1]),2===i.length?"string"!==o&&s.push(new ri(`${n}[1]`,i[1],`string expected, ${o} found`)):s.push(new ri(n,i,`filter array for "${i[0]}" operator must have 2 elements`))}return s}(t)}function ac(t,r){let i,n=t.key,a=t.validateSpec,o=t.style,s=t.styleSpec,l=t.value,u=t.objectKey,c=s[`${r}_${t.layerType}`];if(!c)return[];let h=u.match(nC);if("paint"===r&&h&&c[h[1]]&&c[h[1]].transition)return a({key:n,value:l,valueSpec:s.transition,style:o,styleSpec:s}
56);let f=t.valueSpec||c[u];if(!f)return[new ri(n,l,`unknown property "${u}"`)];if("string"===nD(l)&&nT(f)&&!f.tokens&&(i=/^{([^}]+)}$/.exec(l)))return[new ri(n,l,`"${u}" does not support interpolation syntax 57Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(i[1])} }\`.`)];let d=[];return"symbol"===t.layerType&&"text-font"===u&&nP(at(l))&&"identity"===ae(l.type)&&d.push(new ri(n,l,'"text-font" does not support identity functions')),d.concat(a({key:t.key,value:l,valueSpec:f,style:o,styleSpec:s,expressionContext:"property",propertyType:r,propertyKey:u}))}function ah(t){return ac(t,"paint")}function af(t){return ac(t,"layout")}function ad(t){let r=[],i=t.value,n=t.key,a=t.style,o=t.styleSpec;if("object"!==nD(i))return[new ri(n,i,`object expected, ${nD(i)} found`)];i.type||i.ref||r.push(new ri(n,i,'either "type" or "ref" is required'));let s=ae(i.type),l=ae(i.ref);if(i.id){let o=ae(i.id);for(let s=0;s<t.arrayIndex;s++){let t=a.layers[s];ae(t.id)===o&&r.push(new ri(n,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in i&&r.push(new ri(n,i[t],`"${t}" is prohibited for ref layers`))}),a.layers.forEach(r=>{ae(r.id)===l&&(t=r)}),t?t.ref?r.push(new ri(n,i.ref,"ref cannot reference another ref layer")):s=ae(t.type):r.push(new ri(n,i.ref,`ref layer "${l}" not found`))}else if("background"!==s)if(i.source){let t=a.sources&&a.sources[i.source],o=t&&ae(t.type);t?"vector"===o&&"raster"===s?r.push(new ri(n,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===s||"raster-dem"!==o&&"color-relief"===s?r.push(new ri(n,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==s?r.push(new ri(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s&&"color-relief"!==s?r.push(new ri(n,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===s&&i.paint&&i.paint["line-gradient"]&&("geojson"!==o||!t.lineMetrics)&&r.push(new ri(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new ri(n,i,`layer "${i.id}" must specify a "source-layer"`)):r.push(new ri(n,i.source,`source "${i.source}" not found`))}else r.push(new ri(n,i,'missing required property "source"'));return"raster"===s&&i.paint?.resampling&&i.paint?.["raster-resampling"]&&r.push(new ri(n,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(ar({key:n,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${n}.type`,value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:au,layout:t=>ar({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>af(nM({layerType:s},t))}}),paint:t=>ar({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>ah(nM({layerType:s},t))}})}}))}function ap(t){let r=t.value,i=t.key,n=nD(r);return"string"===n?[]:[new ri(i,r,`string expected, ${n} found`)]}let am={promoteId:function({key:t,value:r}){if("string"===nD(r))return ap({key:t,value:r});{let i=[];for(let n in r)i.push(...ap({key:`${t}.${n}`,value:r[n]}));return i}}};function ag(t){let r=t.value,i=t.key,n=t.styleSpec,a=t.style,o=t.validateSpec;if(!r.type)return[new ri(i,r,'"type" is required')];let s=ae(r.type),l;switch(s){case"vector":case"raster":return ar({key:i,value:r,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:am,validateSpec:o});case"raster-dem":return function(t){let r=t.sourceName??"",i=t.value,n=t.styleSpec,a=n.source_raster_dem,o=t.style,s=[],l=nD(i);if(void 0===i)return s;if("object"!==l)return s.push(new ri("source_raster_dem",i,`object expected, ${l}
57 found`)),s;let u="custom"===ae(i.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let l in i)!u&&c.includes(l)?s.push(new ri(l,i[l],`In "${r}": "${l}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):a[l]?s=s.concat(t.validateSpec({key:l,value:i[l],valueSpec:a[l],validateSpec:t.validateSpec,style:o,styleSpec:n})):s.push(new ri(l,i[l],`unknown property "${l}"`));return s}({sourceName:i,value:r,style:t.style,styleSpec:n,validateSpec:o});case"geojson":if(l=ar({key:i,value:r,valueSpec:n.source_geojson,style:a,styleSpec:n,validateSpec:o,objectElementValidators:am}),r.cluster)for(let t in r.clusterProperties){let[n,a]=r.clusterProperties[t],s="string"==typeof n?[n,["accumulated"],["get",t]]:n;l.push(...ao({key:`${i}.${t}.map`,value:a,validateSpec:o,expressionContext:"cluster-map"})),l.push(...ao({key:`${i}.${t}.reduce`,value:s,validateSpec:o,expressionContext:"cluster-reduce"}))}return l;case"video":return ar({key:i,value:r,valueSpec:n.source_video,style:a,validateSpec:o,styleSpec:n});case"image":return ar({key:i,value:r,valueSpec:n.source_image,style:a,validateSpec:o,styleSpec:n});case"canvas":return[new ri(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return al({key:`${i}.type`,value:r.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:a,validateSpec:o,styleSpec:n})}}function ay(t){let r=t.value,i=t.styleSpec,n=i.light,a=t.style,o=[],s=nD(r);if(void 0===r)return o;if("object"!==s)return o.concat([new ri("light",r,`object expected, ${s} found`)]);for(let s in r){let l=s.match(nC);o=l&&n[l[1]]&&n[l[1]].transition?o.concat(t.validateSpec({key:s,value:r[s],valueSpec:i.transition,validateSpec:t.validateSpec,style:a,styleSpec:i})):n[s]?o.concat(t.validateSpec({key:s,value:r[s],valueSpec:n[s],validateSpec:t.validateSpec,style:a,styleSpec:i})):o.concat([new ri(s,r[s],`unknown property "${s}"`)])}return o}function av(t){let r=t.value,i=t.styleSpec,n=i.sky,a=t.style,o=nD(r);if(void 0===r)return[];if("object"!==o)return[new ri("sky",r,`object expected, ${o} found`)];let s=[];for(let o in r){let l=o.match(nC);s=l&&n[l[1]]&&n[l[1]].transition?s.concat(t.validateSpec({key:o,value:r[o],valueSpec:i.transition,style:a,styleSpec:i})):n[o]?s.concat(t.validateSpec({key:o,value:r[o],valueSpec:n[o],style:a,styleSpec:i})):s.concat([new ri(o,r[o],`unknown property "${o}"`)])}return s}function a_(t){let r=t.value,i=t.styleSpec,n=i.terrain,a=t.style,o=[],s=nD(r);if(void 0===r)return o;if("object"!==s)return o.concat([new ri("terrain",r,`object expected, ${s} found`)]);for(let s in r)o=n[s]?o.concat(t.validateSpec({key:s,value:r[s],valueSpec:n[s],validateSpec:t.validateSpec,style:a,styleSpec:i})):o.concat([new ri(s,r[s],`unknown property "${s}"`)]);return o}function ab(t){let r=[],i=t.value,n=t.key;if(Array.isArray(i)){let a=[],o=[];for(let s in i)i[s].id&&a.includes(i[s].id)&&r.push(new ri(n,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),a.push(i[s].id),i[s].url&&o.includes(i[s].url)&&r.push(new ri(n,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url),r=r.concat(ar({key:`${n}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return r}return ap({key:n,value:i})}function ax(t){return!!t&&t.constructor===Object}function aw(t){return ax(t.value)?[]:[new ri(t.key,t.value,`object expected, ${nD(t.value)} found`)]}let aE=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;function aT(t){let r=t.key??"font-faces",i=t.value,n=t.validateSpec,a=t.styleSpec??rt,o=t.style;if(!ax(i))return[new ri(r,i,`object expected, ${nD(i)} found`)];let s=[];for(let t in i){let l=i[t],u=nD(l);if("string"===u)s.push(...ap({key:`${r}.${t}`,value:l}));else if("array"===u){let i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[u,c]of l.entries()){let l=`${r}.${t}[${u}]`;s.push(...ar({key:l,value:c,valueSpec:i,styleSpec:a,style:o,validateSpec:n}));
57let h=ax(c)?c["unicode-range"]:void 0;if("array"===nD(h))for(let[t,r]of h.entries())s.push(...function(t,r){if("string"!==nD(r))return[];let i=`${r}`,n=()=>[new ri(t,r,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],a=i.match(aE);if(!a)return n();let[,o,s,l]=a;if(void 0!==l)return l.length>6?n():[];let u=parseInt(o,16),c=void 0===s?u:parseInt(s,16);return u>1114111||c>1114111?[new ri(t,r,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:u>c?[new ri(t,r,`unicode range start must not be greater than its end, but ${i} is`)]:[]}(`${l}.unicode-range[${t}]`,r))}}else s.push(new ri(`${r}.${t}`,l,`string or array expected, ${u} found`))}return s}let aA={"*":()=>[],array:ai,boolean:function(t){let r=t.value,i=t.key,n=nD(r);return"boolean"===n?[]:[new ri(i,r,`boolean expected, ${n} found`)]},number:an,color:as,constants:n9,enum:al,filter:au,function:aa,layer:ad,object:ar,source:ag,light:ay,sky:av,terrain:a_,projection:function(t){let r=t.value,i=t.styleSpec,n=i.projection,a=t.style,o=nD(r);if(void 0===r)return[];if("object"!==o)return[new ri("projection",r,`object expected, ${o} found`)];let s=[];for(let o in r)s=n[o]?s.concat(t.validateSpec({key:o,value:r[o],valueSpec:n[o],style:a,styleSpec:i})):s.concat([new ri(o,r[o],`unknown property "${o}"`)]);return s},projectionDefinition:function(t){var r;let i=t.key,n=t.value,a=nD(n=n instanceof String?n.valueOf():n);return"array"!==a||Array.isArray(r=n)&&3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]&&"number"==typeof r[2]||["interpolate","step","literal"].includes(n[0])?["array","string"].includes(a)?[]:[new ri(i,n,`projection expected, invalid type "${a}" found`)]:[new ri(i,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:ap,formatted:function(t){return 0===ap(t).length?[]:ao(t)},resolvedImage:function(t){return 0===ap(t).length?[]:ao(t)},padding:function(t){let r=t.key,i=t.value;if("array"===nD(i)){if(i.length<1||i.length>4)return[new ri(r,i,`padding requires 1 to 4 values; ${i.length} values found`)];let n={type:"number"},a=[];for(let o=0;o<i.length;o++)a=a.concat(t.validateSpec({key:`${r}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:n}));return a}return an({key:r,value:i,valueSpec:{}})},numberArray:function(t){let r=t.key,i=t.value;if("array"===nD(i)){let n={type:"number"};if(i.length<1)return[new ri(r,i,"array length at least 1 expected, length 0 found")];let a=[];for(let o=0;o<i.length;o++)a=a.concat(t.validateSpec({key:`${r}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:n}));return a}return an({key:r,value:i,valueSpec:{}})},colorArray:function(t){let r=t.key,i=t.value;if("array"===nD(i)){if(i.length<1)return[new ri(r,i,"array length at least 1 expected, length 0 found")];let t=[];for(let n=0;n<i.length;n++)t=t.concat(as({key:`${r}[${n}]`,value:i[n],valueSpec:{}}));return t}return as({key:r,value:i,valueSpec:{}})},variableAnchorOffsetCollection:function(t){let r=t.key,i=t.value,n=nD(i),a=t.styleSpec;if("array"!==n||i.length<1||i.length%2!=0)return[new ri(r,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let n=0;n<i.length;n+=2)o=(o=o.concat(al({key:`${r}[${n}]`,value:i[n],valueSpec:a.layout_symbol["text-anchor"]}))).concat(ai({key:`${r}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:a}));return o},sprite:ab,state:aw,fontFaces:aT};function aS(t){let r=t.value,i=t.valueSpec,n=t.styleSpec;return t.validateSpec=aS,i.expression&&nP(ae(r))?aa(t):i.expression&&nV(at(r))?ao(t):i.type&&aA[i.type]?aA[i.type](t):ar(nM({},t,{valueSpec:i.type?n[i.type]:i}))}function aC(t){let r=t.value,i=t.key,n=ap(t);return n.length||(-1===r.indexOf("{fontstack}")&&n.push(new ri(i,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&n.push(new ri(i,r,'"glyphs" url must include a "{range}" token'))),n}function aM(t,r=rt){let i=[];return i=i.concat(aS({key:"",value:t,valueSpec:r.$root,styleSpec:r,style:t,validateSpec:aS,objectElementValidators:{glyphs:aC,"*":()=>[]}})),t.constants&&(i=i.concat(n9({key:"constants",value:t.constants,style:t,styleSpec:r,validateSpec:aS}))),aP(i)}function aD(t){return function(r){return t(Object.assign({},r,{validateSpec:aS}))}}function aP(t){return[].concat(t).sort((t,r)=>t.line-r.line)}function aI(t){return function(...r){return aP(t.apply(this,r))}}aM.source=aI(aD(ag)),aM.sprite=aI(aD(ab)),aM.glyphs=aI(aD(aC)),aM.fontFaces=aI(aD(aT)),aM.light=aI(aD(ay)),aM.sky=aI(aD(av)),aM.terrain=aI(aD(a_)),aM.state=aI(aD(aw)),aM.layer=aI(aD(ad)),aM.filter=aI(aD(au)),aM.paintProperty=aI(aD(ah)),aM.layoutProperty=aI(aD(af));let ak={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};var aO=class{constructor(t,r,i){this._rootKey=r,this._globalState=i,this.setValue(t)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(t){if(null==t||"visible"===t||"none"===t){this._literalValue="none"===t?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let r=n$(t,this._rootKey,ak,this._globalState);if("error"===r.result)throw this._literalValue="visible",this._compiledValue=void 0,Error(r.value.map(t=>`${t.key}: ${t.message}`).join(", "));this._literalValue=void 0,this._compiledValue=r.value,this._globalStateRefs=nZ(r.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};let aN=new Set(Object.keys(rt).filter(t=>t.startsWith("source_")).map(t=>t.slice(7).replaceAll("_","-")));function aL(t,r){let i=Object.entries(r.sources??{}).filter(([,t])=>!aN.has(t.type)).map(([t])=>`sources.${t}`);return aR(t,aM(r).filter(({message:t})=>!i.some(r=>t.startsWith(`${r}:`)||t.startsWith(`${r}.`))))}function aR(t,r){let i=!1;for(let n of r){if("warning"===n.severity){tI(n.message);continue}t.fire(new t9(Error(n.message))),i=!0}return i}function aF(t,r,i,n){return n?.validate!==!1&&aR(t,r({styleSpec:rt,...i}))}var aB=class t{constructor(t,r,i){let n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let a=new Int32Array(this.arrayBuffer);t=a[0],r=a[1],i=a[2],this.d=r+2*i;for(let t=0;t<this.d*this.d;t++){let r=a[3+t],i=a[3+t+1];n.push(r===i?null:a.subarray(r,i))}let o=a[3+n.length],s=a[3+n.length+1];this.keys=a.subarray(o,s),this.bboxes=a.subarray(s),this.insert=this._insertReadonly}else{this.d=r+2*i;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=i,this.scale=r/t,this.uid=0;let a=i/r*t;this.min=-a,this.max=t+a}
vendor: 5,271 bytes, line 57
57insert(t,r,i,n,a){this._forEachCell(r,i,n,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,i,n,a,o){this.cells[a].push(o)}query(t,r,i,n,a){let o=this.min,s=this.max;if(t<=o&&r<=o&&s<=i&&s<=n&&!a)return[...this.keys];{let o=[];return this._forEachCell(t,r,i,n,this._queryCell,o,{},a),o}}_queryCell(t,r,i,n,a,o,s,l){let u=this.cells[a];if(null!==u){let a=this.keys,c=this.bboxes;for(let h of u)if(void 0===s[h]){let u=4*h;(l?l(c[u+0],c[u+1],c[u+2],c[u+3]):t<=c[u+2]&&r<=c[u+3]&&i>=c[u+0]&&n>=c[u+1])?(s[h]=!0,o.push(a[h])):s[h]=!1}}}_forEachCell(t,r,i,n,a,o,s,l){let u=this._convertToCellCoord(t),c=this._convertToCellCoord(r),h=this._convertToCellCoord(i),f=this._convertToCellCoord(n);for(let d=u;d<=h;d++)for(let u=c;u<=f;u++){let c=this.d*u+d;if((!l||l(this._convertFromCellCoord(d),this._convertFromCellCoord(u),this._convertFromCellCoord(d+1),this._convertFromCellCoord(u+1)))&&a.call(this,t,r,i,n,c,o,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,i=0;for(let t of this.cells)i+=t.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let r=0;r<t.length;r++){let i=t[r];n[3+r]=a,n.set(i,a),a+=i.length}return n[3+t.length]=a,n.set(this.keys,a),a+=this.keys.length,n[3+t.length+1]=a,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer}static serialize(t,r){let i=t.toArrayBuffer();return r&&r.push(i),{buffer:i}}static deserialize(r){return new t(r.buffer)}};let az={};function aj(t,r,i={}){if(az[t])throw Error(`${t} is already registered.`);Object.defineProperty(r,"_classRegistryKey",{value:t,writeable:!1}),az[t]={klass:r,omit:i.omit||[],shallow:i.shallow||[]}}for(let t in aj("Object",Object),aj("Set",Set),aj("TransferableGridIndex",aB),aj("Color",rH),aj("Error",Error),aj("AJAXError",tJ),aj("ResolvedImage",r2),aj("StylePropertyFunction",nW),aj("StyleExpression",nz,{omit:["_evaluator"]}),aj("ZoomDependentExpression",nq),aj("ZoomConstantExpression",nG),aj("CompoundExpression",nm,{omit:["_evaluate"]}),nh)nh[t]._classRegistryKey||aj(`Expression_${t}`,nh[t]);function aU(t){return t&&"u">typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor?.name==="ArrayBuffer")}function aV(t){let r=t.constructor;return t.$name||r._classRegistryKey}function a$(t){return!function(t){if("object"!=typeof t||!t)return!1;let r=aV(t);return r&&"Object"!==r}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||aU(t)||tL(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function aG(t,r){if(a$(t))return(aU(t)||tL(t))&&r&&r.push(t),ArrayBuffer.isView(t)&&r&&r.push(t.buffer),t instanceof ImageData&&r&&r.push(t.data.buffer),t;if(Array.isArray(t)){let i=[];for(let n of t)i.push(aG(n,r));return i}if("object"!=typeof t)throw Error(`can't serialize object of type ${typeof t}`);let i=aV(t);if(!i)throw Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!az[i])throw Error(`${i} is not registered.`);let{klass:n}=az[i],a=n.serialize?n.serialize(t,r):{};if(n.serialize){if(a===r?.[r.length-1])throw Error("statically serialized object won't survive transfer of $name property")}else{for(let n in t){if(!t.hasOwnProperty(n)||az[i].omit.includes(n))continue;let o=t[n];void 0!==o&&(a[n]=az[i].shallow.includes(n)?o:aG(o,r))}t instanceof Error&&(a.message=t.message)}if(a.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(a.$name=i),a}function aq(t){if(a$(t))return t;if(Array.isArray(t))return t.map(aq);if("object"!=typeof t)throw Error(`can't deserialize object of type ${typeof t}`);let r=aV(t)||"Object";if(!az[r])throw Error(`can't deserialize unregistered class ${r}`);let{klass:i}=az[r];if(!i)throw Error(`can't deserialize unregistered class ${r}`);if(i.deserialize)return i.deserialize(t);let n=Object.create(i.prototype);for(let i of Object.keys(t)){if("$name"===i)continue;let a=t[i];n[i]=az[r].shallow.includes(i)?a:aq(a)}return n}var aH=class{constructor(){this.first=!0}update(t,r){let i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}},aW=class{constructor(t,r){this.zoom=t,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new aH,this.transition=r.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new aH,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}
57getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*r}}},aZ=class{constructor(t,r,i,n){this.property=t,this.value=r,this.expression=function(t,r,i,n){if(nP(t))return new nW(t,r,i);if(nV(t)){let a=nH(t,r,i,n);if("error"===a.result)throw Error(a.value.map(t=>`${t.key}: ${t.message}`).join(", "));return a.value}{let r=t;return"color"===i.type&&"string"==typeof t?r=rH.parse(t):"padding"===i.type&&("number"==typeof t||Array.isArray(t))?r=rX.parse(t):"numberArray"===i.type&&("number"==typeof t||Array.isArray(t))?r=rK.parse(t):"colorArray"===i.type&&("string"==typeof t||Array.isArray(t))?r=rQ.parse(t):"variableAnchorOffsetCollection"===i.type&&Array.isArray(t)?r=r1.parse(t):"projectionDefinition"===i.type&&"string"==typeof t&&(r=r3.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}(void 0===r?t.specification.default:r,i,t.specification,n)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}readsGlobalState(t){let r=this.getGlobalStateRefs();return t.some(t=>r.has(t))}possiblyEvaluate(t,r,i){return this.property.possiblyEvaluate(this,t,r,i)}},aY=class{constructor(t,r,i){this.property=t,this.value=new aZ(t,void 0,r,i)}transitioned(t,r){return r.value===this.value?r:new aK(this.property,this.value,r,tb({},t.transition,this.transition),t.now)}untransitioned(){return new aK(this.property,this.value,null,{},0)}},aX=class{constructor(t,r,i){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=i,this._rootKey=r}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return tD(this._values[t].value.value)}setValue(t,r){Object.hasOwn(this._values,t)||(this._values[t]=new aY(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new aZ(this._values[t].property,null===r?void 0:tD(r),this._propertyRootKey(t),this._globalState)}setValues(t){for(let r in t){let i=t[r];r.endsWith("-transition")?this.setTransition(r.slice(0,-11),i):tM(this._values[r].value.value,i)||this.setValue(r,i)}}getTransition(t){return tD(this._values[t].transition)}setTransition(t,r){Object.hasOwn(this._values,t)||(this._values[t]=new aY(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=tD(r)||void 0}retainPriorGlobalState(t,r,i){for(let n of Object.keys(i._values))for(let a=i._values[n];a;a=a.prior){let{value:i}=a;i.property.specification.transition&&!i.isDataDriven()&&i.expression._globalState===this._globalState&&i.readsGlobalState(t)&&(a.value=new aZ(i.property,i.value,this._propertyRootKey(n),r))}}applyGlobalStateChange(t,r,i,n){this.retainPriorGlobalState(t,r,i);let a=!1;for(let r of Object.keys(this._values)){let{value:i}=this._values[r];i.readsGlobalState(t)&&(this.setValue(r,i.value),a=!0)}return a?this.transitioned(n,i):i}serialize(){let t={};for(let r of Object.keys(this._values)){let i=this.getValue(r);void 0!==i&&(t[r]=i);let n=this.getTransition(r);void 0!==n&&(t[`${r}-transition`]=n)}return t}transitioned(t,r){let i=new aQ(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(t,r._values[n]);return i}untransitioned(){let t=new aQ(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}},aK=class{constructor(t,r,i,n,a){this.property=t,this.value=r,this.begin=a+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(t,r,i){let n=t.now||0,a=this.value.possiblyEvaluate(t,r,i),o=this.prior;if(!o)return a;if(n>this.end||this.value.isDataDriven())return this.prior=null,a;if(n<this.begin)return o.possiblyEvaluate(t,r,i);{let s=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,r,i),a,function(t){if(t<=0)return 0;if(t>=1)return 1;let r=t*t,i=r*t;return 4*(t<.5?i:3*(t-r)+i-.75)}(s))}}},aQ=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,i){let n=new a1(this._properties);for(let a of Object.keys(this._values))n._values[a]=this._values[a].possiblyEvaluate(t,r,i);return n}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},aJ=class{constructor(t,r,i){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=i,this._rootKey=r}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasValue(t){return void 0!==this._values[t].value}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return tD(this._values[t].value)}setValue(t,r){this._values[t]=new aZ(this._values[t].property,null===r?void 0:tD(r),this._propertyRootKey(t),this._globalState)}serialize(){let t={};for(let r of Object.keys(this._values)){let i=this.getValue(r);void 0!==i&&(t[r]=i)}return t}possiblyEvaluate(t,r,i){let n=new a1(this._properties);for(let a of Object.keys(this._values))n._values[a]=this._values[a].possiblyEvaluate(t,r,i);return n}},a0=class{constructor(t,r,i){this.property=t,this.value=r,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,r,i,n){return this.property.evaluate(this.value,this.parameters,t,r,i,n)}},a1=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function a2(t){if(Array.isArray(t))return t.length;let r=t?.values;return Array.isArray(r)?r.length:void 0}function a3(t,r){let i=a2(t),n=a2(r);return void 0!==i&&void 0!==n&&i!==n}var a4=class{constructor(t,r){this.specification=t,this.name=r}possiblyEvaluate(t,r){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,i){if(a3(t,r))return tI(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),r;let n=il[this.specification.type];return n?n(t,r,i):t}},a6=class{constructor(t,r,i){this.specification=t,this.name=r,this.overrides=i}possiblyEvaluate(t,r,i,n){return"constant"===t.expression.kind||"camera"===t.expression.kind?new a0(this,{kind:"constant",value:t.expression.evaluate(r,null,{},i,n)},r):new a0(this,t.expression,r)}interpolate(t,r,i){if("constant"!==t.value.kind||"constant"!==r.value.kind)return t;if(void 0===t.value.value||void 0===r.value.value)return new a0(this,{kind:"constant",value:void 0},t.parameters);if(a3(t.value.value,r.value.value))return tI(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),r;let n=il[this.specification.type];return n?new a0(this,{kind:"constant",value:n(t.value.value,r.value.value,i)},t.parameters):t}evaluate(t,r,i,n,a,o){return"constant"===t.kind?t.value:t.evaluate(r,i,n,a,o)}},a5=class extends a6{possiblyEvaluate(t,r,i,n){if(void 0===t.value)return new a0(this,{kind:"constant",value:void 0},r);if("constant"===t.expression.kind){let a=t.expression.evaluate(r,null,{},i,n),o="resolvedImage"===t.property.specification.type&&"string"!=typeof a?a.name:a;return new a0(this,{kind:"constant",value:this._calculate(o,o,o,r)},r)}return"camera"===t.expression.kind?new a0(this,{kind:"constant",value:this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r)},r):new a0(this,t.expression,r)}evaluate(t,r,i,n,a,o){if("source"===t.kind){let s=t.evaluate(r,i,n,a,o);return this._calculate(s,s,s,r)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},i,n),t.evaluate({zoom:Math.floor(r.zoom)},i,n),t.evaluate({zoom:Math.floor(r.zoom)+1},i,n),r):t.value}_calculate(t,r,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:i,to:r}}interpolate(t){return t}},a8=class{constructor(t,r){this.specification=t,this.name=r}possiblyEvaluate(t,r,i,n){if(void 0!==t.value){if("constant"===t.expression.kind){let a=t.expression.evaluate(r,null,{},i,n);return this._calculate(a,a,a,r)}return this._calculate(t.expression.evaluate(new aW(Math.floor(r.zoom-1),r)),t.expression.evaluate(new aW(Math.floor(r.zoom),r)),t.expression.evaluate(new aW(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:i,to:r}}interpolate(t){return t}},a7=class{constructor(t,r){this.specification=t,this.name=r}possiblyEvaluate(t,r,i,n){return!!t.expression.evaluate(r,null,{},i,n)}interpolate(){return!1}},a9=class{constructor(t){for(let r in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){let i=t[r];
vendor: 20,466 bytes, line 57
57i.specification.overridable&&this.overridableProperties.push(r);let n=this.defaultPropertyValues[r]=new aZ(i,void 0,i.name,void 0),a=this.defaultTransitionablePropertyValues[r]=new aY(i,i.name,void 0);this.defaultTransitioningPropertyValues[r]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=n.possiblyEvaluate({})}}};aj("DataDrivenProperty",a6),aj("DataConstantProperty",a4),aj("CrossFadedDataDrivenProperty",a5),aj("CrossFadedProperty",a8),aj("ColorRampProperty",a7);let oe=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",ot=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";var or=class extends re{constructor(t,r,i){if(super(),this.id=t.id,this.type=t.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(t,r,i){return new aO(t,r,i)}(this.visibility,`layers[${this.id}].layout.visibility`,i),"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=n3(t.filter,`layers[${this.id}].filter`,i)),r.layout&&(this._unevaluatedLayout=new aJ(r.layout,`layers[${this.id}].layout`,i)),r.paint)){for(let n in this._transitionablePaint=new aX(r.paint,`layers[${this.id}].paint`,i),t.paint)this.setPaintProperty(n,t.paint[n],{validate:!1});for(let r in t.layout)this.setLayoutProperty(r,t.layout[r],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new a1(r.paint)}}setFilter(t){this.filter=t,this._featureFilter=n3(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){if("visibility"===t)return this.visibility;if(this._transitionablePaint?.hasProperty(t))throw Error(t+oe);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let r of this._visibilityExpression.getGlobalStateRefs())t.add(r);if(this._unevaluatedLayout)for(let r in this._unevaluatedLayout._values)for(let i of this._unevaluatedLayout._values[r].getGlobalStateRefs())t.add(i);for(let r of this._featureFilter.getGlobalStateRefs())t.add(r);return t}getPaintAffectingGlobalStateRefs(){let t=new globalThis.Map;if(this._transitionablePaint)for(let r in this._transitionablePaint._values){let i=this._transitionablePaint._values[r].value;for(let n of i.getGlobalStateRefs()){let a=t.get(n)??[];a.push({name:r,value:i.value}),t.set(n,a)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,r,i={}){if("visibility"===t){this.visibility=r,this._visibilityExpression.setValue(r),this.recalculateVisibility();return}this._transitionablePaint?.hasProperty(t)?this.fire(new t9(Error(t+oe))):null!=r&&this._validate(aM.layoutProperty,`layers.${this.id}.layout.${t}`,t,r,i)||this._unevaluatedLayout.setValue(t,r)}getPaintProperty(t){if(t.endsWith("-transition")){let r=t.slice(0,-11);if("visibility"===r||this._unevaluatedLayout?.hasProperty(r))throw Error(t+ot);return this._transitionablePaint.getTransition(r)}if("visibility"===t||this._unevaluatedLayout?.hasProperty(t))throw Error(t+ot);return this._transitionablePaint.getValue(t)}setPaintProperty(t,r,i={}){if("visibility"===t||this._unevaluatedLayout?.hasProperty(t))return this.fire(new t9(Error(t+ot))),!1;if(null!=r&&this._validate(aM.paintProperty,`layers.${this.id}.paint.${t}`,t,r,i))return!1;if(t.endsWith("-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{let i=this._transitionablePaint._values[t],n="cross-faded-data-driven"===i.property.specification["property-type"],a=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let s=this._transitionablePaint._values[t].value;return s.isDataDriven()||a||n||this._handleOverridablePaintPropertyUpdate(t,o,s)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,i){return!1}isHidden(t=this.minzoom,r=!1){return!!(this.minzoom&&t<(r?Math.floor(this.minzoom):this.minzoom))||!!this.maxzoom&&t>=this.maxzoom||"none"===this._evaluatedVisibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}retainPriorGlobalState(t,r){this._transitionablePaint?.retainPriorGlobalState(t,r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(t.layout||={},t.layout.visibility=this.visibility),tC(t,(t,r)=>void 0!==t&&!("layout"===r&&!Object.keys(t).length)&&!("paint"===r&&!Object.keys(t).length))}_validate(t,r,i,n,a={}){return aF(this,t,{key:r,layerType:this.type,objectKey:i,value:n},a)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof a0&&nT(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}return!1}},oi={get paint(){return n||=new a9({"raster-opacity":new a4(rt.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new a4(rt.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new a4(rt.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new a4(rt.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new a4(rt.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new a4(rt.paint_raster["raster-contrast"],"raster-contrast"),resampling:new a4(rt.paint_raster.resampling,"resampling"),"raster-resampling":new a4(rt.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new a4(rt.paint_raster["raster-fade-duration"],"raster-fade-duration")})}};let on=t=>"raster"===t.type;var oa=class extends or{constructor(t,r){super(t,oi,r)}};let oo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};var os=class{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},ol=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function ou(t,r=1){let i=0,n=0;return{members:t.map(t=>{let a=oo[t.type].BYTES_PER_ELEMENT,o=i=oc(i,Math.max(r,a)),s=t.components||1;return n=Math.max(n,a),i+=a*s,{name:t.name,type:t.type,components:s,offset:o}}),size:oc(i,Math.max(n,r)),alignment:r}}function oc(t,r){return Math.ceil(t/r)*r}var oh=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,r)}emplace(t,r,i){let n=2*t;return this.int16[n+0]=r,this.int16[n+1]=i,t}};oh.prototype.bytesPerElement=4,aj("StructArrayLayout2i4",oh);var of=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,r,i)}emplace(t,r,i,n){let a=3*t;return this.int16[a+0]=r,this.int16[a+1]=i,this.int16[a+2]=n,t}};of.prototype.bytesPerElement=6,aj("StructArrayLayout3i6",of);var od=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,r,i,n)}emplace(t,r,i,n,a){let o=4*t;return this.int16[o+0]=r,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=a,t}};od.prototype.bytesPerElement=8,aj("StructArrayLayout4i8",od);var op=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,r,i,n,a,o)}emplace(t,r,i,n,a,o,s){let l=6*t;return this.int16[l+0]=r,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+3]=a,this.int16[l+4]=o,this.int16[l+5]=s,t}};op.prototype.bytesPerElement=12,aj("StructArrayLayout2i4i12",op);var om=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,r,i,n,a,o)}emplace(t,r,i,n,a,o,s){let l=4*t,u=8*t;return this.int16[l+0]=r,this.int16[l+1]=i,this.uint8[u+4]=n,this.uint8[u+5]=a,this.uint8[u+6]=o,this.uint8[u+7]=s,t}};om.prototype.bytesPerElement=8,aj("StructArrayLayout2i4ub8",om);var og=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,r)}emplace(t,r,i){let n=2*t;return this.float32[n+0]=r,this.float32[n+1]=i,t}};og.prototype.bytesPerElement=8,aj("StructArrayLayout2f8",og);var oy=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o,s,l,u,c){let h=this.length;return this.resize(h+1),this.emplace(h,t,r,i,n,a,o,s,l,u,c)}emplace(t,r,i,n,a,o,s,l,u,c,h){let f=10*t;return this.uint16[f+0]=r,this.uint16[f+1]=i,this.uint16[f+2]=n,this.uint16[f+3]=a,this.uint16[f+4]=o,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=u,this.uint16[f+8]=c,this.uint16[f+9]=h,t}};oy.prototype.bytesPerElement=20,aj("StructArrayLayout10ui20",oy);var ov=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,i,n,a,o,s,l)}emplace(t,r,i,n,a,o,s,l,u){let c=8*t;return this.uint16[c+0]=r,this.uint16[c+1]=i,this.uint16[c+2]=n,this.uint16[c+3]=a,this.uint16[c+4]=o,this.uint16[c+5]=s,this.uint16[c+6]=l,this.uint16[c+7]=u,t}};ov.prototype.bytesPerElement=16,aj("StructArrayLayout8ui16",ov);var o_=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o,s,l,u,c,h,f,d){let p=this.length;return this.resize(p+1),this.emplace(p,t,r,i,n,a,o,s,l,u,c,h,f,d)}emplace(t,r,i,n,a,o,s,l,u,c,h,f,d,p){let m=14*t;return this.int16[m+0]=r,this.int16[m+1]=i,this.int16[m+2]=n,this.int16[m+3]=a,this.uint16[m+4]=o,this.uint16[m+5]=s,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=h,this.int16[m+10]=f,this.int16[m+11]=d,this.float32[7*t+6]=p,t}};o_.prototype.bytesPerElement=28,aj("StructArrayLayout4i4ui4i1f28",o_);var ob=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,r,i)}emplace(t,r,i,n){let a=3*t;return this.float32[a+0]=r,this.float32[a+1]=i,this.float32[a+2]=n,t}};ob.prototype.bytesPerElement=12,aj("StructArrayLayout3f12",ob);var ox=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[+t+0]=r,t}};ox.prototype.bytesPerElement=4,aj("StructArrayLayout1ul4",ox);var ow=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,t,r,i,n,a,o,s,l,u)}emplace(t,r,i,n,a,o,s,l,u,c){let h=10*t;return this.int16[h+0]=r,this.int16[h+1]=i,this.int16[h+2]=n,this.int16[h+3]=a,this.int16[h+4]=o,this.int16[h+5]=s,this.uint32[5*t+3]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}};ow.prototype.bytesPerElement=20,aj("StructArrayLayout6i1ul2ui20",ow);var oE=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,r,i,n,a,o)}emplace(t,r,i,n,a,o,s){let l=6*t;return this.int16[l+0]=r,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+3]=a,this.int16[l+4]=o,this.int16[l+5]=s,t}};oE.prototype.bytesPerElement=12,aj("StructArrayLayout2i2i2i12",oE);var oT=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,t,r,i,n,a)}emplace(t,r,i,n,a,o){let s=4*t,l=8*t;return this.float32[s+0]=r,this.float32[s+1]=i,this.float32[s+2]=n,this.int16[l+6]=a,this.int16[l+7]=o,t}};oT.prototype.bytesPerElement=16,aj("StructArrayLayout2f1f2i16",oT);var oA=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,r,i,n,a,o)}emplace(t,r,i,n,a,o,s){let l=16*t,u=4*t,c=8*t;return this.uint8[l+0]=r,this.uint8[l+1]=i,this.float32[u+1]=n,this.float32[u+2]=a,this.int16[c+6]=o,this.int16[c+7]=s,t}};oA.prototype.bytesPerElement=16,aj("StructArrayLayout2ub2f2i16",oA);var oS=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,r,i)}emplace(t,r,i,n){let a=3*t;return this.uint16[a+0]=r,this.uint16[a+1]=i,this.uint16[a+2]=n,t}};oS.prototype.bytesPerElement=6,aj("StructArrayLayout3ui6",oS);var oC=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v){let _=this.length;return this.resize(_+1),this.emplace(_,t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v)}emplace(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_){let b=26*t,x=13*t,w=52*t;return this.int16[b+0]=r,this.int16[b+1]=i,this.uint16[b+2]=n,this.uint16[b+3]=a,this.uint32[x+2]=o,this.uint32[x+3]=s,this.uint32[x+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=h,this.float32[x+7]=f,this.float32[x+8]=d,this.uint8[w+36]=p,this.uint8[w+37]=m,this.uint8[w+38]=g,this.uint32[x+10]=y,this.int16[b+22]=v,this.float32[x+12]=_,t}};oC.prototype.bytesPerElement=52,aj("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",oC);var oM=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D){let P=this.length;return this.resize(P+1),this.emplace(P,t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D)}emplace(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D,P){let I=34*t,k=17*t;return this.int16[I+0]=r,this.int16[I+1]=i,this.int16[I+2]=n,this.int16[I+3]=a,this.int16[I+4]=o,this.int16[I+5]=s,this.int16[I+6]=l,this.int16[I+7]=u,this.uint16[I+8]=c,this.uint16[I+9]=h,this.uint16[I+10]=f,this.uint16[I+11]=d,this.uint16[I+12]=p,this.uint16[I+13]=m,this.uint16[I+14]=g,this.uint16[I+15]=y,this.uint16[I+16]=v,this.uint16[I+17]=_,this.uint16[I+18]=b,this.uint16[I+19]=x,this.uint16[I+20]=w,this.uint16[I+21]=E,this.uint16[I+22]=T,this.uint32[k+12]=A,this.float32[k+13]=S,this.float32[k+14]=C,this.uint16[I+30]=M,this.uint16[I+31]=D,this.float32[k+16]=P,t}};oM.prototype.bytesPerElement=68,aj("StructArrayLayout8i15ui1ul2f2ui1f68",oM);var oD=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[+t+0]=r,t}};oD.prototype.bytesPerElement=4,aj("StructArrayLayout1f4",oD);var oP=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,r,i)}emplace(t,r,i,n){let a=3*t;return this.uint16[6*t+0]=r,this.float32[a+1]=i,this.float32[a+2]=n,t}};oP.prototype.bytesPerElement=12,aj("StructArrayLayout1ui2f12",oP);var oI=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,r,i)}emplace(t,r,i,n){let a=4*t;return this.uint32[2*t+0]=r,this.uint16[a+2]=i,this.uint16[a+3]=n,t}};oI.prototype.bytesPerElement=8,aj("StructArrayLayout1ul2ui8",oI);var ok=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,r)}emplace(t,r,i){let n=2*t;return this.uint16[n+0]=r,this.uint16[n+1]=i,t}};ok.prototype.bytesPerElement=4,aj("StructArrayLayout2ui4",ok);var oO=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[+t+0]=r,t}};oO.prototype.bytesPerElement=2,aj("StructArrayLayout1ui2",oO);var oN=class extends ol{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,r,i,n)}emplace(t,r,i,n,a){let o=4*t;return this.float32[o+0]=r,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=a,t}};oN.prototype.bytesPerElement=16,aj("StructArrayLayout4f16",oN);var oL=class extends os{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}
57get anchorPoint(){return new eT(this.anchorPointX,this.anchorPointY)}};oL.prototype.size=20;var oR=class extends ow{get(t){return new oL(this,t)}};aj("CollisionBoxArray",oR);var oF=class extends os{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};oF.prototype.size=52;var oB=class extends oC{get(t){return new oF(this,t)}};aj("PlacedSymbolArray",oB);var oz=class extends os{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};oz.prototype.size=68;var oj=class extends oM{get(t){return new oz(this,t)}};aj("SymbolInstanceArray",oj);var oU=class extends oD{getoffsetX(t){return this.float32[+t+0]}};aj("GlyphOffsetArray",oU);var oV=class extends of{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}};aj("SymbolLineVertexArray",oV);var o$=class extends os{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};o$.prototype.size=12;var oG=class extends oP{get(t){return new o$(this,t)}};aj("TextAnchorOffsetArray",oG);var oq=class extends os{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};oq.prototype.size=8;var oH=class extends oI{get(t){return new oq(this,t)}};aj("FeatureIndexArray",oH);var oW=class extends oh{},oZ=class extends of{},oY=class extends od{},oX=class extends oh{},oK=class extends oh{},oQ=class extends op{},oJ=class extends om{},o0=class extends og{},o1=class extends oy{},o2=class extends ov{},o3=class extends o_{},o4=class extends ob{},o6=class extends ox{},o5=class extends oE{},o8=class extends oT{},o7=class extends oA{},o9=class extends oS{},se=class extends oS{},st=class extends ok{},sr=class extends oO{};let si=ou([{name:"a_pos",components:2,type:"Int16"}],4),sn=si.members;si.size,si.alignment;var sa=class t{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(r,i,n,a){let o=this.segments[this.segments.length-1];return r>t.MAX_VERTEX_ARRAY_LENGTH&&tI(`Max vertices per segment is ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${r}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${t.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+r>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==a?this.createNewSegment(i,n,a):o}createNewSegment(t,r,i){let n={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(t,r,i){return this.prepareSegment(0,t,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(r,i,n,a){return new t([{vertexOffset:r,primitiveOffset:i,vertexLength:n,primitiveLength:a,vaos:{},sortKey:0}])}};function so(t,r){return 256*(t=tv(Math.floor(t),0,255))+(r=tv(Math.floor(r),0,255))}sa.MAX_VERTEX_ARRAY_LENGTH=65535,aj("SegmentVector",sa);let ss=ou([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),sl=ou([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var su=eE((t,r)=>{void 0!==r&&(r.exports=function(t,r){for(var i,n,a=3&t.length,o=t.length-a,s=r,l=0;l<o;)n=255&t.charCodeAt(l)|(255&t.charCodeAt(++l))<<8|(255&t.charCodeAt(++l))<<16|(255&t.charCodeAt(++l))<<24,++l,s^=n=(65535&(n=(n=(65535&n)*0xcc9e2d51+(((n>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|n>>>17))*0x1b873593+(((n>>>16)*0x1b873593&65535)<<16)|0,s=(65535&(i=(65535&(s=s<<13|s>>>19))*5+(((s>>>16)*5&65535)<<16)|0))+27492+(((i>>>16)+58964&65535)<<16);switch(n=0,a){case 3:n^=(255&t.charCodeAt(l+2))<<16;case 2:n^=(255&t.charCodeAt(l+1))<<8;case 1:n^=255&t.charCodeAt(l),s^=n=(65535&(n=(n=(65535&n)*0xcc9e2d51+(((n>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|n>>>17))*0x1b873593+(((n>>>16)*0x1b873593&65535)<<16)|0}return s^=t.length,s^=s>>>16,s=(65535&s)*0x85ebca6b+(((s>>>16)*0x85ebca6b&65535)<<16)|0,s^=s>>>13,s=(65535&s)*0xc2b2ae35+(((s>>>16)*0xc2b2ae35&65535)<<16)|0,(s^=s>>>16)>>>0})}),sc=eE((t,r)=>{r.exports=function(t,r){for(var i,n=t.length,a=r^n,o=0;n>=4;)i=(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))*0x5bd1e995+(((i>>>16)*0x5bd1e995&65535)<<16),i^=i>>>24,a=(65535&a)*0x5bd1e995+(((a>>>16)*0x5bd1e995&65535)<<16)^(i=(65535&i)*0x5bd1e995+(((i>>>16)*0x5bd1e995&65535)<<16)),n-=4,++o;switch(n){case 3:a^=(255&t.charCodeAt(o+2))<<16;case 2:a^=(255&t.charCodeAt(o+1))<<8;case 1:a^=255&t.charCodeAt(o),a=(65535&a)*0x5bd1e995+(((a>>>16)*0x5bd1e995&65535)<<16)}return a^=a>>>13,a=(65535&a)*0x5bd1e995+(((a>>>16)*0x5bd1e995&65535)<<16),(a^=a>>>15)>>>0}}),sh=((t,r,i)=>{if(r&&"object"==typeof r||"function"==typeof r)for(var n,a=eb(r),o=0,s=a.length;o<s;o++)n=a[o],ew.call(t,n)||void 0===n||ev(t,n,{get:(t=>
vendor: 9,360 bytes, line 57
57r[t]).bind(null,n),enumerable:!(i=e_(r,n))||i.enumerable});return t})(ev(null==(U=eE((t,r)=>{var i=su(),n=sc();r.exports=i,r.exports.murmur3=i,r.exports.murmur2=n})())?{}:ey(ex(U)),"default",{value:U,enumerable:!0}),U),sf=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,i,n){this.ids.push(sd(t)),this.positions.push(r,i,n)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let r=sd(t),i=0,n=this.ids.length-1;for(;i<n;){let t=i+n>>1;this.ids[t]>=r?n=t:i=t+1}let a=[];for(;this.ids[i]===r;){let t=this.positions[3*i],r=this.positions[3*i+1],n=this.positions[3*i+2];a.push({index:t,start:r,end:n}),i++}return a}static serialize(t,r){let i=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(r,i,n,a){for(;n<a;){let o=r[n+a>>1],s=n-1,l=a+1;for(;;){do s++;while(r[s]<o)do l--;while(r[l]>o)if(s>=l)break;sp(r,s,l),sp(i,3*s,3*l),sp(i,3*s+1,3*l+1),sp(i,3*s+2,3*l+2)}l-n<a-l?(t(r,i,n,l),n=l+1):(t(r,i,l+1,a),a=l)}}(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(r){let i=new t;return i.ids=r.ids,i.positions=r.positions,i.indexed=!0,i}};function sd(t){let r=+t;return!isNaN(r)&&r<=0x20000000000000-1?r:(0,sh.default)(String(t))}function sp(t,r,i){let n=t[r];t[r]=t[i],t[i]=n}aj("FeaturePositionMap",sf);var sm=class{constructor(t,r){this.gl=t.gl,this.location=r}},sg=class extends sm{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},sy=class extends sm{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}},sv=class extends sm{constructor(t,r){super(t,r),this.current=[0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1])&&(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},s_=class extends sm{constructor(t,r){super(t,r),this.current=[0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2])&&(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},sb=class extends sm{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},sx=class extends sm{constructor(t,r){super(t,r),this.current=rH.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}},sw=class extends sm{constructor(t,r){super(t,r),this.current=[]}set(t){if(t!=this.current){this.current=t;let r=new Float32Array(4*t.length);for(let i=0;i<t.length;i++)r[4*i]=t[i].r,r[4*i+1]=t[i].g,r[4*i+2]=t[i].b,r[4*i+3]=t[i].a;this.gl.uniform4fv(this.location,r)}}},sE=class extends sm{constructor(t,r){super(t,r),this.current=[]}set(t){if(t!=this.current){this.current=t;let r=new Float32Array(t);this.gl.uniform1fv(this.location,r)}}};let sT=new Float32Array(16);var sA=class extends sm{constructor(t,r){super(t,r),this.current=sT}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);return}for(let r=1;r<16;r++)if(t[r]!==this.current[r]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}};function sS(t){return[so(255*t.r,255*t.g),so(255*t.b,255*t.a)]}var sC=class{constructor(t,r,i){this.value=t,this.uniformNames=r.map(t=>`u_${t}`),this.type=i}setUniform(t,r,i){t.set(i.constantOr(this.value))}getBinding(t,r,i){return"color"===this.type?new sx(t,r):new sy(t,r)}},sM=class{constructor(t,r){this.uniformNames=r.map(t=>`u_${t}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,r){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,r.y,r.height,r.width]}setUniform(t,r,i,n){let a=null;"u_pattern_to"===n?a=this.patternTo:"u_pattern_from"===n?a=this.patternFrom:"u_dasharray_to"===n?a=this.dashTo:"u_dasharray_from"===n?a=this.dashFrom:"u_pixel_ratio_to"===n?a=this.pixelRatioTo:"u_pixel_ratio_from"===n&&(a=this.pixelRatioFrom),null!==a&&t.set(a)}getBinding(t,r,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new sb(t,r):new sy(t,r)}},sD=class{constructor(t,r,i,n){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=r.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(t,r,i){let n=this.paintVertexArray.length,a=this.expression.evaluate(new aW(0,i),r,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(n,t,a)}updatePaintArray(t,r,i,n,a){let o=this.expression.evaluate(new aW(0,a),i,n);this._setPaintValue(t,r,o)}_setPaintValue(t,r,i){if("color"===this.type){let n=sS(i);for(let i=t;i<r;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let n=t;n<r;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},sP=class{constructor(t,r,i,n,a,o){this.expression=t,this.uniformNames=r.map(t=>`u_${t}_t`),this.type=i,this.useIntegerZoom=n,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=r.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(t,r,i){let n=this.expression.evaluate(new aW(this.zoom,i),r,{},i.canonical,[],i.formattedSection),a=this.expression.evaluate(new aW(this.zoom+1,i),r,{},i.canonical,[],i.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,n,a)}updatePaintArray(t,r,i,n,a){let o=this.expression.evaluate(new aW(this.zoom,a),i,n),s=this.expression.evaluate(new aW(this.zoom+1,a),i,n);this._setPaintValue(t,r,o,s)}_setPaintValue(t,r,i,n){if("color"===this.type){let a=sS(i),o=sS(n);for(let i=t;i<r;i++)this.paintVertexArray.emplace(i,a[0],a[1],o[0],o[1])}else{for(let a=t;a<r;a++)this.paintVertexArray.emplace(a,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(n))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let i=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,n=tv(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,r,i){return new sy(t,r)}},sI=class{constructor(t,r,i,n,a,o){this.expression=t,this.type=r,this.useIntegerZoom=i,this.zoom=n,this.layerId=o,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(t,r,i){let n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,this.getPositionIds(r),i)}updatePaintArray(t,r,i,n,a){this._setPaintValues(t,r,this.getPositionIds(i),a)}_setPaintValues(t,r,i,n){let a=this.getPositions(n);if(!a||!i)return;let o=a[i.min],s=a[i.mid],l=a[i.max];if(o&&s&&l)for(let i=t;i<r;i++)this.emplace(this.zoomInPaintVertexArray,i,o,s),this.emplace(this.zoomOutPaintVertexArray,i,l,s)}upload(t){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let r=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,r,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,r,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},sk=class extends sI{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns?.[this.layerId]}getVertexAttributes(){return ss.members}emplace(t,r,i,n){t.emplace(r,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],n.tlbr[0],n.tlbr[1],n.tlbr[2],n.tlbr[3],i.pixelRatio,n.pixelRatio)}},sO=class extends sI{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes?.[this.layerId]}getVertexAttributes(){return sl.members}emplace(t,r,i,n){t.emplace(r,0,i.y,i.height,i.width,0,n.y,n.height,n.width)}},sN=class{constructor(t,r,i){this.binders={},this._buffers=[];let n=[];for(let a in t.paint._values){if(!i(a))continue;let o=t.paint.get(a);if(!(o instanceof a0)||!nT(o.property.specification))continue;let s=function(t,r){return({"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
57pwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]})[t]||[t.replace(`${r}-`,"").replace(/-/g,"_")]}(a,t.type),l=o.value,u=o.property.specification.type,c=o.property.useIntegerZoom,h=o.property.specification["property-type"],f="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===l.kind)this.binders[a]=f?new sM(l.value,s):new sC(l.value,s,u),n.push(`/u_${a}`);else if("source"===l.kind||f){let i=sR(a,u,"source");this.binders[a]=f?"line-dasharray"===a?new sO(l,u,c,r,i,t.id):new sk(l,u,c,r,i,t.id):new sD(l,s,u,i),n.push(`/a_${a}`)}else{let t=sR(a,u,"composite");this.binders[a]=new sP(l,s,u,c,r,t),n.push(`/z_${a}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof sD||r instanceof sP?r.maxValue:0}populatePaintArrays(t,r,i){for(let n in this.binders){let a=this.binders[n];(a instanceof sD||a instanceof sP||a instanceof sI)&&a.populatePaintArray(t,r,i)}}setConstantPatternPositions(t,r){for(let i in this.binders){let n=this.binders[i];n instanceof sM&&n.setConstantPatternPositions(t,r)}}setConstantDashPositions(t,r){for(let i in this.binders){let n=this.binders[i];n instanceof sM&&n.setConstantDashPositions(t,r)}}updatePaintArrays(t,r,i,n,a){let o=!1;for(let s of t)for(let t of r.getPositions(s.id)){let r=i.feature(t.index);for(let i in this.binders){let l=this.binders[i];(l instanceof sD||l instanceof sP||l instanceof sI)&&!0===l.expression.isStateDependent&&(l.expression=n.paint.get(i).value,l.updatePaintArray(t.start,t.end,r,s.state,a),o=!0)}}return o}defines(){let t=[];for(let r in this.binders){let i=this.binders[r];
57(i instanceof sC||i instanceof sM)&&t.push(...i.uniformNames.map(t=>`#define HAS_UNIFORM_${t}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof sD||i instanceof sP)for(let r of i.paintVertexAttributes)t.push(r.name);else if(i instanceof sI)for(let r of i.getVertexAttributes())t.push(r.name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof sC||i instanceof sM||i instanceof sP)for(let r of i.uniformNames)t.push(r)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let i=[];for(let n in this.binders){let a=this.binders[n];if(a instanceof sC||a instanceof sM||a instanceof sP){for(let o of a.uniformNames)if(r[o]){let s=a.getBinding(t,r[o],o);i.push({name:o,property:n,binding:s})}}}return i}setUniforms(t,r,i,n){for(let{name:t,property:a,binding:o}of r)this.binders[a].setUniform(o,n,i.get(a),t)}updatePaintBuffers(t){for(let r in this._buffers=[],this.binders){let i=this.binders[r];if(t&&i instanceof sI){let r=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof sD||i instanceof sP)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(let r in this.binders){let i=this.binders[r];(i instanceof sD||i instanceof sP||i instanceof sI)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof sD||r instanceof sP||r instanceof sI)&&r.destroy()}}},sL=class{constructor(t,r,i=()=>!0){for(let n of(this.programConfigurations={},t))this.programConfigurations[n.id]=new sN(n,r,i);this.needsUpload=!1,this._featureMap=new sf,this._bufferOffset=0}populatePaintArrays(t,r,i,n){for(let i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,r,n);void 0!==r.id&&this._featureMap.add(r.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,i,n){for(let a of i)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,r,a,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function sR(t,r,i){return({"line-pattern":{source:o1,composite:o1},"fill-pattern":{source:o1,composite:o1},"fill-extrusion-pattern":{source:o1,composite:o1},"line-dasharray":{source:o2,composite:o2}})[t]?.[i]||({color:{source:og,composite:oN},number:{source:oD,composite:og}})[r][i]}aj("ConstantBinder",sC),aj("CrossFadedConstantBinder",sM),aj("SourceExpressionBinder",sD),aj("CrossFadedPatternBinder",sk),aj("CrossFadedDasharrayBinder",sO),aj("CompositeExpressionBinder",sP),aj("ProgramConfiguration",sN,{omit:["_buffers"]}),aj("ProgramConfigurationSet",sL);let sF=-16383-1;function sB(t){let r=8192/t.extent,i=t.loadGeometry();for(let t of i)for(let i of t){let t=Math.round(i.x*r),n=Math.round(i.y*r);i.x=tv(t,sF,16383),i.y=tv(n,sF,16383),(t<i.x||t>i.x+1||n<i.y||n>i.y+1)&&tI("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function sz(t,r){return{type:t.type,id:t.id,properties:t.properties,geometry:r?sB(t):[]}}var sj=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new oX,this.indexArray=new se,this.segments=new sa,this.programConfigurations=new sL(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,r,i){let n=this.layers[0],a=[],o=null,s=!1,l="heatmap"===n.type;"circle"===n.type&&(s=!(o=n.layout.get("circle-sort-key")).isConstant(),l||="map"===n.paint.get("circle-pitch-alignment"));let u=l?r.subdivisionGranularity.circle:1,c=new aW(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:r,id:n,index:l,sourceLayerIndex:u}of t){let t=sz(r,h);if(!this.layers[0]._featureFilter.filter(c,t,i))continue;let f=s?o.evaluate(t,{},i):void 0,d={id:n,properties:r.properties,type:r.type,sourceLayerIndex:u,index:l,geometry:h?t.geometry:sB(r),patterns:{},sortKey:f};a.push(d)}for(let n of(s&&a.sort((t,r)=>t.sortKey-r.sortKey),a)){let{geometry:a,index:o,sourceLayerIndex:s}=n,l=t[o].feature;this.addFeature(n,a,o,i,u),r.featureIndex.insert(l,a,o,s,this.index)}}update(t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:i})}addFeatures(t){}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,sn),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,i,n,a=1){let o;switch(a){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${a}; valid values are 1, 3, 5, 7.`)}let s=o.length;for(let i of r)for(let r of i){let i=r.x,n=r.y;if(i<0||i>=8192||n<0||n>=8192)continue;let a=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),h=a.vertexLength;for(let t=0;t<s;t++)for(let r=0;r<s;r++){var l,u,c;l=this.layoutVertexArray,u=o[r],c=o[t],l.emplaceBack(-32768+8*i+u,-32768+8*n+c)}for(let t=0;t<s-1;t++)for(let r=0;r<s-1;r++){let i=h+t*s+r,n=h+(t+1)*s+r;this.indexArray.emplaceBack(i,n+1,i+1),this.indexArray.emplaceBack(i,n,n+1)}a.vertexLength+=s*s,a.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:{},canonical:n})}};function sU(t,r){for(let i of t)if(sZ(r,i))return!0;for(let i of r)if(sZ(t,i))return!0;return sG(t,r)}function sV(t,r,i){return!!sZ(t,r)||sq(r,t,i)}function s$(t,r){if(1===t.length)return sW(r,t[0]);for(let i of r)for(let r of i)if(sZ(t,r))return!0;for(let i of t)if(sW(r,i))return!0;for(let i of r)if(sG(t,i))return!0;return!1}function sG(t,r){if(0===t.length||0===r.length)return!1;for(let s=0;s<t.length-1;s++){let l=t[s],u=t[s+1];for(let t=0;t<r.length-1;t++){var i,n,a,o;if(i=l,n=u,a=r[t],tk(i,a,o=r[t+1])!==tk(n,a,o)&&tk(i,n,a)!==tk(i,n,o))return!0}}return!1}function sq(t,r,i){let n=i*i;if(1===r.length)return t.distSqr(r[0])<n;for(let i=1;i<r.length;
vendor: 18,551 bytes, line 57
57i++)if(sH(t,r[i-1],r[i])<n)return!0;return!1}function sH(t,r,i){let n=r.distSqr(i);if(0===n)return t.distSqr(r);let a=((t.x-r.x)*(i.x-r.x)+(t.y-r.y)*(i.y-r.y))/n;return a<0?t.distSqr(r):a>1?t.distSqr(i):t.distSqr(i.sub(r)._mult(a)._add(r))}function sW(t,r){let i=!1,n,a;for(let o of t)for(let t=0,s=o.length-1;t<o.length;s=t++)n=o[t],a=o[s],n.y>r.y!=a.y>r.y&&r.x<(a.x-n.x)*(r.y-n.y)/(a.y-n.y)+n.x&&(i=!i);return i}function sZ(t,r){let i=!1;for(let n=0,a=t.length-1;n<t.length;a=n++){let o=t[n],s=t[a];o.y>r.y!=s.y>r.y&&r.x<(s.x-o.x)*(r.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function sY(t,r,i){let n=r.paint.get(t).value;return"constant"===n.kind?n.value:i.programConfigurations.get(r.id).getMaxValue(t)}function sX(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function sK(t,r,i,n,a){if(!r[0]&&!r[1])return t;let o=eT.convert(r)._mult(a);"viewport"===i&&o._rotate(-n);let s=[];for(let r of t)s.push(r.sub(o));return s}function sQ({queryGeometry:t,size:r},i){return sV(t,i,r)}function sJ({queryGeometry:t,size:r,transform:i,unwrappedTileID:n,getElevation:a},o){return sV(t,o,r*(i.projectTileCoordinates(o.x,o.y,n,a?.(o.x,o.y)).signedDistanceFromCamera/i.cameraToCenterDistance))}function s0({queryGeometry:t,size:r,transform:i,unwrappedTileID:n,getElevation:a},o){let s=i.projectTileCoordinates(o.x,o.y,n,a?.(o.x,o.y)).signedDistanceFromCamera,l=r*(i.cameraToCenterDistance/s);return sV(t,s3(o,i,n,a),l)}function s1({queryGeometry:t,size:r,transform:i,unwrappedTileID:n,getElevation:a},o){return sV(t,s3(o,i,n,a),r)}function s2({queryGeometry:t,size:r,transform:i,unwrappedTileID:n,getElevation:a,pitchAlignment:o="map",pitchScale:s="map"},l){let u="map"===o?"map"===s?sQ:sJ:"map"===s?s0:s1,c={queryGeometry:t,size:r,transform:i,unwrappedTileID:n,getElevation:a};for(let t of l)for(let r of t)if(u(c,r))return!0;return!1}function s3(t,r,i,n){let a=r.projectTileCoordinates(t.x,t.y,i,n?.(t.x,t.y)).point;return new eT((.5*a.x+.5)*r.width,(-(.5*a.y)+.5)*r.height)}aj("CircleBucket",sj,{omit:["layers"]});var s4={get paint(){return o||=new a9({"circle-radius":new a6(rt.paint_circle["circle-radius"],"circle-radius"),"circle-color":new a6(rt.paint_circle["circle-color"],"circle-color"),"circle-blur":new a6(rt.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new a6(rt.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new a4(rt.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new a4(rt.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new a4(rt.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new a4(rt.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new a6(rt.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new a6(rt.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new a6(rt.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")})},get layout(){return a||=new a9({"circle-sort-key":new a6(rt.layout_circle["circle-sort-key"],"circle-sort-key")})}},s6=class extends or{constructor(t,r){super(t,s4,r)}createBucket(t){return new sj(t)}queryRadius(t){return sY("circle-radius",this,t)+sY("circle-stroke-width",this,t)+sX(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:i,geometry:n,transform:a,pixelsToTileUnits:o,unwrappedTileID:s,getElevation:l}){let u=sK(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-a.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(r,i)+this.paint.get("circle-stroke-width").evaluate(r,i),h=this.paint.get("circle-pitch-scale"),f=this.paint.get("circle-pitch-alignment"),d,p;return"map"===f?(d=u,p=c*o):(d=u.map(t=>s3(t,a,s,l)),p=c),s2({queryGeometry:d,size:p,transform:a,unwrappedTileID:s,getElevation:l,pitchAlignment:f,pitchScale:h},n)}},s5=class extends sj{};aj("HeatmapBucket",s5,{omit:["layers"]});var s8={get paint(){return s||=new a9({"heatmap-radius":new a6(rt.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new a6(rt.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new a4(rt.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new a7(rt.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new a4(rt.paint_heatmap["heatmap-opacity"],"heatmap-opacity")})}};function s7(t,{width:r,height:i},n,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==r*i*n)throw RangeError(`mismatched image size. expected: ${a.length} but got: ${r*i*n}`)}else a=new Uint8Array(r*i*n);return t.width=r,t.height=i,t.data=a,t}function s9(t,{width:r,height:i},n){if(r===t.width&&i===t.height)return;let a=s7({},{width:r,height:i},n);le(t,a,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,r),height:Math.min(t.height,i)},n),t.width=r,t.height=i,t.data=a.data}function le(t,r,i,n,a,o){if(0===a.width||0===a.height)return r;if(a.width>t.width||a.height>t.height||i.x>t.width-a.width||i.y>t.height-a.height)throw RangeError("out of range source coordinates for image copy");if(a.width>r.width||a.height>r.height||n.x>r.width-a.width||n.y>r.height-a.height)throw RangeError("out of range destination coordinates for image copy");let s=t.data,l=r.data;if(s===l)throw Error("srcData equals dstData, so image is already copied");for(let u=0;u<a.height;u++){let c=((i.y+u)*t.width+i.x)*o,h=((n.y+u)*r.width+n.x)*o;for(let t=0;t<a.width*o;t++)l[h+t]=s[c+t]}return r}var lt=class t{constructor(t,r){s7(this,t,1,r)}resize(t){s9(this,t,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,i,n,a){le(t,r,i,n,a,1)}},lr=class t{constructor(t,r){s7(this,t,4,r)}resize(t){s9(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,i,n,a){le(t,r,i,n,a,4)}setPixel(t,r,i){let n=(t*this.width+r)*4;this.data[n+0]=Math.round(255*i.r/i.a),this.data[n+1]=Math.round(255*i.g/i.a),this.data[n+2]=Math.round(255*i.b/i.a),this.data[n+3]=Math.round(255*i.a)}};function li(t){let r=new Uint8Array(t.length);for(let i=0;i<t.length;i+=4){let n=t[i+3];r[i+0]=Math.round(t[i+0]*n/255),r[i+1]=Math.round(t[i+1]*n/255),r[i+2]=Math.round(t[i+2]*n/255),r[i+3]=n}return r}function ln(t){let r={},i=t.resolution||256,n=t.clips?t.clips.length:1,a=t.image||new lr({width:i,height:n});if(Math.log(i)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${i}`);let o=(n,o,s)=>{r[t.evaluationKey]=s;let l=t.expression.evaluate(r);a.setPixel(n/4/i,o/4,l)};if(t.clips)for(let r=0,a=0;r<n;++r,a+=4*i)for(let n=0,s=0;n<i;n++,s+=4){let l=n/(i-1),{start:u,end:c}=t.clips[r];o(a,s,u*(1-l)+c*l)}else for(let t=0,r=0;t<i;t++,r+=4)o(0,r,t/(i-1));return a}aj("AlphaImage",lt),aj("RGBAImage",lr);let la="big-fb";var lo=class extends or{createBucket(t){return new s5(t)}constructor(t,r){super(t,s8,r),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){let t=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=ln({expression:t,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(la)}queryRadius(t){return sY("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:i,geometry:n,transform:a,pixelsToTileUnits:o,unwrappedTileID:s,getElevation:l}){return s2({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(r,i)*o,transform:a,unwrappedTileID:s,getElevation:l},n)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}},ls={get paint(){return l||=new a9({"hillshade-illumination-direction":new a4(rt.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new a4(rt.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new a4(rt.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new a4(rt.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new a4(rt.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new a4(rt.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new a4(rt.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new a4(rt.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new a4(rt.paint_hillshade.resampling,"resampling")})}},ll=class extends or{constructor(t,r){super(t,ls,r),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,n=this.paint.get("hillshade-shadow-color").values,a=Math.max(t.length,r.length,i.length,n.length);t=t.concat(Array(a-t.length).fill(t.at(-1))),r=r.concat(Array(a-r.length).fill(r.at(-1))),i=i.concat(Array(a-i.length).fill(i.at(-1))),n=n.concat(Array(a-n.length).fill(n.at(-1)));let o=r.map(tz);return{directionRadians:t.map(tz),altitudeRadians:o,shadowColor:n,highlightColor:i}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}},lu={get paint(){return u||=new a9({"color-relief-opacity":new a4(rt["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new a7(rt["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new a4(rt["paint_color-relief"].resampling,"resampling")})}};function lc(t){return"data"in t}var lh=class{constructor(t,r,i,n){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(r,n)}update(t,r,i){let{width:n,height:a}=t,o=(this.size?.[0]!==n||this.size[1]!==a)&&!i,{context:s}=this,{gl:l}=s;this.useMipmap=!!r?.useMipmap,o&&this.size&&this.format===l.RGBA&&(l.deleteTexture(this.texture),this.texture=l.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let u=this.format===l.RGBA&&r?.premultiply!==!1;if(o)if(this.size=[n,a],this.format===l.RGBA&&n>0&&a>0){let r=this.useMipmap?Math.floor(Math.log2(Math.max(n,a)))+1:1;if(l.texStorage2D(l.TEXTURE_2D,r,l.RGBA8,n,a),lc(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:r}=t;u&&r&&(r=li(r)),r&&l.texSubImage2D(l.TEXTURE_2D,0,0,0,n,a,l.RGBA,l.UNSIGNED_BYTE,r)}else s.pixelStoreUnpackPremultiplyAlpha.set(u),l.texSubImage2D(l.TEXTURE_2D,0,0,0,l.RGBA,l.UNSIGNED_BYTE,t)}else lc(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,u,n,a,l)):(s.pixelStoreUnpackPremultiplyAlpha.set(u),this._uploadDomImage(t,l));else{let{x:r,y:o}=i||{x:0,y:0};lc(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,u,r,o,n,a,l)):(s.pixelStoreUnpackPremultiplyAlpha.set(u),this._updateDomImage(t,r,o,l))}this.useMipmap&&!(lc(t)&&null===t.data)&&l.generateMipmap(l.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,r){r.texImage2D(r.TEXTURE_2D,0,this.format,this.format,r.UNSIGNED_BYTE,t)}_uploadRawData(t,r,i,n,a){let{data:o}=t;r&&o&&(o=li(o)),a.texImage2D(a.TEXTURE_2D,0,this.format,i,n,0,this.format,a.UNSIGNED_BYTE,o)}_updateDomImage(t,r,i,n){n.texSubImage2D(n.TEXTURE_2D,0,r,i,n.RGBA,n.UNSIGNED_BYTE,t)}_updateRawData(t,r,i,n,a,o,s){let{data:l}=t;r&&l&&(l=li(l)),s.texSubImage2D(s.TEXTURE_2D,0,i,n,a,o,s.RGBA,s.UNSIGNED_BYTE,l)}bind(t,r,i){let{context:n}=this,{gl:a}=n;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),a.bindTexture(a.TEXTURE_2D,this.texture),i!==a.LINEAR_MIPMAP_NEAREST&&i!==a.LINEAR_MIPMAP_LINEAR||this.useMipmap||(i=a.LINEAR);let o=i||t;t!==this.magFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,t),this.magFilter=t),o!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,o),this.minFilter=o),r!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,r),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,r),this.wrap=r)}generateMipmap(){if(!this.useMipmap)return;let{gl:t}=this.context;t.bindTexture(t.TEXTURE_2D,this.texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}};function lf(t,r){let i=r[0],n=r[1],a=r[2],o=r[3],s=Math.min(i,n,a),l=Math.round((t+o)/s);return{r:Math.floor(l*s/i)%256,g:Math.floor(l*s/n)%256,b:Math.floor(l*s/a)%256}}aj("DEMData",class t{static{this.byteViewCache=new WeakMap}constructor(r,i,n,a=1,o=1,s=1,l=0){if(this.uid=r,i.height!==i.width)throw RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n))return void tI(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;let u=this.dim=i.height-4;switch(this.data=new Uint32Array(i.data.buffer),t.byteViewCache.set(this,new Uint8Array(this.data.buffer)),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=a,this.greenFactor=o,this.blueFactor=s,this.baseShift=l;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=-2;t<u+2;t++){let r=this._idx(0,Math.max(0,Math.min(u-1,t)));(t<0||t>=u)&&this.data.copyWithin(this._idx(0,t),r,r+u),this.data.fill(this.data[r],this._idx(-2,t),this._idx(0,t)),this.data.fill(this.data[r+u-1],this._idx(u,t),this._idx(u+1,t)+1)}let c=this._getByteView();this.min=0x20000000000000-1,this.max=-(0x20000000000000-1);for(let t=0;t<u;t++)for(let r=0;r<u;r++){let i=4*this._idx(t,r),n=this._unpackAtIndex(c,i);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(t,r){let i=this._getByteView(),n=4*this._idx(t,r);return this._unpackAtIndex(i,n)}sampleBilinear(t,r){let i=Math.floor(t),n=Math.floor(r);if(i<-1||i>=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),o=((n+2)*this.stride+i+2)*4,s=4*this.stride,l=t-i,u=r-n;return this._unpackAtIndex(a,o)*(1-l)*(1-u)+this._unpackAtIndex(a,o+4)*l*(1-u)+this._unpackAtIndex(a,o+s)*(1-l)*u+this._unpackAtIndex(a,o+s+4)*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-2||t>=this.dim+2||r<-2||r>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${r}, dim: ${this.dim}`);return(r+2)*this.stride+(t+2)}unpack(t,r,i){return t*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(t){return lf(t,this.getUnpackVector())}getPixels(){return new lr({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(t,r,i){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let n=r*this.dim,a=r*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(r){case -1:n=a-2;break;case 1:a=n+2}switch(i){case -1:o=s-2;break;case 1:s=o+2}let l=-r*this.dim,u=-i*this.dim;for(let r=o;r<s;r++)for(let i=n;i<a;i++)this.data[this._idx(i,r)]=t.data[this._idx(i+l,r+u)]}_getByteView(){let r=t.byteViewCache.get(this);return r?.buffer!==this.data.buffer&&(r=new Uint8Array(this.data.buffer),t.byteViewCache.set(this,r)),r}_unpackAtIndex(t,r){return this.unpack(t[r],t[r+1],t[r+2])}});var ld=class extends or{constructor(t,r){super(t,lu,r)}_createColorRamp(t){let r={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof nG&&i._styleExpression.expression instanceof io){this.colorRampExpression=i;let t=i._styleExpression.expression;for(let i of(r.elevationStops=t.labels,r.colorStops=[],r.elevationStops))r.colorStops.push(t.evaluate({globals:{elevation:i}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[rH.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=t)return r;let n={elevationStops:[],colorStops:[]},a=(r.elevationStops.length-1)/(t-1);for(let t=0;t<r.elevationStops.length-.5;t+=a)n.elevationStops.push(r.elevationStops[Math.round(t)]),n.colorStops.push(r.colorStops[Math.round(t)]);return tI(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${r.elevationStops.length}`),n}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,r,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let n=this._createColorRamp(r),a=new lr({width:n.colorStops.length,height:1}),o=new lr({width:n.colorStops.length,height:1});for(let t=0;t<n.elevationStops.length;t++){let r=lf(n.elevationStops[t],i);o.setPixel(0,t,new rH(r.r/255,r.g/255,r.b/255,1)),a.setPixel(0,t,n.colorStops[t])}return this.colorRampTextures={elevationTexture:new lh(t,o,t.gl.RGBA),colorTexture:new lh(t,a,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};let lp=ou([{name:"a_pos",components:2,type:"Int16"}],4),lm=lp.members;function lg(t,r,i){let n=i.patternDependencies,a=!1;for(let i of r){let r=i.paint.get(`${t}-pattern`);r.isConstant()||(a=!0);let o=r.constantOr(null);o&&(a=!0,n[o.to]=!0,n[o.from]=!0)}return a}function ly(t,r,i,n,a){let{zoom:o}=n,s=a.patternDependencies;for(let n of r){let r=n.paint.get(`${t}-pattern`).value;if("constant"!==r.kind){let t=r.evaluate({zoom:o-1},i,{},a.availableImages),l=r.evaluate({zoom:o},i,{},a.availableImages),u=r.evaluate({zoom:o+1},i,{},a.availableImages);t=t?.name?t.name:t,l=l?.name?l.name:l,u=u?.name?u.name:u,s[t]=!0,s[l]=!0,s[u]=!0,i.patterns[n.id]={min:t,mid:l,max:u}}}return i}lp.size,lp.alignment;let lv=new Set,l_=!1;function lb(t,r,i,n,a){let o=null;if(a===function(t,r,i,n){let a=0;for(let o=r,s=i-n;o<i;o+=n)a+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return a}(t,r,i,n)>0)for(let a=r;a<i;a+=n)o=lq(a/n|0,t[a],t[a+1],o);else for(let a=i-n;a>=r;a-=n)o=lq(a/n|0,t[a],t[a+1],o);return o&&lj(o,o.next)&&(lH(o),o=o.next),o}
57function lx(t,r=t){let i=r===t,n=t,a;do a=!1,n!==n.next&&(0===lv.size||!lv.has(n))&&(lj(n,n.next)||0===lz(n.prev,n,n.next))?((i||n===r)&&(r=n.prev),l_=!0,lH(n),n=n.prev,a=!0):(i||n!==r)&&(n=n.next,a=!i);while(a||n!==r)return r}let lw=!1;function lE(t,r){return t.x-r.x||t.y-r.y||(t.next.y-t.y)/(t.next.x-t.x)-(r.next.y-r.y)/(r.next.x-r.x)}let lT=new Float64Array,lA=0,lS=[],lC=[];function lM(t,r){let i=t;do{let t=lA++;lS[t]=i;let n=1/0,a=1/0,o=-1/0,s=-1/0,l=0;do{let r=i.next;i.z=t,i.x<n&&(n=i.x),i.x>o&&(o=i.x),i.y<a&&(a=i.y),i.y>s&&(s=i.y),r.x<n&&(n=r.x),r.x>o&&(o=r.x),r.y<a&&(a=r.y),r.y>s&&(s=r.y),i=r}while(++l<16&&i!==r)lC[t]=i;let u=4*t;lT[u]=n,lT[u+1]=a,lT[u+2]=o,lT[u+3]=s}while(i!==r)}function lD(t){let r=lC[t];for(;r.prev.next!==r;)r=r.next;return lC[t]=r,r}function lP(t){let r=lS[t];for(;r.prev.next!==r;)r=r.next;return lS[t]=r,r}let lI=[],lk=[],lO=new Uint32Array,lN=new Uint32Array,lL=new Uint32Array(256);function lR(t,r,i,n,a,o){lL.fill(0);for(let r=0;r<t;r++)lL[i[r]>>>o&255]++;let s=0;for(let t=0;t<256;t++){let r=lL[t];lL[t]=s,s+=r}for(let s=0;s<t;s++){let t=i[s],l=lL[t>>>o&255]++;n[l]=r[s],a[l]=t}}function lF(t,r,i,n,a){return(t=((t=((t=((t=((t=(t-i)*a|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(r=((r=((r=((r=((r=(r-n)*a|0)|r<<8)&0xff00ff)|r<<4)&0xf0f0f0f)|r<<2)&0x33333333)|r<<1)&0x55555555)<<1}function lB(t,r,i,n,a,o,s,l){return(a-s)*(r-l)>=(t-s)*(o-l)&&(t-s)*(n-l)>=(i-s)*(r-l)&&(i-s)*(o-l)>=(a-s)*(n-l)}function lz(t,r,i){return(r.y-t.y)*(i.x-r.x)-(r.x-t.x)*(i.y-r.y)}function lj(t,r){return t.x===r.x&&t.y===r.y}function lU(t,r,i,n,a=!0){let o=lz(t,r,i),s=lz(t,r,n),l=lz(i,n,t),u=lz(i,n,r);return(o>0&&s<0||o<0&&s>0)&&(l>0&&u<0||l<0&&u>0)||!!a&&!!(0===o&&lV(t,i,r)||0===s&&lV(t,n,r)||0===l&&lV(i,t,n)||0===u&&lV(i,r,n))}function lV(t,r,i){return r.x<=Math.max(t.x,i.x)&&r.x>=Math.min(t.x,i.x)&&r.y<=Math.max(t.y,i.y)&&r.y>=Math.min(t.y,i.y)}function l$(t,r){return 0>lz(t.prev,t,t.next)?lz(t,r,t.next)>=0&&lz(t,t.prev,r)>=0:0>lz(t,r,t.prev)||0>lz(t,t.next,r)}function lG(t,r){let i=lW(t.i,t.x,t.y),n=lW(r.i,r.x,r.y),a=t.next,o=r.prev;return t.next=r,r.prev=t,i.next=a,a.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function lq(t,r,i,n){let a=lW(t,r,i);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function lH(t){var r,i;let n;t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),lw&&(r=t.prev,i=t.next,n=4*r.z,i.x<lT[n]&&(lT[n]=i.x),i.y<lT[n+1]&&(lT[n+1]=i.y),i.x>lT[n+2]&&(lT[n+2]=i.x),i.y>lT[n+3]&&(lT[n+3]=i.y))}function lW(t,r,i){return{i:t,x:r,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null}}var lZ=class{constructor(t,r){if(r>t)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}},lY=class t{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}static{this.noSubdivision=new t({fill:new lZ(0,0),line:new lZ(0,0),tile:new lZ(0,0),stencil:new lZ(0,0),circle:1})}};aj("SubdivisionGranularityExpression",lZ),aj("SubdivisionGranularitySetting",lY);var lX=class{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=8192/t,this._canonical=r}_getKey(t,r){return t+=32768,(r+=32768)|t<<16}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let i=0|Math.round(t),n=0|Math.round(r),a=this._getKey(i,n),o=this._vertexDictionary.get(a);if(void 0!==o)return o;let s=this._vertexBuffer.length/2;return this._vertexDictionary.set(a,s),this._vertexBuffer.push(i,n),s}_subdivideTrianglesScanline(t,r){if(this._granularity<2)return function(t,r){let i=[];for(let n=0;n<r.length;n+=3){let a=r[n],o=r[n+1],s=r[n+2],l=t[2*a],u=t[2*a+1],c=t[2*o],h=t[2*o+1],f=t[2*s],d=t[2*s+1],p=h-u;(c-l)*(d-u)-p*(f-l)>0?(i.push(a),i.push(s),i.push(o)):(i.push(a),i.push(o),i.push(s))}return i}(this._vertexBuffer,function(t,r){let i=Array(t.length);for(let n=0;n<t.length;n++)i[n]=r[t[n]];return i}(t,r));let i=[],n=t.length;for(let a=0;a<n;a+=3){let n=[r[t[a+0]],r[t[a+1]],r[t[a+2]]],o=[this._vertexBuffer[2*n[0]+0],this._vertexBuffer[2*n[0]+1],this._vertexBuffer[2*n[1]+0],this._vertexBuffer[2*n[1]+1],this._vertexBuffer[2*n[2]+0],this._vertexBuffer[2*n[2]+1]],s=1/0,l=1/0,u=-1/0,c=-1/0;for(let t=0;t<3;t++){let r=o[2*t],i=o[2*t+1];
57s=Math.min(s,r),u=Math.max(u,r),l=Math.min(l,i),c=Math.max(c,i)}if(s===u||l===c)continue;let h=Math.floor(s/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize),d=Math.floor(l/this._granularityCellSize),p=Math.ceil(c/this._granularityCellSize);if(h===f&&d===p){i.push(...n);continue}for(let t=d;t<p;t++){let r=this._scanlineGenerateVertexRingForCellRow(t,o,n);!function(t,r,i){if(0===r.length)throw Error("Subdivision vertex ring is empty.");let n=0,a=t[2*r[0]];for(let i=1;i<r.length;i++){let o=t[2*r[i]];o<a&&(a=o,n=i)}let o=r.length,s=n,l=(s+1)%o;for(;;){let n=s-1>=0?s-1:o-1,a=(l+1)%o,u=t[2*r[n]],c=t[2*r[n]+1],h=t[2*r[a]],f=t[2*r[a]+1],d=t[2*r[s]],p=t[2*r[s]+1],m=t[2*r[l]],g=t[2*r[l]+1],y=!1;if(u<h)y=!0;else if(u>h)y=!1;else{let t=g-p,r=-(m-d),i=p<g?1:-1;((u-d)*t+(c-p)*r)*i>((h-d)*t+(f-p)*r)*i&&(y=!0)}if(y){let t=r[n],a=r[s],u=r[l];t!==a&&t!==u&&a!==u&&i.push(u,a,t),--s<0&&(s=o-1)}else{let t=r[a],n=r[s],u=r[l];t!==n&&t!==u&&n!==u&&i.push(u,n,t),++l>=o&&(l=0)}if(n===a)break}}(this._vertexBuffer,r,i)}}return i}_scanlineGenerateVertexRingForCellRow(t,r,i){let n=t*this._granularityCellSize,a=n+this._granularityCellSize,o=[];for(let t=0;t<3;t++){let s=r[2*t],l=r[2*t+1],u=r[(t+1)*2%6],c=r[((t+1)*2+1)%6],h=r[(t+2)*2%6],f=r[((t+2)*2+1)%6],d=u-s,p=c-l,m=0===d,g=0===p,y=(n-l)/p,v=(a-l)/p,_=Math.min(y,v),b=Math.max(y,v);if(!g&&(_>=1||b<=0)||g&&(l<n||l>a)){c>=n&&c<=a&&o.push(i[(t+1)%3]);continue}if(!g&&_>0){let t=s+d*_,r=l+p*_;o.push(this._vertexToIndex(t,r))}let x=s+d*Math.max(_,0),w=s+d*Math.min(b,1);if(m||this._generateIntraEdgeVertices(o,s,l,u,c,x,w),!g&&b<1){let t=s+d*b,r=l+p*b;o.push(this._vertexToIndex(t,r))}(g||c>=n&&c<=a)&&o.push(i[(t+1)%3]),!g&&(c<=n||c>=a)&&this._generateInterEdgeVertices(o,s,l,u,c,h,f,w,n,a)}return o}_generateIntraEdgeVertices(t,r,i,n,a,o,s){let l=n-r,u=a-i,c=0===u,h=c?Math.min(r,n):Math.min(o,s),f=c?Math.max(r,n):Math.max(o,s),d=Math.floor(h/this._granularityCellSize)+1,p=Math.ceil(f/this._granularityCellSize)-1;if(c?r<n:o<s)for(let n=d;n<=p;n++){let a=n*this._granularityCellSize,o=i+u*(a-r)/l;t.push(this._vertexToIndex(a,o))}else for(let n=p;n>=d;n--){let a=n*this._granularityCellSize,o=i+u*(a-r)/l;t.push(this._vertexToIndex(a,o))}}_generateInterEdgeVertices(t,r,i,n,a,o,s,l,u,c){let h=s-a,f=(u-a)/h,d=(c-a)/h,p=Math.min(f,d),m=Math.max(f,d),g=n+(o-n)*p,y=Math.floor(Math.min(g,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,l)/this._granularityCellSize)-1,_=l<g,b=0===h;if(b&&(s===u||s===c))return;if(b||p>=1||m<=0){let t=i-s,n=o+(r-o)*Math.min((u-s)/t,(c-s)/t);y=Math.floor(Math.min(n,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(n,l)/this._granularityCellSize)-1,_=l<n}let x=a-i>0?c:u;if(_)for(let r=y;r<=v;r++){let i=r*this._granularityCellSize;t.push(this._vertexToIndex(i,x))}else for(let r=v;r>=y;r--){let i=r*this._granularityCellSize;t.push(this._vertexToIndex(i,x))}}_generateOutline(t,r){let i=[],n=0;for(let a of t){let t=this._granularity<2?this._ringPathIndices(a,n,r):this._pointArrayToIndices(lQ(a,this._granularity,!0));n+=a.length;let o=[];for(let r=1;r<t.length;r++)o.push(t[r-1]),o.push(t[r]);i.push(o)}return i}_ringPathIndices(t,r,i){let n=i.slice(r,r+t.length);return n.length>=2&&lJ(t)&&n.push(n[0]),n}_handlePoles(t){let r=!1,i=!1;this._canonical&&(0===this._canonical.y&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(r||i)&&this._fillPoles(t,r,i)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){let i=t[r+1];-32768===i&&(t[r+1]=-32767),32767===i&&(t[r+1]=32766)}}_generatePoleQuad(t,r,i,n,a,o){n>a==(-32768===o)?(t.push(i),t.push(r),t.push(this._vertexToIndex(n,o)),t.push(this._vertexToIndex(a,o)),t.push(i)):(t.push(r),t.push(i),t.push(this._vertexToIndex(n,o)),t.push(i),t.push(this._vertexToIndex(a,o))),t.push(this._vertexToIndex(n,o))}_fillPoles(t,r,i){let n=this._vertexBuffer,a=t.length;for(let o=2;o<a;o+=3){let a=t[o-2],s=t[o-1],l=t[o],u=n[2*a],c=n[2*a+1],h=n[2*s],f=n[2*s+1],d=n[2*l],p=n[2*l+1];r&&(0===c&&0===f&&this._generatePoleQuad(t,a,s,u,h,-32768),0===f&&0===p&&this._generatePoleQuad(t,s,l,h,d,-32768),0===p&&0===c&&this._generatePoleQuad(t,l,a,d,u,-32768)),i&&(8192===c&&8192===f&&this._generatePoleQuad(t,a,s,u,h,32767),8192===f&&8192===p&&this._generatePoleQuad(t,s,l,h,d,32767),8192===p&&8192===c&&this._generatePoleQuad(t,l,a,d,u,32767))}}_initializeVertices(t){let r=[];for(let i=0;i<t.length;i+=2)r.push(this._vertexToIndex(t[i],t[i+1]));return r}subdividePolygonInternal(t,r){if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:i,holeIndices:n}=function(t){let r=[],i=[];for(let n of t)if(0!==n.length)for(let a of(n!==t[0]&&r.push(i.length/2),n))i.push(a.x),i.push(a.y);return{flattened:i,holeIndices:r}}(t),a=this._initializeVertices(i),o;try{let t=function(t,r,i=2){let n=r&&r.length,a=n?r[0]*i:t.length;lv.size&&lv.clear();let o=lb(t,0,a,i,!0),s=[];if(!o||o.next===o.prev)return s;let l=0,u=0,c=0;if(n&&(o=function(t,r,i,n){var a,o;let s,l=[];for(let i=0,a=r.length;i<a;i++){let o=lb(t,r[i]*n,i<a-1?r[i+1]*n:t.length,n,!1);o===o.next&&lv.add(o),l.push(function(t){let r=t,i=t;do(r.x<i.x||r.x===i.x&&r.y<i.y)&&(i=r),r=r.next;while(r!==t)return i}(o))}l.sort(lE),a=t.length/n,o=r.length,s=Math.ceil((a+2*o)/16)+o+2,lT.length<4*s&&(lT=ne
57w Float64Array(4*s)),lA=0,lM(i,i),lw=!0;for(let t=0;t<l.length;t++)i=function(t,r){let i=function(t,r){let i=r,n=t.x,a=t.y,o=-1/0,s;if(lj(t,i))return i;for(let r=0,l=0;r<lA;r++,l+=4){if(a<lT[l+1]||a>lT[l+3]||lT[l]>n||lT[l+2]<=o)continue;let u=lD(r);i=lP(r);do{if(i.prev.next===i){if(lj(t,i.next))return i.next;if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let t=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o&&(o=t,s=i.x<i.next.x?i:i.next,t===n))return s}}i=i.next}while(i!==u)}if(!s)return null;let l=s.x,u=s.y,c=Math.min(a,u),h=Math.max(a,u),f=1/0;for(let r=0,m=0;r<lA;r++,m+=4){if(lT[m+2]<l||lT[m]>n||lT[m+3]<c||lT[m+1]>h)continue;let g=lD(r);i=lP(r);do{if(i.prev.next===i&&n>=i.x&&i.x>=l&&n!==i.x&&lB(a<u?n:o,a,l,u,a<u?o:n,a,i.x,i.y)){var d,p;let r=Math.abs(a-i.y)/(n-i.x);(l$(i,t)||i.y===a&&i.next.y===a&&i.next.x>n)&&(r<f||r===f&&(i.x>s.x||i.x===s.x&&(d=s,p=i,0>lz(d.prev,d,p.prev)&&0>lz(p.next,d,d.next))))&&(s=i,f=r)}i=i.next}while(i!==g)}return s}(t,r);if(!i)return r;let n=lG(i,t);return lM(i,n.next.next),lx(n,n.next),lx(i,i.next)}(l[t],i);return lw=!1,lx(i)}(t,r,o,i)),t.length>80*i){l=t[0],u=t[1];let r=l,n=u;for(let o=i;o<a;o+=i){let i=t[o],a=t[o+1];i<l&&(l=i),a<u&&(u=a),i>r&&(r=i),a>n&&(n=a)}c=0===(c=Math.max(r-l,n-u))?0:32767/c}return function t(r,i,n,a,o){o&&function(t,r,i,n){let a=t,o=0;do a.z=lF(a.x,a.y,r,i,n),lI[o++]=a,a=a.next;while(a!==t)!function(t){if(t<=32){for(let r=1;r<t;r++){let t=lI[r],i=t.z,n=r-1;for(;n>=0&&lI[n].z>i;)lI[n+1]=lI[n],n--;lI[n+1]=t}return}lO.length<t&&(lO=new Uint32Array(t),lN=new Uint32Array(t),lk=Array(t));for(let r=0;r<t;r++)lO[r]=lI[r].z;lR(t,lI,lO,lk,lN,0),lR(t,lk,lN,lI,lO,8),lR(t,lI,lO,lk,lN,16),lR(t,lk,lN,lI,lO,24)}(o);let s=null;for(let t=0;t<o;t++){let r=lI[t];r.prevZ=s,s&&(s.nextZ=r),s=r}s.nextZ=null}(r,n,a,o);let s=r,l=!1;for(;r.prev!==r.next;){let u=r.prev,c=r.next;if(0>lz(u,r,c)&&(o?function(t,r,i,n){let a=t.prev,o=t.next,s=a.x,l=t.x,u=o.x,c=a.y,h=t.y,f=o.y,d=Math.min(s,l,u),p=Math.min(c,h,f),m=Math.max(s,l,u),g=Math.max(c,h,f),y=lF(d,p,r,i,n),v=lF(m,g,r,i,n),_=t.prevZ;for(;_&&_.z>=y;){if(_.x>=d&&_.x<=m&&_.y>=p&&_.y<=g&&_!==o&&(s!==_.x||c!==_.y)&&lB(s,c,l,h,u,f,_.x,_.y)&&lz(_.prev,_,_.next)>=0)return!1;_=_.prevZ}let b=t.nextZ;for(;b&&b.z<=v;){if(b.x>=d&&b.x<=m&&b.y>=p&&b.y<=g&&b!==o&&(s!==b.x||c!==b.y)&&lB(s,c,l,h,u,f,b.x,b.y)&&lz(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(r,n,a,o):function(t){let r=t.prev,i=t.next,n=r.x,a=t.x,o=i.x,s=r.y,l=t.y,u=i.y,c=Math.min(n,a,o),h=Math.min(s,l,u),f=Math.max(n,a,o),d=Math.max(s,l,u),p=i.next;for(;p!==r;){if(p.x>=c&&p.x<=f&&p.y>=h&&p.y<=d&&(n!==p.x||s!==p.y)&&lB(n,s,a,l,o,u,p.x,p.y)&&lz(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(r))){i.push(u.i,r.i,c.i),lH(r),r=c,s=c;continue}if((r=c)===s){if(l_=!1,r=lx(r),l_){s=r;continue}if(!l){s=r=function(t,r){let i=t,n=!1;do{let a=i.prev,o=i.next.next;lU(a,i,i.next,o,!1)&&l$(a,o)&&l$(o,a)&&(r.push(a.i,i.i,o.i),lH(i),lH(i.next),i=t=o,n=!0),i=i.next}while(i!==t)return n?lx(i):i}(r,i),l=!0;continue}!function(r,i,n,a,o){let s=r;do{let r=s.next.next;for(;r!==s.prev;){if(s.i!==r.i&&function(t,r){let i=lj(t,r)&&lz(t.prev,t,t.next)>0&&lz(r.prev,r,r.next)>0;return t.next.i!==r.i&&(i||l$(t,r)&&l$(r,t)&&(0!==lz(t.prev,t,r.prev)||0!==lz(t,r.prev,r)))&&!function(t,r){let i=Math.min(t.x,r.x),n=Math.max(t.x,r.x),a=Math.min(t.y,r.y),o=Math.max(t.y,r.y),s=t;do{let l=s.next;if(s.x>n&&l.x>n||s.x<i&&l.x<i||s.y>o&&l.y>o||s.y<a&&l.y<a){s=l;continue}if(s.i!==t.i&&l.i!==t.i&&s.i!==r.i&&l.i!==r.i&&lU(s,l,t,r))return!0;s=l}while(s!==t)return!1}(t,r)&&(i||function(t,r){let i=t,n=!1,a=(t.x+r.x)/2,o=(t.y+r.y)/2;do{let t=i.next;i.y>o!=t.y>o&&a<(t.x-i.x)*(o-i.y)/(t.y-i.y)+i.x&&(n=!n),i=t}while(i!==t)return n}(t,r))}(s,r)){let l=lG(s,r);s=lx(s,s.next),l=lx(l,l.next),t(s,i,n,a,o),t(l,i,n,a,o);return}r=r.next}s=s.next}while(s!==r)}(r,i,n,a,o);break}}}(o,s,l,u,c),s}(i,n);o=this._subdivideTrianglesScanline(t,a)}catch(t){console.error(t)}let s=[];return r&&(s=this._generateOutline(t,a)),this._ensureNoPoleVertices(),this._handlePoles(o),this._granularity>=2&&this._canonical?.z===0&&(o=this._removeTrianglesOutsideTileX(o),s=s.map(t=>this._removeLinesOutsideTileX(t))),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:s}}_vertexOutsideTileX(t){let r=this._vertexBuffer[2*t];return r<0||r>8192}_removeTrianglesOutsideTileX(t){let r=[];for(let i=0;i<t.length;i+=3)this._vertexOutsideTileX(t[i])||this._vertexOutsideTileX(t[i+1])||this._vertexOutsideTileX(t[i+2])||r.push(t[i],t[i+1],t[i+2]);return r}_removeLinesOutsideTileX(t){let r=[];for(let i=0;i<t.length;i+=2)this._vertexOutsideTileX(t[i])||this._vertexOutsideTileX(t[i+1])||r.push(t[i],t[i+1]);return r}_pointArrayToIndices(t){let r=[];for(let i of t)r.push(this._vertexToIndex(i.x,i.y));return r}};function lK(t,r,i,n=!0){return new lX(i,r).subdividePolygonInternal(t,n)}function lQ(t,r,i=!1){if(!t||t.length<1||t.length<2)return[];let n=i&&lJ(t);if(r<2)return n?[...t,t[0]]:[...t];let a=Math.floor(8192/r),o=[];o.push(new eT(t[0].x,t[0].y));let s=t.length,l=n?s:s-1;for(let r=0;r<l;r++){let i=t[r],n=r<s-1?t[r+1]:t[0],l=i.x,u=i.y,c=n.x,h=n.y,f=l!==c,d=u!==h;if(!f&&!d)continue;let p=c-l,m=h-u,g=Math.abs(p),y=Math.abs(m),v=l,_=u;for(;;){let t=p>0?(Math.floor(v/a)+1)*a:(Math.ceil(v/a)-1)*a,r=m>0?(Math.floor(_/a)+1)*a:(Math.ceil(_/a)-1)*a,i=Math.abs(v-t),n=Math.abs(_-r),s=Math.abs(_-h),l=f?i/g:1/0,u=d?n/y:1/0;
57if((Math.abs(v-c)<=i||!f)&&(s<=n||!d))break;if(l<u&&f||!d){let r=new eT(v=t,Math.round(_+=m*l));(o[o.length-1].x!==r.x||o[o.length-1].y!==r.y)&&o.push(r)}else{let t=new eT(Math.round(v+=p*u),_=r);(o[o.length-1].x!==t.x||o[o.length-1].y!==t.y)&&o.push(t)}}let b=new eT(c,h);(o[o.length-1].x!==b.x||o[o.length-1].y!==b.y)&&o.push(b)}return o}function lJ(t){return!t[0].equals(t[t.length-1])}function l0(t,r,i,n,a,o,s,l,u){let c=a.length/2,h=s&&l&&u;if(c<sa.MAX_VERTEX_ARRAY_LENGTH){let f,d,p=r.prepareSegment(c,i,n),m=p.vertexLength;for(let t=0;t<o.length;t+=3)n.emplaceBack(m+o[t],m+o[t+1],m+o[t+2]);p.vertexLength+=c,p.primitiveLength+=o.length/3,h&&(f=(d=s.prepareSegment(c,i,l)).vertexLength,d.vertexLength+=c);for(let r=0;r<a.length;r+=2)t(a[r],a[r+1]);if(h)for(let t of u){for(let r=1;r<t.length;r+=2)l.emplaceBack(f+t[r-1],f+t[r]);d.primitiveLength+=t.length/2}}else(function(t,r,i,n,a,o){let s=[];for(let t=0;t<n.length/2;t++)s.push(-1);let l={count:0},u=0,c=t.getOrCreateLatestSegment(r,i),h=c.vertexLength;for(let f=2;f<a.length;f+=3){let d=a[f-2],p=a[f-1],m=a[f],g=s[d]<u,y=s[p]<u,v=s[m]<u,_=+!!g+ +!!y+ +!!v;c.vertexLength+_>sa.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(r,i),u=l.count,g=!0,y=!0,v=!0,h=0);let b=l1(s,n,o,l,d,g,c),x=l1(s,n,o,l,p,y,c),w=l1(s,n,o,l,m,v,c);i.emplaceBack(h+b-u,h+x-u,h+w-u),c.primitiveLength++}})(r,i,n,a,o,t),h&&function(t,r,i,n,a,o){let s=[];for(let t=0;t<n.length/2;t++)s.push(-1);let l={count:0},u=0,c=t.getOrCreateLatestSegment(r,i),h=c.vertexLength;for(let f of a)for(let a=1;a<f.length;a+=2){let d=f[a-1],p=f[a],m=s[d]<u,g=s[p]<u,y=+!!m+ +!!g;c.vertexLength+y>sa.MAX_VERTEX_ARRAY_LENGTH&&(c=t.createNewSegment(r,i),u=l.count,m=!0,g=!0,h=0);let v=l1(s,n,o,l,d,m,c),_=l1(s,n,o,l,p,g,c);i.emplaceBack(h+v-u,h+_-u),c.primitiveLength++}}(s,i,l,a,u,t),r.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function l1(t,r,i,n,a,o,s){if(o){let o=n.count;return i(r[2*a],r[2*a+1]),t[a]=n.count,n.count++,s.vertexLength++,o}return t[a]}var l2=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new oK,this.indexArray=new se,this.indexArray2=new st,this.programConfigurations=new sL(t.layers,t.zoom),this.segments=new sa,this.segments2=new sa,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,r,i){this.hasDependencies=lg("fill",this.layers,r);let n=this.layers[0].layout.get("fill-sort-key"),a=!n.isConstant(),o=[],s=new aW(this.zoom),l=this.layers[0]._featureFilter.needGeometry;for(let{feature:u,id:c,index:h,sourceLayerIndex:f}of t){let t=sz(u,l);if(!this.layers[0]._featureFilter.filter(s,t,i))continue;let d=a?n.evaluate(t,{},i,r.availableImages):void 0,p={id:c,properties:u.properties,type:u.type,sourceLayerIndex:f,index:h,geometry:l?t.geometry:sB(u),patterns:{},sortKey:d};o.push(p)}for(let n of(a&&o.sort((t,r)=>t.sortKey-r.sortKey),o)){let{geometry:a,index:o,sourceLayerIndex:s}=n;if(this.hasDependencies){let t=ly("fill",this.layers,n,{zoom:this.zoom},r);this.patternFeatures.push(t)}else this.addFeature(n,a,o,i,{},r.subdivisionGranularity);let l=t[o].feature;r.featureIndex.insert(l,a,o,s,this.index)}}update(t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:i})}addFeatures({options:t,canonical:r,patternPositions:i,patternMap:n}){for(let a of(this.detectSdfPatterns(n),this.patternFeatures))this.addFeature(a,a.geometry,a.index,r,i,t.subdivisionGranularity)}detectSdfPatterns(t){for(let r of this.patternFeatures)for(let i in r.patterns){let n=r.patterns[i];this.recordSdfPattern(i,t[n.min]),this.recordSdfPattern(i,t[n.mid]),this.recordSdfPattern(i,t[n.max])}for(let r of this.layers){let i=r.paint.get("fill-pattern").constantOr(null);i&&(this.recordSdfPattern(r.id,t[i.from.toString()]),this.recordSdfPattern(r.id,t[i.to.toString()]))}}recordSdfPattern(t,r){if(!r)return;let i=!0===r.sdf,n=this.sdfPatterns[t];void 0===n?this.sdfPatterns[t]=i:n!==i&&tI(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${t}"`)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,lm),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,i,n,a,o){for(let t of ih(r,500)){let r=lK(t,n,o.fill.getGranularityForZoomLevel(n.z)),i=this.layoutVertexArray;l0((t,r)=>{i.emplaceBack(t,r)},this.segments,this.layoutVertexArray,this.indexArray,r.verticesFlattened,r.indicesTriangles,this.segments2,this.indexArray2,r.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:a,canonical:n})}};aj("FillBucket",l2,{omit:["layers","patternFeatures"]});var l3={get paint(){return h||=new a9({"fill-antialias":new a4(rt.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new a6(rt.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer
57-opacity":new a4(rt.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new a6(rt.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new a6(rt.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new a4(rt.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new a4(rt.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new a5(rt.paint_fill["fill-pattern"],"fill-pattern")})},get layout(){return c||=new a9({"fill-sort-key":new a6(rt.layout_fill["fill-sort-key"],"fill-sort-key")})}},l4=class extends or{constructor(t,r){super(t,l3,r)}recalculate(t,r){super.recalculate(t,r);let i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new l2(t)}queryRadius(){return sX(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:i,pixelsToTileUnits:n}){return s$(sK(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,n),r)}isTileClipped(){return!0}};let l6=ou([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),l5=ou([{name:"a_centroid",components:2,type:"Int16"}],4),l8=l6.members;l6.size,l6.alignment;var l7=class t{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(r){let i=new t;return i.extend(r(new eT(this.minX,this.minY))),i.extend(r(new eT(this.maxX,this.minY))),i.extend(r(new eT(this.minX,this.maxY))),i.extend(r(new eT(this.maxX,this.maxY))),i}static fromPoints(r){let i=new t;for(let t of r)i.extend(t);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}};let l9=l7.fromPoints([new eT(0,0),new eT(8192,8192)]);function ue(t,r){return t.x===r.x&&(t.x<0||t.x>8192)||t.y===r.y&&(t.y<0||t.y>8192)}function ut(t){return t.every(t=>t.x<0)||t.every(t=>t.x>8192)||t.every(t=>t.y<0)||t.every(t=>t.y>8192)}var ur=class{constructor(t,r,i,n,a){for(this.properties=Object.create(null),this.extent=i,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=a;t.pos<r;){let r=t.readVarint();if(8===r)this.id=t.readVarint();else if(18===r){let r=t.readVarint()+t.pos;for(;t.pos<r;){let r=n[t.readVarint()],i=a[t.readVarint()];this.properties[r]=i}}else 24===r?this.type=t.readVarint():(34===r&&(this._geometry=t.pos),t.skip(r))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,i=[],n,a=1,o=0,s=0,l=0;for(;t.pos<r;){if(o<=0){let r=t.readVarint();if(a=7&r,0==(o=r>>3))continue}if(o--,1===a)s+=t.readSVarint(),l+=t.readSVarint(),n&&i.push(n),n=[new eT(s,l)];else if(2===a)s+=t.readSVarint(),l+=t.readSVarint(),n&&n.push(new eT(s,l));else if(7===a)n&&n.push(n[0].clone());else throw Error(`unknown command ${a}`)}return n&&i.push(n),i}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,i=1,n=0,a=0,o=0,s=1/0,l=-1/0,u=1/0,c=-1/0;for(;t.pos<r;){if(n<=0){let r=t.readVarint();if(i=7&r,0==(n=r>>3))continue}if(n--,1===i||2===i)a+=t.readSVarint(),o+=t.readSVarint(),a<s&&(s=a),a>l&&(l=a),o<u&&(u=o),o>c&&(c=o);else if(7!==i)throw Error(`unknown command ${i}`)}return[s,u,l,c]}toGeoJSON(t,r,i){let n,a=this.extent*2**i,o=this.extent*t,s=this.extent*r,l=this.loadGeometry();function u(t){return[(t.x+o)*360/a-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+s)*2/a)*Math.PI))-90]}function c(t){return t.map(u)}if(1===this.type){let t=[];for(let r of l)t.push(r[0]);let r=c(t);n=1===t.length?{type:"Point",coordinates:r[0]}:{type:"MultiPoint",coordinates:r}}else if(2===this.type){let t=l.map(c);n=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else if(3===this.type){let t=ui(l),r=[];for(let i of t)r.push(i.map(c));n=1===r.length?{type:"Polygon",coordinates:r[0]}:{type:"MultiPolygon",coordinates:r}}else throw Error("unknown feature type");let h={type:"Feature",geometry:n,properties:this.properties};return null!=this.id&&(h.id=this.id),h}};function ui(t){let r=t.length;if(r<=1)return[t];let i=[],n,a;for(let o=0;o<r;o++){let r=function(t){let r=0;for(let i=0,n=t.length,a=n-1,o,s;i<n;
57a=i++)o=t[i],r+=((s=t[a]).x-o.x)*(o.y+s.y);return r}(t[o]);0!==r&&(void 0===a&&(a=r<0),a===r<0?(n&&i.push(n),n=[t[o]]):n&&n.push(t[o]))}return n&&i.push(n),i}ur.types=["Unknown","Point","LineString","Polygon"];var un=class{constructor(t,r){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],void 0===r&&(r=t.length);t.pos<r;){let r=t.readVarint();10===r?this.name=t.readString():18===r?(this._features.push(t.pos),t.skip(r)):26===r?this._keys.push(t.readString()):34===r?this._values.push(function(t){let r=null,i=t.readVarint()+t.pos;for(;t.pos<i;){let i=t.readVarint();r=10===i?t.readString():21===i?t.readFloat():25===i?t.readDouble():32===i?t.readVarint(!0):40===i?t.readVarint():48===i?t.readSVarint():56===i?t.readBoolean():(t.skip(i),null)}if(null==r)throw Error("unknown feature value");return r}(t)):40===r?this.extent=t.readVarint():120===r?this.version=t.readVarint():t.skip(r)}this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new ur(this._pbf,r,this.extent,this._keys,this._values)}},ua=class{constructor(t,r=t.length){let i=Object.create(null);for(;t.pos<r;){let r=t.readVarint();if(26===r){let r=new un(t,t.readVarint()+t.pos);r.length&&(i[r.name]=r)}else t.skip(r)}this.layers=i}},uo=class t{constructor(t,r){if(isNaN(t)||isNaN(r))throw Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(t_(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,i=this.lat*r,n=t.lat*r;return 6371008.8*Math.acos(Math.min(Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((t.lng-this.lng)*r),1))}static convert(r){if(r instanceof t)return r;if(Array.isArray(r)&&(2===r.length||3===r.length))return new t(Number(r[0]),Number(r[1]));if(!Array.isArray(r)&&"object"==typeof r&&r)return new t(Number("lng"in r?r.lng:r.lon),Number(r.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};let us=2*Math.PI*6371008.8;function ul(t){return us*Math.cos(t*Math.PI/180)}function uu(t){return(180+t)/360}function uc(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function uh(t){return 360*t-180}function uf(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var ud=class t{constructor(t,r,i=0){this.x=+t,this.y=+r,this.z=+i}static fromLngLat(r,i=0){let n=uo.convert(r);return new t(uu(n.lng),uc(n.lat),i/ul(n.lat))}toLngLat(){return new uo(uh(this.x),uf(this.y))}toAltitude(){return this.z*ul(uf(this.y))}meterInMercatorCoordinateUnits(){return 1/us*(1/Math.cos(uf(this.y)*Math.PI/180))}};function up(t,r,i){let n=1/(1<<i.z);return new ud(t/8192*n+i.x*n,r/8192*n+i.y*n)}function um(t,r){let i=tv(r.lat,-85.051129,85.051129);return new eT(uu(r.lng)*t,uc(i)*t)}function ug(t,r){return new ud(r.x/t,r.y/t).toLngLat()}function uy(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(tz(90-t.pitch)),Math.tan(tz(89.25-t.pitch)))}function uv(t,r){let i=t.canonical,n=r/tE(i.z),a=i.x+2**i.z*t.wrap,o=new Float64Array(16);return eI(o),eN(o,o,[a*n,i.y*n,0]),eL(o,o,[n/8192,n/8192,1]),o}function u_(t,r,i,n,a){let o=ud.fromLngLat(t,r),s=a*(1/ul(t.lat)),{x:l,y:u,z:c}=ub(i,n);return new ud(o.x+-(s*l),o.y+-(s*u),o.z+s*c)}function ub(t,r){let i=tz(t),n=tz(r),a=Math.cos(-i),o=Math.sin(i);return{x:o*Math.sin(n),y:-o*Math.cos(n),z:a}}function ux(t,r,i,n,a,o,s,l){t.emplaceBack(r,i,2*Math.floor(8192*n)+s,8192*a*2,8192*o*2,Math.round(l))}var uw=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new oQ,this.centroidVertexArray=new oW,this.indexArray=new se,this.programConfigurations=new sL(t.layers,t.zoom),this.segments=new sa,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>
57t.id)}populate(t,r,i){var n,a;let o;this.features=[],this.hasDependencies=lg("fill-extrusion",this.layers,r);let s=new aW(this.zoom),l=this.layers[0],u=l.layout.get("fill-extrusion-rounded-corner-distance"),c=u>0?(n=u,o=up(4096,4096,a=i).toLngLat(),n*ud.fromLngLat(o).meterInMercatorCoordinateUnits()*((1<<a.z)*8192)):0,h=l._featureFilter.needGeometry;for(let{feature:n,id:a,index:o,sourceLayerIndex:u}of t){let t=sz(n,h);if(!l._featureFilter.filter(s,t,i))continue;let f={id:a,sourceLayerIndex:u,index:o,geometry:function(t,r){return r<=0||!t||0===t.length?t:t.map(t=>(function(t,r){if(!t||t.length<3)return t;let i=t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y,n=i?t.length-1:t.length;if(n<3)return t;let a=[],o=ue(t[n-1],t[0]);for(let i=0;i<n;i++){let s=t[(i-1+n)%n],l=t[i],u=t[(i+1)%n],c=ue(l,u);o||c?a.push(l.clone()):function(t,r,i,n,a){let o=r.sub(i),s=n.sub(i),l=o.mag(),u=s.mag();if(l<1e-6||u<1e-6)return t.push(i.clone());o._div(l),s._div(u);let c=o.x*s.x+o.y*s.y;if(Math.abs(c)>Math.cos(5*Math.PI/180))return t.push(i.clone());let h=Math.min(a,.2*l,.2*u),f=i.add(o.mult(h)),d=i.add(s.mult(h)),p=Math.sqrt((1+c)/2),m=i.add(o.add(s)._unit()._mult(h/p)),g=f.sub(m).angleWith(d.sub(m)),y=Math.max(2,Math.ceil(Math.abs(g)/(Math.PI/6)-1e-6));for(let r=0;r<=y;r++)t.push(f.rotateAround(r/y*g,m))}(a,s,l,u,r),o=c}let s=function(t){let r=[];for(let i of t){let t=i.round(),n=r[r.length-1];(n?.x!==t.x||n?.y!==t.y)&&r.push(t)}for(;r.length>1&&r[0].x===r[r.length-1].x&&r[0].y===r[r.length-1].y;)r.pop();return r}(a);return s.length<3?t:(i&&s.push(s[0].clone()),s)})(t,r))}(h?t.geometry:sB(n),c),properties:n.properties,type:n.type,patterns:{}};this.hasDependencies?this.features.push(ly("fill-extrusion",this.layers,f,{zoom:this.zoom},r)):this.addFeature(f,f.geometry,o,i,{},r.subdivisionGranularity),r.featureIndex.insert(n,f.geometry,o,u,this.index,!0)}}addFeatures({options:t,canonical:r,patternPositions:i}){for(let n of this.features){let{geometry:a}=n;this.addFeature(n,a,n.index,r,i,t.subdivisionGranularity)}}update(t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,l8),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,l5.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,i,n,a,o){for(let i of ih(r,500)){let r={x:0,y:0,sampleCount:0},a=this.layoutVertexArray.length;this.processPolygon(r,n,t,i,o);let s=this.layoutVertexArray.length-a,l=Math.floor(r.x/r.sampleC
57ount),u=Math.floor(r.y/r.sampleCount);for(let t=0;t<s;t++)this.centroidVertexArray.emplaceBack(l,u)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:a,canonical:n})}processPolygon(t,r,i,n,a){if(n.length<1||ut(n[0]))return;for(let r of n)0!==r.length&&function(t,r){for(let i=0;i<r.length;i++){let n=r[i];(i!==r.length-1||r[0].x!==n.x||r[0].y!==n.y)&&(t.x+=n.x,t.y+=n.y,t.sampleCount++)}}(t,r);let o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=a.fill.getGranularityForZoomLevel(r.z),l="Polygon"===ur.types[i.type];for(let t of n){if(0===t.length||ut(t))continue;let r=lQ(t,s,l);this._generateSideFaces(r,o)}if(!l)return;let u=lK(n,r,s,!1),c=this.layoutVertexArray;l0((t,r)=>{ux(c,t,r,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(t,r){let i=0;for(let n=1;n<t.length;n++){let a=t[n],o=t[n-1];if(ue(a,o))continue;r.segment.vertexLength+4>sa.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=a.sub(o)._perp()._unit(),l=o.dist(a);i+l>32768&&(i=0),ux(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,i),ux(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,i),i+=l,ux(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,i),ux(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,i);let u=r.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}};aj("FillExtrusionBucket",uw,{omit:["layers","features"]});var uE={get paint(){return d||=new a9({"fill-extrusion-opacity":new a4(rt["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new a6(rt["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new a4(rt["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new a4(rt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new a5(rt["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new a6(rt["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new a6(rt["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new a4(rt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")})},get layout(){return f||=new a9({"fill-extrusion-rounded-corner-distance":new a4(rt["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")})}},uT=class extends or{constructor(t,r){super(t,uE,r)}createBucket(t){return new uw(t)}queryRadius(){return sX(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:i,geometry:n,transform:a,pixelsToTileUnits:o,pixelPosMatrix:s}){let l=sK(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-a.bearingInRadians,o),u=this.paint.get("fill-extrusion-height").evaluate(r,i),c=this.paint.get("fill-extrusion-base").evaluate(r,i),h=function(t,r){let i=[];for(let n of t){let t=[n.x,n.y,0,1];e2(t,t,r),i.push(new eT(t[0]/t[3],t[1]/t[3]))}return i}(l,s),f=function(t,r,i,n){let a=[],o=[],s=n[8]*r,l=n[9]*r,u=n[10]*r,c=n[11]*r,h=n[8]*i,f=n[9]*i,d=n[10]*i,p=n[11]*i;for(let r of t){let t=[],i=[];for(let a of r){let r=a.x,o=a.y,m=n[0]*r+n[4]*o+n[12],g=n[1]*r+n[5]*o+n[13],y=n[2]*r+n[6]*o+n[14],v=n[3]*r+n[7]*o+n[15],_=m+s,b=g+l,x=y+u,w=v+c,E=m+h,T=g+f,A=y+d,S=v+p,C=new eT(_/w,b/w);C.z=x/w,t.push(C);let M=new eT(E/S,T/S);M.z=A/S,i.push(M)}a.push(t),o.push(i)}return[a,o]}(n,c,u,s);return function(t,r,i){let n=1/0;s$(i,r)&&(n=uS(i,r[0]));for(let a=0;a<r.length;a++){let o=r[a],s=t[a];for(let t=0;t<o.length-1;t++){let r=o[t],a=o[t+1],l=s[t],u=[r,a,s[t+1],l,r];sU(i,u)&&(n=Math.min(n,uS(i,u)))}}return n!==1/0&&n}(f[0],f[1],h)}};function uA(t,r){return t.x*r.x+t.y*r.y}function uS(t,r){if(1===t.length){let i=0,n=r[i++],a;for(;!a||n.equals(a);)if(!(a=r[i++]))return 1/0;for(;i<r.length;i++){let o=r[i],s=t[0],l=a.sub(n),u=o.sub(n),c=s.sub(n),h=uA(l,l),f=uA(l,u),d=uA(u,u),p=uA(c,l),m=uA(c,u),g=h*d-f*f,y=(d*p-f*m)/g,v=(h*m-f*p)/g,_=1-y-v,b=n.z*_+a.z*y+o.z*v;if(isFinite(b))return b}return 1/0}{let t=1/0;for(let i of r)t=Math.min(t,i.z);return t}}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let uC=ou([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),uM=uC.members;uC.size,uC.alignment;let uD=ou([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),uP=uD.members;uD.size,uD.alignment;let uI=Math.cos(Math.PI/180*37.5);var uk=class{constructor(t){for(let r of(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>
57t.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers))this.gradients[r.id]={};this.layoutVertexArray=new oJ,this.layoutVertexArray2=new o0,this.indexArray=new se,this.programConfigurations=new sL(t.layers,t.zoom),this.segments=new sa,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,r,i){this.hasDependencies=lg("line",this.layers,r)||this.hasLineDasharray(this.layers);let n=this.layers[0].layout.get("line-sort-key"),a=!n.isConstant(),o=[],s=new aW(this.zoom),l=this.layers[0]._featureFilter.needGeometry;for(let{feature:r,id:u,index:c,sourceLayerIndex:h}of t){let t=sz(r,l);if(!this.layers[0]._featureFilter.filter(s,t,i))continue;let f=a?n.evaluate(t,{},i):void 0,d={id:u,properties:r.properties,type:r.type,sourceLayerIndex:h,index:c,geometry:l?t.geometry:sB(r),patterns:{},dashes:{},sortKey:f};o.push(d)}for(let n of(a&&o.sort((t,r)=>t.sortKey-r.sortKey),o)){let{geometry:a,index:o,sourceLayerIndex:s}=n;this.hasDependencies?(lg("line",this.layers,r)?ly("line",this.layers,n,{zoom:this.zoom},r):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,n,this.zoom,r),this.patternFeatures.push(n)):this.addFeature(n,a,o,i,{},{},r.subdivisionGranularity);let l=t[o].feature;r.featureIndex.insert(l,a,o,s,this.index)}}update(t,r,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:i,dashPositions:n})}addFeatures({options:t,canonical:r,patternPositions:i,dashPositions:n}){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,r,i,n,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,uP)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,uM),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,"geojsonvt_clip_start")&&Object.hasOwn(t.properties,"geojsonvt_clip_end"))return{start:+t.properties.geojsonvt_clip_start,end:+t.properties.geojsonvt_clip_end}}addFeature(t,r,i,n,a,o,s){let l=this.layers[0].layout,u=l.get("line-join").evaluate(t,{}),c=l.get("line-cap").evaluate(t,{}),h=l.get("line-miter-limit").evaluate(t,{}),f=l.get("line-round-limit").evaluate(t,{});for(let i of(this.lineClips=this.lineFeatureClips(t),r))this.addLine(i,t,u,c,h,f,n,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:a,dashPositions:o,canonical:n})}addLine(t,r,i,n,a,o,s,l){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let u=s?l.line.getGranularityForZoomLevel(s.z):1;if(t=lQ(t,u),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let r=0;r<t.length-1;r++)this.totalDistance+=t[r].dist(t[r+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c="Polygon"===ur.types[r.type],h=t.length;for(;h>=2&&t[h-1].equals(t[h-2]);)h--;let f=0;for(;f<h-1&&t[f].equals(t[f+1]);)f++;if(h-f<(c?3:2))return;"bevel"===i&&(a=1.05);let d=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*h,this.layoutVertexArray,this.indexArray),m,g,y,v,_;this.e1=this.e2=-1,c&&(m=t[h-2],_=t[f].sub(m)._unit()._perp());for(let r=f;r<h;r++){if((y=r===h-1?c?t[f+1]:void 0:t[r+1])&&t[r].equals(y))continue;_&&(v=_),m&&(g=m),m=t[r],_=y?y.sub(m)._unit()._perp():v;let s=(v||=_).add(_);(0!==s.x||0!==s.y)&&s._unit();let l=v.x*_.x+v.y*_.y,u=s.x*_.x+s.y*_.y,b=0===u?1/0:1/u,x=2*Math.sqrt(2-2*u),w=u<uI&&g&&y,E=v.x*_.y-v.y*_.x>0;if(w&&r>f){let t=m.dist(g);if(t>2*d){let r=m.sub(m.sub(g)._mult(d/t)._round());this.updateDistance(g,r),this.addCurrentVertex(r,v,0,0,p),g=r}}let T=g&&y,A=T?i:c?"butt":n;if(T&&"round"===A&&(b<o?A="miter":b<=2&&(A="fakeround")),"miter"
57===A&&b>a&&(A="bevel"),"bevel"===A&&(b>2&&(A="flipbevel"),b<a&&(A="miter")),g&&this.updateDistance(g,m),"miter"===A)s._mult(b),this.addCurrentVertex(m,s,0,0,p);else if("flipbevel"===A){if(b>100)s=_.mult(-1);else{let t=b*v.add(_).mag()/v.sub(_).mag();s._perp()._mult(t*(E?-1:1))}this.addCurrentVertex(m,s,0,0,p),this.addCurrentVertex(m,s.mult(-1),0,0,p)}else if("bevel"===A||"fakeround"===A){let t=-Math.sqrt(b*b-1),r=E?t:0,i=E?0:t;if(g&&this.addCurrentVertex(m,v,r,i,p),"fakeround"===A){let t=Math.round(180*x/Math.PI/20);for(let r=1;r<t;r++){let i=r/t;if(.5!==i){let t=i-.5,r=1.0904+l*(-3.2452+l*(3.55645-1.43519*l)),n=.848013+l*(-1.06021+.215638*l);i+=i*t*(i-1)*(r*t*t+n)}let n=_.sub(v)._mult(i)._add(v)._unit()._mult(E?-1:1);this.addHalfVertex(m,n.x,n.y,!1,E,0,p)}}y&&this.addCurrentVertex(m,_,-r,-i,p)}else if("butt"===A)this.addCurrentVertex(m,s,0,0,p);else if("square"===A){let t=g?1:-1;this.addCurrentVertex(m,s,t,t,p)}else"round"===A&&(g&&(this.addCurrentVertex(m,v,0,0,p),this.addCurrentVertex(m,v,1,1,p,!0)),y&&(this.addCurrentVertex(m,_,-1,-1,p,!0),this.addCurrentVertex(m,_,0,0,p)));if(w&&r<h-1){let t=m.dist(y);if(t>2*d){let r=m.add(y.sub(m)._mult(d/t)._round());this.updateDistance(m,r),this.addCurrentVertex(r,_,0,0,p),m=r}}}}addCurrentVertex(t,r,i,n,a,o=!1){let s=r.x+r.y*i,l=r.y-r.x*i,u=-r.x+r.y*n,c=-r.y-r.x*n;this.addHalfVertex(t,s,l,o,!1,i,a),this.addHalfVertex(t,u,c,o,!0,-n,a),this.distance>16384&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,i,n,a,o))}addHalfVertex({x:t,y:r},i,n,a,o,s,l){let u=(this.lineClips?32767*this.scaledDistance:this.scaledDistance)*.5;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!a,(r<<1)+ +!!o,Math.round(63*i)+128,Math.round(63*n)+128,(0===s?0:s<0?-1:1)+1|(63&u)<<2,u>>6),this.lineClips){let t=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(t,this.lineClipsArray.length)}let c=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),l.primitiveLength++),o?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}hasLineDasharray(t){for(let r of t){let t=r.paint.get("line-dasharray");if(t&&!t.isConstant())return!0}return!1}addLineDashDependencies(t,r,i,n){for(let a of t){let t=a.paint.get("line-dasharray");if(!t||"constant"===t.value.kind)continue;let o="round"===a.layout.get("line-cap").evaluate(r,{}),s={dasharray:t.value.evaluate({zoom:i-1},r,{}),round:o},l={dasharray:t.value.evaluate({zoom:i},r,{}),round:o},u={dasharray:t.value.evaluate({zoom:i+1},r,{}),round:o},c=`${s.dasharray.join(",")},${s.round}`,h=`${l.dasharray.join(",")},${l.round}`,f=`${u.dasharray.join(",")},${u.round}`;n.dashDependencies[c]=s,n.dashDependencies[h]=l,n.dashDependencies[f]=u,r.dashes[a.id]={min:c,mid:h,max:f}}}};aj("LineBucket",uk,{omit:["layers","patternFeatures"]});var uO={get paint(){return m||=new a9({"line-opacity":new a6(rt.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new a4(rt.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new a6(rt.paint_line["line-color"],"line-color"),"line-translate":new a4(rt.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new a4(rt.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new a6(rt.paint_line["line-width"],"line-width"),"line-gap-width":new a6(rt.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new a6(rt.paint_line["line-offset"],"line-offset"),"line-blur":new a6(rt.paint_line["line-blur"],"line-blur"),"line-dasharray":new a5(rt.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new a5(rt.paint_line["line-pattern"],"line-pattern"),"line-gradient":new a7(rt.paint_line["line-gradient"],"line-gradient")})},get layout(){return p||=new a9({"line-cap":new a6(rt.layout_line["line-cap"],"line-cap"),"line-join":new a6(rt.layout_line["line-join"],"line-join"),"line-miter-limit":new a6(rt.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new a6(rt.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new a6(rt.layout_line["line-sort-key"],"line-sort-key")})}},uN=class extends a6{possiblyEvaluate(t,r){return r=new aW(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,i,n){return r=tb({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,i,n)}},uL=class extends or{constructor(t,r){super(t,uO,r),this.gradientVersion=0,g||((g=new uN(uO.paint.properties["line-width"].specification,"line-floorwidth")).useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){let t=this.gradientExpression();this.stepInterpolant=void 0!==t._styleExpression&&t._styleExpression.expression instanceof ia,this.gradientVersion=(this.gradientVersion+1)%(0x20000000000000-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=g.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new uk(t)}queryRadius(t){var r,i;return r=sY("line-width",this,t),((i=sY("line-gap-width",this,t))>0?i+2*r:r)/2+Math.abs(sY("line-offset",this,t))+sX(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:i,geometry:n,transform:a,pixelsToTileUnits:o}){var s,l;let u=sK(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-a.bearingInRadians,o),c=o/2*(s=this.paint.get("line-width").evaluate(r,i),(l=this.paint.get("line-gap-width").evaluate(r,i))>0?l+2*s:s),h=this.paint.get("line-offset").evaluate(r,i);return h&&(n=function(t,r){let i=[];for(let n of t){let t=function(t){let r=[];for(let i=0;i<t.length;i++){let n=t[i],a=r.at(-1);(0===i||a&&!n.equals(a))&&r.push(n)}return r}(n),a=[];for(let i=0;i<t.length;i++){let n=t[i],o=t[i-1],s=t[i+1],l=0===i?new eT(0,0):n.sub(o)._unit()._perp(),u=i===t.length-1?new eT(0,0):s.sub(n)._unit()._perp(),c=l._add(u)._unit(),h=c.x*u.x+c.y*u.y;0!==h&&c._mult(1/h),a.push(c._mult(r)._add(n))}i.push(a)}return i}(n,h*o)),function(t,r,i){for(let n of r){if(t.length>=3){for(let r of n)if(sZ(t,r))return!0}if(function(t,r,i){if(t.length>1){if(sG(t,r))return!0;
57for(let n of r)if(sq(n,t,i))return!0}for(let n of t)if(sq(n,r,i))return!0;return!1}(t,n,i))return!0}return!1}(u,n,c)}isTileClipped(){return!0}};let uR=ou([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),uF=ou([{name:"a_projected_pos",components:3,type:"Float32"}],4);ou([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let uB=ou([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ou([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let uz=ou([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),uj=ou([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ou([{name:"triangle",components:3,type:"Uint16"}]),ou([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),ou([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),ou([{type:"Float32",name:"offsetX"}]),ou([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ou([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let uU=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(uU.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}
57async syncState(t,r){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;let i=t.pluginURL,n=new Promise(t=>{this.loadScriptResolve=t}),a=new Promise(t=>setTimeout(()=>t(),this.TIMEOUT));if(await r(i),await Promise.race([n,a]),this.isParsed()){let t={pluginStatus:"loaded",pluginURL:i};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${i}`)}};function uV(t){return/[\u02EA\u02EB\u1100-\u11FF\u1401-\u167F\u18B0-\u18FF\u2065\u20DD-\u20E0\u20E2-\u20E4\u2B97\u2BF0-\u2BFF\u2E50\u2E51\u2E80-\u3007\u3012\u3013\u3020-\u302F\u3031-\u30FB\u30FD-\uA4CF\uA960-\uA97F\uAC00-\uD7FF\uF900-\uFAFF\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7\uFFF0-\uFFF8]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|[\uD80C-\uD810\uD81C-\uD822\uD83C\uD83D\uD840-\uD87E\uD880-\uD8BE][\uDC00-\uDFFF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFFF]|\uD823[\uDC00-\uDDFF]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFF]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83E[\uDD00-\uDEFF]|[\uD87F\uD8BF][\uDC00-\uDFFD]/gim.test(String.fromCodePoint(t))}function u$(t){return/[\u0E01-\u0E3A\u0E40-\u0E4E\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA\u1000-\u103F\u1050-\u108F\u109A-\u109F\u1780-\u17D3\u17D7\u17DC\u17DD\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19DE\u19DF\u1A20-\u1A5E\u1A60-\u1A7C\u1AA0-\u1AAD\u1B00-\u1B4C\u1B4E-\u1B7F\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE-\uA9EF\uA9FA-\uA9FE\uAA60-\uAAC2\uAADB-\uAADF]|\uD805[\uDF00-\uDF1A\uDF1D-\uDF2B\uDF3A\uDF3B\uDF3F-\uDF46]/gim.test(String.fromCodePoint(t))}let uG={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,6437
577],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},uq={ÙØ¢:[65269,65270],ÙØ£:[65271,65272],ÙØ¥:[65273,65274],ÙØ§:[65275,65276]},uH=/[\u0600-\u06ff\u0750-\u077f\u0870-\u089f\u08a0-\u08ff\ufb50-\ufdff\ufe70-\ufeff]/,uW=new Map;for(let[t,r]of Object.entries({C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"}))!function(t,r,i){let n=0;for(let a of t.split(";")){let[t,o]=a.split(",").map(t=>parseInt(t,36)),s=n+t;for(let t=s;t<s+o;t++)i.set(t,r);n=s+o}}(r,t,uW);function uZ(t,r,i){let n=i?r.last.points:r.first.points,a=i?n[n.length-1]:n[0];return`${t}:${a.x}:${a.y}`}function uY(t,r,i,n,a){let o=r[i];delete r[i],r[n]=o;let s=t[o];return s.last.next=a.first,s.last=a.last,o}function uX(t,r,i,n,a){let o=r[n];delete r[n],r[i]=o;let s=t[o];return a.last.next=s.first,s.first=a.first,o}let uK="u">typeof Intl&&"Segmenter"in Intl;function uQ(t){var r;if(!uK||!/[\r\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0600-\u0605\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DD\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0890\u0891\u0897-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E33-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB3-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1037\u1039-\u103E\u1056-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1084-\u1086\u108D\u109D\u1100-\u11FF\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60\u1A62\u1A65-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA960-\uA97C\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCBD\uDCC2\uDCCD\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC2\uDDC3\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE4
570\uDEAB-\uDEB7\uDF1D-\uDF1F\uDF22-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE84-\uDE99\uDF60-\uDF67]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6\uDF00-\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD2F]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD63\uDD67-\uDD6A\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF\uDDEE\uDDEF\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDDE6-\uDDFF\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF]/.test(t))return[...t];y??=new Intl.Segmenter(void 0,{granularity:"grapheme"});let i=[];for(let{segment:n}of y.segment(t)){let t=i.length-1;t>=0&&(r=i[t],/(?:[\u1039\u17D2\u1A60\u1BAB\u200D\uAAF6]|\uD802\uDE3F|\uD804[\uDD33\uDFD0]|\uD806[\uDD3E\uDE47\uDE99]|\uD807[\uDD45\uDD97\uDF42])$/.test(r)||/^\p{gc=Mc}/u.test(n))?i[t]+=n:i.push(n)}return i}function uJ(t){let r=t.codePointAt(0);return t.length>(r>65535?2:1)}function u0(t){return/\s/u.test(String.fromCodePoint(t))}function u1(t){for(let r of t)if(uV(r.codePointAt(0)))return!0;return!1}function u2(t){return!(uV(t)||/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t)))}function u3(t){return/\p{sc=Arab}/u.test(String.fromCodePoint(t))}function u4(t){return/[\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u07B1\u07C0-\u07FA\u07FD-\u082D\u0830-\u083E\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC57-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD1F-\uDD39\uDD3F-\uDD59\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE50-\uDE58\uDE60-\uDE9F\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF00-\uDF35\uDF39-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD27\uDD30-\uDD39\uDD40-\uDD65\uDD69-\uDD85\uDD8E\uDD8F\uDE60-\uDE7E\uDE80-\uDEA9\uDEAB-\uDEAD\uDEB0\uDEB1\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDF27\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(t))}function u6(t){for(let r of t)if(u4(r.codePointAt(0)))return!0;return!1}let u5={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â¯":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"},u8={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},u7={40:!0};function u9(t,r,i,n,a,o){if("fontStack"in r){let n=i[r.fontStack],o=n?.[t];if(o)return o.metrics.advance*r.scale+a;let s=0;for(let i of t){let t=n?.[i];t&&(s+=t.metrics.advance*r.scale+a)}return s}{let t=n[r.imageName];return t?t.displaySize[0]*r.scale*24/o+a:0}}function ce(t,r,i,n){let a=(t-r)**2;return n?t<r?a/2:2*a:a+Math.abs(i)*i}function ct(t){return/^\s+$/u.test(t)}function cr(t,r,i,n,a,o){let s=null,l=ce(r,i,a,o);for(let t of n){let n=ce(r-t.x,i,a,o)+t.badness;n<=l&&(s=t,l=n)}return{index:t,x:r,priorBreak:s,badness:l}}var ci=class t{constructor(t="",r=[],i=[]){this.text=t,this.sections=r,this.sectionIndex=i,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??=uQ(this.text),this._graphemes}static fromFeature(r,i){let n=new t;for(let t of r.sections)t.image?n.addImageSection(t):n.addTextSection(t,i);return n}length(){return this.graphemes().length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=function(t){let r="",i={premature:!0,value:void 0},n=t[Symbol.iterator](),a=n.next(),o=t[Symbol.iterator]();o.next();let s=o.next();for(;!a.done;)(s.done||!u2(s.value.codePointAt(0))||u5[s.value])&&(i.premature||!u2(i.value.codePointAt(0))||u5[i.value])&&u5[a.value]?r+=u5[a.value]:r+=a.value,i={value:a.value,premature:!1},a=n.next(),s=o.next();return r}(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("â")}trim(){let t=this.graphemes(),r=0;for(;r<t.length&&ct(t[r]);)r++;let i=t.length;for(;i>r&&ct(t[i-1]);)i--;this.text=t.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(r,i){let n=this.graphemes().slice(r,i).join(""),a=this.sectionIndex.slice(r,i);return new t(n,this.sections,a)}toCodeUnitIndex(t){return this.graphemes().slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=0,i=0;for(let n=0;n<this.length();n++){let a=this.getSection(n);if("imageName"in a){let n=t[a.imageName];if(!n)continue;let o=n.displaySize;r=Math.max(r,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:r,maxImageHeight:i}}_appendSection(t,r){let i=this.graphemes(),n=i.length>0?i[i.length-1]:"",a=uQ(n+t);this.text+=t,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let o=a.length-!!n;for(let t=0;t<o;t++)this.sectionIndex.push(r)}addTextSection(t,r){this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||r}),this._appendSection(t.text,this.sections.length-1)}
57addImageSection(t){let r=t.image?t.image.name:"";if(0===r.length)return void tI("Can't add FormattedSection with an empty image.");let i=this.getNextImageSectionCharCode();i?(this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:r}),this._appendSection(String.fromCharCode(i),this.sections.length-1)):tI("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,r,i,n,a){let o=[],s=this.determineAverageLineWidth(t,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),c=null,h=0,f=0;for(let r=0;r<u.length;r++){let d=u[r];if(r>0){let t=u[r-1].codePointAt(0),i=d.codePointAt(0),n=/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t)),a=u$(t)&&u$(i);(u8[t]||n||"imageName"in this.getSection(r-1)||void 0!==u[r+1]&&u7[i]||a&&(c??=function(t){let r=new Set;if(uK){for(let{index:i}of(v??=new Intl.Segmenter(void 0,{granularity:"word"})).segment(t))r.add(i);return r}let i=0;for(let n of t.split(/\b|(?=\p{Ideo})/u))r.add(i),i+=n.length;return r}(this.text)).has(f))&&o.push(cr(r,h,s,o,function(t,r,i){let n=0;return(10===t||13===t)&&(n-=1e4),i&&(n+=150),(40===t||65288===t)&&(n+=50),(41===r||65289===r)&&(n+=50),n}(t,i,n&&l),!1))}u0(d.codePointAt(0))||(h+=u9(d,this.getSection(r),i,n,t,a)),f+=d.length}return function t(r){return r?t(r.priorBreak).concat(r.index):[]}(cr(this.length(),h,s,o,0,!0))}determineAverageLineWidth(t,r,i,n,a){let o=0,s=0;for(let r of this.graphemes())o+=u9(r,this.getSection(s),i,n,t,a),s++;let l=Math.max(1,Math.ceil(o/r));return o/l}};let cn=function(t){var r,i,n,a,o={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},s={},l={};
57s.L=1,l[1]="L",Object.keys(o).forEach(function(t,r){s[t]=1<<r+1,l[s[t]]=t}),Object.freeze(s);var u=s.LRI|s.RLI|s.FSI,c=s.L|s.R|s.AL,h=s.B|s.S|s.WS|s.ON|s.FSI|s.LRI|s.RLI|s.PDI,f=s.BN|s.RLE|s.LRE|s.RLO|s.LRO|s.PDF,d=s.S|s.WS|s.B|u|s.PDI|f,p=null;function m(t){return function(){if(!p){p=new Map;var t=0;for(var r in o)if(o.hasOwnProperty(r))for(var i=o[r],n="",a=void 0,l=!1,u=0,c=0;c<=i.length+1;c+=1){var h=i[c];if(","!==h&&c!==i.length)"+"===h?(l=!0,u=t=u+parseInt(n,36),n=""):n+=h;else{l?a=t+parseInt(n,36):(u=t=u+parseInt(n,36),a=t),l=!1,n="",u=a;for(var f=t;f<a+1;f+=1)p.set(f,s[r])}}}}(),p.get(t.codePointAt(0))||s.L}function g(t,r){var i,n=0,a=new Map,o=r&&new Map;return t.split(",").forEach(function t(s){if(-1!==s.indexOf("+"))for(var l=+s;l--;)t(i);else{i=s;var u=s.split(">"),c=u[0],h=u[1];c=String.fromCodePoint(n+=parseInt(c,36)),h=String.fromCodePoint(n+=parseInt(h,36)),a.set(c,h),r&&o.set(h,c)}}),{map:a,reverseMap:o}}function y(){if(!r){var t=g("14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",!0),a=t.map,o=t.reverseMap;r=a,i=o,n=g("6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye",!1).map}}function v(t){return y(),r.get(t)||null}function _(t){return y(),i.get(t)||null}function b(t){return y(),n.get(t)||null}var x=s.L,w=s.R,E=s.EN,T=s.ES,A=s.ET,S=s.AN,C=s.CS,M=s.B,D=s.S,P=s.ON,I=s.BN,k=s.NSM,O=s.AL,N=s.LRO,L=s.RLO,R=s.LRE,F=s.RLE,B=s.PDF,z=s.LRI,j=s.RLI,U=s.FSI,V=s.PDI;function $(t){return function(){if(!a){var t=g("14>1,j>2,t>2,u>2,1a>g,2v3>
571,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),r=t.map;t.reverseMap.forEach(function(t,i){r.set(i,t)}),a=r}}(),a.get(t)||null}function G(t,r,i,n){var a=t.length;i=Math.max(0,null==i?0:+i),n=Math.min(a-1,null==n?a-1:+n);var o=[];return r.paragraphs.forEach(function(a){var s=Math.max(i,a.start),l=Math.min(n,a.end);if(s<l){for(var u=r.levels.slice(s,l+1),c=l;c>=s&&m(t[c])&d;c--)u[c]=a.level;for(var h=a.level,f=1/0,p=0;p<u.length;p++){var g=u[p];g>h&&(h=g),g<f&&(f=1|g)}for(var y=h;y>=f;y--)for(var v=0;v<u.length;v++)if(u[v]>=y){for(var _=v;v+1<u.length&&u[v+1]>=y;)v++;v>_&&o.push([_+s,v+s])}}}),o}function q(t,r,i,n){for(var a=G(t,r,i,n),o=[],s=0;s<t.length;s++)o[s]=s;return a.forEach(function(t){for(var r=t[0],i=t[1],n=o.slice(r,i+1),a=n.length;a--;)o[i-a]=n[a]}),o}return t.closingToOpeningBracket=_,t.getBidiCharType=m,t.getBidiCharTypeName=function(t){return l[m(t)]},t.getCanonicalBracket=b,t.getEmbeddingLevels=function(t,r){for(var i=new Uint32Array(t.length),n=0;n<t.length;n++)i[n]=m(t[n]);var a=new Map;function o(t,r){var n=i[t];i[t]=r,a.set(n,a.get(n)-1),n&h&&a.set(h,a.get(h)-1),a.set(r,(a.get(r)||0)+1),r&h&&a.set(h,(a.get(h)||0)+1)}for(var s=new Uint8Array(t.length),l=new Map,p=[],g=null,y=0;y<t.length;y++)g||p.push(g={start:y,end:t.length-1,level:"rtl"===r?1:"ltr"===r?0:tI(y,!1)}),i[y]&M&&(g.end=y,g=null);for(var $=F|R|L|N|u|V|B|M,G=function(t){return t+(1&t?1:2)},q=function(t){return t+(1&t?2:1)},H=0;H<p.length;H++){var W=[{_level:(g=p[H]).level,_override:0,_isolate:0}],Z=void 0,Y=0,X=0,K=0;a.clear();for(var Q=g.start;Q<=g.end;Q++){var J=i[Q];if(Z=W[W.length-1],a.set(J,(a.get(J)||0)+1),J&h&&a.set(h,(a.get(h)||0)+1),J&$)if(J&(F|R)){s[Q]=Z._level;var ee=(J===F?q:G)(Z._level);!(ee<=125)||Y||X?Y||X++:W.push({_level:ee,_override:0,_isolate:0})}else if(J&(L|N)){s[Q]=Z._level;var et=(J===L?q:G)(Z._level);!(et<=125)||Y||X?Y||X++:W.push({_level:et,_override:J&L?w:x,_isolate:0})}else if(J&u){J&U&&(J=1===tI(Q+1,!0)?j:z),s[Q]=Z._level,Z._override&&o(Q,Z._override);var er=(J===j?q:G)(Z._level);er<=125&&0===Y&&0===X?(K++,W.push({_level:er,_override:0,_isolate:1,_isolInitIndex:Q})):Y++}else if(J&V){if(Y>0)Y--;else if(K>0){for(X=0;!W[W.length-1]._isolate;)W.pop();var ei=W[W.length-1]._isolInitIndex;null!=ei&&(l.set(ei,Q),l.set(Q,ei)),W.pop(),K--}Z=W[W.length-1],s[Q]=Z._level,Z._override&&o(Q,Z._override)}else J&B?(0===Y&&(X>0?X--:!Z._isolate&&W.length>1&&(W.pop(),Z=W[W.length-1])),s[Q]=Z._level):J&M&&(s[Q]=g.level);else s[Q]=Z._level,Z._override&&J!==I&&o(Q,Z._override)}for(var en=[],ea=null,eo=g.start;eo<=g.end;eo++){var es=i[eo];if(!(es&f)){var el=s[eo],eu=es&u,ec=es===V;ea&&el===ea._level?(ea._end=eo,ea._endsWithIsolInit=eu):en.push(ea={_start:eo,_end:eo,_level:el,_startsWithPDI:ec,_endsWithIsolInit:eu})}}for(var eh=[],ef=0;ef<en.length;ef++){var ed=en[ef];if(!ed._startsWithPDI||ed._startsWithPDI&&!l.has(ed._start)){for(var ep=[ea=ed],em=void 0;ea&&ea._endsWithIsolInit&&null!=(em=l.get(ea._end));)for(var eg=ef+1;eg<en.length;eg++)if(en[eg]._start===em){ep.push(ea=en[eg]);break}for(var ey=[],ev=0;ev<ep.length;ev++)for(var e_=ep[ev],eb=e_._start;eb<=e_._end;eb++)ey.push(eb);for(var ex=s[ey[0]],ew=g.level,eE=ey[0]-1;eE>=0;eE--)if(!(i[eE]&f)){ew=s[eE];break}var eT=ey[ey.length-1],eA=s[eT],eS=g.level;if(!(i[eT]&u)){for(var eC=eT+1;eC<=g.end;eC++)if(!(i[eC]&f)){eS=s[eC];break}}eh.push({_seqIndices:ey,_sosType:Math.max(ew,ex)%2?w:x,_eosType:Math.max(eS,eA)%2?w:x})}}for(var eM=0;eM<eh.length;eM++){var eD=eh[eM],eP=eD._seqIndices,eI=eD._sosType,ek=eD._eosType,eO=1&s[eP[0]]?w:x;if(a.get(k))for(var eN=0;eN<eP.length;eN++){var eL=eP[eN];if(i[eL]&k){for(var eR=eI,eF=eN-1;eF>=0;eF--)if(!(i[eP[eF]]&f)){eR=i[eP[eF]];break}o(eL,eR&(u|V)?P:eR)}}if(a.get(E))for(var eB=0;eB<eP.length;eB++){var ez=eP[eB];if(i[ez]&E)for(var ej=eB-1;ej>=-1;ej--){var eU=-1===ej?eI:i[eP[ej]];if(eU&c){eU===O&&o(ez,S);break}}}if(a.get(O))for(var eV=0;eV<eP.length;eV++){var e$=eP[eV];i[e$]&O&&o(e$,w)}if(a.get(T)||a.get(C))for(var eG=1;eG<eP.length-1;eG++){var eq=eP[eG];if(i[eq]&(T|C)){for(var eH=0,eW=0,eZ=eG-1;eZ>=0&&(eH=i[eP[eZ]])&f;eZ--);for(var eY=eG+1;eY<eP.length&&(eW=i[eP[eY]])&f;eY++);eH===eW&&(i[eq]===T?eH===E:eH&(E|S))&&o(eq,eH)}}if(a.get(E)){for(var eX=0;eX<eP.length;eX++)if(i[eP[eX]]&E){for(var eK=eX-1;eK>=0&&i[eP[eK]]&(A|f);eK--)o(eP[eK],E);for(eX++;eX<eP.length&&i[eP[eX]]&(A|f|E);eX++)i[eP[eX]]!==E&&o(eP[eX],E)}}
57if(a.get(A)||a.get(T)||a.get(C))for(var eQ=0;eQ<eP.length;eQ++){var eJ=eP[eQ];if(i[eJ]&(A|T|C)){o(eJ,P);for(var e0=eQ-1;e0>=0&&i[eP[e0]]&f;e0--)o(eP[e0],P);for(var e1=eQ+1;e1<eP.length&&i[eP[e1]]&f;e1++)o(eP[e1],P)}}if(a.get(E))for(var e2=0,e3=eI;e2<eP.length;e2++){var e4=eP[e2],e6=i[e4];e6&E?e3===x&&o(e4,x):e6&c&&(e3=e6)}if(a.get(h)){for(var e5=w|E|S,e8=e5|x,e7=[],e9=[],te=0;te<eP.length;te++)if(i[eP[te]]&h){var tt=t[eP[te]],tr=void 0;if(null!==v(tt))if(e9.length<63)e9.push({char:tt,seqIndex:te});else break;else if(null!==(tr=_(tt)))for(var ti=e9.length-1;ti>=0;ti--){var tn=e9[ti].char;if(tn===tr||tn===_(b(tt))||v(b(tn))===tt){e7.push([e9[ti].seqIndex,te]),e9.length=ti;break}}}e7.sort(function(t,r){return t[0]-r[0]});for(var ta=0;ta<e7.length;ta++){for(var to=e7[ta],ts=to[0],tl=to[1],tu=!1,tc=0,th=ts+1;th<tl;th++){var tf=eP[th];if(i[tf]&e8){tu=!0;var td=i[tf]&e5?w:x;if(td===eO){tc=td;break}}}if(tu&&!tc){tc=eI;for(var tp=ts-1;tp>=0;tp--){var tm=eP[tp];if(i[tm]&e8){var tg=i[tm]&e5?w:x;tc=tg===eO?eO:tg;break}}}if(tc){if(i[eP[ts]]=i[eP[tl]]=tc,tc!==eO){for(var ty=ts+1;ty<eP.length;ty++)if(!(i[eP[ty]]&f)){m(t[eP[ty]])&k&&(i[eP[ty]]=tc);break}}if(tc!==eO){for(var tv=tl+1;tv<eP.length;tv++)if(!(i[eP[tv]]&f)){m(t[eP[tv]])&k&&(i[eP[tv]]=tc);break}}}}for(var t_=0;t_<eP.length;t_++)if(i[eP[t_]]&h){for(var tb=t_,tx=t_,tw=eI,tE=t_-1;tE>=0;tE--)if(i[eP[tE]]&f)tb=tE;else{tw=i[eP[tE]]&e5?w:x;break}for(var tT=ek,tA=t_+1;tA<eP.length;tA++)if(i[eP[tA]]&(h|f))tx=tA;else{tT=i[eP[tA]]&e5?w:x;break}for(var tS=tb;tS<=tx;tS++)i[eP[tS]]=tw===tT?tw:eO;t_=tx}}}for(var tC=g.start;tC<=g.end;tC++){var tM=s[tC],tD=i[tC];if(1&tM?tD&(x|E|S)&&s[tC]++:tD&w?s[tC]++:tD&(S|E)&&(s[tC]+=2),tD&f&&(s[tC]=0===tC?g.level:s[tC-1]),tC===g.end||m(t[tC])&(D|M))for(var tP=tC;tP>=0&&m(t[tP])&d;tP--)s[tP]=g.level}}return{levels:s,paragraphs:p};function tI(r,n){for(var a=r;a<t.length;a++){var o=i[a];if(o&(w|O))return 1;if(o&(M|x)||n&&o===V)break;if(o&u){var s=function(r){for(var n=1,a=r+1;a<t.length;a++){var o=i[a];if(o&M)break;if(o&V){if(0==--n)return a}else o&u&&n++}return -1}(a);a=-1===s?t.length:s}}return 0}},t.getMirroredCharacter=$,t.getMirroredCharactersMap=function(t,r,i,n){var a=t.length;i=Math.max(0,null==i?0:+i),n=Math.min(a-1,null==n?a-1:+n);for(var o=new Map,s=i;s<=n;s++)if(1&r[s]){var l=$(t[s]);null!==l&&o.set(s,l)}return o},t.getReorderSegments=G,t.getReorderedIndices=q,t.getReorderedString=function(t,r,i,n){var a=q(t,r,i,n),o=[].concat(t);return a.forEach(function(i,n){o[n]=(1&r.levels[i]?$(t[i]):null)||t[i]}),o.join("")},t.openingToClosingBracket=v,Object.defineProperty(t,"__esModule",{value:!0}),t}({}),ca=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/,co=new Set(["WS","FSI","LRI","RLI","PDI"]),cs=new Set(["S","B"]);function cl(t,r){let{levels:i,paragraphs:n}=cn.getEmbeddingLevels(t);return(function(t,r){let i=[...new Set([0,...r.filter(r=>r>0&&r<t.length),t.length])].sort((t,r)=>t-r),n=[];for(let t=0;t+1<i.length;t++)n.push([i[t],i[t+1]]);return n})(t,r.concat(n.map(t=>t.start))).map(([r,a])=>(function(t,r,i,n,a){let o=function(t,r,i,n){let a=[],o=i;
57for(let s of uQ(t.slice(i,n)))a.push({index:o,text:s,level:r[o]}),o+=s.length;return a}(t,r,n,a),s=!0;for(let t=o.length-1;t>=0;t--){let r=cn.getBidiCharTypeName(o[t].text[0]);cs.has(r)?(o[t].level=i,s=!0):s&&co.has(r)?o[t].level=i:s=!1}let l="",u=[];for(let t of function(t,r){let i=r,n=1/0;for(let{level:r}of t)r>i&&(i=r),(1|r)<n&&(n=1|r);let a=t.slice();for(let t=i;t>=n;t--)for(let r=0;r<a.length;r++){if(a[r].level<t)continue;let i=r;for(;i+1<a.length&&a[i+1].level>=t;)i++;for(let t=r,n=i;t<n;t++,n--)[a[t],a[n]]=[a[n],a[t]];r=i}return a}(o,i)){if(ca.test(t.text))continue;let r=t.level%2==0?t.text:cn.getMirroredCharacter(t.text)??t.text;l+=r,u.push(...Array(r.length).fill(t.index))}return{text:l,sourceIndices:u}})(t,i,n.find(t=>r>=t.start&&r<=t.end)?.level??0,r,a))}let cu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");var cc=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,r,i=this.length){let n;for(;n=this.nextField(i);)t(n,r,this);return r}readMessage(t,r){return this.readFields(t,r,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let r=this.buf,i=r[this.pos++];if(i<128)return i;let n=127&i,a;return n|=(127&(a=r[this.pos++]))<<7,a<128||(n|=(127&(a=r[this.pos++]))<<14,a<128)||(n|=(127&(a=r[this.pos++]))<<21,a<128)?n:function(t,r,i){let n=i.buf,a,o;if(a=(112&(o=n[i.pos++]))>>4,o<128||(a|=(127&(o=n[i.pos++]))<<3,o<128)||(a|=(127&(o=n[i.pos++]))<<10,o<128)||(a|=(127&(o=n[i.pos++]))<<17,o<128)||(a|=(127&(o=n[i.pos++]))<<24,o<128)||(a|=(1&(o=n[i.pos++]))<<31,o<128)){var s,l;return s=t,l=a,r?0x100000000*l+(s>>>0):(l>>>0)*0x100000000+(s>>>0)}throw Error("Expected varint not more than 10 bytes")}(n|=(15&(a=r[this.pos]))<<28,t,this)}readSVarint(){let t=this.readVarint();return t%2==1?-((t+1)/2):t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,r=this.pos;return this.pos=t,t-r>=12&&cu?cu.decode(this.buf.subarray(r,t)):function(t,r,i){let n="",a=r;for(;a<i;){let r,o,s,l=t[a],u=null,c=l>239?4:l>223?3:l>191?2:1;if(a+c>i)break;1===c?l<128&&(u=l):2===c?(192&(r=t[a+1]))==128&&(u=(31&l)<<6|63&r)<=127&&(u=null):3===c?(r=t[a+1],o=t[a+2],(192&r)==128&&(192&o)==128&&((u=(15&l)<<12|(63&r)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(r=t[a+1],o=t[a+2],s=t[a+3],(192&r)==128&&(192&o)==128&&(192&s)==128&&((u=(15&l)<<18|(63&r)<<12|(63&o)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),a+=c}return n}(this.buf,r,t)}readBytes(){let t=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,t);return this.pos=t,r}readPackedVarint(t=[],r){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(r));return t}readPackedSVarint(t=[]){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;let r=this.readVarint();return this.type=7&r,this._valueStart=this.pos,r>>>3}skip(t){let r=7&t;if(0===r)for(;this.buf[this.pos++]>127;);else if(2===r)this.pos=this.readVarint()+this.pos;else if(5===r)this.pos+=4;else if(1===r)this.pos+=8;else throw Error(`Unimplemented type: ${r}`)}};function ch(t,r,i){1===t&&i.readMessage(cf,r)}function cf(t,r,i){if(3===t){let{id:t,bitmap:n,width:a,height:o,left:s,top:l,advance:u}=i.readMessage(cd,{});r.push({id:t,bitmap:new lt({width:a+6,height:o+6},n),metrics:{width:a,height:o,left:s,top:l,advance:u}})}}function cd(t,r,i){1===t?r.id=i.readVarint():2===t?r.bitmap=i.readBytes():3===t?r.width=i.readVarint():4===t?r.height=i.readVarint():5===t?r.left=i.readSVarint():6===t?r.top=i.readSVarint():7===t&&(r.advance=i.readVarint())}function cp(t){return"function"==typeof t?.renderWithWebGL}function cm(t){let r=0,i=0;for(let n of t)r+=n.w*n.h,i=Math.max(i,n.w);t.sort((t,r)=>r.h-t.h);let n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),i),h:1/0}],a=0,o=0;for(let r of t)for(let t=n.length-1;t>=0;t--){let i=n[t];if(!(r.w>i.w||r.h>i.h)){if(r.x=i.x,r.y=i.y,o=Math.max(o,r.y+r.h),a=Math.max(a,r.x+r.w),r.w===i.w&&r.h===i.h){let r=n.pop();r&&t<n.length&&(n[t]=r)}else r.h===i.h?(i.x+=r.w,i.w-=r.w):(r.w===i.w||n.push({x:i.x+r.w,y:i.y,w:i.w-r.w,h:r.h}),i.y+=r.h,i.h-=r.h);break}}return{w:a,h:o,fill:r/(a*o)||0}}
57var cg=class{constructor(t,{pixelRatio:r,version:i,isWebGLImage:n=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=a,this.stretchY=o,this.content=s,this.version=i,this.needsFirstWebGLRender=n,this.textFitWidth=l,this.textFitHeight=u}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},cy=class{constructor(t,r){let i={},n={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let a=[];this.addImages(t,i,a),this.addImages(r,n,a);let{w:o,h:s}=cm(a),l=new lr({width:o||1,height:s||1});for(let r in t){let n=t[r];if(n.isWebGLImage)continue;let a=i[r].paddedRect;lr.copy(n.data,l,{x:0,y:0},{x:a.x+1,y:a.y+1},n.data)}for(let t in r){let i=r[t],a=n[t].paddedRect,o=a.x+1,s=a.y+1,u=i.data.width,c=i.data.height;lr.copy(i.data,l,{x:0,y:0},{x:o,y:s},i.data),lr.copy(i.data,l,{x:0,y:c-1},{x:o,y:s-1},{width:u,height:1}),lr.copy(i.data,l,{x:0,y:0},{x:o,y:s+c},{width:u,height:1}),lr.copy(i.data,l,{x:u-1,y:0},{x:o-1,y:s},{width:1,height:c}),lr.copy(i.data,l,{x:0,y:0},{x:o+u,y:s},{width:1,height:c})}this.image=l,this.iconPositions=i,this.patternPositions=n}addImages(t,r,i){for(let n in t){let a=t[n],o={x:0,y:0,w:a.data.width+2,h:a.data.height+2};i.push(o),r[n]=new cg(o,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,r){if(t.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==t.updateVersion){for(let i in this.patchedUpdateVersion=t.updateVersion,this.iconPositions)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),r);for(let i in this.patternPositions)this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),r)}}patchUpdatedImage(t,r,i){if(!t||!r||!t.needsFirstWebGLRender&&t.version===r.version)return;t.needsFirstWebGLRender=!1,t.version=r.version;let[n,a]=t.tl,o=r.userImage?.data;if(!cp(o))return void i.update(r.data,void 0,{x:n,y:a});let{width:s,height:l}=r.data;i.context.setCustomLayerDefaults(),o.renderWithWebGL({gl:i.context.gl,texture:i.texture,x:n,y:a,width:s,height:l}),i.context.setDirty()}};aj("ImagePosition",cg),aj("ImageAtlas",cy);var cv=((hS=cv||{})[hS.none=0]="none",hS[hS.horizontal=1]="horizontal",hS[hS.vertical=2]="vertical",hS[hS.horizontalOnly=3]="horizontalOnly",hS);let c_=/^\p{gc=M}$/u;function cb(t,r,i){let n=new ci(t.join(""),r,[]),a=0;for(let t of n.graphemes())n.sectionIndex.push(i[a]??0),a+=[...t].length;return n}function cx(t){let r=[],i=0;for(let n of t)r.push(i),i+=n.length;return r}function cw(t,r,i){let n=[...t],a=cx(n),o=function(t){let r=[],i=0;for(;i<t.length;){if(!c_.test(t[i])){r.push(i),i++;continue}let n=i;for(;n<t.length&&c_.test(t[n]);)n++;let a=t[n];if(void 0!==a&&u4(a.codePointAt(0))){r.push(n);for(let t=n-1;t>=i;t--)r.push(t);i=n+1}else{for(let t=i;t<n;t++)r.push(t);i=n}}return r}(n);return cb(o.map(t=>n[t]),r,o.map(t=>i[a[t]]??0))}function cE(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m){let g=ci.fromFeature(t,a);2===f&&g.verticalizePunctuation();let y=g.determineLineBreaks(c,o,r,n,p),v=u6(g.text)?function(t,r){var i;let n=r.map(r=>t.toCodeUnitIndex(r)),a=uU.isParsed()?uU:null;if(1===t.sections.length)return a?a.processBidirectionalText(t.toString(),n).map(r=>cw(r,t.sections,[...r].map(()=>0))):cl(t.toString(),n).map(t=>t.text).map(r=>cb([...r],t.sections,[...r].map(()=>0)));let o=function(t){let r=[],i=0;for(let n of t.graphemes())r.push(...Array(n.length).fill(t.sectionIndex[i])),i++;return r}(t);return a?a.processStyledBidirectionalText(t.text,o,n).map(([r,i])=>cw(r,t.sections,i)):(i=t.text,cl(i,n).map(t=>[t.text,t.sourceIndices.map(t=>o[t]??0)])).map(([r,i])=>{let n=[...r];return cb(n,t.sections,cx(n).map(t=>i[t]??0))})}(g,y):function(t,r){let i=[],n=0;for(let a of r)i.push(t.substring(n,a)),n=a;return n<t.length()&&i.push(t.substring(n,t.length())),i}(g,y),_=[],b={positionedLines:_,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:f,iconsInText:!1,verticalizable:!1};return function(t,r,i,n,a,o,s,l,u,c,h,f){let d=0,p=0,m=0,g=0,y="right"===l?1:.5*("left"!==l),v=24/f,_=0;for(let s of a){s.trim();let a=s.getMaxScale(),l={positionedGlyphs:[],lineOffset:0};t.positionedLines[_]=l;let f=l.positionedGlyphs,b=0;if(!s.length()){p+=o,++_;continue}let x=function(t,r,i){let n=24*r.getMaxScale(),{maxImageWidth:a,maxImageHeight:o}=r.getMaxImageSize(t),s=Math.max(n,o*i);return{verticalLineContentWidth:Math.max(n,a*i),horizontalLineContentHeight:s}}(n,s,v),w=2!==u||h?null:function(t){let r=t.graphemes().slice(),i=r.map(t=>t.codePointAt(0)),n=i.map(uV),a=r=>!n[r]&&!u0(i[r])&&!("imageName"in t.getSection(r));for(let t=0;t<i.length;t++){if(!a(t))continue;let r=t;for(;r+1<i.length&&a(r+1);)r++;if(function(t){let r=t.some(cS)&&t.every(t=>cS(t)||/[\p{P}\p{S}]/u.test(String.fromCodePoint(t))),i=t.length<=3&&t.every(t=>cC(t)||cS(t));return r||i}(i.slice(t,r+1)))for(let a=t;a<=r;a++){var o;n[a]=(cS(o=i[a])||cC(o))&&!u3(o)}t=r}return function(t,r){let i=!1;for(let n=0;n<t.length;n++){if(r[n])continue;let a=u5[t[n]];a&&(0===n||r[n-1])&&(n===t.length-1||r[n+1])&&(t[n]=a,r[n]=!0,i=!0)}return i}(r,n)&&(t.text=r.join(""),t._graphemes=null),n}(s),E=s.graphemes();for(let o=0;o<E.length;o++){let l=s.getSection(o),m=E[o],g=m.codePointAt(0),y=w?w[o]:!(1===u||!h&&
57!uV(g)||h&&(u0(g)||u3(g)));for(let u of"fontStack"in l&&uJ(m)&&!r[l.fontStack]?.[m]?[...m]:[m]){let h={glyph:u.codePointAt(0),grapheme:u,imageName:null,x:d,y:p+-17,vertical:y,scale:1,fontStack:"",sectionIndex:s.getSectionIndex(o),metrics:null,rect:null},m;if("fontStack"in l){if(!(m=function(t,r,i,n,a,o){let s,l=function(t,r,i,n){if(t?.rect)return t;let a=r[i.fontStack]?.[n];return a?{rect:null,metrics:a.metrics}:null}(o[t.fontStack]?.[r],a,t,r);if(null===l)return null;if(i)s=n.verticalLineContentWidth-24*t.scale;else{let r=cA(t.verticalAlign);s=(n.horizontalLineContentHeight-24*t.scale)*r}return{rect:l.rect,metrics:l.metrics,baselineOffset:s}}(l,u,y,x,r,i)))continue;h.fontStack=l.fontStack}else{if(t.iconsInText=!0,l.scale*=v,!(m=function(t,r,i,n,a){let o=a[t.imageName];if(!o)return null;let s=o.paddedRect,l=o.displaySize,u={width:l[0],height:l[1],left:1,top:-3,advance:r?l[1]:l[0]},c;if(r)c=n.verticalLineContentWidth-l[1]*t.scale;else{let r=cA(t.verticalAlign);c=(n.horizontalLineContentHeight-l[1]*t.scale)*r}return{rect:s,metrics:u,baselineOffset:c,imageOffset:(r?l[0]:l[1])*t.scale-24*i}}(l,y,a,x,n)))continue;b=Math.max(b,m.imageOffset),h.imageName=l.imageName}let{rect:g,metrics:_,baselineOffset:w}=m;(h.y+=w,h.scale=l.scale,h.metrics=_,h.rect=g,f.push(h),y)?(t.verticalizable=!0,d+=("imageName"in l?_.advance:24)*l.scale+c):d+=_.advance*l.scale+c}}0!==f.length&&(m=Math.max(d-c,m),function(t,r,i){if(0===i)return;let n=t[r],a=n.metrics.advance*n.scale,o=(t[r].x+a)*i;for(let i=0;i<=r;i++)t[i].x-=o}(f,f.length-1,y)),d=0,l.lineOffset=Math.max(b,(a-1)*24);let T=o*a+b;p+=T,g=Math.max(T,g),++_}let{horizontalAlign:b,verticalAlign:x}=cT(s);(function(t,r,i,n,a,o,s,l,u){let c=(r-i)*a,h=0;for(let r of(h=o===s?-n*u*s+.5*s:-l*n- -17,t))for(let t of r.positionedGlyphs)t.x+=c,t.y+=h})(t.positionedLines,y,b,x,m,g,o,p,a.length),t.top+=-x*p,t.bottom=t.top+p,t.left+=-b*m,t.right=t.left+m}(b,r,i,n,v,s,l,u,f,c,d,m),!function(t){for(let r of t)if(0!==r.positionedGlyphs.length)return!1;return!0}(_)&&b}function cT(t){let r=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:r,verticalAlign:i}}function cA(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function cS(t){return/\p{Nd}/u.test(String.fromCodePoint(t))}function cC(t){return/\p{Lu}/u.test(String.fromCodePoint(t))}function cM(t){let r=t.left,i=t.top,n=t.right-r,a=t.bottom-i,o=t.image.content[2]-t.image.content[0],s=t.image.content[3]-t.image.content[1],l=t.image.textFitWidth??"stretchOrShrink",u=t.image.textFitHeight??"stretchOrShrink",c=o/s;if("proportional"===u){if("stretchOnly"===l&&n/a<c||"proportional"===l){let t=Math.ceil(a*c);r*=t/n,n=t}}else if("proportional"===l&&"stretchOnly"===u&&0!==c&&n/a>c){let t=Math.ceil(n/c);i*=t/a,a=t}return{x1:r,y1:i,x2:r+n,y2:i+a}}function cD(t,r,i,n,a,o){let s=t.image,l;if(s.content){let t=s.content,r=s.pixelRatio||1;l=[t[0]/r,t[1]/r,s.displaySize[0]-t[2]/r,s.displaySize[1]-t[3]/r]}let u=r.left*o,c=r.right*o,h,f,d,p;"width"===i||"both"===i?(p=a[0]+u-n[3],f=a[0]+c+n[1]):f=(p=a[0]+(u+c-s.displaySize[0])/2)+s.displaySize[0];let m=r.top*o,g=r.bottom*o;return"height"===i||"both"===i?(h=a[1]+m-n[0],d=a[1]+g+n[2]):d=(h=a[1]+(m+g-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:h,right:f,bottom:d,left:p,collisionPadding:l}}function cP(t,r){let{expression:i}=r;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new aW(t+1))};if("source"===i.kind)return{kind:"source"};if("composite"===i.kind){let{minZoom:r,maxZoom:n}=function(t,r){let i=0;for(;i<t.length&&t[i]<=r;)i++;let n=i=Math.max(0,i-1);for(;n<t.length&&t[n]<r+1;)n++;return n=Math.min(t.length-1,n),{minZoom:t[i],maxZoom:t[n]}}(i.zoomStops,t);return{kind:"composite",minZoom:r,maxZoom:n,interpolationType:i.interpolationType}}{var n;let r=(n=i).zoomStops.map(t=>n.evaluate(new aW(t===-1/0?n.zoomStops[1]-1:t))),a=i.evaluate(new aW(t+1));return{kind:"camera",zoomStops:i.zoomStops,sizes:r,layoutSize:a,interpolationType:i.interpolationType}}}function cI(t,{uSize:r,uSizeT:i},{lowerSize:n,upperSize:a}){return"source"===t.kind?n/128:"composite"===t.kind?il.number(n/128,a/128,i):r}function ck(t,r){let i=0,n=0;return"constant"===t.kind?n=t.layoutSize:"camera"===t.kind?n=function({zoomStops:t,sizes:r,layoutSize:i,interpolationType:n},a){let o=t.length-1;for(;o>0&&t[o]>a;)o--;let s=Math.min(o+1,t.length-1),l=n?tv(io.interpolationFactor(n,a,t[o],t[s]),0,1):0;return Math.min(il.number(r[o],r[s],l),i)}(t,r):"composite"===t.kind&&(i=function({interpolationType:t,minZoom:r,maxZoom:i},n){return t?tv(io.interpolationFactor(t,n,r,i),0,1):0}(t,r)),{uSizeT:i,uSize:n}}var cO=class t extends eT{constructor(t,r,i,n){super(t,r),this.angle=i,void 0!==n&&(this.segment=n)}clone(){return new t(this.x,this.y,this.angle,this.segment)}};function cN(t,r,i,n,a){if(void 0===r.segment||0===i)return!0;let o=r,s=r.segment+1,l=0;for(;l>-i/2;){if(--s<0)return!1;l-=t[s].dist(o),o=t[s]}l+=t[s].dist(t[s+1]),s++;let u=[],c=0;for(;l<i/2;){let r=t[s-1],i=t[s],o=t[s+1];if(!o)return!1;let h=r.angleTo(i)-i.angleTo(o);for(h=Math.abs((h+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:l,angleDelta:h}),c+=h;l-u[0].distance>n;)c-=u.shift().angleDelta;if(c>a)return!1;s++,l+=i.dist(o)}return!0}function cL(t){let r=0;for(let i=0;i<t.length-1;i++)r+=t[i].dist(t[i+1]);return r}function cR(t,r){return Math.max(t?t.right-t.left:0,r?r.right-r.left:0)}function cF(t,r,i,n,a){let o=[];for(let s of t){let t;for(let l=0;l<s.length-1;l++){let u=s[l],c=s[l+1];u.x<r&&c.x<r||(u.x<r?u=new eT(r,u.y+(c.y-u.y)*((r-u.x)/(c.x-u.x)))._round():c.x<r&&(c=new eT(r,u.y+(c.y-u.y)*((r-u.x)/(c.x-u.x)))._round()),!(u.y<i&&c.y<i)&&(u.y<i?u=new eT(u.x+(c.x-u.x)*((i-u.y)/(c.y-u.y)),i)._round():c.y<i&&(c=new eT(u.x+(c.x-u.x)*((i-u.y)/(c.y-u.y)),i)._round()),!(u.x>=n&&c.x>=n)&&(u.x>=n?u=new eT(n,u.y+(c.y-u.y)*((n-u.x)/(c.x-u.x)))._round():c.x>=n&&(c=new eT(n,u.y+(c.y-u.y)*((n-u.x)/(c.x-u.x)))._round()),u.y>=a&&c.y>=a||(u.y>=a?u=new eT(u.x+(c.x-u.x)*((a-u.y)/(c.y-u.y)),a)._round():c.y>=a&&(c=new eT(u.x+(c.x-u.x)*((a-u.y)/(c.y-u.y)),a)._round()),t&&u.equals(t[t.length-1])||(t=[u],o.push(t)),t.push(c)))))}}return o}function cB(t,r,i,n){let a=[],o=t.image,s=o.pixelRatio,l=o.paddedRect.w-2,u=o.paddedRect.h-2,c={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=o.stretchX||[[0,l]],f=o.stretchY||[[0,u]],d=(t,r)=>t+r[1]-r[0],p=h.reduce(d,0),m=f.reduce(d,0),g=l-p,y=u-m,v=0,_=p,b=0,x=m,w=0,E=g,T=0,A=y;if(o.content&&n){let r=o.content,i=r[2]-r[0],n=r[3]-r[1];(o.textFitWidth||o.textFitHeight)&&(c=cM(t)),v=cz(h,0,r[0]),b=cz(f,0,r[1]),_=cz(h,r[0],r[2]),x=cz(f,r[1],r[3]),w=r[0]-v,T=r[1]-b,E=i-_,A=n-x}let S=c.x1,C=c.y1,M=c.x2-S,D=c.y2-C,P=(t,n,a,l)=>{var u,c,h,f,d,g,y,P,I,k,O,N,L,R,F,B;let z=(u=t.stretch-v,u/_*M+S),j=(c=t.fixed-w,h=E,f=t.stretch,c-h*f/p),U=(d=n.stretch-b,d/x*D+C),V=(g=n.fixed-T,y=A,P=n.stretch,g-y*P/m),$=(I=a.stretch-v,I/_*M+S),G=(k=a.fixed-w,O=E,N=a.stretch,k-O*N/p),q=(L=l.stretch-b,L/x*D+C),H=(R=l.fixed-T,F=A,B=l.stretch,R-F*B/m),W=new eT(z,U),Z=new eT($,U),Y=new eT($,q),X=new eT(z,q),K=new eT(j/s,V/s),Q=new eT(G/s,H/s),J=r*Math.PI/180;if(J){let t=Math.sin(J),r=Math.cos(J),i=[r,-t,t,r];W._matMult(i),Z._matMult(i),X._matMult(i),Y._matMult(i)}
57let ee=t.stretch+t.fixed,et=a.stretch+a.fixed,er=n.stretch+n.fixed,ei=l.stretch+l.fixed;return{tl:W,tr:Z,bl:X,br:Y,tex:{x:o.paddedRect.x+1+ee,y:o.paddedRect.y+1+er,w:et-ee,h:ei-er},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:K,pixelOffsetBR:Q,minFontScaleX:E/s/M,minFontScaleY:A/s/D,isSDF:i}};if(n&&(o.stretchX||o.stretchY)){let t=cj(h,g,p),r=cj(f,y,m);for(let i=0;i<t.length-1;i++){let n=t[i],o=t[i+1];for(let t=0;t<r.length-1;t++){let i=r[t],s=r[t+1];a.push(P(n,i,o,s))}}}else a.push(P({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return a}function cz(t,r,i){let n=0;for(let a of t)n+=Math.max(r,Math.min(i,a[1]))-Math.max(r,Math.min(i,a[0]));return n}function cj(t,r,i){let n=[{fixed:-1,stretch:0}];for(let[r,i]of t){let t=n[n.length-1];n.push({fixed:r-t.stretch,stretch:t.stretch}),n.push({fixed:r-t.stretch,stretch:t.stretch+(i-r)})}return n.push({fixed:r+1,stretch:i}),n}aj("Anchor",cO);var cU=class{constructor(t,r,i,n,a,o,s,l,u,c){if(this.boxStartIndex=t.length,u){let t=o.top,r=o.bottom,i=o.collisionPadding;i&&(t-=i[1],r+=i[3]);let n=r-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let u=o.image?.content&&(o.image.textFitWidth||o.image.textFitHeight)?cM(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};u.y1=u.y1*s-l[0],u.y2=u.y2*s+l[2],u.x1=u.x1*s-l[3],u.x2=u.x2*s+l[1];let h=o.collisionPadding;if(h&&(u.x1-=h[0]*s,u.y1-=h[1]*s,u.x2+=h[2]*s,u.y2+=h[3]*s),c){let t=new eT(u.x1,u.y1),r=new eT(u.x2,u.y1),i=new eT(u.x1,u.y2),n=new eT(u.x2,u.y2),a=c*Math.PI/180;t._rotate(a),r._rotate(a),i._rotate(a),n._rotate(a),u.x1=Math.min(t.x,r.x,i.x,n.x),u.x2=Math.max(t.x,r.x,i.x,n.x),u.y1=Math.min(t.y,r.y,i.y,n.y),u.y2=Math.max(t.y,r.y,i.y,n.y)}t.emplaceBack(r.x,r.y,u.x1,u.y1,u.x2,u.y2,i,n,a)}this.boxEndIndex=t.length}},cV=class{constructor(t=[],r=(t,r)=>t<r?-1:+(t>r)){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:i}=this,n=r[t];for(;t>0;){let a=t-1>>1,o=r[a];if(i(n,o)>=0)break;r[t]=o,t=a}r[t]=n}_down(t){let{data:r,compare:i}=this,n=this.length>>1,a=r[t];for(;t<n;){let n=(t<<1)+1,o=n+1;if(o<this.length&&0>i(r[o],r[n])&&(n=o),i(r[n],a)>=0)break;r[t]=r[n],t=n}r[t]=a}};function c$(t,r){return r.max-t.max}var cG=class{constructor(t,r,i,n){this.p=new eT(t,r),this.h=i,this.d=function(t,r){let i=!1,n=1/0;for(let a of r)for(let r=0,o=a.length,s=o-1;r<o;s=r++){let o=a[r],l=a[s];o.y>t.y!=l.y>t.y&&t.x<(l.x-o.x)*(t.y-o.y)/(l.y-o.y)+o.x&&(i=!i),n=Math.min(n,sH(t,o,l))}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}};let cq=((hC={})[hC.center=1]="center",hC[hC.left=2]="left",hC[hC.right=3]="right",hC[hC.top=4]="top",hC[hC.bottom=5]="bottom",hC[hC["top-left"]=6]="top-left",hC[hC["top-right"]=7]="top-right",hC[hC["bottom-left"]=8]="bottom-left",hC[hC["bottom-right"]=9]="bottom-right",hC),cH=1/0;function cW(t,r){return r[1]===cH?function(t,r){let i=0,n=0;r<0&&(r=0);let a=r/Math.SQRT2;switch(t){case"top-right":case"top-left":n=a-7;break;case"bottom-right":case"bottom-left":n=-a+7;break;case"bottom":n=-r+7;break;case"top":n=r-7}switch(t){case"top-right":case"bottom-right":i=-a;break;case"top-left":case"bottom-left":i=a;break;case"left":i=r;break;case"right":i=-r}return[i,n]}(t,r[0]):function(t,r,i){let n=0,a=0;switch(r=Math.abs(r),i=Math.abs(i),t){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=-i+7}switch(t){case"top-right":case"bottom-right":case"right":n=-r;break;case"top-left":case"bottom-left":case"left":n=r}return[n,a]}(t,r[0],r[1])}function cZ(t,r,i){let n=t.layout,a=n.get("text-variable-anchor-offset")?.evaluate(r,{},i);if(a){let t=a.values,r=[];for(let i=0;i<t.length;i+=2){let n=r[i]=t[i],a=t[i+1].map(t=>24*t);n.startsWith("top")?a[1]-=7:n.startsWith("bottom")&&(a[1]+=7),r[i+1]=a}return new r1(r)}let o=n.get("text-variable-anchor");if(o){let a;a=void 0===t._unevaluatedLayout.getValue("text-radial-offset")?n.get("text-offset").evaluate(r,{},i).map(t=>24*t):[24*n.get("text-radial-offset").evaluate(r,{},i),cH];let s=[];for(let t of o)s.push(t,cW(t,a));return new r1(s)}return null}function cY(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function cX(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g){let y=function(t,r,i,n,a,o,s){let l=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(let i of t.positionedLines)for(let a of i.positionedGlyphs){if(!a.rect)continue;let c=a.rect||{},h=4,f=!0,d=1,p=0,m=(n||s)&&a.vertical,g=a.metrics.advance*a.scale/2;if(s&&t.verticalizable){let t=(a.scale-1)*24,r=(24-a.metrics.width*a.scale)/2;p=i.lineOffset/2-(a.imageName?-r:t)}if(a.imageName){let t=o[a.imageName];f=t.sdf,h=1/(d=t.pixelRatio)}let y=n?[a.x+g,a.y]:[0,0],v=n?[0,0]:[a.x+g+r[0],a.y+r[1]-p],_=[0,0];m&&(_=v,v=[0,0]);let b=a.metrics.isDoubleResolution?2:1,x=(a.metrics.left-h)*a.scale-g+v[0],w=(-a.metrics.top-h)*a.scale+v[1],E=x+c.w/b*a.scale/d,T=w+c.h/b*a.scale/d,A=new eT(x,w),S=new eT(E,w),C=new eT(x,T),M=new eT(E,T);if(m){let t=new eT(-g,g- -17),r=-Math.PI/2,i=12-g,n=a.imageName?i:0,o=new eT(22-i,-n),s=new eT(..._);
57A._rotateAround(r,t)._add(o)._add(s),S._rotateAround(r,t)._add(o)._add(s),C._rotateAround(r,t)._add(o)._add(s),M._rotateAround(r,t)._add(o)._add(s)}if(l){let t=Math.sin(l),r=Math.cos(l),i=[r,-t,t,r];A._matMult(i),S._matMult(i),C._matMult(i),M._matMult(i)}let D=new eT(0,0),P=new eT(0,0);u.push({tl:A,tr:S,bl:C,br:M,tex:c,writingMode:t.writingMode,glyphOffset:y,sectionIndex:a.sectionIndex,isSDF:f,pixelOffsetTL:D,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}return u}(i,l,a,o,s,n,t.allowVerticalPlacement),v=t.textSizeData,_=null;for(let i of("source"===v.kind?(_=[128*a.layout.get("text-size").evaluate(s,{})])[0]>32640&&tI(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===v.kind&&((_=[128*m.compositeTextSizes[0].evaluate(s,{},g),128*m.compositeTextSizes[1].evaluate(s,{},g)])[0]>32640||_[1]>32640)&&tI(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),t.addSymbols(t.text,y,_,l,o,s,h,r,c.lineStartIndex,c.lineLength,p,g,u),f))d[i]=t.text.placedSymbolArray.length-1;return 4*y.length}function cK(t){for(let r in t)return t[r];return null}function cQ(t,r,i){let n="never",a=t.get(r);return a?n=a:t.get(i)&&(n="always"),n}let cJ=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function c0(t,r,i,n,a,o,s,l,u,c,h,f,d,p){let m=l?Math.min(32640,Math.round(l[0])):0,g=l?Math.min(32640,Math.round(l[1])):0;t.emplaceBack(r,i,Math.round(32*n),Math.round(32*a),o,s,(m<<1)+ +!!u,g,16*c,16*h,256*f,256*d,p)}function c1(t,r,i){t.emplaceBack(r.x,r.y,i),t.emplaceBack(r.x,r.y,i),t.emplaceBack(r.x,r.y,i),t.emplaceBack(r.x,r.y,i)}var c2=class{constructor(t){this.layoutVertexArray=new o3,this.indexArray=new se,this.programConfigurations=t,this.segments=new sa,this.dynamicLayoutVertexArray=new o4,this.opacityVertexArray=new o6,this.hasVisibleVertices=!1,this.placedSymbolArray=new oB}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,r,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,uR.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,uF.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,cJ,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};aj("SymbolBuffers",c2);var c3=class{constructor(t,r,i){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new i,this.segments=new sa,this.collisionVertexArray=new o7}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,uB.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};aj("CollisionBuffers",c3);var c4=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=cP(this.zoom,r["text-size"]),this.iconSizeData=cP(this.zoom,r["icon-size"]);let i=this.layers[0].layout,n=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap="never"!==cQ(i,"text-overlap","text-allow-overlap")||"never"!==cQ(i,"icon-overlap","icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==a&&!n.isConstant();let o="viewport-y"===a||"auto"===a&&!this.sortFeaturesByKey;this.sortFeaturesByY=o&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map(t=>cv[t])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>
57t.id),this.sourceID=t.sourceID}createArrays(){this.text=new c2(new sL(this.layers,this.zoom,t=>t.startsWith("text"))),this.icon=new c2(new sL(this.layers,this.zoom,t=>t.startsWith("icon"))),this.glyphOffsetArray=new oU,this.lineVertexArray=new oV,this.symbolInstances=new oj,this.textAnchorOffsets=new oG}calculateGlyphDependencies(t,r,i,n,a){let o=(n||this.allowVerticalPlacement)&&a,s=ci.fromFeature(t,i),l=s.graphemes();for(let t=0;t<l.length;t++){let i=s.getSection(t);if("imageName"in i)continue;let n=r[i.fontStack]||={},a=l[t];for(let t of(uJ(a)&&(n[a]=!0),a)){if(n[t]=!0,!o)continue;let r=u5[t];r&&(n[r]=!0)}}}populate(t,r,i){let n=this.layers[0],a=n.layout,o=a.get("text-font"),s=a.get("text-field"),l=a.get("icon-image"),u=("constant"!==s.value.kind||s.value.value instanceof rY&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=a.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,d=r.glyphDependencies,p=r.availableImages,m=new aW(this.zoom);for(let{feature:r,id:s,index:l,sourceLayerIndex:g}of t){let t,y,v=n._featureFilter.needGeometry,_=sz(r,v);if(!n._featureFilter.filter(m,_,i))continue;if(v||(_.geometry=sB(r)),u){let r=n.getValueAndResolveTokens("text-field",_,i,p),a=rY.factory(r);this.hasRTLText||=function(t){for(let r of t.sections)if(u6(r.text))return!0;return!1}(a),t=function(t,r,i){for(let n of t.sections)n.text=function(t,r,i){let n=r.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),(uU.applyArabicShaping??function(t){if(!uH.test(t))return t;let r=[...t].map(t=>{let r=t.codePointAt(0);return{codePoint:r,type:uW.get(r)??"U",form:null}});return function(t){let r=t.filter(t=>"T"!==t.type);for(let t=0;t<r.length;t++){var i,n,a;let o=r[t],s=t>0&&("D"===(i=r[t-1].type)||"L"===i||"C"===i),l=t+1<r.length&&("D"===(n=r[t+1].type)||"R"===n||"C"===n);a=o.type,o.form="D"===a?s&&l?3:s?1:2*!!l:"R"===a?+!!s:"L"===a?2*!!l:null}}(r),function(t){let r=!1;for(let i of t)"T"===i.type?i.form=3*!!r:r=2===i.form||3===i.form}(r),(function(t){let r=[];for(let i=0;i<t.length;i++){let n=t[i];if(1604!==n.codePoint){r.push(n);continue}let a=i+1;for(;a<t.length&&"T"===t[a].type;)a++;let o=t[a],s=o&&uq[String.fromCodePoint(1604,o.codePoint)];if(!s){r.push(n);continue}let l=3===n.form||1===n.form;r.push({codePoint:s[+!!l],type:"R",form:0}),r.push(...t.slice(i+1,a)),i=a}return r})(r).map(t=>String.fromCodePoint(function(t){if(null===t.form)return t.codePoint;let r=uG[t.codePoint];return r&&(r[t.form]||r[0])||t.codePoint}(t))).join("")})(t)}(n.text,r,i);return t}(a,n,_)}if(c){let t=n.getValueAndResolveTokens("icon-image",_,i,p);y=t instanceof r2?t:r2.fromString(t)}if(!t&&!y)continue;let b=this.sortFeaturesByKey?h.evaluate(_,{},i):void 0,x={id:s,text:t,icon:y,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:r.properties,type:ur.types[r.type],sortKey:b};if(this.features.push(x),y&&(f[y.name]=!0),t){let r=o.evaluate(_,{},i).join(","),n="viewport"!==a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");this.allowVerticalPlacement=this.writingModes?.includes(2);let s=u1(t.toString());for(let i of(this.calculateGlyphDependencies(t,d,r,n,s),t.sections))i.image&&(f[i.image.name]=!0)}}"line"===a.get("symbol-placement")&&(this.features=function(t){let r={},i={},n=[];for(let a of t){let t=a.text?a.text.toString():null,o={points:a.geometry[0],next:null},s={feature:a,first:o,last:o};if(!t){n.push(s);continue}let l=uZ(t,s),u=uZ(t,s,!0);if(l in i&&u in r&&i[l]!==r[u]){let a=uX(n,r,l,u,s),o=uY(n,i,l,u,n[a]);delete r[l],delete i[u],i[uZ(t,n[o],!0)]=o,n[a].feature.geometry=null}else if(l in i)uY(n,i,l,u,s);else if(u in r)uX(n,r,l,u,s);else{let t=n.push(s)-1;r[l]=t,i[u]=t}}let a=[];for(let t of n){let r=t.feature;r.geometry&&(t.first.next&&(r.geometry[0]=function(t){let r=t.first.points,i=r.length;for(let r=t.first.next;r;r=r.next)i+=r.points.length-1;let n=Array(i);for(let t=0;t<r.length;t++)n[t]=r[t];let a=r.length;for(let r=t.first.next;r;r=r.next){let t=r.points;for(let r=1;r<t.length;r++)n[a++]=t[r]}return n}(t)),a.push(r))}return a}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,r)=>t.sortKey-r.sortKey)}update(t,r,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,{imagePositions:i}))}addFeatures({options:t,canonical:r,glyphMap:i,glyphPositions:n,iconMap:a,iconPositions:o,showCollisionBoxes:s}){!function(t){t.bucket.createArrays();let r=512*t.bucket.overscaling;t.bucket.tilePixelRatio=8192/r,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let i=t.bucket.layers[0],n=i.layout,a=i._unevaluatedLayout._values,o={layoutIconSize:a["icon-size"].possiblyEvaluate(new aW(t.bu
vendor: 5,648 bytes, line 57
57cket.zoom+1),t.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new aW(t.bucket.zoom+1),t.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new aW(18))};if("composite"===t.bucket.textSizeData.kind){let{minZoom:r,maxZoom:i}=t.bucket.textSizeData;o.compositeTextSizes=[a["text-size"].possiblyEvaluate(new aW(r),t.canonical),a["text-size"].possiblyEvaluate(new aW(i),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){let{minZoom:r,maxZoom:i}=t.bucket.iconSizeData;o.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new aW(r),t.canonical),a["icon-size"].possiblyEvaluate(new aW(i),t.canonical)]}let s=24*n.get("text-line-height"),l="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),u=n.get("text-keep-upright"),c=n.get("text-size");for(let r of t.bucket.features){let a=n.get("text-font").evaluate(r,{},t.canonical).join(","),h=c.evaluate(r,{},t.canonical),f=o.layoutTextSize.evaluate(r,{},t.canonical),d=o.layoutIconSize.evaluate(r,{},t.canonical),p={horizontal:{},vertical:void 0},m=r.text,g=[0,0];if(m){let o=m.toString(),c=24*n.get("text-letter-spacing").evaluate(r,{},t.canonical),d=!function(t){for(let r of t)if(!function(t){return!/[\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u077F\u07C0-\u07FA\u07FD-\u07FF\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\u1800\u1801\u1804\u1806-\u1819\u1820-\u1878\u1880-\u18AA\uA840-\uA877\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDD00-\uDD27\uDD30-\uDD39\uDE60-\uDE7E\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDEFF\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB]|\uD805[\uDE60-\uDE6C]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]|\uD83A[\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(t))}(r.codePointAt(0)))return!1;return!0}(o)?0:c,y=n.get("text-anchor").evaluate(r,{},t.canonical),v=cZ(i,r,t.canonical);if(!v){let i=n.get("text-radial-offset").evaluate(r,{},t.canonical);g=i?cW(y,[24*i,cH]):n.get("text-offset").evaluate(r,{},t.canonical).map(t=>24*t)}let _=l?"center":n.get("text-justify").evaluate(r,{},t.canonical),b="point"===n.get("symbol-placement")?24*n.get("text-max-width").evaluate(r,{},t.canonical):1/0,x=()=>{t.bucket.allowVerticalPlacement&&u1(o)&&(p.vertical=cE(m,t.glyphMap,t.glyphPositions,t.imagePositions,a,b,s,y,"left",d,g,2,!0,f,h))};if(!l&&v){let r=new Set;if("auto"===_)for(let t=0;t<v.values.length;t+=2)r.add(cY(v.values[t]));else r.add(_);let i=!1;for(let n of r)if(!p.horizontal[n])if(i)p.horizontal[n]=p.horizontal[0];else{let r=cE(m,t.glyphMap,t.glyphPositions,t.imagePositions,a,b,s,"center",n,d,g,1,!1,f,h);r&&(p.horizontal[n]=r,i=1===r.positionedLines.length)}x()}else{"auto"===_&&(_=cY(y));let r=cE(m,t.glyphMap,t.glyphPositions,t.imagePositions,a,b,s,y,_,d,g,1,!1,f,h);r&&(p.horizontal[_]=r),x(),u1(o)&&l&&u&&(p.vertical=cE(m,t.glyphMap,t.glyphPositions,t.imagePositions,a,b,s,y,_,d,g,2,!1,f,h))}}let y,v=!1;if(r.icon?.name){let i=t.imageMap[r.icon.name];i&&(y=function(t,r,i){let{horizontalAlign:n,verticalAlign:a}=cT(i),o=r[0],s=r[1],l=o-t.displaySize[0]*n,u=l+t.displaySize[0],c=s-t.displaySize[1]*a;return{image:t,top:c,bottom:c+t.displaySize[1],left:l,right:u}}(t.imagePositions[r.icon.name],n.get("icon-offset").evaluate(r,{},t.canonical),n.get("icon-anchor").evaluate(r,{},t.canonical)),v=!!i.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=v:t.bucket.sdfIcons!==v&&tI("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),i.pixelRatio===t.bucket.pixelRatio?0!==n.get("icon-rotate").constantOr(1)&&(t.bucket.iconsNeedLinear=!0):t.bucket.iconsNeedLinear=!0)}let _=cK(p.horizontal)||p.vertical;t.bucket.iconsInText||=!!_&&_.iconsInText,(_||y)&&function(t,r,i,n,a,o,s,l,u,c,h,f,d){let p=o.textMaxSize.evaluate(r,{});void 0===p&&(p=s);let m=t.layers[0].layout,g=m.get("icon-offset").evaluate(r,{},h),y=cK(i.horizontal),v=s/24,_=t.tilePixelRatio*v,b=t.tilePixelRatio*p/24,x=t.tilePixelRatio*l,w=t.tilePixelRatio*m.get("symbol-spacing"),E=m.get("text-padding")*t.tilePixelRatio,T=function(t,r,i,n=1){let a=t.get("icon-padding").evaluate(r,{},i)?.values;return[a[0]*n,a[1]*n,a[2]*n,a[3]*n]}(m,r,h,t.tilePixelRatio),A=m.get("text-max-angle")/180*Math.PI,S="viewport"!==m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),C="map"===m.get("icon-rotation-alignment").constantOr("viewport")&&"point"!==m.get("symbol-placement"),M=m.get("symbol-placement"),D=w/2,P=m.get("icon-text-fit"),I;n&&"none"!==P&&(t.allowVerticalPlacement&&i.vertical&&(I=cD(n,i.vertical,P,m.get("icon-text-fit-padding"),g,v)),y&&(n=cD(n,y,P,m.get("icon-text-fit-padding"),g,v)));let k=h?f.line.getGranularityForZoomLevel(h.z):1,O=(l,f)=>{f.x<0||f.x>=8192||f.y<0||f.y>=8192||function(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S){var C,M;let D=t.addToLineVertexArray(r,i),P=l.layout.get("symbol-height-offset").evaluate(x,{},T);P>t.maxHeightOffset&&(t.maxHeightOffset=P);let I,k,O,N,L=0,R=0,F=0,B=0,z=-1,j=-1,U={},V=(0,sh.default)("");if(t.allowVerticalPlacement&&n.vertical){let t=l.layout.get("text-rotate").evaluate(x,{},T)+90;O=new cU(u,r,c,h,f,n.vertical,d,p,m,t),s&&(N=new cU(u,r,c,h,f,s,y,v,m,t))}
57if(a){let i=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),o=cB(a,i,E,n),d=s?cB(s,i,E,n):void 0;k=new cU(u,r,c,h,f,a,y,v,!1,i),L=4*o.length;let p=t.iconSizeData,m=null;"source"===p.kind?(m=[128*l.layout.get("icon-size").evaluate(x,{})])[0]>32640&&tI(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===p.kind&&((m=[128*w.compositeIconSizes[0].evaluate(x,{},T),128*w.compositeIconSizes[1].evaluate(x,{},T)])[0]>32640||m[1]>32640)&&tI(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),t.addSymbols(t.icon,o,m,b,_,x,0,r,D.lineStartIndex,D.lineLength,-1,T,P),z=t.icon.placedSymbolArray.length-1,d&&(R=4*d.length,t.addSymbols(t.icon,d,m,b,_,x,2,r,D.lineStartIndex,D.lineLength,-1,T,P),j=t.icon.placedSymbolArray.length-1)}let $=Object.keys(n.horizontal);for(let i of $){let a=n.horizontal[i];I||=(V=(0,sh.default)(a.text),new cU(u,r,c,h,f,a,d,p,m,l.layout.get("text-rotate").evaluate(x,{},T)));let s=1===a.positionedLines.length;if(F+=cX(t,r,a,o,l,m,x,g,P,D,n.vertical?1:3,s?$:[i],U,z,w,T),s)break}n.vertical&&(B+=cX(t,r,n.vertical,o,l,m,x,g,P,D,2,["vertical"],U,j,w,T));let G=I?I.boxStartIndex:t.collisionBoxArray.length,q=I?I.boxEndIndex:t.collisionBoxArray.length,H=O?O.boxStartIndex:t.collisionBoxArray.length,W=O?O.boxEndIndex:t.collisionBoxArray.length,Z=k?k.boxStartIndex:t.collisionBoxArray.length,Y=k?k.boxEndIndex:t.collisionBoxArray.length,X=N?N.boxStartIndex:t.collisionBoxArray.length,K=N?N.boxEndIndex:t.collisionBoxArray.length,Q=-1,J=(t,r)=>t?.circleDiameter?Math.max(t.circleDiameter,r):r;Q=J(I,-1),Q=J(O,Q),Q=J(k,Q);let ee=+((Q=J(N,Q))>-1);ee&&(Q*=A/24),t.glyphOffsetArray.length>=t.maxGlyphs&&tI("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);let et=cZ(l,x,T),[er,ei]=function(t,r){let i=t.length,n=r?.values;if(n?.length>0)for(let r=0;r<n.length;r+=2){let i=cq[n[r]],a=n[r+1];t.emplaceBack(i,a[0],a[1])}return[i,t.length]}(t.textAnchorOffsets,et);S&&(C=V,V=null==(M=x).id||M.properties?.cluster?C:(0,sh.default)(String(M.id),C)),t.symbolInstances.emplaceBack(r.x,r.y,U.right>=0?U.right:-1,U.center>=0?U.center:-1,U.left>=0?U.left:-1,U.vertical||-1,z,j,V,G,q,H,W,Z,Y,X,K,c,F,B,L,R,ee,0,d,Q,er,ei,P)}(t,f,l,i,n,a,I,t.layers[0],t.collisionBoxArray,r.index,r.sourceLayerIndex,t.index,_,[E,E,E,E],S,u,x,T,C,g,r,o,c,h,s,d)};if("line"===M)for(let a of cF(r.geometry,0,0,8192,8192)){let r=lQ(a,k);for(let a of function(t,r,i,n,a,o,s){let l=n?.6*24*o:0,u=cR(n,a),c=u*o,h=0===t[0].x||8192===t[0].x||0===t[0].y||8192===t[0].y;return r-c<r/4&&(r=c+r/4),function t(r,i,n,a,o,s,l,u,c){let h=s/2,f=cL(r),d=0,p=i-n,m=[];for(let t=0;t<r.length-1;t++){let i=r[t],l=r[t+1],u=i.dist(l),g=l.angleTo(i);for(;p+n<d+u;){let y=((p+=n)-d)/u,v=il.number(i.x,l.x,y),_=il.number(i.y,l.y,y);if(v>=0&&v<c&&_>=0&&_<c&&p-h>=0&&p+h<=f){let i=new cO(v,_,g,t);i._round(),(!a||cN(r,i,s,a,o))&&m.push(i)}}d+=u}return u||m.length||l||(m=t(r,d/2,n,a,o,s,l,!0,c)),m}(t,h?r/2*s%r:(u/2+48)*o*s%r,r,l,i,c,h,!1,8192)}(r,w,A,i.vertical||y,n,b,t.overscaling))y&&function(t,r,i,n){let a=t.compareText;if(r in a){let t=a[r];for(let r=t.length-1;r>=0;r--)if(n.dist(t[r])<i)return!0}else a[r]=[];return a[r].push(n),!1}(t,y.text,D,a)||O(r,a)}else if("line-center"===M){for(let t of r.geometry)if(t.length>1){let r=lQ(t,k),a=function(t,r,i,n,a){let o=i?.6*24*a:0,s=cR(i,n)*a,l=0,u=cL(t)/2;for(let i=0;i<t.length-1;i++){let n=t[i],a=t[i+1],c=n.dist(a);if(l+c>u){let h=(u-l)/c,f=new cO(il.number(n.x,a.x,h),il.number(n.y,a.y,h),a.angleTo(n),i);return f._round(),!o||cN(t,f,s,o,r)?f:void 0}l+=c}}(r,A,i.vertical||y,n,b);a&&O(r,a)}}else if("Polygon"===r.type)for(let t of ih(r.geometry,0)){let r=function(t,r=1){let i=l7.fromPoints(t[0]),n=Math.min(i.width(),i.height()),a=n/2,o=new cV([],c$),{minX:s,minY:l,maxX:u,maxY:c}=i;if(0===n)return new eT(s,l);for(let r=s;r<u;r+=n)for(let i=l;i<c;i+=n)o.push(new cG(r+a,i+a,a,t));let h=function(t){let r=0,i=0,n=0,a=t[0];for(let t=0,o=a.length,s=o-1;t<o;s=t++){let o=a[t],l=a[s],u=o.x*l.y-l.x*o.y;i+=(o.x+l.x)*u,n+=(o.y+l.y)*u,r+=3*u}return new cG(i/r,n/r,0,t)}(t),f=h;for(;o.length;){let i=o.pop();(i.d>f.d||!f.d)&&(f=i),i.max-f.d<=r||(a=i.h/2,o.push(new cG(i.p.x-a,i.p.y-a,a,t)),o.push(new cG(i.p.x+a,i.p.y-a,a,t)),o.push(new cG(i.p.x-a,i.p.y+a,a,t)),o.push(new cG(i.p.x+a,i.p.y+a,a,t)))}return h.d>0&&f.d-h.d<=r?h.p:f.p}(t,16);O(lQ(t[0],k,!0),new cO(r.x,r.y,0))}else if("LineString"===r.type)for(let t of r.geometry){let r=lQ(t,k);O(r,new cO(r[0].x,r[0].y,0))}else if("Point"===r.type)for(let t of r.geometry)for(let r of t)O([r],new cO(r.x,r.y,0))}(t.bucket,r,p,y,t.imageMap,o,f,d,g,v,t.canonical,t.subdivisionGranularity,t.hasPromoteId)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}({bucket:this,glyphMap:i,glyphPositions:n,imageMap:a,imagePositions:o,showCollisionBoxes:s,canonical:r,subdivisionGranularity:t.subdivisionGranularity,hasPromoteId:null!=t.featureIndex.promoteId})}isEmpty(){return 0===this.symbolInstances.length}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){let i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(r[t.segment+1]),n=t.dist(r[t.segment]),a={};for(let n=t.segment+1;n<r.length;n++)a[n]={x:r[n].x,y:r[n].y,tileUnitDistanceFromAnchor:i},n<r.length-1&&(i+=r[n+1].dist(r[n]));for(let i=t.segment||0;i>=0;i--)a[i]={x:r[i].x,y:r[i].y,tileUnitDistanceFromAnchor:n},i>0&&(n+=r[i-1].dist(r[i]));for(let t=0;t<r.length;t++){let r=a[t];this.lineVertexArray.emplaceBack(r.x,r.y,r.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,r,i,n,a,o,s,l,u,c,h,f,d){let p=t.indexArray,m=t.layoutVertexArray,g=t.segments.prepareSegment(4*r.length,m,p,this.canOverlap?o.sortKey:void 0),y=this.glyphOffsetArray.length,v=g.vertexLength,_=this.allowVerticalPlacement&&2===s?Math.PI/2:0,b=o.text&&o.text.sections;for(let n=0;n<r.length;n++){let{tl:a,tr:s,bl:u,br:c,tex:h,pixelOffsetTL:y,pixelOffsetBR:v,minFontScaleX:x,minFontScaleY:w,glyphOffset:E,isSDF:T,sectionIndex:A}=r[n],S=g.vertexLength,C=E[1];c0(m,l.x,l.y,a.x,C+a.y,h.x,h.y,i,T,y.x,y.y,x,w,d),c0(m,l.x,l.y,s.x,C+s.y,h.x+h.w,h.y,i,T,v.x,y.y,x,w,d),c0(m,l.x,l.y,u.x,C+u.y,h.x,h.y+h.h,i,T,y.x,v.y,x,w,d),c0(m,l.x,l.y,c.x,C+c.y,h.x+h.w,h.y+h.h,i,T,v.x,v.y,x,w,d),c1(t.dynamicLayoutVertexArray,l,_),p.emplaceBack(S,S+2,S+1),p.emplaceBack(S+1,S+2,S+3),g.vertexLength+=4,g.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(E[0]),(n===r.length-1||A!==r[n+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(m.length,o,o.index,{imagePositions:{},canonical:f,formattedSection:b?.[A]})}t.placedSymbolArray.emplaceBack(l.x,l.y,y,this.glyphOffsetArray.length-y,v,u,c,l.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,h,d)}_addCollisionDebugVertex(t,r,i,n,a,o){return r.emplaceBack(0,0),t.emplaceBack(i.x,i.y,n,a,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,r,i,n,a,o,s){let l=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),u=l.vertexLength,c=a.layoutVertexArray,h=a.collisionVertexArray,f=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(c,h,o,f,d,new eT(t,r)),this._addCollisionDebugVertex(c,h,o,f,d,new eT(i,r)),this._addCollisionDebugVertex(c,h,o,f,d,new eT(i,n)),this._addCollisionDebugVertex(c,h,o,f,d,new eT(t,n)),l.vertexLength+=4;let p=a.indexArray;p.emplaceBack(u,u+1),p.emplaceBack(u+1,u+2),p.emplaceBack(u+2,u+3),p.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(t,r,i,n){for(let a=t;a<r;a++){let t=this.collisionBoxArray.get(a),r=t.x1,o=t.y1,s=t.x2,l=t.y2;this.addCollisionDebugVertices(r,o,s,l,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new c3(o5,uz.members,st),this.iconCollisionBox=new c3(o5,uz.members,st);for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,i,n,a,o,s,l,u){let c={};for(let n=r;n<i;n++){let r=t.get(n);c.textBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},c.textFeatureIndex=r.featureIndex;break}for(let r=n;r<a;r++){let i=t.get(r);c.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anch
vendor: 9,033 bytes, line 57
57orPointY},c.verticalTextFeatureIndex=i.featureIndex;break}for(let r=o;r<s;r++){let i=t.get(r);c.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.iconFeatureIndex=i.featureIndex;break}for(let r=l;r<u;r++){let i=t.get(r);c.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalIconFeatureIndex=i.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let i=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,r){let i=t.placedSymbolArray.get(r),n=i.vertexStartIndex+4*i.numGlyphs;for(let r=i.vertexStartIndex;r<n;r+=4)t.indexArray.emplaceBack(r,r+2,r+1),t.indexArray.emplaceBack(r+1,r+2,r+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let r=Math.sin(t),i=Math.cos(t),n=[],a=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);let s=this.symbolInstances.get(t);n.push(0|Math.round(r*s.anchorX+i*s.anchorY)),a.push(s.featureIndex)}return o.sort((t,r)=>n[t]-n[r]||a[r]-a[t]),o}addToSortKeyRanges(t,r){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];i?.sortKey===r?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let t=this.symbolInstances.get(r);this.featureSortOrder.push(t.featureIndex);let i=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let t=0;t<i.length;t++){let r=i[t];r>=0&&i.indexOf(r)===t&&this.addIndicesForPlacedSymbol(this.text,r)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};aj("SymbolBucket",c4,{omit:["layers","collisionBoxArray","features","compareText"]});var c6={get paint(){return b||=new a9({"icon-opacity":new a6(rt.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new a6(rt.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new a6(rt.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new a6(rt.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new a6(rt.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new a4(rt.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new a4(rt.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new a6(rt.paint_symbol["text-opacity"],"text-opacity"),"text-color":new a6(rt.paint_symbol["text-color"],"text-color",{runtimeType:rl,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new a6(rt.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new a6(rt.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new a6(rt.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new a4(rt.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new a4(rt.paint_symbol["text-translate-anchor"],"text-translate-anchor")})},get layout(){return _||=new a9({"symbol-placement":new a4(rt.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new a4(rt.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new a4(rt.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new a6(rt.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new a4(rt.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new a4(rt.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new a4(rt.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new a4(rt.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new a4(rt.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new a6(rt.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new a6(rt.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new a4(rt.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new a4(rt.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new a6(rt.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new a6(rt.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new a6(rt.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new a4(rt.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new a6(rt.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new a6(rt.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new a4(rt.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new a4(rt.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new a4(rt.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new a6(rt.layout_symbol["text-field"],"text-field"),"text-font":new a6(rt.layout_symbol["text-font"],"text-font"),"text-size":new a6(rt.layout_symbol["text-size"],"text-size"),"text-max-width":new a6(rt.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new a4(rt.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new a6(rt.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new a6(rt.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new a6(rt.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new a4(rt.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new a6(rt.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new a6(rt.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new a4(rt.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new a4(rt.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new a6(rt.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new a4(rt.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new a4(rt.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new a6(rt.layout_symbol["text-transform"],"text-transform"),"text-offset":new a6(rt.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new a4(rt.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new a4(rt.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new a4(rt.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new a4(rt.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new a6(rt.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new a4(rt.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")})}},c5=class{constructor(t){if(void 0===t.property.overrides)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:rn,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r?.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}};aj("FormatSectionOverride",c5,{omit:["defaultValue"]});let c8=t=>"symbol"===t.type;var c7=class t extends or{constructor(t,r){super(t,c6,r)}recalculate(t,r){super.recalculate(t,r);let i=this.layout.get("icon-rotation-alignment");
57if(("constant"!==i.value.kind||"auto"===i.value.value)&&(this.layout._values["icon-rotation-alignment"]=new a0(i.property,{kind:"constant",value:"point"===this.layout.get("symbol-placement")?"viewport":"map"},i.parameters)),"auto"===this.layout.get("text-rotation-alignment")&&("point"===this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),"point"===this.layout.get("symbol-placement")){let t=this.layout.get("text-writing-mode");if(t){let r=[];for(let i of t)r.includes(i)||r.push(i);this.layout._values["text-writing-mode"]=r}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,i,n){var a;let o=this.layout.get(t).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||nV(s.value)||!o?o:(a=r.properties,o.replace(/{([^{}]+)}/g,(t,r)=>a&&r in a?String(a[r]):""))}createBucket(t){return new c4(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let r of c6.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,r))continue;let i=this.paint.get(r),n=new nz(new c5(i),`layers[${this.id}].paint.${i.property.name}`,i.property.specification),a=null;a="constant"===i.value.kind||"source"===i.value.kind?new nG("source",n):new nq("composite",n,i.value.zoomStops),this.paint._values[r]=new a0(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(r,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&t.hasPaintOverride(this.layout,r)}static hasPaintOverride(t,r){let i=t.get("text-field"),n=c6.paint.properties[r],a=!1,o=t=>{for(let r of t)if(n.overrides?.hasOverride(r)){a=!0;return}};if("constant"===i.value.kind&&i.value.value instanceof rY)o(i.value.value.sections);else if("source"===i.value.kind||"composite"===i.value.kind){let t=r=>{a||(r instanceof r9&&r8(r.value)===rd?o(r.value.sections):r instanceof iu?o(r.sections):r.eachChild(t))},r=i.value;r._styleExpression&&t(r._styleExpression.expression)}return a}},c9={get paint(){return x||=new a9({"background-color":new a4(rt.paint_background["background-color"],"background-color"),"background-pattern":new a8(rt.paint_background["background-pattern"],"background-pattern"),"background-opacity":new a4(rt.paint_background["background-opacity"],"background-opacity")})}},he=class extends or{constructor(t,r){super(t,c9,r)}},ht=class extends or{constructor(t,r){super(t,{},r),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function hr(t,r){if("custom"===t.type)return new ht(t,r);switch(t.type){case"background":return new he(t,r);case"circle":return new s6(t,r);case"color-relief":return new ld(t,r);case"fill":return new l4(t,r);case"fill-extrusion":return new uT(t,r);case"heatmap":return new lo(t,r);case"hillshade":return new ll(t,r);case"line":return new uL(t,r);case"raster":return new oa(t,r);case"symbol":return new c7(t,r)}}var hi=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};let hn={once:!0};var ha=class{constructor(t,r){this.target=t,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new hi(()=>this.process()),this.subscription=tB(this.target,"message",t=>this.receive(t),!1),this.globalScope=tO(self)?t:window}registerMessageHandler(t,r){this.messageHandlers[t]=r}unregisterMessageHandler(t){delete this.messageHandlers[t]}
57sendAsync(t,r){return new Promise((i,n)=>{let a=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=r?tB(r.signal,"abort",()=>{o?.unsubscribe(),delete this.resolveRejects[a];let i={id:a,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(i),n(new tW(r.signal.reason))},hn):null;this.resolveRejects[a]={resolve:t=>{o?.unsubscribe(),i(t)},reject:t=>{o?.unsubscribe(),n(t)}};let s=[],l={...t,id:a,sourceMapId:this.mapId,origin:location.origin,data:aG(t.data,s)};this.target.postMessage(l,{transfer:s})})}receive(t){let r=t.data,i=r.id,n=["file://","resource://android","null"],a=[r.origin,location.origin],o=r.origin===location.origin,s=a.some(t=>n.includes(t));if((o||s)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if("<cancel>"===r.type){delete this.tasks[i];let t=this.abortControllers[i];delete this.abortControllers[i],t&&t.abort();return}if(tO(self)||r.mustQueue){this.tasks[i]=r,this.taskQueue.push(i),this.invoker.trigger();return}this.processTask(i,r)}}process(){if(0===this.taskQueue.length)return;let t=this.taskQueue.shift(),r=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(t,r)}async processTask(t,r){if("<response>"===r.type){let i=this.resolveRejects[t];if(delete this.resolveRejects[t],!i)return;r.error?i.reject(ti(aq(r.error))):i.resolve(aq(r.data));return}if(!this.messageHandlers[r.type])return void this.completeTask(t,null,null);let i=aq(r.data),n=new AbortController;this.abortControllers[t]=n;try{let a=await this.messageHandlers[r.type](r.sourceMapId,i,n);this.completeTask(t,null,a)}catch(r){this.completeTask(t,ti(r))}}completeTask(t,r,i){let n=[];delete this.abortControllers[t];let a={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?aG(r):null,data:aG(i,n)};this.target.postMessage(a,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function ho(t,r){let{x:i,y:n}=ud.fromLngLat(r);return!(t<0||t>25||n<0||n>=1||i<0||i>=1)}var hs=class{constructor(t,r,i){if(!function(t,r,i){return!(t<0||t>25||i<0||i>=2**t||r<0||r>=2**t)}(t,r,i))throw Error(`x=${r}, y=${i}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=r,this.y=i,this.key=hc(0,t,t,r,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,i){var n,a,o;let s,l,u=(n=this.x,a=this.y,o=this.z,s=hf(256*n,256*(a=2**o-a-1),o),l=hf((n+1)*256,(a+1)*256,o),`${s[0]},${s[1]},${l[0]},${l[1]}`),c=function(t,r,i){let n="";for(let a=t;a>0;a--){let t=1<<a-1;n+=(r&t?1:0)+(i&t?2:0)}return n}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,u)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=2**this.z;return new eT((t.x*r-this.x)*8192,(t.y*r-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},hl=class{constructor(t,r){this.wrap=t,this.canonical=r,this.key=hc(t,r.z,r.z,r.x,r.y)}},hu=class t{constructor(t,r,i,n,a){if(this.terrainRttPosMatrix32f=null,t<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=r,this.canonical=new hs(i,+n,+a),this.key=hc(r,t,i,n,a)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(r){if(r>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${r}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-r;return r>this.canonical.z?new t(r,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(r,this.wrap,r,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,r){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?hc(this.wrap*r,t,this.canonical.z,this.canonical.x,this.canonical.y):hc(this.wrap*r,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;
57if(0===t.overscaledZ)return this.overscaledZ>0;let r=this.canonical.z-t.canonical.z;return!(r<0)&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(r){if(this.overscaledZ>=r)return[new t(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,n=2*this.canonical.x,a=2*this.canonical.y;return[new t(i,this.wrap,i,n,a),new t(i,this.wrap,i,n+1,a),new t(i,this.wrap,i,n,a+1),new t(i,this.wrap,i,n+1,a+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new t(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(r){return new t(this.overscaledZ,r,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new hl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ud(t.x-this.wrap,t.y))}normalizeCoordinates(r,i,n=8192){if(r>=0&&r<n&&i>=0&&i<n)return{tileID:this,x:r,y:i};let a=Math.floor(r/n),o=Math.floor(i/n),s=this.canonical.z,l=1<<s,u=this.canonical.y+o;if(u<0||u>=l)return null;let c=this.canonical.x+a,h=this.wrap;return c<0?(h-=Math.ceil(-c/l),c=(c%l+l)%l):c>=l&&(h+=Math.floor(c/l),c%=l),{tileID:new t(this.overscaledZ,h,s,c,u),x:r-a*n,y:i-o*n}}};function hc(t,r,i,n,a){(t*=2)<0&&(t=-1*t-1);let o=1<<i;return(o*o*t+o*a+n).toString(36)+i.toString(36)+r.toString(36)}let hh=6378137*Math.PI;function hf(t,r,i){let n=2*hh/256/2**i;return[t*n-hh,r*n-hh]}function hd(t,r){let i=Math.abs(2*t.wrap)-(t.wrap<0),n=Math.abs(2*r.wrap)-(r.wrap<0);return t.overscaledZ-r.overscaledZ||n-i||r.canonical.y-t.canonical.y||r.canonical.x-t.canonical.x}aj("CanonicalTileID",hs),aj("OverscaledTileID",hu,{omit:["terrainRttPosMatrix32f"]});let hp="_geojsonTileLayer";var hm=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let i=t[r];this._stringToNumber[i]=r,this._numberToString[r]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},hg=class{constructor(t,r,i,n,a){for(let a in this.type="Feature",this._vectorTileFeature=t,this._x=i,this._y=n,this._z=r,t.properties)"string"==typeof t.properties[a]&&t.properties[a].startsWith("__$json__:")&&(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=a}projectPoint(t,r,i,n){return[(t.x+r)*360/n-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+i)*2/n)*Math.PI))-90]}projectLine(t,r,i,n){return t.map(t=>this.projectPoint(t,r,i,n))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,r=t.extent*2**this._z,i=t.extent*this._x,n=t.extent*this._y,a=t.loadGeometry();switch(t.type){case 1:{let t=[];for(let r of a)t.push(r[0]);let o=this.projectLine(t,i,n,r);this._geometry=1===t.length?{type:"Point",coordinates:o[0]}:{type:"MultiPoint",coordinates:o};break}case 2:{let t=a.map(t=>this.projectLine(t,i,n,r));this._geometry=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t};break}case 3:{let t=ui(a),o=[];for(let a of t)o.push(a.map(t=>this.projectLine(t,i,n,r)));this._geometry=1===o.length?{type:"Polygon",coordinates:o[0]}:{type:"MultiPolygon",coordinates:o};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)"_geometry"!==r&&"_vectorTileFeature"!==r&&"_x"!==r&&"_y"!==r&&"_z"!==r&&(t[r]=this[r]);return t}},hy=class{constructor(t,r,i){this._name=t,this.dataBuffer=r,"number"==typeof i?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},hv=class extends hy{},h_=class extends hv{getValueFromBuffer(t){return this.dataBuffer[t]}},hb=class extends hv{getValueFromBuffer(t){return this.dataBuffer[t]}},hx=class extends hy{constructor(t,r,i,n){super(t,r,n),this.delta=i}},hw=class extends hx{constructor(t,r,i,n,a){super(t,a?Int32Array.of(r):Uint32Array.of(r),i,n)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},hE=class extends hy{constructor(t,r,i,n){super(t,n?Int32Array.of(r):Uint32Array.of(r),i)}getValueFromBuffer(t){return this.dataBuffer[0]}},hT=class{constructor(t,r,i,n,a=4096){if(this._name=t,this._geometryVector=r,this._idVector=i,this._propertyVectors=n,this._extent=a,0===t.length)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}
57getPropertyVector(t){return this.propertyVectorsMap||=new Map(this.propertyVectors.map(t=>[t.name,t])),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],r=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let n;if(this.idVector){let t=this.idVector.getValue(i);null!==t&&(n=this.containsMaxSafeIntegerValues(this.idVector)?Number(t):t)}let a={coordinates:r[i],type:this.geometryVector.geometryType(i)},o={};for(let t of this.propertyVectors){if(!t)continue;let r=t.name,n=t.getValue(i);null!==n&&(o[r]=n)}t.push({id:n,geometry:a,properties:o})}return t}containsMaxSafeIntegerValues(t){return t instanceof h_||t instanceof hE||t instanceof hw||t instanceof hb}},hA,hS,hC,hM,hD=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}};(fF=hM||={}).NONE="NONE",fF.DELTA="DELTA",fF.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",fF.RLE="RLE",fF.MORTON="MORTON",(fB=fW||={}).NONE="NONE",fB.FAST_PFOR="FAST_PFOR",fB.VARINT="VARINT";let hP=new Uint32Array(33);hP[0]=0;for(let t=1;t<=32;t++)hP[t]=32===t?0xffffffff:0xffffffff>>>32-t;function hI(t){var r;if(!Number.isFinite(t)||t<=0)return 65536;let i=(r=Math.floor(t))-r%256;return 0===i?256:i}let hk=hI(65536),hO=3*hk/256+hk|0;function hN(){let t=new Uint8Array(hO);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function hL(t,r,i){let n=new Uint32Array(i),a=0,o=r.get();for(let r=0;r<n.length;r++){let r=t[o++],i=127&r;if(r<128||(i|=(127&(r=t[o++]))<<7,r<128)||(i|=(127&(r=t[o++]))<<14,r<128)||(i|=(127&(r=t[o++]))<<21,r<128)){n[a++]=i;continue}i|=(15&(r=t[o++]))<<28,n[a++]=i}return r.set(o),n}function hR(t,r,i){let n=new BigUint64Array(i);for(let i=0;i<n.length;i++)n[i]=function(t,r){let i=0n,n=0,a=r.get();for(;a<t.length;){let r=t[a++];if(i|=BigInt(127&r)<<BigInt(n),!(128&r))break;if((n+=7)>=64)throw Error("Varint too long")}return r.set(a),i}(t,r);return n}function hF(t){return t>>>1^-(1&t)}function hB(t){return t>>1n^-(1n&t)}function hz(t){return t%2==1?-((t+1)/2):t/2}function hj(t,r,i){if(void 0===i){i=0;for(let n=0;n<r;n++)i+=t[n]}let n=new Uint32Array(i),a=0;for(let i=0;i<r;i++){let o=t[i],s=t[i+r];n.fill(s,a,a+o),a+=o}return n}function hU(t,r,i){if(void 0===i){i=0;for(let n=0;n<r;n++)i+=Number(t[n])}let n=new BigUint64Array(i),a=0;for(let i=0;i<r;i++){let o=Number(t[i]),s=t[i+r];n.fill(s,a,a+o),a+=o}return n}function hV(t,r,i){let n=new Float64Array(i),a=0;for(let i=0;i<r;i++){let o=t[i],s=t[i+r];n.fill(s,a,a+o),a+=o}return n}function h$(t){let r=new Int32Array(t.length);r[0]=hF(t[0]);let i=t.length/4*4,n=1;if(i>=4)for(;n<i-4;n+=4){let i=t[n],a=t[n+1],o=t[n+2],s=t[n+3];r[n]=hF(i)+r[n-1],r[n+1]=hF(a)+r[n],r[n+2]=hF(o)+r[n+1],r[n+3]=hF(s)+r[n+2]}for(;n!==t.length;++n)r[n]=hF(t[n])+r[n-1];return r}function hG(t){let r=new BigInt64Array(t.length);r[0]=hB(t[0]);let i=t.length/4*4,n=1;if(i>=4)for(;n<i-4;n+=4){let i=t[n],a=t[n+1],o=t[n+2],s=t[n+3];r[n]=hB(i)+r[n-1],r[n+1]=hB(a)+r[n],r[n+2]=hB(o)+r[n+1],r[n+3]=hB(s)+r[n+2]}for(;n!==r.length;++n)r[n]=hB(t[n])+r[n-1];return r}function hq(t){let r=t.length/4*4,i=1;if(r>=4)for(let n=t[0];i<r-4;i+=4)n=t[i]+=n,n=t[i+1]+=n,n=t[i+2]+=n,n=t[i+3]+=n;for(;i!==t.length;)t[i]+=t[i-1],++i}function hH(t,r,i,n){if(t.length<2)return new Int32Array(t);let a=new Int32Array(t.length),o=hF(t[0]),s=hF(t[1]);a[0]=hW(Math.round(o*r),i,n),a[1]=hW(Math.round(s*r),i,n);let l=t.length/16,u=2;if(l>=4)for(;u<l-4;u+=4){let l=t[u],c=t[u+1],h=hF(l)+o,f=hF(c)+s;a[u]=hW(Math.round(h*r),i,n),a[u+1]=hW(Math.round(f*r),i,n);let d=t[u+2],p=t[u+3];o=hF(d)+h,s=hF(p)+f,a[u+2]=hW(Math.round(o*r),i,n),a[u+3]=hW(Math.round(s*r),i,n)}for(;u!==t.length;u+=2)o+=hF(t[u]),s+=hF(t[u+1]),a[u]=hW(Math.round(o*r),i,n),a[u+1]=hW(Math.round(s*r),i,n);return a}function hW(t,r,i){return Math.min(i,Math.max(r,t))}function hZ(t){let r=new Uint32Array(t.length);r[0]=hF(t[0])>>>0;for(let i=1;i<t.length;i++)r[i]=r[i-1]+hF(t[i])>>>0;return r}function hY(t){let r=new BigUint64Array(t.length);r[0]=BigInt.asUintN(64,hB(t[0]));for(let i=1;i<t.length;i++)r[i]=BigInt.asUintN(64,r[i-1]+hB(t[i]));return r}(fz=fZ||={}).PRESENT="PRESENT",fz.DATA="DATA",fz.OFFSET="OFFSET",fz.LENGTH="LENGTH",(fj=fY||={}).NONE="NONE",fj.SINGLE="SINGLE",fj.SHARED="SHARED",fj.VERTEX="VERTEX",fj.MORTON="MORTON",fj.FSST="FSST",(fU=fX||={}).VERTEX="VERTEX",fU.INDEX="INDEX",fU.STRING="STRING",fU.KEY="KEY",(fV=fK||={}).VAR_BINARY="VAR_BINARY",fV.GEOMETRIES="GEOMETRIES",fV.PARTS="PARTS",fV.RINGS="RINGS",fV.TRIANGLES="TRIANGLES",fV.SYMBOL="SYMBOL",fV.DICTIONARY="DICTIONARY";let hX=[fZ.PRESENT,fZ.DATA,fZ.OFFSET,fZ.LENGTH],hK=[hM.NONE,hM.DELTA,hM.COMPONENTWISE_DELTA,hM.RLE,hM.MORTON],hQ=[fW.NONE,fW.FAST_PFOR,fW.VARINT],hJ=[fY.NONE,fY.SINGLE,fY.SHARED,fY.VERTEX,fY.MORTON,fY.FSST],h0=[fX.VERTEX,fX.INDEX,fX.STRING,fX.KEY],h1=[fK.VAR_BINARY,fK.GEOMETRIES,fK.PARTS,fK.RINGS,fK.TRIANGLES,fK.SYMBOL,fK.DICTIONARY];function h2(t,r){var i,n;let a,o,s=function(t,r){let i=t[r.get()],n=hX[i>>4],a={};switch(n){case fZ.DATA:a={dictionaryType:hJ[15&i]};break;case fZ.OFFSET:a={offsetType:h0[15&i]};break;case fZ.LENGTH:a={lengthType:h1[15&i]}}r.increment();let o=t[r.get()],s=hK[o>>5],l=hK[o>>2&7],u=hQ[3&o];r.increment();let c=hL(t,r,2),h=c[0];return{physicalStreamType:n,logicalStreamType:a,logicalLevelTechnique1:s,logicalLevelTechnique2:l,physicalLevelTechnique:u,numValues:h,byteLength:c[1],decompressedCount:h}}(t,r);return s.logicalLevelTechnique1===hM.MORTON?(i=s,a=hL(t,r,2),{physicalStreamType:i.physicalStreamType,logicalStreamType:i.logicalStreamType,logicalLevelTechnique1:i.logicalLevelTechnique1,logicalLevelTechnique2:i.logicalLevelTechnique2,physicalLevelTechnique:i.physicalLevelTechnique,numValues:i.numValues,byteLength:i.byteLength,decompressedCount:i.decompressedCount,numBits:a[0],coordinateShift:a[1]}):(hM.RLE===s.logicalLevelTechnique1||hM.RLE===s.logicalLevelTechnique2)&&fW.NONE!==s.physicalLevelTechnique?(n=s,o=hL(t,r,2),{physicalStreamType:n.physicalStreamType,logicalStreamType:n.logicalStreamType,logicalLevelTechnique1:n.logicalLevelTechnique1,logicalLevelTechnique2:n.logicalLevelTechnique2,physicalLevelTechnique:n.physicalLevelTechnique,numValues:n.numValues,byteLength:n.byteLength,decompressedCount:o[1],runs:o[0],numRleValues:o[1]}):s}(f$=fQ||={})[f$.FLAT=0]="FLAT",f$[f$.CONST=1]="CONST",f$[f$.SEQUENCE=2]="SEQUENCE",f$[f$.DICTIONARY=3]="DICTIONARY",f$[f$.FSST_DICTIONARY=4]="FSST_DICTIONARY";var h3=class{constructor(t,r){this.values=t,this._size=r}get(t){let r=Math.floor(t/8);return(this.values[r]>>t%8&1)==1}set(t,r){let i=Math.floor(t/8);this.values[i]=this.values[i]|!!r<<t%8}getInt(t){let r=Math.floor(t/8);return this.values[r]>>t%8&1}size(){return this._size}getBuffer(){return this.values}};function h4(t,r,i){if(!r)return t;let n=r.size(),a=new t.constructor(n),o=0;for(let s=0;s<n;s++)a[s]=r.get(s)?t[o++]:i;return a}function h6(t,r,i){for(let n=0;n<t;n++){let t=h2(r,i);i.add(t.byteLength)}}function h5(t,r,i,n,a){let o=function(t,r,i,n){let a=new Uint8Array(r),o=0,s=n.get()+i;for(;o<r&&!(n.get()>=s);){let i=t[n.increment()];if(i<=127){let s=i+3,l=t[n.increment()],u=Math.min(o+s,r);a.fill(l,o,u),o=u}else{let s=256-i;for(let i=0;i<s&&o<r;i++)a[o++]=t[n.increment()]}}return n.set(s),a}(t,Math.ceil(r/8),i,n);return a?function(t,r,i){if(!i)return t;let n=i.size(),a=new h3(t,r),o=new h3(new Uint8Array(Math.ceil(n/8)),n),s=0;for(let t=0;t<n;t++){let r=!!i.get(t)&&a.get(s++);o.set(t,r)}return o.getBuffer()}(o,r,a):o}function h8(t,r,i,n){let a=r.get(),o=a+i*Float32Array.BYTES_PER_ELEMENT,s=new Float32Array(new Uint8Array(t.subarray(a,o)).buffer);return r.set(o),n?h4(s,n,0):s}function h7(t,r,i,n){let a=r.get(),o=a+i*Float64Array.BYTES_PER_ELEMENT,s=new Float64Array(new Uint8Array(t.subarray(a,o)).buffer);return r.set(o),n?h4(s,n,0):s}let h9=new TextDecoder;function fe(t,r,i){return i-r>=12?h9.decode(t.subarray(r,i)):function(t,r,i){let n="",a=r;for(;a<i;){let r,o,s,l=t[a],u=null,c=l>239?4:l>223?3:l>191?2:1;if(a+c>i)break;1===c?l<128&&(u=l):2===c?(192&(r=t[a+1]))==128&&(u=(31&l)<<6|63&r)<=127&&(u=null):3===c?(r=t[a+1],o=t[a+2],(192&r)==128&&(192&o)==128&&((u=(15&l)<<12|(63&r)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(r=t[a+1],o=t[a+2],s=t[a+3],(192&r)==128&&(192&o)==128&&(192&s)==128&&((u=(15&l)<<18|(63&r)<<12|(63&o)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),a+=c}return n}(t,r,i)}function ft(t,r,i,n,a){let o;var s=fn(t,r,i),l=i,u=n,c=a;switch(l.logicalLevelTechnique1){case hM.DELTA:if(l.logicalLevelTechnique2===hM.RLE){if(!c)return function(t,r,i){let n=new Int32Array(i),a=0,o=0;for(let i=0;i<r;i++){let s=t[i],l=hF(t[i+r]);for(let t=0;t<s;t++)o+=l,n[a++]=o}return n}(s,l.runs,l.numRleValues);o=h$(s=hj(s,l.runs,l.numRleValues))}else o=h$(s);break;case hM.RLE:o=function(t,r,i){if(void 0===i){i=0;for(let n=0;n<r;n++)i+=t[n]}let n=new Int32Array(i),a=0;for(let i=0;i<r;i++){let o=t[i],s=t[i+r];s=hF(s),n.fill(s,a,a+o),a+=o}return n}(s,l.runs,l.numRleValues);break;case hM.MORTON:hq(s),o=new Int32Array(s);break;case hM.COMPONENTWISE_DELTA:if(u&&!c)return hH(s,u.scale,u.min,u.max);o=function(t){if(t.length<2)return new Int32Array(t);let r=new Int32Array(t.length);r[0]=hF(t[0]),r[1]=hF(t[1]);let i=t.length/4*4,n=2;if(i>=4)for(;n<i-4;n+=4){let i=t[n],a=t[n+1],o=t[n+2],s=t[n+3];r[n]=hF(i)+r[n-2],r[n+1]=hF(a)+r[n-1],r[n+2]=hF(o)+r[n],r[n+3]=hF(s)+r[n+1]}for(;n!==t.length;n+=2)r[n]=hF(t[n])+r[n-2],r[n+1]=hF(t[n+1])+r[n-1];return r}(s);break;case hM.NONE:o=function(t){let r=new Int32Array(t.length);for(let i=0;i<t.length;i++)r[i]=hF(t[i]);return r}(s);break;default:throw Error(`The specified Logical level technique is not supported: ${l.logicalLevelTechnique1}`)}return c?h4(o,c,0):o}function fr(t,r,i,n,a){return function(t,r,i,n){let a;switch(r.logicalLevelTechnique1){case hM.DELTA:a=r.logicalLevelTechnique2===hM.RLE?hZ(hj(t,r.runs,r.numRleValues)):hZ(t);break;case hM.RLE:a=hj(t,r.runs,r.numRleValues);break;case hM.MORTON:hq(t),a=t;break;case hM.COMPONENTWISE_DELTA:var o;a=i&&!n?(o=i.scale,new Uint32Array(hH(t,o,i.min,i.max))):function(t){if(t.length<2)return new Uint32Array(t);let r=new Uint32Array(t.length);r[0]=hF(t[0])>>>0,r[1]=hF(t[1])>>>0;for(let i=2;i<t.length;i+=2)r[i]=r[i-2]+hF(t[i])>>>0,r[i+1]=r[i-1]+hF(t[i+1])>>>0;return r}(t);break;case hM.NONE:a=t;break;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}return n?h4(a,n,0):a}(fn(t,r,i),i,n,a)}function fi(t,r,i){return function(t,r){if(r.logicalLevelTechnique1===hM.DELTA&&r.logicalLevelTechnique2===hM.NONE){let r=new Int32Array(t.length+1);r[0]=0,r[1]=hF(t[0]);let i=r[1];for(let n=2;n!==r.length;++n)i+=hF(t[n-1]),r[n]=r[n-1]+i;return new Uint32Array(r)}if(r.logicalLevelTechnique1===hM.RLE&&r.logicalLevelTechnique2===hM.NONE)return function(t,r,i){let n=new Uint32Array(i+1);n[0]=0;let a=1,o=n[0];for(let i=0;i<r;i++){let s=t[i],l=t[i+r];for(let t=a;t<a+s;t++)n[t]=l+o,o=n[t];a+=s}return n}(t,r.runs,r.numRleValues);if(r.logicalLevelTechnique1===hM.NONE&&r.logicalLevelTechnique2===hM.NONE){let i=0;for(let r=0;r<t.length;r++)t[r]+=i,i=t[r];let n=new Uint32Array(r.numValues+1);return n[0]=0,n.set(t,1),n}if(r.logicalLevelTechnique1===hM.DELTA&&r.logicalLevelTechnique2===hM.RLE){let i=function(t,r,i){let n=new Int32Array(i+1);n[0]=0;let a=1,o=n[0];for(let i=0;i<r;i++){let s=t[i],l=t[i+r];l=hF(l);for(let t=a;t<a+s;t++)n[t]=l+o,o=n[t];a+=s}return n}(t,r.runs,r.numRleValues);return hq(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(fn(t,r,i),i)}function fn(t,r,i){let n=i.physicalLevelTechnique;switch(n){case fW.FAST_PFOR:var a,o;return a=i.numValues,function(t,r,i,n,a){let o=n.get();
57if(3&i)throw Error(`FastPFOR: invalid encodedByteLength=${i} at offset=${o} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=i>>>2,l=function(t,r){if(r<=t.encodedWords.length)return t.encodedWords;let i=new Uint32Array(Math.max(16,2*r));return t.encodedWords=i,i}(a,s);!function(t,r,i,n){if(r<0||i<0||r+i>t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${r}, byteLength=${i}, bytes.length=${t.length})`);let a=Math.floor(i/4),o=i%4!=0,s=o?a+1:a;if(n.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${n.length} < ${s}`);if(a>0){let i=t.byteOffset+r;if(3&i)for(let i=0;i<a;i++){let a=r+4*i;n[i]=t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]}else{let r=new Uint32Array(t.buffer,i,a);for(let t=0;t<a;t++)n[t]=0|function(t){let r=t>>>0;return((255&r)<<24|(65280&r)<<8|r>>>8&65280|r>>>24&255)>>>0}(r[t])}}if(o){let o=r+4*a,s=i-4*a,l=0;for(let r=0;r<s;r++)l|=t[o+r]<<24-8*r;n[a]=0|l}}(t,o,i,l);let u=function(t,r,i){let n=0,a=0,o=new Uint32Array(r),s=i??hN();if(t.length>0){let r=0|t[n];if(n=n+1|0,255&r)throw Error(`FastPFOR decode: invalid alignedLength=${r} (expected multiple of 256)`);if(a+r>o.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${a}, alignedLength=${r}, out.length=${o.length})`);n=function(t,r,i,n,a,o){let s=n+(a-a%256),l=n,u=i;for(;l!==s;){let i=Math.min(hk,s-l);u=function(t,r,i,n,a,o){let s=0|i,l=0|t[s];if(l<=0||s+l>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${l} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let u=s+l|0,c=t[u]>>>0,h=c+3>>>2,f=u+1,d=f+h;if(d>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${c} (metaInts=${h}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${f}) causes bitmapPos=${d} out of bounds (encoded.length=${t.length})`);let p=function(t,r,i,n){n.byteContainer.length<i&&(n.byteContainer=new Uint8Array(2*i),n.byteContainerI32=void 0);let a=n.byteContainer,o=i>>>2;if(3&a.byteOffset)for(let i=0;i<o;i=i+1|0){let n=0|t[r+i|0],o=i<<2;a[o]=255&n,a[o+1|0]=n>>>8&255,a[o+2|0]=n>>>16&255,a[o+3|0]=n>>>24&255}else{let i=n.byteContainerI32;(!i||i.buffer!==a.buffer||i.byteOffset!==a.byteOffset||i.length<o)&&(i=n.byteContainerI32=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>>2)),i.set(t.subarray(r,r+o))}let s=3&i;if(s>0){let i=0|t[r+o|0],n=o<<2;for(let t=0;t<s;t=t+1|0)a[n+t|0]=i>>>(t<<3)&255}return a}(t,f,c,o),m=function(t,r,i){let n=0|t[r++],a=i.dataToBePacked;for(let o=2;o<=32;o=o+1|0){if(!(n>>>o-1&1))continue;if(r>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${o}, streamWordIndex=${r}, needWords=1, availableWords=${t.length-r}, encodedWords=${t.length})`);let s=t[r++]>>>0,l=function(t){var r;return(r=t+31)-r%32}(s),u=s*o+31>>>5;if(r+u>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${o}, size=${s}, streamWordIndex=${r}, needWords=${u}, availableWords=${t.length-r}, encodedWords=${t.length})`);let c=a[o];(!c||c.length<l)&&(c=a[o]=new Uint32Array(l));let h=0;for(;h<s;h=h+32|0)(function(t,r,i,n,a){switch(a){case 2:let o,s,l;o=n,s=t[r]>>>0,l=t[r+1]>>>0,i[o++]=s>>>0&3,i[o++]=s>>>2&3,i[o++]=s>>>4&3,i[o++]=s>>>6&3,i[o++]=s>>>8&3,i[o++]=s>>>10&3,i[o++]=s>>>12&3,i[o++]=s>>>14&3,i[o++]=s>>>16&3,i[o++]=s>>>18&3,i[o++]=s>>>20&3,i[o++]=s>>>22&3,i[o++]=s>>>24&3,i[o++]=s>>>26&3,i[o++]=s>>>28&3,i[o++]=s>>>30&3,i[o++]=l>>>0&3,i[o++]=l>>>2&3,i[o++]=l>>>4&3,i[o++]=l>>>6&3,i[o++]=l>>>8&3,i[o++]=l>>>10&3,i[o++]=l>>>12&3,i[o++]=l>>>14&3,i[o++]=l>>>16&3,i[o++]=l>>>18&3,i[o++]=l>>>20&3,i[o++]=l>>>22&3,i[o++]=l>>>24&3,i[o++]=l>>>26&3,i[o++]=l>>>28&3,i[o]=l>>>30&3;return;case 3:let u,c,h,f;u=n,c=t[r]>>>0,h=t[r+1]>>>0,f=t[r+2]>>>0,i[u++]=c>>>0&7,i[u++]=c>>>3&7,i[u++]=c>>>6&7,i[u++]=c>>>9&7,i[u++]=c>>>12&7,i[u++]=c>>>15&7,i[u++]=c>>>18&7,i[u++]=c>>>21&7,i[u++]=c>>>24&7,i[u++]=c>>>27&7,i[u++]=(c>>>30|(1&h)<<2)&7,i[u++]=h>>>1&7,i[u++]=h>>>4&7,i[u++]=h>>>7&7,i[u++]=h>>>10&7,i[u++]=h>>>13&7,i[u++]=h>>>16&7,i[u++]=h>>>19&7,i[u++]=h>>>22&7,i[u++]=h>>>25&7,i[u++]=h>>>28&7,i[u++]=(h>>>31|(3&f)<<1)&7,i[u++]=f>>>2&7,i[u++]=f>>>5&7,i[u++]=f>>>8&7,i[u++]=f>>>11&7,i[u++]=f>>>14&7,i[u++]=f>>>17&7,i[u++]=f>>>20&7,i[u++]=f>>>23&7,i[u++]=f>>>26&7,i[u]=f>>>29&7;return;case 4:let d,p,m,g,y;d=n,p=t[r]>>>0,m=t[r+1]>>>0,g=t[r+2]>>>0,y=t[r+3]>>>0,i[d++]=p>>>0&15,i[d++]=p>>>4&15,i[d++]=p>>>8&15,i[d++]=p>>>12&15,i[d++]=p>>>16&15,i[d++]=p>>>20&15,i[d++]=p>>>24&15,i[d++]=p>>>28&15,i[d++]=m>>>0&15,i[d++]=m>>>4&15,i[d++]=m>>>8&15,i[d++]=m>>>12&15,i[d++]=m>>>16&15,i[d++]=m>>>20&15,i[d++]=m>>>
5724&15,i[d++]=m>>>28&15,i[d++]=g>>>0&15,i[d++]=g>>>4&15,i[d++]=g>>>8&15,i[d++]=g>>>12&15,i[d++]=g>>>16&15,i[d++]=g>>>20&15,i[d++]=g>>>24&15,i[d++]=g>>>28&15,i[d++]=y>>>0&15,i[d++]=y>>>4&15,i[d++]=y>>>8&15,i[d++]=y>>>12&15,i[d++]=y>>>16&15,i[d++]=y>>>20&15,i[d++]=y>>>24&15,i[d]=y>>>28&15;return;case 5:let v,_,b,x,w,E;v=n,_=t[r]>>>0,b=t[r+1]>>>0,x=t[r+2]>>>0,w=t[r+3]>>>0,E=t[r+4]>>>0,i[v++]=_>>>0&31,i[v++]=_>>>5&31,i[v++]=_>>>10&31,i[v++]=_>>>15&31,i[v++]=_>>>20&31,i[v++]=_>>>25&31,i[v++]=(_>>>30|(7&b)<<2)&31,i[v++]=b>>>3&31,i[v++]=b>>>8&31,i[v++]=b>>>13&31,i[v++]=b>>>18&31,i[v++]=b>>>23&31,i[v++]=(b>>>28|(1&x)<<4)&31,i[v++]=x>>>1&31,i[v++]=x>>>6&31,i[v++]=x>>>11&31,i[v++]=x>>>16&31,i[v++]=x>>>21&31,i[v++]=x>>>26&31,i[v++]=(x>>>31|(15&w)<<1)&31,i[v++]=w>>>4&31,i[v++]=w>>>9&31,i[v++]=w>>>14&31,i[v++]=w>>>19&31,i[v++]=w>>>24&31,i[v++]=(w>>>29|(3&E)<<3)&31,i[v++]=E>>>2&31,i[v++]=E>>>7&31,i[v++]=E>>>12&31,i[v++]=E>>>17&31,i[v++]=E>>>22&31,i[v]=E>>>27&31;return;case 6:let T,A,S,C,M,D,P;T=n,A=t[r]>>>0,S=t[r+1]>>>0,C=t[r+2]>>>0,M=t[r+3]>>>0,D=t[r+4]>>>0,P=t[r+5]>>>0,i[T++]=A>>>0&63,i[T++]=A>>>6&63,i[T++]=A>>>12&63,i[T++]=A>>>18&63,i[T++]=A>>>24&63,i[T++]=(A>>>30|(15&S)<<2)&63,i[T++]=S>>>4&63,i[T++]=S>>>10&63,i[T++]=S>>>16&63,i[T++]=S>>>22&63,i[T++]=(S>>>28|(3&C)<<4)&63,i[T++]=C>>>2&63,i[T++]=C>>>8&63,i[T++]=C>>>14&63,i[T++]=C>>>20&63,i[T++]=C>>>26&63,i[T++]=M>>>0&63,i[T++]=M>>>6&63,i[T++]=M>>>12&63,i[T++]=M>>>18&63,i[T++]=M>>>24&63,i[T++]=(M>>>30|(15&D)<<2)&63,i[T++]=D>>>4&63,i[T++]=D>>>10&63,i[T++]=D>>>16&63,i[T++]=D>>>22&63,i[T++]=(D>>>28|(3&P)<<4)&63,i[T++]=P>>>2&63,i[T++]=P>>>8&63,i[T++]=P>>>14&63,i[T++]=P>>>20&63,i[T]=P>>>26&63;return;case 7:let I,k,O,N,L,R,F,B;I=n,k=t[r]>>>0,O=t[r+1]>>>0,N=t[r+2]>>>0,L=t[r+3]>>>0,R=t[r+4]>>>0,F=t[r+5]>>>0,B=t[r+6]>>>0,i[I++]=k>>>0&127,i[I++]=k>>>7&127,i[I++]=k>>>14&127,i[I++]=k>>>21&127,i[I++]=(k>>>28|(7&O)<<4)&127,i[I++]=O>>>3&127,i[I++]=O>>>10&127,i[I++]=O>>>17&127,i[I++]=O>>>24&127,i[I++]=(O>>>31|(63&N)<<1)&127,i[I++]=N>>>6&127,i[I++]=N>>>13&127,i[I++]=N>>>20&127,i[I++]=(N>>>27|(3&L)<<5)&127,i[I++]=L>>>2&127,i[I++]=L>>>9&127,i[I++]=L>>>16&127,i[I++]=L>>>23&127,i[I++]=(L>>>30|(31&R)<<2)&127,i[I++]=R>>>5&127,i[I++]=R>>>12&127,i[I++]=R>>>19&127,i[I++]=(R>>>26|(1&F)<<6)&127,i[I++]=F>>>1&127,i[I++]=F>>>8&127,i[I++]=F>>>15&127,i[I++]=F>>>22&127,i[I++]=(F>>>29|(15&B)<<3)&127,i[I++]=B>>>4&127,i[I++]=B>>>11&127,i[I++]=B>>>18&127,i[I]=B>>>25&127;return;case 8:let z,j,U,V,$,G,q,H,W;z=n,j=t[r]>>>0,U=t[r+1]>>>0,V=t[r+2]>>>0,$=t[r+3]>>>0,G=t[r+4]>>>0,q=t[r+5]>>>0,H=t[r+6]>>>0,W=t[r+7]>>>0,i[z++]=j>>>0&255,i[z++]=j>>>8&255,i[z++]=j>>>16&255,i[z++]=j>>>24&255,i[z++]=U>>>0&255,i[z++]=U>>>8&255,i[z++]=U>>>16&255,i[z++]=U>>>24&255,i[z++]=V>>>0&255,i[z++]=V>>>8&255,i[z++]=V>>>16&255,i[z++]=V>>>24&255,i[z++]=$>>>0&255,i[z++]=$>>>8&255,i[z++]=$>>>16&255,i[z++]=$>>>24&255,i[z++]=G>>>0&255,i[z++]=G>>>8&255,i[z++]=G>>>16&255,i[z++]=G>>>24&255,i[z++]=q>>>0&255,i[z++]=q>>>8&255,i[z++]=q>>>16&255,i[z++]=q>>>24&255,i[z++]=H>>>0&255,i[z++]=H>>>8&255,i[z++]=H>>>16&255,i[z++]=H>>>24&255,i[z++]=W>>>0&255,i[z++]=W>>>8&255,i[z++]=W>>>16&255,i[z]=W>>>24&255;return;case 9:let Z,Y,X,K,Q,J,ee,et,er,ei;Z=n,Y=t[r]>>>0,X=t[r+1]>>>0,K=t[r+2]>>>0,Q=t[r+3]>>>0,J=t[r+4]>>>0,ee=t[r+5]>>>0,et=t[r+6]>>>0,er=t[r+7]>>>0,ei=t[r+8]>>>0,i[Z++]=Y>>>0&511,i[Z++]=Y>>>9&511,i[Z++]=Y>>>18&511,i[Z++]=(Y>>>27|(15&X)<<5)&511,i[Z++]=X>>>4&511,i[Z++]=X>>>13&511,i[Z++]=X>>>22&511,i[Z++]=(X>>>31|(255&K)<<1)&511,i[Z++]=K>>>8&511,i[Z++]=K>>>17&511,i[Z++]=(K>>>26|(7&Q)<<6)&511,i[Z++]=Q>>>3&511,i[Z++]=Q>>>12&511,i[Z++]=Q>>>21&511,i[Z++]=(Q>>>30|(127&J)<<2)&511,i[Z++]=J>>>7&511,i[Z++]=J>>>16&511,i[Z++]=(J>>>25|(3&ee)<<7)&511,i[Z++]=ee>>>2&511,i[Z++]=ee>>>11&511,i[Z++]=ee>>>20&511,i[Z++]=(ee>>>29|(63&et)<<3)&511,i[Z++]=et>>>6&511,i[Z++]=et>>>15&511,i[Z++]=(et>>>24|(1&er)<<8)&511,i[Z++]=er>>>1&511,i[Z++]=er>>>10&511,i[Z++]=er>>>19&511,i[Z++]=(er>>>28|(31&ei)<<4)&511,i[Z++]=ei>>>5&511,i[Z++]=ei>>>14&511,i[Z]=ei>>>23&511;return;case 10:let en,ea,eo,es,el,eu,ec,eh,ef,ed,ep;en=n,ea=t[r]>>>0,eo=t[r+1]>>>0,es=t[r+2]>>>0,el=t[r+3]>>>0,eu=t[r+4]>>>0,ec=t[r+5]>>>0,eh=t[r+6]>>>0,ef=t[r+7]>>>0,ed=t[r+8]>>>0,ep=t[r+9]>>>0,i[en++]=ea>>>0&1023,i[en++]=ea>>>10&1023,i[en++]=ea>>>20&1023,i[en++]=(ea>>>30|(255&eo)<<2)&1023,i[en++]=eo>>>8&1023,i[en++]=eo>>>18&1023,i[en++]=(eo>
57>>28|(63&es)<<4)&1023,i[en++]=es>>>6&1023,i[en++]=es>>>16&1023,i[en++]=(es>>>26|(15&el)<<6)&1023,i[en++]=el>>>4&1023,i[en++]=el>>>14&1023,i[en++]=(el>>>24|(3&eu)<<8)&1023,i[en++]=eu>>>2&1023,i[en++]=eu>>>12&1023,i[en++]=eu>>>22&1023,i[en++]=ec>>>0&1023,i[en++]=ec>>>10&1023,i[en++]=ec>>>20&1023,i[en++]=(ec>>>30|(255&eh)<<2)&1023,i[en++]=eh>>>8&1023,i[en++]=eh>>>18&1023,i[en++]=(eh>>>28|(63&ef)<<4)&1023,i[en++]=ef>>>6&1023,i[en++]=ef>>>16&1023,i[en++]=(ef>>>26|(15&ed)<<6)&1023,i[en++]=ed>>>4&1023,i[en++]=ed>>>14&1023,i[en++]=(ed>>>24|(3&ep)<<8)&1023,i[en++]=ep>>>2&1023,i[en++]=ep>>>12&1023,i[en]=ep>>>22&1023;return;case 11:let em,eg,ey,ev,e_,eb,ex,ew,eE,eT,eA,eS;em=n,eg=t[r]>>>0,ey=t[r+1]>>>0,ev=t[r+2]>>>0,e_=t[r+3]>>>0,eb=t[r+4]>>>0,ex=t[r+5]>>>0,ew=t[r+6]>>>0,eE=t[r+7]>>>0,eT=t[r+8]>>>0,eA=t[r+9]>>>0,eS=t[r+10]>>>0,i[em++]=eg>>>0&2047,i[em++]=eg>>>11&2047,i[em++]=(eg>>>22|(1&ey)<<10)&2047,i[em++]=ey>>>1&2047,i[em++]=ey>>>12&2047,i[em++]=(ey>>>23|(3&ev)<<9)&2047,i[em++]=ev>>>2&2047,i[em++]=ev>>>13&2047,i[em++]=(ev>>>24|(7&e_)<<8)&2047,i[em++]=e_>>>3&2047,i[em++]=e_>>>14&2047,i[em++]=(e_>>>25|(15&eb)<<7)&2047,i[em++]=eb>>>4&2047,i[em++]=eb>>>15&2047,i[em++]=(eb>>>26|(31&ex)<<6)&2047,i[em++]=ex>>>5&2047,i[em++]=ex>>>16&2047,i[em++]=(ex>>>27|(63&ew)<<5)&2047,i[em++]=ew>>>6&2047,i[em++]=ew>>>17&2047,i[em++]=(ew>>>28|(127&eE)<<4)&2047,i[em++]=eE>>>7&2047,i[em++]=eE>>>18&2047,i[em++]=(eE>>>29|(255&eT)<<3)&2047,i[em++]=eT>>>8&2047,i[em++]=eT>>>19&2047,i[em++]=(eT>>>30|(511&eA)<<2)&2047,i[em++]=eA>>>9&2047,i[em++]=eA>>>20&2047,i[em++]=(eA>>>31|(1023&eS)<<1)&2047,i[em++]=eS>>>10&2047,i[em]=eS>>>21&2047;return;case 12:let eC,eM,eD,eP,eI,ek,eO,eN,eL,eR,eF,eB,ez;eC=n,eM=t[r]>>>0,eD=t[r+1]>>>0,eP=t[r+2]>>>0,eI=t[r+3]>>>0,ek=t[r+4]>>>0,eO=t[r+5]>>>0,eN=t[r+6]>>>0,eL=t[r+7]>>>0,eR=t[r+8]>>>0,eF=t[r+9]>>>0,eB=t[r+10]>>>0,ez=t[r+11]>>>0,i[eC++]=eM>>>0&4095,i[eC++]=eM>>>12&4095,i[eC++]=(eM>>>24|(15&eD)<<8)&4095,i[eC++]=eD>>>4&4095,i[eC++]=eD>>>16&4095,i[eC++]=(eD>>>28|(255&eP)<<4)&4095,i[eC++]=eP>>>8&4095,i[eC++]=eP>>>20&4095,i[eC++]=eI>>>0&4095,i[eC++]=eI>>>12&4095,i[eC++]=(eI>>>24|(15&ek)<<8)&4095,i[eC++]=ek>>>4&4095,i[eC++]=ek>>>16&4095,i[eC++]=(ek>>>28|(255&eO)<<4)&4095,i[eC++]=eO>>>8&4095,i[eC++]=eO>>>20&4095,i[eC++]=eN>>>0&4095,i[eC++]=eN>>>12&4095,i[eC++]=(eN>>>24|(15&eL)<<8)&4095,i[eC++]=eL>>>4&4095,i[eC++]=eL>>>16&4095,i[eC++]=(eL>>>28|(255&eR)<<4)&4095,i[eC++]=eR>>>8&4095,i[eC++]=eR>>>20&4095,i[eC++]=eF>>>0&4095,i[eC++]=eF>>>12&4095,i[eC++]=(eF>>>24|(15&eB)<<8)&4095,i[eC++]=eB>>>4&4095,i[eC++]=eB>>>16&4095,i[eC++]=(eB>>>28|(255&ez)<<4)&4095,i[eC++]=ez>>>8&4095,i[eC]=ez>>>20&4095;return;case 16:let ej,eU,eV,e$,eG,eq,eH,eW,eZ,eY,eX,eK,eQ,eJ,e0,e1,e2;ej=n,eU=t[r]>>>0,eV=t[r+1]>>>0,e$=t[r+2]>>>0,eG=t[r+3]>>>0,eq=t[r+4]>>>0,eH=t[r+5]>>>0,eW=t[r+6]>>>0,eZ=t[r+7]>>>0,eY=t[r+8]>>>0,eX=t[r+9]>>>0,eK=t[r+10]>>>0,eQ=t[r+11]>>>0,eJ=t[r+12]>>>0,e0=t[r+13]>>>0,e1=t[r+14]>>>0,e2=t[r+15]>>>0,i[ej++]=eU>>>0&65535,i[ej++]=eU>>>16&65535,i[ej++]=eV>>>0&65535,i[ej++]=eV>>>16&65535,i[ej++]=e$>>>0&65535,i[ej++]=e$>>>16&65535,i[ej++]=eG>>>0&65535,i[ej++]=eG>>>16&65535,i[ej++]=eq>>>0&65535,i[ej++]=eq>>>16&65535,i[ej++]=eH>>>0&65535,i[ej++]=eH>>>16&65535,i[ej++]=eW>>>0&65535,i[ej++]=eW>>>16&65535,i[ej++]=eZ>>>0&65535,i[ej++]=eZ>>>16&65535,i[ej++]=eY>>>0&65535,i[ej++]=eY>>>16&65535,i[ej++]=eX>>>0&65535,i[ej++]=eX>>>16&65535,i[ej++]=eK>>>0&65535,i[ej++]=eK>>>16&65535,i[ej++]=eQ>>>0&65535,i[ej++]=eQ>>>16&65535,i[ej++]=eJ>>>0&65535,i[ej++]=eJ>>>16&65535,i[ej++]=e0>>>0&65535,i[ej++]=e0>>>16&65535,i[ej++]=e1>>>0&65535,i[ej++]=e1>>>16&65535,i[ej++]=e2>>>0&65535,i[ej]=e2>>>16&65535;return;case 32:for(let a=0;a<32;a=a+1|0)i[n+a|0]=0|t[r+a|0];return}let e3=hP[a]>>>0,e4=r,e6=0,e5=t[e4]>>>0;for(let r=0;r<32;r++)if(e6+a<=32){let o=e5>>>e6&e3;i[n+r]=0|o,32===(e6+=a)&&(e6=0,e4++,31!==r&&(e5=t[e4]>>>0))}else{let o=32-e6,s=(e5>>>e6|((e5=t[++e4]>>>0)&hP[a-o]>>>0)<<o)&e3;i[n+r]=0|s,e6=a-o}})(t,r,c,h,o),r=r+o|0;r=r-((h-s|0)*o>>>5)|0,i.exceptionSizes[o]=s}return r}(t,d,o);return o.dataPointers.fill(0),function(t,r,i,n,a,o,s,l,u,c){let h=0|i,f=0;for(let r=0;r<s;r=r+1|0){let i=function(t,r,i,n){if(i+2>r)throw Error(`FastPFOR decode: byteContainer underflow at block=${n} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${r})`);let a=t[i++],o=t[i++];if(a>32)throw Error(`FastPFOR decode: invalid bitWidth=${a} at block=${n} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:o,bytePosIn:i}}(l,u,f,r);f=i.bytePosIn;let n=i.bitWidth,s=i.exceptionCount,d=o+256*r|0;switch(n){case 0:a.fill(0,d,d+256);break;case 32:for(let r=0;r<256;r=r+1|0)a[d+r|0]=0|t[h+r|0];h=h+256|0;break;default:h=function(t,r,i,n,a){switch(a){case 1:let o=n,s=r;for(let r=0;r<8;r++){let r=t[s++]>>>0;i[o++]=r>>>0&1,i[o++]=r>>>1&1,i[o++]=r>>>2&1,i[o++]=r>>>3&1,i[o++]=r>>>4&1,i[o++]=r>>>5&1,i[o++]=r>>>6&1,i[o++]=r>>>7&1,i[o++]=r>>>8&1,i[o++]=r>>>9&1,i[o++]=r>>>10&1,i[o++]=r>>>11&1,i[o++]=r>>>12&1,i[o++]=r>>>13&1,i[o++]=r>>>14&1,i[o++]=r>>>15&1,i[o++]=r>>>16&1,i[o++]=r>>>17&1,i[o++]=r>>>18&1,i[o++]=r>>>19&1,i[o++]=r>>>20&1,i[o++]=r>>>21&1,i[o++]=r>>>22&1,i[o++]=r>>>23&1,i[o++]=r>>>24&1,i[o++]=r>>>25&1,i[o++]=r>>>26&1,i[o++]=r>>>27&1,i[o++]=r>>>28&1,i[o++]=r>>>29&1,i[o++]=r>>>30&1,i[o++]=r>>>31&1}break;case 2:!function(t,r,i,n){let a=n,o=r;for(let r=0;r<8;r++){let r=t[o++]>>>0,n=t[o++]>>>0;i[a++]=r>>>0&3,i[a++]=r>>>2&3,i[a++]=r>>>4&3,i[a++]=r>>>6&3,i[a++]=r>>>8&3,i[a++]=r>>>10&3,i[a++]=r>>>12&3,i[a++]=r>>>14&3,i[a++]=r>>>16&3,i[a++]=r>>>18&3,i[a++]=r>>>20&3,i[a++]=r>>>22&3,i[a++]=r>>>24&3,i[a++]=r>>>26&3,i[a++]=r>>>28&3,i[a++]=r>>>30&3,i[a++]=n>>>0&3,i[a++]=n>>>2&3,i[a++]=n>>>4&3,i[a++]=n>>>6&3,i[a++]=n>>>8&3,i[a++]=n>>>10&3,i[a++]=n>>>12&3,i[a++]=n>>>14&3,i[a++]=n>>>16&3,i[a++]=n>>>18&3,i[a++]=n>>>20&3,i[a++]=n>>>22&3,i[a++]=n>>>24&3,i[a++]=n>>>26&3,i[a++]=n>>>28&3,i[a++]=n>>>30&3}}(t,r,i,n);break;case 3:!function(t,r,i,n){let a=n,o=r;for(let r=0;r<8;r++){let r=t[o++]>>>0,n=t[o++]>>>0,s=t[o++]>>>0;i[a++]=r>>>0&7,i[a++]=r>>>3&7,i[a++]=r>>>6&7,i[a++]=r>>>9&7,i[a++]=r>>>12&7,i[a++]=r>>>15&7,i[a++]=r>>>18&7,i[a++]=r>>>21&7,i[a++]=r>>>24&7,i[a++]=r>>>27&7,i[a++]=(r>>>30|(1&n)<<2)&7,i[a++]=n>>>1&7,i[a++]=n>>>4&7,i[a++]=n>>>7&7,i[a++]=n>>>10&7,i[a++]=n>>>13&7,i[a++]=n>>>16&7,i[a++]=n>>>19&7,i[a++]=n>>>22&7,i[a++]=n>>>25&7,i[a++]=n>>>28&7,i[a++]=(n>>>31|(3&s)<<1)&7,i[a++]=s>>>2&7,i[a++]=s>>>5&7,i[a++]=s>>>8&7,i[a++]=s>>>11&7,i[a++]=s>>>14&7,i[a++]=s>>>17&7,i[a++]=s>>>20&7,i[a++]=s>>>23&7,i[a++]=s>>>26&7,i[a++]=s>>>29&7}}(t,r,i,n);break;case 4:!function(t,r,i,n){let a=n,o=r;for(let r=0;r<8;r++){let r=t[o++]>>>0,n=t[o++]>>>0,s=t[o++]>>>0,l=t[o++]>>>0;i[a++]=r>>>0&15,i[a++]=r>>>4&15,i[a++]=r>>>8&15,i[a++]=r>>>12&15,i[a++]=r>>>16&15,i[a++]=r>>>20&15,i[a++]=r>>>24&15,i[a++]=r>>>28&15,i[a++]=n>>>0&15,i[a++]=n>>>4&15,i[a++]=n>>>8&15,i[a++]=n>>>12&15,i[a++]=n>>>16&15,i[a++]=n>>>20&15,i[a++]=n>>>24&15,i[a++]=n>>>28&15,i[a++]=s>>>0&15,i[a++]=s>>>4&15,i[a++]=s>>>8&15,i[a++]=s>>>12&15,i[a++]=s>>>16&15,i[a++]=s>>>20&15,i[a++]=s>>>24&15,i[a++]=s>>>28&15,i[a++]=l>>>0&15,i[a++]=l>>>4&15,i[a++]=l>>>8&15,i[a++]=l>>>12&15,i[a++]=l>>>16&15,i[a++]=l>>>20&15,i[a++]=l>>>
5724&15,i[a++]=l>>>28&15}}(t,r,i,n);break;case 5:!function(t,r,i,n){let a=n,o=r;for(let r=0;r<8;r++){let r=t[o++]>>>0,n=t[o++]>>>0,s=t[o++]>>>0,l=t[o++]>>>0,u=t[o++]>>>0;i[a++]=r>>>0&31,i[a++]=r>>>5&31,i[a++]=r>>>10&31,i[a++]=r>>>15&31,i[a++]=r>>>20&31,i[a++]=r>>>25&31,i[a++]=(r>>>30|(7&n)<<2)&31,i[a++]=n>>>3&31,i[a++]=n>>>8&31,i[a++]=n>>>13&31,i[a++]=n>>>18&31,i[a++]=n>>>23&31,i[a++]=(n>>>28|(1&s)<<4)&31,i[a++]=s>>>1&31,i[a++]=s>>>6&31,i[a++]=s>>>11&31,i[a++]=s>>>16&31,i[a++]=s>>>21&31,i[a++]=s>>>26&31,i[a++]=(s>>>31|(15&l)<<1)&31,i[a++]=l>>>4&31,i[a++]=l>>>9&31,i[a++]=l>>>14&31,i[a++]=l>>>19&31,i[a++]=l>>>24&31,i[a++]=(l>>>29|(3&u)<<3)&31,i[a++]=u>>>2&31,i[a++]=u>>>7&31,i[a++]=u>>>12&31,i[a++]=u>>>17&31,i[a++]=u>>>22&31,i[a++]=u>>>27&31}}(t,r,i,n);break;case 6:!function(t,r,i,n){let a=n,o=r;for(let r=0;r<8;r++){let r=t[o++]>>>0,n=t[o++]>>>0,s=t[o++]>>>0,l=t[o++]>>>0,u=t[o++]>>>0,c=t[o++]>>>0;i[a++]=r>>>0&63,i[a++]=r>>>6&63,i[a++]=r>>>12&63,i[a++]=r>>>18&63,i[a++]=r>>>24&63,i[a++]=(r>>>30|(15&n)<<2)&63,i[a++]=n>>>4&63,i[a++]=n>>>10&63,i[a++]=n>>>16&63,i[a++]=n>>>22&63,i[a++]=(n>>>28|(3&s)<<4)&63,i[a++]=s>>>2&63,i[a++]=s>>>8&63,i[a++]=s>>>14&63,i[a++]=s>>>20&63,i[a++]=s>>>26&63,i[a++]=l>>>0&63,i[a++]=l>>>6&63,i[a++]=l>>>12&63,i[a++]=l>>>18&63,i[a++]=l>>>24&63,i[a++]=(l>>>30|(15&u)<<2)&63,i[a++]=u>>>4&63,i[a++]=u>>>10&63,i[a++]=u>>>16&63,i[a++]=u>>>22&63,i[a++]=(u>>>28|(3&c)<<4)&63,i[a++]=c>>>2&63,i[a++]=c>>>8&63,i[a++]=c>>>14&63,i[a++]=c>>>20&63,i[a++]=c>>>26&63}}(t,r,i,n);break;case 7:!function(t,r,i,n){let a=n,o=r;for(let r=0;r<8;r++){let r=t[o++]>>>0,n=t[o++]>>>0,s=t[o++]>>>0,l=t[o++]>>>0,u=t[o++]>>>0,c=t[o++]>>>0,h=t[o++]>>>0;i[a++]=r>>>0&127,i[a++]=r>>>7&127,i[a++]=r>>>14&127,i[a++]=r>>>21&127,i[a++]=(r>>>28|(7&n)<<4)&127,i[a++]=n>>>3&127,i[a++]=n>>>10&127,i[a++]=n>>>17&127,i[a++]=n>>>24&127,i[a++]=(n>>>31|(63&s)<<1)&127,i[a++]=s>>>6&127,i[a++]=s>>>13&127,i[a++]=s>>>20&127,i[a++]=(s>>>27|(3&l)<<5)&127,i[a++]=l>>>2&127,i[a++]=l>>>9&127,i[a++]=l>>>16&127,i[a++]=l>>>23&127,i[a++]=(l>>>30|(31&u)<<2)&127,i[a++]=u>>>5&127,i[a++]=u>>>12&127,i[a++]=u>>>19&127,i[a++]=(u>>>26|(1&c)<<6)&127,i[a++]=c>>>1&127,i[a++]=c>>>8&127,i[a++]=c>>>15&127,i[a++]=c>>>22&127,i[a++]=(c>>>29|(15&h)<<3)&127,i[a++]=h>>>4&127,i[a++]=h>>>11&127,i[a++]=h>>>18&127,i[a++]=h>>>25&127}}(t,r,i,n);break;case 8:!function(t,r,i,n){let a=n,o=r;for(let r=0;r<8;r++){let r=t[o++]>>>0,n=t[o++]>>>0,s=t[o++]>>>0,l=t[o++]>>>0,u=t[o++]>>>0,c=t[o++]>>>0,h=t[o++]>>>0,f=t[o++]>>>0;i[a++]=r>>>0&255,i[a++]=r>>>8&255,i[a++]=r>>>16&255,i[a++]=r>>>24&255,i[a++]=n>>>0&255,i[a++]=n>>>8&255,i[a++]=n>>>16&255,i[a++]=n>>>24&255,i[a++]=s>>>0&255,i[a++]=s>>>8&255,i[a++]=s>>>16&255,i[a++]=s>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=f>>>0&255,i[a++]=f>>>8&255,i[a++]=f>>>16&255,i[a++]=f>>>24&255}}(t,r,i,n);break;case 16:let l=n,u=r;for(let r=0;r<128;r++){let r=t[u++]>>>0;i[l++]=65535&r,i[l++]=r>>>16&65535}break;default:!function(t,r,i,n,a){let o=hP[a]>>>0,s=r,l=0,u=t[s]>>>0,c=n;for(let r=0;r<8;r++){for(let r=0;r<32;r++)if(l+a<=32){let n=u>>>l&o;i[c+r]=0|n,32===(l+=a)&&(l=0,s++,31!==r&&(u=t[s]>>>0))}else{let n=32-l,h=u>>>l;u=t[++s]>>>0;let f=a-n,d=(h|(u&-1>>>32-f>>>0)<<n)&o;i[c+r]=0|d,l=f}c+=32,l=0,r<7&&(u=t[s]>>>0)}}(t,r,i,n,a)}return r+(a<<3)|0}(t,h,a,d,n)}s>0&&(f=function(t,r,i,n,a,o,s,l,u){let{maxBits:c,exceptionBitWidth:h,bytePosIn:f}=function(t,r,i,n,a,o){if(i+1>r)throw Error(`FastPFOR decode: exception header underflow at block=${o} (need 1 byte for maxBits, bytePos=${i}, byteSize=${r})`);let s=t[i++];if(s<n||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${o} (bitWidth=${n}, expected ${n}..32)`);let l=s-n|0;if(l<1||l>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${l} at block=${o} (bitWidth=${n}, maxBits=${s})`);if(i+a>r)throw Error(`FastPFOR decode: exception positions underflow at block=${o} (need=${a}, have=${r-i})`);return{maxBits:s,exceptionBitWidth:l,bytePosIn:i}}(a,o,s,i,n,u);if(s=f,1===h){let o=1<<i;for(let i=0;i<n;i=i+1|0){let i=a[s++];t[i+r|0]|=o}return s}let d=l.dataToBePacked[h];if(!d)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${i}, maxBits=${c}) at block ${u}`);let p=l.dataPointers,m=0|p[h],g=0|l.exceptionSizes[h];if(m+n>g)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${m}, need ${n}, size=${g}) at block ${u}`);for(let o=0;o<n;o=o+1|0){let n=a[s++],o=0|d[m++];t[n+r|0]|=o<<i}return p[h]=m,s}(a,d,n,s,l,u,f,c,r))}if(h!==n)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${r}, packedStart=${i}, consumedPackedEnd=${h}, expectedPackedEnd=${n}, packedWords=${n-i}, encoded.length=${t.length})`)}(t,s,s+1|0,u,r,0|n,a/256|0,p,c,o),m}(t,r,u,l,i,o),l=l+i|0}return u}(t,o,n,a,r,s),a=a+r|0}let l=t.length-n|0,u=r-a|0;return function(t,r,i,n,a,o){if(0===o)return;
57let s=0,l=r,u=r+i,c=a,h=a+o,f=0,d=0;for(;l<u&&c<h;){let r=t[l]>>>s&255;if(s+=8,l+=s>>>5,s&=31,f|=(127&r)<<d,128&r)n[c++]=0|f,f=0,d=0;else if((d+=7)>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${d}, partial=${f}, decoded=${c-a}/${o}, inPos=${l}, inEnd=${u})`)}if(c!==h)throw Error(`FastPFOR VByte: truncated stream (decoded=${c-a}, expected=${o}, consumedWords=${l-r}/${i}, vbyteStart=${r}, vbyteEnd=${u})`)}(t,n,l,o,a,u),o}(l.subarray(0,s),r,a.decoderWorkspace);return n.add(i),u}(t,a,o=i.byteLength,r,function(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);return{encodedWords:new Uint32Array(Math.max(16,0|t)),decoderWorkspace:hN()}}(o>>>2));case fW.VARINT:return hL(t,r,i.numValues);case fW.NONE:return function(t,r,i){let n=r.get(),a=i*Uint32Array.BYTES_PER_ELEMENT,o=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new Uint32Array(i);for(let t=0;t<i;t++)s[t]=o.getUint32(n+t*Uint32Array.BYTES_PER_ELEMENT,!0);return r.add(a),s}(t,r,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${n} is not supported (yet).`)}}function fa(t,r,i){let n=i.physicalLevelTechnique;switch(n){case fW.VARINT:return hR(t,r,i.numValues);case fW.NONE:return function(t,r,i){let n=r.get(),a=i*BigUint64Array.BYTES_PER_ELEMENT,o=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new BigUint64Array(i);for(let t=0;t<i;t++)s[t]=o.getBigUint64(n+t*BigUint64Array.BYTES_PER_ELEMENT,!0);return r.add(a),s}(t,r,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${n} is not supported (yet).`)}}function fo(t,r,i){let n=fn(t,r,i);return 1===n.length?i.logicalLevelTechnique1===hM.DELTA?hF(n[0]):n[0]:n[1]}function fs(t,r,i){var n=fn(t,r,i);if(2===n.length){let t=hF(n[1]);return[t,t]}return[hF(n[2]),hF(n[3])]}function fl(t,r,i){var n=hR(t,r,i.numValues);if(2===n.length){let t=hB(n[1]);return[t,t]}return[hB(n[2]),hB(n[3])]}function fu(t,r,i,n){return ff(fa(t,r,i),i,n)}function fc(t,r,i){let n=fa(t,r,i);return 1===n.length?i.logicalLevelTechnique1===hM.DELTA?hB(n[0]):n[0]:n[1]}function fh(t,r,i){let n;switch(r.logicalLevelTechnique1){case hM.DELTA:if(r.logicalLevelTechnique2===hM.RLE){if(!i)return function(t,r,i){let n=new BigInt64Array(i),a=0,o=0n;for(let i=0;i<r;i++){let s=Number(t[i]),l=hB(t[i+r]);for(let t=0;t<s;t++)o+=l,n[a++]=o}return n}(t,r.runs,r.numRleValues);n=hG(t=hU(t,r.runs,r.numRleValues))}else n=hG(t);break;case hM.RLE:n=function(t,r,i){if(void 0===i){i=0;for(let n=0;n<r;n++)i+=Number(t[n])}let n=new BigInt64Array(i),a=0;for(let i=0;i<r;i++){let o=Number(t[i]),s=t[i+r];s=hB(s),n.fill(s,a,a+o),a+=o}return n}(t,r.runs,r.numRleValues);break;case hM.NONE:n=function(t){let r=new BigInt64Array(t.length);for(let i=0;i<t.length;i++)r[i]=hB(t[i]);return r}(t);break;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}return i?h4(n,i,0n):n}function ff(t,r,i){let n;switch(r.logicalLevelTechnique1){case hM.DELTA:n=r.logicalLevelTechnique2===hM.RLE?hY(hU(t,r.runs,r.numRleValues)):hY(t);break;case hM.RLE:n=hU(t,r.runs,r.numRleValues);break;case hM.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}return i?h4(n,i,0n):n}function fd(t,r,i,n,a="int32"){let o=t.logicalLevelTechnique1;if(o===hM.RLE)return 1===t.runs?fQ.CONST:fQ.FLAT;if(o!==hM.DELTA||t.logicalLevelTechnique2!==hM.RLE)return 1===t.numValues?fQ.CONST:fQ.FLAT;let s=r instanceof h3?r.size():r;if(t.numRleValues!==s)return fQ.FLAT;if(1===t.runs)return fQ.SEQUENCE;if(2!==t.runs)return 1===t.numValues?fQ.CONST:fQ.FLAT;let l=n.get();if(t.physicalLevelTechnique===fW.VARINT)return!function(t,r,i){let n=new hD(r.get());if("int64"===i){let r=hR(t,n,4);return 2n===r[2]&&2n===r[3]}let a=hL(t,n,4);return 2===a[2]&&2===a[3]}(i,n,a)?1===t.numValues?fQ.CONST:fQ.FLAT:fQ.SEQUENCE;let u=n.get(),c=new Int32Array(i.buffer,i.byteOffset+u,4);return n.set(l),2===c[2]&&2===c[3]?fQ.SEQUENCE:1===t.numValues?fQ.CONST:fQ.FLAT}var fp=class extends hv{getValueFromBuffer(t){return this.dataBuffer[t]}},fm=class extends hx{constructor(t,r,i,n,a){super(t,a?BigInt64Array.of(r):BigUint64Array.of(r),i,n)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function fg(t,r,i){return{x:fy(t,r)-i,y:fy(t>>1,r)-i}}function fy(t,r){let i=0;for(let n=0;n<r;n++)i|=(t&1<<2*n)>>n;return i}function fv(t,r,i,n,a,o,s){return t===f1.MORTON?function(t,r,i,n,a,o){let s=Array(a?n+1:n);for(let a=0;a<n;a++){let n=fg(t[r[i+a]],o.numBits,o.coordinateShift);s[a]=new eT(n.x,n.y)}return a&&(s[s.length-1]=s[0]),s}(r,i,n,a,o,s):function(t,r,i,n,a){let o=Array(a?n+1:n);for(let a=0;a<2*n;a+=2){let n=2*r[i+a/2],s=t[n],l=t[n+1];o[a/2]=new eT(s,l)}return a&&(o[o.length-1]=o[0]),o}(r,i,n,a,o)}function f_(t,r,i,n){let a=Array(n?i+1:i);for(let n=0;n<2*i;n+=2){let i=t[r+n],o=t[r+n+1];a[n/2]=new eT(i,o)}return n&&(a[a.length-1]=a[0]),a}(fG=fJ||={})[fG.POINT=0]="POINT",fG[fG.LINESTRING=1]="LINESTRING",fG[fG.POLYGON=2]="POLYGON",fG[fG.MULTIPOINT=3]="MULTIPOINT",fG[fG.MULTILINESTRING=4]="MULTILINESTRING",fG[fG.MULTIPOLYGON=5]="MULTIPOLYGON",(fq=f0||={})[fq.POINT=0]="POINT",fq[fq.LINESTRING=1]="LINESTRING",fq[fq.POLYGON=2]="POLYGON",(fH=f1||={})[fH.MORTON=0]="MORTON",fH[fH.VEC_2=1]="VEC_2",fH[fH.VEC_3=2]="VEC_3";var fb=class{constructor(t,r,i,n,a){this._vertexBufferType=t,this._topologyVector=r,this._vertexOffsets=i,this._vertexBuffer=n,this._mortonSettings=a}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let r=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[r],this.vertexBuffer[r+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let r=this.vertexOffsets[t],i=fg(this.vertexBuffer[r],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[i.x,i.y]}let r=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[r],this.vertexBuffer[r+1]]}getGeometries(){return function(t){let r=Array(t.numGeometries),i=1,n=1,a=1,o=0,s=0,l=0,u=t.mortonSettings,c=t.topologyVector,h=c.geometryOffsets,f=c.partOffsets,d=c.ringOffsets,p=t.vertexOffsets,m=!p||0===p.length,g=t.containsPolygonGeometry(),y=t.vertexBuffer;for(let c=0;c<t.numGeometries;c++){let v=t.geometryType(c);switch(v){case fJ.POINT:{let c,g;if(m)c=y[s++],g=y[s++];else if(t.vertexBufferType===f1.MORTON){let t=fg(y[p[l++]],u.numBits,u.coordinateShift);c=t.x,g=t.y}else{let t=2*p[l++];c=y[t],g=y[t+1]}r[o++]=[[new eT(c,g)]],h&&a++,f&&i++,d&&n++}break;case fJ.MULTIPOINT:{let c,f=h[a]-h[a-1];if(a++,m){c=Array(f);for(let t=0;t<f;t++){let r=y[s++],i=y[s++];c[t]=new eT(r,i)}}else c=fv(t.vertexBufferType,y,p,l,f,!1,u),l+=f;r[o++]=c.map(t=>[t]),i+=f,n+=f}break;case fJ.LINESTRING:{let c,v;g?(c=d[n]-d[n-1],n++):c=f[i]-f[i-1],i++,m?(v=f_(y,s,c,!1),s+=2*c):(v=fv(t.vertexBufferType,y,p,l,c,!1,u),l+=c),r[o++]=[v],h&&a++}break;case fJ.POLYGON:{let c=f[i]-f[i-1];i++;let g=Array(c-1),v,_=d[n]-d[n-1];if(n++,m){v=f_(y,s,_,!0),s+=2*_;for(let t=0;t<g.length;t++)_=d[n]-d[n-1],n++,g[t]=f_(y,s,_,!0),s+=2*_}else{v=fv(t.vertexBufferType,y,p,l,_,!0,u),l+=_;for(let r=0;r<g.length;r++)_=d[n]-d[n-1],n++,g[r]=fv(t.vertexBufferType,y,p,l,_,!0,u),l+=_}r[o++]=[v].concat(g),h&&a++}break;case fJ.MULTILINESTRING:{let c=h[a]-h[a-1];a++;let v=Array(c);for(let r=0;r<c;r++){let a;if(g?(a=d[n]-d[n-1],n++):a=f[i]-f[i-1],i++,m)v[r]=f_(y,s,a,!1),s+=2*a;else{let i=fv(t.vertexBufferType,y,p,l,a,!1,u);v[r]=i,l+=a}}r[o++]=v}break;case fJ.MULTIPOLYGON:{let c=h[a]-h[a-1];a++;let g=Array(c);for(let r=0;r<c;r++){let a=f[i]-f[i-1];i++;let o,c=Array(a-1),h=d[n]-d[n-1];
vendor: 5,296 bytes, line 57
57n++,m?(o=f_(y,s,h,!0),s+=2*h):(o=fv(t.vertexBufferType,y,p,l,h,!0,u),l+=h);for(let r=0;r<c.length;r++){let i=d[n]-d[n-1];n++,m?(c[r]=f_(y,s,i,!0),s+=2*i):(c[r]=fv(t.vertexBufferType,y,p,l,i,!0,u),l+=i)}g[r]=[o].concat(c)}r[o++]=g.flat()}break;default:throw Error(`The specified geometry type (${v}) is currently not supported.`)}}return r}(this)}get mortonSettings(){return this._mortonSettings}},fx=class extends fb{constructor(t,r,i,n,a,o,s){super(i,n,a,o,s),this._numGeometries=t,this._geometryType=r}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===fJ.POLYGON||this._geometryType===fJ.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function fw(t,r,i,n){return new fE(f1.VEC_2,t,r,i,n)}var fE=class extends fb{constructor(t,r,i,n,a,o){super(t,i,n,a,o),this._geometryTypes=r}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===fJ.POLYGON||this.geometryType(t)===fJ.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},fT=class{constructor(t,r,i,n){this._triangleOffsets=t,this._indexBuffer=r,this._vertexBuffer=i,this._topologyVector=n}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let t=new Uint32Array(this.numGeometries);for(let r=0;r<this.numGeometries;r++)t[r]=this.geometryType(r);return fw(t,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}},fA=class extends fT{constructor(t,r,i,n,a,o){super(i,n,a,o),this._numGeometries=t,this._geometryType=r}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}},fS=class extends fT{constructor(t,r,i,n,a){super(r,i,n,a),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function fC(t,r,i){let n=new Uint32Array(t.length+1),a=0;n[0]=a;let o=0;for(let s=0;s<t.length;s++)a=n[s+1]=a+(t[s]>i?r[o++]:1);return n}function fM(t,r,i,n){let a=new Uint32Array(r[r.length-1]+1),o=0;a[0]=o;let s=1,l=0;for(let u=0;u<t.length;u++){let c=t[u],h=r[u+1]-r[u];if(5===c||2===c||n&&(4===c||1===c))for(let t=0;t<h;t++)o=a[s++]=o+i[l++];else for(let t=0;t<h;t++)a[s++]=++o}return a}var fD=class extends hy{constructor(t,r,i){super(t,r.getBuffer(),i),this.dataVector=r}getValueFromBuffer(t){return this.dataVector.get(t)}},fP=class extends hv{getValueFromBuffer(t){return this.dataBuffer[t]}},fI=class extends hy{constructor(t,r,i,n){super(t,n?BigInt64Array.of(r):BigUint64Array.of(r),i)}getValueFromBuffer(t){return this.dataBuffer[0]}},fk=class extends hy{constructor(t,r,i,n){super(t,i,n),this.offsetBuffer=r}},fO=class extends fk{constructor(t,r,i,n){super(t,r,i,n??r.length-1)}getValueFromBuffer(t){let r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return fe(this.dataBuffer,r,i)}},fN=class extends fk{constructor(t,r,i,n,a){super(t,i,n,a??r.length),this.indexBuffer=r,this.indexBuffer=r}getValueFromBuffer(t){let r=this.indexBuffer[t],i=this.offsetBuffer[r],n=this.offsetBuffer[r+1];return fe(this.dataBuffer,i,n)}},fL=class extends fk{constructor(t,r,i,n,a,o,s,l){super(t,i,n,s??r.length),this.indexBuffer=r,this.symbolOffsetBuffer=a,this.symbolTableBuffer=o,this.sharedDictionaryCache=l}getValueFromBuffer(t){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let r=this.indexBuffer[t],i=this.offsetBuffer[r],n=this.offsetBuffer[r+1];return fe(this.decodedDictionary,i,n)}decodeDictionary(){return this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),function(t,r,i){let n=new Uint32Array(r.length);for(let t=1;t<r.length;t++)n[t]=n[t-1]+r[t-1];let a=new Uint8Array(function(t,r){let i=0;for(let n=0;n<r.length;n++){let a=r[n];255===a?(i++,n++):i+=t[a]}return i}(r,i)),o=0;for(let s=0;s<i.length;s++){let l=i[s];if(255===l)s++,a[o++]=i[s];else{let i=r[l],s=n[l];for(;i-- >0;)a[o++]=t[s++]}}return a}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let r=new Uint32Array(t.length-1),i=t[0];for(let n=1;n<t.length;n++){let a=t[n];r[n-1]=a-i,i=a}return r}};function fR(t,r,i,n,a){let o,s,l,u,c,h=a,f,d;for(let t=0;t<n;t++){let t=h2(r,i);switch(t.physicalStreamType){case fZ.PRESENT:{let n=new h3(h5(r,t.numValues,t.byteLength,i),t.numValues);h=a??n;break}case fZ.OFFSET:s=fr(r,i,t,void 0,h);break;case fZ.LENGTH:{let n=fi(r,i,t);fK.DICTIONARY===t.logicalStreamType.lengthType?o=n:fK.SYMBOL===t.logicalStreamType.lengthType?u=n:f=n;break}case fZ.DATA:{let n=r.subarray(i.get(),i.get()+t.byteLength);i.add(t.byteLength);let a=t.logicalStreamType.dictionaryType;fY.FSST===a?c=n:fY.SINGLE===a||fY.SHARED===a?l=n:fY.NONE===a&&(d=n)}}}
57return function(t,r,i,n,a,o,s){if(r){if(!i||!n||!a||!o)throw Error(`Incomplete FSST dictionary string column "${t}"`);return new fL(t,i,n,a,o,r,s)}}(t,c,s,o,l,u,h)??function(t,r,i,n,a){if(r){if(!i||!n)throw Error(`Incomplete dictionary string column "${t}"`);return a?new fN(t,i,n,r,a):new fN(t,i,n,r)}}(t,l,s,o,h)??function(t,r,i,n,a){if(r&&i){if(n)return a?new fN(t,n,r,i,a):new fN(t,n,r,i);if(a&&a.size()!==r.length-1){let n=new Uint32Array(a.size()),o=0;for(let t=0;t<a.size();t++)a.get(t)?n[t]=o++:n[t]=0;return new fN(t,n,r,i,a)}return a?new fO(t,r,i,a):new fO(t,r,i)}}(t,f,d,s,h)}var fF,fB,fz,fj,fU,fV,f$,fG,fq,fH,fW,fZ,fY,fX,fK,fQ,fJ,f0,f1,f2,f3=class extends hy{constructor(t,r,i){super(t,new Uint8Array,i??r.length),this.values=r}getValueFromBuffer(t){return this.values[t]}};function f4(t,r,i,n){let a=Object.create(null),o=r;for(;o<i;){let r=f8(t[o++],n);if("string"!=typeof r)throw Error(`Map key dictionary index does not resolve to a string: ${r}`);let s=f6(t,o,i,n);a[r]=s.value,o=s.nextIndex}return{value:a,nextIndex:o}}function f6(t,r,i,n){if(r>=i)throw Error("Unexpected end of map value stream");let a=t[r];if(a===eh.FALSE)return{value:!1,nextIndex:r+1};if(a===eh.TRUE)return{value:!0,nextIndex:r+1};if(a===eh.START_MAP){let a=f5(t,r,i);return{value:f4(t,r+2,a,n).value,nextIndex:a}}if(a===eh.START_LIST){let a=f5(t,r,i),o=[],s=r+2;for(;s<a;){let r=f6(t,s,a,n);o.push(r.value),s=r.nextIndex}return{value:o,nextIndex:a}}return{value:f8(a,n),nextIndex:r+1}}function f5(t,r,i){if(r+1>=i)throw Error("Missing length for nested map/list payload");let n=t[r+1];if(n<2)throw Error(`Invalid nested payload length: ${n}`);let a=r+n;if(a>i)throw Error("Nested payload exceeds containing payload bounds");return a}function f8(t,r){let i=t-eh.COUNT;if(i<0||i>=r.length)throw Error(`Scalar dictionary index out of range: ${t}`);return r[i]}function f7(t,r){for(let i of r)t.push(i)}function f9(t){return t instanceof h3}(ei=f2||={})[ei.STRING=1]="STRING",ei[ei.INT32=2]="INT32",ei[ei.UINT32=4]="UINT32",ei[ei.INT64=8]="INT64",ei[ei.UINT64=16]="UINT64",ei[ei.FLOAT=32]="FLOAT",ei[ei.DOUBLE=64]="DOUBLE",ei[ei.PRESENCE=128]="PRESENCE",(en=eh||={})[en.FALSE=0]="FALSE",en[en.TRUE=1]="TRUE",en[en.START_MAP=2]="START_MAP",en[en.START_LIST=3]="START_LIST",en[en.COUNT=4]="COUNT";function de(t){switch(t){case 0:case 1:case 2:case 3:return{nullable:(1&t)!=0,columnScope:0,type:"scalarType",scalarType:{longID:(2&t)!=0,type:"logicalType",logicalType:0}};case 4:return{nullable:!1,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:0,children:[]}};case 30:return{nullable:!1,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:1,children:[]}};case 31:return{nullable:!0,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:2,children:[]}};default:let r;var i=t;switch(i){case 10:case 11:r=0;break;case 12:case 13:r=1;break;case 14:case 15:r=2;break;case 16:case 17:r=3;break;case 18:case 19:r=4;break;case 20:case 21:r=5;break;case 22:case 23:r=6;break;case 24:case 25:r=7;break;case 26:case 27:r=8;break;case 28:case 29:r=9;break;default:return null}return{nullable:!!(1&i),columnScope:0,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:r}}}}function dt(t){return 30===t||31===t}let dr=new TextDecoder,di="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function dn(t,r){let i=hL(t,r,1)[0];if(0===i)return"";let n=r.get(),a=t.subarray(n,n+i);return r.add(i),dr.decode(a)}hI(65536);var da=class{constructor(t,r){switch(this._featureData=t,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case fJ.POINT:case fJ.MULTIPOINT:this.type=1;break;case fJ.LINESTRING:case fJ.MULTILINESTRING:this.type=2;break;case fJ.POLYGON:case fJ.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=r,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let r of this._featureData.geometry.coordinates){let i=[];for(let t of r)i.push(new eT(t.x,t.y));t.push(i)}return t}},ds=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new da(this.features[t],this.extent)}},dl=class{constructor(t){this.layers={};let r=function(t,r=!0){let i=new hD(0),n=[];for(;i.get()<t.length;){let s=hL(t,i,1)[0]>>>0,l=i.get()+s;if(l>t.length)throw Error(`Block overruns tile: ${l} > ${t.length}`);let u=hL(t,i,1)[0]>>>0;if(1!==u&&2!==u){i.set(l);continue}let[c,h]=function(t,r){let i={};i.featureTables=[];let n={};if(n.name=dn(t,r),0===n.name.length)throw Error("Missing layer name");let a=hL(t,r,1)[0]>>>0,o=hL(t,r,1)[0]>>>0;n.columns=Array(o);for(let i=0;i<o;i++)n.columns[i]=function(t,r){let i,n=hL(t,r,1)[0]>>>0,a=de(n);
57if(!a)throw Error(`Unsupported column type code ${n}. Supported: ${di}`);if(n>=10)i=dn(t,r);else if(n<4)i="id";else if(4===n)i="geometry";else throw Error(`Unsupported column type code ${n}. Supported: ${di}`);let o={...a,name:i};if("complexType"===o.type&&dt(n)){let i=hL(t,r,1)[0]>>>0,n=o.complexType;n.children=Array(i);for(let a=0;a<i;a++)n.children[a]=function t(r,i){let n,a,o=hL(r,i,1)[0]>>>0,s=o>=10?de(o):null;if(!s)throw Error(`Unsupported field type code ${o}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let l={...s,name:dn(r,i)};if("complexType"===l.type&&dt(o)){let n=l.complexType,a=hL(r,i,1)[0]>>>0;n.children=Array(a);for(let o=0;o<a;o++)n.children[o]=t(r,i)}return n=l.name,a=l.nullable,"scalarType"===l.type?{type:"scalarField",scalarField:l.scalarType,name:n,nullable:a}:{type:"complexField",complexField:l.complexType,name:n,nullable:a}}(t,r)}return o}(t,r);return i.featureTables.push(n),[i,a]}(t,i),f=c.featureTables[0],d=null,p=null,m=[],g=0;for(let n of f.columns){var a,o;let s=n.name;if("scalarType"===n.type&&n.scalarType?.type==="logicalType"&&0===n.scalarType.logicalType){let a=null;if(n.nullable){let r=h2(t,i),n=i.get(),o=h5(t,r.numValues,r.byteLength,i);i.set(n+r.byteLength),a=new h3(o,r.numValues)}let o=h2(t,i);g=a?a.size():o.decompressedCount,d=function(t,r,i,n,a,o,s=!1){let l=r.scalarType?.longID?6:4,u="number"==typeof o?void 0:o,c=fd(a,o,t,i,6===l?"int64":"int32");if(4===l)switch(c){case fQ.FLAT:return new h_(n,fr(t,i,a,void 0,u),o);case fQ.SEQUENCE:{let r=fs(t,i,a);return new hw(n,r[0],r[1],a.numRleValues,!1)}case fQ.CONST:return new hE(n,fo(t,i,a),o,!1)}switch(c){case fQ.FLAT:let h;return s?new hb(n,(h=function(t,r,i,n){if(i.physicalLevelTechnique===fW.VARINT)return function(t,r,i){switch(r.logicalLevelTechnique1){case hM.DELTA:return r.logicalLevelTechnique2===hM.RLE&&(t=hV(t,r.runs,r.numRleValues)),function(t){t[0]=hz(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let r=t[i],n=t[i+1],a=t[i+2],o=t[i+3];t[i]=hz(r)+t[i-1],t[i+1]=hz(n)+t[i],t[i+2]=hz(a)+t[i+1],t[i+3]=hz(o)+t[i+2]}for(;i!==t.length;++i)t[i]=hz(t[i])+t[i-1]}(t),t;case hM.RLE:var n,a;return n=t,a=r,i?function(t,r,i){let n=new Float64Array(i),a=0;for(let i=0;i<r;i++){let o=t[i],s=t[i+r];s=hz(s),n.fill(s,a,a+o),a+=o}return n}(n,a.runs,a.numRleValues):hV(n,a.runs,a.numRleValues);case hM.NONE:return i&&function(t){for(let r=0;r<t.length;r++)t[r]=hz(t[r])}(t),t;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}}(function(t,r,i){let n=new Float64Array(i);for(let a=0;a<i;a++)n[a]=function(t,r){let i,n;return n=t[r.get()],r.increment(),i=127&n,n<128||(n=t[r.get()],r.increment(),i|=(127&n)<<7,n<128)||(n=t[r.get()],r.increment(),i|=(127&n)<<14,n<128)||(n=t[r.get()],r.increment(),i|=(127&n)<<21,n<128)?i:function(t,r,i){let n,a;if(a=r[i.get()],i.increment(),n=(112&a)>>4,a<128||(a=r[i.get()],i.increment(),n|=(127&a)<<3,a<128)||(a=r[i.get()],i.increment(),n|=(127&a)<<10,a<128)||(a=r[i.get()],i.increment(),n|=(127&a)<<17,a<128)||(a=r[i.get()],i.increment(),n|=(127&a)<<24,a<128)||(a=r[i.get()],i.increment(),n|=(1&a)<<31,a<128))return 0x100000000*n+(t>>>0);throw Error("Expected varint not more than 10 bytes")}(i|=(15&(n=t[r.get()]))<<28,t,r)}(t,r);return n}(t,r,i.numValues),i,n);let a=fa(t,r,i),o=n?fh(a,i):ff(a,i);return Float64Array.from(o,Number)}(t,i,a,!1),u?h4(h,u,0):h),o):new fp(n,fu(t,i,a,u),o);case fQ.SEQUENCE:{let r=fl(t,i,a);return new fm(n,r[0],r[1],a.numRleValues,!1)}case fQ.CONST:return new fI(n,fc(t,i,a),o,!1)}throw Error("Vector type not supported for id column.")}(t,n,i,s,o,a??g,r)}else if("complexType"===n.type&&n.complexType?.type==="physicalType"&&0===n.complexType.physicalType){let r=hL(t,i,1)[0];if(0===g){let r=i.get();g=h2(t,i).decompressedCount,i.set(r)}p=function(t,r,i,n,a){var o,s,l,u,c,h,f,d,p,m,g;let y,v,_,b=h2(t,i),x,w,E,T;if(fd(b,n,t,i)===fQ.CONST){let d=fo(t,i,b),p,m,g,y;for(let n=0;n<r-1;n++){let r=h2(t,i);switch(r.physicalStreamType){case fZ.LENGTH:switch(r.logicalStreamType.lengthType){case fK.GEOMETRIES:p=fi(t,i,r);break;case fK.PARTS:m=fi(t,i,r);break;case fK.RINGS:g=fi(t,i,r);break;case fK.TRIANGLES:y=fi(t,i,r)}break;case fZ.OFFSET:switch(r.logicalStreamType.offsetType){case fX.VERTEX:x=fr(t,i,r);break;case fX.INDEX:T=fr(t,i,r)}break;case fZ.DATA:fY.VERTEX===r.logicalStreamType.dictionaryType?w=ft(t,i,r,a):(E={numBits:r.numBits,coordinateShift:r.coordinateShift},w=fr(t,i,r,a))}}return T?void 0!==p||void 0!==m?new fA(n,d,y,T,w,{geometryOffsets:p,partOffsets:m,ringOffsets:g}):new fA(n,d,y,T,w,void 0):void 0===E?(o={geometryOffsets:p,partOffsets:m,ringOffsets:g},s=x,l=w,new fx(n,d,f1.VEC_2,o,s,l)):(u={geometryOffsets:p,partOffsets:m,ringOffsets:g},c=x,h=w,f=E,new fx(n,d,f1.MORTON,u,c,h,f))}let A=fr(t,i,b),S,C,M,D;for(let n=0;n<r-1;n++){let r=h2(t,i);switch(r.physicalStreamType){case fZ.LENGTH:switch(r.logicalStreamType.lengthType){case fK.GEOMETRIES:S=fr(t,i,r);break;case fK.PARTS:C=fr(t,i,r);break;case fK.RINGS:M=fr(t,i,r);break;case fK.TRIANGLES:D=fi(t,i,r)}break;case fZ.OFFSET:switch(r.logicalStreamType.offsetType){case fX.VERTEX:x=fr(t,i,r);break;case fX.INDEX:T=fr(t,i,r)}break;case fZ.DATA:fY.VERTEX===r.logicalStreamType.dictionaryType?w=ft(t,i,r,a):(E={numBits:r.numBits,coordinateShift:r.coordinateShift},w=fr(t,i,r,a))}}return S?(y=fC(A,S,2),C&&M?(v=fM(A,y,C,!1),_=function(t,r,i,n){let a=new Uint32Array(i[i.length-1]+1),o=0;a[0]=o;let s=1,l=1,u=0;for(let c=0;c<t.length;c++){let h=t[c],f=r[c+1]-r[c];if(0!==h&&3!==h)for(let t=0;t<f;t++){let t=i[s]-i[s-1];s++;for(let r=0;r<t;r++)o=a[l++]=o+n[u++]}else for(let t=0;t<f;t++)a[l++]=++o,s++}return a}(A,y,v,M)):C&&(v=function(t,r,i){let n=new Uint32Array(r[r.length-1]+1),a=0;n[0]=a;let o=1,s=0;for(let l=0;l<t.length;l++){let u=t[l],c=r[l+1]-r[l];if(4===u||1===u)for(let t=0;t<c;t++)a=n[o++]=a+i[s++];else for(let t=0;t<c;t++)n[o++]=++a}return n}(A,y,C))):C&&M?(v=fC(A,C,1),_=fM(A,v,M,!0)):C&&(v=fC(A,C,0)),T&&!v?new fS(A,D,T,w,void 0):T?new fS(A,D,T,w,{geometryOffsets:y,partOffsets:v,ringOffsets:_}):void 0===E?fw(A,{geometryOffsets:y,partOffsets:v,ringOffsets:_},x,w):(d={geometryOffsets:y,partOffsets:v,ringOffsets:_},p=x,m=w,g=E,new fE(f1.MORTON,A,d,p,m,g))}(t,r,i,g,void 0)}else{let r=!function(t){if("scalarType"===t.type){let r=t.scalarType;if("physicalType"===r.type)switch(r.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case
576:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===r.type)return!1}else if("complexType"===t.type){let r=t.complexType;if("physicalType"===r.type)switch(r.physicalType){case 0:case 1:case 2:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}(n)?1:hL(t,i,1)[0];if(0===r)continue;let s=(a=g,o=void 0,"scalarType"===n.type?o&&!o.has(n.name)?(h6(r,t,i),null):function(t,r,i,n,a,o){let s;if(0===t)return null;if(o.nullable){let t=h2(r,i),n=t.numValues,a=i.get(),o=h5(r,n,t.byteLength,i);i.set(a+t.byteLength),s=new h3(o,t.numValues)}let l=s??n;switch(a.physicalType){case 4:case 3:return function(t,r,i,n,a){let o=h2(t,r),s=fd(o,a,t,r),l=3===n.physicalType;if(s===fQ.FLAT){let n=f9(a)?a:void 0,s=l?ft(t,r,o,void 0,n):fr(t,r,o,void 0,n);return new h_(i.name,s,a)}if(s===fQ.SEQUENCE){let n=fs(t,r,o);return new hw(i.name,n[0],n[1],o.numRleValues,l)}let u=l?function(t,r,i){let n=fn(t,r,i);return 1===n.length?hF(n[0]):hF(n[1])}(t,r,o):fo(t,r,o);return new hE(i.name,u,a,l)}(r,i,o,a,l);case 9:{let n=o.nullable?t-1:t;return fR(o.name,r,i,n,s)??null}case 0:return function(t,r,i,n){let a=h2(t,r),o=a.numValues,s=r.get(),l=f9(n)?n:void 0,u=h5(t,o,a.byteLength,r,l);r.set(s+a.byteLength);let c=new h3(u,o);return new fD(i.name,c,n)}(r,i,o,l);case 6:case 5:return function(t,r,i,n,a){let o=h2(t,r),s=fd(o,n,t,r,"int64"),l=5===a.physicalType;if(s===fQ.FLAT){let a=f9(n)?n:void 0,s=l?fh(fa(t,r,o),o,a):fu(t,r,o,a);return new fp(i.name,s,n)}if(s===fQ.SEQUENCE){let n=fl(t,r,o);return new fm(i.name,n[0],n[1],o.numRleValues,l)}let u=l?function(t,r,i){let n=fa(t,r,i);return 1===n.length?hB(n[0]):hB(n[1])}(t,r,o):fc(t,r,o);return new fI(i.name,u,n,l)}(r,i,o,l,a);case 7:return function(t,r,i,n){let a=h2(t,r),o=f9(n)?n:void 0,s=h8(t,r,a.numValues,o);return new fP(i.name,s,n)}(r,i,o,l);case 8:return function(t,r,i,n){let a=h2(t,r),o=f9(n)?n:void 0,s=h7(t,r,a.numValues,o);return new hb(i.name,s,n)}(r,i,o,l);default:throw Error(`The specified data type for the field is currently not supported: ${a}`)}}(r,t,i,a,n.scalarType,n):n.complexType?.physicalType===2?function(t,r,i,n){let a=function(t){let r="complexType"===t.type?t.complexType.children:void 0;return r&&0!==r.length?r.map(r=>t.name+(r.name??"")):[t.name]}(i);if(0===n)return a.map(t=>new f3(t,[]));let o=function(t,r,i){let n=t[r.get()];r.add(1);let a=fr(t,r,h2(t,r)),o=i-1,s=[];n&f2.STRING&&(o-=function(t,r,i){let n=t[r.get()];r.add(1);let a=fR("",t,r,n);if(a)for(let t=0;t<a.size;t++)i.push(a.getValue(t));return n}(t,r,s)),o-=function(t,r,i,n){var a;let o=0;return i&f2.INT32?(f7(n,ft(t,r,h2(t,r))),o++):i&f2.INT64&&(f7(n,fh(fa(t,r,a=h2(t,r)),a,void 0)),o++),i&f2.UINT32?(f7(n,fr(t,r,h2(t,r))),o++):i&f2.UINT64&&(f7(n,fu(t,r,h2(t,r))),o++),o}(t,r,n,s),o-=function(t,r,i,n){let a=0;return i&f2.FLOAT&&(f7(n,h8(t,r,h2(t,r).numValues)),a++),i&f2.DOUBLE&&(f7(n,h7(t,r,h2(t,r).numValues)),a++),a}(t,r,n,s);let l,u=0;if(n&f2.PRESENCE){let i=function(t,r){let i=h2(t,r);
57if(i.physicalStreamType!==fZ.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${i.physicalStreamType}`);let n=i.numValues,a=r.get(),o=new h3(h5(t,n,i.byteLength,r),n);return r.set(a+i.byteLength),{value:o,count:n}}(t,r);l=i.value,u=i.count,o--}let c=new Uint32Array;if(o>0&&(c=fr(t,r,h2(t,r)),o--),0!==o)throw Error(`Unexpected number of remaining streams while decoding map column: ${o}`);return{lengthStream:a,dictionary:s,presentStream:l,presentCount:u,flattenedValues:c}}(t,r,n),s=(o.presentStream?o.presentCount:o.lengthStream.length)/a.length,l=[],u=0,c=0;for(let t=0;t<a.length;t++){let r=function(t,r,i,n,a){let{lengthStream:o,flattenedValues:s,presentStream:l,dictionary:u}=t,c=r*i,h=i,f;if(l){f=new h3(new Uint8Array(Math.ceil(i/8)),i),h=0;for(let t=0;t<i;t++)l.get(c+t)&&(f.set(t,!0),h++)}let d=n+h;if(d>o.length)throw Error("Merged map counts underflow while decoding child streams");let p=Array(i),m=n,g=a;for(let t=0;t<i;t++){var y,v,_,b;if(l&&!l.get(c+t)){p[t]=null;continue}let r=g+o[m++];if(r>s.length)throw Error("Map value stream underflow while decoding feature payload");let i=(y=s,v=g,_=r,b=u,_-v==1||y[v]===eh.START_LIST?f6(y,v,_,b):f4(y,v,_,b));p[t]=i.value,g=i.nextIndex}let x=0;for(let t=n;t<d;t++)x+=o[t];let w=a+x;if(g!==w)throw Error("Unused flattened map values remain after decode");return{value:p,nullabilityBuffer:f,countsEnd:d,valuesEnd:w}}(o,t,s,u,c);l.push(new f3(a[t],r.value,r.nullabilityBuffer)),u=r.countsEnd,c=r.valuesEnd}return l}(t,i,n,r):0===r?null:function(t,r,i,n){let a,o,s,l,u=!1;for(;!u;){let i=h2(t,r);switch(i.physicalStreamType){case fZ.LENGTH:fK.DICTIONARY===i.logicalStreamType.lengthType?a=fi(t,r,i):s=fi(t,r,i);break;case fZ.DATA:fY.SINGLE===i.logicalStreamType.dictionaryType||fY.SHARED===i.logicalStreamType.dictionaryType?(o=t.subarray(r.get(),r.get()+i.byteLength),u=!0):l=t.subarray(r.get(),r.get()+i.byteLength),r.add(i.byteLength)}}if("complexType"!==i.type)throw Error(`Shared dictionary column ${i.name} must be a complex (struct) column.`);if(!a||!o)throw Error(`Incomplete shared dictionary for column "${i.name}"`);let c=i.complexType.children,h=[],f=l?{}:void 0,d=0;for(let u of c){let c,p=hL(t,r,1)[0];if(0===p)continue;let m=u.name?`${i.name}${u.name}`:i.name;if(n&&!n.has(m)){h6(p,t,r);continue}if("scalarField"!==u.type||9!==u.scalarField.physicalType)throw Error("Currently only scalar string fields are implemented for a struct.");if(p>1&&!u.nullable||1===p&&u.nullable)throw Error(`The number of streams for the child field ${u.name} does not match its nullability. nullibilty: ${u.nullable}, numStreams: ${p}`);if(u.nullable){let i=h2(t,r);c=new h3(h5(t,i.numValues,i.byteLength,r),i.numValues)}let g=fr(t,r,h2(t,r),void 0,c);if(l){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${m}"`);h[d++]=new fL(m,g,a,o,s,l,c,f)}else h[d++]=new fN(m,g,a,o,c)}return h}(t,i,n,o));if(s)if(Array.isArray(s))for(let t of s)m.push(t);else m.push(s)}}let y=new hT(f.name,p,d,m,h);n.push(y),i.set(l)}return n}(new Uint8Array(t));this.layers=r.reduce((t,r)=>({...t,[r.name]:new ds(r)}),{})}};function du(t,r,i,n,a){return tS(t,(t,o)=>{let s=r instanceof a1?r.get(o):null;return"object"==typeof s&&s&&"evaluate"in s?s.evaluate(i,n,void 0,a):s})}function dc(t,r){return r-t}aj("FeatureIndex",class{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new aB(8192,16,0),this.grid3D=new aB(8192,16,0),this.featureIndexArray=new oH,this.promoteId=r}insert(t,r,i,n,a,o){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,a);let l=o?this.grid3D:this.grid;for(let t of r){let r=[1/0,1/0,-1/0,-1/0];for(let i of t)r[0]=Math.min(r[0],i.x),r[1]=Math.min(r[1],i.y),r[2]=Math.max(r[2],i.x),r[3]=Math.max(r[3],i.y);r[0]<8192&&r[1]<8192&&r[2]>=0&&r[3]>=0&&l.insert(s,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||("mlt"===this.encoding?this.vtLayers=new dl(this.rawTileData).layers:this.vtLayers=new ua(new cc(this.rawTileData)).layers,this.sourceLayerCoder=new hm(this.vtLayers?Object.keys(this.vtLayers).sort():[hp])),this.vtLayers}query(t,r,i,n){this.loadVTLayers();let a=t.params,o=8192/t.tileSize/t.scale,s=n3(a.filter,"queryRenderedFeatures filter",a.globalState),l=t.queryGeometry,u=t.queryPadding*o,c=l7.fromPoints(l),h=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=l7.fromPoints(t.cameraQueryGeometry).expandBy(u);for(let r of this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,(r,i,n,a)=>(function(t,r,i,n,a){for(let o of t)if(r<=o.x&&i<=o.y&&n>=o.x&&a>=o.y)return!0;let o=[new eT(r,i),new eT(r,a),new eT(n,a),new eT(n,i)];if(t.length>2){for(let r of o)if(sZ(t,r))return!0}for(let r=0;r<t.length-1;r++)if(function(t,r,i){let n=i[0],a=i[2];if(t.x<n.x&&r.x<n.x||t.x>a.x&&r.x>a.x||t.y<n.y&&r.y<n.y||t.y>a.y&&r.y>a.y)return!1;let o=tk(t,r,i[0]);return o!==tk(t,r,i[1])||o!==tk(t,r,i[2])||o!==tk(t,r,i[3])}(t[r],t[r+1],o))return!0;return!1})(t.cameraQueryGeometry,r-u,i-u,n+u,a+u)))h.push(r);h.sort(dc);let d={},p;for(let u of h){if(u===p)continue;p=u;let c=this.featureIndexArray.get(u),h=null;
57this.loadMatchingFeature(d,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,s,a.layers,a.availableImages,r,i,n,(r,i,n)=>(h||=sB(r),i.queryIntersectsFeature({queryGeometry:l,feature:r,featureState:n,geometry:h,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return d}loadMatchingFeature(t,r,i,n,a,o,s,l,u,c,h){let f=this.bucketLayerIDs[r];if(o&&!f.some(t=>o.has(t)))return;let d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(n);if(a.needGeometry){let t=sz(p,!0);if(!a.filter(new aW(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!a.filter(new aW(this.tileID.overscaledZ),p))return;let m=this.getId(p,d);for(let r of f){if(o&&!o.has(r))continue;let i=l[r];if(!i)continue;let a={};m&&c&&(a=c.getState(i.sourceLayer||"_geojsonTileLayer",m));let f=tb({},u[r]);f.paint=du(f.paint,i.paint,p,a,s),f.layout=du(f.layout,i.layout,p,a,s);let d=!h||h(p,i,a);if(!d)continue;let g=new hg(p,this.z,this.x,this.y,m);g.layer=f;let y=t[r];void 0===y&&(y=t[r]=[]),y.push({featureIndex:n,feature:g,intersectionZ:d})}}lookupSymbolFeatures(t,r,i,n,a,o,s,l){let u={};this.loadVTLayers();let c=n3(a.filterSpec,"queryRenderedFeatures symbol filter",a.globalState);for(let a of t)this.loadMatchingFeature(u,i,n,a,c,o,s,l,r);return u}hasLayer(t){for(let r of this.bucketLayerIDs)for(let i of r)if(t===i)return!0;return!1}getId(t,r){let i=t.id;if(this.promoteId){let n="string"==typeof this.promoteId?this.promoteId:this.promoteId[r];"boolean"==typeof(i=t.properties[n])&&(i=Number(i)),void 0===i&&t.properties?.cluster&&this.promoteId&&(i=Number(t.properties.cluster_id))}return i}},{omit:["rawTileData","sourceLayerCoder"]});var dh=class{constructor(t,r){this.max=t,this.onRemove=r,this.reset()}reset(){for(let t in this.data)for(let r of this.data[t])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(t,r,i){let n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);let a={value:r,timeout:void 0};if(void 0!==i&&(a.timeout=setTimeout(()=>{this.remove(t,a)},i)),this.data[n].push(a),this.order.push(n),this.order.length>this.max){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let r=this.data[t].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),r.value}getByKey(t){let r=this.data[t];return r?r[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,r){if(!this.has(t))return this;let i=t.wrapped().key,n=void 0===r?0:this.data[i].indexOf(r),a=this.data[i][n];return this.data[i].splice(n,1),a.timeout&&clearTimeout(a.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){let r=[];for(let i in this.data)for(let n of this.data[i])t(n.value)||r.push(n);for(let t of r)this.remove(t.value.tileID,t)}},df={get url(){return t.F("node_modules/maplibre-gl/dist/maplibre-gl.mjs")},env:{DEV:!1,PROD:!0,MODE:"production",BASE_URL:"/",SSR:!1}};function dd(){var t=new eC(4);return eC!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let dp={frame(t,r,i,n){let a=n||window,o=a.requestAnimationFrame(t=>{s(),r(t)}),{unsubscribe:s}=tB(t.signal,"abort",()=>{s(),a.cancelAnimationFrame(o),i(new tW(t.signal.reason))},!1)},frameAsync(t,r){return new Promise((i,n)=>{this.frame(t,i,n,r)})},getImageData(t,r=0){return this.getImageCanvasContext(t).getImageData(-r,-r,t.width+2*r,t.height+2*r)},getImageCanvasContext(t){let r;if(eA()&&!eS())r=new OffscreenCanvas(t.width,t.height).getContext("2d",{willReadFrequently:!0});else{let i=window.document.createElement("canvas");i.width=t.width,i.height=t.height,r=i.getContext("2d",{willReadFrequently:!0})}if(!r)throw Error("failed to create canvas 2d context");return r.drawImage(t,0,0,t.width,t.height),r},resolveURL:t=>((w||=document.createElement("a")).href=t,w.href),get hardwareConcurrency(){return"u">typeof navigator&&navigator.hardwareConcurrency||4}
57,get prefersReducedMotion(){return void 0===T?!!matchMedia&&(E??=matchMedia("(prefers-reduced-motion: reduce)")).matches:T},set prefersReducedMotion(e){T=e}},dm=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null===this._frozenAt?performance.now():this._frozenAt}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function dg(){return dm.getCurrentTime()}let dy=new Set("a.abbr.b.bdi.bdo.br.cite.code.del.div.em.i.img.ins.kbd.li.mark.ol.p.q.s.samp.small.span.strong.sub.sup.time.u.ul.var.wbr".split(".")),dv=new Set(["alt","class","datetime","dir","height","href","hreflang","lang","referrerpolicy","rel","role","src","target","title","translate","type","width"]),d_=new Set(["href","src"]),db=new Set(["http:","https:","mailto:"]);function dx(){return A??={getAttribute:Element.prototype.getAttribute,getAttributeNames:Element.prototype.getAttributeNames,querySelectorAll:Element.prototype.querySelectorAll,remove:Element.prototype.remove,removeAttribute:Element.prototype.removeAttribute,localName:Object.getOwnPropertyDescriptor(Element.prototype,"localName").get,namespaceURI:Object.getOwnPropertyDescriptor(Element.prototype,"namespaceURI").get}}var dw=class t{static{this.docStyle="u">typeof window&&window.document?.documentElement.style}static{this.selectProp=!t.docStyle||"userSelect"in t.docStyle?"userSelect":"webkitUserSelect"}static create(t,r,i){let n=window.document.createElement(t);return void 0!==r&&(n.className=r),i&&i.appendChild(n),n}static createNS(t,r){return window.document.createElementNS(t,r)}static disableDrag(){t.docStyle&&t.selectProp&&(t.userSelect=t.docStyle[t.selectProp],t.docStyle[t.selectProp]="none")}static enableDrag(){t.docStyle&&t.selectProp&&(t.docStyle[t.selectProp]=t.userSelect)}static suppressClickInternal(r){r.preventDefault(),r.stopPropagation(),window.removeEventListener("click",t.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",t.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",t.suppressClickInternal,!0)},0)}static getScale(t){let r=t.getBoundingClientRect();return{x:r.width/t.offsetWidth||1,y:r.height/t.offsetHeight||1,boundingClientRect:r}}static getPoint(t,r,i){let n=r.boundingClientRect;return new eT((i.clientX-n.left)/r.x-t.clientLeft,(i.clientY-n.top)/r.y-t.clientTop)}static mousePos(r,i){let n=t.getScale(r);return t.getPoint(r,n,i)}static touchPos(r,i){let n=[],a=t.getScale(r);for(let o of i)n.push(t.getPoint(r,a,o));return n}static sanitize(r){let i=new DOMParser().parseFromString(r,"text/html").body,{querySelectorAll:n,remove:a}=dx();for(let r of Array.from(n.call(i,"*")))t.isAllowedElement(r)?t.removeDisallowedAttributes(r):a.call(r);let o=document.createDocumentFragment();return o.append(...i.childNodes),o}static isAllowedElement(t){let{namespaceURI:r,localName:i}=dx();return"http://www.w3.org/1999/xhtml"===r.call(t)&&dy.has(i.call(t))}static removeDisallowedAttributes(r){let{getAttributeNames:i,getAttribute:n,removeAttribute:a}=dx();for(let o of i.call(r))t.isAllowedAttribute(o,n.call(r,o))||a.call(r,o)}static isAllowedAttribute(t,r){if(!dv.has(t)&&!t.startsWith("aria-"))return!1;if(!d_.has(t))return!0;try{return db.has(new URL(r,"https://maplibre.invalid/").protocol)}catch{return!1}}};(ea=S||={}).resetRequestQueue=()=>{V=[],$=0,G=0,q={}},ea.addThrottleControl=t=>{let r=G++;return q[r]=t,r},ea.removeThrottleControl=t=>{delete q[t],W()},ea.transformAndGetImage=async function(t,r,i,n,a=!0,o){let s=await t.transformRequest(r,i);return tY(n.signal),S.getImage(s,n,a,o)},ea.getImage=(t,r,i=!0,n)=>new Promise((a,o)=>{t.headers||={},t.headers.accept="image/webp,*/*",tb(t,{type:"image"}),V.push({abortController:r,requestParameters:t,supportImageRefresh:i,imageBitmapOptions:n,state:"queued",onError:t=>{o(t)},onSuccess:t=>{a(t)}}),W()}),H=async t=>{t.state="running";let{requestParameters:r,supportImageRefresh:i,imageBitmapOptions:n,onError:a,onSuccess:o,abortController:s}=t,l=!1===i&&!n&&!tO(self)&&!tK(r.url)&&(!r.headers||Object.keys(r.headers).reduce((t,r)=>t&&"accept"===r,!0));$++;let u=l?Z(r,s):t2(r,s);try{var c;let r=await u;delete t.abortController,t.state="completed",r.data instanceof HTMLImageElement||tL(r.data)?o(r):o(r.data&&0!==r.data.byteLength?{data:await (c=r.data,"function"==typeof createImageBitmap?tR(c,n):new Promise((t,r)=>{let i=new Image;i.onload=()=>{t(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>i.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},i.onerror=()=>r(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let n=new Blob([new Uint8Array(c)],{type:"image/png"});i.src=URL.createObjectURL(n)})),cacheControl:r.cacheControl,expires:r.expires}:{data:null,cacheControl:r.cacheControl,expires:r.expires})}catch(r){delete t.abortController,a(ti(r))}finally{$--,W()}},W=()=>{let t=(()=>{for(let t of Object.keys(q))if(q[t]())return!0;return!1})()?tX.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:tX.MAX_PARALLEL_IMAGE_REQUESTS;for(let r=$;r<t&&V.length>0;r++){let t=V.shift();if(t.abortController.signal.aborted){r--;continue}H(t)}},Z=(t,r)=>new Promise((i,n)=>{let a=new Image,o=t.url,s=t.credentials;s&&"include"===s?a.crossOrigin="use-credentials":(s&&"same-origin"===s||!t6(o))&&(a.crossOrigin="anonymous"),r.signal.addEventListener("abort",()=>{a.src="",n(new tW(r.signal.reason))}),a.fetchPriority="high",a.onload=()=>{a.onerror=a.onload=null,i({data:a})},a.onerror=()=>{a.onerror=a.onload=null,r.signal.aborted||n(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},a.src=o}),S.resetRequestQueue();var dE=class{constructor(t){this._transformRequestFn=t??null}transformRequest(t,r){return this._transformRequestFn&&this._transformRequestFn(t,r)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}},dT=class extends t7{},dA=class extends dT{},dS=class extends dT{constructor(t={}){super("style.load",t)}},dC=class extends dT{constructor(t,r={}){super(t,r),this.dataType="style"}}
57,dM=class extends dT{constructor(t,r={}){super(t,r),this.dataType="source"}},dD=class extends dT{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i,n={}){i=i instanceof MouseEvent?i:new MouseEvent(t,i);let a=dw.mousePos(r.getCanvas(),i),o=r.unproject(a);super(t,tb({point:a,lngLat:o,originalEvent:i},n)),this._defaultPrevented=!1,this.target=r}},dP=class extends dT{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,i){let n="touchend"===t?i.changedTouches:i.touches,a=dw.touchPos(r.getCanvasContainer(),n),o=a.map(t=>r.unproject(t)),s=a.reduce((t,r,i,n)=>t.add(r.div(n.length)),new eT(0,0)),l=r.unproject(s);super(t,{points:a,point:s,lngLats:o,lngLat:l,originalEvent:i}),this._defaultPrevented=!1}},dI=class extends dT{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r){super("wheel",{originalEvent:r}),this._defaultPrevented=!1}},dk=class extends dT{},dO=class extends dT{constructor(t={}){super("terrain",t)}},dN=class extends dT{constructor(t={}){super("projectiontransition",t)}},dL=class extends dT{},dR=class extends dT{constructor(t={}){super("styleimagemissing",t)}};function dF(t){t=t.slice();let r=Object.create(null);for(let i=0;i<t.length;i++)r[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=function(t,r){let i={};for(let r in t)"ref"!==r&&(i[r]=t[r]);return rr.forEach(t=>{t in r&&(i[t]=r[t])}),i}(t[i],r[t[i].ref]));return t}function dB(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let i=0;i<t.length;i++)if(!dB(t[i],r[i]))return!1;return!0}if("object"==typeof t&&t&&null!==r){if("object"!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(let i in t)if(!dB(t[i],r[i]))return!1;return!0}return t===r}function dz(t,r){t.push(r)}function dj(t,r,i){dz(i,{command:"addSource",args:[t,r[t]]})}function dU(t,r,i){dz(r,{command:"removeSource",args:[t]}),i[t]=!0}function dV(t,r,i,n,a){dz(r,{command:a,args:[i,n,t[n]]})}function d$(t,r,i,n,a){for(let o in r||={},t||={})Object.prototype.hasOwnProperty.call(t,o)&&(dB(t[o],r[o])||dV(r,i,n,o,a));for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&!Object.prototype.hasOwnProperty.call(t,o)&&(dB(t[o],r[o])||dV(r,i,n,o,a))}function dG(t){return t.id}function dq(t,r){return t[r.id]=r,t}function dH(t){let r=[];if("string"==typeof t)r.push({id:"default",url:t});else if(t&&t.length>0){let i=[];for(let{id:n,url:a}of t){let t=`${n}${a}`;i.includes(t)||(i.push(t),r.push({id:n,url:a}))}}return r}function dW(t,r,i){try{let n=new URL(t);return n.pathname+=`${r}${i}`,n.toString()}catch{throw Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function dZ(t,r,i,n){let a=dH(t),o=i>1?"@2x":"",s={},l={};for(let{id:t,url:i}of a){let a=await r.transformRequest(dW(i,o,".json"),"SpriteJSON");s[t]=t3(a,n);let u=await r.transformRequest(dW(i,o,".png"),"SpriteImage");l[t]=S.getImage(u,n)}return await Promise.all([...Object.values(s),...Object.values(l)]),dY(s,l)}async function dY(t,r){let i={};for(let n in t){i[n]={};let a=(await r[n]).data;if(!a)throw Error(`Could not load sprite image for ${n}: the response is empty`);let o=dp.getImageCanvasContext(a),s=(await t[n]).data;for(let t in s){let{width:r,height:a,x:l,y:u,sdf:c,pixelRatio:h,stretchX:f,stretchY:d,content:p,textFitWidth:m,textFitHeight:g}=s[t],y={width:r,height:a,x:l,y:u,context:o};i[n][t]={data:null,pixelRatio:h,sdf:c,stretchX:f,stretchY:d,content:p,textFitWidth:m,textFitHeight:g,spriteData:y}}}return i}var dX=class extends re{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let t of Object.keys(this.images))this.removeImage(t);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:t,promiseResolve:r}of this.requestors)r(this._getImagesForIds(t));this.requestors=[]}}getImage(t){let r=this.images[t];if(r&&!r.data&&r.spriteData){let t=r.spriteData;r.data=new lr({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),r.spriteData=null}return r}addImage(t,r){if(this.images[t])throw Error(`Image id ${t} already exist, use updateImage instead`);
57this._validate(t,r)&&(this.images[t]=r,this._imagesIds=null,r.isWebGLImage&&this.updateImage(t,r,!1))}_validate(t,r){let i=!0,n=r.data||r.spriteData;return this._validateStretch(r.stretchX,n?.width)||(this.fire(new t9(Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(r.stretchY,n?.height)||(this.fire(new t9(Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(r.content,r)||(this.fire(new t9(Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(t,r){if(!t)return!0;let i=0;for(let n of t){if(n[0]<i||n[1]<n[0]||r<n[1])return!1;i=n[1]}return!0}_validateContent(t,r){if(!t)return!0;if(4!==t.length)return!1;let i=r.spriteData,n=i?.width||r.data.width,a=i?.height||r.data.height;return!(t[0]<0)&&!(n<t[0])&&!(t[1]<0)&&!(a<t[1])&&!(t[2]<0)&&!(n<t[2])&&!(t[3]<0)&&!(a<t[3])&&!(t[2]<t[0])&&t[3]>=t[1]}updateImage(t,r,i=!0){let n=this.images[t];if(i){let t=n.data||n.spriteData;if(t.width!==r.data.width||t.height!==r.data.height)throw Error(`size mismatch between old image (${t.width}x${t.height}) and new image (${r.data.width}x${r.data.height}).`)}r.version=(n.version??0)+1,this.images[t]=r,this.updateVersion++}removeImage(t){let r=this.images[t];r&&(delete this.images[t],this._imagesIds=null,r.userImage?.onRemove&&r.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(t,r){return"default"===t?r:`${t}:${r}`}setSpriteImages(t,r){let i=this._spriteImagesIds[t]??[],n=[];for(let i in r){let a=this._getSpriteImageId(t,i);n.push(a),a in this.images?this.updateImage(a,r[i],!1):this.addImage(a,r[i])}let a=new Set(n),o=i.filter(t=>!a.has(t));for(let t of o)this.removeImage(t);return this._spriteImagesIds[t]=n,{loaded:n,removed:o}}removeSpriteImages(t){let r=this._spriteImagesIds[t]??[];for(let t of r)this.removeImage(t);return delete this._spriteImagesIds[t],r}removeAllSpriteImages(){let t=Object.values(this._spriteImagesIds).flat();for(let r of t)this.removeImage(r);return this._spriteImagesIds={},t}setMissingImageResolver(t){this.missingImageResolver=t}getImages(t){return new Promise((r,i)=>{let n=!0;if(!this.isLoaded())for(let r of t)this.images[r]||(n=!1);this.isLoaded()||n?r(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:r})})}async _getImagesForIds(t){let r=new Set(t.filter(t=>!this.getImage(t))),i=this.missingImageResolver;i&&await Promise.allSettled(Array.from(r,t=>i(t)));let n={};for(let i of t){let t=this.getImage(i);t&&(r.delete(i),n[i]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:!!t.userImage?.render,isWebGLImage:t.isWebGLImage})}for(let t of r)this.fire(new dR({id:t})),tI(`Image "${t}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return n}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let r of t){if(this._renderCallbacksDispatchedThisFrame[r])continue;this._renderCallbacksDispatchedThisFrame[r]=!0;let t=this.getImage(r);t||tI(`Image with ID: "${r}" was not found`),function(t){let{userImage:r}=t;return!!r?.render&&!!r.render()&&(cp(r.data)||t.data.replace(new Uint8Array(r.data.buffer)),!0)}(t)&&this.updateImage(r,t)}}cloneImages(){let t={};for(let r in this.images){let i=this.images[r];t[r]={...i,data:i.data?i.data.clone():null}}return t}},dK=class{constructor(t){this._imageManager=t,this._entries={},this._image=new lr({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new lr({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:t,height:r}=this._image;return{width:t,height:r}}getPattern(t){let r=this._imageManager.getImage(t);if(!r)return null;let i=this._entries[t];
57if(i?.image!==r){let i={w:r.data.width+2,h:r.data.height+2,x:0,y:0};this._entries[t]={bin:i,position:new cg(i,r),image:r}}else{if(i.position.version===r.version)return i.position;i.position.version=r.version}return this._update(),this._entries[t].position}bind(t){let r=t.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new lh(t,this._image,r.RGBA),this._dirty=!1),this._texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_update(){for(let t in this._entries)this._imageManager.getImage(t)||delete this._entries[t];let t=[];for(let r in this._entries)t.push(this._entries[r].bin);let{w:r,h:i}=cm(t),n=this._image;for(let t in n.resize({width:r||1,height:i||1}),this._entries){let{bin:r}=this._entries[t],i=r.x+1,a=r.y+1,o=this._entries[t].image.data,s=o.width,l=o.height;lr.copy(o,n,{x:0,y:0},{x:i,y:a},{width:s,height:l}),lr.copy(o,n,{x:0,y:l-1},{x:i,y:a-1},{width:s,height:1}),lr.copy(o,n,{x:0,y:0},{x:i,y:a+l},{width:s,height:1}),lr.copy(o,n,{x:s-1,y:0},{x:i-1,y:a},{width:1,height:l}),lr.copy(o,n,{x:0,y:0},{x:i+s,y:a},{width:1,height:l})}this._dirty=!0}};let dQ={start:0,end:1114111},dJ=0;function d0(t,r){return t>r||t>1114111?null:{start:t,end:Math.min(r,1114111)}}var d1=class{constructor(t){this.requestManager=t,this._faces={},this._registered=new Set}setFontFaces(t){for(let[r,i]of(this._unregisterAll(),this._faces={},Object.entries(t??{}))){let t=Array.isArray(i)?i:[i];this._faces[r]=t.map(t=>this._declareFontFace(r,t)).filter(t=>null!==t)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(t,r){for(let i of t.split(","))for(let t of this._faces[i.trim()]??[])if(function(t,r){return t.ranges.some(({start:t,end:i})=>r>=t&&r<=i)}(t,r)&&(t.loaded??=this._loadFontFace(t),await t.loaded))return t.family;return null}_declareFontFace(t,r){let i="string"==typeof r?{url:r}:r;if("string"!=typeof i?.url)return tI(`Ignoring the font face declared for "${t}": it has no URL.`),null;let n=`maplibre-gl-font-face-${dJ++}`,a=i["unicode-range"];if(!a?.length)return{url:i.url,ranges:[dQ],family:n};let o=[];for(let t of a){let r=function(t){let r=/^u\+([0-9a-f]*)(\?+)$/i.exec(t);if(r){let[,t,i]=r;return t.length+i.length>6?null:d0(parseInt(`${t}${"0".repeat(i.length)}`,16),parseInt(`${t}${"f".repeat(i.length)}`,16))}let i=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(t);if(!i)return null;let n=parseInt(i[1],16);return d0(n,void 0===i[2]?n:parseInt(i[2],16))}(t);if(!r){tI(`Ignoring the unicode range "${t}" of the font face at ${i.url}: it is not a valid range.`);continue}o.push(r)}return o.length?{url:i.url,ranges:o,family:n}:null}async _loadFontFace(t){let r;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return tI(`Ignoring the font face at ${t.url}: this environment has no CSS Font Loading API.`),!1;try{return r=new FontFace(t.family,await this._downloadFontFile(t.url)),!!Object.values(this._faces).some(r=>r.includes(t))&&(document.fonts.add(r),this._registered.add(r),await r.load(),!0)}catch(i){return r&&this._unregister(r),tI(`Ignoring the font face at ${t.url}: ${ti(i).message}`),!1}}async _downloadFontFile(t){let r=await this.requestManager.transformRequest(t,"Glyphs"),i=await t4(r,new AbortController);if(!i?.data)throw Error(`the response was empty for the font file at ${t}`);return i.data}_unregister(t){document.fonts?.delete(t),this._registered.delete(t)}_unregisterAll(){for(let t of this._registered)document.fonts?.delete(t);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};let d2=new Float64Array(256);for(let t=0;t<256;t++){let r=.5-(t/255)**(1/2.2);d2[t]=r*Math.abs(r)}d2[255]=-1e20;var d3=class{constructor({fontSize:t=24,buffer:r=3,radius:i=8,cutoff:n=.25,fontFamily:a="sans-serif",fontWeight:o="normal",fontStyle:s="normal",lang:l=null}={}){this.buffer=r,this.radius=i,this.cutoff=n,this.lang=l;let u=this.size=t+4*r,c=this._createCanvas(u),h=this.ctx=c.getContext("2d",{willReadFrequently:!0});h.font=`${s} ${o} ${t}px ${a}`,h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(t){if("u">typeof OffscreenCanvas)return new OffscreenCanvas(t,t);let r=document.createElement("canvas");return r.width=r.height=t,r}draw(t){let{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(i),l=Math.floor(-a),u=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o)-l)),c=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(n))),h=u+2*this.buffer,f=c+2*this.buffer,d=Math.max(h*f,0),p=new Uint8ClampedArray(d),m={data:p,width:h,height:f,glyphWidth:u,glyphHeight:c,glyphTop:s,glyphLeft:l,glyphAdvance:r};if(0===u||0===c)return m;let{ctx:g,buffer:y,gridInner:v,gridOuter:_}=this;this.lang&&(g.lang=this.lang),g.clearRect(y,y,u,c),g.fillText(t,y-l,y+s);let b=g.getImageData(y,y,u,c);_.fill(1e20,0,d),v.fill(0,0,d);let x=3;for(let t=0;t<c;t++){let r=(t+y)*h+y;for(let t=0;t<u;t++,x+=4,r++){let t=b.data[x];if(0===t)continue;let i=d2[t];_[r]=Math.max(0,i),v[r]=Math.max(0,-i)}}d4(_,0,0,h,f,h,this.f,this.v,this.z);let w=Math.min(y,1);d4(v,y-w,y-w,u+2*w,c+2*w,h,this.f,this.v,this.z);let E=255/this.radius,T=255*(1-this.cutoff);for(let t=0;t<d;t++){let r=Math.sqrt(_[t])-Math.sqrt(v[t]);p[t]=Math.round(T-E*r)}return m}};function d4(t,r,i,n,a,o,s,l,u){for(let c=r;c<r+n;c++)d6(t,i*o+c,o,a,s,l,u);for(let c=i;c<i+a;c++)d6(t,c*o+r,1,n,s,l,u)}function d6(t,r,i,n,a,o,s){o[0]=0,s[0]=-1e20,s[1]=1e20,a[0]=t[r];for(let l=1,u=0,c=0;l<n;l++){a[l]=t[r+l*i];let n=l*l;
57do{let t=o[u];c=(a[l]-a[t]+n-t*t)/(l-t)/2}while(c<=s[u]&&--u>-1)o[++u]=l,s[u]=c,s[u+1]=1e20}for(let l=0,u=0;l<n;l++){for(;s[u+1]<l;)u++;let n=o[u],c=l-n;t[r+l*i]=a[n]+c*c}}let d5=rt.layout_symbol["text-font"].default.join(","),d8=(t,r)=>{let i=new d3(t);return i.buffer=r,i};var d7=class{constructor(t,r,i,n=d8){this.requestManager=t,this.localIdeographFontFamily=r,this.entries={},this.lang=i,this.fontFaceManager=new d1(t),this.createRasterizer=n}setURL(t){this.url=t}setFontFaces(t){this.fontFaceManager.setFontFaces(t),this.entries={}}async getGlyphs(t){let r=[];for(let i in t)for(let n of t[i])r.push(this._getAndCacheGlyphsPromise(i,n));let i=await Promise.all(r),n={};for(let{stack:t,id:r,glyph:a}of i)n[t]||={},n[t][r]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};return n}async _getAndCacheGlyphsPromise(t,r){this.entries[t]??={glyphs:{},requests:{},ranges:{}};let i=this.entries[t],n=i.glyphs[r];if(void 0!==n)return{stack:t,id:r,glyph:n};let a=r.codePointAt(0),o=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(t,a):null;return o?(n=i.glyphs[r]=await this._drawGlyph(i,t,r,o),{stack:t,id:r,glyph:n}):!this.url||uJ(r)||this._charUsesLocalIdeographFontFamily(a)?(n=i.glyphs[r]=await this._drawGlyph(i,t,r),{stack:t,id:r,glyph:n}):await this._downloadAndCacheRangePromise(t,r)}async _downloadAndCacheRangePromise(t,r){let i=r.codePointAt(0),n=this.entries[t],a=Math.floor(i/256);if(n.ranges[a])return{stack:t,id:r,glyph:null};n.requests[a]||=this._loadGlyphRange(t,a);try{let o=await n.requests[a];for(let t in o)n.glyphs[String.fromCodePoint(+t)]=o[+t];return n.ranges[a]=!0,{stack:t,id:r,glyph:o[i]||null}}catch(s){let o=n.glyphs[r]=await this._drawGlyph(n,t,r);return this._warnOnMissingGlyphRange(o,a,i,ti(s)),{stack:t,id:r,glyph:o}}}async _loadGlyphRange(t,r){let i=256*r,n=i+255,a=await this.requestManager.transformRequest(this.url.replace("{fontstack}",t).replace("{range}",`${i}-${n}`),"Glyphs"),o=await t4(a,new AbortController);if(!o?.data)throw Error(`Could not load glyph range. range: ${r}, ${i}-${n}`);let s={};for(let t of new cc(o.data).readFields(ch,[]))s[t.id]=t;return s}_warnOnMissingGlyphRange(t,r,i,n){let a=256*r,o=i.toString(16).padStart(4,"0").toUpperCase();tI(`Unable to load glyph range ${r}, ${a}-${a+255}. Rendering codepoint U+${o} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}async _drawGlyph(t,r,i,n){let a=(await this._getTinySDF(t,r,i,n)).draw(i),o=/^\p{gc=Cf}+$/u.test(i);return{id:i.codePointAt(0),bitmap:new lt({width:a.width||60,height:a.height||60},a.data),metrics:{width:o?0:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:o?0:a.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(t,r,i,n){let a=uJ(i);if(n){let r=a?"clusterTinySDFs":"fontFaceTinySDFs";return t[r]??={},t[r][n]||=this._createTinySDF(n,!1,a?3:1),t[r][n]}let o=r===d5&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(i.codePointAt(0)),s=o?this.localIdeographFontFamily:r;if(a)return t.clusterTinySDFs??={},t.clusterTinySDFs[s]||=this._createTinySDF(s,!0,3),t.clusterTinySDFs[s];let l=o?"ideographTinySDF":"tinySDF";return t[l]||=this._createTinySDF(s),t[l]}async _createTinySDF(t,r=!0,i=1){let n=t?t.split(","):[];n.push("sans-serif");let a=n.map(t=>/[-\w]+/.test(t)?t:`'${CSS.escape(t)}'`).join(","),o=r?this._fontWeight(n[0]):void 0,s=r?this._fontStyle(n[0]):"normal";if("u">typeof document&&document.fonts?.load)try{await document.fonts.load(`${s} ${o||"normal"} 48px ${a}`)}catch(t){tI(`Failed to load font "${a}": ${ti(t).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(i-1)/4)),radius:16,cutoff:.25,fontFamily:a,fontWeight:o,fontStyle:s,lang:this.lang},6)}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let r;for(let[i,n]of Object.entries({thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950}))RegExp(`\\b${i}\\b`,"i").test(t)&&(r=`${n}`);return r}destroy(){for(let t in this.entries){let r=this.entries[t];r.tinySDF=null,r.ideographTinySDF=null,r.fontFaceTinySDFs={},r.glyphs={},r.requests={},r.ranges={}}this.entries={},this.fontFaceManager.destroy()}},d9=class extends re{constructor(t,r){super(),this._transitionable=new aX(C||=new a9({anchor:new a4(rt.light.anchor,"anchor"),position:new a4(rt.light.position,"position"),color:new a4(rt.light.color,"color"),intensity:new a4(rt.light.intensity,"intensity")}),"light",r),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return function([t,r,i]){return r+=90,[t*Math.cos(r*=Math.PI/180)*Math.sin(i*=Math.PI/180),t*Math.sin(r)*Math.sin(i),t*Math.cos(i)]}(this.properties.get("position"))}setLight(t,r={}
57){this._validate(aM.light,t,r)||this._transitionable.setValues(t)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}applyGlobalStateChange(t,r,i){this._transitioning=this._transitionable.applyGlobalStateChange(t,r,this._transitioning,i)}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,i){return aF(this,t,{value:r},i)}},pe=class extends re{constructor(t,r){super(),this._transitionable=new aX(M||=new a9({"sky-color":new a4(rt.sky["sky-color"],"sky-color"),"horizon-color":new a4(rt.sky["horizon-color"],"horizon-color"),"fog-color":new a4(rt.sky["fog-color"],"fog-color"),"fog-ground-blend":new a4(rt.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new a4(rt.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new a4(rt.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new a4(rt.sky["atmosphere-blend"],"atmosphere-blend")}),"sky",r),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new aW(0))}setSky(t,r={}){return!this._validate(aM.sky,t,r)&&(t||={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0},this._transitionable.setValues(t),!0)}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}applyGlobalStateChange(t,r,i){this._transitioning=this._transitionable.applyGlobalStateChange(t,r,this._transitioning,i)}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,i={}){return aF(this,t,{value:r},i)}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}},pt=class{constructor(t,r){this.width=t,this.height=r,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,r){let i=t.join(",")+String(r);return this.dashEntry[i]||=this.addDash(t,r),this.dashEntry[i]}getDashRanges(t,r,i){let n=t.length%2==1,a=[],o=n?-t[t.length-1]*i:0,s=t[0]*i,l=!0;a.push({left:o,right:s,isDash:l,zeroLength:0===t[0]});let u=t[0];for(let r=1;r<t.length;r++){l=!l;let n=t[r];o=u*i,u+=n,s=u*i,a.push({left:o,right:s,isDash:l,zeroLength:0===n})}return a}addRoundDash(t,r,i){let n=r/2;for(let r=-i;r<=i;r++){let a=this.nextRow+i+r,o=this.width*a,s=0,l=t[0];for(let a=0;a<this.width;a++){a/l.right>1&&(l=t[++s]);let u=Math.min(Math.abs(a-l.left),Math.abs(a-l.right)),c,h=r/i*(n+1);if(l.isDash){let t=n-Math.abs(h);c=Math.sqrt(u*u+t*t)}else c=n-Math.sqrt(u*u+h*h);this.data[o+a]=Math.max(0,Math.min(255,c+128))}}}addRegularDash(t){for(let r=t.length-1;r>=0;--r){let i=t[r],n=t[r+1];i.zeroLength?t.splice(r,1):n?.isDash===i.isDash&&(n.left=i.left,t.splice(r,1))}let r=t[0],i=t[t.length-1];r.isDash===i.isDash&&(r.left=i.left-this.width,i.right=r.right+this.width);let n=this.width*this.nextRow,a=0,o=t[0];for(let r=0;r<this.width;r++){r/o.right>1&&(o=t[++a]);let i=Math.min(Math.abs(r-o.left),Math.abs(r-o.right)),s=o.isDash?i:-i;this.data[n+r]=Math.max(0,Math.min(255,s+128))}}addDash(t,r){let i=7*!!r,n=2*i+1;if(this.nextRow+n>this.height)return tI("LineAtlas out of space"),null;let a=0;for(let r of t)a+=r;if(0!==a){let n=this.width/a,o=this.getDashRanges(t,this.width,n);r?this.addRoundDash(o,n,i):this.addRegularDash(o)}let o={y:this.nextRow+i,height:2*i,width:a};return this.nextRow+=n,this.dirty=!0,o}bind(t){let r=t.gl;this.texture?(r.bindTexture(r.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,r.texSubImage2D(r.TEXTURE_2D,0,0,0,this.width,this.height,r.ALPHA,r.UNSIGNED_BYTE,this.data))):(this.texture=r.createTexture(),r.bindTexture(r.TEXTURE_2D,this.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.REPEAT),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.REPEAT),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.ALPHA,this.width,this.height,0,r.ALPHA,r.UNSIGNED_BYTE,this.data))}};function pr(t,r){if(r)try{return new Worker(t,{type:"module"})}catch(t){console.warn("Module worker not supported, falling back to classic worker",t)}return new Worker(t)}async function pi(t){let r=await fetch(t);if(!r.ok)throw Error(`Failed to fetch worker script (${r.status}): ${t}`);
57let i=new Blob([await r.text()],{type:"text/javascript"});return URL.createObjectURL(i)}async function pn(){let r,i=tX.WORKER_URL||(r=df.url,/^https?:/.test(r)?(r.endsWith("-dev.mjs"),new t.U(t.r(16839)).href):""),n=!i?.endsWith(".cjs");if(!function(t){if(!t)return!1;let r=globalThis.location;if(!r)return!1;try{return new URL(t,r.href).origin!==r.origin}catch{return!1}}(i))return pr(i,n);if(n){let t,r=(t=new Blob([`import ${JSON.stringify(new URL(i,df.url).href)}`],{type:"text/javascript"}),URL.createObjectURL(t));try{return pr(r,n)}finally{URL.revokeObjectURL(r)}}let a=await pi(i);try{return pr(a,n)}finally{URL.revokeObjectURL(a)}}var pa=class t{constructor(){this.active={},this.workersPromise=null}async acquire(r){if(this.active[r]=!0,!this.workersPromise){let r=[];for(;r.length<t.workerCount;)r.push(pn());this.workersPromise=Promise.all(r)}return(await this.workersPromise).slice()}release(t){if(delete this.active[t],0===this.numActive()&&this.workersPromise){let t=this.workersPromise;this.workersPromise=null,t.then(t=>{for(let r of t)r.terminate()})}}isPreloaded(){return!!this.active.maplibre_preloaded_worker_pool}numActive(){return Object.keys(this.active).length}};let po=Math.floor(dp.hardwareConcurrency/2);pa.workerCount=!function(t){if(null==tN){let r=t.navigator?t.navigator.userAgent:null;tN=!!t.safari||!!(r&&(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return tN}(globalThis)?1:Math.max(Math.min(po,3),1);var ps=class extends re{constructor(t,r){super(),this.workerPool=t,this.actors=[],this.currentActor=0,this.id=r,this.removed=!1,this.workerErrorSubscriptions=[],this.actorsPromise=this.initActors(r)}async initActors(t){let r=await this.workerPool.acquire(t);if(this.removed)return[];if(this.actors=r.map((r,i)=>{this.workerErrorSubscriptions.push(tB(r,"error",()=>{this.fire(new t9(Error("Worker failed to load. Check that the worker URL is correct.")))},!1));let n=new ha(r,t);return n.name=`Worker ${i}`,n}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(t,r){return Promise.all((await this.actorsPromise).map(i=>i.sendAsync({type:t,data:r})))}async getActor(){let t=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%t.length,t[this.currentActor]}async waitForInitComplete(){0===this.actors.length&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(let t of(this.removed=!0,this.actors))t.remove();for(let t of this.workerErrorSubscriptions)t.unsubscribe();this.actors=[],this.workerErrorSubscriptions=[],this.setEventedParent(null),t&&this.workerPool.release(this.id)}async registerMessageHandler(t,r){for(let i of(await this.actorsPromise))i.registerMessageHandler(t,r)}async unregisterMessageHandler(t){for(let r of(await this.actorsPromise))r.unregisterMessageHandler(t)}};function pl(t,r){let i=t.tileID,n=r.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}function pu(t,r){let i=t.feature,n=r.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=n}async function pc(t,r,i,n){let a=t;if(t.url?a=(await t3(await r.transformRequest(t.url,"Source"),i)).data:await dp.frameAsync(i,n),!a)return null;let o=tx(tb(a,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map(t=>t.id)),o}var ph=class t{constructor(t,r){t&&(r?this.setSouthWest(t).setNorthEast(r):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof uo?new uo(t.lng,t.lat):uo.convert(t),this}setSouthWest(t){return this._sw=t instanceof uo?new uo(t.lng,t.lat):uo.convert(t),this}extend(r){let i=this._sw,n=this._ne,a,o;if(r instanceof uo)a=r,o=r;else if(r instanceof t){if(a=r._sw,o=r._ne,!a||!o)return this}else return Array.isArray(r)?4===r.length||r.every(Array.isArray)?this.extend(t.convert(r)):this.extend(uo.convert(r)):r&&("lng"in r||"lon"in r)&&"lat"in r?this.extend(uo.convert(r)):this;return i||n?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),n.lng=Math.max(o.lng,n.lng),n.lat=Math.max(o.lat,n.lat)):(this._sw=new uo(a.lng,a.lat),this._ne=new uo(o.lng,o.lat)),this}getCenter(){return new uo((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}
vendor: 3,790 bytes, line 57
57getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new uo(this.getWest(),this.getNorth())}getSouthEast(){return new uo(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:r,lat:i}=uo.convert(t),n=this._sw.lat<=i&&i<=this._ne.lat,a=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=r&&r>=this._ne.lng),n&&a}intersects(r){if(!((r=t.convert(r)).getNorth()>=this.getSouth()&&r.getSouth()<=this.getNorth()))return!1;let i=Math.abs(this.getEast()-this.getWest()),n=Math.abs(r.getEast()-r.getWest());if(i>=360||n>=360)return!0;let a=t_(this.getWest(),-180,180),o=t_(this.getEast(),-180,180),s=t_(r.getWest(),-180,180),l=t_(r.getEast(),-180,180),u=a>o,c=s>l;return!!u&&!!c||(u?l>=a||s<=o:c?o>=s||a<=l:s<=o&&l>=a)}static convert(r){return r instanceof t||!r?r:new t(r)}static fromLngLat(r,i=0){let n=360*i/0x2637f09,a=n/Math.cos(Math.PI/180*r.lat);return new t(new uo(r.lng-a,r.lat-n),new uo(r.lng+a,r.lat+n))}adjustAntiMeridian(){let r=new uo(this._sw.lng,this._sw.lat),i=new uo(this._ne.lng,this._ne.lat);return r.lng>i.lng?new t(r,new uo(i.lng+360,i.lat)):new t(r,i)}},pf=class{constructor(t,r,i){this.bounds=ph.convert(this.validateBounds(t)),this.minzoom=r||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){let r=2**t.z,i={minX:Math.floor(uu(this.bounds.getWest())*r),minY:Math.floor(uc(this.bounds.getNorth())*r),maxX:Math.ceil(uu(this.bounds.getEast())*r),maxY:Math.ceil(uc(this.bounds.getSouth())*r)};return t.x>=i.minX&&t.x<i.maxX&&t.y>=i.minY&&t.y<i.maxY}},pd=class extends re{constructor(t,r,i,n){if(super(),this.id=t,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,tb(this,tx(r,["url","scheme","tileSize","promoteId","encoding"])),this._options=tb({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}async load(t=!1){this._loaded=!1,this.fire(new dM("dataloading")),this._tileJSONRequest=new AbortController;try{let r=await pc(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,r&&(tb(this,r),r.bounds&&(this.tileBounds=new pf(r.bounds,this.minzoom,this.maxzoom)),this.fire(new dM("data",{sourceDataType:"metadata"})),this.fire(new dM("data",{sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,tZ(t)||this.fire(new t9(ti(t)))}}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this.tiles=t,this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return tb({},this._options)}async loadTile(t){let r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:await this.map._requestManager.transformRequest(r,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
57ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(t),etag:t.etag};if(i.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete(),t.aborted)return;let n="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise((r,i)=>{t.reloadPromise={resolve:r,reject:i}})}else t.actor=this.dispatcher.getReadyActor(),n="LT";t.abortController=new AbortController;try{let r=await t.actor.sendAsync({type:n,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,r);let a={};return r?.etagUnmodified&&(a.unmodified=!0),a}catch(r){if(delete t.abortController,t.aborted||tZ(r))return;if(r&&404!==r.status)throw r;this._afterTileLoadWorkerResponse(t,null)}}async _getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let r=t.tileID.scaledTo(this.maxzoom).canonical,i=r.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:r,overzoomRequest:await this.map._requestManager.transformRequest(i,"Tile")}}_afterTileLoadWorkerResponse(t,r){if(r?.resourceTiming&&(t.resourceTiming=r.resourceTiming),r&&this.map._refreshExpiredTiles&&t.setExpiryData(r),t.etag=r?.etag,t.loadVectorData(r,this.map.painter),t.reloadPromise){let r=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(r.resolve).catch(r.reject)}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&await t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.t
vendor: 4,186 bytes, line 57
57ype,source:this.id}})}async unloadTile(t){t.unloadVectorData(),t.actor&&await t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},pp=class extends re{constructor(t,r,i,n){super(),this.id=t,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=tb({type:"raster"},r),tb(this,tx(r,["url","scheme","tileSize"]))}async load(t=!1){this._loaded=!1,this.fire(new dM("dataloading")),this._tileJSONRequest=new AbortController;try{let r=await pc(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,r&&(tb(this,r),r.bounds&&(this.tileBounds=new pf(r.bounds,this.minzoom,this.maxzoom)),this.fire(new dM("data",{sourceDataType:"metadata"})),this.fire(new dM("data",{sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,tZ(t)||this.fire(new t9(ti(t)))}}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(t){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this.tiles=t,this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return tb({},this._options)}setPremultiplyAlpha(t){return this._premultiplyAlpha===t||this.setSourceProperty(()=>{this._premultiplyAlpha=t}),this}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}async loadTile(t){let r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this._premultiplyAlpha,n=i?void 0:{premultiplyAlpha:"none"};t.abortController=new AbortController;try{let a=await S.transformAndGetImage(this.map._requestManager,r,"Tile",t.abortController,this.map._refreshExpiredTiles,n);if(delete t.abortController,t.aborted){t.state="unloaded";return}if(a){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let r=this.map.painter.context,n=r.gl,o=a.data??new lr({width:1,height:1},new Uint8Array(4));t.texture=this.map.painter.getTileTexture(o.width),t.texture?t.texture.update(o,{useMipmap:!0,premultiply:i}):(t.texture=new lh(r,o,n.RGBA,{useMipmap:!0,premultiply:i}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(r){if(delete t.abortController,t.aborted)t.state="unloaded";else if(r)throw t.state="errored",r}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController)}async unloadTile(t){t.texture&&this.map.painter.saveTileTexture(t.texture)}hasTransition(){return!1}},pm=class extends pp{constructor(t,r,i,n){super(t,r,i,n),this.type="raster-dem",this.maxzoom=22,this._options=tb({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox",this.redFactor=r.redFactor,this.greenFactor=r.greenFactor,this.blueFactor=r.blueFactor,this.baseShift=r.baseShift}async loadTile(t){let r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let i=await S.transformAndGetImage(this.map._requestManager,r,"Tile",t.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete t.abortController,t.aborted){t.state="unloaded";return}if(i){if(this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires}),!i.data){t.state="loaded";return}let r=i.data,n=tL(r)&&eA()?r:await this.readImageNow(r),a={type:this.type,uid:t.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&"expired"!==t.state&&"reloading"!==t.state)return;await this.dispatcher.waitForInitComplete(),t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getReadyActor()),t.dem=await t.actor.sendAsync({type:"LDT",data:a}
vendor: 1,400 bytes, line 57
57),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.needsColorReliefPrepare=!0,t.state="loaded"}}catch(r){if(delete t.abortController,t.aborted)t.state="unloaded";else if(r)throw t.state="errored",r}}async readImageNow(t){if("u">typeof VideoFrame&&eS()){let r=t.width+4,i=t.height+4;try{return new lr({width:r,height:i},await tF(t,-2,-2,r,i))}catch{}}return dp.getImageData(t,2)}_getNeighboringTiles(t){let r=t.canonical,i=2**r.z,n=(r.x-1+i)%i,a=0===r.x?t.wrap-1:t.wrap,o=(r.x+1+i)%i,s=r.x+1===i?t.wrap+1:t.wrap,l={};return l[new hu(t.overscaledZ,a,r.z,n,r.y).key]={backfilled:!1},l[new hu(t.overscaledZ,s,r.z,o,r.y).key]={backfilled:!1},r.y>0&&(l[new hu(t.overscaledZ,a,r.z,n,r.y-1).key]={backfilled:!1},l[new hu(t.overscaledZ,t.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new hu(t.overscaledZ,s,r.z,o,r.y-1).key]={backfilled:!1}),r.y+1<i&&(l[new hu(t.overscaledZ,a,r.z,n,r.y+1).key]={backfilled:!1},l[new hu(t.overscaledZ,t.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new hu(t.overscaledZ,s,r.z,o,r.y+1).key]={backfilled:!1}),l}async unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&await t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}})}};function pg(t,r){return r?t.properties[r]:t.id}function py(t,r){if(!t)return{};let i={};
57return i.removeAll=t.removeAll,i.remove=new Set(t.remove||[]),i.add=new Map(t.add?.map(t=>[pg(t,r),t])),i.update=new Map(t.update?.map(t=>[t.id,t])),i}function pv(t){return"GeometryCollection"===t.type?t.geometries.flatMap(t=>pv(t)):function t(r){return r&&0!==r.length?"number"==typeof r[0]?[r]:r.flatMap(r=>t(r)):[]}(t.coordinates)}function p_(t){let r=new ph,i;switch(t.type){case"FeatureCollection":i=t.features.flatMap(t=>pv(t.geometry));break;case"Feature":i=pv(t.geometry);break;default:i=pv(t)}if(0===i.length)return r;for(let t of i){let[i,n]=t;r.extend([i,n])}return r}var pb=class extends re{constructor(t,r,i,n){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:r.data},this.actorPromise=i.getActor(),this.setEventedParent(n),this._data="string"==typeof r.data?{url:r.data}:{geojson:r.data},this._options=tb({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId,void 0!==r.clusterMaxZoom&&this.maxzoom<=r.clusterMaxZoom&&tI(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${r.clusterMaxZoom}".`),this.workerOptions=tb({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0===r.buffer?128:r.buffer),tolerance:this._pixelsToTileUnits(void 0===r.tolerance?.375:r.tolerance),extent:8192,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1,promoteId:this._promoteIdKey,cluster:r.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(r.clusterMaxZoom),minPoints:Math.max(2,r.clusterMinPoints||2),extent:8192,radius:this._pixelsToTileUnits(r.clusterRadius||50),log:!1,generateId:r.generateId||!1}},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions)}get _promoteIdKey(){return"string"==typeof this.promoteId?this.promoteId:void 0}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(8192/this.tileSize)}_tileUnitsToPixels(t){return t/(8192/this.tileSize)}_getClusterMaxZoom(t){let r=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||tI(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${r}"`),r}async load(){await this._updateWorkerData()}onAdd(t){this.map=t,this.load()}setData(t){return this._data="string"==typeof t?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t},this._updateWorkerData()}updateData(t){return this._pendingWorkerUpdate.diff=function(t,r,i){let n;if(!t)return r||{};if(!r)return t||{};let a=py(t,i),o=py(r,i);var s,l=a,u=o;for(let t of(u.removeAll&&(l.add.clear(),l.update.clear(),l.remove.clear(),u.remove.clear()),u.remove))l.add.delete(t),l.update.delete(t);for(let[t,r]of u.update){let i=l.update.get(t);i&&(u.update.set(t,function(t,r){let i={id:t.id};if(r.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete r.removeProperties),r.removeProperties&&t.addOrUpdateProperties){let i=new Set(r.removeProperties);t.addOrUpdateProperties=t.addOrUpdateProperties.filter(t=>!i.has(t.key))}return(t.removeAllProperties||r.removeAllProperties)&&(i.removeAllProperties=!0),(t.removeProperties||r.removeProperties)&&(i.removeProperties=[...t.removeProperties||[],...r.removeProperties||[]]),(t.addOrUpdateProperties||r.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...r.addOrUpdateProperties||[]]),(t.newGeometry||r.newGeometry)&&(i.newGeometry=r.newGeometry||t.newGeometry),i}(i,r)),l.update.delete(t))}let c={};
vendor: 4,817 bytes, line 57
57if((a.removeAll||o.removeAll)&&(c.removeAll=!0),c.remove=new Set([...a.remove,...o.remove]),c.add=new Map([...a.add,...o.add]),c.update=new Map([...a.update,...o.update]),c.remove.size&&c.add.size)for(let t of c.add.keys())c.remove.delete(t);return n={},(s=c).removeAll&&(n.removeAll=s.removeAll),s.remove&&(n.remove=Array.from(s.remove)),s.add&&(n.add=Array.from(s.add.values())),s.update&&(n.update=Array.from(s.update.values())),n}(this._pendingWorkerUpdate.diff,t,this._promoteIdKey),this._updateWorkerData()}async getData(){return this._data.url&&await this.once("data"),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return p_(await this.getData())}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,void 0!==t.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:t,clusterOptions:r}=this.workerOptions.geojsonVtOptions;return{cluster:t,clusterMaxZoom:r.maxZoom,clusterRadius:this._tileUnitsToPixels(r.radius)}}async getClusterExpansionZoom(t){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}async getClusterChildren(t){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}async getClusterLeaves(t,r,i){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:r,offset:i}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate())return void tI(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:r,updateCluster:i}=this._pendingWorkerUpdate,n=this._getLoadGeoJSONParameters(t,r,i);void 0===t?r?this._pendingWorkerUpdate.diff=void 0:i&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(n),await this._updatePromise}async _getLoadGeoJSONParameters(t,r,i){let n=tb({type:this.type,source:this.id},this.workerOptions);return"string"==typeof t?(n.request=await this.map._requestManager.transformRequest(dp.resolveURL(t),"Source"),n.request.collectResourceTiming=this._collectResourceTiming,n):void 0!==t?(n.data=t,n):r?(n.dataDiff=r,n):i?(n.updateCluster=!0,n):void 0}async _dispatchWorkerUpdate(t){this._isUpdatingWorker=!0,this.fire(new dM("dataloading"));try{let r=await t,i=await (await this.actorPromise).sendAsync({type:"LD",data:r});if(this._isUpdatingWorker=!1,this._removed||i.abandoned)return void this.fire(new dM("dataabort"));i.data&&(this._data={geojson:i.data});let n=this._applyDiffToSource(r.dataDiff),a=this._getShouldReloadTileOptions(n),o={};this._applyResourceTiming(o,i),this.fire(new dM("data",{...o,sourceDataType:"metadata"})),this.fire(new dM("data",{...o,sourceDataType:"content",shouldReloadTileOptions:a}))}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new dM("dataabort"));this.fire(new t9(ti(t)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(t,r){if(!this._collectResourceTiming)return;let i=r.resourceTiming?.[this.id];if(!i)return;let n=i.slice(0);n?.length&&tb(t,{resourceTiming:n})}_applyDiffToSource(t){if(!t)return;let r=this._promoteIdKey;if(!this._data.url&&!this._data.updateable){let t=function(t,r){let i=new Map;if(null==t||null==t.type)return i;if("Feature"===t.type){let n=pg(t,r);return null==n?void 0:(i.set(n,t),i)}if("FeatureCollection"===t.type){let n=new Set;for(let a of t.features){let t=pg(a,r);if(null==t||n.has(t))return;n.add(t),i.set(t,a)}return i}}(this._data.geojson,r);if(!t)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:t}}if(!this._data.updateable)return;let i=function(t,r,i){let n=[];if(r.removeAll)t.clear();else if(r.remove)for(let i of r.remove){let r=t.get(i);r&&(n.push(r.geometry),t.delete(i))}if(r.add)for(let a of r.add){let r=pg(a,i);if(null==r)continue;let o=t.get(r);o&&n.push(o.geometry),n.push(a.geometry),t.set(r,a)}if(r.update)for(let i of r.update){let r=t.get(i.id);if(!r)continue;let a=!!i.newGeometry,o=i.removeAllProperties||i.removeProperties?.length>0||i.addOrUpdateProperties?.length>0;if(!a&&!o)continue;n.push(r.geometry);let s={...r};if(t.set(i.id,s),a&&(n.push(i.newGeometry),s.geometry=i.newGeometry),o){if(s.properties=i.removeAllProperties?{}:{...s.properties||{}},i.removeProperties)for(let t of i.removeProperties)delete s.properties[t];
57if(i.addOrUpdateProperties)for(let{key:t,value:r}of i.addOrUpdateProperties)s.properties[t]=r}}return n}(this._data.updateable,t,r);if(!(t.removeAll||this._options.cluster))return i}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map(t=>p_(t))}}shouldReloadTile(t,{affectedBounds:r}){if("loading"===t.state)return!0;if("unloaded"===t.state)return!1;let{buffer:i,extent:n}=this.workerOptions.geojsonVtOptions,a=function({x:t,y:r,z:i},n=0){return new ph([uh((t-n)/2**i),uf((r+1+n)/2**i)],[uh((t+1+n)/2**i),uf((r-n)/2**i)])}(t.tileID.canonical,i/n);for(let t of r)if(a.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(t){let r=t.actor?"RT":"LT";t.actor=await this.actorPromise;let i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;try{let n=await (await this.actorPromise).sendAsync({type:r,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(n,this.map.painter,"RT"===r)}catch(r){if(delete t.abortController,t.aborted||tZ(r))return;throw r}}async abortTile(t){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}async unloadTile(t){t.unloadVectorData(),await (await this.actorPromise).sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
57ype,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(t=>t.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return tb({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};let px=[0,0,1],pw=(t,r,i,n,a,o)=>{var s,l,u;let c,h;return{u_tl_parent:t,u_scale_parent:r,u_buffer_scale:1,u_image_warp:o,u_fade_t:i.mix,u_opacity:i.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(s=n.paint.get("raster-saturation"))>0?1-1/(1.001-s):-s,u_contrast_factor:(l=n.paint.get("raster-contrast"))>0?1/(1-l):1+l,u_spin_weights:(c=Math.sin(u=n.paint.get("raster-hue-rotate")*(Math.PI/180)),[(2*(h=Math.cos(u))+1)/3,(-Math.sqrt(3)*c-h+1)/3,(Math.sqrt(3)*c-h+1)/3]),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y]}};var pE=class{constructor(t,r,i){this.vertexBuffer=t,this.indexBuffer=r,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};let pT=ou([{name:"a_pos",type:"Int16",components:2}]);function pA(t,r){let i=function(t,r){let i=void 0===t.granularity?1:Math.max(t.granularity,1),n=i+2*!!t.generateBorders,a=i+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),o=n+1,s=a+1,l=t.generateBorders?-1:0,u=t.generateBorders||t.extendToNorthPole?-1:0,c=i+ +!!t.generateBorders,h=i+(t.generateBorders||t.extendToSouthPole?1:0),f=n*a*6,d=o*s>65536;if(d&&"16bit"===r)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let p=d||"32bit"===r,m=new Int16Array(o*s*2),g=0;for(let r=u;r<=h;r++)for(let n=l;n<=c;n++){let a=n/i*8192;-1===n&&(a=-64),n===i+1&&(a=8256);let o=r/i*8192;-1===r&&(o=t.extendToNorthPole?-32768:-64),r===i+1&&(o=t.extendToSouthPole?32767:8256),m[g++]=a,m[g++]=o}let y=p?new Uint32Array(f):new Uint16Array(f),v=0;for(let t=0;t<a;t++)for(let r=0;r<n;r++){let i=r+t*o,n=r+1+t*o,a=r+(t+1)*o,s=r+1+(t+1)*o;y[v++]=i,y[v++]=a,y[v++]=n,y[v++]=n,y[v++]=a,y[v++]=s}return{vertices:m.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:p}}(r,"16bit"),n=oW.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),a=se.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new pE(t.createVertexBuffer(n,pT.members),t.createIndexBuffer(a),sa.simpleSegment(0,0,n.length,a.length))}var pS=class extends re{constructor(t,r,i,n){super(),this.imageWarp=px,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=t,this.dispatcher=i,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=r}async load(t){if(void 0===this.options.url){this._loaded=!0,this._finishLoading();return}this._loaded=!1,this.fire(new dM("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let r=await S.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,r?.data?(this._setImage(r.data),t&&(this.coordinates=t),this._finishLoading()):this.fire(new t9(Error(`Could not load image ${this.url}: the response is empty`)))}catch(t){if(tZ(t))return;this._abortController=null,this._loaded=!0,this.fire(new t9(ti(t)))}}loaded(){return this._loaded}updateImage(t){return this._abortController&&=(this._abortController.abort(),null),"image"in t?(this._loaded=!0,this._setImage(t.image),t.coordinates&&(this.coordinates=t.coordinates),this._finishLoading()):t.url&&(this.options.url=t.url,this.load(t.coordinates)),this}_setImage(t){this.image=t,this._imageDirty=!0}getMesh(t,r){return!this._subdividedQuad||r?null:(this._subdividedMesh??=pA(t,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new dM("data",{sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(t){return this._warp===t||(this._warp=t,this.tileCoords&&this.setCoordinates(this.coordinates)),this}getWarp(){return this._warp}setCoordinates(t){var r,i;let n,a,o,s,l,u;this.coordinates=t;let c=t.map(ud.fromLngLat);return this.tileID=(r=c,a=Math.max(0,Math.floor(-Math.log(Math.max((n=l7.fromPoints(r)).width(),n.height()))/Math.LN2)),o=2**a,new hs(a,Math.floor((n.minX+n.maxX)/2*o),Math.floor((n.minY+n.maxY)/2*o))),this.terrainTileRanges=this._getOverlappingTileRanges(c),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=c.map(t=>
57this.tileID.getTilePoint(t)._round()),this.imageWarp=function(t,r){if("flat"===r||pC(t))return px;let[i,n,a,o]=t,s=i.x-n.x+a.x-o.x,l=i.y-n.y+a.y-o.y,u=[n.x-a.x,n.y-a.y,o.x-a.x,o.y-a.y],[c,h,f,d]=u,p=u[0]*u[3]-u[2]*u[1],m=(s*d-f*l)/p,g=(c*l-s*h)/p,y=[1,1+m,1+m+g,1+g],v=Math.max(...y)/Math.min(...y),_="perspective"===r?0:Math.max(0,(1-4/v)/(1-4/512));return!(v>=1&&v<=512)||_>=1?px:[m,g,_]}(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!pC(this.tileCoords),this.flippedWindingOrder=(s=(i=this.tileCoords)[1].x-i[0].x,l=i[1].y-i[0].y,u=i[2].x-i[0].x,s*(i[2].y-i[0].y)-l*u<0),this.fire(new dM("data",{sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let t=this.map.painter.context,r=t.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)):(this.texture=new lh(t,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._imageDirty=!1;let i=!1;for(let t in this.tiles){let r=this.tiles[t];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture,i=!0)}i&&this.fire(new dM("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(t){this.tileID?.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}serialize(){let t={type:"image",coordinates:this.coordinates};return void 0!==this.options.url&&(t.url=this.options.url),t}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:r,minY:i,maxX:n,maxY:a}=l7.fromPoints(t),o={};for(let t=0;t<=25;t++){let s=2**t,l=Math.floor(r*s),u=Math.floor(i*s),c=Math.floor(n*s),h=Math.floor(a*s),f=(l%s+s)%s,d=c%s,p=Math.floor(l/s),m=Math.floor(c/s);o[t]={minWrap:p,maxWrap:m,minTileXWrapped:f,maxTileXWrapped:d,minTileY:u,maxTileY:h}}return o}};function pC(t){let[r,i,n,a]=t;return r.x+n.x===i.x+a.x&&r.y+n.y===i.y+a.y}var pM=class extends pS{constructor(t,r,i,n){super(t,r,i,n),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=r}async load(){this._loaded=!1;let t=this.options;for(let r of(this.urls=[],t.urls))this.urls.push((await this.map._requestManager.transformRequest(r,"Source")).url);try{var r;let t,i=await (r=this.urls,(t=window.document.createElement("video")).muted=!0,new Promise(i=>{for(let n of(t.onloadstart=()=>{i(t)},r)){let r=window.document.createElement("source");t6(n)||(t.crossOrigin="Anonymous"),r.src=n,t.appendChild(r)}}));if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new t9(ti(t)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let r=this.video.seekable;t<r.start(0)||t>r.end(0)?this.fire(new t9(new ri(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let t=this.map.painter.context,r=t.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new lh(t,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let t in this.tiles){let r=this.tiles[t];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture,i=!0)}i&&this.fire(new dM("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},pD=class extends pS{constructor(t,r,i,n){super(t,r,i,n),r.coordinates?(!Array.isArray(r.coordinates)||4!==r.coordinates.length||r.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t)))&&this.fire(new t9(new ri(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t9(new ri(`sources.${t}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new t9(new ri(`sources.${t}
57`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new t9(new ri(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t9(new ri(`sources.${t}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}async load(){(this._loaded=!0,this.canvas||=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions())?this.fire(new t9(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&=(this.prepare(),!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let r=this.map.painter.context,i=r.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new lh(r,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(let t in this.tiles){let r=this.tiles[t];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture,n=!0)}n&&this.fire(new dM("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}};let pP={},pI="RTLPluginLoaded";var pk=class extends re{constructor(...t){super(...t),this.status="unavailable",this.url=null,this.dispatcher=(P||(P=new ps(D||=new pa,tQ)).registerMessageHandler("GR",(t,r,i)=>t2(r,i)),P)}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,r=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=dp.resolveURL(t),!this.url)throw Error(`requested url ${t} is invalid`);if("unavailable"===this.status)if(!r)return this._requestImport();else this.status="deferred",this._syncState(this.status);else if("requested"===this.status)return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new t7(pI))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}};let pO=null;function pN(){return pO||=new pk}var pL=class{constructor(t,r){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=tw++,this.uses=0,this.tileSize=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||0!==this.fadingDirection||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:r,fadingParentID:i,fadeEndTime:n}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=r,this.fadingParentID=i,this.fadeEndTime=n}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=dg(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(t){return this.rttObjects[t]}acquireRTT(t,r,i){return this.rttObjects[r]=t.acquireRTT(i)}releaseRTT(t){if(0!==this.rttObjects.length){for(let r of this.rttObjects)r&&t.releaseRTT(r);this.rttObjects.length=0}}loadVectorData(t,r,i){if(t?.etagUnmodified===!0){this.state="loaded";return}if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!t){this.collisionBoxArray=new oR;return}for(let n in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,r){let i={};if(!r)return i;for(let n of t){let t=n.layerIds.map(t=>
57r.getLayer(t)).filter(Boolean);if(0!==t.length)for(let r of(n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(r=>t.filter(t=>t.id===r)[0])),t))i[r.id]=n}return i}(t.buckets,r?.style),this.hasSymbolBuckets=!1,this.buckets){let t=this.buckets[n];if(t instanceof c4)if(this.hasSymbolBuckets=!0,i)t.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let t in this.buckets){let r=this.buckets[t];if(r instanceof c4&&r.hasRTLText){this.hasRTLText=!0,pN().lazyLoad();break}}for(let t in this.queryPadding=0,this.buckets){let i=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(t).queryRadius(i))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let r in this.buckets){let i=this.buckets[r];i.uploadPending()&&i.upload(t)}let r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new lh(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new lh(t,this.glyphAtlasImage,r.ALPHA),null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,r,i,n,a,o,s,l,u,c,h){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:a,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:l,params:s,queryPadding:this.queryPadding*u,getElevation:h},t,r,i):{}}querySourceFeatures(t,r){let i=this.latestFeatureIndex;if(!i?.rawTileData)return;let n=i.loadVTLayers(),a=r?.sourceLayer?r.sourceLayer:"",o=n._geojsonTileLayer||n[a];if(!o)return;let s=n3(r?.filter,`querySourceFeatures[${a}].filter`,r?.globalState),{z:l,x:u,y:c}=this.tileID.canonical,h={z:l,x:u,y:c};for(let r=0;r<o.length;r++){let n=o.feature(r);if(s.needGeometry){let t=sz(n,!0);if(!s.filter(new aW(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!s.filter(new aW(this.tileID.overscaledZ),n))continue;let f=i.getId(n,a),d=new hg(n,l,u,c,f);d.tile=h,t.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let r=this.expirationTime;if(t.cacheControl){let r=function(t){let r={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,i,n,a)=>{let o=n||a;return r[i]=!o||o.toLowerCase(),""}),r["max-age"]){let t=parseInt(r["max-age"],10);isNaN(t)?delete r["max-age"]:r["max-age"]=t}return r}(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let t=Date.now(),i=!1;if(this.expirationTime>t)i=!1;else if(r)if(this.expirationTime<r)i=!0;else{let n=this.expirationTime-r;n?this.expirationTime=t+Math.max(n,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),0x80000000-1)}setFeatureState(t,r,i){if(!this.latestFeatureIndex?.rawTileData||0===Object.keys(t).length||this.featureStateRevision===i)return;this.featureStateRevision=i;let n=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!r.style.hasLayer(i))continue;let a=this.buckets[i],o=a.layers[0].sourceLayer||"_geojsonTileLayer",s=n[o],l=t[o];if(!s||!l||0===l.length)continue;a.update(l,s,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let u=r?.style?.getLayer(i);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(a)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<dg()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=dg()+t}
57setDependencies(t,r){let i={};for(let t of r)i[t]=!0;this.dependencies[t]=i}hasDependency(t,r){for(let i of t){let t=this.dependencies[i];if(t){for(let i of r)if(t[i])return!0}}return!1}};function pR(t){let r=[];for(let i in t)r.push({id:i,state:t[i]});return r}var pF=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,r,i){let n=String(r);if(this.stateChanges[t]||={},this.stateChanges[t][n]||={},tb(this.stateChanges[t][n],i),null===this.deletedStates[t])for(let r in this.deletedStates[t]={},this.state[t])if(r===n)for(let a in this.deletedStates[t][n]={},this.state[t][r])void 0===i[a]&&(this.deletedStates[t][n][a]=null);else this.deletedStates[t][r]=null;else if(this.deletedStates[t]?.[n]===null)for(let r in this.deletedStates[t][n]={},this.state[t][n])void 0===i[r]&&(this.deletedStates[t][n][r]=null);else for(let r in i)this.deletedStates[t]?.[n]?.[r]===null&&delete this.deletedStates[t][n][r]}removeFeatureState(t,r,i){if(null===this.deletedStates[t])return;let n=String(r);if(this.deletedStates[t]||={},i&&void 0!==r)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]||={},this.deletedStates[t][n][i]=null);else if(void 0!==r)if(this.stateChanges[t]?.[n])for(i in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][i]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(t,r){let i=String(r),n=this.state[t]||{},a=this.stateChanges[t]||{},o=tb({},n[i],a[i]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){let i=this.deletedStates[t][r];if(null===i)return{};for(let t in i)delete o[t]}return o}initializeTileState(t,r){let i={};for(let t in this.state)i[t]=pR(this.state[t]);t.setFeatureState(i,r,this.revision)}coalesceChanges(t,r){let i={};for(let t in this.stateChanges)for(let r in this.state[t]||={},i[t]||={},this.stateChanges[t])this.state[t][r]||={},tb(this.state[t][r],this.stateChanges[t][r]),i[t][r]=this.state[t][r];for(let t in this.deletedStates)if(this.state[t]||={},i[t]||={},null===this.deletedStates[t])for(let r in this.state[t])this.state[t][r]={},i[t][r]={};else for(let r in this.deletedStates[t]){if(null===this.deletedStates[t][r])this.state[t][r]={};else for(let i of Object.keys(this.deletedStates[t][r]))delete this.state[t][r][i];i[t][r]=this.state[t][r]}if(this.stateChanges={},this.deletedStates={},0===Object.keys(i).length)return;this.revision++;let n={};for(let t in i)n[t]=pR(i[t]);t.setFeatureState(n,r,this.revision)}},pB=class t{constructor(t,r){this.min=t,this.max=r,this.center=eW([],eq([],this.min,this.max),.5)}quadrant(r){let i=[r%2==0,r<2],n=eV(this.min),a=eV(this.max);for(let t=0;t<i.length;t++)n[t]=i[t]?this.min[t]:this.center[t],a[t]=i[t]?this.center[t]:this.max[t];return a[2]=this.max[2],new t(n,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let r=!0;for(let i of t.planes){let t=this.intersectsPlane(i);if(0===t)return 0;1===t&&(r=!1)}return r?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let r=t[3],i=t[3];for(let n=0;n<3;n++)t[n]>0?(r+=t[n]*this.min[n],i+=t[n]*this.max[n]):(i+=t[n]*this.min[n],r+=t[n]*this.max[n]);return r>=0?2:i<0?0:1}},pz=class t{constructor(t,r,i){this.points=t,this.planes=r,this.aabb=i}static fromInvProjectionMatrix(r,i=1,n=0,a,o){let s=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=2**n,u=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(t=>(function(t,r,i,n){var a;let o=e2([],t,r),s=1/o[3]/i*n;return a=[s,s,1/o[3],s],o[0]=o[0]*a[0],o[1]=o[1]*a[1],o[2]=o[2]*a[2],o[3]=o[3]*a[3],o})(t,r,i,l));a&&function(t,r,i,n){var a,o;let s,l,u,c=4*!!n,h=4*!n,f=0,d=[],p=[];for(let r=0;r<4;r++){let i=eH([],t[r+h],t[r+c]),n=e$(i);eW(i,i,1/n),d.push(n),p.push(i)}for(let r=0;r<4;r++){let n=function(t,r,i){let n=t[0]*i[0]+t[1]*i[1]+t[2]*i[2],a=r[0]*i[0]+r[1]*i[1]+r[2]*i[2];return 0===a?null:(-n-i[3])/a}(t[r+c],p[r],i);f=null!==n&&n>=0?Math.max(f,n):Math.max(f,d[r])}let m=(s=eH([],(a=t)[(o=r)[0]],a[o[1]]),l=eH([],a[o[2]],a[o[1]]),eY(u=[0,0,0,0],eK([],s,l)),u[3]=-eX(u,a[o[0]]),u),g=function(t,r){var i,n;let a=e$(t),o=(i=[],n=1/a,i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*n,i[3]=t[3]*n,i),s=eH([],r,eW([],o,eX(r,o))),l=e$(s);if(l>0){let t=Math.sqrt(1-o[3]*o[3]);return tc(r,eq([],eW([],o,-o[3]),eW([],s,t/l)))}return null}(i,m);null!==g&&(f=Math.min(f,g/eX(p[0],m)));for(let r=0;r<4;r++){let i=Math.min(f,d[r]);t[r+h]=[t[r+c][0]+p[r][0]*i,t[r+c][1]+p[r][1]*i,t[r+c][2]+p[r][2]*i,1]}}(u,s[0],a,o);let c=s.map(t=>{let r=eY([],eK([],eH([],u[t[0]],u[t[1]]),eH([],u[t[2]],u[t[1]]))),i=-eX(r,u[t[1]]);return r.concat(i)}),h=[1/0,1/0,1/0],f=[-1/0,-1/0,-1/0];for(let t of u)for(let r=0;r<3;r++)h[r]=Math.min(h[r],t[r]),f[r]=Math.max(f[r],t[r]);return new t(u,c,new pB(h,f))}};function pj(t,r,i){let n=0,a=(i-r)/10;for(let o=0;o<10;o++){let s=r+(o+.5)/10*(i-r);n+=a*Math.cos(s)**t}return n}function pU(t,r){return function(i,n,a,o,s){let l=2*((t-1)/tT(Math.cos(tz(89.25-s))/Math.cos(tz(89.25)))-1),u=Math.acos(a/o),c=2*pj(l-1,0,tz(s/2)),h=Math.min(tz(89.25),u+tz(s/2)),f=pj(l-1,Math.min(h,u-tz(s/2)),h),d=Math.atan(n/a),p=i;return p+=tT(o/Math.hypot(n,a)/Math.max(.5,Math.cos(tz(s/2)))),p+=l*tT(Math.cos(d))/2,p-=tT(Math.max(1,f/c/r))/2}}let pV=pU(9.314,3);function p$(t,r){return Math.max(0,(r.roundZoom?Math.round:Math.floor)(t.zoom+tT(t.tileSize/r.tileSize)))}function pG(t,r){var i,n;let a,o,s,l=t.getCameraFrustum(),u=t.getClippingPlane();u&&r.maxContentElevation>0&&({frustum:l,plane:u}=function(t,r,i,n){let a=Math.hypot(r[0],r[1],r[2]);if(0===a)return{frustum:t,plane:r};let o=1+n/6371008.8,s=Math.cos(Math.acos(tv(-r[3]/a,-1,1))+Math.acos(1/o));return{frustum:function(t,r,i){let n=t.planes[1],a=t.points.map(t=>{if(Math.abs(n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3])>1e-6)return t;let a=[t[0]-i[0],t[1]-i[1],t[2]-i[2]],o=n[0]*a[0]+n[1]*a[1]+n[2]*a[2];if(o>=-1e-9)return t;let s=-(r/o);return[t[0]+a[0]*s,t[1]+a[1]*s,t[2]+a[2]*s,t[3]]}),o=t.planes.map((t,i)=>1===i?[t[0],t[1],t[2],t[3]+r]:t),s=[1/0,1/0,1/0],l=[-1/0,-1/0,-1/0];for(let t of a)for(let r=0;r<3;r++)s[r]=Math.min(s[r],t[r]),l[r]=Math.max(l[r],t[r]);return new pz(a,o,new pB(s,l))}(t,Math.sqrt(o*o-1),i),plane:[r[0],r[1],r[2],-s*a]}}(l,u,t.cameraPosition,r.maxContentElevation));let c=(a=1/ul((n=t).center.lat)*n.worldSize,u_(n.center,n.elevation,n.pitch,n.bearing,n.cameraToCenterDistance/a)),h=ud.fromLngLat(t.center,t.elevation),f=(i=r.maxContentElevation,o=tv((15-(89.25-t.pitch-t.fov/2))/15,0,1),s=Math.max(500,i??0),t.elevation+o*s),d=t.getCoveringTilesDetailsProvider(),p=d.allowVariableZoom(t,r),m=p$(t,r),g=r.minzoom||0,y=void 0===r.maxzoom?t.maxZoom:r.maxzoom,v=Math.min(Math.max(0,m),y),_=2**v,b=[_*c.x,_*c.y,0],x=[_*h.x,_*h.y,0],w=Math.hypot(h.x-c.x,h.y-c.y),E=Math.abs(h.z-c.z),T=Math.hypot(w,E),A=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),S=[],C=[];if(t.renderWorldCopies&&d.allowWorldCopies())for(let t=1;t<=3;t++)S.push(A(-t)),S.push(A(t));for(S.push(A(0));S.length>0;){let i=S.pop(),n=i.x,a=i.y,o=i.fullyVisible,s={x:n,y:a,z:i.zoom},_=d.getTileBoundingVolume(s,i.wrap,f,r);if(!o){let t=function(t,r,i){let n=r.intersectsFrustum(t);if(!i||0===n)return n;let a=r.intersectsPlane(i);return 0===a?0:2===n&&2===a?2:1}(l,_,u);if(0===t)continue;o=2===t}let w=d.distanceToTile2d(c.x,c.y,s,_),A=m;p&&(A=(r.calculateTileZoom||pV)(t.zoom+tT(t.tileSize/r.tileSize),w,E,T,t.fov));let M=Math.min(A=Math.max(0,A=(r.roundZoom?Math.round:Math.floor)(A)),y);if(i.wrap=d.getWrap(h,s,i.wrap),i.zoom>
57=M){if(i.zoom<g)continue;let t=v-i.zoom,o=b[0]-.5-(n<<t),s=b[1]-.5-(a<<t),l=r.reparseOverscaled?Math.max(i.zoom,A):i.zoom;C.push({tileID:new hu(i.zoom===y?l:i.zoom,i.wrap,i.zoom,n,a),distanceSq:tt([x[0]-.5-n,x[1]-.5-a]),tileDistanceToCamera:Math.sqrt(o*o+s*s)});continue}for(let t=0;t<4;t++){let r=(n<<1)+t%2,s=(a<<1)+(t>>1),l=i.zoom+1;S.push({zoom:l,x:r,y:s,wrap:i.wrap,fullyVisible:o})}}return C.sort((t,r)=>t.distanceSq-r.distanceSq).map(t=>t.tileID)}function pq(t){return"raster"===t||"image"===t||"video"===t}function pH(t,r,i,n,a,o,s){if(i[0].overscaledZ>=o)return!1;let l=!1;for(let o of i){let i=t.getLoadedTile(o);if(!i)continue;let{fadingRole:u,fadingDirection:c,fadingParentID:h}=i;0===u&&0===c&&h||(i.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:r.tileID,fadeEndTime:a+s}),r.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:a+s})),n[o.key]=o,l=!0}return l}function pW(t,r){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.needsColorReliefPrepare=!0;let i=r.tileID.canonical.x-t.tileID.canonical.x,n=r.tileID.canonical.y-t.tileID.canonical.y,a=2**t.tileID.canonical.z,o=r.tileID.key;(0!==i||0!==n)&&(Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+a)?i+=a:1===Math.abs(i-a)&&(i-=a)),r.dem&&t.dem&&(t.dem.backfillBorder(r.dem,i,n),t.neighboringTiles?.[o]&&(t.neighboringTiles[o].backfilled=!0))))}var pZ=class{constructor(){this._tiles={}}handleWrapJump(t){let r={};for(let i in this._tiles){let n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this._tiles=r}setFeatureState(t,r,i){for(let n in this._tiles)this._tiles[n].setFeatureState(t,r,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map(t=>t.tileID).sort(hd).map(t=>t.key):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,r){this._tiles[t]=r}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let r=this.getTileById(t.key);return r?.hasData()?r:null}isIdRenderable(t,r=!1){return this.getTileById(t)?.isRenderable(r)}getRenderableIds(t=0,r){let i=[];for(let t of this.getAllIds())this.isIdRenderable(t,r)&&i.push(this.getTileById(t));return r?i.sort((r,i)=>{let n=r.tileID,a=i.tileID,o=new eT(n.canonical.x,n.canonical.y)._rotate(-t),s=new eT(a.canonical.x,a.canonical.y)._rotate(-t);return n.overscaledZ-a.overscaledZ||s.y-o.y||s.x-o.x}).map(t=>t.tileID.key):i.map(t=>t.tileID).sort(hd).map(t=>t.key)}},pY=class t extends re{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(t,r,i){super(),this._maxContentElevationSeen=0,this.id=t,this.dispatcher=i,this.on("data",t=>{this._dataHandler(t)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((t,r,i,n)=>{let a=new((t=>{switch(t){case"geojson":return pb;case"image":return pS;case"raster":return pp;case"raster-dem":return pm;case"vector":return pd;case"video":return pM;case"canvas":return pD}return pP[t]})(r.type))(t,r,i,n);if(a.id!==t)throw Error(`Expected Source id to be ${t} instead of ${a.id}`);return a})(t,r,i,this),this._inViewTiles=new pZ,this._outOfViewCache=new dh(0,t=>this._unloadTile(t)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new pF,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(t)}onRemove(t){for(let t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(t),this._inViewTiles=new pZ}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((void 0!==this.used||void 0!==this.usedForTerrain)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,r,i,n){try{let a=await this._source.loadTile(t);this._tileLoaded(t,r,i,n,a)}catch(r){t.state="errored",404===r.status?this.update(this.transform,this.terrain):this._source.fire(new t9(ti(r),{tile:t}))}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new dM("dataabort",{tile:t,coord:t.tileID}))}serialize(){return this._source.serialize()}prepare(t){for(let r of(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null),this._inViewTiles.getAllTiles()))r.upload(t),r.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,t)}hasRenderableParent(t){let r=t.overscaledZ-1;if(r>=this._source.minzoom){let i=this.getLoadedTile(t.scaledTo(r));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(t,r){if(this._paused){this._shouldReloadOnResume=!0;return}for(let i of(this._outOfViewCache.reset(),this._inViewTiles.getAllIds())){let n=this._inViewTiles.getTileById(i);(!r||this._source.shouldReloadTile(n,r))&&(t?this._reloadTile(i,"errored"===n.state?"loading":"expired"):"errored"!==n.state&&this._reloadTile(i,"reloading"))}}async _reloadTile(t,r){let i=this._inViewTiles.getTileById(t);if(!i)return;let n=i.hasData();"loading"!==i.state&&(i.state=r),await this._loadTile(i,t,r,n)}_tileLoaded(t,r,i,n,a){n||(t.timeAdded=dg(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration)),"expired"===i&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),!a?.unmodified&&("raster-dem"===this.getSource().type&&t.dem&&function(t,r){for(let i of r.getRenderableIds()){if
57(!t.neighboringTiles?.[i])continue;let n=r.getTileById(i);t.neighboringTiles[i].backfilled||pW(t,n),n.neighboringTiles?.[t.tileID.key]?.backfilled||pW(n,t)}}(t,this._inViewTiles),t.featureStateRevision=-1,this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new dM("data",{tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(r,i){let n=this._getLoadedDescendents(i),a=new Set;for(let o of i){let i=n[o.key];if(!i?.length){a.add(o);continue}let s=o.overscaledZ+t.maxOverzooming,l=i.filter(t=>t.tileID.overscaledZ<=s);if(!l.length){a.add(o);continue}let u=Math.min(...l.map(t=>t.tileID.overscaledZ)),c=l.filter(t=>t.tileID.overscaledZ===u).map(t=>t.tileID);for(let t of c)r[t.key]=t;this._areDescendentsComplete(c,u,o.overscaledZ)||a.add(o)}return a}_getLoadedDescendents(t){let r={};for(let i of this._inViewTiles.getAllTiles().filter(t=>t.hasData()))for(let n of t)i.tileID.isChildOf(n)&&(r[n.key]||=[],r[n.key].push(i));return r}_areDescendentsComplete(t,r,i){return 1===t.length&&t[0].isOverscaled()?t[0].overscaledZ===r:4**(r-i)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let r=Math.floor((Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1)*(null===this._maxTileCacheZoomLevels?tX.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._outOfViewCache.setMaxSize(i)}handleWrapJump(t){let r=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);this._prevLng=t,r&&(this._inViewTiles.handleWrapJump(r),this._resetTileReloadTimers())}_updateMaxContentElevation(){let t=this._maxContentElevationSeen,r=this.map?.style?._layers;if(!r)return t;let i=this._inViewTiles.getAllTiles();for(let n in r){let a=r[n];if("symbol"!==a.type||a.source!==this.id||a.isHidden(this.transform.zoom)||!a.layout)continue;let o=a.layout.get("symbol-height-offset");if(t=Math.max(t,o.constantOr(0)),!o.isConstant())for(let r of i){let i=r.getBucket(a);i&&i.maxHeightOffset>t&&(t=i.maxHeightOffset)}}return this._maxContentElevationSeen=t,t}update(t,r){let i;if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=r,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new hu(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(i=pG(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?Math.max(this._source.maxzoom,t.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(i=i.filter(t=>this._source.hasTile(t)))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));let n=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new dM("data",{sourceDataType:"idle",sourceId:this.id}));let a=p$(t,this._source),o=this._updateRetainedTiles(i,a),s=pq(this._source.type);s&&this._rasterFadeDuration>0&&!r&&function(t,r,i,n,a,o,s){let l=dg(),u=function(t){if(!t.length)return new Set;let r=Math.max(...t.map(t=>t.canonical.z)),i=1/0,n=-1/0,a=1/0,o=-1/0,s=[];for(let l of t){let{x:t,y:u,z:c}=l.canonical,h=2**(r-c),f=t*h,d=u*h;s.push({id:l,x:f,y:d}),f<i&&(i=f),f>n&&(n=f),d<a&&(a=d),d>o&&(o=d)}let l=new Set;for(let t of s)(t.x===i||t.x===n||t.y===a||t.y===o)&&l.add(t.id);return l}(r);for(let c of r){let r=t.getTileById(c.key);(0===r.fadingDirection||0===r.fadeOpacity)&&r.resetFadeLogic(),!function(t,r,i,n,a,o,s){if(!r.hasData())return!1;let{tileID:l,fadingRole:u,fadingDirection:c,fadingParentID:h}=r;if(0===u&&1===c&&h)return i[h.key]=h,!0;let f=Math.max(l.overscaledZ-a,o);for(let a=l.overscaledZ-1;a>=f;a--){let o=l.scaledTo(a),u=t.getLoadedTile(o);if(u)return r.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:u.tileID,fadeEndTime:n+s}),u.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:n+s}),i[o.key]=o,!0}return!1}(t,r,i,l,n,a,s)&&(function(t,r,i,n,a,o){if(!r.hasData())return!1;let s=r.tileID.children(a),l=pH(t,r,s,i,n,a,o);if(l)return!0;for(let u of s)pH(t,r,u.children(a),i,n,a,o)&&(l=!0);return l}(t,r,i,l,o,s)||function(t,r,i,n){let a=t.tileID;return!!t.selfFading||!t.hasData()&&!!r.has(a)&&(t.setSelfFadeLogic(i+n),!0)}(r,u,l,s)||r.resetFadeLogic())}}(this._inViewTiles,i,o,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(o):this._cleanUpVectorTiles(o)}
57_cleanUpRasterTiles(t){for(let r of this._inViewTiles.getAllIds())t[r]||this._removeTile(r)}_cleanUpVectorTiles(t){for(let r of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(r);if(t[r]){i.clearSymbolFadeHold();continue}if(!i.hasSymbolBuckets){this._removeTile(r);continue}i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(r):i.setSymbolHoldDuration(this.map._fadeDuration)}}_addTerrainIdealTiles(t){let r=[];for(let i of t)if(i.canonical.z>this._source.minzoom){let t=i.scaledTo(i.canonical.z-1);r.push(t);let n=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));r.push(n)}return t.concat(r)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(r,i){let n=new Set;for(let t of r)this._addTile(t).hasData()||n.add(t);let a=r.reduce((t,r)=>(t[r.key]=r,t),{}),o=this._retainLoadedChildren(a,n),s={},l=Math.max(i-t.maxUnderzooming,this._source.minzoom);for(let t of o){let r=this._inViewTiles.getTileById(t.key),i=r?.wasRequested();for(let n=t.overscaledZ-1;n>=l;--n){let o=t.scaledTo(n);if(s[o.key])break;if(s[o.key]=!0,(r=this.getTile(o))||!i||(r=this._addTile(o)),r){let t=r.hasData();if((t||!this.map?.cancelPendingTileRequestsWhileZooming||i)&&(a[o.key]=o),i=r.wasRequested(),t)break}}}return a}_addTile(t){let r=this._inViewTiles.getTileById(t.key);if(r)return r;(r=this._outOfViewCache.getAndRemove(t))&&(r.resetFadeLogic(),this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null));let i=r;return r||(r=new pL(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(r,t.key,r.state,!1)),r.uses++,this._inViewTiles.setTile(t.key,r),i||this._source.fire(new dM("dataloading",{tile:r,coord:r.tileID})),r}_setTileReloadTimer(t,r){this._clearTileReloadTimer(t);let i=r.getExpiryTimeout();if(i){let r=()=>{this._reloadTile(t,"expired"),delete this._timers[t]};this._timers[t]=setTimeout(r,i)}}_clearTileReloadTimer(t){let r=this._timers[t];r&&(clearTimeout(r),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,r)}}refreshTiles(t){for(let r of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(r);(this._inViewTiles.isIdRenderable(r)||"errored"==i.state)&&t.some(t=>t.equals(i.tileID.canonical))&&this._reloadTile(r,"expired")}}_removeTile(t){let r=this._inViewTiles.getTileById(t);r&&(r.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),r.uses>0||(r.hasData()&&"reloading"!==r.state?this._outOfViewCache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}_dataHandler(t){if("source"===t.dataType){if("metadata"===t.sourceDataType){this._sourceLoaded=!0;return}"content"===t.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){for(let t of(this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation(),this._inViewTiles.getAllIds()))this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,r,i){let n=[],a=this.transform;if(!a)return n;let o=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?a.getCameraQueryGeometry(t):t,l=t=>a.screenPointToMercatorCoordinate(t,this.terrain),u=this.transformBbox(t,l,!o),c=this.transformBbox(s,l,!o),h=this.getIds(),f=l7.fromPoints(c);for(let t of h){let i=this._inViewTiles.getTileById(t);if(i.holdingForSymbolFade())continue;let s=o?[i.tileID]:[i.tileID.unwrapTo(-1),i.tileID.unwrapTo(0)],l=2**(a.zoom-i.tileID.overscaledZ),h=r*i.queryPadding*8192/i.tileSize/l;for(let t of s){let r=f.map(r=>t.getTilePoint(new ud(r.x,r.y)));if(r.expandBy(h),r.intersects(l9)){let r=u.map(r=>t.getTilePoint(r)),a=c.map(r=>t.getTilePoint(r));n.push({tile:i,tileID:o?t:t.unwrapTo(0),queryGeometry:r,cameraQueryGeometry:a,scale:l})}}}return n}transformBbox(t,r,i){let n=t.map(r);if(i){let i=l7.fromPoints(t);i.shrinkBy(.001*Math.min(i.width(),i.height()));let a=i.map(r);l7.fromPoints(n).covers(a)||(n=n.map(t=>t.x>.5?new ud(t.x-1,t.y,t.z):t))}return n}getVisibleCoordinates(t){let r=this.getRenderableIds(t).map(t=>this._inViewTiles.getTileById(t).tileID);return this.transform&&this.transform.populateCache(r),r}hasTransition(){return!!this._source.hasTransition()||pq(this._source.type)&&function(t,r){if(r<=0)return!1;let i=dg();for(let r of t.getAllTiles())if(r.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,r,i){t||=hp,this._state.updateState(t,r,i)}removeFeatureState(t,r,i){t||=hp,this._state.removeFeatureState(t,r,i)}getFeatureState(t,r){return t||=hp,this._state.getState(t,r)}
vendor: 4,309 bytes, line 57
57setDependencies(t,r,i){let n=this._inViewTiles.getTileById(t);n&&n.setDependencies(r,i)}reloadTilesForDependencies(t,r){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(t,r)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter(i=>!i.hasDependency(t,r))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}},pX=class{constructor(t,r){this.reset(t,r)}reset(t,r){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(r||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=tv(t,0,1);let r=1,i=this._distances[r],n=t*this.paddedLength+this.padding;for(;i<n&&r<this._distances.length;)i=this._distances[++r];let a=r-1,o=this._distances[a],s=i-o,l=s>0?(n-o)/s:0;return this.points[a].mult(1-l).add(this.points[r].mult(l))}};function pK(t,r,i,n,a){return a?t?t(r,i)+n:0===n?void 0:n:n}function pQ(t,r){let i=!0;return"always"===t||("never"===t||"never"===r)&&(i=!1),i}var pJ=class{constructor(t,r,i){let n=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(r/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)n.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=r,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/r,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,r,i,n,a){this._forEachCell(r,i,n,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)}insertCircle(t,r,i,n){this._forEachCell(r-n,i-n,r+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(r),this.circles.push(i),this.circles.push(n)}_insertBoxCell(t,r,i,n,a,o){this.boxCells[a].push(o)}_insertCircleCell(t,r,i,n,a,o){this.circleCells[a].push(o)}_query(t,r,i,n,a,o,s){if(i<0||t>this.width||n<0||r>this.height)return[];let l=[];if(t<=0&&r<=0&&this.width<=i&&this.height<=n){if(a)return[{key:null,x1:t,y1:r,x2:i,y2:n}];for(let t=0;t<this.boxKeys.length;t++)l.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){let r=this.circles[3*t],i=this.circles[3*t+1],n=this.circles[3*t+2];l.push({key:this.circleKeys[t],x1:r-n,y1:i-n,x2:r+n,y2:i+n})}}else this._forEachCell(t,r,i,n,this._queryCell,l,{hitTest:a,overlapMode:o,seenUids:{box:{},circle:{}}},s);return l}query(t,r,i,n){return this._query(t,r,i,n,!1,null)}hitTest(t,r,i,n,a,o){return this._query(t,r,i,n,!0,a,o).length>0}hitTestCircle(t,r,i,n,a){let o=t-i,s=t+i,l=r-i,u=r+i;if(s<0||o>this.width||u<0||l>this.height)return!1;let c=[];return this._forEachCell(o,l,s,u,this._queryCellCircle,c,{hitTest:!0,overlapMode:n,circle:{x:t,y:r,radius:i},seenUids:{box:{},circle:{}}},a),c.length>0}_queryCell(t,r,i,n,a,o,s,l){let{seenUids:u,hitTest:c,overlapMode:h}=s,f=this.boxCells[a];if(null!==f){let a=this.bboxes;for(let s of f)if(!u.box[s]){u.box[s]=!0;let f=4*s,d=this.boxKeys[s];if(t<=a[f+2]+1e-6&&r<=a[f+3]+1e-6&&i>=a[f+0]-1e-6&&n>=a[f+1]-1e-6&&(!l||l(d))&&(!c||!pQ(h,d.overlapMode))&&(o.push({key:d,x1:a[f],y1:a[f+1],x2:a[f+2],y2:a[f+3]}),c))return!0}}let d=this.circleCells[a];if(null!==d){let a=this.circles;for(let s of d)if(!u.circle[s]){u.circle[s]=!0;let f=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(a[f],a[f+1],a[f+2],t,r,i,n)&&(!l||l(d))&&(!c||!pQ(h,d.overlapMode))){let t=a[f],r=a[f+1],i=a[f+2];if(o.push({key:d,x1:t-i,y1:r-i,x2:t+i,y2:r+i}),c)return!0}}}return!1}_queryCellCircle(t,r,i,n,a,o,s,l){let{circle:u,seenUids:c,overlapMode:h}=s,f=this.boxCells[a];if(null!==f){let t=this.bboxes;for(let r of f)if(!c.box[r]){c.box[r]=!0;let i=4*r,n=this.boxKeys[r];if(this._circleAndRectCollide(u.x,u.y,u.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!l||l(n))&&!pQ(h,n.overlapMode))return o.push(!0),!0}}let d=this.circleCells[a];if(null!==d){let t=this.circles;for(let r of d)if(!c.circle[r]){c.circle[r]=!0;let i=3*r,n=this.circleKeys[r];
57if(this._circlesCollide(t[i],t[i+1],t[i+2],u.x,u.y,u.radius)&&(!l||l(n))&&!pQ(h,n.overlapMode))return o.push(!0),!0}}}_forEachCell(t,r,i,n,a,o,s,l){let u=this._convertToXCellCoord(t),c=this._convertToYCellCoord(r),h=this._convertToXCellCoord(i),f=this._convertToYCellCoord(n);for(let d=u;d<=h;d++)for(let u=c;u<=f;u++){let c=this.xCellCount*u+d;if(a.call(this,t,r,i,n,c,o,s,l))return}}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,r,i,n,a,o){let s=n-t,l=a-r,u=i+o;return u*u>s*s+l*l}_circleAndRectCollide(t,r,i,n,a,o,s){let l=(o-n)/2,u=Math.abs(t-(n+l));if(u>l+i)return!1;let c=(s-a)/2,h=Math.abs(r-(a+c));if(h>c+i)return!1;if(u<=l||h<=c)return!0;let f=u-l,d=h-c;return f*f+d*d<=i*i}};let p0=eD();function p1(t,r,i){let n=eD();if(!t){var a,o,s,l,u;let{vecSouth:t,vecEast:i}=p2(r),c=dd();c[0]=i[0],c[1]=i[1],c[2]=t[0],c[3]=t[1],a=c[0],o=c[1],s=c[2],(u=a*(l=c[3])-s*o)&&(u=1/u,c[0]=l*u,c[1]=-o*u,c[2]=-s*u,c[3]=a*u),n[0]=c[0],n[1]=c[1],n[4]=c[2],n[5]=c[3]}return eL(n,n,[1/i,1/i,1]),n}function p2(t){let r=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),a=Math.cos(t.bearingInRadians),o=Math.sin(t.bearingInRadians),s=e5();s[0]=-a*n*i-o*r,s[1]=-o*n*i+a*r;let l=e9(s);l<1e-9?te(s):e7(s,s,1/l);let u=e5();u[0]=a*n*r-o*i,u[1]=o*n*r+a*i;let c=e9(u);return c<1e-9?te(u):e7(u,u,1/c),{vecEast:u,vecSouth:s}}function p3(t,r,i){return pK(t.getElevation,r,i,t.heightOffset??0,t.heightAnchorGround??!0)}function p4(t,r,i,n){let a;null==n?ms(a=[t,r,0,1],a,i):e2(a=[t,r,n,1],a,i);let o=a[3];return{point:new eT(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function p6(t,r,i,n,a,o,s,l){let u=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,h=o.lineStartIndex+o.lineLength,f=r.getoffsetX(o.glyphStartIndex),d=r.getoffsetX(u-1),p=mn(t*f,i,n,a,o.segment,c,h,l,s);if(!p)return null;let m=mn(t*d,i,n,a,o.segment,c,h,l,s);return!m||l.projectionCache.anyProjectionOccluded?null:{first:p,last:m}}function p5(t,r,i,n){return 1===t&&Math.abs(i.y-r.y)>Math.abs(i.x-r.x)*n?{useVertical:!0}:(2===t?r.y<i.y:r.x>i.x)?{needsFlipping:!0}:null}function p8(t){let{projectionContext:r,pitchedLabelPlaneMatrixInverse:i,symbol:n,fontSize:a,flip:o,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:u,aspectRatio:c,rotateToLine:h}=t,f=a/24,d=n.lineOffsetX*f,p=n.lineOffsetY*f,m;if(n.numGlyphs>1){let t=n.glyphStartIndex+n.numGlyphs,a=n.lineStartIndex,u=n.lineStartIndex+n.lineLength,g=p6(f,l,d,p,o,n,h,r);if(!g)return{notEnoughRoom:!0};let y=mt(g.first.point.x,g.first.point.y,r,i),v=mt(g.last.point.x,g.last.point.y,r,i);if(s&&!o){let t=p5(n.writingMode,y,v,c);if(t)return t}m=[g.first];for(let i=n.glyphStartIndex+1;i<t-1;i++){let t=mn(f*l.getoffsetX(i),d,p,o,n.segment,a,u,r,h);if(!t)return{notEnoughRoom:!0};m.push(t)}m.push(g.last)}else{if(s&&!o){let t=me(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,a=n.lineStartIndex+n.segment+1,o=new eT(r.lineVertexArray.getx(a),r.lineVertexArray.gety(a)),s=me(o.x,o.y,r),l=s.signedDistanceFromCamera>0?s.point:p7(r.tileAnchorPoint,o,t,1,r),u=mt(t.x,t.y,r,i),h=mt(l.x,l.y,r,i),f=p5(n.writingMode,u,h,c);if(f)return f}let t=mn(f*l.getoffsetX(n.glyphStartIndex),d,p,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,h);if(!t||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[t]}for(let t of m)c1(u,t.point,t.angle);return{}}function p7(t,r,i,n,a){let o=t.add(t.sub(r)._unit()),s=me(o.x,o.y,a).point,l=i.sub(s);return i.add(l._mult(n/l.mag()))}function p9(t,r,i){let n=r.projectionCache;if(n.projections[t])return n.projections[t];let a=new eT(r.lineVertexArray.getx(t),r.lineVertexArray.gety(t)),o=me(a.x,a.y,r);if(o.signedDistanceFromCamera>0)return n.projections[t]=o.point,n.anyProjectionOccluded||=o.isOccluded,o.point;let s=t-i.direction,l=0===i.distanceFromAnchor?r.tileAnchorPoint:new eT(r.lineVertexArray.getx(s),r.lineVertexArray.gety(s)),u=i.absOffsetX-i.distanceFromAnchor+1;return p7(l,a,i.previousVertex,u,r)}function me(t,r,i){let n=t+i.translation[0],a=r+i.translation[1],o;
57return i.pitchWithMap?(o=p4(n,a,i.pitchedLabelPlaneMatrix,p3(i,n,a))).isOccluded=!1:((o=i.transform.projectTileCoordinates(n,a,i.unwrappedTileID,p3(i,n,a))).point.x=(.5*o.point.x+.5)*i.width,o.point.y=(-(.5*o.point.y)+.5)*i.height),o}function mt(t,r,i,n){if(i.pitchWithMap){let a=[t,r,0,1];e2(a,a,n);let o=a[0]/a[3],s=a[1]/a[3];return i.transform.projectTileCoordinates(o,s,i.unwrappedTileID,p3(i,o,s)).point}return{x:t/i.width*2-1,y:1-r/i.height*2}}function mr(t,r,i){return i.transform.projectTileCoordinates(t,r,i.unwrappedTileID,p3(i,t,r))}function mi(t,r,i){return t._unit()._perp()._mult(r*i)}function mn(t,r,i,n,a,o,s,l,u){let c=n?t-r:t+r,h=c>0?1:-1,f=0;n&&(h*=-1,f=Math.PI),h<0&&(f+=Math.PI);let d=h>0?o+a:o+a+1,p;l.projectionCache.cachedAnchorPoint?p=l.projectionCache.cachedAnchorPoint:(p=me(l.tileAnchorPoint.x,l.tileAnchorPoint.y,l).point,l.projectionCache.cachedAnchorPoint=p);let m=p,g=p,y,v,_=0,b=0,x=Math.abs(c),w=[],E;for(;_+b<=x;){if((d+=h)<o||d>=s)return null;_+=b,g=m,v=y;let t={absOffsetX:x,direction:h,distanceFromAnchor:_,previousVertex:g};if(m=p9(d,l,t),0===i)w.push(g),E=m.sub(g);else{let r,n=m.sub(g);r=0===n.mag()?mi(p9(d+h,l,t).sub(m),i,h):mi(n,i,h),v||=g.add(r),y=function(t,r,i,n,a,o,s,l,u){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];let c=i.add(r);if(t+u.direction<n||t+u.direction>=a)return l.projectionCache.offsets[t]=c,c;let h=p9(t+u.direction,l,u),f=mi(h.sub(i),s,u.direction),d=i.add(f),p=h.add(f);return l.projectionCache.offsets[t]=function(t,r,i,n){let a=r.y-t.y,o=r.x-t.x,s=n.y-i.y,l=n.x-i.x,u=s*o-l*a;if(0===u)return null;let c=(l*(t.y-i.y)-s*(t.x-i.x))/u;return new eT(t.x+c*o,t.y+c*a)}(o,c,d,p)||c,l.projectionCache.offsets[t]}(d,r,m,o,s,v,i,l,t),w.push(v),E=y.sub(v)}b=E.mag()}let T=(x-_)/b,A=E._mult(T)._add(v||g),S=f+Math.atan2(m.y-g.y,m.x-g.x);return w.push(A),{point:A,angle:u?S:0,path:w}}let ma=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function mo(t,r){for(let i=0;i<t;i++){let t=r.length;r.resize(t+4),r.float32.set(ma,3*t)}}function ms(t,r,i){let n=r[0],a=r[1];return t[0]=i[0]*n+i[4]*a+i[12],t[1]=i[1]*n+i[5]*a+i[13],t[3]=i[3]*n+i[7]*a+i[15],t}var ml=class{constructor(t,r=new pJ(t.width+200,t.height+200,25),i=new pJ(t.width+200,t.height+200,25)){this.transform=t,this.grid=r,this.ignoredGrid=i,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,r,i,n,a,o,s,l,u,c,h,f,d=0,p=!0){let m=t.anchorPointX+l[0],g=t.anchorPointY+l[1],y=this.projectAndGetPerspectiveRatio(m,g,a,pK(c,m,g,d,p),f),v=i*y.perspectiveRatio,_;if(o||s)_=this._projectCollisionBox(t,v,n,a,o,s,l,y,c,h,f,d,p);else{let r=y.x+(h?h.x*v:0),i=y.y+(h?h.y*v:0);_={allPointsOccluded:!1,box:[r+t.x1*v,i+t.y1*v,r+t.x2*v,i+t.y2*v]}}let[b,x,w,E]=_.box,T=o?_.allPointsOccluded:y.isOccluded,A=T;return A||=y.perspectiveRatio<this.perspectiveRatioCutoff,(A||=!this.isInsideGrid(b,x,w,E))||"always"!==r&&this.grid.hitTest(b,x,w,E,r,u)?{box:[b,x,w,E],placeable:!1,offscreen:!1,occluded:T}:{box:[b,x,w,E],placeable:!0,offscreen:this.isOffscreen(b,x,w,E),occluded:T}}placeCollisionCircles(t,r,i,n,a,o,s,l,u,c,h,f,d,p){let m=[],g=new eT(r.anchorX,r.anchorY),y=this.getPerspectiveRatio(g.x,g.y,o,p?.(g.x,g.y)),v=(u?a*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,o)/y:a*y)/24,_=r.lineOffsetX*v,b=r.lineOffsetY*v,x={getElevation:p,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:u,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:d},w=p6(v,n,_,b,!1,r,!1,x),E=!1,T=!1,A=!0;if(w){let r=.5*h*y+f,i=new eT(-100,-100),n=new eT(this.screenRightBoundary,this.screenBottomBoundary),a=new pX,o=w.first,s=w.last,d=[];for(let t=o.path.length-1;t>=1;t--)d.push(o.path[t]);for(let t=1;t<s.path.length;t++)d.push(s.path[t]);let p=2.5*r;if(u){let t=this.projectPathToScreenSpace(d,x);d=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let g=[];if(d.length>0){let t=d[0].clone(),r=d[0].clone();for(let i=1;i<d.length;i++)t.x=Math.min(t.x,d[i].x),t.y=Math.min(t.y,d[i].y),r.x=Math.max(r.x,d[i].x),r.y=Math.max(r.y,d[i].y);g=t.x>=i.x&&r.x<=n.x&&t.y>=i.y&&r.y<=n.y?[d]:r.x<i.x||t.x>n.x||r.y<i.y||t.y>n.y?[]:cF([d],i.x,i.y,n.x,n.y)}for(let i of g){a.reset(i,.25*r);let n=0;n=a.length<=.5*r?1:Math.ceil(a.paddedLength/p)+1;for(let i=0;i<n;i++){let o=i/Math.max(n-1,1),s=a.lerp(o),u=s.x+100,h=s.y+100;m.push(u,h,r,0);let f=u-r,d=h-r,p=u+r,g=h+r;if(A&&=this.isOffscreen(f,d,p,g),T||=this.isInsideGrid(f,d,p,g),"always"!==t&&this.grid.hitTestCircle(u,h,r,t,c)&&(E=!0,!l))return{circles:[],offscreen:!1,collisionDetected:E}}}}return{circles:!l&&E||!T||y<this.perspectiveRatioCutoff?[]:m,offscreen:A,collisionDetected:E}}projectPathToScreenSpace(t,r){var i;let n;return function(t){let r=0,i=0,n=0,a=0;for(let o=0;o<t.length;o++)t[o].isOccluded?(n=o+1,a=0):++a>i&&(i=a,r=n);return t.slice(r,r+i)}
57((n=1/((i=r.pitchedLabelPlaneMatrix)[0]*i[5]-i[1]*i[4]),p0[0]=i[5]*n,p0[1]=-i[1]*n,p0[2]=0,p0[3]=0,p0[4]=-i[4]*n,p0[5]=i[0]*n,p0[6]=0,p0[7]=0,p0[8]=0,p0[9]=0,p0[10]=1/i[10],p0[11]=0,p0[12]=0,p0[13]=0,p0[14]=0,p0[15]=1/i[15],t.map(t=>{let i=p4(t.x,t.y,p0,p3(r,t.x,t.y)),n=r.transform.projectTileCoordinates(i.point.x,i.point.y,r.unwrappedTileID,p3(r,i.point.x,i.point.y));return n.point.x=(.5*n.point.x+.5)*r.width,n.point.y=(-(.5*n.point.y)+.5)*r.height,n})))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let r=[],i=new l7;for(let n of t){let t=new eT(n.x+100,n.y+100);i.extend(t),r.push(t)}let{minX:n,minY:a,maxX:o,maxY:s}=i,l=this.grid.query(n,a,o,s).concat(this.ignoredGrid.query(n,a,o,s)),u={},c={};for(let t of l){let i=t.key;void 0===u[i.bucketInstanceId]&&(u[i.bucketInstanceId]={}),!u[i.bucketInstanceId][i.featureIndex]&&sU(r,[new eT(t.x1,t.y1),new eT(t.x2,t.y1),new eT(t.x2,t.y2),new eT(t.x1,t.y2)])&&(u[i.bucketInstanceId][i.featureIndex]=!0,void 0===c[i.bucketInstanceId]&&(c[i.bucketInstanceId]=[]),c[i.bucketInstanceId].push(i.featureIndex))}return c}insertCollisionBox(t,r,i,n,a,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:a,collisionGroupID:o,overlapMode:r},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,r,i,n,a,o){let s=i?this.ignoredGrid:this.grid,l={bucketInstanceId:n,featureIndex:a,collisionGroupID:o,overlapMode:r};for(let r=0;r<t.length;r+=4)s.insertCircle(l,t[r],t[r+1],t[r+2])}projectAndGetPerspectiveRatio(t,r,i,n,a){if(a){let i;null==n?ms(i=[t,r,0,1],i,a):e2(i=[t,r,n,1],i,a);let o=i[3];return{x:(i[0]/o+1)/2*this.transform.width+100,y:(-i[1]/o+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o),isOccluded:!1,signedDistanceFromCamera:o}}{let a=this.transform.projectTileCoordinates(t,r,i,n);return{x:(a.point.x+1)/2*this.transform.width+100,y:(-a.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera),isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(t,r,i,n){let a=this.transform.projectTileCoordinates(t,r,i,n);return .5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera)}isOffscreen(t,r,i,n){return i<100||t>=this.screenRightBoundary||n<100||r>this.screenBottomBoundary}isInsideGrid(t,r,i,n){return i>=0&&t<this.gridRightBoundary&&n>=0&&r<this.gridBottomBoundary}getViewportMatrix(){let t=eI([]);return eN(t,t,[-100,-100,0]),t}_projectCollisionBox(t,r,i,n,a,o,s,l,u,c,h,f=0,d=!0){let p=1,m=0,g=0,y=1,v=t.anchorPointX+s[0],_=t.anchorPointY+s[1];if(o&&!a){let t=this.projectAndGetPerspectiveRatio(v+1,_,n,pK(u,v+1,_,f,d),h),r=t.x-l.x,i=Math.atan((t.y-l.y)/r)+(r<0?Math.PI:0),a=Math.sin(i),o=Math.cos(i);p=o,m=a,g=-a,y=o}else if(!o&&a){let t=p2(this.transform);p=t.vecEast[0],m=t.vecEast[1],g=t.vecSouth[0],y=t.vecSouth[1]}let b=l.x,x=l.y,w=r;a&&(b=v,x=_,w=2**-(this.transform.zoom-i.overscaledZ)*this.transform.getPitchedTextCorrection(v,_,n),!c)&&(w*=tv(.5+.5*(l.signedDistanceFromCamera/this.transform.cameraToCenterDistance),0,4)),c&&(b+=p*c.x*w+g*c.y*w,x+=m*c.x*w+y*c.y*w);let E=t.x1*w,T=t.x2*w,A=(E+T)/2,S=t.y1*w,C=t.y2*w,M=(S+C)/2,D=[];for(let{offsetX:t,offsetY:r}of[{offsetX:E,offsetY:S},{offsetX:A,offsetY:S},{offsetX:T,offsetY:S},{offsetX:T,offsetY:M},{offsetX:T,offsetY:C},{offsetX:A,offsetY:C},{offsetX:E,offsetY:C},{offsetX:E,offsetY:M}])D.push(new eT(b+p*t+g*r,x+m*t+y*r));let P=!1;if(a){let t=D.map(t=>this.projectAndGetPerspectiveRatio(t.x,t.y,n,pK(u,t.x,t.y,f,d),h));P=t.some(t=>!t.isOccluded),D=t.map(t=>new eT(t.x,t.y))}else P=!0;return{box:function(t){let r=1/0,i=1/0,n=-1/0,a=-1/0;for(let o of t)r=Math.min(r,o.x),i=Math.min(i,o.y),n=Math.max(n,o.x),a=Math.max(a,o.y);return[r,i,n,a]}(D),allPointsOccluded:!P}}},mu=class{constructor(t,r,i,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?r:-r))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}},mc=class{constructor(t,r,i,n,a){this.text=new mu(t?t.text:null,r,i,a),this.icon=new mu(t?t.icon:null,r,n,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},mh=class{constructor(t,r,i){this.text=t,this.icon=r,this.skipFade=i}},mf=class{constructor(t,r,i,n,a){this.bucketInstanceId=t,this.featureIndex=r,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=a}},md=class{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let r=++this.maxGroupID;this.collisionGroups[t]={ID:r,predicate:t=>t.collisionGroupID===r}}return this.collisionGroups[t]}};function mp(t,r,i,n,a){let{horizontalAlign:o,verticalAlign:s}=cT(t);return new eT(-(o-.5)*r+n[0]*a,-(s-.5)*i+n[1]*a)}var mm=class{constructor(t,r,i,n,a){this.transform=t.clone(),this.terrain=r,this.collisionIndex=new ml(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new md(n),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let r=this.terrain;if(r)return(i,n)=>r.getElevation(t,i,n)}getBucketParts(t,r,i,n){let a=i.getBucket(r),o=i.latestFeatureIndex;if(!a||!o||r.id!==a.layerIds[0])return;let s=i.collisionBoxArray,l=a.layers[0].layout,u=a.layers[0].paint,c=2**(this.transform.zoom-i.tileID.overscaledZ
vendor: 4,441 bytes, line 57
57),h=i.tileSize/8192,f=i.tileID.toUnwrapped(),d="map"===l.get("text-rotation-alignment"),p=tr(i,1,this.transform.zoom),m=tu(this.collisionIndex.transform,i,u.get("text-translate"),u.get("text-translate-anchor")),g=tu(this.collisionIndex.transform,i,u.get("icon-translate"),u.get("icon-translate-anchor")),y=p1(d,this.transform,p);this.retainedQueryData[a.bucketInstanceId]=new mf(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,i.tileID);let v={bucket:a,layout:l,translationText:m,translationIcon:g,unwrappedTileID:f,pitchedLabelPlaneMatrix:y,scale:c,textPixelRatio:h,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:ck(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(n)for(let r of a.sortKeyRanges){let{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:a}=r;t.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:a,parameters:v})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:v})}attemptAnchorPlacement(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w){let E=cq[t.textAnchor],T=[t.textOffset0,t.textOffset1],A=mp(E,i,n,T,a),S=this.collisionIndex.placeCollisionBox(r,f,l,u,c,s,o,g,h.predicate,_,A,b,x,w);if((!v||this.collisionIndex.placeCollisionBox(v,f,l,u,c,s,o,y,h.predicate,_,A,b,x,w).placeable)&&S.placeable){let t;if(this.prevPlacement?.variableOffsets[d.crossTileID]&&this.prevPlacement?.placements[d.crossTileID]?.text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:T,width:i,height:n,anchor:E,textBoxScale:a,prevAnchor:t},this.markUsedJustification(p,E,d,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,d),this.placedOrientations[d.crossTileID]=m),{shift:A,placedGlyphBoxes:S}}}placeLayerBucketPart(t,r,i){let{bucket:n,layout:a,translationText:o,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:u,textPixelRatio:c,holdingForFade:h,collisionBoxArray:f,partiallyEvaluatedTextSize:d,collisionGroup:p}=t.parameters,m=a.get("text-optional"),g=a.get("icon-optional"),y=cQ(a,"text-overlap","text-allow-overlap"),v="always"===y,_=cQ(a,"icon-overlap","icon-allow-overlap"),b="always"===_,x="map"===a.get("text-rotation-alignment"),w="map"===a.get("text-pitch-alignment"),E="none"!==a.get("icon-text-fit"),T="viewport-y"===a.get("symbol-z-order"),A="ground"===a.get("symbol-height-anchor"),S=v&&(b||!n.hasIconData()||g),C=b&&(v||!n.hasTextData()||m);!n.collisionArrays&&f&&n.deserializeCollisionBoxes(f);let M=this.retainedQueryData[n.bucketInstanceId].tileID,D=this._getTerrainElevationFunc(M),P=this.transform.getFastPathSimpleProjectionMatrix(M),I=(t,f,b)=>{if(r[t.crossTileID])return;if(h){this.placements[t.crossTileID]=new mh(!1,!1,!1);return}let T=t.heightOffset,I=!1,k=!1,O=!0,N=null,L={box:null,placeable:!1,offscreen:null,occluded:!1},R={box:null,placeable:!1,offscreen:null},F=null,B=null,z=null,j=0,U=0,V=0;f.textFeatureIndex?j=f.textFeatureIndex:t.useRuntimeCollisionCircles&&(j=t.featureIndex),f.verticalTextFeatureIndex&&(U=f.verticalTextFeatureIndex);let $=f.textBox;if($){let r=r=>{let i=1;if(n.allowVerticalPlacement&&!r&&this.prevPlacement){let r=this.prevPlacement.placedOrientations[t.crossTileID];r&&(this.placedOrientations[t.crossTileID]=r,i=r,this.markUsedOrientation(n,i,t))}return i},a=(r,i)=>{if(n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&f.verticalTextBox){for(let t of n.writingModes)if(2===t?R=L=i():L=r(),L?.placeable)break}else L=r()},u=t.textAnchorOffsetStartIndex,h=t.textAnchorOffsetEndIndex;if(h===u){let i=(r,i)=>{let a=this.collisionIndex.placeCollisionBox(r,y,c,M,l,w,x,o,p.predicate,D,void 0,P,T,A);return a?.placeable&&(this.markUsedOrientation(n,i,t),this.placedOrientations[t.crossTileID]=i),a};a(()=>i($,1),()=>{let r=f.verticalTextBox;return n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&r?i(r,2):{box:null,offscreen:null}}),r(L?.placeable)}else{let d=cq[this.prevPlacement?.variableOffsets[t.crossTileID]?.anchor],m=(r,a,f)=>{let m=r.x2-r.x1,g=r.y2-r.y1,v=t.textBoxScale,b=E&&"never"===_?a:null,S=null,C="never"===y?1:2,k="never";d&&C++;for(let i=0;i<C;i++){for(let i=u;i<h;i++){let a=n.textAnchorOffsets.get(i);if(d&&a.textAnchor!==d)continue;let u=this.attemptAnchorPlacement(a,r,m,g,v,x,w,c,M,l,p,k,t,n,f,o,s,b,D,P,T,A);if(u&&(S=u.placedGlyphBoxes,S?.placeable))return I=!0,N=u.shift,
57S}d?d=null:k=y}return i&&!S&&(S={box:this.collisionIndex.placeCollisionBox($,"always",c,M,l,w,x,o,p.predicate,D,void 0,P,T,A).box,offscreen:!1,placeable:!1,occluded:!1}),S};a(()=>m($,f.iconBox,1),()=>{let r=f.verticalTextBox,i=L?.placeable;return n.allowVerticalPlacement&&!i&&t.numVerticalGlyphVertices>0&&r?m(r,f.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),L&&(I=L.placeable,O=L.offscreen);let g=r(L?.placeable);if(!I&&this.prevPlacement){let r=this.prevPlacement.variableOffsets[t.crossTileID];r&&(this.variableOffsets[t.crossTileID]=r,this.markUsedJustification(n,r.anchor,t,g))}}}if(F=L,I=F?.placeable,O=F?.offscreen,t.useRuntimeCollisionCircles&&t.centerJustifiedTextSymbolIndex>=0){let r=n.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),s=cI(n.textSizeData,d,r),c=a.get("text-padding"),h=t.collisionCircleDiameter;(B=this.collisionIndex.placeCollisionCircles(y,r,n.lineVertexArray,n.glyphOffsetArray,s,l,u,i,w,p.predicate,h,c,o,D)).circles.length&&B.collisionDetected&&!i&&tI("Collisions detected, but collision boxes are not shown"),I=v||B.circles.length>0&&!B.collisionDetected,O&&=B.offscreen}if(f.iconFeatureIndex&&(V=f.iconFeatureIndex),f.iconBox){let t=t=>this.collisionIndex.placeCollisionBox(t,_,c,M,l,w,x,s,p.predicate,D,E&&N?N:void 0,P,T,A);k=R&&R.placeable&&f.verticalIconBox?(z=t(f.verticalIconBox)).placeable:(z=t(f.iconBox)).placeable,O&&=z.offscreen}let G=m||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,q=g||0===t.numIconVertices;G||q?q?G||(k&&=I):I=k&&I:k=I=k&&I;let H=I&&F.placeable,W=k&&z.placeable;if(H&&(R&&R.placeable&&U?this.collisionIndex.insertCollisionBox(F.box,y,a.get("text-ignore-placement"),n.bucketInstanceId,U,p.ID):this.collisionIndex.insertCollisionBox(F.box,y,a.get("text-ignore-placement"),n.bucketInstanceId,j,p.ID)),W&&this.collisionIndex.insertCollisionBox(z.box,_,a.get("icon-ignore-placement"),n.bucketInstanceId,V,p.ID),B&&I&&this.collisionIndex.insertCollisionCircles(B.circles,y,a.get("text-ignore-placement"),n.bucketInstanceId,j,p.ID),i&&this.storeCollisionData(n.bucketInstanceId,b,f,F,z,B),0===t.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");let Z=(I||S)&&!F?.occluded,Y=(k||C)&&!z?.occluded;this.placements[t.crossTileID]=new mh(Z,Y,O||n.justReloaded),r[t.crossTileID]=!0};if(T){if(0!==t.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");let r=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=r.length-1;t>=0;--t){let i=r[t];I(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let r=t.symbolInstanceStart;r<t.symbolInstanceEnd;r++)I(n.symbolInstances.get(r),n.collisionArrays[r],r);n.justReloaded=!1}storeCollisionData(t,r,i,n,a,o){if(i.textBox||i.iconBox){let o,s;this.collisionBoxArrays.has(t)?o=this.collisionBoxArrays.get(t):(o=new Map,this.collisionBoxArrays.set(t,o)),o.has(r)?s=o.get(r):(s={text:null,icon:null},o.set(r,s)),i.textBox&&(s.text=n.box),i.iconBox&&(s.icon=a.box)}if(o){let r=this.collisionCircleArrays[t];void 0===r&&(r=this.collisionCircleArrays[t]=[]);for(let t=0;t<o.circles.length;t+=4)r.push(o.circles[t+0]-100),r.push(o.circles[t+1]-100),r.push(o.circles[t+2]),r.push(+!!o.collisionDetected)}}markUsedJustification(t,r,i,n){let a={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},o;for(let s of(o=2===n?i.verticalPlacedTextSymbolIndex:a[cY(r)],[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex]))s>=0&&(o>=0&&s!==o?t.text.placedSymbolArray.get(s).crossTileID=0:t.text.placedSymbolArray.get(s).crossTileID=i.crossTileID)}markUsedOrientation(t,r,i){let n=1===r||3===r?r:0;for(let r of[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex])t.text.placedSymbolArray.get(r).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=2===r?r:0)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let r=this.prevPlacement,i=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;let n=r?r.symbolFadeChange(t):1,a=r?r.opacities:{},o=r?r.variableOffsets:{},s=r?r.placedOrientations:{};for(let t in this.placements){let r=this.placements[t],o=a[t];o?(this.opacities[t]=new mc(o,n,r.text,r.icon),i||=r.text!==o.text.placed,i||=r.icon!==o.icon.placed):(this.opacities[t]=new mc(null,n,r.text,r.icon,r.ski
57pFade),i||=r.text||r.icon)}for(let t in a){let r=a[t];if(!this.opacities[t]){let a=new mc(r,n,!1,!1);a.isHidden()||(this.opacities[t]=a,i||=r.text.placed,i||=r.icon.placed)}}for(let t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(let t in s)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=s[t]);if(r&&void 0===r.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:t)}updateLayerOpacities(t,r){let i={};for(let n of r){let r=n.getBucket(t);r&&n.latestFeatureIndex&&t.id===r.layerIds[0]&&this.updateBucketOpacities(r,n.tileID,i,n.collisionBoxArray)}}updateBucketOpacities(t,r,i,n){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let a=t.layers[0],o=a.layout,s=new mc(null,0,!1,!1,!0),l=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),c=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===o.get("text-rotation-alignment"),f="map"===o.get("text-pitch-alignment"),d="none"!==o.get("icon-text-fit"),p=new mc(null,0,l&&(u||!t.hasIconData()||o.get("icon-optional")),u&&(l||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);let m=(t,r,i)=>{for(let n=0;n<r/4;n++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices||=i!==mv},g=this.collisionBoxArrays.get(t.bucketInstanceId);for(let r=0;r<t.symbolInstances.length;r++){let n=t.symbolInstances.get(r),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:o,crossTileID:l}=n,u=i[l],y=this.opacities[l];u?y=s:y||(y=p,this.opacities[l]=y),i[l]=!0;let v=a>0||o>0,_=n.numIconVertices>0,b=this.placedOrientations[n.crossTileID],x=2===b,w=1===b||3===b;if(v){let r=my(y.text),i=x?mv:r;m(t.text,a,i);let s=w?mv:r;m(t.text,o,s);let l=y.text.isHidden();for(let r of[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex])r>=0&&(t.text.placedSymbolArray.get(r).hidden=l||x?1:0);n.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=l||w?1:0);let u=this.variableOffsets[n.crossTileID];u&&this.markUsedJustification(t,u.anchor,n,b);let c=this.placedOrientations[n.crossTileID];c&&(this.markUsedJustification(t,"left",n,c),this.markUsedOrientation(t,c,n))}if(_){let r=my(y.icon),i=!(d&&n.verticalPlacedIconSymbolIndex&&x);if(n.placedIconSymbolIndex>=0){let a=i?r:mv;m(t.icon,n.numIconVertices,a),t.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=y.icon.isHidden()}if(n.verticalPlacedIconSymbolIndex>=0){let a=i?mv:r;m(t.icon,n.numVerticalIconVertices,a),t.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden()}}let E=g?.has(r)?g.get(r):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let i=t.collisionArrays[r];if(i){let r=new eT(0,0);if(i.textBox||i.verticalTextBox){let n=!0;if(c){let t=this.variableOffsets[l];t?(r=mp(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),h&&r._rotate(f?-this.transform.bearingInRadians:this.transform.bearingInRadians)):n=!1}if(i.textBox||i.verticalTextBox){let a;
57i.textBox&&(a=x),i.verticalTextBox&&(a=w),mg(t.textCollisionBox.collisionVertexArray,y.text.placed,!n||a,E.text,r.x,r.y)}}if(i.iconBox||i.verticalIconBox){let n=!(w||!i.verticalIconBox),a;i.iconBox&&(a=n),i.verticalIconBox&&(a=!n),mg(t.iconCollisionBox.collisionVertexArray,y.icon.placed,a,E.icon,d?r.x:0,d?r.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,r){let i=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}};function mg(t,r,i,n,a,o){n&&0!==n.length||(n=[0,0,0,0]);let s=n[0]-100,l=n[1]-100,u=n[2]-100,c=n[3]-100;t.emplaceBack(+!!r,+!!i,a||0,o||0,s,l),t.emplaceBack(+!!r,+!!i,a||0,o||0,u,l),t.emplaceBack(+!!r,+!!i,a||0,o||0,u,c),t.emplaceBack(+!!r,+!!i,a||0,o||0,s,c)}function my(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 0xffffffff;let r=+!!t.placed,i=Math.floor(127*t.opacity);return 0x2000000*i+0x1000000*r+131072*i+65536*r+512*i+256*r+2*i+r}let mv=0;var m_=class{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,r,i,n,a){let o=this._bucketParts;for(;this._currentTileIndex<t.length;){let i=t[this._currentTileIndex];if(r.getBucketParts(o,n,i,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((t,r)=>t.sortKey-r.sortKey));this._currentPartIndex<o.length;){let t=o[this._currentPartIndex];if(r.placeLayerBucketPart(t,this._seenCrossTileIDs,i),this._currentPartIndex++,a())return!0}return!1}},mb=class{constructor(t,r,i,n,a,o,s,l){this.placement=new mm(t,r,o,s,l),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(t,r,i){let n=dg(),a=()=>!this._forceFullPlacement&&dg()-n>2;for(;this._currentPlacementIndex>=0;){let n=r[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if(c8(n)&&n.layout&&(!n.minzoom||n.minzoom<=o)&&(!n.maxzoom||n.maxzoom>o)){if(this._inProgressLayer||=new m_(n),this._inProgressLayer.continuePlacement(i[n.source],this.placement,this._showCollisionBoxes,n,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}};let mx=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 9,014 bytes, lines 57-81
57],mw=new Uint32Array(96);var mE=class t{static from(r){if(!r||void 0===r.byteLength||r.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[i,n]=new Uint8Array(r,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=n>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let o=mx[15&n];if(!o)throw Error("Unrecognized array type.");let[s]=new Uint16Array(r,2,1),[l]=new Uint32Array(r,4,1);return new t(l,s,o,void 0,r)}constructor(t,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(t)||t<0)throw Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let o=mx.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(o<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,t),this.coords=new i(a,8+l+u,2*t),this._pos=2*t,this._finished=!0;else{let a=this.data=new n(8+s+l+u);this.ids=new this.IndexArrayType(a,8,t),this.coords=new i(a,8+l+u,2*t),this._pos=0,this._finished=!1,new Uint8Array(a,0,2).set([219,16+o]),new Uint16Array(a,2,1)[0]=r,new Uint32Array(a,4,1)[0]=t}}add(t,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=r,i}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return function t(r,i,n,a,o,s){if(o-a<=n)return;let l=a+o>>1;(function t(r,i,n,a,o,s){for(;o>a;){if(o-a>600){let l=o-a+1,u=n-a+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1);t(r,i,n,Math.max(a,Math.floor(n-u*h/l+f)),Math.min(o,Math.floor(n+(l-u)*h/l+f)),s)}let l=i[2*n+s],u=a,c=o;for(mT(r,i,a,n),i[2*o+s]>l&&mT(r,i,a,o);u<c;){for(mT(r,i,u,c),u++,c--;i[2*u+s]<l;)u++;for(;i[2*c+s]>l;)c--}i[2*a+s]===l?mT(r,i,a,c):mT(r,i,++c,o),c<=n&&(a=c+1),n<=c&&(o=c-1)}})(r,i,l,a,o,s),t(r,i,n,a,l-1,1-s),t(r,i,n,l+1,o,1-s)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:o,nodeSize:s}=this;mw[0]=0,mw[1]=a.length-1,mw[2]=0;let l=3,u=[];for(;l>0;){let c=mw[--l],h=mw[--l],f=mw[--l];if(h-f<=s){for(let s=f;s<=h;s++){let l=o[2*s],c=o[2*s+1];l>=t&&l<=i&&c>=r&&c<=n&&u.push(a[s])}continue}let d=f+h>>1,p=o[2*d],m=o[2*d+1];p>=t&&p<=i&&m>=r&&m<=n&&u.push(a[d]),(0===c?t<=p:r<=m)&&(mw[l++]=f,mw[l++]=d-1,mw[l++]=1-c),(0===c?i>=p:n>=m)&&(mw[l++]=d+1,mw[l++]=h,mw[l++]=1-c)}return u}within(t,r,i){let n=[];return this.withinInto(t,r,i,n),n}withinInto(t,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:o,nodeSize:s}=this;mw[0]=0,mw[1]=a.length-1,mw[2]=0;let l=3,u=0,c=i*i;for(;l>0;){let h=mw[--l],f=mw[--l],d=mw[--l];if(f-d<=s){for(let i=d;i<=f;i++)mS(o[2*i],o[2*i+1],t,r)<=c&&(n[u++]=a[i]);continue}let p=d+f>>1,m=o[2*p],g=o[2*p+1];mS(m,g,t,r)<=c&&(n[u++]=a[p]),(0===h?t-i<=m:r-i<=g)&&(mw[l++]=d,mw[l++]=p-1,mw[l++]=1-h),(0===h?t+i>=m:r+i>=g)&&(mw[l++]=p+1,mw[l++]=f,mw[l++]=1-h)}return u}};function mT(t,r,i,n){mA(t,i,n),mA(r,2*i,2*n),mA(r,2*i+1,2*n+1)}function mA(t,r,i){let n=t[r];t[r]=t[i],t[i]=n}function mS(t,r,i,n){let a=t-i,o=r-n;return a*a+o*o}var mC=class{constructor(t,r,i){this.tileID=t,this.bucketInstanceId=i,this._symbolsByKey={};let n=new Map;for(let t=0;t<r.length;t++){let i=r.get(t),a=i.key,o=n.get(a);o?o.push(i):n.set(a,[i])}for(let[t,r]of n){let i={positions:r.map(t=>({x:Math.floor(.03125*t.anchorX),y:Math.floor(.03125*t.anchorY)})),crossTileIDs:r.map(t=>t.crossTileID)};if(i.positions.length>128){let t=new mE(i.positions.length,16,Uint16Array);for(let{x:r,y:n}of i.positions)t.add(r,n);t.finish(),delete i.positions,i.index=t}this._symbolsByKey[t]=i}}getScaledCoordinates(t,r){let{x:i,y:n,z:a}=this.tileID.canonical,{x:o,y:s,z:l}=r.canonical,u=.03125/2**(l-a);return{x:Math.floor((8192*o+t.anchorX)*u-8192*i*.03125),y:Math.floor((8192*s+t.anchorY)*u-8192*n*.03125)}}findMatches(t,r,i){let n=this.tileID.canonical.z<r.canonical.z?1:2**(this.tileID.canonical.z-r.canonical.z);for(let a=0;a<t.length;a++){let o=t.get(a);if(o.crossTileID)continue;let s=this._symbolsByKey[o.key];if(!s)continue;let l=this.getScaledCoordinates(o,r);s.index?this.findMatchesForIndexedEntry(s,o,l,n,i):s.positions&&this.findMatchesForNonIndexedEntry(s,o,l,n,i)}}findMatchesForIndexedEntry(t,r,i,n,a){let o=t.index.range(i.x-n,i.y-n,i.x+n,i.y+n),s=1/0;for(let r of o)r<s&&!a[t.crossTileIDs[r]]&&(s=r);if(s!==1/0){let i=t.crossTileIDs[s];a[i]=!0,r.crossTileID=i}}findMatchesForNonIndexedEntry(t,r,i,n,a){for(let o=0;o<t.positions.length;o++){let s=t.positions[o],l=t.crossTileIDs[o];if(Math.abs(s.x-i.x)<=n&&Math.abs(s.y-i.y)<=n&&!a[l]){a[l]=!0,r.crossTileID=l;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}},mM=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},mD=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let r=Math.round((t-this.lng)/360);if(0!==r)for(let t in this.indexes){let i=this.indexes[t],n={};for(let t in i){let a=i[t];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+r),n[a.tileID.key]=a}this.indexes[t]=n}this.lng=t}addBucket(t,r,i){if(this.indexes[t.overscaledZ]?.[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<r.symbolInstances.length;t++)r.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||={};let n=this.usedCrossTileIDs[t.overscaledZ];for(let i in this.indexes){let a=this.indexes[i];if(Number(i)>t.overscaledZ)for(let i in a){let o=a[i];o.tileID.isChildOf(t)&&o.findMatches(r.symbolInstances,t,n)}else{let o=a[t.scaledTo(Number(i)).key];o&&o.findMatches(r.symbolInstances,t,n)}}for(let t=0;t<r.symbolInstances.length;t++){let a=r.symbolInstances.get(t);a.crossTileID||(a.crossTileID=i.generate(),n[a.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new mC(t,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(t,r){for(let i of r.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[t][r]}removeStaleBuckets(t){let r=!1;for(let i in this.indexes){let n=this.indexes[i];for(let a in n)t[n[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[a]),delete n[a],r=!0)}return r}},mP=class{constructor(){this.layerIndexes={},this.crossTileIDs=new mM,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,r,i){let n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new mD);let a=!1,o={};for(let s of(n.handleWrapJump(i),r)){let r=s.getBucket(t);t.id===r?.layerIds[0]&&(r.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),n.addBucket(s.tileID,r,this.crossTileIDs)&&(a=!0),o[r.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(a=!0),a}pruneUnusedLayers(t){let r={};for(let i of t)r[i]=!0;for(let t in this.layerIndexes)r[t]||delete this.layerIndexes[t]}},mI=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; 58#ifdef OVERDRAW_INSPECTOR 59fragColor=vec4(1.0); 60#endif 61}`,mk=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity; 62#ifdef OVERDRAW_INSPECTOR 63fragColor=vec4(1.0); 64#endif 65}`,mO=`in vec3 v_data;flat in float v_visibility; 66#pragma maplibre: define highp vec4 color 67#pragma maplibre: define mediump float radius 68#pragma maplibre: define lowp float blur 69#pragma maplibre: define lowp float opacity 70#pragma maplibre: define highp vec4 stroke_color 71#pragma maplibre: define mediump float stroke_width 72#pragma maplibre: define lowp float stroke_opacity 73void main() { 74#pragma maplibre: initialize highp vec4 color 75#pragma maplibre: initialize mediump float radius 76#pragma maplibre: initialize lowp float blur 77#pragma maplibre: initialize lowp float opacity 78#pragma maplibre: initialize highp vec4 stroke_color 79#pragma maplibre: initialize mediump float stroke_width 80#pragma maplibre: initialize lowp float stroke_opacity 81vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius
81/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;} 82#ifdef OVERDRAW_INSPECTOR 83fragColor=vec4(1.0); 84#endif 85}`,mN=`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility; 86#pragma maplibre: define highp vec4 color 87#pragma maplibre: define mediump float radius 88#pragma maplibre: define lowp float blur 89#pragma maplibre: define lowp float opacity 90#pragma maplibre: define highp vec4 stroke_color 91#pragma maplibre: define mediump float stroke_width 92#pragma maplibre: define lowp float stroke_opacity 93void main(void) { 94#pragma maplibre: initialize highp vec4 color 95#pragma maplibre: initialize mediump float radius 96#pragma maplibre: initialize lowp float blur 97#pragma maplibre: initialize lowp float opacity 98#pragma maplibre: initialize highp vec4 stroke_color 99#pragma maplibre: initialize mediump float stroke_width 100#pragma maplibre: initialize lowp float stroke_opacity 101ivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) { 102#ifdef GLOBE 103vec3 center_vector=projectToSphere(circle_center); 104#endif 105float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else { 106#ifdef GLOBE 107vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); 108#else 109vec4 projected_center=projectTileWithElevation(circle_center,ele); 110#endif 111corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);} 112#ifdef GLOBE 113vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); 114#else 115gl_Position=projectTileWithElevation(corner_position,ele); 116#endif 117} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,mL="void main() {fragColor=vec4(1.0);}";let mR={prelude:mF(`#ifdef GL_ES 118precision mediump float; 119#else 120#if !defined(lowp) 121#define lowp 122#endif 123#if !defined(mediump) 124#define mediump 125#endif 126#if !defined(highp) 127#define highp 128#endif 129#endif 130out highp vec4 fragColor;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`,`#ifdef GL_ES 131precision highp float; 132#else 133#if !defined(lowp) 134#define lowp 135#endif 136#if !defined(mediump) 137#define mediump 138#endif 139#if !defined(highp) 140#define highp 141#endif 142#endif 143vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 144);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
144return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c 145);} 146#ifdef TERRAIN3D 147uniform sampler2D u_terrain;uniform highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;}; 148#endif 149const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) { 150#ifdef TERRAIN3D 151highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); 152#else 153return 1.0; 154#endif 155}float calculate_visibility(vec4 pos) { 156#ifdef TERRAIN3D 157vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0; 158#else 159return 1.0; 160#endif 161}float ele(ivec2 pos) { 162#ifdef TERRAIN3D 163vec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; 164#else 165return 0.0; 166#endif 167}float get_elevation(vec2 pos) { 168#ifdef TERRAIN3D 169#ifdef GLOBE 170if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} 171#endif 172vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.5;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; 173#else 174return 0.0; 175#endif 176}const float PI=3.141592653589793; 177#define PROJECTION_UBO 178layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`),projectionMercator:mF(` 179void clipAntimeridian() {}`,"float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:mF("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}",`#define GLOBE_RADIUS 6371008.8 180#ifndef PROJECTION_UBO 181uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix; 182#endif 183out highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos 184);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));
184float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy 185);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:mF(mI,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:mF(mk,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:mF(mO,mN),clippingMask:mF(mL,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:mF(`uniform highp float u_intensity;in vec2 v_extrude; 186#pragma maplibre: define highp float weight 187#define GAUSS_COEF 0.3989422804014327 188void main() { 189#pragma maplibre: initialize highp float weight 190float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0); 191#ifdef OVERDRAW_INSPECTOR 192fragColor=vec4(1.0); 193#endif 194}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude; 195#pragma maplibre: define highp float weight 196#pragma maplibre: define mediump float radius 197const highp float ZERO=1.0/255.0/16.0; 198#define GAUSS_COEF 0.3989422804014327 199void main(void) { 200#pragma maplibre: initialize highp float weight 201#pragma maplibre: initialize mediump float radius 202ivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3); 203#ifdef GLOBE 204vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0); 205#else 206gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); 207#endif 208}`),heatmapTexture:mF(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity; 209#ifdef OVERDRAW_INSPECTOR 210fragColor=vec4(0.0); 211#endif 212}`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:mF("flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:mF("flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:mF(`#ifdef GL_ES 213precision highp float; 214#endif 215uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else 216{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0)); 217#ifdef OVERDRAW_INSPECTOR 218fragColor=vec4(1.0); 219#endif 220}`,"uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:mF("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:mF(mL,`layout(location=0) in vec2 a_pos;void main() { 221#ifdef GLOBE 222gl_Position=projectTileFor3D(a_pos,0.0); 223#else 224gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); 225#endif 226}`),fill:mF(`#pragma maplibre: define highp vec4 color 227#pragma maplibre: define lowp float opacity 228void main() { 229#pragma maplibre: initialize highp vec4 color 230#pragma maplibre: initialize lowp float opacity 231fragColor=color*opacity; 232#ifdef OVERDRAW_INSPECTOR 233fragColor=vec4(1.0); 234#endif 235}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos; 236#pragma maplibre: define highp vec4 color 237#pragma maplibre: define lowp float opacity 238void main() { 239#pragma maplibre: initialize highp vec4 color 240#pragma maplibre: initialize lowp float opacity 241if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:mF(`in vec2 v_pos; 242#ifdef GLOBE 243in float v_depth; 244#endif 245#pragma maplibre: define highp vec4 outline_color 246#pragma maplibre: define lowp float opacity 247void main() { 248#pragma maplibre: initialize highp vec4 outline_color 249#pragma maplibre: initialize lowp float opacity 250float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); 251#ifdef GLOBE 252if (v_depth > 1.0) {discard;} 253#endif 254#ifdef OVERDRAW_INSPECTOR 255fragColor=vec4(1.0); 256#endif 257}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos; 258#ifdef GLOBE 259out float v_depth; 260#endif 261#pragma maplibre: define highp vec4 outline_color 262#pragma maplibre: define lowp float opacity 263void main() { 264#pragma maplibre: initialize highp vec4 outline_color 265#pragma maplibre: initialize lowp float opacity 266if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size; 267#ifdef GLOBE 268v_depth=gl_Position.z/gl_Position.w; 269#endif 270}`),fillOutlinePattern:mF(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos; 271#ifdef GLOBE 272in float v_depth; 273#endif 274#pragma maplibre: define lowp float opacity 275#pragma maplibre: define highp vec4 color 276#pragma maplibre: define lowp vec4 pattern_from 277#pragma maplibre: define lowp vec4 pattern_to 278void main() { 279#pragma maplibre: initialize lowp float opacity 280#pragma maplibre: initialize highp vec4 color 281#pragma maplibre: initialize mediump vec4 pattern_from 282#pragma maplibre: initialize mediump vec4 pattern_to 283vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {fragColor=mix(color1,color2,u_fade)*alpha*opacity;} 284#ifdef GLOBE 285if (v_depth > 1.0) {discard;} 286#endif 287#ifdef OVERDRAW_INSPECTOR 288fragColor=vec4(1.0); 289#endif 290}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; 291#ifdef GLOBE 292out float v_depth; 293#endif 294#pragma maplibre: define lowp float opacity 295#pragma maplibre: define highp vec4 color 296#pragma maplibre: define lowp vec4 pattern_from 297#pragma maplibre: define lowp vec4 pattern_to 298#pragma maplibre: define lowp float pixel_ratio_from 299#pragma maplibre: define lowp float pixel_ratio_to 300void main() { 301#pragma maplibre: initialize lowp float opacity 302#pragma maplibre: initialize highp vec4 color 303#pragma maplibre: initialize mediump vec4 pattern_from 304#pragma maplibre: initialize mediump vec4 pattern_to 305#pragma maplibre: initialize lowp float pixel_ratio_from 306#pragma maplibre: initialize lowp float pixel_ratio_to 307if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size; 308#ifdef GLOBE 309v_depth=gl_Position.z/gl_Position.w; 310#endif 311}`),fillPattern:mF(`#ifdef GL_ES 312precision highp float; 313#endif 314uniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; 315#pragma maplibre: define lowp float opacity 316#pragma maplibre: define highp vec4 color 317#pragma maplibre: define lowp vec4 pattern_from 318#pragma maplibre: define lowp vec4 pattern_to 319void main() { 320#pragma maplibre: initialize lowp float opacity 321#pragma maplibre: initialize highp vec4 color 322#pragma maplibre: initialize mediump vec4 pattern_from 323#pragma maplibre: initialize mediump vec4 pattern_to 324vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {fragColor=mix(color1,color2,u_fade)*opacity;} 325#ifdef OVERDRAW_INSPECTOR 326fragColor=vec4(1.0); 327#endif 328}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; 329#pragma maplibre: define lowp float opacity 330#pragma maplibre: define highp vec4 color 331#pragma maplibre: define lowp vec4 pattern_from 332#pragma maplibre: define lowp vec4 pattern_to 333#pragma maplibre: define lowp float pixel_ratio_from 334#pragma maplibre: define lowp float pixel_ratio_to 335void main() { 336#pragma maplibre: initialize lowp float opacity 337#pragma maplibre: initialize highp vec4 color 338#pragma maplibre: initialize mediump vec4 pattern_from 339#pragma maplibre: initialize mediump vec4 pattern_to 340#pragma maplibre: initialize lowp float pixel_ratio_from 341#pragma maplibre: initialize lowp float pixel_ratio_to 342if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float to
342Scale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:mF(`in vec4 v_color;void main() {fragColor=v_color; 343#ifdef OVERDRAW_INSPECTOR 344fragColor=vec4(1.0); 345#endif 346}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed; 347#ifdef TERRAIN3D 348layout(location=2) in vec2 a_centroid; 349#endif 350out vec4 v_color; 351#pragma maplibre: define highp float base 352#pragma maplibre: define highp float height 353#pragma maplibre: define highp vec4 color 354void main() { 355#pragma maplibre: initialize highp float base 356#pragma maplibre: initialize highp float height 357#pragma maplibre: initialize highp vec4 color 358vec3 normal=vec3(a_normal_ed.xyz);float gradient_base=max(0.0,base);float gradient_height=max(0.0,height); 359#ifdef TERRAIN3D 360float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 361#else 362float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 363#endif 364base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 365#ifdef GLOBE 366vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 367#else 368gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 369#endif 370float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0); 371#ifdef GLOBE 372mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); 373#endif 374directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:mF(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting; 375#pragma maplibre: define lowp float base 376#pragma maplibre: define lowp float height 377#pragma maplibre: define lowp vec4 pattern_from 378#pragma maplibre: define lowp vec4 pattern_to 379#pragma maplibre: define lowp float pixel_ratio_from 380#pragma maplibre: define lowp float pixel_ratio_to 381void main() { 382#pragma maplibre: initialize lowp float base 383#pragma maplibre: initialize lowp float height 384#pragma maplibre: initialize mediump vec4 pattern_from 385#pragma maplibre: initialize mediump vec4 pattern_to 386#pragma maplibre: initialize lowp float pixel_ratio_from 387#pragma maplibre: initialize lowp float pixel_ratio_to 388vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting; 389#ifdef OVERDRAW_INSPECTOR 390fragColor=vec4(1.0); 391#endif 392}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed; 393#ifdef TERRAIN3D 394layout(location=2) in vec2 a_centroid; 395#endif 396#ifdef GLOBE 397out vec3 v_sphere_pos; 398#endif 399out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; 400#pragma maplibre: define lowp float base 401#pragma maplibre: define lowp float height 402#pragma maplibre: define lowp vec4 pattern_from 403#pragma maplibre: define lowp vec4 pattern_to 404#pragma maplibre: define lowp float pixel_ratio_from 405#pragma maplibre: define lowp float pixel_ratio_to 406void main() { 407#pragma maplibre: initialize lowp float base 408#pragma maplibre: initialize lowp float height 409#pragma maplibre: initialize mediump vec4 pattern_from 410#pragma maplibre: initialize mediump vec4 pattern_to 411#pragma maplibre: initialize lowp float pixel_ratio_from 412#pragma maplibre: initialize lowp float pixel_ratio_to 413vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=vec3(a_normal_ed.xyz);float edgedistance=float(a_normal_ed.w);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;float gradient_base=max(0.0,base);float gradient_height=max(0.0,height); 414#ifdef TERRAIN3D 415float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 416#else 417float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 418#endif 419base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 420#ifdef GLOBE 421vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 422#else 423gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 424#endif 425vec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384 426? a_pos 427: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:mF(`#ifdef GL_ES 428precision highp float; 429#endif 430uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/p
430ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0); 431#ifdef OVERDRAW_INSPECTOR 432fragColor=vec4(1.0); 433#endif 434}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:mF(`uniform sampler2D u_image;in highp vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES]; 435#define PI 3.141592653589793 436#define STANDARD 0 437#define COMBINED 1 438#define IGOR 2 439#define MULTIDIRECTIONAL 3 440#define BASIC 4 441float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else 442{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else 443{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {highp vec2 size=vec2(textureSize(u_image,0));highp vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);} 444#ifdef OVERDRAW_INSPECTOR 445fragColor=vec4(1.0); 446#endif 447}`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:mF(`flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; 448#ifdef GLOBE 449in float v_depth; 450#endif 451#pragma maplibre: define highp vec4 color 452#pragma maplibre: define lowp float blur 453#pragma maplibre: define lowp float opacity 454void main() { 455#pragma maplibre: initialize highp vec4 color 456#pragma maplibre: initialize lowp float blur 457#pragma maplibre: initialize lowp float opacity 458clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity); 459#ifdef GLOBE 460if (v_depth > 1.0) {discard;} 461#endif 462#ifdef OVERDRAW_INSPECTOR 463fragColor=vec4(1.0); 464#endif 465}`,` 466#define scale 0.015873016 467layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar; 468#ifdef GLOBE 469out float v_depth; 470#endif 471#pragma maplibre: define highp vec4 color 472#pragma maplibre: define lowp float blur 473#pragma maplibre: define lowp float opacity 474#pragma maplibre: define mediump float gapwidth 475#pragma maplibre: define lowp float offset 476#pragma maplibre: define mediump float width 477void main() { 478#pragma maplibre: initialize highp vec4 color 479#pragma maplibre: initialize lowp float blur 480#pragma maplibre: initialize lowp float opacity 481#pragma maplibre: initialize mediump float gapwidth 482#pragma maplibre: initialize lowp float offset 483#pragma maplibre: initialize mediump float width 484if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
484float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 485#ifdef GLOBE 486v_depth=gl_Position.z/gl_Position.w; 487#endif 488#ifdef TERRAIN3D 489v_gamma_scale=1.0; 490#else 491float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 492#endif 493v_width2=vec2(outset,inset);}`),lineGradient:mF(`uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv; 494#ifdef GLOBE 495in float v_depth; 496#endif 497#pragma maplibre: define lowp float blur 498#pragma maplibre: define lowp float opacity 499void main() { 500#pragma maplibre: initialize lowp float blur 501#pragma maplibre: initialize lowp float opacity 502clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity); 503#ifdef GLOBE 504if (v_depth > 1.0) {discard;} 505#endif 506#ifdef OVERDRAW_INSPECTOR 507fragColor=vec4(1.0); 508#endif 509}`,` 510#define scale 0.015873016 511layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv; 512#ifdef GLOBE 513out float v_depth; 514#endif 515#pragma maplibre: define lowp float blur 516#pragma maplibre: define lowp float opacity 517#pragma maplibre: define mediump float gapwidth 518#pragma maplibre: define lowp float offset 519#pragma maplibre: define mediump float width 520void main() { 521#pragma maplibre: initialize lowp float blur 522#pragma maplibre: initialize lowp float opacity 523#pragma maplibre: initialize mediump float gapwidth 524#pragma maplibre: initialize lowp float offset 525#pragma maplibre: initialize mediump float width 526if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 527#ifdef GLOBE 528v_depth=gl_Position.z/gl_Position.w; 529#endif 530#ifdef TERRAIN3D 531v_gamma_scale=1.0; 532#else 533float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 534#endif 535v_width2=vec2(outset,inset);}`),linePattern:mF(`#ifdef GL_ES 536precision highp float; 537#endif 538uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width; 539#ifdef GLOBE 540in float v_depth; 541#endif 542#pragma maplibre: define lowp vec4 pattern_from 543#pragma maplibre: define lowp vec4 pattern_to 544#pragma maplibre: define lowp float pixel_ratio_from 545#pragma maplibre: define lowp float pixel_ratio_to 546#pragma maplibre: define lowp float blur 547#pragma maplibre: define lowp float opacity 548void main() { 549#pragma maplibre: initialize mediump vec4 pattern_from 550#pragma maplibre: initialize mediump vec4 pattern_to 551#pragma maplibre: initialize lowp float pixel_ratio_from 552#pragma maplibre: initialize lowp float pixel_ratio_to 553#pragma maplibre: initialize lowp float blur 554#pragma maplibre: initialize lowp float opacity 555clipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity; 556#ifdef GLOBE 557if (v_depth > 1.0) {discard;} 558#endif 559#ifdef OVERDRAW_INSPECTOR 560fragColor=vec4(1.0); 561#endif 562}`,` 563#define scale 0.015873016 564#define LINE_DISTANCE_SCALE 2.0 565layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width; 566#ifdef GLOBE 567out float v_depth; 568#endif 569#pragma maplibre: define lowp float blur 570#pragma maplibre: define lowp float opacity 571#pragma maplibre: define lowp float offset 572#pragma maplibre: define mediump float gapwidth 573#pragma maplibre: define mediump float width 574#pragma maplibre: define lowp float floorwidth 575#pragma maplibre: define lowp vec4 pattern_from 576#pragma maplibre: define lowp vec4 pattern_to 577#pragma maplibre: define lowp float pixel_ratio_from 578#pragma maplibre: define lowp float pixel_ratio_to 579void main() { 580#pragma maplibre: initialize lowp float blur 581#pragma maplibre: initialize lowp float opacity 582#pragma maplibre: initialize lowp float offset 583#pragma maplibre: initialize mediump float gapwidth 584#pragma maplibre: initialize mediump float width 585#pragma maplibre: initialize lowp float floorwidth 586#pragma maplibre: initialize mediump vec4 pattern_from 587#pragma maplibre: initialize mediump vec4 pattern_to 588#pragma maplibre: initialize lowp float pixel_ratio_from 589#pragma maplibre: initialize lowp float pixel_ratio_to 590if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
590float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 591#ifdef GLOBE 592v_depth=gl_Position.z/gl_Position.w; 593#endif 594#ifdef TERRAIN3D 595v_gamma_scale=1.0; 596#else 597float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 598#endif 599v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:mF(`uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale; 600#ifdef GLOBE 601in float v_depth; 602#endif 603#pragma maplibre: define highp vec4 color 604#pragma maplibre: define lowp float blur 605#pragma maplibre: define lowp float opacity 606#pragma maplibre: define mediump float width 607#pragma maplibre: define lowp float floorwidth 608#pragma maplibre: define mediump vec4 dasharray_from 609#pragma maplibre: define mediump vec4 dasharray_to 610void main() { 611#pragma maplibre: initialize highp vec4 color 612#pragma maplibre: initialize lowp float blur 613#pragma maplibre: initialize lowp float opacity 614#pragma maplibre: initialize mediump float width 615#pragma maplibre: initialize lowp float floorwidth 616#pragma maplibre: initialize mediump vec4 dasharray_from 617#pragma maplibre: initialize mediump vec4 dasharray_to 618clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
618float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity); 619#ifdef GLOBE 620if (v_depth > 1.0) {discard;} 621#endif 622#ifdef OVERDRAW_INSPECTOR 623fragColor=vec4(1.0); 624#endif 625}`,` 626#define scale 0.015873016 627#define LINE_DISTANCE_SCALE 2.0 628layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale; 629#ifdef GLOBE 630out float v_depth; 631#endif 632#pragma maplibre: define highp vec4 color 633#pragma maplibre: define lowp float blur 634#pragma maplibre: define lowp float opacity 635#pragma maplibre: define mediump float gapwidth 636#pragma maplibre: define lowp float offset 637#pragma maplibre: define mediump float width 638#pragma maplibre: define lowp float floorwidth 639#pragma maplibre: define mediump vec4 dasharray_from 640#pragma maplibre: define mediump vec4 dasharray_to 641void main() { 642#pragma maplibre: initialize highp vec4 color 643#pragma maplibre: initialize lowp float blur 644#pragma maplibre: initialize lowp float opacity 645#pragma maplibre: initialize mediump float gapwidth 646#pragma maplibre: initialize lowp float offset 647#pragma maplibre: initialize mediump float width 648#pragma maplibre: initialize lowp float floorwidth 649#pragma maplibre: initialize mediump vec4 dasharray_from 650#pragma maplibre: initialize mediump vec4 dasharray_to 651if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 652#ifdef GLOBE 653v_depth=gl_Position.z/gl_Position.w; 654#endif 655#ifdef TERRAIN3D 656v_gamma_scale=1.0; 657#else 658float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 659#endif 660float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:mF(`uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv; 661#ifdef GLOBE 662in float v_depth; 663#endif 664#pragma maplibre: define lowp float blur 665#pragma maplibre: define lowp float opacity 666#pragma maplibre: define mediump float width 667#pragma maplibre: define lowp float floorwidth 668#pragma maplibre: define mediump vec4 dasharray_from 669#pragma maplibre: define mediump vec4 dasharray_to 670void main() { 671#pragma maplibre: initialize lowp float blur 672#pragma maplibre: initialize lowp float opacity 673#pragma maplibre: initialize mediump float width 674#pragma maplibre: initialize lowp float floorwidth 675#pragma maplibre: initialize mediump vec4 dasharray_from 676#pragma maplibre: initialize mediump vec4 dasharray_to 677clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
677float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity); 678#ifdef GLOBE 679if (v_depth > 1.0) {discard;} 680#endif 681#ifdef OVERDRAW_INSPECTOR 682fragColor=vec4(1.0); 683#endif 684}`,` 685#define scale 0.015873016 686#define LINE_DISTANCE_SCALE 2.0 687layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b; 688#ifdef GLOBE 689out float v_depth; 690#endif 691#pragma maplibre: define lowp float blur 692#pragma maplibre: define lowp float opacity 693#pragma maplibre: define mediump float gapwidth 694#pragma maplibre: define lowp float offset 695#pragma maplibre: define mediump float width 696#pragma maplibre: define lowp float floorwidth 697#pragma maplibre: define mediump vec4 dasharray_from 698#pragma maplibre: define mediump vec4 dasharray_to 699void main() { 700#pragma maplibre: initialize lowp float blur 701#pragma maplibre: initialize lowp float opacity 702#pragma maplibre: initialize mediump float gapwidth 703#pragma maplibre: initialize lowp float offset 704#pragma maplibre: initialize mediump float width 705#pragma maplibre: initialize lowp float floorwidth 706#pragma maplibre: initialize mediump vec4 dasharray_from 707#pragma maplibre: initialize mediump vec4 dasharray_to 708if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 709#ifdef GLOBE 710v_depth=gl_Position.z/gl_Position.w; 711#endif 712#ifdef TERRAIN3D 713v_gamma_scale=1.0; 714#else 715float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 716#endif 717float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),layerOpacity:mF(`uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity; 718#ifdef OVERDRAW_INSPECTOR 719fragColor=vec4(0.0); 720#endif 721}`,"layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:mF(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); 722#ifdef OVERDRAW_INSPECTOR 723fragColor=vec4(1.0); 724#endif 725}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;
725vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5; 726#ifdef GLOBE 727if (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;} 728#endif 729float perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}`),symbolIcon:mF(`uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity; 730#ifdef OVERDRAW_INSPECTOR 731fragColor=vec4(1.0); 732#endif 733}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform bool u_rotate_symbol;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity; 734#pragma maplibre: define lowp float opacity 735void main() { 736#pragma maplibre: initialize lowp float opacity 737vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 738camera_to_anchor_distance/u_camera_to_center_distance : 739u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 740#ifdef GLOBE 741if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 742#endif 743vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:mF(`#define SDF_PX 8.0 744uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1; 745#pragma maplibre: define highp vec4 fill_color 746#pragma maplibre: define highp vec4 halo_color 747#pragma maplibre: define lowp float halo_width 748#pragma maplibre: define lowp float halo_blur 749void main() { 750#pragma maplibre: initialize highp vec4 fill_color 751#pragma maplibre: initialize highp vec4 halo_color 752#pragma maplibre: initialize lowp float halo_width 753#pragma maplibre: initialize lowp float halo_blur 754float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;} 755#ifdef OVERDRAW_INSPECTOR 756fragColor=vec4(1.0); 757#endif 758}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1; 759#pragma maplibre: define highp vec4 fill_color 760#pragma maplibre: define highp vec4 halo_color 761#pragma maplibre: define lowp float opacity 762#pragma maplibre: define lowp float halo_width 763#pragma maplibre: define lowp float halo_blur 764void main() { 765#pragma maplibre: initialize highp vec4 fill_color 766#pragma maplibre: initialize highp vec4 halo_color 767#pragma maplibre: initialize lowp float opacity 768#pragma maplibre: initialize lowp float halo_width 769#pragma maplibre: initialize lowp float halo_blur 770vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 771camera_to_anchor_distance/u_camera_to_center_distance : 772u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 773#ifdef GLOBE 774if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 775#endif 776vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:mF(`#define SDF_PX 8.0 777#define SDF 1.0 778#define ICON 0.0 779uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf; 780#pragma maplibre: define highp vec4 fill_color 781#pragma maplibre: define highp vec4 halo_color 782#pragma maplibre: define lowp float halo_width 783#pragma maplibre: define lowp float halo_blur 784void main() { 785#pragma maplibre: initialize highp vec4 fill_color 786#pragma maplibre: initialize highp vec4 halo_color 787#pragma maplibre: initialize lowp float halo_width 788#pragma maplibre: initialize lowp float halo_blur 789float total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;
789fragColor=texture(u_texture_icon,tex_icon)*total_opacity; 790#ifdef OVERDRAW_INSPECTOR 791fragColor=vec4(1.0); 792#endif 793return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;} 794#ifdef OVERDRAW_INSPECTOR 795fragColor=vec4(1.0); 796#endif 797}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf; 798#pragma maplibre: define highp vec4 fill_color 799#pragma maplibre: define highp vec4 halo_color 800#pragma maplibre: define lowp float opacity 801#pragma maplibre: define lowp float halo_width 802#pragma maplibre: define lowp float halo_blur 803void main() { 804#pragma maplibre: initialize highp vec4 fill_color 805#pragma maplibre: initialize highp vec4 halo_color 806#pragma maplibre: initialize lowp float opacity 807#pragma maplibre: initialize lowp float halo_width 808#pragma maplibre: initialize lowp float halo_blur 809vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 810camera_to_anchor_distance/u_camera_to_center_distance : 811u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 812#ifdef GLOBE 813if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 814#endif 815vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}`),terrain:mF("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
815float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:mF("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),atmosphere:mF(`#ifdef GL_ES 816precision highp float; 817#endif 818in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 819);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:mF("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;in vec3 v_view_direction;const float ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS=100000.0/6371000.0;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;float opacity=1.0;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,((angle_to_globe_center-horizon_angle)*u_camera_to_center_distance+1.0)*u_device_pixel_ratio,u_sky_blend);float closest_approach=max(dot(ray,u_globe_position),0.0);
819float lowest_altitude=sqrt(max(globe_distance*globe_distance-closest_approach*closest_approach,0.0))-u_globe_radius;float atmosphere_height=u_globe_radius*ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS;float inside_atmosphere=1.0-smoothstep(atmosphere_height,10.0*atmosphere_height,globe_distance-u_globe_radius);float through_atmosphere=1.0-smoothstep(0.0,atmosphere_height,lowest_altitude);opacity=inside_atmosphere*through_atmosphere*(1.0-u_atmosphere_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor*=mix(1.0,opacity,u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};function mF(t,r){let i=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=r.match(/in ([\w]+) ([\w]+)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=o?o.concat(a):a,l=n?n.length:0,u={};return{fragmentSource:t=t.replace(i,(t,r,i,n,a)=>(u[a]=!0,"define"===r?` 820#ifndef HAS_UNIFORM_u_${a} 821in ${i} ${n} ${a}; 822#else 823uniform ${i} ${n} u_${a}; 824#endif 825`:` 826#ifdef HAS_UNIFORM_u_${a} 827 ${i} ${n} ${a} = u_${a}; 828#endif 829`)),vertexSource:r=r.replace(i,(t,r,i,n,a)=>{let o="float"===n?"vec2":"vec4",s=a.match(/color/)?"color":o;return u[a]?"define"===r?` 830#ifndef HAS_UNIFORM_u_${a} 831uniform lowp float u_${a}_t; 832layout(location = ${l++}) in ${i} ${o} a_${a}; 833out ${i} ${n} ${a}; 834#else 835uniform ${i} ${n} u_${a}; 836#endif 837`:"vec4"===s?` 838#ifndef HAS_UNIFORM_u_${a} 839 ${a} = a_${a}; 840#else 841 ${i} ${n} ${a} = u_${a}; 842#endif 843`:` 844#ifndef HAS_UNIFORM_u_${a} 845 ${a} = unpack_mix_${s}(a_${a}, u_${a}_t); 846#else 847 ${i} ${n} ${a} = u_${a}; 848#endif 849`:"define"===r?` 850#ifndef HAS_UNIFORM_u_${a} 851uniform lowp float u_${a}_t; 852layout(location = ${l++}) in ${i} ${o} a_${a}; 853#else 854uniform ${i} ${n} u_${a}; 855#endif 856`:"vec4"===s?` 857#ifndef HAS_UNIFORM_u_${a} 858 ${i} ${n} ${a} = a_${a}; 859#else 860 ${i} ${n} ${a} = u_${a}; 861#endif 862`:` 863#ifndef HAS_UNIFORM_u_${a} 864 ${i} ${n} ${a} = unpack_mix_${s}(a_${a}, u_${a}_t); 865#else 866 ${i} ${n} ${a} = u_${a}; 867#endif 868`}),staticAttributes:n,staticUniforms:s}}let mB="#define PROJECTION_MERCATOR",mz="mercator";var mj=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return mz}get shaderDefine(){return mB}get shaderPreludeCode(){return mR.projectionMercator}get vertexShaderPreludeCode(){return mR.projectionMercator.vertexSource}get subdivisionGranularity(){return lY.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(t,r,i,n,a){if(this._cachedMesh)return this._cachedMesh;let o=new oW;o.emplaceBack(0,0),o.emplaceBack(8192,0),o.emplaceBack(0,8192),o.emplaceBack(8192,8192);let s=t.createVertexBuffer(o,pT.members),l=sa.simpleSegment(0,0,4,2),u=new se;u.emplaceBack(1,0,2),u.emplaceBack(1,2,3);let c=t.createIndexBuffer(u);return this._cachedMesh=new pE(s,c,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}},mU=class t{constructor(t=0,r=0,i=0,n=0){if(isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0||isNaN(n)||n<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=r,this.left=i,this.right=n}interpolate(t,r,i){return null!=r.top&&null!=t.top&&(this.top=il.number(t.top,r.top,i)),null!=r.bottom&&null!=t.bottom&&(this.bottom=il.number(t.bottom,r.bottom,i)),null!=r.left&&null!=t.left&&(this.left=il.number(t.left,r.left,i)),null!=r.right&&null!=t.right&&(this.right=il.number(t.right,r.right,i)),this}getCenter(t,r){return new eT(tv((this.left+t-this.right)/2,0,t),tv((this.top+r-this.bottom)/2,0,r))}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new t(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function mV(t,r){if(!t.renderWorldCopies||t.lngRange)return;let i=r.lng-t.center.lng;r.lng+=i>180?-360:360*(i<-180)}function m$(t){return Math.max(0,Math.floor(t))}var mG=class{constructor(t,r){this.applyConstrain=(t,r)=>null===this._constrainOverride?this._callbacks.defaultConstrain(t,r):this._constrainOverride(t,r),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=r?.renderWorldCopies===void 0||!!r?.renderWorldCopies,this._minZoom=r?.minZoom||0,this._maxZoom=r?.maxZoom||22,this._minPitch=r?.minPitch===void 0||r?.minPitch===null?0:r?.minPitch,this._maxPitch=r?.maxPitch===void 0||r?.maxPitch===null?60:r?.maxPitch,this._constrainOverride=r?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new uo(0,0),this._elevation=0,this._zoom=0,this._tileZoom=m$(this._zoom),this._scale=tE(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new mU,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,r){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=m$(this._zoom),this._scale=tE(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new mU(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=t.autoCalculateNearFarZ,r&&this.constrainInternal(),this._calcMatrices()}
868get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){if(this._minZoom===t)return;this._minZoom=t;let r=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=r}get maxZoom(){return this._maxZoom}setMaxZoom(t){if(this._maxZoom===t)return;this._maxZoom=t;let r=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=r}get minPitch(){return this._minPitch}setMinPitch(t){if(this._minPitch===t)return;this._minPitch=t;let r=this._unmodified;this.setPitch(Math.max(this.pitch,t)),this._unmodified=r}get maxPitch(){return this._maxPitch}setMaxPitch(t){if(this._maxPitch===t)return;this._maxPitch=t;let r=this._unmodified;this.setPitch(Math.min(this.pitch,t)),this._unmodified=r}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new eT(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){var r,i,n,a,o,s,l,u,c;let h=t_(t,-180,180)*Math.PI/180;this._bearingInRadians!==h&&(this._unmodified=!1,this._bearingInRadians=h,this._calcMatrices(),this._rotationMatrix=dd(),r=this._rotationMatrix,i=this._rotationMatrix,n=-this._bearingInRadians,a=i[0],o=i[1],s=i[2],l=i[3],u=Math.sin(n),c=Math.cos(n),r[0]=a*c+s*u,r[1]=o*c+l*u,r[2]=-(a*u)+s*c,r[3]=-(o*u)+l*c)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let r=tv(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let r=t/180*Math.PI;this._rollInRadians!==r&&(this._unmodified=!1,this._rollInRadians=r,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return tj(this._fovInRadians)}setFov(t){t=tv(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=tz(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let r=this.applyConstrain(this._center,t).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=tE(r),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){(t.lat!==this._center.lat||t.lng!==this._center.lng)&&(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,r){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=r,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,r,i){this._unmodified=!1,this._edgeInsets.interpolate(t,r,i),this.constrainInternal(),this._calcMatrices()}resize(t,r,i=!0){this._width=t,this._height=r,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange?.length!==2||this._lngRange?.length!==2?null:new ph([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-85.051129,85.051129])}getCameraQueryGeometry(t,r){if(1===r.length)return[r[0],t];{let{minX:i,minY:n,maxX:a,maxY:o}=l7.fromPoints(r).extend(t);return[new eT(i,n),new eT(a,n),new eT(a,o),new eT(i,o),new eT(i,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:r,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(r),this.setZoom(i),this._unmodified=t,this._constraining=!1}
868_calcMatrices(){if(this._pixelPerMeter=1/ul(this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=eI(new Float64Array(16));eL(t,t,[this._width/2,-this._height/2,1]),eN(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,eL(t=eI(new Float64Array(16)),t,[1,-1,1]),eN(t,t,[-1,-1,0]),eL(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t;let r=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(r)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,r,i,n){let a=void 0===i?this.bearing:i,o=n=void 0===n?this.pitch:n,{distanceToCenter:s,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(r,this.elevation,o),{x:u,y:c}=ub(o,a),h=ud.fromLngLat(t,r),f=+ul(uf(h.y)),d,p,m=0;do{if((m+=1)>10)break;let t=u*(p=s/f),r=c*p;f=1/(d=new ud(h.x+t,h.y+r)).meterInMercatorCoordinateUnits()}while(Math.abs(s-p*f)>1e-12)return{center:d.toLngLat(),elevation:l,zoom:tT(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let r=1/this.worldSize,i=1/ul(this.center.lat)*this.worldSize,n=ud.fromLngLat(this.center,this.elevation),a=n.x/r,o=n.y/r,s=n.z/r,l=this.pitch,{x:u,y:c,z:h}=ub(l,this.bearing),f=this.cameraToCenterDistance,{distanceToCenter:d,clampedElevation:p}=this._distanceToCenterFromAltElevationPitch((s+f*h)/i,t,l),m=d*i,g=new ud((a+-(f*u)+u*m)*r,(o+-(f*c)+c*m)*r,0).toLngLat(),y=1/ul(g.lat),v=tT(this.height/2/Math.tan(this.fovInRadians/2)/d/y/this.tileSize);this._elevation=p,this._center=g,this.setZoom(v)}_distanceToCenterFromAltElevationPitch(t,r,i){let n=-Math.cos(tz(i)),a=t-r,o,s=r;return n*a>=0||.1>Math.abs(n)?s=t+(o=1e4)*n:o=-a/n,{distanceToCenter:o,clampedElevation:s}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new eT(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let r=t.canonical.z>=0?1<<t.canonical.z:2**t.canonical.z;return[t.canonical.x/r,t.canonical.y/r,1/r/8192,1/r/8192]}},mq=class{distanceToTile2d(t,r,i,n){return Math.hypot(n.distanceX([t,r]),n.distanceY([t,r]))}getWrap(t,r,i){return i}getTileBoundingVolume(t,r,i,n){let a=Math.min(0,i),o=Math.max(0,i);if(n?.terrain){let i=new hu(t.z,r,t.z,t.x,t.y),s=n.terrain.getMinMaxElevation(i);a=s.minElevation??a,o=s.maxElevation??o}let s=1<<t.z;return new pB([r+t.x/s,t.y/s,a],[r+(t.x+1)/s,(t.y+1)/s,o])}allowVariableZoom(t,r){let i=tv(78.5-t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height/2,0,60);return!!r.terrain||t.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}};let mH=ou([{name:"a_pos3d",type:"Int16",components:3}]);var mW=class extends re{constructor(t){super(),this._lastTilesetChange=dg(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(t,r){this.tileManager.update(t,r),this._renderableTilesKeys=[];let i={},n=!1;for(let a of pG(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r}))i[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),ej(a.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[a.key]=new pL(a,this.tileSize),this._lastTilesetChange=dg(),n=!0);for(let t in this._tiles)i[t]||(this._tiles[t].releaseRTT(this.tileManager.map.painter),delete this._tiles[t],n=!0);return n}releaseRTT(t){for(let r in this._tiles){let i=this._tiles[r];(i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&i.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let t in this._tiles)this._tiles[t].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,r){return r?this._getTerrainCoordsForTileRanges(t,r):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let r={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID,a=t.clone(),o=to();if(n.canonical.equals(t.canonical))ej(o,0,8192,8192,0,0,1);else if(n.canonical.isChildOf(t.canonical)){let r=n.canonical.z-t.canonical.z,i=n.canonical.x-(n.canonical.x>>r<<r),a=n.canonical.y-(n.canonical.y>>r<<r),s=8192>>r;ej(o,0,s,s,0,0,1),eN(o,o,[-i*s,-a*s,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;let r=t.canonical.z-n.canonical.z,i=t.canonical.x-(t.canonical.x>>r<<r),a=t.canonical.y-(t.canonical.y>>r<<r),s=8192>>r;ej(o,0,8192,8192,0,0,1),eN(o,o,[i*s,a*s,0]),eL(o,o,[1/2**r,1/2**r,0])}a.terrainRttPosMatrix32f=new Float32Array(o),r[i]=a}return r}_getTerrainCoordsForTileRanges(t,r){let i={};for(let n of this._renderableTilesKeys){let a=this._tiles[n].tileID;if(!this._isWithinTileRanges(a,r))continue;let o=t.clone(),s=to();if(a.canonical.z===t.canonical.z){let r=t.canonical.x-a.canonical.x+t.wrap*(1<<t.canonical.z),i=t.canonical.y-a.canonical.y;ej(s,0,8192,8192,0,0,1),eN(s,s,[8192*r,8192*i,0])}else if(a.canonical.z>t.canonical.z){let r=a.canonical.z-t.canonical.z,i=a.canonical.x-(a.canonical.x>>r<<r)+t.wrap*(1<<a.canonical.z),n=a.canonical.y-(a.canonical.y>>r<<r),o=t.canonical.x-(a.canonical.x>>r),l=t.canonical.y-(a.canonical.y>>r),u=8192>>r;ej(s,0,u,u,0,0,1),eN(s,s,[-i*u+8192*o,-n*u+8192*l,0])}else{let r=t.canonical.z-a.canonical.z,i=t.canonical.x-(t.canonical.x>>r<<r)+t.wrap*(1<<t.canonical.z),n=t.canonical.y-(t.canonical.y>>r<<r),o=(t.canonical.x>>r)-a.canonical.x,l=(t.canonical.y>>r)-a.canonical.y,u=8192<<r;ej(s,0,u,u,0,0,1),eN(s,s,[8192*i+o*u,8192*n+l*u,0])}o.terrainRttPosMatrix32f=new Float32Array(s),i[n]=o}return i}getSourceTile(t,r){let i=this.tileManager._source,n=t.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return;this._sourceTileCache[t.key]||=t.scaledTo(n).key;let a=this.findTileInCaches(this._sourceTileCache[t.key]);if(!a?.dem&&r)for(;n>=i.minzoom&&!a?.dem;)a=this.findTileInCaches(t.scaledTo(n--).key);return a}findTileInCaches(t){let r=this.tileManager.getTileByID(t);return r||(r=this.tileManager._outOfViewCache.getByKey(t))}anyTilesAfterTime(t=dg()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,r){let i=r[t.canonical.z];return!!i&&(t.wrap>i.minWrap||t.wrap<i.maxWrap||t.canonical.x>=i.minTileXWrapped&&t.canonical.x<=i.maxTileXWrapped&&t.canonical.y>=i.minTileY&&t.canonical.y<=i.maxTileY)}};let mZ=8192*(1-1e-12);var mY=class{constructor(t,r,i,n="auto"){this._meshCache={},this.painter=t,this.tileManager=new mW(r),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this._terrainSkirtLength=n,this.qual
868ityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){for(let t in this._fbo&&=(this._fbo.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null),this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,r,i,n=8192){let a=t.normalizeCoordinates(r,i,n);if(!a)return 0;let o=this.getElevationSampler(a.tileID);return o?o(a.x,a.y,n):0}getElevationForLngLatZoom(t,r){if(!ho(r,t.wrap()))return 0;let{tileID:i,mercatorX:n,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(t,r);return this.getElevation(i,n%8192,a%8192,8192)}getElevationForLngLat(t,r){let i=this.getCoverageIndex();if(i){let r=ud.fromLngLat(t),n=mK(i,this.exaggeration,r.x,r.y);if(n.demLoaded)return n.elevation}let n=pG(r,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let t of n)t.canonical.z>a&&(a=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,a)}getElevation(t,r,i,n=8192){return this.getDEMElevation(t,r,i,n)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return void 0===this._coverageIndex&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let t=[],r=new Map,i=0,n=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:o,wrap:s}=a.tileID;t.includes(o.z)||t.push(o.z);let l=this.getElevationSampler(a.tileID);r.set(`${s}/${o.z}/${o.x}/${o.y}`,l);let{minElevation:u,maxElevation:c}=this.getMinMaxElevation(a.tileID);i=Math.min(i,u??0),n=Math.max(n,c??0)}return 0===r.size?null:(t.sort((t,r)=>r-t),{zooms:t,samplerPerTile:r,minElevation:i-10,maxElevation:n+10})}getElevationSampler(t){let r=t.key,i=this._elevationSamplerCache.get(r);if(i)return i;let n=this.tileManager.getSourceTile(t,!0),a=n?.dem;if(!n||!a)return null;let o=this._getDEMTileMatrix(t,n),s=o[0]*a.dim,l=o[5]*a.dim,u=o[12]*a.dim+-.5,c=o[13]*a.dim+-.5,h=(t,r,i)=>{let n=8192===i?1:8192/i;return a.sampleBilinear(t*n*s+u,r*n*l+c)};return this._elevationSamplerCache.set(r,h),h}_getDEMTileMatrix(t,r){var i,n;let a=`${r.tileID.key}/${t.key}`,o=this._demMatrixCache.get(a);if(o)return o;let s=t.canonical.z-r.tileID.canonical.z,l=t.canonical.x-(t.canonical.x>>s<<s),u=t.canonical.y-(t.canonical.y>>s<<s),c=(i=new Float64Array(16),n=[1/(8192<<s),1/(8192<<s),0],i[0]=n[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=n[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=n[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i);return eN(c,c,[8192*l,8192*u,0]),this._demMatrixCache.set(a,c),c}getTerrainData(t){if(!this._emptyDemTexture){let t=this.painter.context,r=new lr({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new lh(t,r,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new lh(t,new lr({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=eI([])}let r=this.tileManager.getSourceTile(t,!0);if(r?.dem&&(!r.demTexture||r.needsTerrainPrepare)){let t=this.painter.context;r.demTexture||=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new lh(t,r.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),r.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}let i=r?this._getDEMTileMatrix(t,r):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:r?.dem?.dim||1,u_terrain_matrix:i,u_terrain_unpack:r?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(r?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:r}}getFramebuffer(){let t=this.painter,r=t.width/devicePixelRatio,i=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new lh(t.context,{width:r,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(r,i,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,r,i))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}getTerrainMesh(t){let r=this.painter.style.projection?.transitionState>0,i=r&&0===t.canonical.y,n=r&&t.canonical.y===(1<<t.canonical.z)-1,a=`m_${i?"n":""}_${n?"s":""}`;if(this._meshCache[a])return this._meshCache[a];let o=this.painter.context,s=new oZ,l=new se,u=this.meshSize,c=8192/u,h=u*u;for(let t=0;t<=u;t++)for(let r=0;r<=u;r++)s.emplaceBack(r*c,t*c,0);for(let t=0;t<h;t+=u+1)for(let r=0;r<u;r++)l.emplaceBack(r+t,u+r+t+1,u+r+t+2),l.emplaceBack(r+t,u+r+t+2,r+t+1);"none"!==this._terrainSkirtLength&&this._buildSkirts(s,l,u,c,i,n);let f=new pE(o.createVertexBuffer(s,mH.members),o.createIndexBuffer(l),sa.simpleSegment(0,0,s.length,l.length));return this._meshCache[a]=f,f}getSkirtLength(t){return 2*Math.PI*6371008.8/2**Math.max(t,0)/5}getMinTileElevationForLngLatZoom(t,r){if(!ho(r,t.wrap()))return 0;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(t,r);return this.getMinMaxElevation(i).minElevation??0}getMinMaxElevation(t){let r=this.tileManager.getSourceTile(t,!0),i={minElevation:null,maxElevation:null};return r?.dem&&(i.minElevation=r.dem.min*this.exaggeration,i.maxElevation=r.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(t,r){let i=ud.fromLngLat(t.wrap()),n=(1<<r)*8192,a=i.x*n,o=i.y*n;return{tileID:new hu(r,0,r,Math.floor(a/8192),Math.floor(o/8192)),mercatorX:a,mercatorY:o}}_buildSkirts(t,r,i,n,a,o){let s=t.length,l=s+(i+1),u=(i+1)*i,c=a?-32768:0,h=+!a,f=
868o?32767:8192,d=+!o;for(let r=0;r<=i;r++)t.emplaceBack(r*n,c,h);for(let r=0;r<=i;r++)t.emplaceBack(r*n,f,d);for(let t=0;t<i;t++)r.emplaceBack(u+t,l+t,l+t+1),r.emplaceBack(u+t,l+t+1,u+t+1),r.emplaceBack(0+t,s+t+1,s+t),r.emplaceBack(0+t,0+t+1,s+t+1);let p=t.length,m=p+(i+1)*2;for(let r of[0,1])for(let a=0;a<=i;a++)for(let i of[0,1])t.emplaceBack(8192*r,a*n,i);for(let t=0;t<2*i;t+=2)r.emplaceBack(p+t,p+t+1,p+t+3),r.emplaceBack(p+t,p+t+3,p+t+2),r.emplaceBack(m+t,m+t+3,m+t+1),r.emplaceBack(m+t,m+t+2,m+t+3)}};let mX={covered:!1,demLoaded:!1,elevation:0};function mK(t,r,i,n){if(n<0||n>=1)return mX;let a=Math.floor(i),o=i-a;for(let i of t.zooms){let s=1<<i,l=o*s,u=n*s,c=Math.floor(l),h=Math.floor(u),f=`${a}/${i}/${c}/${h}`;if(!t.samplerPerTile.has(f))continue;let d=t.samplerPerTile.get(f);return d?{covered:!0,demLoaded:!0,elevation:d(Math.min((l-c)*8192,mZ),Math.min((u-h)*8192,mZ),8192)*r}:{covered:!0,demLoaded:!1,elevation:0}}return mX}function mQ(t,r){return t.covered&&r<=t.elevation+1e-6}function mJ(t,r,i,n,a){for(let o=0;o<40&&n-i>a;o++){let a=(i+n)/2;r(t,a)?n=a:i=a}return{lo:i,hi:n}}var m0=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t,r){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,r)=>{r=tv(+r,this.minZoom,this.maxZoom);let i={center:new uo(t.lng,t.lat),zoom:r},n=this._helper._lngRange;this._helper._renderWorldCopies||null!==n||(n=[-179.9999999999,180-1e-10]);let a=this.tileSize*tE(i.zoom),o=0,s=a,l=0,u=a,c=0,h=0,{x:f,y:d}=this.size;if(this._helper._latRange){let t=this._helper._latRange;o=uc(t[1])*a,(s=uc(t[0])*a)-o<d&&(c=d/(s-o))}n&&(l=t_(uu(n[0])*a,0,a),(u=t_(uu(n[1])*a,0,a))<l&&(u+=a),u-l<f&&(h=f/(u-l)));let{x:p,y:m}=um(a,t),g,y,v=Math.max(h||0,c||0);if(v)return i.center=ug(a,new eT(h?(u+l)/2:p,c?(s+o)/2:m)).wrap(),i.zoom+=tT(v),i;if(this._helper._latRange){let t=d/2;
vendor: 4,684 bytes, line 868
868m-t<o&&(y=o+t),m+t>s&&(y=s-t)}if(n){let t=(l+u)/2,r=p;this._helper._renderWorldCopies&&(r=t_(p,t-a/2,t+a/2));let i=f/2;r-i<l&&(g=l+i),r+i>u&&(g=u-i)}return(void 0!==g||void 0!==y)&&(i.center=ug(a,new eT(g??p,y??m)).wrap()),i},this.applyConstrain=(t,r)=>this._helper.applyConstrain(t,r),this._helper=r??new mG({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,r)=>this.defaultConstrain(t,r)},t),this._coveringTilesDetailsProvider=new mq}clone(){let r=new t;return r.apply(this,!1),r}apply(t,r){this._helper.apply(t,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let r=[new hl(0,t)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new eT(0,0)),n=this.screenPointToMercatorCoordinate(new eT(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new eT(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new eT(0,this._helper._height)),s=Math.floor(Math.min(i.x,n.x,a.x,o.x)),l=Math.floor(Math.max(i.x,n.x,a.x,o.x));for(let i=s-1;i<=l+1;i++)0!==i&&r.push(new hl(i,t))}return r}getCameraFrustum(){return pz.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let r=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLat(r,this):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,r,i=this.elevation){let n=i-this.elevation,a=this.screenPointToMercatorCoordinateAtZ(r,n),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),s=ud.fromLngLat(t),l=new ud(s.x-(a.x-o.x),s.y-(a.y-o.y));this.setCenter(l?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(ud.fromLngLat(t),r.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(ud.fromLngLat(t))}screenPointToLocation(t,r){return this.screenPointToMercatorCoordinate(t,r)?.toLngLat()}screenPointToLocationAtElevation(t,r){return this.screenPointToMercatorCoordinateAtZ(t,r-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(t,r){if(r){let i=this.screenTerrainPointToMercatorCoordinate(t,r);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenTerrainPointToMercatorCoordinate(t,r){let i=r.getCoverageIndex();if(!i)return null;let{near:n,far:a}=this.getRaySegmentFromPixel(t),o=this.worldSize,s=a[0]-n[0],l=a[1]-n[1],u=a[2]-n[2],c={index:i,exaggeration:r.exaggeration,near:n,dx:s,dy:l,dz:u,worldSize:o},h=0,f=1;if(0===u){if(n[2]>i.maxElevation||n[2]<i.minElevation)return null}else{let t=(i.maxElevation-n[2])/u,r=(i.minElevation-n[2])/u;if((h=Math.max(h,Math.min(t,r)))>(f=Math.min(f,Math.max(t,r))))return null}let d=Math.hypot(s,l),p=tv(Math.ceil(d*(f-h)/4),1,512),m=0,g=!m2(c,0);for(let t=0;t<=p;t++){let r=h+(f-h)*t/p;if(g){if(m2(c,r)){let{lo:t,hi:i}=mJ(c,m2,m,r,.001/d),a=m1(c,t),h=m1(c,i),f=n[2]+t*u-a.elevation,p=n[2]+i*u-h.elevation,g=a.covered&&f>p?tv(t+f*(i-t)/(f-p),t,i):i;return new ud((n[0]+g*s)/o,(n[1]+g*l)/o,m1(c,g).elevation)}}else g=!m2(c,r);m=r}return null}getRaySegmentFromPixel(t){let r=[t.x,t.y,0,1],i=[t.x,t.y,1,1];e2(r,r,this._pixelMatrixInverse),e2(i,i,this._pixelMatrixInverse);let n=r[3],a=i[3],o=this.elevation;return{near:[r[0]/n,r[1]/n,r[2]/n+o],far:[i[0]/a,i[1]/a,i[2]/a+o]}}screenPointToMercatorCoordinateAtZ(t,r){let i=r||0,{near:n,far:a}=this.getRaySegmentFromPixel(t),o=n[2]===a[2]?0:(i+this.elevation-n[2])/(a[2]-n[2]);return new ud(il.number(n[0],a[0],o)/this.worldSize,il.number(n[1],a[1],o)/this.worldSize,i)}coordinatePoint(t,r=0,i=this._pixelMatrix){let n=this._coordinateClipPoint(t,r,i),a=n[3];return a>0?new eT(n[0]/a,n[1]/a):this._offScreenPointBehindCamera(n[0],n[1],a)}_coordinateClipPoint(t,r,i){let n=[t.x*this.worldSize,t.y*this.worldSize,r,1];return e2(n,n,i)}_offScreenPointBehindCamera(t,r,i){let n=this.width/2,a=this.height/2,o=t-n*i,s=r-a*i;0===o&&0===s&&(s=1);let l=n+this.width,u=a+this.height,c=Math.min(0===o?1/0:l/Math.abs(o),0===s?1/0:u/Math.abs(s));return new eT(n+o*c,a+s*c)}getBounds(){let t=Math.max(0,this._helper._height/2-uy(this));return new ph().extend(this.screenPointToLocation(new eT(0,t))).extend(this.screenPointToLocation(new eT(this._helper._width,t))).extend(this.screenPointToLocation(new eT(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new eT(0,this._helper._height)))}
868isPointOnMapSurface(t,r){return r?null!=this.screenTerrainPointToMercatorCoordinate(t,r):t.y>this.height/2-uy(this)}calculatePosMatrix(t,r=!1,i=!1){let n=t.key??hc(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),a=r?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(n)){let t=a.get(n);return i?t.f32:t.f64}let o=uv(t,this.worldSize);eO(o,r?this._alignedProjMatrix:this._viewProjMatrix,o);let s={f64:o,f32:new Float32Array(o)};return a.set(n,s),i?s.f32:s.f64}calculateFogMatrix(t){let r=t.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);let n=uv(t,this.worldSize);return eO(n,this._fogMatrix,n),i.set(r,new Float32Array(n)),i.get(r)}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}calculateCameraOptionsFromTo(t,r,i,n){let a=ud.fromLngLat(t,r),o=ud.fromLngLat(i,n),s=o.x-a.x,l=o.y-a.y,u=o.z-a.z,c=Math.hypot(s,l,u);if(0===c)throw Error("Can't calculate camera options with same From and To");let h=Math.hypot(s,l),f=tT(this.cameraToCenterDistance/c/this.tileSize),d=tj(Math.atan2(s,-l)),p=tj(Math.acos(h/c));return p=u<0?90-p:90+p,{center:o.toLngLat(),elevation:n,zoom:f,pitch:p,bearing:d}}_calculateNearFarZ(t,r,i){let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=t-n*this._helper._pixelPerMeter/Math.cos(r),o=n<0?a:t,s=Math.PI/2+this.pitchInRadians,l=tz(this.fov)*(Math.abs(Math.cos(tz(this.roll)))*this.height+Math.abs(Math.sin(tz(this.roll)))*this.width)/this.height*(.5+i.y/this.height),u=Math.sin(l)*o/Math.sin(tv(Math.PI-s-l,.01,Math.PI-.01)),c=uy(this),h=Math.atan(c/this._helper.cameraToCenterDistance),f=tz(.75),d=h>f?2*h*(.5+i.y/(2*c)):f,p=Math.min(u,Math.sin(d)*o/Math.sin(tv(Math.PI-s-d,.01,Math.PI-.01)));this._helper._farZ=(Math.cos(Math.PI/2-r)*p+o)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(t=this._helper.autoCalculateNearFarZ){var r,i;let n,a=this.centerOffset,o=um(this.worldSize,this.center),s=o.x,l=o.y,u=tz(Math.min(this.pitch,89.25)),c=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(u));t&&this._calculateNearFarZ(c,u,a),ez(n=new Float64Array(16),this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),r=this._invProjMatrix,i=n,r[0]=1/i[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1/i[5],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=0,r[11]=1/i[14],r[12]=0,r[13]=0,r[14]=-1,r[15]=i[10]/i[14],n[8]=-(2*a.x)/this._helper._width,n[9]=2*a.y/this._helper._height,this._projectionMatrix=eP(n),eL(n,n,[1,-1,1]),eN(n,n,[0,0,-this._helper.cameraToCenterDistance]),eB(n,n,-this.rollInRadians),eR(n,n,this.pitchInRadians),eB(n,n,-this.bearingInRadians),eN(n,n,[-s,-l,0]),this._mercatorMatrix=eL([],n,[this.worldSize,this.worldSize,this.worldSize]),eL(n,n,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=eO(new Float64Array(16),this.clipSpaceToPixelsMatrix,n),eN(n,n,[0,0,-this.elevation]),this._viewProjMatrix=n,this._invViewProjMatrix=ek([],n);let h=[0,0,-1,1];e2(h,h,this._invViewProjMatrix),this._cameraPosition=[h[0]/h[3],h[1]/h[3],h[2]/h[3]],this._fogMatrix=new Float64Array(16),ez(this._fogMatrix,this.fovInRadians,this.width/this.height,c,this._helper._farZ),this._fogMatrix[8]=-(2*a.x)/this.width,this._fogMatrix[9]=2*a.y/this.height,eL(this._fogMatrix,this._fogMatrix,[1,-1,1]),eN(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),eB(this._fogMatrix,this._fogMatrix,-this.rollInRadians),eR(this._fogMatrix,this._fogMatrix,this.pitchInRadians),eB(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),eN(this._fogMatrix,this._fogMatrix,[-s,-l,0]),eL(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),eN(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=eO(new Float64Array(16),this.clipSpaceToPixelsMatrix,n);let f=this._helper._width%2/2,d=this._helper._height%2/2,p=Math.cos(this.bearingInRadians),m=Math.sin(-this.bearingInRadians),g=s-Math.round(s)+p*f+m*d,y=l-Math.round(l)+p*d+m*f,v=new Float64Array(n);if(eN(v,v,[g>.5?g-1:g,y>.5?y-1:y,0]),this._alignedProjMatrix=v,!(n=ek(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=n,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new eT(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e2(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let t=1/ul(this.center.lat)*this.worldSize,r=this._helper.cameraToCenterDistance/t;return u_(this.center,this.elevation,this.pitch,this.bearing,r).toLngLat()}getProjectionData(t){let{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=t,a=this._helper.getMercatorTileCoordinates(r),o=r?this.calculatePosMatrix(r,i,!0):null,s;return{mainMatrix:s=r?.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:o||tl(),tileMercatorCoords:a,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s,clipAntimeridian:!1}}isLocationOccluded(t,r,i){if(!r?.getCoverageIndex())return!1;let n=ud.fromLngLat(t);i??=r.getElevationForLngLat(t,this);let a=this._coordinateClipPoint(n,i,this._pixelMatrix3D),o=a[3];if(o<=0||a[2]>o)return!0;let s=new eT(a[0]/o,a[1]/o),l=this.screenTerrainPointToMercatorCoordinate(s,r);if(null==l)return!1;let u=this.getRaySegmentFromPixel(s),c=m3(u,n.x*this.worldSize,n.y*this.worldSize,i);return m3(u,l.x*this.worldSize,l.y*this.worldSize,l.z)<.99*c}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,r,i){return 1}transformLightDirection(t){return eV(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,r,i,n){let a=this.calculatePosMatrix(i),o;null==n?ms(o=[t,r,0,1],o,a):e2(o=[t,r,n,1],o,a);let s=o[3];return{point:new eT(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(let r of t)this.calculatePosMatrix(r)}getProjectionDataForCustomLayer(t=!0){let r=new hu(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),n=uv(r,this.worldSize);eO(n,this._viewProjMatrix,n);let a=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],o=to();return eL(o,n,a),{...i,tileMercatorCoords:[0,0,1,1],fallbackMatrix:o,mainMatrix:o}}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}};function m1(t,r){return mK(t.index,t.exaggeration,(t.near[0]+r*t.dx)/t.worldSize,(t.near[1]+r*t.dy)/t.worldSize)}function m2(t,r){return mQ(m1(t,r),t.near[2]+r*t.dz)}function m3({near:t,far:r},i,n,a){let o=r[0]-t[0],s=r[1]-t[1],l=r[2]-t[2];return((i-t[0])*o+(n-t[1])*s+(a-t[2])*l)/(o*o+s*s+l*l)}function m4(){tI("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function m6(t){if(t.useSlerp)if(t.k<1){var r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D,P,I,k;let O,N,L,R,F=t$(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),B=t$(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),z=new Float64Array(4);r=t.k,s=F[0],l=F[1],u=F[2],c=F[3],h=B[0],f=B[1],(m=s*h+l*f+u*(d=B[2])+c*(p=B[3]))<0&&(m=-m,h=-h,f=-f,d=-d,p=-p),1-m>1e-6?(n=Math.sin(i=Math.acos(m)),a=Math.sin((1-r)*i)/n,o=Math.sin(r*i)/n):(a=1-r,o=r),z[0]=a*s+o*h,z[1]=a*l+o*f,z[2]=a*u+o*d,z[3]=a*c+o*p;let j=(g=O=new Float64Array(9),y=z[0],v=z[1],_=z[2],b=z[3],x=y+y,w=v+v,E=_+_,T=y*x,A=v*x,S=v*w,C=_*x,M=_*w,D=_*E,P=b*x,I=b*w,k=b*E,g[0]=1-S-D,g[3]=A-k,g[6]=C+I,g[1]=A+k,g[4]=1-T-D,g[7]=M-P,g[2]=C-I,g[5]=M+P,g[8]=1-T-S,N=tj(-Math.asin(tv(O[2],-1,1))),.001>Math.hypot(O[5],O[8])?(L=0,R=-tj(Math.atan2(O[3],O[4]))):(L=tj(0===O[5]&&0===O[8]?0:Math.atan2(O[5],O[8])),R=tj(0===O[1]&&0===O[0]?0:Math.atan2(O[1],O[0]))),{roll:L,pitch:N+90,bearing:R});t.tr.setRoll(j.roll),t.tr.setPitch(j.pitch),t.tr.setBearing(j.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(il.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(il.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(il.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function m5(t,r,i,n,a){let o=a.padding,s=um(a.worldSize,i.getNorthWest()),l=um(a.worldSize,i.getNorthEast()),u=um(a.worldSize,i.getSouthEast()),c=um(a.worldSize,i.getSouthWest
868()),h=tz(-n),f=s.rotate(h),d=l.rotate(h),p=u.rotate(h),m=c.rotate(h),g=new eT(Math.max(f.x,d.x,m.x,p.x),Math.max(f.y,d.y,m.y,p.y)),y=new eT(Math.min(f.x,d.x,m.x,p.x),Math.min(f.y,d.y,m.y,p.y)),v=g.sub(y),_=a.width-(o.left+o.right+r.left+r.right),b=a.height-(o.top+o.bottom+r.top+r.bottom),x=_/v.x,w=b/v.y;if(w<0||x<0)return void m4();let E=Math.min(tT(a.scale*Math.min(x,w)),t.maxZoom),T=eT.convert(t.offset),A=new eT((r.left-r.right)/2,(r.top-r.bottom)/2).rotate(tz(n)),S=T.add(A).mult(a.scale/tE(E));return{center:ug(a.worldSize,s.add(u).div(2).sub(S)),zoom:E,bearing:n}}var m8=class{get useGlobeControls(){return!1}handlePanInertia(t,r){let i=t.mag(),n=Math.abs(uy(r));return{easingOffset:t.mult(Math.min(.75*n/i,1)),easingCenter:r.center}}handleMapControlsRollPitchBearingZoom(t,r){t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta),t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta)}handleMapControlsPan(t,r,i){.01>t.around.distSqr(r.centerPoint)||r.setLocationAtPoint(i,t.around,t.aroundElevation)}cameraForBoxAndBearing(t,r,i,n,a){return m5(t,r,i,n,a)}handleJumpToCenterZoom(t,r){let i=void 0===r.zoom?t.zoom:+r.zoom;t.zoom!==i&&t.setZoom(+r.zoom),void 0!==r.center&&t.setCenter(uo.convert(r.center))}handleEaseTo(t,r){let i=t.zoom,n=t.padding,a={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},s=void 0!==r.zoom,l=!t.isPaddingEqual(r.padding),u=!1,c=s?+r.zoom:t.zoom,h=t.centerPoint.add(r.offsetAsPoint),f=t.screenPointToLocation(h),{center:d,zoom:p}=t.applyConstrain(uo.convert(r.center||f),c??i);mV(t,d);let m=um(t.worldSize,f),g=um(t.worldSize,d).sub(m),y=tE(p-i);return{easeFunc:s=>{if(u&&t.setZoom(il.number(i,p,s)),tU(a,o)||m6({startEulerAngles:a,endEulerAngles:o,tr:t,k:s,useSlerp:a.roll!=o.roll}),l&&(t.interpolatePadding(n,r.padding,s),h=t.centerPoint.add(r.offsetAsPoint)),r.around)t.setLocationAtPoint(r.around,r.aroundPoint);else{let r=tE(t.zoom-i),n=(p>i?Math.min(2,y):Math.max(.5,y))**(1-s),a=ug(t.worldSize,m.add(g.mult(s*n)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?a.wrap():a,h)}},isZooming:u=p!==i,elevationCenter:d}}handleFlyTo(t,r){let i=void 0!==r.zoom,n=t.zoom,a=t.applyConstrain(uo.convert(r.center||r.locationAtOffset),i?+r.zoom:n),o=a.center,s=a.zoom;mV(t,o);let l=t.worldSize,u=um(l,r.locationAtOffset),c=um(l,o).sub(u),h=c.mag(),f=tE(s-n),d=Math.min(Math.max(void 0===r.minZoom?t.minZoom:+r.minZoom,t.minZoom),n,s),p=t.applyConstrain(o,d).zoom;return{easeFunc:(r,i,a,h)=>{t.setZoom(1===r?s:n+tT(i));let f=1===r?o:ug(l,u.add(c.mult(a)));t.setLocationAtPoint(t.renderWorldCopies?f.wrap():f,h)},scaleOfZoom:f,targetCenter:o,scaleOfMinZoom:tE(p-n),pixelPathLength:h}}};let m7=new lY({fill:new lZ(128,2),line:new lZ(512,0),tile:new lZ(128,32),stencil:new lZ(128,1),circle:3});var m9=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return mR.projectionGlobe}get vertexShaderPreludeCode(){return mR.projectionMercator.vertexSource}get subdivisionGranularity(){return m7}get useGlobeControls(){return!0}destroy(){}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,r,i,n,a){let o=("stencil"===a?m7.stencil:m7.tile).getGranularityForZoomLevel(r.z),s=0===r.y&&n,l=r.y===(1<<r.z)-1&&n;return this._getMesh(t,{granularity:o,generateBorders:i,extendToNorthPole:s,extendToSouthPole:l})}_getMesh(t,r){let i=this._getMeshKey(r);if(i in this._tileMeshCache)return this._tileMeshCache[i];let n=pA(t,r);return this._tileMeshCache[i]=n,n}recalculate(t){}hasTransition(){return!1}},ge=class extends re{constructor(t,r){super(),this._transitionable=new aX(I||=new a9({type:new a4(rt.projection.type,"type")}),"projection",r),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new aW(0)),this._mercatorProjection=new mj,this._verticalPerspectiveProjection=new m9}get transitionState(){let t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof r3){if(t.from===t.to)return+("mercator"!==t.from);if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(t,r,i,n,a){return this.currentProjection.getMeshFromTileID(t,r,i,n,a)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}};function gt(t){return 2*Math.PI*gn(t.worldSize,t.center.lat)}function gr(t,r,i,n,a){var o;let s=1/(1<<a),l=(((t/8192*s+i*s)*Math.PI*2+Math.PI)%(o=2*Math.PI)+o)%o,u=2*Math.atan(Math.exp(Math.PI-(r/8192*s+n*s)*Math.PI*2))-.5*Math.PI,c=Math.cos(u),h=new Float64Array(3);return h[0]=Math.sin(l)*c,h[1]=Math.sin(u),h[2]=Math.cos(l)*c,h}function gi(t){var r,i;let n,a;return r=t.lng*Math.PI/180,n=Math.cos(i=t.lat*Math.PI/180),(a=new Float64Array(3))[0]=Math.sin(r)*n,a[1]=Math.sin(i),a[2]=Math.cos(r)*n,a}function gn(t,r){return t/(2*Math.PI)/Math.cos(r*Math.PI/180)}function ga(t){let r=e2(tn(),[0,0,0,1],t.modelViewProjectionMatrix);return e2(r,r,t.inverseProjectionMatrix),[r[0]/r[3],r[1]/r[3],r[2]/r[3]]}function go(t){let r=Math.asin(t[1])/Math.PI*180,i=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(i>1e-6){let n=t[0]/i,a=Math.acos(t[2]/i);return new uo(t_((n>0?a:-a)/Math.PI*180,-180,180),r)}return new uo(0,r)}let gs=.98*Math.PI;function gl(t,r){let i=t.cameraPosition,n=e$(i);if(n<=1)return t.screenPointToLocation(r);let a=ta();eY(a,i);let o=t.getRayDirectionFromPixel(r),s=-eX(o,a),l=ta();eZ(l,o,a,s);let u=e$(l);if(u<1e-9)return t.screenPointToLocation(r);let c=Math.atan2(u,s),h=.9*Math.asin(1/n);if(c<h)return t.screenPointToLocation(r);let f=n*Math.sin(h),d=Math.asin(tv(f,-1,1))-h,p=n*Math.cos(h)/Math.sqrt(Math.max(1-f*f,1e-12))-1,m=gs-d,g=c-h,y=d+p*g*m/(m+p*g),v=ta();eW(v,l,1/u);let _=ta();return eW(_,a,Math.cos(tv(y,0,gs))),eZ(_,_,v,Math.sin(tv(y,0,gs))),eY(_,_),go(_)}function gu(t){return Math.cos(t*Math.PI/180)}function gc(t,r){let i=gu(t);return tT(gu(r)/i)}function gh(t){let r=.5*t,i=Math.sin(r),n=Math.cos(r);return Math.log(i+n)-Math.log(n-i)}function gf(t,r,i,n){let a=t.lat+i*n;if(Math.abs(i)>1){let o=(Math.sign(t.lat+i)===Math.sign(t.lat)?Math.abs(t.lat):-Math.abs(t.lat))*Math.PI/180,s=Math.abs(t.lat+i)*Math.PI/180,l=gh(o+n*(s-o)),u=gh(o),c=gh(s);return new uo(t.lng+(l-u)/(c-u)*r,a)}return new uo(t.lng+r*n,a)}function gd(t,r,i=1){let n=eX(t,r),a=i*i,o=ta(),s=ta();eW(s,r,n),eH(o,t,s);let l=a-eX(o,o);if(l<0)return null;let u=eX(t,t)-a,c=-n+(n<0?1:-1)*Math.sqrt(l),h=u/c;return{tMin:Math.min(h,c),tMax:Math.max(h,c)}}function gp(t,r){let i=.01569612305760477*r,n=tv((t-i)/(9*i),0,1);return n*n*(3-2*n)}var gm=class{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,r,i,n){let a=`${t.z}_${t.x}_${t.y}_${n?.terrain?"t":""}_${Math.round(i)}`,o=this._cache.get(a);if(o)return o;let s=this._cachePrevious.get(a);if(s)return this._cache.set(a,s),s;let l=this._boundingVolumeFactory(t,r,i,n);return this._cache.set(a,l),this._hadAnyChanges=!0,l}},gg=class t{constructor(t,r,i,n){this.min=i,this.max=n,this.points=t,this.planes=r}static fromAabb(r,i){let n=[];for(let t=0;t<8;t++)n.push([(1&t)==1?i[0]:r[0],(t>>1&1)==1?i[1]:r[1],(t>>2&1)==1?i[2]:r[2]]);return new t(n,[[-1,0,0,i[0]],[1,0,0,-r[0]],[0,-1,0,i[1]],[0,1,0,-r[1]],[0,0,-1,i[2]],[0,0,1,-r[2]]],r,i)}
868static fromCenterSizeAngles(r,i,n){let a=e4([],n[0],n[1],n[2]),o=eQ([],[i[0],0,0],a),s=eQ([],[0,i[1],0],a),l=eQ([],[0,0,i[2]],a),u=[...r],c=[...r];for(let t=0;t<8;t++)for(let i=0;i<3;i++){let n=r[i]+o[i]*((1&t)==1?1:-1)+s[i]*((t>>1&1)==1?1:-1)+l[i]*((t>>2&1)==1?1:-1);u[i]=Math.min(u[i],n),c[i]=Math.max(c[i],n)}let h=[];for(let t=0;t<8;t++){let i=[...r];eq(i,i,eW([],o,(1&t)==1?1:-1)),eq(i,i,eW([],s,(t>>1&1)==1?1:-1)),eq(i,i,eW([],l,(t>>2&1)==1?1:-1)),h.push(i)}return new t(h,[[...o,-eX(o,h[0])],[...s,-eX(s,h[0])],[...l,-eX(l,h[0])],[-o[0],-o[1],-o[2],-eX(o,h[7])],[-s[0],-s[1],-s[2],-eX(s,h[7])],[-l[0],-l[1],-l[2],-eX(l,h[7])]],u,c)}intersectsFrustum(t){let r=!0,i=this.points.length,n=this.planes.length,a=t.planes.length,o=t.points.length;for(let n=0;n<a;n++){let a=t.planes[n],o=0;for(let t=0;t<i;t++){let r=this.points[t];a[0]*r[0]+a[1]*r[1]+a[2]*r[2]+a[3]>=0&&o++}if(0===o)return 0;o<i&&(r=!1)}if(r)return 2;for(let r=0;r<n;r++){let i=this.planes[r],n=0;for(let r=0;r<o;r++){let a=t.points[r];i[0]*a[0]+i[1]*a[1]+i[2]*a[2]+i[3]>=0&&n++}if(0===n)return 0}return 1}intersectsPlane(t){let r=this.points.length,i=0;for(let n=0;n<r;n++){let r=this.points[n];t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]>=0&&i++}return i===r?2:+(0!==i)}};function gy(t,r,i){let n=t-r;return n<0?-n:Math.max(0,n-i)}function gv(t,r,i,n,a){let o=t-i;return Math.max(o<0?Math.min(-o,1+o-a):o>a?Math.min(Math.max(o-a,0),1-o):0,gy(r,n,a))}var g_=class{constructor(){this._boundingVolumeCache=new gm(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,r,i,n){let a=1<<i.z,o=1/a,s=i.x/a,l=i.y/a;return Math.min(Math.min(Math.min(2,gv(t,r,s,l,o)),gv(t,r,s+.5,-l-o,o)),gv(t,r,s+.5,2-l-o,o))}getWrap(t,r,i){let n=1<<r.z,a=1/n,o=r.x/n,s=gy(t.x,o,a),l=gy(t.x,o-1,a),u=gy(t.x,o+1,a),c=Math.min(s,l,u);return c===u?1:c===l?-1:0}allowVariableZoom(t,r){return p$(t,r)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,r,i,n){return this._boundingVolumeCache.getTileBoundingVolume(t,r,i,n)}_computeTileBoundingVolume(t,r,i,n){let a=Math.min(0,i),o=Math.max(0,i);if(n?.terrain){let i=new hu(t.z,r,t.z,t.x,t.y),s=n.terrain.getMinMaxElevation(i);a=s.minElevation??a,o=Math.max(s.maxElevation??o,o)}if(a/=6371008.8,o/=6371008.8,a+=1,o+=1,t.z<=0)return gg.fromAabb([-o,-o,-o],[o,o,o]);if(1===t.z)return gg.fromAabb([0===t.x?-o:0,0===t.y?0:-o,-o],[0===t.x?0:o,0===t.y?o:0,o]);{let r=[gr(0,0,t.x,t.y,t.z),gr(8192,0,t.x,t.y,t.z),gr(8192,8192,t.x,t.y,t.z),gr(0,8192,t.x,t.y,t.z)],i=[];for(let t of r)i.push(eW([],t,o));if(o!==a)for(let t of r)i.push(eW([],t,a));0===t.y&&i.push([0,1,0]),t.y===(1<<t.z)-1&&i.push([0,-1,0]);let n=[1,1,1],s=[-1,-1,-1];for(let t of i)for(let r=0;r<3;r++)n[r]=Math.min(n[r],t[r]),s[r]=Math.max(s[r],t[r]);let l=gr(4096,4096,t.x,t.y,t.z),u=eK([],[0,1,0],l);eY(u,u);let c=eK([],l,u);eY(c,c);let h=eK([],r[2],r[1]);eY(h,h);let f=eK([],r[0],r[3]);eY(f,f),i.push(eW([],l,o)),t.y>=(1<<t.z)/2&&i.push(eW([],gr(4096,0,t.x,t.y,t.z),o)),t.y<(1<<t.z)/2&&i.push(eW([],gr(4096,8192,t.x,t.y,t.z),o));let d=gb(l,i),p=gb(c,i),m=[-l[0],-l[1],-l[2],d.max],g=[l[0],l[1],l[2],-d.min],y=[-c[0],-c[1],-c[2],p.max],v=[c[0],c[1],c[2],-p.min],_=[...h,0],b=[...f,0],x=[];return 0===t.y?x.push(th(b,_,m),th(b,_,g)):x.push(th(y,_,m),th(y,_,g),th(y,b,m),th(y,b,g)),t.y===(1<<t.z)-1?x.push(th(b,_,m),th(b,_,g)):x.push(th(v,_,m),th(v,_,g),th(v,b,m),th(v,b,g)),new gg(x,[m,g,y,v,_,b],n,s)}}};function gb(t,r){let i=1/0,n=-1/0;for(let a of r){let r=eX(t,a);i=Math.min(i,r),n=Math.max(n,r)}return{min:i,max:n}}var gx=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}
868interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r){this._helper.resize(t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t,r){this._cachedClippingPlane=tn(),this._projectionMatrix=ts(),this._globeViewProjMatrix32f=tl(),this._globeViewProjMatrixF64=ts(),this._globeViewProjMatrixF64Inverted=ts(),this._globeProjMatrixInverted=ts(),this._cameraPosition=ta(),this.defaultConstrain=(t,r)=>{let i=tv(t.lat,-85.051129,85.051129),n=tv(+r,this.minZoom+gc(0,i),this.maxZoom);return{center:new uo(t.lng,i),zoom:n}},this.applyConstrain=(t,r)=>this._helper.applyConstrain(t,r),this._helper=r??new mG({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,r)=>this.defaultConstrain(t,r)},t),this._coveringTilesDetailsProvider=new g_}clone(){let r=new t;return r.apply(this,!1),r}apply(t,r){this._helper.apply(t,r)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=ta();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:r,applyGlobeMatrix:i}=t,n=this._helper.getMercatorTileCoordinates(r);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:r?.canonical.z===0}}_computeClippingPlane(t){let r=this.pitchInRadians,i=this.cameraToCenterDistance/t,n=Math.sin(r)*i,a=Math.cos(r)*i+1,o=1/Math.sqrt(n*n+a*a)*1,s=-n,l=a,u=Math.sqrt(s*s+l*l),c=[0,s/=u,l/=u];e1(c,c,[0,0,0],-this.bearingInRadians),eJ(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),e0(c,c,[0,0,0],this.center.lng*Math.PI/180);let h=1/e$(c);return eW(c,c,h),[...c,-o*h]}isLocationOccluded(t,r,i){var n,a,o,s,l,u;let c=r?.getCoverageIndex();i??=c?r.getElevationForLngLat(t,this):0;let h=gT(t,i);if(!this.isSurfacePointVisible(h))return!0;if(!c)return!1;let f=this._projectSurfacePointToScreen(h),d=this.cameraPosition,p=this.getRayDirectionFromPixel(f),m=(n=d,a=p,o=h,eX(eH(ta(),o,n),a));if(m<=0)return!0;let g=this.screenTerrainPointToMercatorCoordinate(f,r);return null!=g&&(s=d,l=p,u=gT(g.toLngLat(),g.z),eX(eH(ta(),u,s),l)<.99*m)}transformLightDirection(t){let r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),a=[Math.sin(r)*n,Math.sin(i),Math.cos(r)*n],o=[a[2],0,-a[0]],s=[0,0,0];eK(s,o,a),eY(o,o),eY(s,s);let l=[o[0]*t[0]+s[0]*t[1]+a[0]*t[2],o[1]*t[0]+s[1]*t[1]+a[1]*t[2],o[2]*t[0]+s[2]*t[1]+a[2]*t[2]],u=[0,0,0];return eY(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,i){var n,a,o;let s=up(t,r,i.canonical),l=(n=s.x,a=s.y,[((n*Math.PI*2+Math.PI)%(o=2*Math.PI)+o)%o,2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);return this.getCircleRadiusCorrection()/Math.cos(l[1])}projectTileCoordinates(t,r,i,n){let a,o=i.canonical,s=gr(t,r,o.x,o.y,o.z),l=1+(n??0)/6371008.8,u=s[0]*l,c=s[1]*l,h=s[2]*l,f=[u,c,h,1];if(e2(f,f,this._globeViewProjMatrixF64),l<=1){let t=this._cachedClippingPlane;a=t[0]*s[0]+t[1]*s[1]+t[2]*s[2]+t[3]<0}else a=this._isLineOfSightBlocked(u,c,h);return{point:new eT(f[0]/f[3],f[1]/f[3]),signedDistanceFromCamera:f[3],isOccluded:a}}_isLineOfSightBlocked(t,r,i){let n=this._cameraPosition,a=t-n[0],o=r-n[1],s=i-n[2],l=a*a+o*o+s*s;if(0===l)return!1;
868let u=tv(-(n[0]*a+n[1]*o+n[2]*s)/l,0,1),c=n[0]+u*a,h=n[1]+u*o,f=n[2]+u*s;return c*c+h*h+f*f<1}_calcMatrices(t=this._helper.autoCalculateNearFarZ){let r=gn(this.worldSize,this.center.lat),i=to();t&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*r),ez(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;i[8]=-(2*n.x)/this._helper._width,i[9]=2*n.y/this._helper._height,this._projectionMatrix=eP(i),this._globeProjMatrixInverted=to(),ek(this._globeProjMatrixInverted,i),eN(i,i,[0,0,-this.cameraToCenterDistance]),eB(i,i,this.rollInRadians),eR(i,i,-this.pitchInRadians),eB(i,i,this.bearingInRadians),eN(i,i,[0,0,-r]);let a=ta();a[0]=r,a[1]=r,a[2]=r,eR(i,i,this.center.lat*Math.PI/180),eF(i,i,-this.center.lng*Math.PI/180),eL(i,i,a),this._globeViewProjMatrixF64=i,this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixF64Inverted=to(),ek(this._globeViewProjMatrixF64Inverted,i);let o=ta();this._cameraPosition=ta(),this._cameraPosition[2]=this.cameraToCenterDistance/r,e1(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),eJ(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),e1(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),eq(this._cameraPosition,this._cameraPosition,[0,0,1]),eJ(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),e0(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(r);let s=eP(this._globeViewProjMatrixF64Inverted);eL(s,s,[1,1,-1]),this._cachedFrustum=pz.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){tI("calculateFogMatrix is not supported on globe projection.");let r=to();return eI(r),r}getVisibleUnwrappedCoordinates(t){return[new hl(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t?tI("terrain is not fully supported on vertical perspective projection."):this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(e$(this._cameraPosition)-1)*6371008.8}getCameraLngLat(){let t=ta();return eY(t,this._cameraPosition),go(t)}populateCache(t){}getBounds(){let t=.5*this.width,r=.5*this.height,i=[new eT(0,0),new eT(t,0),new eT(this.width,0),new eT(this.width,r),new eT(this.width,this.height),new eT(t,this.height),new eT(0,this.height),new eT(0,r)],n=[];for(let t of i)n.push(this.unprojectScreenPoint(t));let a=0,o=0,s=0,l=0,u=this.center;for(let t of n){let r=td(u.lng,t.lng),i=td(u.lat,t.lat);r<o&&(o=r),r>a&&(a=r),i<l&&(l=i),i>s&&(s=i)}let c=[u.lng+o,u.lat+l,u.lng+a,u.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new ph(c)}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}calculateCameraOptionsFromTo(t,r,i,n){var a,o,s;let l=uo.convert(i),u=gi(uo.convert(t));eW(u,u,1+r/6371008.8);let c=gi(l),h=eW(ta(),c,1+n/6371008.8),f=eH(ta(),u,c),d=e$(f);if(d<1e-12||(a=h[0]-u[0],1e-12>Math.sqrt(a*a+(o=h[1]-u[1])*o+(s=h[2]-u[2])*s)))throw Error("Can't calculate camera options with same From and To");let p=ta();e0(f,f,p,-tz(l.lng)),eJ(f,f,p,tz(l.lat));let m=tj(Math.acos(tv(f[2]/d,-1,1))),g=Math.hypot(f[0],f[1])<1e-9*d?this.bearing:tj(Math.atan2(-f[0],-f[1]));return{center:l,elevation:n,zoom:tT(this.cameraToCenterDistance/d/gn(this.tileSize,l.lat)),pitch:m,bearing:g}}setLocationAtPoint(t,r,i){let n=gi(this.unprojectScreenPoint(r)),a=gi(t),o=ta();o[0]=0,o[1]=0,o[2]=0;let s=ta();e0(s,n,o,-this.center.lng*Math.PI/180),eJ(s,s,o,this.center.lat*Math.PI/180);let l=a[0]*a[0]+a[2]*a[2],u=s[0]*s[0];if(l<u)return;let c=Math.sqrt(l-u),h=tf(a[0],a[2],s[0],c),f=tf(a[0],a[2],s[0],-c),d=ta();e0(d,a,o,-h);let p=tf(d[1],d[2],s[1],s[2]),m=ta();e0(m,a,o,-f);let g=tf(m[1],m[2],s[1],s[2]),y=.5*Math.PI,v=p>=-y&&p<=y,_=g>=-y&&g<=y,b,x;if(v&&_){let t=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;tp(h,t)+tp(p,r)<tp(f,t)+tp(g,r)?(b=h,x=p):(b=f,x=g)}else if(v)b=h,x=p;else{if(!_)return;b=f,x=g}let w=b/Math.PI*180,E=x/Math.PI*180,T=this.center.lat;this.setCenter(new uo(w,tv(E,-90,90))),this.setZoom(this.zoom+gc(T,this.center.lat))}locationToScreenPoint(t,r){let i=gi(t);return r&&eW(i,i,1+r.getElevationForLngLatZoom(t,this._helper._tileZoom)/6371008.8),this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){let r=tn();return e2(r,[...t,1],this._globeViewProjMatrixF64),r[0]/=r[3],r[1]/=r[3],new eT((.5*r[0]+.5)*this.width,(-(.5*r[1])+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){let i=this.screenTerrainPointToMercatorCoordinate(t,r);
868if(i)return i}return ud.fromLngLat(this.unprojectScreenPoint(t))}screenTerrainPointToMercatorCoordinate(t,r){let i=r.getCoverageIndex();if(!i)return null;let n=this.cameraPosition,a=this.getRayDirectionFromPixel(t),o=gd(n,a,1+i.maxElevation/6371008.8);if(!o)return null;let s=gd(n,a,1+i.minElevation/6371008.8),l=Math.max(o.tMin,0),u=s?s.tMin:o.tMax;if(u<=l)return null;let c={index:i,exaggeration:r.exaggeration,origin:n,direction:a},h=0;for(let t=0;t<=256;t++){let r=l+(u-l)*t/256;if(gE(c,r)){let{hi:t}=mJ(c,gE,h,r,1e-12),{sample:i,mercator:n}=gw(c,t);return new ud(n.x,n.y,i.elevation)}h=r}return null}screenPointToLocation(t,r){return this.screenPointToMercatorCoordinate(t,r)?.toLngLat()}screenPointToLocationAtElevation(t,r){return this.screenPointToLocation(t)}isPointOnMapSurface(t,r){return!!gd(this._cameraPosition,this.getRayDirectionFromPixel(t))}getRayDirectionFromPixel(t){let r=tn();r[0]=t.x/this.width*2-1,r[1]=-((t.y/this.height*2-1)*1),r[2]=1,r[3]=1,e2(r,r,this._globeViewProjMatrixF64Inverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];let i=ta();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];let n=ta();return eY(n,i),n}isSurfacePointVisible(t){let r=this._cachedClippingPlane;return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let r=tn();return e2(r,[...t,1],this._globeViewProjMatrixF64),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}unprojectScreenPoint(t){var r,i;let n,a,o,s=this._cameraPosition,l=this.getRayDirectionFromPixel(t),u=gd(s,l);if(u){let t=ta();eq(t,s,[l[0]*u.tMin,l[1]*u.tMin,l[2]*u.tMin]);let r=ta();return eY(r,t),go(r)}let c=this._cachedClippingPlane,h=c[0]*l[0]+c[1]*l[1]+c[2]*l[2],f=-tc(c,s)/h,d=ta();if(f>0)eq(d,s,[l[0]*f,l[1]*f,l[2]*f]);else{let t=ta();eq(t,s,[2*l[0],2*l[1],2*l[2]]);let r=tc(this._cachedClippingPlane,t);eH(d,t,[this._cachedClippingPlane[0]*r,this._cachedClippingPlane[1]*r,this._cachedClippingPlane[2]*r])}let p=((n=ta())[0]=-(c[0]*c[3]),n[1]=-(c[1]*c[3]),n[2]=-(c[2]*c[3]),{center:n,radius:Math.sqrt(1-c[3]*c[3])});return go((r=p.center,i=p.radius,eH(a=ta(),d,r),eZ(o=ta(),r,a,i/e$(a)),o))}getProjectionDataForCustomLayer(t=!0){let r=this.getProjectionData({overscaledTileID:new hu(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}};function gw(t,r){let i=ta();eZ(i,t.origin,t.direction,r);let n=e$(i),a=ta();eW(a,i,1/n);let o=go(a),s=ud.fromLngLat(o),l=new ud(s.x,tv(s.y,0,.999999999)),u=mK(t.index,t.exaggeration,l.x,l.y),c=Math.abs(o.lat)>85.051129?0:u.elevation;return{sample:{...u,elevation:c},radius:n,mercator:l}}function gE(t,r){let{sample:i,radius:n}=gw(t,r);return mQ(i,(n-1)*6371008.8)}function gT(t,r){let i=gi(t);return eW(i,i,1+r/6371008.8)}var gA=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t){this._globeness=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeness=1,this.defaultConstrain=(t,r)=>this.currentTransform.defaultConstrain(t,r),this.applyConstrain=(t,r)=>this._helper.applyConstrain(t,r),this._helper=new mG({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,r)=>this.defaultConstrain(t,r)},t),this._globeness=1,this._mercatorTransform=new m0(void 0,this._helper),this._verticalPerspectiveTransform=new gx(void 0,this._helper)}clone(){let r=new t;return r._globeness=this._globeness,r.apply(this,!1),r}apply(t,r){this._helper.apply(t,r)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let r=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:r.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:r.fallbackMatrix,clipAntimeridian:i.clipAntimeridian}}isLocationOccluded(t,r,i){return this.currentTransform.isLocationOccluded(t,r,i)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){var t,r,i;return t=this._mercatorTransform.getPixelScale(),r=this._verticalPerspectiveTransform.getPixelScale(),t*(1-(i=this._globeness))+r*i}getCircleRadiusCorrection(){var t,r,i;return t=this._mercatorTransform.getCircleRadiusCorrection(),r=this._verticalPerspectiveTransform.getCircleRadiusCorrection(),t*(1-(i=this._globeness))+r*i}getPitchedTextCorrection(t,r,i){var n;let a=this._mercatorTransform.getPitchedTextCorrection(t,r,i),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,i);return a*(1-(n=this._globeness))+o*n}projectTileCoordinates(t,r,i,n){return this.currentTransform.projectTileCoordinates(t,r,i,n)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform._calcMatrices(),this._mercatorTransform._calcMatrices(this.autoCalculateNearFarZ&&!this.isGlobeRendering))}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this.currentTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}calculateCameraOptionsFromTo(t,r,i,n){return this.currentTransform.calculateCameraOptionsFromTo(t,r,i,n)}setLocationAtPoint(t,r,i){this.currentTransform.setLocationAtPoint(t,r,i)}locationToScreenPoint(t,r){return this.currentTransform.locationToScreenPoint(t,r)}screenPointToMercatorCoordinate(t,r){return this.currentTransform.screenPointToMercatorCoordinate(t,r)}screenTerrainPointToMercatorCoordinate(t,r){return this.currentTransform.screenTerrainPointToMercatorCoordinate(t,r)}screenPointToLocation(t,r){return this.currentTransform.screenPointToLocation(t,r)}screenPointToLocationAtElevation(t,r){return this.currentTransform.screenPointToLocationAtElevation(t,r)}
868isPointOnMapSurface(t,r){return this.currentTransform.isPointOnMapSurface(t,r)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getProjectionDataForCustomLayer(t=!0){let r=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return r;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=r.mainMatrix,i.projectionTransition=this._globeness,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},gS=class t{get useGlobeControls(){return!0}handlePanInertia(t,r){var i,n,a;let o,s,l,u,c=(o=t.rotate(r.bearingInRadians),s=r.zoom+gc(r.center.lat,0),i=1/gu(r.center.lat),n=1/gu(Math.min(Math.abs(r.center.lat),60)),l=i*(1-(a=tm(s,7,3,0,1)))+n*a,u=360/gt({worldSize:r.worldSize,center:{lat:r.center.lat}}),new uo(r.center.lng-o.x*u*l,tv(r.center.lat+o.y*u,-85.051129,85.051129)));return Math.abs(c.lng-r.center.lng)>180&&(c.lng=r.center.lng+179.5*Math.sign(c.lng-r.center.lng)),{easingCenter:c,easingOffset:new eT(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){let i=t.around,n=r.screenPointToLocation(i);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);let a=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);let o=r.zoom-a;if(0===o)return;let s=td(r.center.lng,n.lng),l=s/(Math.abs(s/180)+1),u=td(r.center.lat,n.lat),c=r.getRayDirectionFromPixel(i),h=r.cameraPosition,f=-1*eX(h,c),d=ta();eq(d,h,[c[0]*f,c[1]*f,c[2]*f]);let p=e$(d),m=Math.exp(-(.5*Math.max(p-1-.3,0))),g=tm(p,.95,.999,0,1),y=Math.min(m,+(1-g)+tm(gn(r.worldSize,r.center.lat)/Math.min(r.width,r.height),.9,.5,1,.25)*g),v=(1-tE(-o))*y,_=r.center.lat,b=r.zoom,x=new uo(r.center.lng+l*v,tv(r.center.lat+u*v,-85.051129,85.051129));r.setLocationAtPoint(n,i);let w=r.center,E=Math.max(tm(Math.abs(s),45,85,0,1),g)**.25,T=td(w.lng,x.lng),A=td(w.lat,x.lat);r.setCenter(new uo(w.lng+T*E,w.lat+A*E).wrap()),r.setZoom(b+gc(_,r.center.lat))}handleMapControlsPan(t,r,i){t.panDelta&&function(t,r,i,n,a=!0){var o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x;let w,E,T,A,S,C,M,D,P,I,k,O,N,L,R=gl(t,i),F=r;if(n)F=gl(t,i.sub(n));else if(!t.isPointOnMapSurface(i))return;let B=gi(R),z=gi(F),j=(o=t.center,s=t.bearing,e4(tn(),-o.lng,-o.lat,s)),U=eK(ta(),z,B),V=Math.sqrt(eX(U,U)),$=Math.acos(tv(eX(z,B),-1,1))/2,G=Math.sin($),q=V?e6(U[1]/V*G,-U[0]/V*G,U[2]/V*G,Math.cos($)):e6(0,0,0,1),{lng:H,lat:W,bearing:Z}=(k=(l=tn(),u=j[0],c=j[1],h=j[2],f=j[3],d=q[0],p=q[1],m=q[2],g=q[3],l[0]=u*g+f*d+c*m-h*p,l[1]=c*g+f*p+h*d-u*m,l[2]=h*g+f*m+u*p-c*d,l[3]=f*g-u*d-c*p-h*m,y=l)[0],O=y[1],N=y[2],{lng:-(180*Math.atan2(2*((L=y[3])*k+O*N),1-2*(k*k+O*O)))/Math.PI,lat:-(180*Math.asin(tv(2*(L*O-N*k),-1,1)))/Math.PI,bearing:180*Math.atan2(2*(L*N+k*O),1-2*(O*O+N*N))/Math.PI}),Y=t.center.lat,X=t.zoom,K=tv(W,-90,90),Q=a?(v=t,_=i,b=n,x=H,w=v.center.lng,T=(E=v.center.lat)>=0?90:-90,A=v.locationToScreenPoint(new uo(0,T)),S=_.x-A.x,C=_.y-A.y,D=(M=tv(1-(85.051129-Math.abs(E))/12,0,1))*M*(3-2*M),P=((x-w+180)%360+360)%360-180,I=0,D>0&&b&&(I=(T>0?1:-1)*((S*b.y-C*b.x)/Math.max(S*S+C*C,400))*180/Math.PI),w+(1-D)*P+D*I):H;t.setCenter(new uo(t_(Q,-180,180),K)),a||t.setBearing(Z),t.setZoom(X+gc(Y,t.center.lat))}(r,i,r.isPointOnMapSurface(t.around)?t.around:r.centerPoint,t.panDelta)}cameraForBoxAndBearing(r,i,n,a,o){let s=m5(r,i,n,a,o),l=i.left/o.width*2-1,u=(o.width-i.right)/o.width*2-1,c=-(i.top/o.height*2)+1,h=-((o.height-i.bottom)/o.height*2)+1,f=0>td(n.getWest(),n.getEast()),d=f?n.getEast():n.getWest(),p=f?n.getWest():n.getEast(),m=Math.max(n.getNorth(),n.getSouth()),g=Math.min(n.getNorth(),n.getSouth()),y=d+.5*td(d,p),v=m+.5*td(m,g),_=o.clone();_.setCenter(s.center),_.setBearing(s.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(s.zoom);let b=_.modelViewProjectionMatrix,x=[gi(n.getNorthWest()),gi(n.getNorthEast()),gi(n.getSouthWest
868()),gi(n.getSouthEast()),gi(new uo(p,v)),gi(new uo(d,v)),gi(new uo(y,m)),gi(new uo(y,g))],w=gi(s.center),E=1/0;for(let r of x)l<0&&(E=t.getLesserNonNegativeNonNull(E,t.solveVectorScale(r,w,b,"x",l))),u>0&&(E=t.getLesserNonNegativeNonNull(E,t.solveVectorScale(r,w,b,"x",u))),c>0&&(E=t.getLesserNonNegativeNonNull(E,t.solveVectorScale(r,w,b,"y",c))),h<0&&(E=t.getLesserNonNegativeNonNull(E,t.solveVectorScale(r,w,b,"y",h)));return Number.isFinite(E)&&0!==E?(s.zoom=Math.min(_.zoom+tT(E),r.maxZoom),s):void m4()}handleJumpToCenterZoom(t,r){let i=t.center.lat,n=t.applyConstrain(r.center?uo.convert(r.center):t.center,t.zoom).center;t.setCenter(n.wrap());let a=void 0===r.zoom?t.zoom+gc(i,n.lat):+r.zoom;t.zoom!==a&&t.setZoom(a)}handleEaseTo(t,r){let i=t.zoom,n=t.center,a=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},l=void 0!==r.zoom,u=!t.isPaddingEqual(r.padding),c=!1,h=r.center?uo.convert(r.center):n,f=t.applyConstrain(h,i).center;mV(t,f);let d=t.clone();d.setCenter(f),d.setZoom(l?+r.zoom:i+gc(n.lat,h.lat)),d.setBearing(r.bearing);let p=new eT(tv(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),tv(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));d.setLocationAtPoint(f,p);let m=(r.offset&&r.offsetAsPoint.mag())>0?d.center:f,g=l?+r.zoom:i+gc(n.lat,m.lat),y=i+gc(n.lat,0),v=g+gc(m.lat,0),_=td(n.lng,m.lng),b=td(n.lat,m.lat),x=tE(v-y);return{easeFunc:i=>{if(tU(o,s)||m6({startEulerAngles:o,endEulerAngles:s,tr:t,k:i,useSlerp:o.roll!=s.roll}),u&&t.interpolatePadding(a,r.padding,i),r.around)tI("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{let r=gf(n,_,b,i*(v>y?Math.min(2,x):Math.max(.5,x))**(1-i));t.setCenter(r.wrap())}if(c){let r=il.number(y,v,i)+gc(0,t.center.lat);t.setZoom(r)}},isZooming:c=g!==i,elevationCenter:m}}handleFlyTo(t,r){let i=void 0!==r.zoom,n=t.center,a=t.zoom,o=t.padding,s=!t.isPaddingEqual(r.padding),l=t.applyConstrain(uo.convert(r.center||r.locationAtOffset),a).center,u=i?+r.zoom:t.zoom+gc(t.center.lat,l.lat),c=t.clone();c.setCenter(l),c.setZoom(u),c.setBearing(r.bearing);let h=new eT(tv(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),tv(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));c.setLocationAtPoint(l,h);let f=c.center;mV(t,f);let d=Math.acos(eX(gi(n),gi(f)))/(2*Math.PI)*gt(t),p=a+gc(n.lat,0),m=u+gc(f.lat,0),g=tE(m-p),y=Math.min(Math.max("number"==typeof r.minZoom?+r.minZoom:t.minZoom,t.minZoom)+gc(f.lat,0),p,m)+gc(0,f.lat),v=tE(t.applyConstrain(f,y).zoom+gc(f.lat,0)-p),_=td(n.lng,f.lng),b=td(n.lat,f.lat);return{easeFunc:(i,a,l,c)=>{let h=gf(n,_,b,l);s&&t.interpolatePadding(o,r.padding,i);let d=1===i?f:h;t.setCenter(d.wrap());let m=p+tT(a);t.setZoom(1===i?u:m+gc(0,d.lat))},scaleOfZoom:g,targetCenter:f,scaleOfMinZoom:v,pixelPathLength:d}}static solveVectorScale(t,r,i,n,a){let o="x"===n?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],l=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],c=r[0]*o[0]+r[1]*o[1]+r[2]*o[2],h=r[0]*s[0]+r[1]*s[1]+r[2]*s[2],f=(c+o[3]-a*h-a*s[3])/(c-l-a*h+a*u);return c+a*u===l+a*h||s[3]*(l-c)+o[3]*(h-u)+l*h==c*u?null:f}static getLesserNonNegativeNonNull(t,r){return null!==r&&r>=0&&r<t?r:t}},gC=class{constructor(t){this._globe=t,this._mercatorCameraHelper=new m8,this._verticalPerspectiveCameraHelper=new gS}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,r){return this.currentHelper.handlePanInertia(t,r)}handleMapControlsRollPitchBearingZoom(t,r){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,r)}handleMapControlsPan(t,r,i){this.currentHelper.handleMapControlsPan(t,r,i)}cameraForBoxAndBearing(t,r,i,n,a){return this.currentHelper.cameraForBoxAndBearing(t,r,i,n,a)}handleJumpToCenterZoom(t,r){this.currentHelper.handleJumpToCenterZoom(t,r)}handleEaseTo(t,r){return this.currentHelper.handleEaseTo(t,r)}handleFlyTo(t,r){return this.currentHelper.handleFlyTo(t,r)}};let gM=function(){let t={},r=rt.$version;for(let i in rt.$root){let n=rt.$root[i];if(n.required){let a=null;null!=(a="version"===i?r:"array"===n.type?[]:{})&&(t[i]=a)}}return t}();var gD=class extends re{constructor(t,r={}){super(),this._rtlPluginLoaded=()=>{for(let t in this.tileManagers){let r=this.tileManagers[t].getSource().type;("vector"===r||"geojson"===r)&&this.tileManagers[t].reload()}},this.map=t,this.dispatcher=new ps(D||=new pa,t._getMapId()).setEventedParent(this),this.dispatcher.registerMessageHandler("GG",(t,r)=>this.getGlyphs(t,r)),this.dispatcher.registerMessageHandler("GI",(t,r)=>this.getImages(t,r)),this.dispatcher.registerMessageHandler("GDA",(t,r)=>this.getDashes(t,r)),this.imageManager=new dX,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(t._missingStyleImageResolver),this.patternAtlas=new dK(this.imageManager);let i=t._container?.lang||"u">typeof document&&document.documentElement?.lang||void 0;this.glyphManager=new d7(t._requestManager,r.localIdeographFontFamily,i),this.lineAtlas=new pt(256,512),this.crossTileSymbolIndex=new mP,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",t0()),pN().on(pI,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;let r=this.tileManagers[t.sourceId];if(!r)return;let i=r.getSource();if(i?.vectorLayerIds)for(let t in this._layers){let r=this._layers[t];
868r.source===i.id&&this._validateLayer(r)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new aH,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,r){this._checkLoaded();let i=null===r?this.stylesheet.state?.[t]?.default??null:r;return this._setGlobalStateValues({[t]:i}),this}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let r={};for(let i in t)r[i]=t[i].default;this._setGlobalStateValues(r)}_setGlobalStateValues(t){let r=[];for(let i in t)tM(t[i],this._globalState[i])||r.push(i);if(0===r.length)return;let i={...this._globalState};for(let i of r)this._globalState[i]=t[i];this._applyGlobalStateChanges(r,i)}_applyGlobalStateChanges(t,r){let i=new Set,n={};for(let r of t)n[r]=this._globalState[r];for(let n in this._layers){let a=this._layers[n];a.retainPriorGlobalState(t,r);let o=a.getLayoutAffectingGlobalStateRefs(),s=a.getPaintAffectingGlobalStateRefs(),l=a.getVisibilityAffectingGlobalStateRefs();for(let r of t){if(o.has(r)&&i.add(a.source),s.has(r))for(let{name:t,value:i}of s.get(r))this._updatePaintProperty(a,t,i,{validate:!1});l?.has(r)&&(a.recalculateVisibility(),this._updateLayer(a))}}let a={now:dg(),transition:this.getTransition()};for(let o in this.light?.applyGlobalStateChange(t,r,a),this.sky?.applyGlobalStateChange(t,r,a),this.dispatcher.broadcast("UGS",n),this.tileManagers)i.has(o)&&(this._reloadSource(o),this._changed=!0)}async loadURL(t,r={},i){this.fire(new dC("dataloading")),r.validate="boolean"!=typeof r.validate||r.validate,this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;try{let a=await this.map._requestManager.transformRequest(t,"Style");tY(n.signal);let o=await t3(a,n);this._loadStyleRequest===n&&(this._loadStyleRequest=null),this._load(o.data,r,i)}catch(t){this._loadStyleRequest===n&&(this._loadStyleRequest=null),t&&!n.signal.aborted&&this.fire(new t9(ti(t)))}}loadJSON(t,r={},i){this.fire(new dC("dataloading")),this._frameRequest=new AbortController,dp.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(t,r,i)}).catch(()=>{})}loadEmpty(){this.fire(new dC("dataloading")),this._load(gM,{validate:!1})}_load(t,r,i){let n=r.transformStyle?r.transformStyle(i,t):t;if(!(r.validate&&aL(this,n))){for(let t in n={...n},this._loaded=!0,this.stylesheet=n,n.sources)this.addSource(t,n.sources[t],{validate:!1});n.sprite?this._loadSprite(n.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(n.glyphs),this.glyphManager.setFontFaces(n["font-faces"]),this._createLayers(),this.light=new d9(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new pe(this.stylesheet.sky,this._globalState),this.sky.setEventedParent(this),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new dC("data")),this.fire(new dS)}}_createLayers(){let t=dF(this.stylesheet.layers);for(let r of(this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",t),this._order=t.map(t=>t.id),this._layers={},this._serializedLayers=null,t)){let t=hr(r,this._globalState);if(t.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=t,on(t)&&this.tileManagers[t.source]){let i=r.paint?.["raster-fade-duration"]??t.paint.get("raster-fade-duration");this.tileManagers[t.source].setRasterFadeDuration(i)}}}async _loadSprite(t,r=!1,i){let n;this.imageManager.setLoaded(!1);let a=new AbortController;this._spriteRequest=a;try{let i=await dZ(t,this.map._requestManager,this.map.getPixelRatio(),a);if(!i)return;for(let t in i){let{loaded:n,removed:a}=this.imageManager.setSpriteImages(t,i[t]);this._markImagesChanged(a),r&&this._markImagesChanged(n)}}catch(t){n=t,a.signal.aborted||this.fire(new t9(n))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new dC("data")),i?.(n)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new dC("data"))}_validateLayer(t){let r=this.tileManagers[t.source];if(!r)return;let i=t.sourceLayer;if(!i)return;let n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&!n.vectorLayerIds.includes(i))&&this.fire(new t9(Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,r=!1){let i=this._serializedAllLayers();if(!t||0===t.length)return Object.values(r?tD(i):i);let n=[];for(let a of t)if(i[a]){let t=r?tD(i[a]):i[a];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;for(let r of(t=this._serializedLayers={},Object.keys(this._layers))){let i=this._layers[r];
868"custom"!==i.type&&(t[r]=i.serialize())}return t}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let t in this.tileManagers)if(this.tileManagers[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(t){if(!this._loaded)return;let r=this._changed;if(r){this._imagesListDirty&&=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1);let r=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);for(let t in(r.length||i.length)&&this._updateWorkerLayers(r,i),this._updatedSources){let r=this._updatedSources[t];if("reload"===r)this._reloadSource(t);else if("clear"===r)this._clearSource(t);else throw Error(`Invalid action ${r}`)}for(let r in this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs(),this._updatedPaintProps)this._layers[r].updateTransitions(t);this._resetUpdates()}let i={};for(let t in this.tileManagers){let r=this.tileManagers[t];i[t]=r.used,r.used=!1}let n=this.imageManager.listImages();for(let r of this._order){let i=this._layers[r];i.recalculate(t,n),!i.isHidden(t.zoom)&&i.source&&(this.tileManagers[i.source].used=!0)}for(let t in i){let r=this.tileManagers[t];!!i[t]!=!!r.used&&r.fire(new dM("data",{sourceDataType:"visibility",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,r&&this.fire(new dC("data"))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let r in this.tileManagers)this.tileManagers[r].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,r){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,r={}){this._checkLoaded();let i=this.serialize();if(t=r.transformStyle?r.transformStyle(i,t):t,(r.validate??!0)&&aL(this,t))return!1;(t=tD(t)).layers=dF(t.layers);let n=function(t,r){if(!t)return[{command:"setStyle",args:[r]}];let i=[];try{if(!dB(t.version,r.version))return[{command:"setStyle",args:[r]}];dB(t.center,r.center)||i.push({command:"setCenter",args:[r.center]}),dB(t.state,r.state)||i.push({command:"setGlobalState",args:[r.state]}),dB(t.centerAltitude,r.centerAltitude)||i.push({command:"setCenterAltitude",args:[r.centerAltitude]}),dB(t.zoom,r.zoom)||i.push({command:"setZoom",args:[r.zoom]}),dB(t.bearing,r.bearing)||i.push({command:"setBearing",args:[r.bearing]}),dB(t.pitch,r.pitch)||i.push({command:"setPitch",args:[r.pitch]}),dB(t.roll,r.roll)||i.push({command:"setRoll",args:[r.roll]}),dB(t.sprite,r.sprite)||i.push({command:"setSprite",args:[r.sprite]}),dB(t.glyphs,r.glyphs)||i.push({command:"setGlyphs",args:[r.glyphs]}),dB(t["font-faces"],r["font-faces"])||i.push({command:"setFontFaces",args:[r["font-faces"]]}),dB(t.transition,r.transition)||i.push({command:"setTransition",args:[r.transition]}),dB(t.light,r.light)||i.push({command:"setLight",args:[r.light]});let n=!dB(t.terrain,r.terrain);n&&!r.terrain&&i.push({command:"setTerrain",args:[void 0]}),dB(t.sky,r.sky)||i.push({command:"setSky",args:[r.sky]}),dB(t.projection,r.projection)||i.push({command:"setProjection",args:[r.projection]});let a={},o=[];!function(t,r,i,n){let a;for(a in t||={},r||={},t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(r,a)||dU(a,i,n));for(a in r){var o;Object.prototype.hasOwnProperty.call(r,a)&&(Object.prototype.hasOwnProperty.call(t,a)?dB(t[a],r[a])||("geojson"===t[a].type&&"geojson"===r[a].type&&function(t,r,i){let n;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!dB(t[i][n],r[i][n]))return!1;for(n in r[i])if(Object.prototype.hasOwnProperty.call(r[i],n)&&"data"!==n&&!
868dB(t[i][n],r[i][n]))return!1;return!0}(t,r,a)?dz(i,{command:"setGeoJSONSourceData",args:[a,r[a].data]}):(o=r,dU(a,i,n),dj(a,o,i))):dj(a,r,i))}}(t.sources,r.sources,o,a);let s=[];t.layers&&t.layers.forEach(t=>{"source"in t&&a[t.source]?i.push({command:"removeLayer",args:[t.id]}):s.push(t)}),i=i.concat(o),function(t,r,i){t||=[],r||=[];let n=t.map(dG),a=r.map(dG),o=t.reduce(dq,{}),s=r.reduce(dq,{}),l=n.slice(),u=Object.create(null),c,h,f,d,p;for(let t=0,r=0;t<n.length;t++)c=n[t],Object.prototype.hasOwnProperty.call(s,c)?r++:(dz(i,{command:"removeLayer",args:[c]}),l.splice(l.indexOf(c,r),1));for(let t=0,r=0;t<a.length;t++)c=a[a.length-1-t],l[l.length-1-t]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(dz(i,{command:"removeLayer",args:[c]}),l.splice(l.lastIndexOf(c,l.length-r),1)):r++,d=l[l.length-t],dz(i,{command:"addLayer",args:[s[c],d]}),l.splice(l.length-t,0,c),u[c]=!0);for(let t=0;t<a.length;t++)if(h=o[c=a[t]],f=s[c],!(u[c]||dB(h,f))){if(!dB(h.source,f.source)||!dB(h["source-layer"],f["source-layer"])||!dB(h.type,f.type)){dz(i,{command:"removeLayer",args:[c]}),dz(i,{command:"addLayer",args:[f,d=l[l.lastIndexOf(c)+1]]});continue}for(p in d$(h.layout,f.layout,i,c,"setLayoutProperty"),d$(h.paint,f.paint,i,c,"setPaintProperty"),dB(h.filter,f.filter)||dz(i,{command:"setFilter",args:[c,f.filter]}),dB(h.minzoom,f.minzoom)&&dB(h.maxzoom,f.maxzoom)||dz(i,{command:"setLayerZoomRange",args:[c,f.minzoom,f.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?d$(h[p],f[p],i,c,"setPaintProperty"):dB(h[p],f[p])||dz(i,{command:"setLayerProperty",args:[c,p,f[p]]}));for(p in f)Object.prototype.hasOwnProperty.call(f,p)&&!Object.prototype.hasOwnProperty.call(h,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?d$(h[p],f[p],i,c,"setPaintProperty"):dB(h[p],f[p])||dz(i,{command:"setLayerProperty",args:[c,p,f[p]]}))}}(s,r.layers,i),n&&r.terrain&&i.push({command:"setTerrain",args:[r.terrain]})}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:"setStyle",args:[r]}]}return i}(i,t),a=this._getOperationsToPerform(n);if(a.unimplemented.length>0)throw Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(let t of a.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new dS({style:this})),!0}_getOperationsToPerform(t){let r=[],i=[];for(let n of t)switch(n.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":{let[t,i]=n.args;r.push(()=>this.addLayer(t,i));break}case"removeLayer":{let[t]=n.args;r.push(()=>this.removeLayer(t));break}case"setPaintProperty":{let[t,i,a]=n.args;r.push(()=>this.setPaintProperty(t,i,a));break}case"setLayoutProperty":{let[t,i,a]=n.args;r.push(()=>this.setLayoutProperty(t,i,a));break}case"setFilter":{let[t,i]=n.args;r.push(()=>this.setFilter(t,i));break}case"addSource":{let[t,i]=n.args;r.push(()=>this.addSource(t,i));break}case"removeSource":{let[t]=n.args;r.push(()=>this.removeSource(t));break}case"setLayerZoomRange":{let[t,i,a]=n.args;r.push(()=>this.setLayerZoomRange(t,i,a));break}case"setLight":{let[t]=n.args;r.push(()=>this.setLight(t));break}case"setGeoJSONSourceData":{let[t,i]=n.args;r.push(()=>this.setGeoJSONSourceData(t,i));break}case"setGlyphs":{let[t]=n.args;r.push(()=>this.setGlyphs(t));break}case"setFontFaces":{let[t]=n.args;r.push(()=>this.setFontFaces(t));break}case"setSprite":{let[t]=n.args;r.push(()=>this.setSprite(t));break}case"setTerrain":{let[t]=n.args;r.push(()=>this.map.setTerrain(t));break}case"setSky":{let[t]=n.args;r.push(()=>this.setSky(t));break}case"setProjection":{let[t]=n.args;r.push(()=>this.setProjection(t));break}case"setGlobalState":{let[t]=n.args;r.push(()=>this.setGlobalState(t));break}case"setTransition":r.push(()=>{});break;default:i.push(n.command)}return{operations:r,unimplemented:i}}addImage(t,r){this.getImage(t)?this.fire(new t9(Error(`An image named "${t}" already exists.`))):(this.imageManager.addImage(t,r),this._afterImageUpdated(t))}updateImage(t,r){this.imageManager.updateImage(t,r)}getImage(t){return this.imageManager.getImage(t)}setMissingImageResolver(t){this.imageManager.setMissingImageResolver(t)}removeImage(t){this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t)):this.fire(new t9(Error(`An image named "${t}" does not exist.`)))}_markImagesChanged(t){for(let r of t)this._changedImages[r]=!0}_afterImageUpdated(t){this._changedImages[t]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new dC("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,r,i={}){if(this._checkLoaded(),void 0!==this.tileManagers[t])throw Error(`Source "${t}" already exists.`);if(!r.type)throw Error(`The type property must be defined, but only the following properties were given: ${Ob
868ject.keys(r).join(", ")}.`);if(aN.has(r.type)&&this._validate(aM.source,`sources.${t}`,r,null,i))return;this.map?._collectResourceTiming&&(r.collectResourceTiming=!0);let n=this.tileManagers[t]=new pY(t,r,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:t})),n.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);for(let r in this._layers)if(this._layers[r].source===t)return this.fire(new t9(Error(`Source "${t}" cannot be removed while layer "${r}" is using it.`)));let r=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],r.fire(new dM("data",{sourceDataType:"metadata",sourceId:t})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,r){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);let i=this.tileManagers[t].getSource();if("geojson"!==i.type)throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(r),this._changed=!0}getSource(t){return this.tileManagers[t]?.getSource()}addLayer(t,r,i={}){let n;this._checkLoaded();let a=t.id;if(this.getLayer(a))return void this.fire(new t9(Error(`Layer "${a}" already exists on this map.`)));if("custom"===t.type){var o;let r,i;if(aR(this,(r=[],void 0===(i=(o=t).id)&&r.push(new ri(`layers.${i}`,null,'missing required property "id"')),void 0===o.render&&r.push(new ri(`layers.${i}`,null,'missing required method "render"')),o.renderingMode&&"2d"!==o.renderingMode&&"3d"!==o.renderingMode&&r.push(new ri(`layers.${i}`,null,'property "renderingMode" must be either "2d" or "3d"')),r)))return;n=hr(t,this._globalState)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(a,t.source),t=tb(t=tD(t),{source:a})),this._validate(aM.layer,`layers.${a}`,t,{arrayIndex:-1},i))return;n=hr(t,this._globalState),this._validateLayer(n),n.setEventedParent(this,{layer:{id:a}})}let s=r?this._order.indexOf(r):this._order.length;if(r&&-1===s)return void this.fire(new t9(Error(`Cannot add layer "${a}" before non-existing layer "${r}".`)));if(this._order.splice(s,0,a),this._layerOrderChanged=!0,this._layers[a]=n,this._removedLayers[a]&&n.source&&"custom"!==n.type){let t=this._removedLayers[a];delete this._removedLayers[a],t.type===n.type?(this._updatedSources[n.source]="reload",this.tileManagers[n.source].pause()):this._updatedSources[n.source]="clear"}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}moveLayer(t,r){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new t9(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===r)return;if(r&&!this._order.includes(r))return void this.fire(new t9(Error(`Cannot move layer "${t}" before non-existing layer "${r}".`)));let i=this._order.indexOf(t);this._order.splice(i,1);let n=r?this._order.indexOf(r):this._order.length;this._order.splice(n,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let r=this._layers[t];if(!r)return void this.fire(new t9(Error(`Cannot remove non-existing layer "${t}".`)));r.setEventedParent(null);let i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=r,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],"symbol"===r.type&&r.source&&this.tileManagers[r.source]?.resetMaxContentElevation(),r.onRemove&&r.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,r,i){this._checkLoaded();let n=this.getLayer(t);n?(n.minzoom!==r||n.maxzoom!==i)&&(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new t9(Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,r,i={}){this._checkLoaded();let n=this.getLayer(t);if(!n)return void this.fire(new t9(Error(`Cannot filter non-existing layer "${t}".`)));if(!tM(n.filter,r)){if(null==r){n.setFilter(void 0),this._updateLayer(n);return}
868this._validate(aM.filter,`layers.${n.id}.filter`,r,null,i)||(n.setFilter(tD(r)),this._updateLayer(n))}}getFilter(t){return tD(this.getLayer(t).filter)}setLayoutProperty(t,r,i,n={}){this._checkLoaded();let a=this.getLayer(t);a?tM(a.getLayoutProperty(r),i)||(a.setLayoutProperty(r,i,n),this._updateLayer(a)):this.fire(new t9(Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,r){let i=this.getLayer(t);return i?i.getLayoutProperty(r):void this.fire(new t9(Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,r,i,n={}){this._checkLoaded();let a=this.getLayer(t);a?tM(a.getPaintProperty(r),i)||this._updatePaintProperty(a,r,i,n):this.fire(new t9(Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,r,i,n={}){t.setPaintProperty(r,i,n)&&this._updateLayer(t),on(t)&&"raster-fade-duration"===r&&this.tileManagers[t.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[t.id]=!0,"symbol"===t.type&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(t,r){return this.getLayer(t).getPaintProperty(r)}setFeatureState(t,r){this._checkLoaded();let i=t.source,n=t.sourceLayer,a=this.tileManagers[i];if(void 0===a)return void this.fire(new t9(Error(`The source '${i}' does not exist in the map's style.`)));let o=a.getSource().type;if("geojson"===o&&n)return void this.fire(new t9(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===o&&!n)return void this.fire(new t9(Error("The sourceLayer parameter must be provided for vector source types.")));if(void 0===t.id)return void this.fire(new t9(Error("The feature id parameter must be provided.")));let s=["__proto__","constructor","prototype"];r&&Object.keys(r).some(t=>s.includes(t))?this.fire(new t9(Error(`The feature state should not include one of the following keys: ${s}`))):a.setFeatureState(n,t.id,r)}removeFeatureState(t,r){this._checkLoaded();let i=t.source,n=this.tileManagers[i];if(void 0===n)return void this.fire(new t9(Error(`The source '${i}' does not exist in the map's style.`)));let a=n.getSource().type,o="vector"===a?t.sourceLayer:void 0;"vector"!==a||o?r&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new t9(Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(o,t.id,r):this.fire(new t9(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let r=t.source,i=t.sourceLayer,n=this.tileManagers[r];return void 0===n?void this.fire(new t9(Error(`The source '${r}' does not exist in the map's style.`))):"vector"!==n.getSource().type||i?(void 0===t.id&&this.fire(new t9(Error("The feature id parameter must be provided."))),n.getFeatureState(i,t.id)):void this.fire(new t9(Error("The sourceLayer parameter must be provided for vector source types.")))}getTransition(){return tb({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let t=tS(this.tileManagers,t=>t.serialize()),r=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return tC({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,"font-faces":n["font-faces"],transition:n.transition,projection:n.projection,state:n.state,sources:t,layers:r,terrain:i},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let r=t=>"fill-extrusion"===this._layers[t].type,i={},n=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(r(o))for(let r of(i[o]=a,t)){let t=r[o];if(t)for(let r of t)n.push(r)}}n.sort((t,r)=>r.intersectionZ-t.intersectionZ);let a=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(r(s))for(let t=n.length-1;t>=0;t--){let r=n[t].feature;if(i[r.layer.id]<o)break;a.push(r),n.pop()}else for(let r of t){let t=r[s];if(t)for(let r of t)a.push(r.feature)}}return a}
868queryRenderedFeatures(t,r,i){r?.filter&&this._validate(aM.filter,"queryRenderedFeatures.filter",r.filter,null,r);let n={};if(r?.layers){if(!(Array.isArray(r.layers)||r.layers instanceof Set))return this.fire(new t9(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let t of r.layers){let r=this._layers[t];if(!r)return this.fire(new t9(Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[r.source]=!0}}let a=[];r.availableImages=this.imageManager.listImages();let o=this._serializedAllLayers(),s=r.layers instanceof Set?r.layers:Array.isArray(r.layers)?new Set(r.layers):null,l={...r,layers:s,globalState:this._globalState};for(let s in this.tileManagers)(!r.layers||n[s])&&a.push(function(t,r,i,n,a,o,s){let l=function(t,r,i){if(t)for(let n of t){let t=r[n];if(t?.source===i&&"fill-extrusion"===t.type)return!0}else for(let t in r){let n=r[t];if(n.source===i&&"fill-extrusion"===n.type)return!0}return!1}(a?.layers??null,r,t.id),u=o.maxPitchScaleFactor(),c=t.tilesIn(n,u,l);c.sort(pl);let h=[];for(let n of c)h.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(r,i,t.getState(),n.queryGeometry,n.cameraQueryGeometry,n.scale,a,o,u,function(t,r){let i=eD();return eN(i,i,[1,1,0]),eL(i,i,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?eO(i,i,t.calculatePosMatrix(r.toUnwrapped())):i}(o,n.tileID),s?(t,r)=>s(n.tileID,t,r):void 0)});var f=function(t){let r={},i={};for(let{queryResults:n,wrappedTileID:a}of t){i[a]||={};let t=i[a];for(let i in n){let a=n[i];t[i]||={};let o=t[i];for(let t of(r[i]||=[],a))o[t.featureIndex]||(o[t.featureIndex]=!0,r[i].push(t))}}return r}(h),d=t;for(let t in f)for(let r of f[t])pu(r,d);return f}(this.tileManagers[s],this._layers,o,t,l,i,this.map.terrain?(t,r,i)=>this.map.terrain.getElevation(t,r,i):void 0));return this.placement&&a.push(function(t,r,i,n,a,o,s){let l={},u=o.queryRenderedSymbols(n),c=[];for(let t of Object.keys(u).map(Number))c.push(s[t]);for(let i of(c.sort(pl),c)){let n=i.featureIndex.lookupSymbolFeatures(u[i.bucketInstanceId],r,i.bucketIndex,i.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,t);for(let t in n){l[t]||=[];let r=n[t];for(let n of(r.sort((t,r)=>{let n=i.featureSortOrder;if(n){let i=n.indexOf(t.featureIndex);return n.indexOf(r.featureIndex)-i}return r.featureIndex-t.featureIndex}),r))l[t].push(n)}}var h=l,f=t,d=i;for(let t in h)for(let r of h[t])pu(r,d[f[t].source]);return h}(this._layers,o,this.tileManagers,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(t,r){r?.filter&&this._validate(aM.filter,"querySourceFeatures.filter",r.filter,null,r);let i=this.tileManagers[t];return i?function(t,r){let i=t.getRenderableIds().map(r=>t.getTileByID(r)),n=[],a={};for(let t of i){let i=t.tileID.canonical.key;a[i]||(a[i]=!0,t.querySourceFeatures(n,r))}return n}(i,r?{...r,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,r={}){this._checkLoaded();let i=this.light.getLight(),n=!1;for(let r in t)if(!tM(t[r],i[r])){n=!0;break}if(!n)return;let a={now:dg(),transition:tb({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,r),this.light.updateTransitions(a)}getProjection(){return this.stylesheet?.projection}setProjection(t){this._checkLoaded();let r=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===r.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(r.type)}getSky(){return this.stylesheet?.sky}setSky(t,r={}){this._checkLoaded();let i=this.getSky(),n=!1;if(!t&&!i)return;if(t&&!i)n=!0;else if(!t&&i)n=!0;else for(let r in t)if(!tM(t[r],i[r])){n=!0;break}if(!n)return;let a={now:dg(),transition:tb({duration:300,delay:0},this.stylesheet.transition)};this.sky.setSky(t,r)&&(this.stylesheet.sky=t,this.sky.updateTransitions(a))}_setProjectionInternal(t){let r=function(t,r,i){let n={constrainOverride:r};if(Array.isArray(t)){let r=new ge({type:t},i);return{projection:r,transform:new gA(n),cameraHelper:new gC(r)}}switch(t){case"mercator":return{projection:new mj,transform:new m0(n),cameraHelper:new m8};case"globe":{let t=new ge({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:t,transform:new gA(n),cameraHelper:new gC(t)}}case"vertical-perspective":return{projection:new m9,transform:new gx(n),cameraHelper:new gS};default:return tI(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new mj,transform:new m0(n),cameraHelper:new m8}}}(t,this.map._camera?.transform.constrainOverride,this._globalState);for(let t in this.projection=r.projection,this.map.migrateProjection(r.transform,r.cameraHelper),this.tileManagers)this.tileManagers[t].reload()}_validate(t,r,i,n,a={}
868){return!1!==a.validate&&aF(this,t,{key:r,style:this.serialize(),value:i,...n},a)}_remove(t=!0){for(let t in this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),pN().off(pI,this._rtlPluginLoaded),this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let r=this.tileManagers[t];r.setEventedParent(null),r.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let r in this.tileManagers)this.tileManagers[r].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(t,r,i){var n,a;let o=this.pauseablePlacement;return!o||this._symbolPlacementTriggered||this._placedProjectionTransition!==this.projection?.transitionState||o._showCollisionBoxes!==r||o.placement.collisionGroups.crossSourceCollisions!==i||o.placement.transform.renderWorldCopies!==t.renderWorldCopies||(n=o.placement.transform.modelViewProjectionMatrix,a=t.modelViewProjectionMatrix,n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3]||n[4]!==a[4]||n[5]!==a[5]||n[6]!==a[6]||n[7]!==a[7]||n[8]!==a[8]||n[9]!==a[9]||n[10]!==a[10]||n[11]!==a[11]||n[12]!==a[12]||n[13]!==a[13]||n[14]!==a[14]||n[15]!==a[15])}_updatePlacement(t,r,i,n,a=!1){let o=!1,s=!1,l={};for(let r of this._order){let i=this._layers[r];if("symbol"!==i.type)continue;if(!l[i.source]){let t=this.tileManagers[i.source];l[i.source]=t.getRenderableIds(!0).map(r=>t.getTileByID(r)).sort((t,r)=>r.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(r.tileID)?-1:1))}let n=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng);o||=n}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||=this._layerOrderChanged||0===i;let u=o||this._placementInputsChanged(t,r,n),c=this.pauseablePlacement?.isDone()&&!this.placement.stillRecent(dg(),t.zoom);if((a||!this.pauseablePlacement||c&&(u||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=this.projection?.transitionState,this.pauseablePlacement=new mb(t,this.map.terrain,this._order,a,r,i,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?u&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(dg()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(let t of this._order){let r=this._layers[t];"symbol"===r.type&&this.placement.updateLayerOpacities(r,l[r.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(dg())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}async getImages(t,r){let i=await this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();let n=this.tileManagers[r.source];return n&&n.setDependencies(r.tileID.key,r.type,r.icons),i}async getGlyphs(t,r){let i=await this.glyphManager.getGlyphs(r.stacks),n=this.tileManagers[r.source];return n&&n.setDependencies(r.tileID.key,r.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,r={}){this._checkLoaded(),t&&this._validate(aM.glyphs,"glyphs",t,null,r)||(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(t){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=t,this.glyphManager.setFontFaces(t)}async getDashes(t,r){let i={};for(let[t,n]of Object.entries(r.dashes))i[t]=this.lineAtlas.getDash(n.dasharray,n.round);return i}addSprite(t,r,i={},n){this._checkLoaded();let a=[{id:t,url:r}],o=[...dH(this.stylesheet.sprite),...a];
868this._validate(aM.sprite,"sprite",o,null,i)||(this.stylesheet.sprite=o,this._loadSprite(a,!0,n))}removeSprite(t){this._checkLoaded();let r=dH(this.stylesheet.sprite);if(!r.find(r=>r.id===t))return void this.fire(new t9(Error(`Sprite "${t}" doesn't exists on this map.`)));let i=this.imageManager.removeSpriteImages(t);this._markImagesChanged(i),r.splice(r.findIndex(r=>r.id===t),1),this.stylesheet.sprite=r.length>0?r:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new dC("data"))}getSprite(){return dH(this.stylesheet.sprite)}setSprite(t,r={},i){this._checkLoaded(),!(t&&this._validate(aM.sprite,"sprite",t,null,r))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){for(let t in this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),this.tileManagers){let r=this.tileManagers[t];r.setEventedParent(null),r.onRemove(this.map)}for(let t in this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy(),this._layers){let r=this._layers[t];r.setEventedParent(null),r.onRemove&&r.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}};let gP=ou([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var gI=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,r,i,n,a,o,s,l,u){this.context=t;let c=this.boundPaintVertexBuffers.length!==n.length;for(let t=0;!c&&t<n.length;t++)this.boundPaintVertexBuffers[t]!==n[t]&&(c=!0);!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==a||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==u?this.freshBind(r,i,n,a,o,s,l,u):t.bindVertexArray.set(this.vao)}freshBind(t,r,i,n,a,o,s,l){let u=t.numAttributes,c=this.context,h=c.gl;for(let u of(this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=l,r.enableAttributes(h,t),i))u.enableAttributes(h,t);for(let n of(o&&o.enableAttributes(h,t),s&&s.enableAttributes(h,t),l&&l.enableAttributes(h,t),r.bind(),r.setVertexAttribPointers(h,t,a),i))n.bind(),n.setVertexAttribPointers(h,t,a);o&&(o.bind(),o.setVertexAttribPointers(h,t,a)),n&&n.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,t,a)),l&&(l.bind(),l.setVertexAttribPointers(h,t,a)),c.currentNumAttributes=u}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}};let gk=(t,r,i,n,a)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:r,u_fog_color:i?i.properties.get("fog-color"):rH.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):rH.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!a}),gO=t=>({u_ele_delta:t}),gN={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2},gL={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function gR(t){let r={},i=0;for(let{name:n,type:a}of t){let[t,o]=gL[a];i=Math.ceil(i/o)*o,r[n]=i,i+=t}return{offsets:r,contentWords:i,sizeWords:4*Math.ceil(i/4)}}var gF=class{constructor(t,r,i){this.context=t,this.binding=r,this.contentWords=i.contentWords;let n=t.gl;this.buffer=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,this.buffer),n.bufferData(n.UNIFORM_BUFFER,4*i.sizeWords,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,r,this.buffer),this.uploaded=new Float32Array(i.sizeWords),this.pending=new Float32Array(i.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let t=this.context.gl,r=!this.hasData;if(!r){let t=this.pendingWords,i=this.uploadedWords;for(let n=0;n<this.contentWords;n++)if(t[n]!==i[n]){r=!0;break}}this.bind(),r&&(t.bindBufferBase(t.UNIFORM_BUFFER,this.binding,this.buffer),t.bufferData(t.UNIFORM_BUFFER,this.pending,t.DYNAMIC_DRAW),this.uploaded.set(this.pending),this.hasData=!0)}bind(){if(!this.bindingDirty)return;let t=this.context.gl;t.bindBufferBase(t.UNIFORM_BUFFER,this.binding,this.buffer),this.bindingDirty=!1}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};let gB=gR([{name:"u_projection_matrix",type:"mat4"},{name:"u_projection_fallback_matrix",type:"mat4"},{name:"u_projection_tile_mercator_coords",type:"vec4"},{name:"u_projection_clipping_plane",type:"vec4"},{name:"u_projection_transition",type:"float"},{name:"u_projection_clip_antimeridian",type:"int"}]),gz=gB.offsets,gj=gR([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),gU=gj.offsets;function gV(t){let r=[];for(let i of t){if(null===i)continue;let t=i.split(" ");r.push(t.pop())}return r}var g$=class{constructor(t,r,i,n,a,o,s,l,u=[]){let c=t.gl;this.program=c.createProgram();let h=gV(r.staticAttributes),f=i?i.getBinderAttributes():[],d=h.concat(f),p=mR.prelude.staticUniforms?gV(mR.prelude.staticUniforms):[],m=r.staticUniforms?gV(r.staticUniforms):[],g=i?i.getBinderUniforms():[],y=p.concat(m).concat(g),v=[];for(let t of y)v.includes(t)||v.push(t);let _=i?i.defines():[];_.unshift("#version 300 es"),a&&_.push("#define OVERDRAW_INSPECTOR;"),o&&_.push("#define TERRAIN3D;"),l&&_.push(l),u&&_.push(...u);let b=_.concat(mR.prelude.fragmentSource,s.fragmentSource,r.fragmentSource).join(` 869`),x=_.concat(mR.prelude.vertexSource,s.vertexSource,r.vertexSource).join(` 870`),w=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}c.shaderSource(w,b),c.compileShader(w),c.attachShader(this.program,w);let E=c.createShader(c.VERTEX_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}c.shaderSource(E,x),c.compileShader(E),c.attachShader(this.program,E),this.attributes={};let T={};if(this.numAttributes=d.length,c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS)){if
870(c.isContextLost()){this.failedToCreate=!0;return}throw c.getShaderParameter(w,c.COMPILE_STATUS)?c.getShaderParameter(E,c.COMPILE_STATUS)?Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${c.getShaderInfoLog(E)}`):Error(`Could not compile fragment shader: ${c.getShaderInfoLog(w)}`)}!function(t,r){for(let[i,n]of Object.entries(gN)){let a=t.getUniformBlockIndex(r,i);a!==t.INVALID_INDEX&&t.uniformBlockBinding(r,a,n)}}(c,this.program);let A=function(t,r){let i=new Set([t.INT,t.INT_VEC2,t.INT_VEC3,t.INT_VEC4,t.UNSIGNED_INT,t.UNSIGNED_INT_VEC2,t.UNSIGNED_INT_VEC3,t.UNSIGNED_INT_VEC4]),n=new Set,a=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let o=0;o<a;o++){let a=t.getActiveAttrib(r,o);a&&i.has(a.type)&&n.add(a.name)}return n}(c,this.program);for(let t of d){if(!t)continue;let r=c.getAttribLocation(this.program,t);r>=0&&(this.attributes[t]={location:r,isInteger:A.has(t)})}for(let t of(c.deleteShader(E),c.deleteShader(w),v))if(t&&!T[t]){let r=c.getUniformLocation(this.program,t);r&&(T[t]=r)}this.fixedUniforms=n(t,T),this.terrainUniforms=((t,r)=>({u_depth:new sg(t,r.u_depth),u_terrain:new sg(t,r.u_terrain)}))(t,T),this.binderUniforms=i?i.getUniforms(t,T):[]}draw(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_){var b,x;let w,E=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.projectionUniformBuffer.bind(),t.terrainUniformBuffer.bind(),t.frameUniformBuffer.bind(),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(a),t.setCullFace(o),l){let r;for(let r in t.activeTexture.set(E.TEXTURE2),E.bindTexture(E.TEXTURE_2D,l.depthTexture),t.activeTexture.set(E.TEXTURE3),E.bindTexture(E.TEXTURE_2D,l.texture),this.terrainUniforms)this.terrainUniforms[r].set(l[r]);b=t.terrainUniformBuffer,(r=b.pending).set(l.u_terrain_matrix,gU.u_terrain_matrix),r.set(l.u_terrain_unpack,gU.u_terrain_unpack),r[gU.u_terrain_dim]=l.u_terrain_dim,r[gU.u_terrain_exaggeration]=l.u_terrain_exaggeration,b.upload()}if(u&&(x=t.projectionUniformBuffer,(w=x.pending).set(u.mainMatrix,gz.u_projection_matrix),w.set(u.fallbackMatrix,gz.u_projection_fallback_matrix),w.set(u.tileMercatorCoords,gz.u_projection_tile_mercator_coords),w.set(u.clippingPlane,gz.u_projection_clipping_plane),w[gz.u_projection_transition]=u.projectionTransition,x.pendingWords[gz.u_projection_clip_antimeridian]=+!!u.clipAntimeridian,x.upload()),s)for(let t in this.fixedUniforms)this.fixedUniforms[t].set(s[t]);g&&g.setUniforms(t,this.binderUniforms,p,{zoom:m});let T=0;switch(r){case E.LINES:T=2;break;case E.TRIANGLES:T=3;break;case E.LINE_STRIP:T=1}for(let i of d.get())i.vaos||={},i.vaos[c]||=new gI,i.vaos[c].bind(t,this,h,g?g.getPaintVertexBuffers():[],f,i.vertexOffset,y,v,_),E.drawElements(r,i.primitiveLength*T,E.UNSIGNED_SHORT,i.primitiveOffset*T*2)}};function gG(t,r,i){let n=1/tr(i,1,r.transform.tileZoom),a=2**i.tileID.overscaledZ,o=i.tileSize*2**r.transform.tileZoom/a,s=o*(i.tileID.canonical.x+i.tileID.wrap*a),l=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}let gq=(t,r,i,n)=>{var a,o,s,l,u,c;let h=t.style.light,f=h.getCartesianPosition(),d=eM();"viewport"===h.properties.get("anchor")&&(o=Math.sin(a=t.transform.bearingInRadians),s=Math.cos(a),d[0]=s,d[1]=o,d[2]=0,d[3]=-o,d[4]=s,d[5]=0,d[6]=0,d[7]=0,d[8]=1),l=f[0],u=f[1],c=f[2],f[0]=l*d[0]+u*d[3]+c*d[6],f[1]=l*d[1]+u*d[4]+c*d[7],f[2]=l*d[2]+u*d[5]+c*d[8];let p=t.transform.transformLightDirection(f),m=h.properties.get("color");return{u_lightpos:f,u_lightpos_globe:p,u_lightintensity:h.properties.get("intensity"),u_lightcolor:[m.r,m.g,m.b],u_vertical_gradient:+r,u_opacity:i,u_fill_translate:n}},gH=(t,r,i,n,a,o,s)=>tb(gq(t,r,i,n),gG(o,t,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),gW=(t,r,i,n,a)=>tb(gG(r,t,i),{u_fill_translate:n,u_sdf_pattern:+!!a}),gZ=t=>({u_fill_translate:t}),gY=t=>({u_fill_translate:t}),gX=(t,r,i,n,a)=>gW(t,r,i,n,a),gK=(t,r,i,n,a)=>{let o=t.transform,s,l,u=0;if("map"===i.paint.get("circle-pitch-alignment")){let t=tr(r,1,o.zoom);
vendor: 9,673 bytes, line 870
870s=!0,l=[t,t],u=t/(8192*2**r.tileID.overscaledZ)*2*Math.PI*a}else s=!1,l=o.pixelsToGLUnits;return{u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_extrude_scale:l,u_globe_extrude_scale:u,u_translate:n}},gQ=(t,r=1)=>({u_color:t,u_overlay:0,u_overlay_scale:r}),gJ=(t,r,i,n)=>{let a=tr(t,1,r)/(8192*2**t.tileID.overscaledZ)*2*Math.PI*n;return{u_extrude_scale:tr(t,1,r),u_intensity:i,u_globe_extrude_scale:a}},g0=(t,r,i,n)=>{let a=eD();return ej(a,0,t.width,t.height,0,0,1),{u_matrix:a,u_image:i,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},g1=(t,r,i)=>{var n;let a,o,s=i.paint.get("hillshade-accent-color"),l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}let u=i.getIlluminationProperties();for(let r=0;r<u.directionRadians.length;r++)"viewport"===i.paint.get("hillshade-illumination-anchor")&&(u.directionRadians[r]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:(n=r.tileID,a=2**n.canonical.z,[new ud(0,(o=n.canonical.y)/a).toLngLat().lat,new ud(0,(o+1)/a).toLngLat().lat]),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:u.altitudeRadians,u_azimuths:u.directionRadians,u_accent:s,u_method:l,u_highlights:u.highlightColor,u_shadows:u.shadowColor}},g2=(t,r)=>{let i=r.stride,n=eD();return ej(n,0,8192,-8192,0,0,1),eN(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:r.getUnpackVector()}},g3=(t,r,i=0)=>({u_image:0,u_unpack:r.getUnpackVector(),u_dimension:[r.stride,r.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:t.paint.get("color-relief-opacity")}),g4=(t,r,i,n)=>{let a=t.transform;return{u_translation:ye(t,r,i),u_ratio:n/tr(r,1,a.zoom)}},g6=(t,r,i,n,a)=>tb(g4(t,r,i,n),{u_image:0,u_image_height:a}),g5=(t,r,i,n,a)=>{let o=t.transform,s=g9(r,o);return{u_translation:ye(t,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:n/tr(r,1,o.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},g8=(t,r,i,n,a)=>{let o=g9(r,t.transform);return tb(g4(t,r,i,n),{u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},g7=(t,r,i,n,a,o)=>{let s=g9(r,t.transform);return tb(g4(t,r,i,n),{u_image:0,u_image_height:o,u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function g9(t,r){return 1/tr(t,1,r.tileZoom)}function ye(t,r,i){return tu(t.transform,r,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}let yt=(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m)=>({u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_rotate_symbol:+i,u_label_plane_matrix:l,u_coord_matrix:u,u_is_text:+h,u_pitch_with_map:+n,u_is_along_line:a,u_is_variable_anchor:o,u_texsize:f,u_texture:0,u_translation:c,u_pitched_scale:d,u_is_offset:p,u_height_anchor_ground:+m}),yr=(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g)=>{let y=s.transform;return tb(yt(t,r,i,n,a,o,s,l,u,c,h,f,p,m,g),{u_gamma_scale:n?Math.cos(y.pitch*Math.PI/180)*y.cameraToCenterDistance:1,u_is_halo:+!!d,u_is_plain:1})},yi=(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m)=>tb(yr(t,r,i,n,a,o,s,l,u,c,!0,h,!0,d,p,m),{u_texsize_icon:f,u_texture_icon:1}),yn=(t,r)=>({u_opacity:t,u_color:r}),ya=(t,r,i,n,a)=>tb(function(t,r,i,n){let a=i.patternAtlas.getPattern(t.from.toString()),o=i.patternAtlas.getPattern(t.to.toString()),{width:s,height:l}=i.patternAtlas.getPixelSize(),u=2**n.tileID.overscaledZ,c=n.tileSize*2**i.transform.tileZoom/u,h=c*(n.tileID.canonical.x+n.tileID.wrap*u),f=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,l],u_mix:r.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/tr(n,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,f>>16],u_pixel_coord_lower:[65535&h,65535&f]}}(i,a,r,n),{u_opacity:t}),yo=(t,r)=>({}),ys={fillExtrusion:(t,r)=>({u_lightpos:new s_(t,r.u_lightpos),u_lightpos_globe:new s_(t,r.u_lightpos_globe),u_lightintensity:new sy(t,r.u_lightintensity),u_lightcolor:new s_(t,r.u_lightcolor),u_vertical_gradient:new sy(t,r.u_vertical_gradient),u_opacity:new sy(t,r.u_opacity),u_fill_translate:new sv(t,r.u_fill_translate)}),fillExtrusionPattern:(t,r)=>({u_lightpos:new s_(t,r.u_lightpos),u_lightpos_globe:new s_(t,r.u_lightpos_globe),u_lightintensity:new sy(t,r.u_lightintensity),u_lightcolor:new s_(t,r.u_lightcolor),u_vertical_gradient:new sy(t,r.u_vertical_gradient),u_height_factor:new sy(t,r.u_height_factor),u_opacity:new sy(t,r.u_opacity),u_fill_translate:new sv(t,r.u_fill_translate),u_image:new sg(t,r.u_image),u_texsize:new sv(t,r.u_texsize),u_pixel_coord_upper:new sv(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new sv(t,r.u_pixel_coord_lower),u_scale:new s_(t,r.u_scale),u_fade:new sy(t,r.u_fade)}),fill:(t,r)=>({u_fill_translate:new sv(t,r.u_fill_translate)}),fillPattern:(t,r)=>({u_image:new sg(t,r.u_image),u_texsize:new sv(t,r.u_texsize),u_pixel_coord_upper:new sv(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new sv(t,r.u_pixel_coord_lower),u_scale:new s_(t,r.u_scale),u_fade:new sy(t,r.u_fade),u_sdf_pattern:new sg(t,r.u_sdf_pattern),u_fill_translate:new sv(t,r.u_fill_translate)}),fillOutline:(t,r)=>({u_fill_translate:new sv(t,r.u_fill_translate)}),fillOutlinePattern:(t,r)=>({u_image:new sg(t,r.u_image),u_texsize:new sv(t,r.u_texsize),u_pixel_coord_upper:new sv(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new sv(t,r.u_pixel_coord_lower),u_scale:new s_(t,r.u_scale),u_fade:new sy(t,r.u_fade),u_sdf_pattern:new sg(t,r.u_sdf_pattern),u_fill_translate:new sv(t,r.u_fill_translate)}),circle:(t,r)=>({u_scale_with_map:new sg(t,r.u_scale_with_map),u_pitch_with_map:new sg(t,r.u_pitch_with_map),u_extrude_scale:new sv(t,r.u_extrude_scale),u_globe_extrude_scale:new sy(t,r.u_globe_extrude_scale),u_translate:new sv(t,r.u_translate)}),collisionBox:yo,collisionCircle:yo,debug:(t,r)=>({u_color:new sx(t,r.u_color),u_overlay:new sg(t,r.u_overlay),u_overlay_scale:new sy(t,r.u_overlay_scale)}),depth:yo,clippingMask:yo,heatmap:(t,r)=>({u_extrude_scale:new sy(t,r.u_extrude_scale),u_intensity:new sy(t,r.u_intensity),u_globe_extrude_scale:new sy(t,r.u_globe_extrude_scale)}),heatmapTexture:(t,r)=>({u_matrix:new sA(t,r.u_matrix),u_image:new sg(t,r.u_image),u_color_ramp:new sg(t,r.u_color_ramp),u_opacity:new sy(t,r.u_opacity)}),hillshade:(t,r)=>({u_image:new sg(t,r.u_image),u_latrange:new sv(t,r.u_latrange),u_exaggeration:new sy(t,r.u_exaggeration),u_altitudes:new sE(t,r.u_altitudes),u_azimuths:new sE(t,r.u_azimuths),u_accent:new sx(t,r.u_accent),u_method:new sg(t,r.u_method),u_shadows:new sw(t,r.u_shadows),u_highlights:new sw(t,r.u_highlights)}),hillshadePrepare:(t,r)=>({u_matrix:new sA(t,r.u_matrix),u_image:new sg(t,r.u_image),u_dimension:new sv(t,r.u_dimension),u_zoom:new sy(t,r.u_zoom),u_unpack:new sb(t,r.u_unpack)}),colorRelief:(t,r)=>({u_image:new sg(t,r.u_image),u_unpack:new sb(t,r.u_unpack),u_dimension:new sv(t,r.u_dimension),u_elevation_stops:new sg(t,r.u_elevation_stops),u_color_stops:new sg(t,r.u_color_stops),u_color_ramp_size:new sg(t,r.u_color_ramp_size),u_opacity:new sy(t,r.u_opacity)}),line:(t,r)=>({u_translation:new sv(t,r.u_translation),u_ratio:new sy(t,r.u_ratio)}),lineGradient:(t,r)=>({u_translation:new sv(t,r.u_translation),u_ratio:new sy(t,r.u_ratio),u_image:new sg(t,r.u_image),u_image_height:new sy(t,r.u_image_height)}),linePattern:(t,r)=>({u_translation:new sv(t,r.u_translation),u_texsize:new sv(t,r.u_texsize),u_ratio:new sy(t,r.u_ratio),u_image:new sg(t,r.u_image),u_scale:new s_(t,r.u_scale),u_fade:new sy(t,r.u_fade)}),lineSDF:(t,r)=>({u_translation:new sv(t,r.u_translation),u_ratio:new sy(t,r.u_ratio),u_image:new sg(t,r.u_image),u_mix:new sy(t,r.u_mix),u_tileratio:new sy(t,r.u_tileratio),u_crossfade_from:new sy(t,r.u_crossfade_from),u_crossfade_to:new sy(t,r.u_crossfade_to),u_lineatlas_width:new sy(t,r.u_lineatlas_width),u_lineatlas_height:new sy(t,r.u_lineatlas_height)}),lineGradientSDF:(t,r)=>({u_translation:new sv(t,r.u_translation),u_ratio:new sy(t,r.u_ratio),u_image:new sg(t,r.u_image),u_image_height:new sy(t,r.u_image_height),u_tileratio:new sy(t,r.u_tileratio),u_crossfade_from:new sy(t,r.u_crossfade_from),u_crossfade_to:new sy(t,r.u_crossfade_to),u_image_dash:new sg(t,r.u_image_dash),u_mix:new sy(t,r.u_mix),u_lineatlas_width:new sy(t,r.u_lineatlas_width),u_lineatlas_height:new sy(t,r.u_lineatlas_height)}),layerOpacity:(t,r)=>({u_image:new sg(t,r.u_image),u_opacity:new sy(t,r.u_opacity)}),raster:(t,r)=>({u_tl_parent:new sv(t,r.u_tl_parent),u_scale_parent:new sy(t,r.u_scale_parent),u_buffer_scale:new sy(t,r.u_buffer_scale),u_image_warp:new s_(t,r.u_image_warp),u_fade_t:new sy(t,r.u_fade_t),u_opacity:new sy(t,r.u_opacity),u_image0:new sg(t,r.u_image0),u_image1:new sg(t,r.u_image1),u_brightness_low:new sy(t,r.u_brightness_low),u_brightness_high:new sy(t,r.u_brightness_high),u_saturation_factor:new sy(t,r.u_saturation_factor),u_contrast_factor:new sy(t,r.u_contrast_factor),u_spin_weights:new s_(t,r.u_spin_weights),u_coords_top:new sb(t,r.u_coords_top),u_coords_bottom:new sb(t,r.u_coords_bottom)}),symbolIcon:(t,r)=>({u_is_size_zoom_constant:new sg(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new sg(t,r.u_is_size_feature_constant),u_size_t:new sy(t,r.u_size_t),u_size:new sy(t,r.u_size),u_rotate_symbol:new sg(t,r.u_rotate_symbol),u_label_plane_matrix:new sA(t,r.u_label_plane_matrix
vendor: 12,657 bytes, line 870
870),u_coord_matrix:new sA(t,r.u_coord_matrix),u_is_text:new sg(t,r.u_is_text),u_pitch_with_map:new sg(t,r.u_pitch_with_map),u_is_along_line:new sg(t,r.u_is_along_line),u_is_variable_anchor:new sg(t,r.u_is_variable_anchor),u_texsize:new sv(t,r.u_texsize),u_texture:new sg(t,r.u_texture),u_translation:new sv(t,r.u_translation),u_pitched_scale:new sy(t,r.u_pitched_scale),u_is_offset:new sg(t,r.u_is_offset),u_height_anchor_ground:new sg(t,r.u_height_anchor_ground)}),symbolSDF:(t,r)=>({u_is_size_zoom_constant:new sg(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new sg(t,r.u_is_size_feature_constant),u_size_t:new sy(t,r.u_size_t),u_size:new sy(t,r.u_size),u_rotate_symbol:new sg(t,r.u_rotate_symbol),u_label_plane_matrix:new sA(t,r.u_label_plane_matrix),u_coord_matrix:new sA(t,r.u_coord_matrix),u_is_text:new sg(t,r.u_is_text),u_pitch_with_map:new sg(t,r.u_pitch_with_map),u_is_along_line:new sg(t,r.u_is_along_line),u_is_variable_anchor:new sg(t,r.u_is_variable_anchor),u_texsize:new sv(t,r.u_texsize),u_texture:new sg(t,r.u_texture),u_gamma_scale:new sy(t,r.u_gamma_scale),u_is_halo:new sg(t,r.u_is_halo),u_is_plain:new sg(t,r.u_is_plain),u_translation:new sv(t,r.u_translation),u_pitched_scale:new sy(t,r.u_pitched_scale),u_is_offset:new sg(t,r.u_is_offset),u_height_anchor_ground:new sg(t,r.u_height_anchor_ground)}),symbolTextAndIcon:(t,r)=>({u_is_size_zoom_constant:new sg(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new sg(t,r.u_is_size_feature_constant),u_size_t:new sy(t,r.u_size_t),u_size:new sy(t,r.u_size),u_rotate_symbol:new sg(t,r.u_rotate_symbol),u_label_plane_matrix:new sA(t,r.u_label_plane_matrix),u_coord_matrix:new sA(t,r.u_coord_matrix),u_is_text:new sg(t,r.u_is_text),u_pitch_with_map:new sg(t,r.u_pitch_with_map),u_is_along_line:new sg(t,r.u_is_along_line),u_is_variable_anchor:new sg(t,r.u_is_variable_anchor),u_texsize:new sv(t,r.u_texsize),u_texsize_icon:new sv(t,r.u_texsize_icon),u_texture:new sg(t,r.u_texture),u_texture_icon:new sg(t,r.u_texture_icon),u_gamma_scale:new sy(t,r.u_gamma_scale),u_is_halo:new sg(t,r.u_is_halo),u_translation:new sv(t,r.u_translation),u_pitched_scale:new sy(t,r.u_pitched_scale),u_is_offset:new sg(t,r.u_is_offset),u_height_anchor_ground:new sg(t,r.u_height_anchor_ground)}),background:(t,r)=>({u_opacity:new sy(t,r.u_opacity),u_color:new sx(t,r.u_color)}),backgroundPattern:(t,r)=>({u_opacity:new sy(t,r.u_opacity),u_image:new sg(t,r.u_image),u_pattern_tl_a:new sv(t,r.u_pattern_tl_a),u_pattern_br_a:new sv(t,r.u_pattern_br_a),u_pattern_tl_b:new sv(t,r.u_pattern_tl_b),u_pattern_br_b:new sv(t,r.u_pattern_br_b),u_texsize:new sv(t,r.u_texsize),u_mix:new sy(t,r.u_mix),u_pattern_size_a:new sv(t,r.u_pattern_size_a),u_pattern_size_b:new sv(t,r.u_pattern_size_b),u_scale_a:new sy(t,r.u_scale_a),u_scale_b:new sy(t,r.u_scale_b),u_pixel_coord_upper:new sv(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new sv(t,r.u_pixel_coord_lower),u_tile_units_to_pixels:new sy(t,r.u_tile_units_to_pixels)}),terrain:(t,r)=>({u_texture:new sg(t,r.u_texture),u_ele_delta:new sy(t,r.u_ele_delta),u_fog_matrix:new sA(t,r.u_fog_matrix),u_fog_color:new sx(t,r.u_fog_color),u_fog_ground_blend:new sy(t,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new sy(t,r.u_fog_ground_blend_opacity),u_horizon_color:new sx(t,r.u_horizon_color),u_horizon_fog_blend:new sy(t,r.u_horizon_fog_blend),u_is_globe_mode:new sy(t,r.u_is_globe_mode)}),terrainDepth:(t,r)=>({u_ele_delta:new sy(t,r.u_ele_delta)}),atmosphere:(t,r)=>({u_sun_pos:new s_(t,r.u_sun_pos),u_atmosphere_blend:new sy(t,r.u_atmosphere_blend),u_globe_position:new s_(t,r.u_globe_position),u_globe_radius:new sy(t,r.u_globe_radius),u_inv_proj_matrix:new sA(t,r.u_inv_proj_matrix)}),sky:(t,r)=>({u_sky_color:new sx(t,r.u_sky_color),u_horizon_color:new sx(t,r.u_horizon_color),u_horizon:new sv(t,r.u_horizon),u_horizon_normal:new sv(t,r.u_horizon_normal),u_sky_horizon_blend:new sy(t,r.u_sky_horizon_blend),u_sky_blend:new sy(t,r.u_sky_blend),u_inv_proj_matrix:new sA(t,r.u_inv_proj_matrix),u_globe_position:new s_(t,r.u_globe_position),u_globe_radius:new sy(t,r.u_globe_radius),u_atmosphere_blend:new sy(t,r.u_atmosphere_blend)})};var yl=class{constructor(t,r,i){this.context=t;let n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let r=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};let yu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var yc=class{constructor(t,r,i,n){this.length=r.length,this.attributes=i,this.itemSize=r.bytesPerElement,this.dynamicDraw=n,this.context=t;let a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,r){for(let i of this.attributes){let n=r.attributes[i.name];void 0!==n&&t.enableVertexAttribArray(n.location)}}setVertexAttribPointers(t,r,i){for(let n of this.attributes){let a=r.attributes[n.name];if(void 0!==a){let r=n.offset+this.itemSize*(i||0);a.isInteger?t.vertexAttribIPointer(a.location,n.components,t[yu[n.type]],this.itemSize,r):t.vertexAttribPointer(a.location,n.components,t[yu[n.type]],!1,this.itemSize,r)}}}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}},yh=class{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}},yf=class extends yh{getDefault(){return rH.transparent}set(t){let r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},yd=class extends yh{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}},yp=class extends yh{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}},ym=class extends yh{getDefault(){return[!0,!0,!0,!0]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},yg=class extends yh{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}},yy=class extends yh{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}},yv=class extends yh{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let r=this.current;(t.func!==r.func||t.ref!==r.ref||t.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}},y_=class extends yh{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}},yb=class extends yh{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=t,this.dirty=!1}},yx=class extends yh{getDefault(){return[0,1]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}},yw=class extends yh{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=t,this.dirty=!1}},yE=class extends yh{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}},yT=class extends yh{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.BLEND):r.disable(r.BLEND),this.current=t,this.dirty=!1}},yA=class extends yh{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}},yS=class extends yh{getDefault(){return rH.transparent}set(t){let r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},yC=class extends yh{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}},yM=class extends yh{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=t,this.dirty=!1}},yD=class extends yh{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}},yP=class extends yh{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}},yI=class extends yh{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}},yk=class extends yh{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}},yO=class extends yh{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},yN=class extends yh{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},yL=class extends yh{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},yR=class extends yh{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,t),this.current=t,this.dirty=!1}},yF=class extends yh{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},yB=class extends yh{getDefault(){return null}set(t){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},yz=class extends yh{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}},yj=class extends yh{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},yU=class extends yh{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},yV=class extends yh{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},y$=class extends yh{constructor(t,r){super(t),this.context=t,this.parent=r}getDefault(){return null}},yG=class extends y${setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},yq=class extends y${set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},yH=class extends y${set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},yW=class{constructor(t,r,i,n,a){this.context=t,this.width=r,this.height=i;let o=t.gl,s=this.framebuffer=o.createFramebuffer();
vendor: 7,464 bytes, line 870
870if(this.colorAttachment=new yG(t,s),n)this.depthAttachment=a?new yH(t,s):new yq(t,s);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let t=this.context.gl,r=this.colorAttachment.get();if(r&&t.deleteTexture(r),this.depthAttachment){let r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)}};let yZ=gR([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),yY=yZ.offsets;var yX=class{constructor(t,r,i){this.blendFunction=t,this.blendColor=r,this.mask=i}};yX.Replace=[1,0],yX.disabled=new yX(yX.Replace,rH.transparent,[!1,!1,!1,!1]),yX.unblended=new yX(yX.Replace,rH.transparent,[!0,!0,!0,!0]),yX.alphaBlended=new yX([1,771],rH.transparent,[!0,!0,!0,!0]);var yK=class{constructor(t){this.gl=t,this.clearColor=new yf(this),this.clearDepth=new yd(this),this.clearStencil=new yp(this),this.colorMask=new ym(this),this.depthMask=new yg(this),this.stencilMask=new yy(this),this.stencilFunc=new yv(this),this.stencilOp=new y_(this),this.stencilTest=new yb(this),this.depthRange=new yx(this),this.depthTest=new yw(this),this.depthFunc=new yE(this),this.blend=new yT(this),this.blendFunc=new yA(this),this.blendColor=new yS(this),this.blendEquation=new yC(this),this.cullFace=new yM(this),this.cullFaceSide=new yD(this),this.frontFace=new yP(this),this.program=new yI(this),this.activeTexture=new yk(this),this.viewport=new yO(this),this.bindFramebuffer=new yN(this),this.bindRenderbuffer=new yL(this),this.bindTexture=new yR(this),this.bindVertexBuffer=new yF(this),this.bindElementBuffer=new yB(this),this.bindVertexArray=new yz(this),this.pixelStoreUnpack=new yj(this),this.pixelStoreUnpackPremultiplyAlpha=new yU(this),this.pixelStoreUnpackFlipY=new yV(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=function(t){return new gF(t,gN.ProjectionUBO,gB)}(this),this.terrainUniformBuffer=function(t){return new gF(t,gN.TerrainUBO,gj)}(this),this.frameUniformBuffer=function(t){return new gF(t,gN.FrameUBO,yZ)}(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(t,r){return new yl(this,t,r)}createVertexBuffer(t,r,i){return new yc(this,t,r,i)}createRenderbuffer(t,r,i){let n=this.gl,a=n.createRenderbuffer();return this.bindRenderbuffer.set(a),n.renderbufferStorage(n.RENDERBUFFER,t,r,i),this.bindRenderbuffer.set(null),a}createFramebuffer(t,r,i,n){return new yW(this,t,r,i,n)}clear({color:t,depth:r,stencil:i}){let n=this.gl,a=0;t&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),void 0!==i&&(a|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(a)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){tM(t.blendFunction,yX.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(t){this.gl.deleteVertexArray(t)}unbindVAO(){this.bindVertexArray.set(null)}},yQ=class{constructor(t,r,i){this.func=t,this.mask=r,this.range=i}};yQ.ReadOnly=!1,yQ.ReadWrite=!0,yQ.disabled=new yQ(519,yQ.ReadOnly,[0,1]);var yJ=class{constructor(t,r,i,n,a,o){this.test=t,this.ref=r,this.mask=i,this.fail=n,this.depthFail=a,this.pass=o}};yJ.disabled=new yJ({func:519,mask:0},0,0,7680,7680,7680);var y0=class{constructor(t,r,i){this.enable=t,this.mode=r,this.frontFace=i}};function y1(t,r,i={}){return t.transform.getProjectionData({overscaledTileID:r,aligned:i.aligned,applyGlobeMatrix:!t.isRenderingToTexture,applyTerrainMatrix:i.applyTerrainMatrix??!0})}function y2(t,r){return t.isRenderingToTexture?null:t.terrain?.getTerrainData(r)??null}function y3(t,r,i,n,a,o){let s=t.context,l=s.gl,u=t.useProgram("collisionBox"),c=[],h=0,f=0;for(let d of n){let n=r.getTile(d).getBucket(i);if(!n)continue;let p=a?n.textCollisionBox:n.iconCollisionBox,m=n.collisionCircleArray;m.length>0&&(c.push({circleArray:m,circleOffset:f,coord:d}),h+=m.length/4,f=h),p&&u.draw(s,l.LINES,yQ.disabled,yJ.disabled,t.colorModeForRenderPass(),y0.disabled,null,y2(o,d),y1(o,d),i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,t.transform.zoom,null,null,p.collisionVertexBuffer)}if(!a||!c.length)return;let d=t.useProgram("collisionCircle"),p=new o8;
870p.resize(4*h),p._trim();let m=0;for(let t of c)for(let r=0;r<t.circleArray.length/4;r++){let i=4*r,n=t.circleArray[i+0],a=t.circleArray[i+1],o=t.circleArray[i+2],s=t.circleArray[i+3];p.emplace(m++,n,a,o,s,0),p.emplace(m++,n,a,o,s,1),p.emplace(m++,n,a,o,s,2),p.emplace(m++,n,a,o,s,3)}(!k||k.length<2*h)&&(k=function(t){let r=2*t,i=new o9;i.resize(r),i._trim();for(let t=0;t<r;t++){let r=6*t;i.uint16[r+0]=4*t+0,i.uint16[r+1]=4*t+1,i.uint16[r+2]=4*t+2,i.uint16[r+3]=4*t+2,i.uint16[r+4]=4*t+3,i.uint16[r+5]=4*t+0}return i}(h));let g=s.createIndexBuffer(k,!0),y=s.createVertexBuffer(p,uj.members,!0);for(let r of c)d.draw(s,l.TRIANGLES,yQ.disabled,yJ.disabled,t.colorModeForRenderPass(),y0.disabled,null,y2(o,r.coord),null,i.id,y,g,sa.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,t.transform.zoom,null,null,null);y.destroy(),g.destroy()}y0.disabled=new y0(!1,1029,2305),y0.backCCW=new y0(!0,1029,2305),y0.frontCCW=new y0(!0,1028,2305);let y4=eI(new Float32Array(16));function y6(t,r,i,n,a,o,s,l,u,c,h,f,d){let p=t.context,m=p.gl,g=t.transform,y="map"===l,v="map"===u,_="viewport"!==l&&"point"!==i.layout.get("symbol-placement"),b=y&&!v&&!_,x=!i.layout.get("symbol-sort-key").isConstant(),w=!1,E=t.getDepthModeForSublayer(0,yQ.ReadOnly),T=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=[],S=g.getCircleRadiusCorrection();for(let l of n){let n=r.getTile(l),u=n.getBucket(i);if(!u)continue;let h=a?u.text:u.icon;if(!h?.segments.get().length||!h.hasVisibleVertices)continue;let f=h.programConfigurations.get(i.id),p=a||u.sdfIcons,E=a?u.textSizeData:u.iconSizeData,C=v||0!==g.pitch,M=t.useProgram(u.iconsInText&&a?"symbolTextAndIcon":p?"symbolSDF":"symbolIcon",f),D=ck(E,g.zoom),P=y2(d,l),I,k=[0,0],O,N,L=null,R;if(a){if(O=n.glyphAtlasTexture,N=m.LINEAR,I=n.glyphAtlasTexture.size,u.iconsInText){k=n.imageAtlasTexture.size,L=n.imageAtlasTexture;let r="composite"===E.kind||"camera"===E.kind;R=C||t.options.rotating||t.options.zooming||r?m.LINEAR:m.NEAREST}}else{let r=1!==i.layout.get("icon-size").constantOr(0)||u.iconsNeedLinear;O=n.imageAtlasTexture,N=p||t.options.rotating||t.options.zooming||r||C?m.LINEAR:m.NEAREST,I=n.imageAtlasTexture.size}let F=tr(n,1,t.transform.zoom),B=p1(y,t.transform,F),z=function(t,r,i,n){if(t){let t=eD();if(!r){let{vecSouth:r,vecEast:n}=p2(i);t[0]=n[0],t[1]=n[1],t[4]=r[0],t[5]=r[1]}return eL(t,t,[n,n,1]),t}return i.pixelsToClipSpaceMatrix}(v,y,t.transform,F),j=tu(g,n,o,s),U=y1(d,l),V=T&&u.hasTextData(),$="none"!==i.layout.get("icon-text-fit")&&V&&u.hasIconData(),G=i._unevaluatedLayout.hasValue("icon-offset"),q="ground"===i.layout.get("symbol-height-anchor");if(_){let r=eD();!function(t,r){let i=1/(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),n=1/(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]),a=r[0]*i,o=r[4]*i,s=r[8]*n,l=r[1]*i,u=r[5]*i,c=r[9]*n,h=r[2]*i,f=r[6]*i,d=r[10]*n;t[0]=a,t[1]=o,t[2]=s,t[4]=l,t[5]=u,t[6]=c,t[8]=h,t[9]=f,t[10]=d;let p=r[12],m=r[13],g=r[14];t[12]=-a*p-l*m-h*g,t[13]=-o*p-u*m-f*g,t[14]=-s*p-c*m-d*g,t[3]=0,t[7]=0,t[11]=0,t[15]=1}(r,B);let n=t.style.map.terrain?(r,i)=>t.style.map.terrain.getElevation(l,r,i):void 0;!function(t,r,i,n,a,o,s,l,u,c,h,f,d){let p=i?t.textSizeData:t.iconSizeData,m=ck(p,r.transform.zoom),g=[256/r.width*2+1,256/r.height*2+1],y=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;y.clear();let v=t.lineVertexArray,_=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,b=r.transform.width/r.transform.height,x=!1;for(let i=0;i<_.length;i++){var w;let E=_.get(i);if(E.hidden||2===E.writingMode&&!x){mo(E.numGlyphs,y);continue}x=!1;let T=new eT(E.anchorX,E.anchorY),A={getElevation:d,pitchedLabelPlaneMatrix:n,lineVertexArray:v,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:r.transform,tileAnchorPoint:T,unwrappedTileID:u,width:c,height:h,translation:f}
870,S=mr(E.anchorX,E.anchorY,A);if(w=S.point,!(w.x>=-g[0]&&w.x<=g[0]&&w.y>=-g[1])||!(w.y<=g[1])){mo(E.numGlyphs,y);continue}let C=S.signedDistanceFromCamera,M=.5+r.transform.cameraToCenterDistance/C*.5,D=cI(p,m,E),P=o?D*r.transform.getPitchedTextCorrection(E.anchorX,E.anchorY,u)/M:D*M,I=p8({projectionContext:A,pitchedLabelPlaneMatrixInverse:a,symbol:E,fontSize:P,flip:!1,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:l});x=I.useVertical,(I.notEnoughRoom||x||I.needsFlipping&&p8({projectionContext:A,pitchedLabelPlaneMatrixInverse:a,symbol:E,fontSize:P,flip:!0,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&mo(E.numGlyphs,y)}i?t.text.dynamicLayoutVertexBuffer.updateData(y):t.icon.dynamicLayoutVertexBuffer.updateData(y)}(u,t,a,B,r,v,c,"map"===i.layout.get("text-rotation-alignment"),l.toUnwrapped(),g.width,g.height,j,n)}let H=a&&T||$,W=v?B:t.transform.clipSpaceToPixelsMatrix,Z=_||H?y4:W,Y=p&&0!==i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1),X={program:M,buffers:h,uniformValues:p?u.iconsInText?yi(E.kind,D,b,v,_,H,t,Z,z,j,I,k,S,G,q):yr(E.kind,D,b,v,_,H,t,Z,z,j,a,I,Y,S,G,q):yt(E.kind,D,b,v,_,H,t,Z,z,j,a,I,S,G,q),projectionData:U,atlasTexture:O,atlasTextureIcon:L,atlasInterpolation:N,atlasInterpolationIcon:R,isSDF:p,hasHalo:Y};
870if(x&&u.canOverlap)for(let t of(w=!0,h.segments.get()))A.push({segments:new sa([t]),sortKey:t.sortKey,state:X,terrainData:P});else A.push({segments:h.segments,sortKey:0,state:X,terrainData:P})}w&&A.sort((t,r)=>t.sortKey-r.sortKey);let C=i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,M=24*i.layout.get("text-letter-spacing").constantOr(0)<0||C>1;for(let r of A){let n=r.state;p.activeTexture.set(m.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,m.CLAMP_TO_EDGE),n.atlasTextureIcon&&(p.activeTexture.set(m.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,m.CLAMP_TO_EDGE));let a=n.isSDF&&n.hasHalo;if(a){let a=n.uniformValues;a.u_is_halo=1,M&&(a.u_is_plain=0,y5(n.buffers,r.segments,i,t,n.program,E,h,f,a,n.projectionData,r.terrainData),a.u_is_halo=0,a.u_is_plain=1)}y5(n.buffers,r.segments,i,t,n.program,E,h,f,n.uniformValues,n.projectionData,r.terrainData),a&&!M&&(n.uniformValues.u_is_halo=0)}}function y5(t,r,i,n,a,o,s,l,u,c,h){let f=n.context,d=f.gl;a.draw(f,d.TRIANGLES,o,s,l,y0.backCCW,u,h,c,i.id,t.layoutVertexBuffer,t.indexBuffer,r,i.paint,n.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function y8(t,r,i){let n=t.gl,a=n.createTexture();n.bindTexture(n.TEXTURE_2D,a),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
870INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texStorage2D(n.TEXTURE_2D,1,n.RGBA16F,r,i);let o=t.createFramebuffer(r,i,!1,!1);return o.colorAttachment.set(a),o}function y7(t,r){return r.colorRampTexture||=new lh(t,r.colorRamp,t.gl.RGBA),r.colorRampTexture}function y9(t,r,i){let n=t.context,a=n.bindFramebuffer.get(),o=n.viewport.get(),[,,s,l]=o;return function(t,r,i){let n=t.context.gl;if(!t.layerOpacityFbo){let a=t.context.createFramebuffer(r,i,!0,!0),o=n.createTexture();n.bindTexture(n.TEXTURE_2D,o),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,r,i,0,n.RGBA,n.UNSIGNED_BYTE,null),a.colorAttachment.set(o),a.depthAttachment.set(t.context.createRenderbuffer(n.DEPTH_STENCIL,r,i)),t.layerOpacityFbo=a,t.context.bindFramebuffer.set(t.layerOpacityFbo.framebuffer);return}if(t.layerOpacityFbo.width===r&&t.layerOpacityFbo.height===i)return t.context.bindFramebuffer.set(t.layerOpacityFbo.framebuffer);let a=t.layerOpacityFbo;n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,r,i,0,n.RGBA,n.UNSIGNED_BYTE,null),t.context.bindRenderbuffer.set(a.depthAttachment.get()),n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,r,i),t.context.bindRenderbuffer.set(null),a.width=r,a.height=i,t.context.bindFramebuffer.set(a.framebuffer)}(t,s,l),n.viewport.set([0,0,s,l]),n.clear({color:rH.transparent,depth:1,stencil:0}),t.currentStencilSource=void 0,t.renderTileClippingMasks(r,i),{compositeTarget:a,compositeViewport:o}}function ve(t,r,i,n){let a=t.context,o=a.gl;a.bindFramebuffer.set(i.compositeTarget),a.viewport.set(i.compositeViewport),a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,t.layerOpacityFbo.colorAttachment.get()),t.useProgram("layerOpacity").draw(a,o.TRIANGLES,yQ.disabled,yJ.disabled,t.colorModeForRenderPass(),y0.disabled,{u_image:0,u_opacity:r},null,null,n.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,n.paint,t.transform.zoom),t.currentStencilSource=void 0}function vt(t,r,i,n,a,o,s,l){let u=256;if(a.stepInterpolant){var c;let n=r.getSource().maxzoom,a=s.canonical.z===n?Math.ceil(1<<t.transform.maxZoom-s.canonical.z):1;u=tv((c=o.maxLineLength/8192*1024*a)<=1?1:2**Math.ceil(Math.log(c)/Math.LN2),256,i.maxTextureSize)}return l.gradient=ln({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:u,image:l.gradient||void 0,clips:o.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new lh(i,l.gradient,n.RGBA),l.version=a.gradientVersion,l.texture}function vr(t,r,i,n,a){let o=t.getDepthModeForSublayer(0,yQ.ReadOnly),s=t.colorModeForRenderPass(),l=i.paint.get("line-dasharray"),u=l.constantOr(1),c=i.paint.get("line-pattern"),h=c.constantOr(1),f=i.paint.get("line-gradient"),d=i.getCrossfadeParameters(),p;p=h?"linePattern":u&&f?"lineGradientSDF":u?"lineSDF":f?"lineGradient":"line";let m=t.context,g=m.gl,y=t.transform,v=!0;for(let _ of n){let n=r.getTile(_);if(h&&!n.patternsLoaded())continue;let b=n.getBucket(i);if(!b)continue;let x=b.programConfigurations.get(i.id),w=t.context.program.get(),E=t.useProgram(p,x),T=v||E.program!==w,A=y2(a,_),S=c.constantOr(null),C=l?.constantOr(null);if(S&&n.imageAtlas){let t=n.imageAtlas,r=t.patternPositions[S.to.toString()],i=t.patternPositions[S.from.toString()];r&&i&&x.setConstantPatternPositions(r,i)}else if(C){let r="round"===i.layout.get("line-cap").constantOr(null),n=t.lineAtlas.getDash(C.to,r),a=t.lineAtlas.getDash(C.from,r);x.setConstantDashPositions(n,a)}let M=y1(a,_),D=y.getPixelScale(),P;h?(P=g5(t,n,i,D,d),m.activeTexture.set(g.TEXTURE0),n.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),x.updatePaintBuffers(d)):u&&f?(P=g7(t,n,i,D,d,b.lineClipsArray.length),function(t,r,i,n,a,o,s,l,u){let c=o.gradients[a.id],h=c.texture;a.gradientVersion!==c.version&&(h=vt(t,r,i,n,a,o,s,c)),i.activeTexture.set(n.TEXTURE0),h.bind(a.stepInterpolant?n.NEAREST:n.LINEAR,n.CLAMP_TO_EDGE),i.activeTexture.set(n.TEXTURE1),t.lineAtlas.bind(i),l.updatePaintBuffers(u)}(t,r,m,g,i,b,_,x,d)):u?(P=g8(t,n,i,D,d),(T||t.lineAtlas.dirty)&&(m.activeTexture.set(g.TEXTURE0),t.lineAtlas.bind(m)),x.updatePaintBuffers(d)):f?(P=g6(t,n,i,D,b.lineClipsArray.length),function(t,r,i,n,a,o,s){let l=o.gradients[a.id],u=l.texture;a.gradientVersion!==l.version&&(u=vt(t,r,i,n,a,o,s,l)),i.activeTexture.set(n.TEXTURE0),u.bind(a.stepInterpolant?n.NEAREST:n.LINEAR,n.CLAMP_TO_EDGE)}(t,r,m,g,i,b,_)):P=g4(t,n,i,D);let I=t.stencilModeForClipping(_);E.draw(m,g.TRIANGLES,o,I,s,y0.disabled,P,A,M,i.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,i.paint,t.transform.zoom,x,b.layoutVertexBuffer2),v=!1}}function vi(t,r,i,n,a){if(!i||!n?.imageAtlas)return;let o=n.imageAtlas.patternPositions,s=o[i.to.toString()],l=o[i.from.toString()];if(!s&&l&&(s=l),!l&&s&&(l=s),!s||!l){let t=a.getPaintProperty(r);s=o[t],l=o[t]}s&&l&&t.setConstantPatternPositions(s,l)}function vn(t,r,i,n,a){let o=t.colorModeForRenderPass();vo(t,r,i,n,t.getDepthModeForSublayer(1,yQ.ReadOnly),o,!1,a),va(t,r,i,n,a)}function va(t,r,i,n,a){if(!i.paint.get("fill-antialias"))return;let o=t.colorModeForRenderPass();vo(t,r,i,n,t.getDepthModeForSublayer(2*!!i.getPaintProperty("fill-outline-color"),yQ.ReadOnly),o,!0,a)}function vo(t,r,i,n,a,o,s,l){let u=t.context.gl,c="fill-pattern",h=i.paint.get(c),f=h?.constantOr(1),d=i.getCrossfadeParameters(),p,m,g,y,v,_=t.transform,b=i.paint.get("fill-translate"),x=i.paint.get("fill-translate-anchor");s?(m=f&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=u.LINES):(m=f?"fillPattern":"fill",p=u.TRIANGLES);let w=h.constantOr(null);for(let h of n){let n=r.getTile(h);if(f&&!n.patternsLoaded())continue;let E=n.getBucket(i);if(!E)continue;let T=E.sdfPatterns[i.id]??!1,A=E.programConfigurations.get(i.id),S=t.useProgram(m,A),C=y2(l,h);f&&(t.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),A.updatePaintBuffers(d)),vi(A,c,w,n,i);let M=y1(l,h),D=tu(_,n,b,x);s?(y=E.indexBuffer2,v=E.segments2,g="fillOutlinePattern"===m&&f?gX(t,d,n,D,T):gY(D)):(y=E.indexBuffer,v=E.segments,g=f?gW(t,d,n,D,T):gZ(D));let P=t.stencilModeForClipping(h);S.draw(t.context,p,a,P,o,y0.backCCW,g,C,M,i.id,E.layoutVertexBuffer,y,v,i.paint,t.transform.zoom,A)}}function vs(t,r,i,n,a,o,s,l){let u=t.context,c=u.gl,h="fill-extrusion-pattern",f=i.paint.get(h),d=f.constantOr(1),p=i.getCrossfadeParameters(),m=i.paint.get("fill-extrusion-opacity"),g=f.constantOr(null),y=t.transform;
870for(let f of n){let n=r.getTile(f),v=n.getBucket(i);if(!v)continue;let _=y2(l,f),b=v.programConfigurations.get(i.id),x=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",b);d&&(t.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),b.updatePaintBuffers(p));let w=y1(l,f);vi(b,h,g,n,i);let E=tu(y,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),T=i.paint.get("fill-extrusion-vertical-gradient"),A=d?gH(t,T,m,E,f,p,n):gq(t,T,m,E);x.draw(u,u.gl.TRIANGLES,a,o,s,y0.backCCW,A,_,w,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,t.transform.zoom,b,t.style.map.terrain&&v.centroidVertexBuffer)}}function vl(t,r,i,n,a,o,s,l,u){let c=t.style.projection,h=t.context,f=h.gl,d=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],p=t.useProgram("hillshade",null,!1,d),m=!t.options.moving;for(let d of n){let n=r.getTile(d),g=n.fbo;if(!g)continue;let y=c.getMeshFromTileID(h,d.canonical,l,!0,"raster"),v=y2(u,d);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,g.colorAttachment.get());let _=y1(u,d,{aligned:m});p.draw(h,f.TRIANGLES,o,a[d.overscaledZ],s,y0.backCCW,g1(t,n,i),v,_,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}}let vu=0;function vc(t,r,i,n,a,o,s,l,u){let c=t.style.projection,h=t.context,f=h.gl,d=t.useProgram("colorRelief"),p=!t.options.moving,m="nearest"===i.paint.get("resampling")?f.NEAREST:f.LINEAR,g=!0,y=0;for(let v of n){let n=r.getTile(v),_=n.dem;if(!_?.data)continue;if(g){let t=vu||=f.getParameter(f.MAX_TEXTURE_SIZE),{elevationTexture:r,colorTexture:n}=i.getColorRampTextures(h,t,_.getUnpackVector());h.activeTexture.set(f.TEXTURE1),r.bind(f.NEAREST,f.CLAMP_TO_EDGE),h.activeTexture.set(f.TEXTURE4),n.bind(f.LINEAR,f.CLAMP_TO_EDGE),g=!1,y=r.size[0]}let b=_.stride;h.activeTexture.set(f.TEXTURE0),(!n.demTexture||n.needsColorReliefPrepare)&&(h.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture||=t.getTileTexture(b)??new lh(h,{width:b,height:b,data:null},f.RGBA),n.demTexture.update(_.getPixels(),{premultiply:!1}),n.needsColorReliefPrepare=!1),n.demTexture.bind(m,f.CLAMP_TO_EDGE);let x=c.getMeshFromTileID(h,v.canonical,l,!0,"raster"),w=y2(u,v),E=y1(u,v,{aligned:p});d.draw(h,f.TRIANGLES,o,a[v.overscaledZ],s,y0.backCCW,g3(i,n.dem,y),w,E,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}let vh=[new eT(0,0),new eT(8192,0),new eT(8192,8192),new eT(0,8192)];function vf(t,r,i,n,a,o,s,l,u,c=!1,h,f=null){let d=n[n.length-1].overscaledZ,p=t.context,m=p.gl,g=t.useProgram("raster"),y=t.style.projection,v=t.colorModeForRenderPass(),_=!t.options.moving,b=i.paint.get("raster-opacity"),x="nearest"===i.paint.get("resampling")||"nearest"===i.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,w=i.paint.get("raster-fade-duration"),E=!!t.style.map.terrain;for(let T of n){let n=t.getDepthModeForSublayer(T.overscaledZ-d,1===b?yQ.ReadWrite:yQ.ReadOnly,m.LESS),A=r.getTile(T);p.activeTexture.set(m.TEXTURE0),A.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(m.TEXTURE1);let{parentTile:S,parentScaleBy:C,parentTopLeft:M,fadeValues:D}=function(t,r,i,n){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===i||n)return a;if(t.fadingParentID){let n=r.getLoadedTile(t.fadingParentID);if(!n)return a;let o=2**(n.tileID.overscaledZ-t.tileID.overscaledZ);return{parentTile:n,parentScaleBy:o,parentTopLeft:[t.tileID.canonical.x*o%1,t.tileID.canonical.y*o%1],fadeValues:function(t,r,i){let n=dg(),a=(n-t.timeAdded)/i,o=(n-r.timeAdded)/i,s=1===t.fadingDirection,l=tv(a,0,1),u=tv(1-o,0,1),c=s?l:u;return{tileOpacity:c,parentTileOpacity:s?u:l,fadeMix:{opacity:1,mix:1-c}}}(t,n,i)}}return t.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:function(t,r){let i=tv((dg()-t.timeAdded)/r,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}(t,i)}:a}(A,r,w,E);A.fadeOpacity=D.tileOpacity,S?(S.fadeOpacity=D.parentTileOpacity,S.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):A.texture.bind(x,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),A.texture.useMipmap&&p.extTextureFilterAnisotropic&&t.transform.pitch>t.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let P=y2(h,T),I=y1(h,T,{aligned:_}),k=pw(M,C,D.fadeMix,i,l,u),O=f??y.getMeshFromTileID(p,T.canonical,o,s,"raster"),N=a?a[T.overscaledZ]:yJ.disabled;g.draw(p,m.TRIANGLES,n,N,v,c?y0.frontCCW:y0.backCCW,k,P,I,i.id,O.vertexBuffer,O.indexBuffer,O.segments)}}let vd=new rH(1,0,0,1),vp=new rH(0,1,0,1),vm=new rH(0,0,1,1),vg=new rH(1,0,1,1),vy=new rH(0,1,1,1);function vv(t,r,i,n){vb(t,0,r+i/2,t.transform.width,i,n)}function v_(t,r,i,n){vb(t,r-i/2,0,i,t.transform.height,n)}function vb(t,r,i,n,a,o){let s=t.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(r*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio,a*t.pixelRatio),s.clear({color:o}),l.disable(l.SCISSOR_TEST)}function vx(t,r){if(!r.mesh){let i=new oW;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let n=new se;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),r.mesh=new pE(t.createVertexBuffer(i,pT.members),t.createIndexBuffer(n),sa.simpleSegment(0,0,i.length,n.length))}return r.mesh}
870let vw={symbol:function(t,r,i,n,a,o){if("translucent"!==o.currentPass)return;let s=yJ.disabled,l=t.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,r,i,n,a,o,s,l,u){let c=r.transform,h=r.style.map.terrain,f="map"===a,d="map"===o;for(let a of t){let t=n.getTile(a),o=t.getBucket(i);if(!o?.text?.segments.get().length)continue;let p=ck(o.textSizeData,c.zoom),m=tr(t,1,r.transform.zoom),g=p1(f,r.transform,m),y="none"!==i.layout.get("icon-text-fit")&&o.hasIconData();if(p){let r=2**(c.zoom-t.tileID.overscaledZ),n=h?(t,r)=>h.getElevation(a,t,r):void 0;!function(t,r,i,n,a,o,s,l,u,c,h,f,d){let p=t.text.placedSymbolArray,m=t.text.dynamicLayoutVertexArray,g=t.icon.dynamicLayoutVertexArray,y={};m.clear();for(let g=0;g<p.length;g++){let v=p.get(g),_=t.allowVerticalPlacement&&!v.placedOrientation,b=v.hidden||!v.crossTileID||_?null:n[v.crossTileID];if(b){let n=new eT(v.anchorX,v.anchorY),p={getElevation:f,heightOffset:v.heightOffset,heightAnchorGround:d,width:a.width,height:a.height,pitchedLabelPlaneMatrix:o,lineVertexArray:null,pitchWithMap:i,transform:a,projectionCache:null,tileAnchorPoint:n,translation:c,unwrappedTileID:h},g=i?mr(n.x,n.y,p):me(n.x,n.y,p),_=.5+a.cameraToCenterDistance/g.signedDistanceFromCamera*.5,x=cI(t.textSizeData,l,v)*_/24;i&&(x*=t.tilePixelRatio/s);let{width:w,height:E,anchor:T,textOffset:A,textBoxScale:S}=b,C=function(t,r,i,n,a,o){let{horizontalAlign:s,verticalAlign:l}=cT(t);return new eT((-(s-.5)*r/a+n[0])*o,(-(l-.5)*i/a+n[1])*o)}(T,w,E,A,S,x),M=a.getPitchedTextCorrection(n.x+c[0],n.y+c[1],h),D=function(t,r,i,n,a,o){let s=r.tileAnchorPoint.add(new eT(r.translation[0],r.translation[1]));if(r.pitchWithMap){let t=n.mult(o);i||(t=t.rotate(-a));let l=s.add(t);return p4(l.x,l.y,r.pitchedLabelPlaneMatrix,p3(r,l.x,l.y)).point}if(i){let i=me(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(t),a=Math.atan(i.y/i.x)+(i.x<0?Math.PI:0);return t.add(n.rotate(a))}return t.add(n)}(g.point,p,r,C,-a.bearingInRadians,M),P=t.allowVerticalPlacement&&2===v.placedOrientation?Math.PI/2:0;for(let t=0;t<v.numGlyphs;t++)c1(m,D,P);u&&v.associatedIconIndex>=0&&(y[v.associatedIconIndex]={shiftedAnchor:D,angle:P})}else mo(v.numGlyphs,m)}if(u){g.clear();let r=t.icon.placedSymbolArray;for(let t=0;t<r.length;t++){let i=r.get(t);if(i.hidden)mo(i.numGlyphs,g);else{let r=y[t];if(r)for(let t=0;t<i.numGlyphs;t++)c1(g,r.shiftedAnchor,r.angle);else mo(i.numGlyphs,g)}}t.icon.dynamicLayoutVertexBuffer.updateData(g)}t.text.dynamicLayoutVertexBuffer.updateData(m)}(o,f,d,u,c,g,r,p,y,tu(c,t,s,l),a.toUnwrapped(),n,"ground"===i.layout.get("symbol-height-anchor"))}}}(n,t,i,r,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),a),0!==i.paint.get("icon-opacity").constantOr(1)&&y6(t,r,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment").constantOr("viewport"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),s,l,o),0!==i.paint.get("text-opacity").constantOr(1)&&y6(t,r,i,n,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),s,l,o),r.map.showCollisionBoxes&&(y3(t,r,i,n,!0,o),y3(t,r,i,n,!1,o))},circle:function(t,r,i,n,a){if("translucent"!==a.currentPass)return;let o=i.paint.get("circle-opacity"),s=i.paint.get("circle-stroke-width"),l=i.paint.get("circle-stroke-opacity"),u=!i.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===l.constantOr(1)))return;let c=t.context,h=c.gl,f=t.transform,d=t.getDepthModeForSublayer(0,yQ.ReadOnly),p=yJ.disabled,m=t.colorModeForRenderPass(),g=[],y=f.getCircleRadiusCorrection();for(let o of n){let n=r.getTile(o),s=n.getBucket(i);if(!s)continue;let l=tu(f,n,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),c=s.programConfigurations.get(i.id),h=t.useProgram("circle",c),d=s.layoutVertexBuffer,p=s.indexBuffer,m=y2(a,o),v={programConfiguration:c,program:h,layoutVertexBuffer:d,indexBuffer:p,uniformValues:gK(t,n,i,l,y),terrainData:m,projectionData:y1(a,o)};if(u)for(let t of s.segments.get())g.push({segments:new sa([t]),sortKey:t.sortKey,state:v});else g.push({segments:s.segments,sortKey:0,state:v})}for(let r of(u&&g.sort((t,r)=>t.sortKey-r.sortKey),g)){let{programConfiguration:n,program:a,layoutVertexBuffer:o,indexBuffer:s,uniformValues:l,terrainData:u,projectionData:f}=r.state,g=r.segments;a.draw(c,h.TRIANGLES,d,p,m,y0.backCCW,l,u,f,i.id,o,s,g,i.paint,t.transform.zoom,n)}},heatmap:function(t,r,i,n,a){if(0===i.paint.get("heatmap-opacity"))return;let o=t.context;if(t.style.map.terrain){for(let o of n){let n=r.getTile(o);r.hasRenderableParent(o)||("offscreen"===a.currentPass?function(t,r,i,n,a){let o=t.context,s=o.gl,l=yJ.disabled,u=new yX([s.ONE,s.ONE],rH.transparent,[!0,!0,!0,!0]),c=r.getBucket(i);if(!c)return;let h=n.key,f=i.heatmapFbos.get(h);f||(f=y8(o,r.tileSize,r.tileSize),i.heatmapFbos.set(h,f)),o.bindFramebuffer.set(f.framebuffer),o.viewport.set([0,0,r.tileSize,r.tileSize]),o.clear({color:rH.transparent});let d=c.programConfigurations.get(i.id),p=t.useProgram("heatmap",d,!a.isRenderingGlobe),m=y1(a,r.tileID),g=y2(a,n);
870p.draw(o,s.TRIANGLES,yQ.disabled,l,u,y0.disabled,gJ(r,t.transform.zoom,i.paint.get("heatmap-intensity"),1),g,m,i.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,i.paint,t.transform.zoom,d)}(t,n,i,o,a):"translucent"===a.currentPass&&function(t,r,i,n){let a=t.context,o=a.gl,s=t.transform;a.setColorMode(t.colorModeForRenderPass());let l=y7(a,r),u=i.key,c=r.heatmapFbos.get(u);if(!c)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,c.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),l.bind(o.LINEAR,o.CLAMP_TO_EDGE);let h=y1(n,i,{applyTerrainMatrix:n.isRenderingGlobe});t.useProgram("heatmapTexture").draw(a,o.TRIANGLES,yQ.disabled,yJ.disabled,t.colorModeForRenderPass(),y0.disabled,g0(t,r,0,1),null,h,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,r.paint,s.zoom),c.destroy(),r.heatmapFbos.delete(u)}(t,i,o,a))}o.viewport.set([0,0,t.width,t.height])}else{var s,l;let o,u,c;"offscreen"===a.currentPass?function(t,r,i,n,a){var o,s,l;let u,c,h=t.context,f=h.gl,d=t.transform,p=yJ.disabled,m=new yX([f.ONE,f.ONE],rH.transparent,[!0,!0,!0,!0]);for(let g of(o=h,s=t,l=i,u=o.gl,o.activeTexture.set(u.TEXTURE1),o.viewport.set([0,0,s.width/4,s.height/4]),(c=l.heatmapFbos.get(la))?(u.bindTexture(u.TEXTURE_2D,c.colorAttachment.get()),o.bindFramebuffer.set(c.framebuffer)):(c=y8(o,s.width/4,s.height/4),l.heatmapFbos.set(la,c)),h.clear({color:rH.transparent}),n)){if(r.hasRenderableParent(g))continue;let n=r.getTile(g),o=n.getBucket(i);if(!o)continue;let s=o.programConfigurations.get(i.id),l=t.useProgram("heatmap",s),u=y1(a,g,{applyTerrainMatrix:!1}),c=d.getCircleRadiusCorrection();l.draw(h,f.TRIANGLES,yQ.disabled,p,m,y0.backCCW,gJ(n,d.zoom,i.paint.get("heatmap-intensity"),c),null,u,i.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,i.paint,d.zoom,s)}h.viewport.set([0,0,t.width,t.height])}(t,r,i,n,a):"translucent"===a.currentPass&&(s=t,l=i,u=(o=s.context).gl,o.setColorMode(s.colorModeForRenderPass()),(c=l.heatmapFbos.get(la))&&(o.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,c.colorAttachment.get()),o.activeTexture.set(u.TEXTURE1),y7(o,l).bind(u.LINEAR,u.CLAMP_TO_EDGE),s.useProgram("heatmapTexture").draw(o,u.TRIANGLES,yQ.disabled,yJ.disabled,s.colorModeForRenderPass(),y0.disabled,g0(s,l,0,1),null,null,l.id,s.viewportBuffer,s.quadTriangleIndexBuffer,s.viewportSegments,l.paint,s.transform.zoom)))}},line:function(t,r,i,n,a){if("translucent"!==a.currentPass)return;let o=i.paint.get("line-opacity"),s=i.paint.get("line-width"),l=i.paint.get("line-layer-opacity");if(0!==o.constantOr(1)&&0!==s.constantOr(1)&&0!==l){if(l<1){let o=y9(t,i,n);vr(t,r,i,n,a),ve(t,l,o,i);return}vr(t,r,i,n,a)}},fill:function(t,r,i,n,a){let o=i.paint.get("fill-color"),s=i.paint.get("fill-opacity"),l=i.paint.get("fill-layer-opacity");if(0===s.constantOr(1)||0===l)return;if(l<1){if("translucent"!==a.currentPass)return;let o=y9(t,i,n);vn(t,r,i,n,a),ve(t,l,o,i);return}let u=i.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===o.constantOr(rH.transparent).a&&1===s.constantOr(0);if(c&&"opaque"===a.currentPass){let o=t.colorModeForRenderPass();vo(t,r,i,n,t.getDepthModeForSublayer(1,yQ.ReadWrite),o,!1,a);return}c&&"translucent"===a.currentPass?va(t,r,i,n,a):"translucent"===a.currentPass&&vn(t,r,i,n,a)},fillExtrusion:function(t,r,i,n,a){let o=i.paint.get("fill-extrusion-opacity");if(0!==o&&"translucent"===a.currentPass){let s=new yQ(t.context.gl.LEQUAL,yQ.ReadWrite,a.depthRangeFor3D);if(1!==o||i.paint.get("fill-extrusion-pattern").constantOr(1))vs(t,r,i,n,s,yJ.disabled,yX.disabled,a),vs(t,r,i,n,s,t.stencilModeFor3D(),t.colorModeForRenderPass(),a);else{let o=t.colorModeForRenderPass();vs(t,r,i,n,s,yJ.disabled,o,a)}}},hillshade:function(t,r,i,n,a){if("offscreen"!==a.currentPass&&"translucent"!==a.currentPass)return;let o=t.context,s=t.style.projection.useSubdivision,l=t.getDepthModeForSublayer(0,yQ.ReadOnly),u=t.colorModeForRenderPass();if("offscreen"===a.currentPass)(function(t,r,i,n,a,o,s){let l=t.context,u=l.gl,c="nearest"===n.paint.get("resampling")?u.NEAREST:u.LINEAR;for(let h of i){let i=r.getTile(h),f=i.dem;if(!f?.data||!i.needsHillshadePrepare)continue;let d=f.dim+2,p=f.stride,m=f.getPixels();if(l.activeTexture.set(u.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture||=t.getTileTexture(p),i.demTexture){let t=i.demTexture;t.update(m,{premultiply:!1}),t.bind(u.NEAREST,u.CLAMP_TO_EDGE)}else i.demTexture=new lh(l,m,u.RGBA,{premultiply:!1}),i.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);l.activeTexture.set(u.TEXTURE0);let g=i.fbo;if(!g){let t=new lh(l,{width:d,height:d,data:null},u.RGBA);t.bind(c,u.CLAMP_TO_EDGE),(g=i.fbo=l.createFramebuffer(d,d,!0,!1)).colorAttachment.set(t.texture)}l.bindFramebuffer.set(g.framebuffer),l.viewport.set([0,0,d,d]),t.useProgram("hillshadePrepare").draw(l,u.TRIANGLES,a,o,s,y0.disabled,g2(i.tileID,f),null,null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}})(t,r,n,i,l,yJ.disabled,u),o.viewport.set([0,0,t.width,t.height]);else if("translucent"===a.currentPass)if(s){let[o,s,c]=t.stencilConfigForOverlapTwoPass(n);vl(t,r,i,c,o,l,u,!1,a),vl(t,r,i,c,s,l,u,!0,a)}else{let[o,s]=t.getStencilConfigForOverlapAndUpdateStencilID(n);vl(t,r,i,s,o,l,u,!1,a)}},colorRelief:function(t,r,i,n,a){if("translucent"!==a.currentPass||!n.length)return;let o=t.style.projection.useSubdivision,s=t.getDepthModeForSublayer(0,yQ.ReadOnly),l=t.colorModeForRenderPass();if(o){let[o,u,c]=t.stencilConfigForOverlapTwoPass(n);vc(t,r,i,c,o,s,l,!1,a),vc(t,r,i,c,u,s,l,!0,a)}else{let[o,u]=t.getStencilConfigForOverlapAndUpdateStencilID(n);vc(t,r,i,u,o,s,l,!1,a)}},raster:function(t,r,i,n,a){if("translucent"!==a.currentPass||0===i.paint.get("raster-opacity")||!n.length)return;let o=r.getSource(),s=t.style.projection.useSubdivision;if(o instanceof pS)vf(t,r,i,n,null,!1,!1,o.tileCoords,o.imageWarp,o.flippedWindingOrder,a,o.getMesh(t.context,s));else if(s){let[o,s,l]=t.stencilConfigForOverlapTwoPass(n);vf(t,r,i,l,o,!1,!0,vh,px,!1,a),vf(t,r,i,l,s,!0,!0,vh,px,!1,a)}else{let[o,s]=t.getStencilConfigForOverlapAndUpdateStencilID(n);vf(t,r,i,s,o,!1,!0,vh,px,!1,a)}},background:function(t,r,i,n,a){let o=i.paint.get("background-color"),s=i.paint.get("background-opacity");if(0===s)return;let l=t.context,u=l.gl,c=t.style.projection,h=t.transform,f=h.tileSize,d=i.paint.get("background-pattern");if(t.isPatternMissing(d))return;let p=!d&&1===o.a&&1===s&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.currentPass!==p)return;let m=yJ.disabled,g=t.getDepthModeForSublayer(0,"opaque"===p?yQ.ReadWrite:yQ.ReadOnly),y=t.colorModeForRenderPass(),v=t.useProgram(d?"backgroundPattern":"background"),_=n||pG(h,{tileSize:f,terrain:t.style.map.terrain});d&&(l.activeTexture.set(u.TEXTURE0),t.patternAtlas.bind(t.context));let b=i.getCrossfadeParameters();for(let r of _){let n=y1(a,r),h=d?ya(s,t,d,{tileID:r,tileSize:f},b):yn(s,o),p=y2(a,r),_=c.getMeshFromTileID(l,r.canonical,!1,!0,"raster");v.draw(l,u.TRIANGLES,g,m,y,y0.backCCW,h,p,n,i.id,_.vertexBuffer,_.indexBuffer,_.segments)}},sky:function(t,r){var i,n;
870let a,o,s,l,u,c,h=t.context,f=h.gl,d=(i=t.transform,n=t.pixelRatio,a=Math.cos(i.rollInRadians),o=Math.sin(i.rollInRadians),s=uy(i),l=i.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,u=ga(i),c=gn(i.worldSize,i.center.lat),{u_sky_color:r.properties.get("sky-color"),u_horizon_color:r.properties.get("horizon-color"),u_horizon:[(i.width/2-s*o)*n,(i.height/2+s*a)*n],u_horizon_normal:[-o,a],u_sky_horizon_blend:r.properties.get("sky-horizon-blend")*i.height/2*n,u_sky_blend:l,u_inv_proj_matrix:i.inverseProjectionMatrix,u_globe_position:u,u_globe_radius:c,u_atmosphere_blend:r.properties.get("atmosphere-blend")*gp(e$(u)-c,c)}),p=new yQ(f.LEQUAL,yQ.ReadWrite,[0,1]),m=yJ.disabled,g=t.colorModeForRenderPass(),y=t.useProgram("sky"),v=vx(h,r);y.draw(h,f.TRIANGLES,p,m,g,y0.disabled,d,null,void 0,"sky",v.vertexBuffer,v.indexBuffer,v.segments)},atmosphere:function(t,r,i){var n,a,o,s,l,u;let c,h,f=t.context,d=f.gl,p=t.useProgram("atmosphere"),m=new yQ(d.LEQUAL,yQ.ReadOnly,[0,1]),g=t.transform,y=(n=t.transform,a=c=i.getCartesianPosition(),a[0]=-c[0],a[1]=-c[1],a[2]=-c[2],h=eI(new Float64Array(16)),"map"===i.properties.get("anchor")&&(eB(h,h,n.rollInRadians),eR(h,h,-n.pitchInRadians),eB(h,h,n.bearingInRadians),eR(h,h,n.center.lat*Math.PI/180),eF(h,h,-n.center.lng*Math.PI/180)),o=c[0],s=c[1],l=c[2],u=h[3]*o+h[7]*s+h[11]*l+h[15],u||=1,c[0]=(h[0]*o+h[4]*s+h[8]*l+h[12])/u,c[1]=(h[
8701]*o+h[5]*s+h[9]*l+h[13])/u,c[2]=(h[2]*o+h[6]*s+h[10]*l+h[14])/u,c),v=g.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),_=gn(g.worldSize,g.center.lat),b=ga(g),x=gp(e$(b)-_,_),w=r.properties.get("atmosphere-blend")*v.projectionTransition*x;if(0===w)return;let E={u_sun_pos:y,u_atmosphere_blend:w,u_globe_position:b,u_globe_radius:_,u_inv_proj_matrix:g.inverseProjectionMatrix},T=vx(f,r);p.draw(f,d.TRIANGLES,m,yJ.disabled,yX.alphaBlended,y0.disabled,E,null,null,"atmosphere",T.vertexBuffer,T.indexBuffer,T.segments)},custom:function(t,r,i,n){let{isRenderingGlobe:a}=n,o=t.context,s=i.implementation,l=t.style.projection,u=t.transform,c=u.getProjectionDataForCustomLayer(a),h={farZ:u.farZ,nearZ:u.nearZ,fov:u.fov*Math.PI/180,modelViewProjectionMatrix:u.modelViewProjectionMatrix,projectionMatrix:u.projectionMatrix,shaderData:{variantName:l.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 871uniform mat4 u_projection_matrix; 872${l.shaderPreludeCode.vertexSource}`,define:l.shaderDefine},defaultProjectionData:c,getProjectionData:t=>u.getProjectionData({overscaledTileID:new hu(t.tileID.canonical.z,t.tileID.wrap??0,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),aligned:t.aligned,applyGlobeMatrix:t.applyGlobeMatrix,applyTerrainMatrix:t.applyTerrainMatrix})},f=s.renderingMode?s.renderingMode:"2d";if("offscreen"===n.currentPass){let r=s.prerender;r&&(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),r.call(s,o.gl,h),o.setDirty(),t.setBaseState())}else if("translucent"===n.currentPass){t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(yJ.disabled);let r="3d"===f?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,yQ.ReadOnly);o.setDepthMode(r),s.render(o.gl,h),o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}},debug:function(t,r,i,n){for(let a of i)!function(t,r,i,n){let a=t.context,o=a.gl,s=t.useProgram("debug"),l=yQ.disabled,u=yJ.disabled,c=t.colorModeForRenderPass(),h="$debug",f=y2(n,i);a.activeTexture.set(o.TEXTURE0);let d=Math.floor((r.getTileByID(i.key).latestRawTileData?.byteLength||0)/1024),p=512/Math.min(r.getTile(i).tileSize,512)*(i.overscaledZ/t.transform.zoom)*.5,m=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(m+=` => ${i.overscaledZ}`),function(t,r){t.initDebugOverlayCanvas();let i=t.debugOverlayCanvas,n=t.context.gl,a=t.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(r,5,5),a.strokeText(r,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(t,`${m} ${d}kB`);let g=y1(n,i);s.draw(a,o.TRIANGLES,l,u,yX.alphaBlended,y0.disabled,gQ(rH.transparent,p),null,g,h,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),s.draw(a,o.LINE_STRIP,l,u,c,y0.disabled,gQ(rH.red),f,g,h,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}(t,r,a,n)},debugPadding:function(t){var r,i,n,a;let o=t.transform.padding;vv(t,t.transform.height-(o.top||0),3,vd),vv(t,o.bottom||0,3,vp),v_(t,o.left||0,3,vm),v_(t,t.transform.width-(o.right||0),3,vg);let s=t.transform.centerPoint;r=t,i=s.x,n=t.transform.height-s.y,vb(r,i-1,n-10,2,20,a=vy),vb(r,i-10,n-1,20,2,a)},terrainDepth:function(t,r){let i=t.context,n=i.gl,a=t.transform,o=yX.unblended,s=new yQ(n.LEQUAL,yQ.ReadWrite,[0,1]),l=r.tileManager.getRenderableTiles(),u=t.useProgram("terrainDepth");for(let c of(i.bindFramebuffer.set(r.getFramebuffer().framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:rH.white,depth:1}),l)){let t=r.getTerrainMesh(c.tileID),l=r.getTerrainData(c.tileID),h=a.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),f=gO(r.getSkirtLength(a.zoom));u.draw(i,n.TRIANGLES,s,yJ.disabled,o,y0.backCCW,f,l,h,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}};var vE=class t{constructor(t,r){this.drawFunctions=vw,this.context=new yK(t),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:eI(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=pY.maxOverzooming+pY.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new mP}resize(t,r,i){if(this.width=Math.floor(t*i),this.height=Math.floor(r*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let t of this.style._order)this.style._layers[t].resize()}setup(){let t=this.context,r=new oW;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.tileExtentBuffer=t.createVertexBuffer(r,pT.members),this.tileExtentSegments=sa.simpleSegment(0,0,4,2);let i=new oW;i.emplaceBack(0,0),i.emplaceBack(8192,0),i.emplaceBack(0,8192),i.emplaceBack(8192,8192),this.debugBuffer=t.createVertexBuffer(i,pT.members),this.debugSegments=sa.simpleSegment(0,0,4,5);let n=new oY;n.emplaceBack(0,0,0,0),n.emplaceBack(8192,0,8192,0),n.emplaceBack(0,8192,0,8192),n.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=t.createVertexBuffer(n,gP.members),this.rasterBoundsSegments=sa.simpleSegment(0,0,4,2);let a=new oW;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(a,pT.members),this.rasterBoundsSegmentsPosOnly=sa.simpleSegment(0,0,4,5);let o=new oW;
872o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,pT.members),this.viewportSegments=sa.simpleSegment(0,0,4,2);let s=new sr;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(s);let l=new se;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new yJ({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new pE(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=eD();ej(i,0,this.width,this.height,0,0,1),eL(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,yQ.disabled,this.stencilClearMode,yX.disabled,y0.disabled,null,null,{mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!r?.length)return;this.currentStencilSource=t.source,this.nextStencilID+r.length>256&&this.clearStencil();let i=this.context;i.setColorMode(yX.disabled),i.setDepthMode(yQ.disabled);let n={};for(let t of r)n[t.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(n,r,!0),this._renderTileMasks(n,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,r,i){let n=this.context,a=n.gl,o=this.style.projection,s=this.renderContext,l=this.useProgram("clippingMask");for(let u of r){let r=t[u.key],c=y2(s,u),h=o.getMeshFromTileID(this.context,u.canonical,i,!0,"stencil"),f=y1(s,u);l.draw(n,a.TRIANGLES,yQ.disabled,new yJ({func:a.ALWAYS,mask:0},r,255,a.KEEP,a.KEEP,a.REPLACE),yX.disabled,s.isRenderingToTexture?y0.disabled:y0.backCCW,null,c,f,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){let t=this.context,r=t.gl,i=this.style.projection,n=this.transform,a=this.useProgram("depth"),o=this.getDepthModeFor3D();for(let s of pG(n,{tileSize:n.tileSize})){let n=y2(this.renderContext,s),l=i.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),u=y1(this.renderContext,s);a.draw(t,r.TRIANGLES,o,yJ.disabled,yX.disabled,y0.backCCW,null,n,u,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,r=this.context.gl;return new yJ({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){let r=this.context.gl;return new yJ({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let r=this.context.gl,i=t.sort((t,r)=>r.overscaledZ-t.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let t={};for(let i=0;i<a;i++)t[i+n]=new yJ({func:r.GEQUAL,mask:255},i+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=a,[t,i]}return[{[n]:yJ.disabled},i]}stencilConfigForOverlapTwoPass(t){let r=this.context.gl,i=t.sort((t,r)=>r.overscaledZ-t.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(this.clearStencil(),a>1){let t={},o={};for(let i=0;i<a;i++)t[i+n]=new yJ({func:r.GREATER,mask:255},a+1+i,255,r.KEEP,r.KEEP,r.REPLACE),o[i+n]=new yJ({func:r.GREATER,mask:255},1+i,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID=2*a+1,[t,o,i]}return this.nextStencilID=3,[{[n]:new yJ({func:r.GREATER,mask:255},2,255,r.KEEP,r.KEEP,r.REPLACE)},{[n]:new yJ({func:r.GREATER,mask:255},1,255,r.KEEP,r.KEEP,r.REPLACE)},i]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let r=1/8;return new yX([t.CONSTANT_COLOR,t.ONE],new rH(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderContext.currentPass?yX.unblended:yX.alphaBlended}getDepthModeForSublayer(t,r,i){if(!this.opaquePassEnabledForLayer())return yQ.disabled;let n=1-((1+this.renderContext.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new yQ(i||this.context.gl.LEQUAL,r,[n,n])}getDepthModeFor3D(){return new yQ(this.context.gl.LEQUAL,yQ.ReadWrite,this.renderContext.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderContext.currentLayer<this.renderContext.opaquePassCutoff}render(t,r){var i,n;let a;this.style=t,this.options=r;let o=this.renderContext=(i=this.transform,n=t.projection,{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:i,terrain:t.map.terrain??null,projectionTransition:a=n?.transitionState??0,isRenderingGlobe:a>0});this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(dg()),function(t,r){let i=t.pending,{transform:n}=r,a=r.context.gl;i[yY.u_units_to_pixels]=1/n.pixelsToGLUnits[0],i[yY.u_units_to_pixels+1]=1/n.pixelsToGLUnits[1],i[yY.u_world_size]=a.drawingBufferWidth,i[yY.u_world_size+1]=a.drawingBufferHeight,i[yY.u_camera_to_center_distance]=n.cameraToCenterDistance,i[yY.u_symbol_fade_change]=r.options.fadeDuration?r.symbolFadeChange:1,i[yY.u_aspect_ratio]=n.width/n.height,i[yY.u_device_pixel_ratio]=r.pixelRatio,i[yY.u_viewport_size]=n.width,i[yY.u_viewport_size+1]=n.height,i[yY.u_pixel_extrude_scale]=1/n.width,i[yY.u_pixel_extrude_scale+1]=1/n.height,i[yY.u_pitch]=n.pitch/360*2*Math.PI,t.upload()}(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let s=this.style._order,l=this.style.tileManagers,u={},c={},h={};for(let t in l){let r=l[t];r.used&&r.prepare(this.context),u[t]=r.getVisibleCoordinates(!1),c[t]=u[t].slice().reverse(),h[t]=r.getVisibleCoordinates(!0).reverse()}o.opaquePassCutoff=1/0;for(let t=0;t<s.length;t++){let r=s[t];if(this.style._layers[r].is3D()){o.opaquePassCutoff=t;break}}for(let t of(this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),o.opaquePassCutoff=0),o.currentPass="offscreen",s)){let r=this.style._layers[t];
872if(!r.hasOffscreenPass()||r.isHidden(this.transform.zoom))continue;let i=c[r.source];("custom"===r.type||i.length)&&this.renderLayer(this,l[r.source],r,i,o)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?rH.black:rH.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,o.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(o.currentPass="opaque",o.currentLayer=s.length-1;o.currentLayer>=0;o.currentLayer--){let t=this.style._layers[s[o.currentLayer]];if(t.isHidden(this.transform.zoom))continue;let r=l[t.source],i=u[t.source];this.renderTileClippingMasks(t,i),this.renderLayer(this,r,t,i,o)}o.currentPass="translucent";let f=!1;for(o.currentLayer=0;o.currentLayer<s.length;o.currentLayer++){let t=this.style._layers[s[o.currentLayer]];if(t.isHidden(this.transform.zoom))continue;let r=l[t.source];if(this.renderToTexture?.renderLayer(t,o))continue;this.opaquePassEnabledForLayer()||f||(f=!0,o.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let i=("symbol"===t.type?h:c)[t.source];this.renderTileClippingMasks(t,u[t.source]),this.renderLayer(this,r,t,i,o)}if(o.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let t=function(t,r){let i=null,n=Object.values(t._layers).flatMap(i=>i.source&&!i.isHidden(r)?[t.tileManagers[i.source]]:[]),a=n.filter(t=>"vector"===t.getSource().type),o=n.filter(t=>"vector"!==t.getSource().type),s=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};for(let t of a)s(t);if(!i)for(let t of o)s(t);return i}(this.style,this.transform.zoom);t&&this.drawFunctions.debug(this,t,t.getVisibleCoordinates(),o)}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.renderToTexture&&!this.options.moving&&this.clearRTTPool(),this.context.setDefault()}markTerrainDepthDirty(){this.terrainFacilitator.depthDirty=!0}maybeDrawDepth(){var t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D,P,I,k;if(!this.style?.projection||!this.style.map?.terrain)return;let O=this.terrainFacilitator.matrix,N=this.transform.modelViewProjectionMatrix,L=this.terrainFacilitator.depthDirty;L||=(t=O[0],r=O[1],i=O[2],n=O[3],a=O[4],o=O[5],s=O[6],l=O[7],u=O[8],c=O[9],h=O[10],f=O[11],d=O[12],p=O[13],m=O[14],g=O[15],y=N[0],v=N[1],_=N[2],b=N[3],x=N[4],w=N[5],E=N[6],T=N[7],A=N[8],S=N[9],C=N[10],M=N[11],D=N[12],P=N[13],I=N[14],k=N[15],!(Math.abs(t-y)<=1e-6*Math.max(1,Math.abs(t),Math.abs(y))&&Math.abs(r-v)<=1e-6*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(i-_)<=1e-6*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(a-x)<=1e-6*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(o-w)<=1e-6*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-E)<=1e-6*Math.max(1,Math.abs(s),Math.abs(E))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-A)<=1e-6*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(c-S)<=1e-6*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(h-C)<=1e-6*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(d-D)<=1e-6*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(p-P)<=1e-6*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(m-I)<=1e-6*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(g-k)<=1e-6*Math.max(1,Math.abs(g),Math.abs(k)))),(L||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime))&&(O[0]=N[0],O[1]=N[1],O[2]=N[2],O[3]=N[3],O[4]=N[4],O[5]=N[5],O[6]=N[6],O[7]=N[7],O[8]=N[8],O[9]=N[9],O[10]=N[10],O[11]=N[11],O[12]=N[12],O[13]=N[13],O[14]=N[14],O[15]=N[15],this.terrainFacilitator.renderTime=dg(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t,r,i,n,a){if(i.isHidden(this.transform.zoom)||"background"!==i.type&&"custom"!==i.type&&!(n||[]).length)return;this.id=i.id;let o=this.drawFunctions;c8(i)?o.symbol(t,r,i,n,this.style.placement.variableOffsets,a):"circle"===i.type?o.circle(t,r,i,n,a):"heatmap"===i.type?o.heatmap(t,r,i,n,a):"line"===i.type?o.line(t,r,i,n,a):"fill"===i.type?o.fill(t,r,i,n,a):"fill-extrusion"===i.t
vendor: 4,835 bytes, line 872
872ype?o.fillExtrusion(t,r,i,n,a):"hillshade"===i.type?o.hillshade(t,r,i,n,a):"color-relief"===i.type?o.colorRelief(t,r,i,n,a):on(i)?o.raster(t,r,i,n,a):"background"===i.type?o.background(t,r,i,n,a):"custom"===i.type&&o.custom(t,r,i,a)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(r){let i=this._tileTextures[r.size[0]];i?i.length<t.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?i.push(r):r.destroy():this._tileTextures[r.size[0]]=[r]}getTileTexture(t){let r=this._tileTextures[t];return r&&r.length>0?r.pop():null}acquireRTT(t){let r=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==t&&(i.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),i.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),i.size=t),i;let n=new lh(this.context,{width:t,height:t,data:null},r.RGBA,{premultiply:!1,useMipmap:!0});return n.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:n,size:t}}bindRTT(t){let r=this.context.gl,i=t.size;if(!this._rttSharedFbo){let t=this.context.createFramebuffer(i,i,!0,!0),n=this.context.createRenderbuffer(r.DEPTH_STENCIL,i,i);t.depthAttachment.set(n),this._rttSharedFbo={fbo:t,depthRenderbuffer:n,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}clearRTTPool(){for(let t of this._rttObjectRecyclePool)t.texture.destroy();this._rttObjectRecyclePool.length=0}destroyRTTResources(){if(this.clearRTTPool(),!this._rttSharedFbo)return;this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let r=this.patternAtlas.getPattern(t.from.toString()),i=this.patternAtlas.getPattern(t.to.toString());return!r||!i}useProgram(t,r,i=!1,n=[]){this.cache||={};let a=!!this.style.map.terrain,o=this.style.projection,s=i?mR.projectionMercator:o.shaderPreludeCode,l=i?mB:o.shaderDefine,u=`/${i?mz:o.shaderVariantName}`,c=t+(r?r.cacheKey:"")+u+(this._showOverdrawInspector?"/overdraw":"")+(a?"/terrain":"")+(n?`/${n.join("/")}`:"");return this.cache[c]||=new g$(this.context,mR[t],r,ys[t],this._showOverdrawInspector,a,s,l,n),this.cache[c]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new lh(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){if(this._tileTextures){for(let t in this._tileTextures){let r=this._tileTextures[t];if(r)for(let t of r)t.destroy()}this._tileTextures={}}if(this.destroyRTTResources(),this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let t in this.cache){let r=this.cache[t];r?.program&&this.context.gl.deleteProgram(r.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:r}=this.context.gl;return this.width!==t||this.height!==r}}
vendor: 2,994 bytes, line 872
872,vT=class extends Error{constructor(t,r){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=t,this.statusMessage=r?.statusMessage??null}};function vA(t,r){let i=!1,n=null,a,o=()=>{n=null,i&&=(t(...a),n=setTimeout(o,r),!1)};return(...t)=>(i=!0,a=t,n||o(),n)}var vS=class{constructor(t){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):([...t.keys()][0]??"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:r,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let r=Array.from(t.keys());r.length>0&&t.delete(r[0])}let r=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=r?`#${r}`:"",n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=vA(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let r=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=10**Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(r.lng*n)/n,o=Math.round(r.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch(),u="";if(u+=t?`/${a}/${o}/${i}`:`${i}/${o}/${a}`,(s||l)&&(u+=`/${Math.round(10*s)/10}`),l&&(u+=`/${Math.round(l)}`),this._hashName){let t=this._getHashParams();return t.set(this._hashName,u),`#${decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${u}`}_isValidHash(t){if(t.length<3||t.some(t=>isNaN(+t)))return!1;try{new uo(+t[2],+t[1])}catch{return!1}let r=+t[0],i=+(t[3]||0),n=+(t[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}};let vC={linearity:.3,easing:tg(0,0,.3,1)},vM=tb({deceleration:2500,maxSpeed:1400},vC),vD=tb({deceleration:20,maxSpeed:1400},vC),vP=tb({deceleration:1e3,maxSpeed:360},vC),vI=tb({deceleration:1e3,maxSpeed:90}
vendor: 27,870 bytes, line 872
872,vC),vk=tb({deceleration:1e3,maxSpeed:360},vC);var vO=class{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:dg(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,r=dg();for(;t.length>0&&r-t[0].time>160;)t.shift()}_getVelocityEntries(){let t=this._inertiaBuffer,r=dg()-60,i=Math.max(0,t.length-2);for(;i>0&&t[i-1].time>=r;)i--;return t.slice(i)}_onMoveEnd(t){this._drainInertiaBuffer();let r=this._getVelocityEntries();if(r.length<2)return void this.clear();let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new eT(0,0),pinchAround:void 0,around:void 0};for(let{settings:t}of r)t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);for(let{settings:t}of r.slice(1))i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,i.roll+=t.rollDelta||0,t.panDelta&&i.pan._add(t.panDelta);if(!i.pan.mag()&&!i.zoom&&!i.bearing&&!i.pitch&&!i.roll)return void this.clear();let n=dg()-r[0].time,a={};if(i.pan.mag()){let r=vL(i.pan.mag(),n,tb({},vM,t||{})),o=i.pan.mult(r.amount/i.pan.mag()),s=this._map._camera.cameraHelper.handlePanInertia(o,this._map._camera.transform);a.center=s.easingCenter,a.offset=s.easingOffset,vN(a,r)}if(i.zoom){let t=vL(i.zoom,n,vD);a.zoom=tA(this._map.getZoom()+t.amount,this._map.getZoomSnap(),t.amount),vN(a,t)}if(i.bearing){let t=vL(i.bearing,n,vP);a.bearing=this._map.getBearing()+tv(t.amount,-179,179),vN(a,t)}if(i.pitch){let t=vL(i.pitch,n,vI);a.pitch=this._map.getPitch()+t.amount,vN(a,t)}if(i.roll){let t=vL(i.roll,n,vk);a.roll=this._map.getRoll()+tv(t.amount,-179,179),vN(a,t)}if(a.zoom||a.bearing){let t=void 0===i.pinchAround?i.around:i.pinchAround;a.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),tb(a,{noMoveStart:!0})}};function vN(t,r){(!t.duration||t.duration<r.duration)&&(t.duration=r.duration,t.easing=r.easing)}function vL(t,r,i){let{maxSpeed:n,linearity:a,deceleration:o}=i,s=tv(t*a/(r/1e3),-n,n),l=Math.abs(s)/(o*a);return{easing:i.easing,duration:1e3*l,amount:l/2*s}}var vR=class{constructor(t,r){this._map=t,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new dI(this._map,t))}mousedown(t,r){return this._mousedownPos=r,this._firePreventable(new dD(t.type,this._map,t))}mouseup(t){this._map.fire(new dD(t.type,this._map,t))}click(t,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||this._map.fire(new dD(t.type,this._map,t))}dblclick(t){return this._firePreventable(new dD(t.type,this._map,t))}mouseover(t){this._map.fire(new dD(t.type,this._map,t))}mouseout(t){this._map.fire(new dD(t.type,this._map,t))}touchstart(t){return this._firePreventable(new dP(t.type,this._map,t))}touchmove(t){this._map.fire(new dP(t.type,this._map,t))}touchend(t){this._map.fire(new dP(t.type,this._map,t))}touchcancel(t){this._map.fire(new dP(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},vF=class{constructor(t,r){this._map=t,this._clickTolerance=r.clickTolerance}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent,this._clearLongPress(),this._touchActive=!1}mousemove(t){this._map.fire(new dD(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new dD("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}touchstart(t,r,i){if(this._clearLongPress(),this._touchActive=i.length>0,1!==i.length)return;this._longPressStart=r[0];let n=i[0];this._longPressTimer=setTimeout(()=>{this._longPressTimer=void 0;let t=new MouseEvent("contextmenu",{clientX:n.clientX,clientY:n.clientY,button:2,bubbles:!0,cancelable:!0});this._map.fire(new dD("contextmenu",this._map,t))},500)}touchmove(t,r,i){this._longPressTimer&&(1!==i.length||!this._longPressStart||r[0].dist(this._longPressStart)>this._clickTolerance)&&this._clearLongPress()}touchend(){this._touchActive=!1,this._clearLongPress()}touchcancel(){this._touchActive=!1,this._clearLongPress()}_clearLongPress(){this._longPressTimer&&=void clearTimeout(this._longPressTimer),this._longPressStart=void 0}contextmenu(t){this._touchActive?t.preventDefault():(this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new dD(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault())}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},vB=class{constructor(t,r,i){this._map=t,this._tr=i,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=r.clickTolerance||1,r.boxZoom&&"object"==typeof r.boxZoom&&(this._boxZoomEnd=r.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,r){this.isEnabled()&&t.shiftKey&&0===t.button&&(dw.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(t,r){if(!this._active||this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=r,this._box||(this._box=dw.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let n=Math.min(i.x,r.x),a=Math.max(i.x,r.x),o=Math.min(i.y,r.y),s=Math.max(i.y,r.y);this._box.style.transform=`translate(${n}px,${o}px)`,this._box.style.width=`${a-n}px`,this._box.style.height=`${s-o}px`}mouseupWindow(t,r){if(!this._active||0!==t.button)return;let i=this._startPos;if(this.reset(),dw.suppressClick(),i.x!==r.x||i.y!==r.y)return(this._map.fire(new dk("boxzoomend",{originalEvent:t})),this._boxZoomEnd)?void this._boxZoomEnd(this._map,i,r,t):{cameraAnimation:t=>t.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&=(this._box.remove(),null),dw.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new dk(t,{originalEvent:r}))}};function vz(t,r){if(t.length!==r.length)throw Error(`The number of touches and points are not equal - touches ${t.length}, points ${r.length}`);let i={};for(let n=0;n<t.length;n++)i[t[n].identifier]=r[n];return i}var vj=class{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){let r=new eT(0,0);for(let i of t)r._add(i);return r.div(t.length)}(r),this.touches=vz(i,r)))}touchmove(t,r,i){if(this.aborted||!this.centroid)return;let n=vz(i,r);for(let t in this.touches){let r=this.touches[t],i=n[t];(!i||i.dist(r)>30)&&(this.aborted=!0)}}touchend(t,r,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){let t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}},vU=class{constructor(t){this.singleTap=new vj(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,r,i){this.singleTap.touchstart(t,r,i)}touchmove(t,r,i){this.singleTap.touchmove(t,r,i)}touchend(t,r,i){let n=this.singleTap.touchend(t,r,i);if(n){let r=t.timeStamp-this.lastTime<500,i=!this.lastTap||30>this.lastTap.dist(n);if(r&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}},vV=class{constructor(t,r){this._tr=r,this._zoomIn=new vU({numTouches:1,numTaps:2}),this._zoomOut=new vU({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,r,i){this._zoomIn.touchstart(t,r,i),this._zoomOut.touchstart(t,r,i)}touchmove(t,r,i){this._zoomIn.touchmove(t,r,i),this._zoomOut.touchmove(t,r,i)}touchend(t,r,i){let n=this._zoomIn.touchend(t,r,i),a=this._zoomOut.touchend(t,r,i),o=this._tr;return n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:tA(o.zoom+1,r.getZoomSnap()),around:o.unproject(n)},{originalEvent:t})}):a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:tA(o.zoom-1,r.getZoomSnap()),around:o.unproject(a)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},v$=class{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let r=this._moveFunction(...t);if(r.bearingDelta||r.pitchDelta||r.rollDelta||r.around||r.panDelta)return this._active=!0,r}dragStart(t,r){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(r)?r[0]:r,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,r){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let n=Array.isArray(r)?r[0]:r;if(!(!this._moved&&n.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(i,n)}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&dw.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};let vG={0:1,2:2};var vq=class{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){let r;return r=vG[this._eventButton],void 0!==t.buttons&&(t.buttons&r)===r}isValidEndEvent(t){return t.button===this._eventButton}},vH=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}},vW=class{constructor(t=new vq({checkCorrectEvent:()=>!0}),r=new vH){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=r}_executeRelevantHandler(t,r,i){return t instanceof MouseEvent?r(t):"u">typeof TouchEvent&&t instanceof TouchEvent?i(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.startMove(t)},t=>{this.oneFingerTouchMoveStateManager.startMove(t)})}endMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.endMove(t)},t=>{this.oneFingerTouchMoveStateManager.endMove(t)})}isValidStartEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}};let vZ=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};var vY=class{constructor(t,r){this._clickTolerance=t.clickTolerance||1,this._map=r,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new eT(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,r,i){return this._calculateTransform(t,r,i)}touchmove(t,r,i){if(this._active)return this._shouldBePrevented(i.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t):(t.preventDefault(),this._calculateTransform(t,r,i))}touchend(t,r,i){this._calculateTransform(t,r,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,i){i.length>0&&(this._active=!0);let n=vz(i,r),a=new eT(0,0),o=new eT(0,0),s=0;for(let t in n){let r=n[t],i=this._touches[t];i&&(a._add(r),o._add(r.sub(i)),s++,n[t]=r)}if(this._touches=n,this._shouldBePrevented(s)||!o.mag())return;let l=o.div(s);if(this._sum._add(l),!(this._sum.mag()<this._clickTolerance))return{around:a.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},vX=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,r,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([r[0],r[1]]))}touchmove(t,r,i){if(!this._firstTwoTouches)return;t.preventDefault();let[n,a]=this._firstTwoTouches,o=vK(i,r,n),s=vK(i,r,a);if(!o||!s)return;let l=this._aroundCenter?null:o.add(s).div(2);return this._move([o,s],l,t)}touchend(t,r,i){if(!this._firstTwoTouches)return;let[n,a]=this._firstTwoTouches,o=vK(i,r,n),s=vK(i,r,a);o&&s||(this._active&&dw.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function vK(t,r,i){for(let n=0;n<t.length;n++)if(t[n].identifier===i)return r[n]}function vQ(t,r){return Math.log(t/r)/Math.LN2}var vJ=class extends vX{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,r){let i=this._distance;if(this._distance=t[0].dist(t[1]),!(!this._active&&Math.abs(vQ(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:vQ(this._distance,i)*this._zoomRate,pinchAround:r}}};function v0(t,r){return 180*t.angleWith(r)/Math.PI}var v1=class extends vX{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,r,i){let n=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:v0(this._vector,n),pinchAround:r}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let r=25/(Math.PI*this._minDiameter)*360;return Math.abs(v0(t,this._startVector))<r}};function v2(t){return Math.abs(t.y)>Math.abs(t.x)}var v3=class extends vX{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,r,i){super.touchstart(t,r,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,v2(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,r,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let n=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,a,i.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:-((n.y+a.y)/2*.5)}}gestureBeginsVertically(t,r,i){if(void 0!==this._valid)return this._valid;let n=t.mag()>=2,a=r.mag()>=2;if(!n&&!a)return;if(!n||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;let o=t.y>0==r.y>0;return v2(t)&&v2(r)&&o}};let v4=100,v6=15,v5=10;var v8=class{constructor(t,r){this._tr=r,this._panStep=v4,this._bearingStep=v6,this._pitchStep=v5,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let r=0,i=0,n=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:v7,zoom:r?tA(l.zoom+r*(t.shiftKey?2:1),s.getZoomSnap()):l.zoom,bearing:l.bearing+i*this._bearingStep,pitch:l.pitch+n*this._pitchStep,offset:[-a*this._panStep,-o*this._panStep],center:l.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function v7(t){return t*(2-t)}var v9=class{constructor(t,r,i){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=i,this._triggerRenderFrame=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,i=dg(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&4>Math.abs(r)?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=200>Math.abs(n*r)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),t.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=t,this._delta-=r,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=dw.mousePos(this._map.getCanvas(),t),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(uo.convert(i.center)):r,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let r=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=r),"number"==typeof this._targetZoom&&(this._targetZoom+=r)}if(0!==this._delta){let r="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==i&&(i=1/i);let n="number"==typeof this._targetZoom?tE(this._targetZoom):t.scale,a=t.applyConstrain(t.getCameraLngLat(),tT(n*i)).zoom,o=this._map.getZoomSnap();if("wheel"===this._type&&o>0){let r=tA(t.zoom,o);this._targetZoom=tA(a,o,a-r)}else this._targetZoom=a;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let r="number"==typeof this._targetZoom?this._targetZoom:t.zoom,i=this._startZoom,n=this._easing,a=!1,o;if("wheel"===this._type&&i&&n){let t=Math.min((dg()-this._lastWheelEventTime+5)/200,1),s=n(t);o=il.number(i,r,s),t<1?this._needsRerender=!0:a=!0}else o=r,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=ty;if(this._prevEase){let t=this._prevEase,i=(dg()-t.start)/t.duration,n=t.easing(i+.01)-t.easing(i),a=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.0729-a*a);r=tg(a,o,.25,1)}return this._prevEase={start:dg(),duration:t,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},_e=class{constructor(t,r){this._clickZoom=t,this._tapZoom=r}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},_t=class{constructor(t,r){this._tr=r,this.reset()}reset(){this._active=!1}dblclick(t,r){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:tA(this._tr.zoom+(t.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(r)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},_r=class{constructor(){this._tap=new vU({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,r,i){if(!this._swipePoint)if(this._tapTime){let n=r[0],a=t.timeStamp-this._tapTime<500,o=30>this._tapPoint.dist(n);a&&o?i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,r,i)}touchmove(t,r,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let n=r[0],a=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}else this._tap.touchmove(t,r,i)}touchend(t,r,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{let n=this._tap.touchend(t,r,i);n&&(this._tapTime=t.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},_i=class{constructor(t,r,i){this._el=t,this._mousePan=r,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},_n=class{constructor(t,r,i,n){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=r,this._mousePitch=i,this._mouseRoll=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},_a=class{constructor(t,r,i,n){this._el=t,this._touchZoom=r,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},_o=class{constructor(t,r){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=r,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=dw.create("div","maplibregl-cooperative-gesture-screen",t);let r=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(r=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=r,this._container.appendChild(n);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,r){this._enabled&&(this._map.fire(new dT("cooperativegestureprevented",{gestureType:t,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},_s=class{constructor(t){this._camera=t}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(eT.convert(t),this._camera.terrain)}};let _l=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;var _u=class extends t7{};function _c(t){return t.panDelta?.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}var _h=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(t,r,i){this._terrainGesture={inFlight:!1,anchorElevation:null},this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,r)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;let i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},a={},o={};for(let{handlerName:l,handler:u,allowed:c}of this._handlers){let h;
872if(u.isEnabled()){if(this._blockedByActive(o,c,l))u.reset();else if(u[r||t.type]){if(function(t,r){if(!tq[r])return!1;let i=t?.target?.ownerDocument?.defaultView||window;return t instanceof i.MouseEvent||t instanceof i.WheelEvent}(t,r||t.type)){let i=dw.mousePos(this._map.getCanvas(),t);h=u[r||t.type](t,i)}else{var s;if(tG[r||t.type]&&"touches"in t){let i=t.touches,n=this._getMapTouches(i),a=dw.touchPos(this._map.getCanvas(),n);h=u[r||t.type](t,a,n)}else tG[s=r||t.type]||tq[s]||(h=u[r||t.type](t))}this.mergeHandlerResult(n,a,h,l,i),h?.needsRenderFrame&&this._triggerRenderFrame()}(h||u.isActive())&&(o[l]=u)}}let l={};for(let t in this._previousActiveHandlers)o[t]||(l[t]=i);this._previousActiveHandlers=o,(Object.keys(l).length||_c(n))&&(this._changes.push([n,a,l]),this._triggerRenderFrame()),(Object.keys(o).length||_c(n))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},this._map=t,this._camera=r,this._transformProvider=new _s(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new vO(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let n=this._el;for(let[t,r,i]of(this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]],this._listeners))t.addEventListener(r,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[t,r,i]of this._listeners)t.removeEventListener(r,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){let r=this._map,i=r.getCanvasContainer();this._add("mapEvent",new vR(r,t));let n=r.boxZoom=new vB(r,t,this._transformProvider);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();let a=r.cooperativeGestures=new _o(r,t.cooperativeGestures);this._add("cooperativeGestures",a),t.cooperativeGestures&&a.enable();let o=new vV(r,this._transformProvider),s=new _t(r,this._transformProvider);r.doubleClickZoom=new _e(s,o),this._add("tapZoom",o),this._add("clickZoom",s),t.interactive&&t.doubleClickZoom&&r.doubleClickZoom.enable();let l=new _r;this._add("tapDragZoom",l);let u=r.touchPitch=new v3(r);this._add("touchPitch",u),t.interactive&&t.touchPitch&&r.touchPitch.enable(t.touchPitch);let c=()=>this._camera.transform.centerPoint,h=function({enable:t,clickTolerance:r,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateSpeed:a=.8},o){return new v$({clickTolerance:r,move:(t,r)=>{let s=o();if(i&&Math.abs(s.y-t.y)>n)return{bearingDelta:tV(new eT(t.x,r.y),r,s)};let l=(r.x-t.x)*a;return i&&r.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:new vq({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button&&!t.ctrlKey}),enable:t,assignEvents:vZ})}(t,c),f=function({enable:t,clickTolerance:r,pitchSpeed:i=-.5}){return new v$({clickTolerance:r,move:(t,r)=>({pitchDelta:(r.y-t.y)*i}),moveStateManager:new vq({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button}),enable:t,assignEvents:vZ})}(t),d=function({enable:t,clickTolerance:r,rollDegreesPerPixelMoved:i=.3},n){return new v$({clickTolerance:r,move:(t,r)=>{let a=n(),o=(r.x-t.x)*i;return r.y<a.y&&(o=-o),{rollDelta:o}},moveStateManager:new vq({checkCorrectEvent:t=>2===t.button&&t.ctrlKey}),enable:t,assignEvents:vZ})}(t,c);r.dragRotate=new _n(t,h,f,d),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",f,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),t.interactive&&t.dragRotate&&r.dragRotate.enable();let p=function({enable:t,clickTolerance:r}){return new v$({clickTolerance:r,move:(t,r)=>({around:r,panDelta:r.sub(t)}),activateOnStart:!0,moveStateManager:new vq({checkCorrectEvent:t=>0===t.button&&!t.ctrlKey}),enable:t,assignEvents:vZ})}(t),m=new vY(t,r);r.dragPan=new _i(i,p,m),this._add("mousePan",p),this._add("touchPan",m,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&r.dragPan.enable(t.dragPan);let g=new v1,y=new vJ;r.touchZoomRotate=new _a(i,y,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&r.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new vF(r,t),["touchPan"]);let v=r.scrollZoom=new v9(r,()=>
872this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",v,["mousePan"]),t.interactive&&t.scrollZoom&&r.scrollZoom.enable(t.scrollZoom);let _=r.keyboard=new v8(r,this._transformProvider);this._add("keyboard",_),t.interactive&&t.keyboard&&r.keyboard.enable()}_add(t,r,i){this._handlers.push({handlerName:t,handler:r,allowed:i}),this._handlersById[t]=r}stop(t){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!_l(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,r,i){for(let n in t)if(n!==i&&!r?.includes(n))return!0;return!1}_getMapTouches(t){let r=[];for(let i of t){let t=i.target;this._el.contains(t)&&r.push(i)}return r}mergeHandlerResult(t,r,i,n,a){if(!i)return;tb(t,i);let o={handlerName:n,originalEvent:i.originalEvent||a};void 0!==i.zoomDelta&&(r.zoom=o),void 0!==i.panDelta&&(r.drag=o),void 0!==i.rollDelta&&(r.roll=o),void 0!==i.pitchDelta&&(r.pitch=o),void 0!==i.bearingDelta&&(r.rotate=o)}_applyChanges(){let t={},r={},i={};for(let[n,a,o]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new eT(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),tb(r,a),tb(i,o);this._updateMapTransform(t,r,i),this._changes=[]}_updateMapTransform(t,r,i){let n=this._map.terrain;if(!_c(t))return void this._fireEvents(r,i,!0);let a=this._camera.getTransformForUpdate();this._camera.stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:l,pitchDelta:u,rollDelta:c}=t,{around:h,aroundOnSurface:f}=this._resolveAround(t,n,a),d=n?this._terrainGestureElevation(n,h,f,a,r):void 0,p={panDelta:o,zoomDelta:s,rollDelta:c,pitchDelta:u,bearingDelta:l,around:h,aroundElevation:d};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(h)&&(h=a.centerPoint);let m=this._computePreZoomAroundLoc(a,h,o,d);this._handleMapControls({terrain:n,tr:a,deltasForHelper:p,preZoomAroundLoc:m,combinedEventsInProgress:r,panDelta:o}),this._camera.applyUpdatedTransform(a),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(r,i,!0)}_resolveAround(t,r,i){let n=void 0===t.pinchAround?t.around:t.pinchAround;return n||=this._camera.transform.centerPoint,r&&!i.isPointOnMapSurface(n)?{around:i.centerPoint,aroundOnSurface:!1}:{around:n,aroundOnSurface:!0}}_terrainGestureElevation(t,r,i,n,a){if(!i)return;if(null===this._terrainGesture.anchorElevation&&(a.drag||a.zoom)){let i=n.screenTerrainPointToMercatorCoordinate(r,t);this._terrainGesture.anchorElevation=i?i.z:void 0}let o=this._terrainGesture.anchorElevation;if(null!=o&&!(.01>r.distSqr(n.centerPoint))&&!(o-n.elevation>=.9*(n.getCameraAltitude()-n.elevation)))return o}_computePreZoomAroundLoc(t,r,i,n){if(.01>r.distSqr(t.centerPoint))return t.center;let a=i?r.sub(i):r;return void 0===n?t.screenPointToLocation(a):t.screenPointToLocationAtElevation(a,n)}_handleMapControls({terrain:t,tr:r,deltasForHelper:i,preZoomAroundLoc:n,combinedEventsInProgress:a,panDelta:o}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,r),!t)return void s.handleMapControlsPan(i,r,n);if(!this._terrainGesture.inFlight){this._terrainGesture.inFlight=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(i,r,n);return}!s.useGlobeControls&&void 0===i.aroundElevation&&a.drag&&o?r.setCenter(r.screenPointToLocation(r.centerPoint.sub(o))):s.handleMapControlsPan(i,r,n)}_fireEvents(t,r,i){let n=_l(this._eventsInProgress),a=_l(t),o={};for(let r in t){let{originalEvent:i}=t[r];this._eventsInProgress[r]||(o[`${r}start`]=i),this._eventsInProgress[r]=t[r]}for(let t in!n&&a&&this._fireEvent("movestart",a.originalEvent),o)this._fireEvent(t,o[t]);for(let r in a&&this._fireEvent("move",a.originalEvent),t){let{originalEvent:i}=t[r];this._fireEvent(r,i)}let s={},l;for(let t in this._eventsInProgress){let{handlerName:i,originalEvent:n}=this._eventsInProgress[t];this._handlersById[i].isActive()||(delete this._eventsInProgress[t],l=r[i]||n,s[`${t}end`]=l)}for(let t in s)this._fireEvent(t,s[t]);
vendor: 6,749 bytes, line 872
872let u=_l(this._eventsInProgress),c=(n||a)&&!u;if(c&&this._terrainGesture.inFlight){this._camera.elevationFreeze=!1,this._terrainGesture={inFlight:!1,anchorElevation:null};let t=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(t)}if(i&&c){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;t&&(t.essential||!dp.prefersReducedMotion)?(r(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:l})):(this._fireEvent("moveend",l),r(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,r){this._camera.fire(new dA(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new _u("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},_f=class extends re{constructor(t){super(),this._renderFrameCallback=()=>{let t=Math.min((dg()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new m0,this.cameraHelper=new m8,void 0!==t.minZoom&&this.transform.setMinZoom(t.minZoom),void 0!==t.maxZoom&&this.transform.setMaxZoom(t.maxZoom),void 0!==t.minPitch&&this.transform.setMinPitch(t.minPitch),void 0!==t.maxPitch&&this.transform.setMaxPitch(t.maxPitch),void 0!==t.renderWorldCopies&&this.transform.setRenderWorldCopies(t.renderWorldCopies),null!==t.transformConstrain&&this.transform.setConstrainOverride(t.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=t.bearingSnap,this._zoomSnap=t.zoomSnap,this._requestRenderFrame=t.requestRenderFrame,this._cancelRenderFrame=t.cancelRenderFrame,this.terrain=t.terrain,this._centerClampedToGround=t.centerClampedToGround??!0,this.transformCameraUpdate=t.transformCameraUpdate??null,this._stopHandlers=t.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}setTerrain(t){this.terrain=t,this.applyTerrainChange()}migrateProjection(t,r){if(t.apply(this.transform,!0),this.transform=t,this.cameraHelper=r,this._requestedCameraState){let r=t.clone();r.apply(this._requestedCameraState,!0),this._requestedCameraState=r}}getCenter(){return new uo(this.transform.center.lng,this.transform.center.lat)}setCenter(t,r){return this.jumpTo({center:t},r)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,r){return this.jumpTo({elevation:t},r),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,r,i){return t=eT.convert(t).mult(-1),this.panTo(this.transform.center,tb({offset:t},r),i)}panTo(t,r,i){return this.easeTo(tb({center:t},r),i)}getZoom(){return this.transform.zoom}setZoom(t,r){return this.jumpTo({zoom:t},r),this}zoomTo(t,r,i){return this.easeTo(tb({zoom:t},r),i)}zoomIn(t,r){return this.zoomTo(tA(this.getZoom()+1,this._zoomSnap),t,r),this}zoomOut(t,r){return this.zoomTo(tA(this.getZoom()-1,this._zoomSnap),t,r),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,r){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new dA("movestart",r)).fire(new dA("move",r)).fire(new dA("moveend",r))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,r){return this.jumpTo({bearing:t},r),this}getPadding(){return this.transform.padding}setPadding(t,r){return this.jumpTo({padding:t},r),this}rotateTo(t,r,i){return this.easeTo(tb({bearing:t},r),i)}resetNorth(t,r){return this.rotateTo(0,tb({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(tb({bearing:0,pitch:0,roll:0,duration:1e3},t),r),this}snapToNorth(t,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,r):this}getPitch(){return this.transform.pitch}setPitch(t,r){return this.jumpTo({pitch:t},r),this}getRoll(){return this.transform.roll}setRoll(t,r){return this.jumpTo({roll:t},r),this}cameraForBounds(t,r){t=ph.convert(t).adjustAntiMeridian();let i=r?.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,r)}_cameraForBoxAndBearing(t,r,i,n){let a={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=tb({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){let t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}let o=tb(a,n.padding);n.padding=o;let s=this.transform,l=new ph(t,r),u=this.cameraHelper.cameraForBoxAndBearing(n,o,l,i,s);return u&&this._zoomSnap&&(u.zoom=tA(u.zoom,this._zoomSnap,-1)),u}fitBounds(t,r,i){return this._fitInternal(this.cameraForBounds(t,r),r,i)}fitScreenCoordinates(t,r,i,n,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(eT.convert(t)),this.transform.screenPointToLocation(eT.convert(r)),i,n),n,a)}_fitInternal(t,r,i){return t?(r=tb(t,r),delete r.padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(t,r){this.stop(),void 0!==t.zoom&&this._zoomSnap&&(t.zoom=tA(t.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),n=!1,a=!1,o=!1,s=i.zoom;this.terrain&&i.setElevation(this.terrain.getElevationForLngLat(t.center?uo.convert(t.center):i.center,i)),this.cameraHelper.handleJumpToCenterZoom(i,t);let l=i.zoom!==s;return void 0!==t.elevation&&i.elevation!==+t.elevation&&i.setElevation(+t.elevation),void 0!==t.bearing&&i.bearing!==+t.bearing&&(n=!0,i.setBearing(+t.bearing)),void 0!==t.pitch&&i.pitch!==+t.pitch&&(a=!0,i.setPitch(+t.pitch)),void 0!==t.roll&&i.roll!==+t.roll&&(o=!0,i.setRoll(+t.roll)),null==t.padding||i.isPaddingEqual(t.padding)||i.setPadding(t.padding),this.applyUpdatedTransform(i),this.fire(new dA("movestart",r)).fire(new dA("move",r)),l&&this.fire(new dA("zoomstart",r)).fire(new dA("zoom",r)).fire(new dA("zoomend",r)),n&&this.fire(new dA("rotatestart",r)).fire(new dA("rotate",r)).fire(new dA("rotateend",r)),a&&this.fire(new dA("pitchstart",r)).fire(new dA("pitch",r)).fire(new dA("pitchend",r)),o&&this.fire(new dA("rollstart",r)).fire(new dA("roll",r)).fire(new dA("rollend",r)),this.fire(new dA("moveend",r))}calculateAnchoredCameraOptions(t){let r=this.transform.clone(),i=uo.convert(t.anchorLocation),n=eT.convert(t.anchorScreenPoint),a={panDelta:n.sub(this.transform.locationToScreenPoint(i,this.terrain)),zoomDelta:void 0===t.zoom?0:t.zoom-r.zoom,bearingDelta:0,pitchDelta:0,rollDelta:0,around:n,aroundElevation:this.terrain?.getElevationForLngLat(i,r)};
872return this.cameraHelper.handleMapControlsRollPitchBearingZoom(a,r),this.cameraHelper.handleMapControlsPan(a,r,i),{center:r.center,zoom:r.zoom}}calculateCameraOptionsFromCameraLngLatAltRotation(t,r,i,n,a){let o=this.transform.calculateCenterFromCameraLngLatAlt(t,r,i,n);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:i,pitch:n,roll:a}}easeTo(t,r){this._stop(!1,t.easeId),void 0!==(t=tb({offset:[0,0],duration:500,easing:ty},t)).zoom&&this._zoomSnap&&(t.zoom=tA(t.zoom,this._zoomSnap)),(!1===t.animate||!t.essential&&dp.prefersReducedMotion)&&(t.duration=0);let i=this.getTransformForUpdate(),n=this.getBearing(),a=i.pitch,o=i.roll,s=void 0===t.bearing?n:this._normalizeBearing(t.bearing,n),l=void 0===t.pitch?a:+t.pitch,u=void 0===t.roll?o:this._normalizeBearing(t.roll,o),c=void 0===t.padding?i.padding:t.padding,h=eT.convert(t.offset),f,d;t.around&&(f=uo.convert(t.around),d=i.locationToScreenPoint(f));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},m=this.cameraHelper.handleEaseTo(i,{bearing:s,pitch:l,roll:u,padding:c,around:f,aroundPoint:d,offsetAsPoint:h,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||=n!==s,this._pitching||=l!==a,this._rolling||=u!==o,this._padding=!i.isPaddingEqual(c),this._zooming||=m.isZooming,this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,p),this.terrain&&this._prepareElevation(m.elevationCenter),this._ease(n=>{m.easeFunc(n),this.terrain&&!t.freezeElevation&&this._updateElevation(n),this.applyUpdatedTransform(i),this._fireMoveEvents(r)},i=>{this.terrain&&t.freezeElevation?this._finalizeElevation():this.elevationFreeze=!1,this._afterEase(r,i)},t),this}_prepareEase(t,r,i={}){this._moving=!0,r||i.moving||this.fire(new dA("movestart",t)),this._zooming&&!i.zooming&&this.fire(new dA("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new dA("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new dA("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new dA("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(t,this.transform),this.elevationFreeze=!0}_updateElevation(t){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let r=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(t<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,n=(r-(i*t+this._elevationStart))/(1-t);this._elevationStart+=t*(i-n),this._elevationTarget=r}this.transform.setElevation(il.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}applyTerrainChange(){if(this.elevationFreeze)return;let t=this.transform;t.setMinElevationForCurrentTile(this.terrain?this.terrain.getMinTileElevationForLngLatZoom(t.center,t.tileZoom):0),this.getCenterClampedToGround()&&t.setElevation(this.terrain?this.terrain.getElevationForLngLat(t.center,t):0)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let r=t.getCameraLngLat(),i=t.getCameraAltitude(),n=this.terrain?this.terrain.getElevationForLngLatZoom(r,t.zoom):0;if(i<n){let i=t.calculateCameraOptionsFromTo(r,n,t.center,t.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}applyUpdatedTransform(t){let r=[];if(r.push(t=>this._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&r.push(t=>this.transformCameraUpdate(t)),!r.length)return;let i=t.clone();for(let t of r){let r=i.clone(),{center:n,zoom:a,roll:o,pitch:s,bearing:l,elevation:u}=t(r);n&&r.setCenter(n),void 0!==u&&r.setElevation(u),void 0!==a&&r.setZoom(a),void 0!==o&&r.setRoll(o),void 0!==s&&r.setPitch(s),void 0!==l&&r.setBearing(l),i.apply(r,!1)}this.transform.apply(i,!1)}_fireMoveEvents(t){this.fire(new dA("move",t)),this._zooming&&this.fire(new dA("zoom",t)),this._rotating&&this.fire(new dA("rotate",t)),this._pitching&&this.fire(new dA("pitch",t)),this._rolling&&this.fire(new dA("roll",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let i=this._zooming,n=this._rotating,a=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new dA("zoomend",t)),n&&this.fire(new dA("rotateend",t)),a&&this.fire(new dA("pitchend",t)),o&&this.fire(new dA("rollend",t)),this.fire(new dA("moveend",t))}flyTo(t,r){if(!t.essential&&dp.prefersReducedMotion){let i=tx(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,r)}this.stop(),void 0!==(t=tb({offset:[0,0],speed:1.2,curve:1.42,easing:ty},t)).zoom&&this._zoomSnap&&(t.zoom=tA(t.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),n=i.bearing,a=i.pitch,o=i.roll,s=i.padding,l=void 0===t.bearing?n:this._normalizeBearing(t.bearing,n),u=void 0===t.pitch?a:+t.pitch,c=void 0===t.roll?o:this._normalizeBearing(t.roll,o),h=void 0===t.padding?i.padding:t.padding,f
872=eT.convert(t.offset),d=i.centerPoint.add(f),p=i.screenPointToLocation(d),m=this.cameraHelper.handleFlyTo(i,{bearing:l,pitch:u,roll:c,padding:h,locationAtOffset:p,offsetAsPoint:f,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),g=t.curve,y=Math.max(i.width,i.height),v=y/m.scaleOfZoom,_=m.pixelPathLength,b=y/m.scaleOfMinZoom,x=(g=Math.min(g,Math.sqrt(b/_*2)))*g;function w(t){let r=(v*v-y*y+(t?-1:1)*x*x*_*_)/(2*(t?v:y)*x*_);return Math.log(Math.sqrt(r*r+1)-r)}function E(t){return(Math.exp(t)-Math.exp(-t))/2}function T(t){return(Math.exp(t)+Math.exp(-t))/2}let A=w(!1),S=function(t){return T(A)/T(A+g*t)},C=function(t){var r;return y*((T(A)*(E(r=A+g*t)/T(r))-E(A))/x)/_},M=(w(!0)-A)/g;if(2e-6>Math.abs(_)||!isFinite(M)){if(1e-6>Math.abs(y-v))return this.easeTo(t,r);let i=v<y?-1:1;M=Math.abs(Math.log(v/y))/g,C=()=>0,S=t=>Math.exp(i*g*t)}if(void 0!==t.duration)t.duration=+t.duration;else{let r=void 0===t.screenSpeed?+t.speed:t.screenSpeed/g;t.duration=1e3*M/r}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==l,this._pitching=u!==a,this._rolling=c!==o,this._padding=!i.isPaddingEqual(h),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease(p=>{let g=p*M,y=1/S(g),v=C(g);this._rotating&&i.setBearing(il.number(n,l,p)),this._pitching&&i.setPitch(il.number(a,u,p)),this._rolling&&i.setRoll(il.number(o,c,p)),this._padding&&(i.interpolatePadding(s,h,p),d=i.centerPoint.add(f)),m.easeFunc(p,y,v,d),this.terrain&&!t.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&t.freezeElevation?this._finalizeElevation():this.elevationFreeze=!1,this._afterEase(r)},t),this}isEasing(){return!!this._easeFrameId}stop(t){return this._stop(t)}_stop(t,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,r)}return t||this._stopHandlers(),this}_ease(t,r,i){!1===i.animate||0===i.duration?(t(1),r()):(this._easeStart=dg(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,r){let i=Math.abs((t=t_(t,-180,180))-r);return Math.abs(t-360-r)<i&&(t-=360),Math.abs(t+360-r)<i&&(t+=360),t}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};let _d={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var _p=class{constructor(t=_d){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&("terrain"===t.type||"style"===t.dataType||"source"===t.dataType&&("metadata"===t.sourceDataType||"visibility"===t.sourceDataType))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=dw.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=dw.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=dw.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,r){let i=this._map._getUIString(`AttributionControl.${r}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"==typeof t?t:"")):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}let r=this._map.style.tileManagers;for(let i in r){let n=r[i];if(n.used||n.usedForTerrain){let r=n.getSource();r.attribution&&!t.includes(r.attribution)&&t.push(r.attribution)}}(t=t.filter(t=>String(t).trim())).sort((t,r)=>t.length-r.length);let i=(t=t.filter((r,i)=>{for(let n=i+1;n<t.length;n++)if(t[n].includes(r))return!1;return!0})).join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.replaceChildren(dw.sanitize(i)),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},_m=class{constructor(t={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let r=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&r.classList.add("maplibregl-compact"):r.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options?.compact,this._container=dw.create("div","maplibregl-ctrl");let r=dw.create("a","maplibregl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://maplibre.org/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},_g=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let r=++this._id;return this._queue.push({callback:t,id:r,cancelled:!1}),r}remove(t){let r=this._currentlyRunning;for(let i of r?this._queue.concat(r):this._queue)if(i.id===t){i.cancelled=!0;return}}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let r=this._currentlyRunning=this._queue;this._queue=[];let i=!1,n;for(let a of r)if(!a.cancelled){try{a.callback(t)}catch(t){i||(i=!0,n=t)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,i)throw n}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};let _y=["none","zoom","sourceTiles","visibleLayers","revision"];var _v=class{constructor(t,r,i,n){this._tileKeys=t.map(t=>t.key).sort().join(),this._revision=r,this._zoom=i,this._visibleLayerIds=n}difference(t){return this._revision===t?._revision?this._visibleLayerIds===t._visibleLayerIds?this._tileKeys===t._tileKeys?this._zoom===t._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};let __={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var _b=class{constructor(t,r){this.needsFollowUpFrame=!1,this.painter=t,this.terrain=r,this.rttSize=r.tileManager.tileSize*r.qualityFactor}getTexture(t){return t.getRTT(this._stacks.length-1).texture}
872prepareForRender(t,r){let i=r!==this._lastPrepareZoom;this._lastPrepareZoom=r,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter(i=>!t._layers[i].isHidden(r));let n=this._renderableLayerIds.join(),a=new Set;for(let r of this._renderableLayerIds){let i=t._layers[r],n=i.source;n&&__[i.type]&&a.add(n)}for(let i of(this._coordsAscending={},this._rttFingerprints={},a)){let a=t.tileManagers[i];if(!a)continue;this._coordsAscending[i]={};let o=this._coordsAscending[i],s=a.getSource(),l=s instanceof pS?s.terrainTileRanges:null;for(let t of a.getVisibleCoordinates()){let r=this.terrain.tileManager.getTerrainCoords(t,l);for(let t in r)o[t]||=[],o[t].push(r[t])}this._rttFingerprints[i]={};let u=this._rttFingerprints[i],c=a.getState().revision;for(let t in o)u[t]=new _v(o[t],c,r,n)}this.needsFollowUpFrame=!1;let o=i||this.painter.options.moving,s=!1;for(let t of this._renderableTiles){let r=this._textureDifference(t);"none"!==r&&("zoom"===r&&o||"visibleLayers"===r&&i?this.needsFollowUpFrame=!0:"zoom"===r||"sourceTiles"===r?(s?this.needsFollowUpFrame=!0:t.releaseRTT(this.painter),s=!0):t.releaseRTT(this.painter))}}_textureDifference(t){let r="none";for(let i in this._rttFingerprints){let n=this._rttFingerprints[i][t.tileID.key];if(!n)continue;let a=n.difference(t.rttFingerprint[i]);_y.indexOf(a)>_y.indexOf(r)&&(r=a)}return r}renderLayer(t,r){if(t.isHidden(this.painter.transform.zoom))return!1;let i=t.type,n=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(__[i]&&(this._prevType&&__[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(__[this._prevType]||__[i]&&a){this._prevType=i;let t=this._stacks.length-1,a=this._stacks[t]||[];for(let i of(r.isRenderingToTexture=!0,this._renderableTiles)){if(this._rttTiles.push(i),i.getRTT(t))continue;let o=i.acquireRTT(n,t,this.rttSize);for(let t of(n.bindRTT(o),n.context.clear({color:rH.transparent,stencil:0}),n.currentStencilSource=void 0,a)){let a=n.style._layers[t],o=a.source?this._coordsAscending[a.source][i.tileID.key]:[i.tileID];n.context.viewport.set([0,0,this.rttSize,this.rttSize]),n.renderTileClippingMasks(a,o),n.renderLayer(n,n.style.tileManagers[a.source],a,o,r),a.source&&(i.rttFingerprint[a.source]=this._rttFingerprints[a.source][i.tileID.key])}o.texture.generateMipmap()}return r.isRenderingToTexture=!1,function(t,r,i,n){let{isRenderingGlobe:a}=n,o=t.context,s=o.gl,l=t.transform,u=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),h=t.useProgram("terrain");for(let f of(o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]),i)){let i=r.getTerrainMesh(f.tileID),d=t.renderToTexture.getTexture(f),p=r.getTerrainData(f.tileID);o.activeTexture.set(s.TEXTURE0),d.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_LINEAR);let m=gk(r.getSkirtLength(l.zoom),l.calculateFogMatrix(f.tileID.toUnwrapped()),t.style.sky,l.pitch,a),g=y1(n,f.tileID,{applyTerrainMatrix:!1});h.draw(o,s.TRIANGLES,c,yJ.disabled,u,y0.backCCW,m,p,g,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],__[i]}return!1}};let _x={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use â + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},_w={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:_d,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileC
872acheSize:null,maxTileCacheZoomLevels:tX.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var _E=class extends re{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(t){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new _g,this._controls=[],this._mapId=tw++,this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style)return void this.fire(new dL("webglcontextlost",{originalEvent:t}));for(let t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(let[r]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${r}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new dL("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style)for(let t in this.style.imageManager.images=this._lostContextStyle.images,this._lostContextStyle.images){let r=this._lostContextStyle.images[t];r.isWebGLImage&&this.style.imageManager.updateImage(t,r,!1)}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(t){this.fire(new t9(t));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new dL("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let r={..._w,...t,canvasContextAttributes:{..._w.canvasContextAttributes,...t.canvasContextAttributes}};if(null!=r.minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new _f({minZoom:r.minZoom,maxZoom:r.maxZoom,minPitch:r.minPitch,maxPitch:r.maxPitch,bearingSnap:r.bearingSnap,zoomSnap:r.zoomSnap,renderWorldCopies:r.renderWorldCopies,centerClampedToGround:r.centerClampedToGround,terrain:this.terrain,transformConstrain:r.transformConstrain,requestRenderFrame:t=>this._requestRenderFrame(t),cancelRenderFrame:t=>this._cancelRenderFrame(t),transformCameraUpdate:r.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=r.interactive,this._maxTileCacheSize=r.maxTileCacheSize,this._maxTileCacheZoomLevels=r.maxTileCacheZoomLevels,this._canvasContextAttributes={...r.canvasContextAttributes},this._trackResize=!0===r.trackResize,this._terrainSkirtLength=r.terrainSkirtLength,this._refreshExpiredTiles=!0===r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._crossSourceCollisions=!0===r.crossSourceCollisions,this._collectResourceTiming=!0===r.collectResourceTiming,this._locale={..._x,...r.locale},this._clickTolerance=r.clickTolerance,this._overridePixelRatio=r.pixelRatio,this._maxCanvasSize=r.maxCanvasSize,this._zoomLevelsToOverscale=r.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===r.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(r.anisotropicFilterPitch),void 0!==r.reduceMotion&&(dp.prefersReducedMotion=r.reduceMotion),this._requestManager=new dE(r.transformRequest),this._container=this._resolveContainer(r.container),r.maxBounds&&this.setMaxBounds(r.maxBounds),this._setupContainer();try{this._setupPainter()}catch(t){throw this._cleanupContainer(),t}this._imageQueueHandle=S.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.markTerrainDepthDirty(),this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new _h(this,this._camera,r),"u">typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let i="string"==typeof r.hash&&r.hash||void 0;this._hash=r.hash?new vS(i).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:r.center,elevation:r.elevation,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,roll:r.roll}
872),r.bounds&&(this.resize(),this.fitBounds(r.bounds,tb({},r.fitBoundsOptions,{duration:0}))));let n="string"==typeof r.style||r.style?.projection?.type!=="globe";this.resize(null,n),this._localIdeographFontFamily=r.localIdeographFontFamily,this._validateStyle=r.validateStyle,r.style&&this.setStyle(r.style,{localIdeographFontFamily:r.localIdeographFontFamily}),r.attributionControl&&this.addControl(new _p("boolean"==typeof r.attributionControl?void 0:r.attributionControl)),r.maplibreLogo&&this.addControl(new _m,r.logoPosition),this.on("style.load",()=>{if(n||this._resizeTransform(),this._camera.transform.unmodified){let t=tx(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire("style"===t.dataType?new dC("styledata",t):new dM("sourcedata",t))}),this.on("dataloading",t=>{this.fire("style"===t.dataType?new dC("styledataloading",t):new dM("sourcedataloading",t))}),this.on("dataabort",t=>{this.fire(new dM("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,r){return this.style.setGlobalStateProperty(t,r),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t?.onAdd)return this.fire(new t9(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=t.onAdd(this);this._controls.push(t);let n=this._controlPositions[r];return r.includes("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(t){if(!t?.onRemove)return this.fire(new t9(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(t){return this._controls.includes(t)}coveringTiles(t){return pG(this._camera.transform,t)}setTransformCameraUpdate(t){this._camera.transformCameraUpdate=t}getCenter(){return new uo(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(t,r){return this._camera.setCenter(t,r),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(t,r){return this._camera.setCenterElevation(t,r),this}setCenterClampedToGround(t){this._camera.setCenterClampedToGround(t)}panBy(t,r,i){return this._camera.panBy(t,r,i),this}panTo(t,r,i){return this._camera.panTo(t,r,i),this}getZoom(){return this._camera.transform.zoom}setZoom(t,r){return this._camera.setZoom(t,r),this}zoomTo(t,r,i){return this._camera.zoomTo(t,r,i),this}zoomIn(t,r){return this._camera.zoomIn(t,r),this}zoomOut(t,r){return this._camera.zoomOut(t,r),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(t,r){return this._camera.setVerticalFieldOfView(t,r),this}getBearing(){return this._camera.transform.bearing}setBearing(t,r){return this._camera.setBearing(t,r),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(t){return this._camera.setZoomSnap(t),this}getPadding(){return this._camera.transform.padding}setPadding(t,r){return this._camera.setPadding(t,r),this}rotateTo(t,r,i){return this._camera.rotateTo(t,r,i),this}resetNorth(t,r){return this._camera.resetNorth(t,r),this}resetNorthPitch(t,r){return this._camera.resetNorthPitch(t,r),this}snapToNorth(t,r){return this._camera.snapToNorth(t,r),this}getPitch(){return this._camera.transform.pitch}setPitch(t,r){return this._camera.setPitch(t,r),this}getRoll(){return this._camera.transform.roll}setRoll(t,r){return this._camera.setRoll(t,r),this}cameraForBounds(t,r){return this._camera.cameraForBounds(t,r)}fitBounds(t,r,i){return this._camera.fitBounds(t,r,i),this}fitScreenCoordinates(t,r,i,n,a){return this._camera.fitScreenCoordinates(t,r,i,n,a),this}jumpTo(t,r){return this._camera.jumpTo(t,r),this}calculateAnchoredCameraOptions(t){return this._camera.calculateAnchoredCameraOptions(t)}calculateCameraOptionsFromCameraLngLatAltRotation(t,r,i,n,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(t,r,i,n,a)}easeTo(t,r){return this._camera.easeTo(t,r),this}flyTo(t,r){return this._camera.flyTo(t,r),this}stop(){return this._camera.stop(),this}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(uo.convert(t),this._camera.transform):null}
vendor: 4,633 bytes, line 872
872getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(t,r,i,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLat(i,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(t,r,i,n??0)}resize(t,r=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(r);let i=!this._camera._moving;return i&&(this.stop(),this.fire(new dA("movestart",t)).fire(new dA("move",t))),this.fire(new dT("resize",t)),i&&this.fire(new dA("moveend",t)),this}_resizeInternal(t=!0){let[r,i]=this._containerDimensions(),n=this._getClampedPixelRatio(r,i);if(this._resizeCanvas(r,i,n),this.painter.resize(r,i,n),this.painter.overLimit()){let t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];let n=this._getClampedPixelRatio(r,i);this._resizeCanvas(r,i,n),this.painter.resize(r,i,n)}this._resizeTransform(t)}_resizeTransform(t=!0){let[r,i]=this._containerDimensions();this._camera.transform.resize(r,i,t),this._camera._requestedCameraState?.resize(r,i,t)}_getClampedPixelRatio(t,r){let{0:i,1:n}=this._maxCanvasSize,a=this.getPixelRatio(),o=t*a,s=r*a,l=Math.min(o>i?i/o:1,s>n?n/s:1);return l<1&&tI("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),l*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(t){return this._camera.transform.setMaxBounds(ph.convert(t)),this._update()}setMinZoom(t){if((t??=-2)>=-2&&t<=this._camera.transform.maxZoom){let r=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMinZoom(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.zoom&&this.fire(new dA("zoomstart")).fire(new dA("zoom")).fire(new dA("zoomend")).fire(new dA("movestart")).fire(new dA("move")).fire(new dA("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(t=!1){let r=this._camera.transform;return t?r.applyConstrain(r.center,r.minZoom).zoom:r.minZoom}setMaxZoom(t){if((t??=22)>=this._camera.transform.minZoom){let r=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMaxZoom(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.zoom&&this.fire(new dA("zoomstart")).fire(new dA("zoom")).fire(new dA("zoomend")).fire(new dA("movestart")).fire(new dA("move")).fire(new dA("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(t){if((t??=0)<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this._camera.transform.maxPitch){let r=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMinPitch(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.pitch&&this.fire(new dA("pitchstart")).fire(new dA("pitch")).fire(new dA("pitchend")).fire(new dA("movestart")).fire(new dA("move")).fire(new dA("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(t){if((t??=60)>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this._camera.transform.minPitch){let r=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMaxPitch(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.pitch&&this.fire(new dA("pitchstart")).fire(new dA("pitch")).fire(new dA("pitchend")).fire(new dA("movestart")).fire(new dA("move")).fire(new dA("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if((t??=20)>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(t){return this._camera.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this._camera.transform.setConstrainOverride(t),this._update()}project(t){return this._camera.transform.locationToScreenPoint(uo.
872convert(t),this.style&&this.terrain)}unproject(t){return this._camera.transform.screenPointToLocation(eT.convert(t),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}_createDelegatedListener(t,r,i){if("mouseenter"===t||"mouseover"===t){let n=!1;return{layers:r,listener:i,delegates:{mousemove:a=>{let o=r.filter(t=>this.getLayer(t)),s=0===o.length?[]:this.queryRenderedFeatures(a.point,{layers:o});s.length?n||(n=!0,i.call(this,new dD(t,this,a.originalEvent,{features:s}))):n=!1},mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;return{layers:r,listener:i,delegates:{mousemove:a=>{let o=r.filter(t=>this.getLayer(t));(0===o.length?[]:this.queryRenderedFeatures(a.point,{layers:o})).length?n=!0:n&&(n=!1,i.call(this,new dD(t,this,a.originalEvent)))},mouseout:r=>{n&&(n=!1,i.call(this,new dD(t,this,r.originalEvent)))}}}}{let n=t=>{let n=r.filter(t=>this.getLayer(t)),a=0===n.length?[]:this.queryRenderedFeatures(t.point,{layers:n});a.length&&(t.features=a,i.call(this,t),delete t.features)};return{layers:r,listener:i,delegates:{[t]:n}}}}_saveDelegatedListener(t,r){this._delegatedListeners||={},this._delegatedListeners[t]||=[],this._delegatedListeners[t].push(r)}_removeDelegatedListener(t,r,i){if(!this._delegatedListeners?.[t])return;let n=this._delegatedListeners[t];for(let t=0;t<n.length;t++){let a=n[t];if(a.listener===i&&a.layers.length===r.length&&a.layers.every(t=>r.includes(t))){for(let t in a.delegates)this.off(t,a.delegates[t]);n.splice(t,1);return}}}on(t,r,i){if(void 0===i)return super.on(t,r);let n="string"==typeof r?[r]:r,a=this._createDelegatedListener(t,n,i);for(let r in this._saveDelegatedListener(t,a),a.delegates)this.on(r,a.delegates[r]);return{unsubscribe:()=>{this._removeDelegatedListener(t,n,i)}}}once(t,r,i){if(void 0===i)return super.once(t,r);let n="string"==typeof r?[r]:r,a=this._createDelegatedListener(t,n,i);for(let r in a.delegates){let o=a.delegates[r];a.delegates[r]=(...r)=>{this._removeDelegatedListener(t,n,i),o(...r)}}for(let r in this._saveDelegatedListener(t,a),a.delegates)this.once(r,a.delegates[r]);return this}off(t,r,i){if(void 0===i)return super.off(t,r);let n="string"==typeof r?[r]:r;return this._removeDelegatedListener(t,n,i),this}queryRenderedFeatures(t,r){if(!this.style)return[];let i,n=t instanceof eT||Array.isArray(t),a=n?t:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(r||=(n?{}:t)||{},a instanceof eT||"number"==typeof a[0])i=[eT.convert(a)];else{let t=eT.convert(a[0]),r=eT.convert(a[1]);i=[t,new eT(r.x,t.y),r,new eT(t.x,r.y),t]}return this.style.queryRenderedFeatures(i,r,this._camera.transform)}querySourceFeatures(t,r){return this.style.querySourceFeatures(t,r)}setStyle(t,r){return r=tb({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
872idateStyle},r),this._styleUrl="string"==typeof t?t:null,!1!==r.diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(t,r))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let r=this._locale[t];if(null==r)throw Error(`Missing UI string '${t}'`);return r}_updateStyle(t,r){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,r.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,r));let i=this.style&&r.transformStyle?this.style.serialize():void 0;return(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)?(this.style=new gD(this,r||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,r,i):this.style.loadJSON(t,r,i)):(this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new gD(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(t,r){if(this._diffStyleRequest?.abort(),"string"==typeof t){this._diffStyleRequest=new AbortController;let i=this._diffStyleRequest;try{let n=await this._requestManager.transformRequest(t,"Style");if(i.signal.aborted){this._diffStyleRequest=null;return}let a=await t3(n,i);this._diffStyleRequest=null,this._updateDiff(a.data,r)}catch(t){this._diffStyleRequest=null,tZ(t)||this.fire(new t9(ti(t)))}}else"object"==typeof t&&(this._diffStyleRequest=null,this._updateDiff(t,r))}_updateDiff(t,r){try{this.style.setState(t,r)&&this._update(!0)}catch(i){tI(`Unable to perform style diff: ${ti(i).message}. Rebuilding the style from scratch.`),this._updateStyle(t,r)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():void tI("There is no style added to the map.")}addSource(t,r){return this._lazyInitEmptyStyle(),this.style.addSource(t,r),this._update(!0)}isSourceLoaded(t){let r=this.style?.tileManagers[t];return void 0===r?void this.fire(new t9(Error(`There is no tile manager with ID '${t}'`))):r.loaded()}setTerrain(t,r={}){if(this.style._checkLoaded(),t&&aF(this,aM.terrain,{value:t},r))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let r=this.style.tileManagers[t.source];if(!r)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);for(let i in null===this.terrain&&r.reload(),this.style._layers){let r=this.style._layers[i];"hillshade"===r.type&&r.source===t.source&&tI("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===r.type&&r.source===t.source&&tI("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new mY(this.painter,r,t,this._terrainSkirtLength),this.painter.renderToTexture=new _b(this.painter,this.terrain),this._camera.setTerrain(this.terrain),this._terrainDataCallback=r=>this._handleTerrainDataEvent(r,t.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this.painter.destroyRTTResources(),this._camera.setTerrain(null);return this.style.triggerSymbolPlacement(),this.fire(new dO({terrain:t})),this}_handleTerrainDataEvent(t,r){if("style"===t.dataType)return void this.terrain.tileManager.releaseAllRTT();let i=t.sourceId===r;if(i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&t.tile&&(this.painter.markTerrainDepthDirty(),this._camera.applyTerrainChange()),t.tile){if(t.source?.type==="image")return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(t.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){for(let t of Object.values(this.style?.tileManagers))if(!t.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style?.getSource(t)}setSourceTileLodParams(t,r,i){if(i){let n=this.getSource(i);if(!n)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);n.calculateTileZoom=pU(Math.max(1,t),Math.max(1,r))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=pU(Math.max(1,t),Math.max(1,r));return this._update(!0),this}refreshTiles(t,r){let i=this.style.tileManagers[t];if(!i)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===r?i.reload(!0):i.refreshTiles(r.map(t=>new hs(t.z,t.x,t.y)))}addImage(t,r,i={}){this._lazyInitEmptyStyle();let n=this._createStyleImage(r,i);return n&&(this.style.addImage(t,n),n.userImage?.onAdd&&n.userImage.onAdd(this,t)),this}setMissingStyleImageResolver(t){return this._missingStyleImageResolver=t,this.style?.setMissingImageResolver(t),this}_createStyleImage(t,r={}){let{pixelRatio:i=1,sdf:n=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u}=r;if(t instanceof HTMLImageElement||tL(t)){let{width:r,height:c,data:h}=dp.getImageData(t);return{data:new lr({width:r,height:c},h),pixelRatio:i,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:0}}if(void 0===t.width||void 0===t.height)return this.fire(new t9(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))),null;{let{width:r,height:c,data:h}=t,f=cp(t.data);return{data:f?new lr({width:r,height:c}):new lr({width:r,height:c},new Uint8Array(h)),pixelRatio:i,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:0,isWebG
vendor: 4,992 bytes, line 872
872LImage:f,userImage:t}}}updateImage(t,r){let i=this.style.getImage(t);if(!i)return this.fire(new t9(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:a,data:o}=r instanceof HTMLImageElement||tL(r)?dp.getImageData(r):r;if(void 0===n||void 0===a)return this.fire(new t9(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(n!==i.data.width||a!==i.data.height)return this.fire(new t9(Error("The width and height of the updated image must be that same as the previous version of the image")));if(i.isWebGLImage=cp(o),i.isWebGLImage)i.userImage=r;else{let t=!(r instanceof HTMLImageElement||tL(r));i.data.replace(o,t)}return this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new t9(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}async loadImage(t){let r=await S.getImage(await this._requestManager.transformRequest(t,"Image"),new AbortController);if(!r.data)throw Error(`Could not load image ${t}: the response is empty`);return r}listImages(){return this.style?.listImages()??[]}addLayer(t,r){return this._lazyInitEmptyStyle(),this.style.addLayer(t,r),this._update(!0)}moveLayer(t,r){return this.style.moveLayer(t,r),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style?.getLayer(t)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(t,r,i){return this.style.setLayerZoomRange(t,r,i),this._update(!0)}setFilter(t,r,i={}){return this.style?.setFilter(t,r,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,r,i,n={}){return this.style?.setPaintProperty(t,r,i,n),this._update(!0)}getPaintProperty(t,r){return this.style.getPaintProperty(t,r)}setLayoutProperty(t,r,i,n={}){return this.style.setLayoutProperty(t,r,i,n),this._update(!0)}getLayoutProperty(t,r){return this.style.getLayoutProperty(t,r)}setGlyphs(t,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(t){return this._lazyInitEmptyStyle(),this.style.setFontFaces(t),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(t,r,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,r,i,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,r,t=>{t||this._update(!0)}),this}setLight(t,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,r={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,r),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,r){return this.style.setFeatureState(t,r),this._update()}removeFeatureState(t,r){return this.style.removeFeatureState(t,r),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,r=0;return this._container&&(t=this._container.clientWidth||400,r=this._container.clientHeight||300),[t,r]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[t,r]=this._containerDimensions();return t!==this._camera.transform.width||r!==this._camera.transform.height}_setupResizeObserver(){let t=!1,r=vA(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50),i=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new i(i=>{(t||(t=!0,this._shouldHandleInitialResize()))&&r(i)}),this._resizeObserver.observe(this._container)}_resolveContainer(t){if("string"==typeof t){let r=document.getElementById(t);if(!r)throw Error(`Container '${t}' not found.`);return r}if(t instanceof HTMLElement||t&&"object"==typeof t&&1===t.nodeType)return t;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let t=this._containerDimensions(),r=this._getClampedPixelRatio(t[0],t[1]),i=this._container;i.classList.add("maplibregl-map");let n=this._canvasContainer=dw.create("div","maplibregl-canvas-container",i);this._interactive&&n.classList.add("maplibregl-interactive"),this._canvas=dw.create("canvas","maplibregl-canvas",n),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","regi
872on"),this._resizeCanvas(t[0],t[1],r);let a=this._controlContainer=dw.create("div","maplibregl-control-container",i),o=this._controlPositions={};for(let t of["top-left","top-right","bottom-left","bottom-right"])o[t]=dw.create("div",`maplibregl-ctrl-${t} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(t,r,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*r),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${r}px`}_setupPainter(){let t={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},r=null;this._canvas.addEventListener("webglcontextcreationerror",t=>{r=t},{once:!0});let i=this._canvas.getContext("webgl2",t);if(!i)throw new vT(t,r);this.painter=new vE(i,this._camera.transform)}migrateProjection(t,r){this._camera.migrateProjection(t,r),this.painter.transform=t,this.fire(new dN({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?._loaded&&(this._styleDirty||=t,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){let r=this._idleTriggered?this._fadeDuration:0,i=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this._camera.transform.zoom,i=dg();this.style.zoomHistory.update(t,i);let a=new aW(t,{now:i,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),o=a.crossFadingFactor();(1!==o||o!==this._crossFadingFactor)&&(n=!0,this._crossFadingFactor=o),this.style.update(a)}let a=this.style.projection?.transitionState>0!==i;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,r,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:r,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new dT("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new dT("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let o=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new dT("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){for(let t of(this._hash&&this._hash.remove(),this._controls))t.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),"u">typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),S.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new dT("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,dp.frame(this._frameRequest,t=>{this._frameRequest=null;try{this._render(t)}catch(t){if(!tZ(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return"6.11.1"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}};let _T={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var _A=class{constructor(t){this._updateZoomButtons=()=>
vendor: 4,781 bytes, line 872
872{let t=this._map.getZoom(),r=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom(!0);this._zoomInButton.disabled=r,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{let t=this._map.getPitch(),r=this._map.getRoll(),i=this._map.getBearing(),n=1/Math.cos(tz(t))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${n}) rotateZ(${-r}deg) rotateX(${t}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${n}) rotateX(${t}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-i-r}deg)`;return}this._compassIcon.style.transform=`rotate(${-i}deg)`},this._setButtonTitle=(t,r)=>{let i=this._map._getUIString(`NavigationControl.${r}`);t.title=i,t.setAttribute("aria-label",i)},this.options=tb({},_T,t),this._container=dw.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),dw.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),dw.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=dw.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new _S(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,r){let i=dw.create("button",t,this._container);return i.type="button",i.addEventListener("click",r),i}},_S=class{constructor(t,r,i=!1){this.mousedown=t=>{this.startMove(t,dw.mousePos(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,dw.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1===t.targetTouches.length?(this._startPos=this._lastPos=dw.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=t=>{1===t.targetTouches.length?(this._lastPos=dw.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos)):this.reset()},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;let n=new vW;this._rotatePitchHandler=new v$({clickTolerance:3,move:(t,n)=>{let a=r.getBoundingClientRect(),o=new eT((a.bottom-a.top)/2,(a.right-a.left)/2);return{bearingDelta:tV(new eT(t.x,n.y),n,o),pitchDelta:i?-((n.y-t.y)*.5):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchcancel",this.reset)}startMove(t,r){this._rotatePitchHandler.dragStart(t,r),dw.disableDrag()}move(t,r){let i=this.map,{bearingDelta:n,pitchDelta:a}=this._rotatePitchHandler.dragMove(t,r)||{};
872n&&i.setBearing(i.getBearing()+n),a&&i.setPitch(i.getPitch()+a)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){dw.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};async function _C(t=!1){if(void 0!==O&&!t)return O;if(void 0===window.navigator.permissions)return O=!!window.navigator.geolocation;try{O="denied"!==(await window.navigator.permissions.query({name:"geolocation"})).state}catch{O=!!window.navigator.geolocation}return O}let _M={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},_D={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},_P="#3FB1CE";function _I(t,r,i=[]){let n=dw.createNS("http://www.w3.org/2000/svg",t);for(let t in r)n.setAttributeNS(null,t,r[t]);for(let t of i)n.appendChild(t);return n}var _k=class extends t7{},_O=class extends t7{},_N=class extends re{constructor(t){if(super(),this._onClick=t=>{this.fire(new _O("click",{originalEvent:t}))},this._onKeyPress=t=>{("Space"===t.code||"Enter"===t.code)&&this.togglePopup()},this._onKeyDown=t=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||t.composedPath()[0]!==this._element||t.altKey||t.ctrlKey||t.metaKey)return;let r=_D[t.key];if(!r)return;t.preventDefault(),t.stopPropagation();let i=t.shiftKey?10:1,n=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new eT(n.x+r[0]*i,n.y+r[1]*i))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new _k("dragstart"))),this.fire(new _k("drag"))},this._onKeyUp=t=>{_D[t.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=t=>{let r=t.originalEvent.target,i=this._element;this._popup&&(r===i||i.contains(r))&&this.togglePopup()},this._updateCoveredUnthrottled=()=>{let t=this._map?.terrain;if(!t||!this._isInViewport())return;let r=this._isCovered(t);r&&this._popup?.isOpen()&&this._popup.remove(),this._element.style.opacity=r?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",r)},this._updateCovered=vA(this._updateCoveredUnthrottled,100),this._update=t=>{if(!this._map)return;this._lngLat=function(t,r,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return t?.wrap();let a=new uo(t.lng,t.lat);if(t=new uo(t.lng,t.lat),r){let n=new uo(t.lng-360,t.lat),a=new uo(t.lng+360,t.lat),o=i.locationToScreenPoint(t).distSqr(r);i.locationToScreenPoint(n).distSqr(r)<o?t=n:i.locationToScreenPoint(a).distSqr(r)<o&&(t=a)}for(;Math.abs(t.lng-i.center.lng)>180;){let r=i.locationToScreenPoint(t);if(r.x>=0&&r.y>=0&&r.x<=i.width&&r.y<=i.height)break;t.lng>i.center.lng?t.lng-=360:t.lng+=360}return t.lng!==a.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(t))?t:a}(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t?.type==="move"||(this._pos=this._pos.round()),this._element.style.transform=`${_M[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`,this._updateOpacity()},this._onMove=t=>{if(!this._isDragging){let r=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=r}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new _k("dragstart"))),this.fire(new _k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new _k("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t?.anchor||"center",this._color=t?.color||_P,this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=eT.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=dw.create("div");let r=(N||(N=_I("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[_I("g",{"fill-rule":"nonzero"},[_I("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([t,r])=>_I("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:t,ry:r}))),_I("g",{fill:_P},[_I("path",{d:"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"})]),_I("g",{opacity:"0.25",fill:"#000000"},[_I("path",{d:"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"})]),_I("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),_I("g",{transform:"translate(8.0, 8.0)"},[_I("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),_I("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]))).cloneNode(!0);r.setAttributeNS(null,"height",`${41*this._scale}px`),r.setAttributeNS(null,"width",`${27*this._scale}px`),(function(t){return t.firstElementChild.children[1]})(r).setAttributeNS(null,"fill",this._color),this._element.appendChild(r),this._offset=eT.convert(t?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),function(t,r,i){let n=t.classList;for(let t in _M)n.remove(`maplibregl-${i}-anchor-${t}`);
872n.add(`maplibregl-${i}-anchor-${r}`)}(this._element,this._anchor,"marker"),t?.className)for(let r of t.className.split(" "))this._element.classList.add(r);this._popup=null}addTo(t){return this.remove(),this._map=t,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._updateAccessibilityRole(),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),t.on("idle",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("idle",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=uo.convert(t),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),t){if(!("offset"in t.options)){let r=13.5/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-((24.6+r)*1)],"bottom-right":[-r,-((24.6+r)*1)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new _k("dragend")))}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered||t&&(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map))),this}_updateOpacity(){if(!this._isInViewport())return;let t=this._map?.terrain,r=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!t||r){let t=r?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==t&&(this._element.style.opacity=t,this._element.classList.toggle("maplibregl-marker-covered",r));return}this._updateCovered()}_isInViewport(){let{width:t,height:r}=this._map._camera.transform;return!!this._pos&&this._pos.x>=0&&this._pos.y>=0&&this._pos.x<=t&&this._pos.y<=r}_isCovered(t){let r=this._map._camera.transform,i=t.getElevationForLngLat(this._lngLat,r),n=Math.max(0,-this._offset.y)/r.pixelsPerMeter,a=Math.sin(this._map.getPitch()*Math.PI/180)*n;return r.isLocationOccluded(this._lngLat,t,i+a)}getOffset(){return this._offset}setOffset(t){return this._offset=eT.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&=("0"===this._element.getAttribute("tabindex")&&this._element.removeAttribute("tabindex"),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let t=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",t),this._roleManaged=!0}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,r){return(void 0===this._opacity||void 0===t&&void 0===r)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=String(t)),void 0!==r&&(this._opacityWhenCovered=String(r)),this._map&&this._updateOpacity(),this}};let _L={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0}
872,_R=0,_F=!1;var _B=class extends t7{},_z=class extends t7{},_j=class extends t7{},_U=class extends re{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new _z("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new _z("geolocate",t)),this._finish()}},this._updateCamera=t=>{let r=new uo(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,n=tb({bearing:this._map.getBearing()},this.options.fitBoundsOptions),a=ph.fromLngLat(r,i);this._map.fitBounds(a,n,{geolocateSource:!0})},this._updateMarker=t=>{if(t){let r=new uo(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&_F)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new _j("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;let r=t?.[0]instanceof ResizeObserverEntry;t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new _B("trackuserlocationend")),this.fire(new _B("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>{t.preventDefault()}),this._geolocateButton=dw.create("button","maplibregl-ctrl-geolocate",this._container),dw.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){tI("Geolocation support is not available so the GeolocateControl will be disabled.");let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{let t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
872se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=dw.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new _N({element:this._dotElement}),this._circleElement=dw.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new _N({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=tb({},_L,t)}onAdd(t){return this._map=t,this._container=dw.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),_C().then(t=>this._finishSetupUI(t)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,_R=0,_F=!1}_isOutOfMapMaxBounds(t){let r=this._map.getMaxBounds(),i=t.coords;return r&&(i.longitude<r.getWest()||i.longitude>r.getEast()||i.latitude<r.getSouth()||i.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let t=this._userLocationDotMarker.getLngLat();if(!this.options.showUserLocation||!this.options.showAccuracyCircle||!this._accuracy||!t)return;let r=this._map.project(t),i=this._map.unproject([r.x+100,r.y]),n=t.distanceTo(i)/100,a=2*this._accuracy/n;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return tI("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new _B("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":_R--,_F=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new _B("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new _B("trackuserlocationstart")),this.fire(new _B("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++_R>1?(t={maximumAge:6e5,timeout:0},_F=!0):(t=this.options.positionOptions,_F=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
872se"),this.options.showUserLocation&&this._updateMarker(null)}},_V=class extends t7{},_$=class extends re{constructor(t={}){super(),this._onFullscreenChange=()=>{let t=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;t?.shadowRoot?.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=t.pseudo??!1,t?.container&&(t.container instanceof HTMLElement?this._container=t.container:tI("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||=this._map.getContainer(),this._controlContainer=dw.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=dw.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);dw.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new _V("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new _V("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};t.s(["AttributionControl",0,_p,"FullscreenControl",0,_$,"GeolocateControl",0,_U,"Map",0,_E,"NavigationControl",0,_A,"setWorkerUrl",0,function(t){tX.WORKER_URL=t}],264360);var _G=t.i(843476),_q=t.i(271645),_H=t.i(174080);t.s(["MapSearchControl",0,function({mapRef:t}){let[r,i]=(0,_q.useState)(""),[n,a]=(0,_q.useState)([]),[o,s]=(0,_q.useState)(!1),[l,u]=(0,_q.useState)(null),c=(0,_q.useRef)(null),h=(0,_q.useRef)(null),f=(0,_q.useCallback)(async t=>{if(t.trim().length<2){a([]),s(!1);return}try{let r=`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(t)}&countrycodes=ca&format=json&limit=5`,i=await fetch(r,{headers:{"Accept-Language":"en"}}),n=await i.json();a(n),n.length>0?(u(c.current?.getBoundingClientRect()??null),s(!0)):s(!1)}catch{a([]),s(!1)}},[]);return(0,_G.jsxs)("div",{className:"w-64",children:[(0,_G.jsx)("input",{ref:c,type:"text",value:r,onChange:t=>{let r=t.target.value;i(r),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>f(r),300)},onBlur:()=>setTimeout(()=>s(!1),150),placeholder:"Search regions in Canadaâ¦",style:{fontSize:"16px"},className:"w-full px-3 py-1.5 bg-white/80 rounded-md shadow-md text-sm outline-none border border-gray-200 focus:border-blue-400"}),o&&l&&"u">typeof document&&(0,_H.createPortal)((0,_G.jsx)("ul",{style:{position:"fixed",top:l.bottom+4,left:l.left,width:l.width,zIndex:9999},className:"bg-white/80 rounded-md shadow-lg border border-gray-200 overflow-hidden max-h-60 overflow-y-auto",children:n.map(r=>(0,_G.jsx)("li",{className:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100 border-b border-gray-100 last:border-0",onMouseDown:()=>(r=>{let n=t.current;if(!n)return;i(r.display_name.split(",")[0].trim()),s(!1);let[a,o,l,u]=r.boundingbox.map(Number);n.fitBounds([[l,a],[u,o]],{padding:40,maxZoom:14})})(r),children:r.display_name},r.place_id))}),document.body)]})}],90522);var _W=t.i(905151),_Z=t.i(456420);let _Y={name:"trees",size:24,node:[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]]};_Y.node;let _X=(0,_Z.default)(_Y),_K={name:"building-complex",size:24,node:[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}
872],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],aliases:["building-2"]};_K.node;let _Q=(0,_Z.default)(_K),_J={name:"road",size:24,node:[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M12 5V3",key:"vd5es"}],["path",{d:"M12 9v3",key:"qyerrc"}],["path",{d:"M2.077 18.449A2 2 0 0 0 4 21h16a2 2 0 0 0 1.924-2.55l-4-14A2 2 0 0 0 16 3H8a2 2 0 0 0-1.924 1.45z",key:"1cuxct"}]]};_J.node;let _0=(0,_Z.default)(_J),_1={name:"tram-front",size:24,node:[["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m18 22-2-3",key:"1p0ohu"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}]],aliases:["train"]};_1.node;let _2=(0,_Z.default)(_1),_3={name:"tag",size:24,node:[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]};_3.node;let _4=(0,_Z.default)(_3),_6={landuse:{label:"Land use",tooltip:"Block out parks, green spaces and industrial areas at high zoom levels",icon:(0,_G.jsx)(_X,{size:15})},buildings:{label:"Buildings",tooltip:"Show buildings at very high zoom levels",icon:(0,_G.jsx)(_Q,{size:15})},roads:{label:"Roads",tooltip:"Show road network",icon:(0,_G.jsx)(_0,{size:15})},transit:{label:"Transit / Rail",tooltip:"Show transit lines and rail corridors",icon:(0,_G.jsx)(_2,{size:15})},labels:{label:"Place names",tooltip:"Show place name labels on the map",icon:(0,_G.jsx)(_4,{size:15})}},_5=Object.keys(_W.LAYER_TOGGLE_PATTERNS).filter(t=>"water"!==t),_8={landuse:!0,buildings:!0,roads:!0,transit:!0,labels:!0,water:!0};t.s(["MapLayersControl",0,function({mapRef:t,initialVisibility:r}){let[i,n]=(0,_q.useState)(!1),[a,o]=(0,_q.useState)({..._8,...r});_q.default.useEffect(()=>{if(!r)return;let i=t.current;if(i){for(let[t,n]of Object.entries(r))if(!n){let r=_W.LAYER_TOGGLE_PATTERNS[t];for(let t of i.getStyle()?.layers||[])r.test(t.id)&&i.setLayoutProperty(t.id,"visibility","none")}}},[]);let s=(0,_q.useCallback)((r,i)=>{let n=t.current;if(!n)return;let a=_W.LAYER_TOGGLE_PATTERNS[r];for(let t of n.getStyle()?.layers||[])a.test(t.id)&&n.setLayoutProperty(t.id,"visibility",i?"visible":"none");o(t=>({...t,[r]:i}))},[t]);return(0,_G.jsxs)("div",{className:"relative",children:[(0,_G.jsx)("div",{className:"maplibregl-ctrl-group",children:(0,_G.jsx)("button",{style:{width:29,height:29,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},title:"Toggle map layers",onClick:()=>n(t=>!t),"aria-pressed":i,"aria-label":"Map layers",children:(0,_G.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,_G.jsx)("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),(0,_G.jsx)("polyline",{points:"2 17 12 22 22 17"}),(0,_G.jsx)("polyline",{points:"2 12 12 17 22 12"})]})})}),i&&(0,_G.jsxs)("div",{className:"absolute left-full top-0 ml-2 rounded-xl z-50 overflow-hidden",style:{minWidth:210,background:"#1e2130",boxShadow:"0 8px 32px rgba(0,0,0,0.45), 0 1.5px 4px rgba(0,0,0,0.3)",border:"1px solid rgba(255,255,255,0.07)"},children:[(0,_G.jsx)("div",{className:"px-4 py-2.5",style:{borderBottom:"1px solid rgba(255,255,255,0.07)"},children:(0,_G.jsx)("span",{className:"text-xs font-semibold uppercase tracking-widest",style:{color:"#7b8db0"},children:"Map layers"})}),(0,_G.jsx)("div",{className:"p-2",children:_5.map(t=>{let r=_6[t];if(!r)return null;let i=a[t];return(0,_G.jsxs)("label",{title:r.tooltip,className:"flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer select-none transition-colors duration-100",style:{background:i?"rgba(99,179,237,0.10)":"transparent",color:i?"#e2e8f0":"#4a5568"},onMouseEnter:t=>{i||(t.currentTarget.style.background="rgba(255,255,255,0.05)")},onMouseLeave:t=>{i||(t.currentTarget.style.background="transparent")},children:[(0,_G.jsx)("span",{style:{color:i?"#63b3ed":"#2d3748",flexShrink:0},children:r.icon}),(0,_G.jsx)("span",{className:"text-sm font-medium flex-1",style:{color:i?"#e2e8f0":"#4a5568"},children:r.label}),(0,_G.jsx)("span",{className:"flex-shrink-0 relative rounded-full transition-all duration-200",style:{width:30,height:16,background:i?"linear-gradient(90deg, #3b82f6, #63b3ed)":"#2d3748",boxShadow:i?"0 0 8px rgba(99,179,237,0.5)":"none"},children:(0,_G.jsx)("span",{className:"absolute rounded-full transition-transform duration-200",style:{to
872p:2,width:12,height:12,background:i?"#fff":"#4a5568",transform:i?"translateX(16px)":"translateX(2px)",boxShadow:i?"0 0 4px rgba(99,179,237,0.6)":"none"}})}),(0,_G.jsx)("input",{type:"checkbox",checked:i,onChange:r=>s(t,r.target.checked),className:"sr-only"})]},t)})})]})]})}],429525);let _7=1,_9=1;class be{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;addChannel(t){let{delay:r=0,duration:i=1/0,rate:n=1,repeat:a=1}=t,o=_7++,s={time:0,delay:r,duration:i,rate:n,repeat:a};return this._setChannelTime(s,this.time),this.channels.set(o,s),o}removeChannel(t){for(let[r,i]of(this.channels.delete(t),this.animations))i.channel===t&&this.detachAnimation(r)}isFinished(t){let r=this.channels.get(t);return void 0!==r&&this.time>=r.delay+r.duration*r.repeat}getTime(t){if(void 0===t)return this.time;let r=this.channels.get(t);return void 0===r?-1:r.time}setTime(t){for(let r of(this.time=Math.max(0,t),this.channels.values()))this._setChannelTime(r,this.time);for(let t of this.animations.values()){let{animation:r,channel:i}=t;r.setTime(this.getTime(i))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,r){let i=_9++;return this.animations.set(i,{animation:t,channel:r}),t.setTime(this.getTime(r)),i}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(-1===this.lastEngineTime&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,r){let i=r-t.delay;i>=t.duration*t.repeat?t.time=t.duration*t.rate:(t.time=Math.max(0,i)%t.duration,t.time*=t.rate)}}var bt=t.i(896875);Uint32Array.BYTES_PER_ELEMENT,bn("colors");let br=bn("floatColors");ba("colors");let bi=ba("floatColors");function bn(t){return`\ 873layout(std140) uniform ${t}Uniforms { 874 float useByteColors; 875} ${t}; 876 877vec3 ${t}_normalize(vec3 inputColor) { 878 return ${t}.useByteColors > 0.5 ? inputColor / 255.0 : inputColor; 879} 880 881vec4 ${t}_normalize(vec4 inputColor) { 882 return ${t}.useByteColors > 0.5 ? inputColor / 255.0 : inputColor; 883} 884 885vec4 ${t}_premultiplyAlpha(vec4 inputColor) { 886 return vec4(inputColor.rgb * inputColor.a, inputColor.a); 887} 888 889vec4 ${t}_unpremultiplyAlpha(vec4 inputColor) { 890 return inputColor.a > 0.0 ? vec4(inputColor.rgb / inputColor.a, inputColor.a) : vec4(0.0); 891} 892 893vec4 ${t}_premultiply_alpha(vec4 inputColor) { 894 return ${t}_premultiplyAlpha(inputColor); 895} 896 897vec4 ${t}_unpremultiply_alpha(vec4 inputColor) { 898 return ${t}_unpremultiplyAlpha(inputColor); 899} 900`}function ba(t){return`\ 901struct ${t}Uniforms { 902 useByteColors: f32 903}; 904 905@group(0) @binding(auto) var<uniform> ${t} : ${t}Uniforms; 906 907fn ${t}_normalize(inputColor: vec3<f32>) -> vec3<f32> { 908 return select(inputColor, inputColor / 255.0, ${t}.useByteColors > 0.5); 909} 910 911fn ${t}_normalize4(inputColor: vec4<f32>) -> vec4<f32> { 912 return select(inputColor, inputColor / 255.0, ${t}.useByteColors > 0.5); 913} 914 915fn ${t}_premultiplyAlpha(inputColor: vec4<f32>) -> vec4<f32> { 916 return vec4<f32>(inputColor.rgb * inputColor.a, inputColor.a); 917} 918 919fn ${t}_unpremultiplyAlpha(inputColor: vec4<f32>) -> vec4<f32> { 920 return select( 921 vec4<f32>(0.0), 922 vec4<f32>(inputColor.rgb / inputColor.a, inputColor.a), 923 inputColor.a > 0.0 924 ); 925} 926 927fn ${t}_premultiply_alpha(inputColor: vec4<f32>) -> vec4<f32> { 928 return ${t}_premultiplyAlpha(inputColor); 929} 930 931fn ${t}_unpremultiply_alpha(inputColor: vec4<f32>) -> vec4<f32> { 932 return ${t}_unpremultiplyAlpha(inputColor); 933} 934`}let bo={name:"floatColors",props:{},uniforms:{},vs:br,fs:br,source:bi,uniformTypes:{useByteColors:"f32"},defaultUniforms:{useByteColors:!0}};var bs=t.i(912828);let bl=`\ 935precision highp int; 936 937// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) 938struct AmbientLight { 939 vec3 color; 940}; 941 942struct PointLight { 943 vec3 color; 944 vec3 position; 945 vec3 attenuation; // 2nd order x:Constant-y:Linear-z:Exponential 946}; 947 948struct SpotLight { 949 vec3 color; 950 vec3 position; 951 vec3 direction; 952 vec3 attenuation; 953 vec2 coneCos; 954}; 955 956struct DirectionalLight { 957 vec3 color; 958 vec3 direction; 959}; 960 961struct UniformLight { 962 vec3 color; 963 vec3 position; 964 vec3 direction; 965 vec3 attenuation; 966 vec2 coneCos; 967}; 968 969layout(std140) uniform lightingUniforms { 970 int enabled; 971 int directionalLightCount; 972 int pointLightCount; 973 int spotLightCount; 974 vec3 ambientColor; 975 UniformLight lights[5]; 976} lighting; 977 978PointLight lighting_getPointLight(int index) { 979 UniformLight light = lighting.lights[index]; 980 return PointLight(light.color, light.position, light.attenuation); 981} 982 983SpotLight lighting_getSpotLight(int index) { 984 UniformLight light = lighting.lights[lighting.pointLightCount + index]; 985 return SpotLight(light.color, light.position, light.direction, light.attenuation, light.coneCos); 986} 987 988DirectionalLight lighting_getDirectionalLight(int index) { 989 UniformLight light = 990 lighting.lights[lighting.pointLightCount + lighting.spotLightCount + index]; 991 return DirectionalLight(light.color, light.direction); 992} 993 994float getPointLightAttenuation(PointLight pointLight, float distance) { 995 return pointLight.attenuation.x
996 + pointLight.attenuation.y * distance 997 + pointLight.attenuation.z * distance * distance; 998} 999 1000float getSpotLightAttenuation(SpotLight spotLight, vec3 positionWorldspace) { 1001 vec3 light_direction = normalize(positionWorldspace - spotLight.position); 1002 float coneFactor = smoothstep( 1003 spotLight.coneCos.y, 1004 spotLight.coneCos.x, 1005 dot(normalize(spotLight.direction), light_direction) 1006 ); 1007 float distanceAttenuation = getPointLightAttenuation( 1008 PointLight(spotLight.color, spotLight.position, spotLight.attenuation), 1009 distance(spotLight.position, positionWorldspace) 1010 ); 1011 return distanceAttenuation / max(coneFactor, 0.0001); 1012} 1013 1014// #endif 1015`,bu=`\ 1016// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX)) 1017const MAX_LIGHTS: i32 = 5; 1018 1019struct AmbientLight { 1020 color: vec3<f32>, 1021}; 1022 1023struct PointLight { 1024 color: vec3<f32>, 1025 position: vec3<f32>, 1026 attenuation: vec3<f32>, // 2nd order x:Constant-y:Linear-z:Exponential 1027}; 1028 1029struct SpotLight { 1030 color: vec3<f32>, 1031 position: vec3<f32>, 1032 direction: vec3<f32>, 1033 attenuation: vec3<f32>, 1034 coneCos: vec2<f32>, 1035}; 1036 1037struct DirectionalLight { 1038 color: vec3<f32>, 1039 direction: vec3<f32>, 1040}; 1041 1042struct UniformLight { 1043 color: vec3<f32>, 1044 position: vec3<f32>, 1045 direction: vec3<f32>, 1046 attenuation: vec3<f32>, 1047 coneCos: vec2<f32>, 1048}; 1049 1050struct lightingUniforms { 1051 enabled: i32, 1052 directionalLightCount: i32, 1053 pointLightCount: i32, 1054 spotLightCount: i32, 1055 ambientColor: vec3<f32>, 1056 lights: array<UniformLight, 5>, 1057}; 1058 1059@group(2) @binding(auto) var<uniform> lighting : lightingUniforms; 1060 1061fn lighting_getPointLight(index: i32) -> PointLight { 1062 let light = lighting.lights[index]; 1063 return PointLight(light.color, light.position, light.attenuation); 1064} 1065 1066fn lighting_getSpotLight(index: i32) -> SpotLight { 1067 let light = lighting.lights[lighting.pointLightCount + index]; 1068 return SpotLight(light.color, light.position, light.direction, light.attenuation, light.coneCos); 1069} 1070 1071fn lighting_getDirectionalLight(index: i32) -> DirectionalLight { 1072 let light = lighting.lights[lighting.pointLightCount + lighting.spotLightCount + index]; 1073 return DirectionalLight(light.color, light.direction); 1074} 1075 1076fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 { 1077 return pointLight.attenuation.x 1078 + pointLight.attenuation.y * distance 1079 + pointLight.attenuation.z * distance * distance; 1080} 1081 1082fn getSpotLightAttenuation(spotLight: SpotLight, positionWorldspace: vec3<f32>) -> f32 { 1083 let lightDirection = normalize(positionWorldspace - spotLight.position); 1084 let coneFactor = smoothstep( 1085 spotLight.coneCos.y, 1086 spotLight.coneCos.x, 1087 dot(normalize(spotLight.direction), lightDirection) 1088 ); 1089 let distanceAttenuation = getPointLightAttenuation( 1090 PointLight(spotLight.color, spotLight.position, spotLight.attenuation), 1091 distance(spotLight.position, positionWorldspace) 1092 ); 1093 return distanceAttenuation / max(coneFactor, 0.0001); 1094} 1095`;function bc(t,r=!0){return t??r}function bh(t=[0,0,0],r=!0){return r?t.map(t=>t/255):[...t]}let bf={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",directionalLightCount:"i32",pointLightCount:"i32",spotLightCount:"i32",ambientColor:"vec3<f32>",lights:[{color:"vec3<f32>",position:"vec3<f32>",direction:"vec3<f32>",attenuation:"vec3<f32>",coneCos:"vec2<f32>"},5]},defaultUniforms:bp(),bindingLayout:[{name:"lighting",group:2}],firstBindingSlot:0,source:bu,vs:bl,fs:bl,getUniforms:function(t,r={}){if(!(t=t?{...t}:t))return bp();t.lights&&(t={...t,...function(t){let r={pointLights:[],spotLights:[],directionalLights:[]};for(let i of t||[])switch(i.type){case"ambient":r.ambientLight=i;break;case"directional":r.directionalLights?.push(i);break;case"point":r.pointLights?.push(i);break;case"spot":r.spotLights?.push(i)}return r}(t.lights),lights:void 0});let{useByteColors:i,ambientLight:n,pointLights:a,spotLights:o,directionalLights:s}=t||{};if(!(n||a&&a.length>0||o&&o.length>0||s&&s.length>0))return{...bp(),enabled:0};let l={...bp(),...function({useByteColors:t,ambientLight:r,pointLights:i=[],spotLights:n=[],directionalLights:a=[]}){let o=bm(),s=0,l=0,u=0,c=0;for(let r of i){if(s>=5)break;o[s]={...o[s],color:bd(r,t),position:r.position,attenuation:r.attenuation||[1,0,0]},s++,l++}for(let r of n){var h;if(s>=5)break;o[s]={...o[s],color:bd(r,t),position:r.position,direction:r.direction,attenuation:r.attenuation||[1,0,0],coneCos:[Math.cos((h=r).innerConeAngle??0),Math.cos(h.outerConeAngle??Math.PI/4)]},s++,u++}for(let r of a){if(s>=5)break;o[s]={...o[s],color:bd(r,t),direction:r.direction},s++,c++}return i.length+n.length+a.length>5&&bs.log.warn("MAX_LIGHTS exceeded, truncating to 5")(),{ambientColor:bd(r,t),directionalLightCount:c,pointLightCount:l,spotLightCount:u,lights:o}}({useByteColors:i,ambientLight:n,pointLights:a,spotLights:o,directionalLights:s})};return void 0!==t.enabled&&(l.enabled=+!!t.enabled),l}};function bd(t={}
1095,r){let{color:i=[0,0,0],intensity:n=1}=t;return bh(i,bc(r,!0)).map(t=>t*n)}function bp(){return{enabled:1,directionalLightCount:0,pointLightCount:0,spotLightCount:0,ambientColor:[.1,.1,.1],lights:bm()}}function bm(){return Array.from({length:5},()=>({color:[1,1,1],position:[1,1,2],direction:[1,1,1],attenuation:[1,0,0],coneCos:[1,0]}))}let bg=`\ 1096layout(std140) uniform phongMaterialUniforms { 1097 uniform bool unlit; 1098 uniform float ambient; 1099 uniform float diffuse; 1100 uniform float shininess; 1101 uniform vec3 specularColor; 1102} material; 1103`,by=`\ 1104layout(std140) uniform phongMaterialUniforms { 1105 uniform bool unlit; 1106 uniform float ambient; 1107 uniform float diffuse; 1108 uniform float shininess; 1109 uniform vec3 specularColor; 1110} material; 1111 1112vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) { 1113 vec3 halfway_direction = normalize(light_direction + view_direction); 1114 float lambertian = dot(light_direction, normal_worldspace); 1115 float specular = 0.0; 1116 if (lambertian > 0.0) { 1117 float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); 1118 specular = pow(specular_angle, material.shininess); 1119 } 1120 lambertian = max(lambertian, 0.0); 1121 return (lambertian * material.diffuse * surfaceColor + specular * floatColors_normalize(material.specularColor)) * color; 1122} 1123 1124vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) { 1125 vec3 lightColor = surfaceColor; 1126 1127 if (material.unlit) { 1128 return surfaceColor; 1129 } 1130 1131 if (lighting.enabled == 0) { 1132 return lightColor; 1133 } 1134 1135 vec3 view_direction = normalize(cameraPosition - position_worldspace); 1136 lightColor = material.ambient * surfaceColor * lighting.ambientColor; 1137 1138 for (int i = 0; i < lighting.pointLightCount; i++) { 1139 PointLight pointLight = lighting_getPointLight(i); 1140 vec3 light_position_worldspace = pointLight.position; 1141 vec3 light_direction = normalize(light_position_worldspace - position_worldspace); 1142 float light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace)); 1143 lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation); 1144 } 1145 1146 for (int i = 0; i < lighting.spotLightCount; i++) { 1147 SpotLight spotLight = lighting_getSpotLight(i); 1148 vec3 light_position_worldspace = spotLight.position; 1149 vec3 light_direction = normalize(light_position_worldspace - position_worldspace); 1150 float light_attenuation = getSpotLightAttenuation(spotLight, position_worldspace); 1151 lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, spotLight.color / light_attenuation); 1152 } 1153 1154 for (int i = 0; i < lighting.directionalLightCount; i++) { 1155 DirectionalLight directionalLight = lighting_getDirectionalLight(i); 1156 lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); 1157 } 1158 1159 return lightColor; 1160} 1161`,bv=`\ 1162struct phongMaterialUniforms { 1163 unlit: u32, 1164 ambient: f32, 1165 diffuse: f32, 1166 shininess: f32, 1167 specularColor: vec3<f32>, 1168}; 1169 1170@group(3) @binding(auto) var<uniform> phongMaterial : phongMaterialUniforms; 1171 1172fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, view_direction: vec3<f32>, normal_worldspace: vec3<f32>, color: vec3<f32>) -> vec3<f32> { 1173 let halfway_direction: vec3<f32> = normalize(light_direction + view_direction); 1174 var lambertian: f32 = dot(light_direction, normal_worldspace); 1175 var specular: f32 = 0.0; 1176 if (lambertian > 0.0) { 1177 let specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0); 1178 specular = pow(specular_angle, phongMaterial.shininess); 1179 } 1180 lambertian = max(lambertian, 0.0); 1181 return ( 1182 lambertian * phongMaterial.diffuse * surfaceColor + 1183 specular * floatColors_normalize(phongMaterial.specularColor) 1184 ) * color; 1185} 1186 1187fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> { 1188 var lightColor: vec3<f32> = surfaceColor; 1189 1190 if (phongMaterial.unlit != 0u) { 1191 return surfaceColor; 1192 } 1193 1194 if (lighting.enabled == 0) { 1195 return lightColor; 1196 } 1197 1198 let view_direction: vec3<f32> = normalize(cameraPosition - position_worldspace); 1199 lightColor = phongMaterial.ambient * surfaceColor * lighting.ambientColor; 1200 1201 for (var i: i32 = 0; i < lighting.pointLightCount; i++) { 1202 let pointLight: PointLight = lighting_getPointLight(i); 1203 let light_position_worldspace: vec3<f32> = pointLight.position; 1204 let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); 1205 let light_attenuation = getPointLightAttenuation( 1206 pointLight, 1207 distance(light_position_worldspace, position_worldspace) 1208 ); 1209 lightColor += lighting_getLightColor( 1210 surfaceColor, 1211 light_direction, 1212 view_direction, 1213 normal_worldspace, 1214 pointLight.color / light_attenuation 1215 ); 1216 } 1217 1218 for (var i: i32 = 0; i < lighting.spotLightCount; i++) { 1219 let spotLight: SpotLight = lighting_getSpotLight(i); 1220 let light_position_worldspace: vec3<f32> = spotLight.position; 1221 let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); 1222 let light_attenuation = getSpotLightAttenuation(spotLight, position_worldspace); 1223 lightColor += lighting_getLightColor( 1224 surfaceColor, 1225 light_direction, 1226 view_direction, 1227 normal_worldspace, 1228 spotLight.color / light_attenuation 1229 ); 1230 } 1231 1232 for (var i: i32 = 0; i < lighting.directionalLightCount; i++) { 1233 let directionalLight: DirectionalLight = lighting_getDirectionalLight(i); 1234 lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); 1235 } 1236 1237 return lightColor; 1238} 1239 1240fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32>{ 1241 var lightColor = vec3<f32>(0, 0, 0); 1242 let surfaceColor = vec3<f32>(0, 0, 0); 1243 1244 if (lighting.enabled != 0) { 1245 let view_direction = normalize(cameraPosition - position_worldspace); 1246 1247 for (var i: i32 = 0; i < lighting.pointLightCount; i++) { 1248 let pointLight: PointLight = lighting_getPointLight(i); 1249 let light_position_worldspace: vec3<f32> = pointLight.position; 1250 let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); 1251 let light_attenuation = getPointLightAttenuation( 1252 pointLight, 1253 distance(light_position_worldspace, position_worldspace) 1254 ); 1255 lightColor += lighting_getLightColor( 1256 surfaceColor, 1257 light_direction, 1258 view_direction, 1259 normal_worldspace, 1260 pointLight.color / light_attenuation 1261 ); 1262 } 1263 1264 for (var i: i32 = 0; i < lighting.spotLightCount; i++) { 1265 let spotLight: SpotLight = lighting_getSpotLight(i); 1266 let light_position_worldspace: vec3<f32> = spotLight.position; 1267 let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace); 1268 let light_attenuation = getSpotLightAttenuation(spotLight, position_worldspace); 1269 lightColor += lighting_getLightColor( 1270 surfaceColor, 1271 light_direction, 1272 view_direction, 1273 normal_worldspace, 1274 spotLight.color / light_attenuation 1275 ); 1276 } 1277 1278 for (var i: i32 = 0; i < lighting.directionalLightCount; i++) { 1279 let directionalLight: DirectionalLight = lighting_getDirectionalLight(i); 1280 lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color); 1281 } 1282 } 1283 return lightColor; 1284} 1285`,b_={props:{},name:"gouraudMaterial",bindingLayout:[{name:"gouraudMaterial",group:3}],vs:by.replace("phongMaterial","gouraudMaterial"),fs:bg.replace("phongMaterial","gouraudMaterial"),source:bv.replaceAll("phongMaterial","gouraudMaterial"),defines:{LIGHTING_VERTEX:!0},dependencies:[bf,bo],uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6,shininess:32,specularColor:[38.25,38.25,38.25]},getUniforms:t=>({...b_.defaultUniforms,...t})},bb={name:"phongMaterial",firstBindingSlot:0,bindingLayout:[{name:"phongMaterial",group:3}],dependencies:[bf,bo],source:bv,vs:bg,fs:by,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{unlit:"i32",ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{unlit:!1,ambient:.35,diffuse:.6,shininess:32,specularColor:[38.25,38.25,38.25]},getUniforms:t=>({...bb.defaultUniforms,...t})},bx=`\ 1286layout(std140) uniform layerUniforms { 1287 uniform float opacity; 1288} layer; 1289`,bw={name:"layer",source:`\ 1290struct LayerUniforms { 1291 opacity: f32, 1292}; 1293 1294@group(0) @binding(auto) 1295var<uniform> layer: LayerUniforms; 1296`,vs:bx,fs:bx,getUniforms:t=>({opacity:Math.pow(t.opacity,1/2.2)}),uniformTypes:{opacity:"f32"}},bE={name:"color",dependencies:[],source:` 1297 1298@must_use 1299fn deckgl_premultiplied_alpha(fragColor: vec4<f32>) -> vec4<f32> { 1300 return vec4(fragColor.rgb * fragColor.a, fragColor.a); 1301}; 1302`,getUniforms:t=>({})},bT="#define SMOOTH_EDGE_RADIUS 0.5",bA={name:"geometry",source:`\ 1303const SMOOTH_EDGE_RADIUS: f32 = 0.5; 1304 1305struct VertexGeometry { 1306 position: vec4<f32>, 1307 worldPosition: vec3<f32>, 1308 worldPositionAlt: vec3<f32>, 1309 normal: vec3<f32>, 1310 uv: vec2<f32>, 1311 pickingColor: vec3<f32>, 1312}; 1313 1314var<private> geometry_: VertexGeometry = VertexGeometry( 1315 vec4<f32>(0.0, 0.0, 1.0, 0.0), 1316 vec3<f32>(0.0, 0.0, 0.0), 1317 vec3<f32>(0.0, 0.0, 0.0), 1318 vec3<f32>(0.0, 0.0, 0.0), 1319 vec2<f32>(0.0, 0.0), 1320 vec3<f32>(0.0, 0.0, 0.0) 1321); 1322 1323struct FragmentGeometry { 1324 uv: vec2<f32>, 1325}; 1326 1327var<private> fragmentGeometry: FragmentGeometry; 1328 1329fn smoothedge(edge: f32, x: f32) -> f32 { 1330 return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); 1331} 1332`,vs:`\ 1333${bT} 1334 1335struct VertexGeometry { 1336 vec4 position; 1337 vec3 worldPosition; 1338 vec3 worldPositionAlt; 1339 vec3 normal; 1340 vec2 uv; 1341 vec3 pickingColor; 1342} geometry = VertexGeometry( 1343 vec4(0.0, 0.0, 1.0, 0.0), 1344 vec3(0.0), 1345 vec3(0.0), 1346 vec3(0.0), 1347 vec2(0.0), 1348 vec3(0.0) 1349); 1350`,fs:`\ 1351${bT} 1352 1353struct FragmentGeometry { 1354 vec2 uv; 1355}; 1356FragmentGeometry geometry; 1357 1358float smoothedge(float edge, float x) { 1359 return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); 1360} 1361`};
vendor: 5,228 bytes, line 1361
1361var bS=t.i(18342);let bC="u">typeof Float32Array?Float32Array:Array,bM=Math.random;function bD(t){return t>=0?Math.round(t):t%.5==0?Math.floor(t):Math.round(t)}function bP(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function bI(t,r){if(t===r){let i=r[1],n=r[2],a=r[3],o=r[6],s=r[7],l=r[11];t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=i,t[6]=r[9],t[7]=r[13],t[8]=n,t[9]=o,t[11]=r[14],t[12]=a,t[13]=s,t[14]=l}else t[0]=r[0],t[1]=r[4],t[2]=r[8],t[3]=r[12],t[4]=r[1],t[5]=r[5],t[6]=r[9],t[7]=r[13],t[8]=r[2],t[9]=r[6],t[10]=r[10],t[11]=r[14],t[12]=r[3],t[13]=r[7],t[14]=r[11],t[15]=r[15];return t}function bk(t,r){let i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],l=r[5],u=r[6],c=r[7],h=r[8],f=r[9],d=r[10],p=r[11],m=r[12],g=r[13],y=r[14],v=r[15],_=i*l-n*s,b=i*u-a*s,x=i*c-o*s,w=n*u-a*l,E=n*c-o*l,T=a*c-o*u,A=h*g-f*m,S=h*y-d*m,C=h*v-p*m,M=f*y-d*g,D=f*v-p*g,P=d*v-p*y,I=_*P-b*D+x*M+w*C-E*S+T*A;return I?(I=1/I,t[0]=(l*P-u*D+c*M)*I,t[1]=(a*D-n*P-o*M)*I,t[2]=(g*T-y*E+v*w)*I,t[3]=(d*E-f*T-p*w)*I,t[4]=(u*C-s*P-c*S)*I,t[5]=(i*P-a*C+o*S)*I,t[6]=(y*x-m*T-v*b)*I,t[7]=(h*T-d*x+p*b)*I,t[8]=(s*D-l*C+c*A)*I,t[9]=(n*C-i*D-o*A)*I,t[10]=(m*E-g*x+v*_)*I,t[11]=(f*x-h*E-p*_)*I,t[12]=(l*S-s*M-u*A)*I,t[13]=(i*M-n*S+a*A)*I,t[14]=(g*b-m*w-y*_)*I,t[15]=(h*w-f*b+d*_)*I,t):null}function bO(t){let r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],f=t[10],d=t[11],p=t[12],m=t[13],g=t[14],y=t[15],v=r*s-i*o,_=r*l-n*o,b=i*l-n*s,x=c*m-h*p,w=c*g-f*p,E=h*g-f*m;return u*(r*E-i*w+n*x)-a*(o*E-s*w+l*x)+y*(c*b-h*_+f*v)-d*(p*b-m*_+g*v)}function bN(t,r,i){let n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],u=r[5],c=r[6],h=r[7],f=r[8],d=r[9],p=r[10],m=r[11],g=r[12],y=r[13],v=r[14],_=r[15],b=i[0],x=i[1],w=i[2],E=i[3];return t[0]=b*n+x*l+w*f+E*g,t[1]=b*a+x*u+w*d+E*y,t[2]=b*o+x*c+w*p+E*v,t[3]=b*s+x*h+w*m+E*_,b=i[4],x=i[5],w=i[6],E=i[7],t[4]=b*n+x*l+w*f+E*g,t[5]=b*a+x*u+w*d+E*y,t[6]=b*o+x*c+w*p+E*v,t[7]=b*s+x*h+w*m+E*_,b=i[8],x=i[9],w=i[10],E=i[11],t[8]=b*n+x*l+w*f+E*g,t[9]=b*a+x*u+w*d+E*y,t[10]=b*o+x*c+w*p+E*v,t[11]=b*s+x*h+w*m+E*_,b=i[12],x=i[13],w=i[14],E=i[15],t[12]=b*n+x*l+w*f+E*g,t[13]=b*a+x*u+w*d+E*y,t[14]=b*o+x*c+w*p+E*v,t[15]=b*s+x*h+w*m+E*_,t}function bL(t,r,i){let n,a,o,s,l,u,c,h,f,d,p,m,g=i[0],y=i[1],v=i[2];return r===t?(t[12]=r[0]*g+r[4]*y+r[8]*v+r[12],t[13]=r[1]*g+r[5]*y+r[9]*v+r[13],t[14]=r[2]*g+r[6]*y+r[10]*v+r[14],t[15]=r[3]*g+r[7]*y+r[11]*v+r[15]):(n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],u=r[5],c=r[6],h=r[7],f=r[8],d=r[9],p=r[10],m=r[11],t[0]=n,t[1]=a,t[2]=o,t[3]=s,t[4]=l,t[5]=u,t[6]=c,t[7]=h,t[8]=f,t[9]=d,t[10]=p,t[11]=m,t[12]=n*g+l*y+f*v+r[12],t[13]=a*g+u*y+d*v+r[13],t[14]=o*g+c*y+p*v+r[14],t[15]=s*g+h*y+m*v+r[15]),t}function bR(t,r,i){let n=i[0],a=i[1],o=i[2];return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=r[3]*n,t[4]=r[4]*a,t[5]=r[5]*a,t[6]=r[6]*a,t[7]=r[7]*a,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=r[11]*o,t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t}function bF(t,r,i,n){let a,o,s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w,E,T,A,S,C,M,D=n[0],P=n[1],I=n[2],k=Math.sqrt(D*D+P*P+I*I);return k<1e-6?null:(D*=k=1/k,P*=k,I*=k,o=Math.sin(i),s=1-(a=Math.cos(i)),l=r[0],u=r[1],c=r[2],h=r[3],f=r[4],d=r[5],p=r[6],m=r[7],g=r[8],y=r[9],v=r[10],_=r[11],b=D*D*s+a,x=P*D*s+I*o,w=I*D*s-P*o,E=D*P*s-I*o,T=P*P*s+a,A=I*P*s+D*o,S=D*I*s+P*o,C=P*I*s-D*o,M=I*I*s+a,t[0]=l*b+f*x+g*w,t[1]=u*b+d*x+y*w,t[2]=c*b+p*x+v*w,t[3]=h*b+m*x+_*w,t[4]=l*E+f*T+g*A,t[5]=u*E+d*T+y*A,t[6]=c*E+p*T+v*A,t[7]=h*E+m*T+_*A,t[8]=l*S+f*C+g*M,t[9]=u*S+d*C+y*M,t[10]=c*S+p*C+v*M,t[11]=h*S+m*C+_*M,r!==t&&(t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t)}function bB(t,r,i){let n=Math.sin(i),a=Math.cos(i),o=r[4],s=r[5],l=r[6],u=r[7],c=r[8],h=r[9],f=r[10],d=r[11];return r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*a+c*n,t[5]=s*a+h*n,t[6]=l*a+f*n,t[7]=u*a+d*n,t[8]=c*a-o*n,t[9]=h*a-s*n,t[10]=f*a-l*n,t[11]=d*a-u*n,t}function bz(t,r,i){let n=Math.sin(i),a=Math.cos(i),o=r[0],s=r[1],l=r[2],u=r[3],c=r[8],h=r[9],f=r[10],d=r[11];return r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a-c*n,t[1]=s*a-h*n,t[2]=l*a-f*n,t[3]=u*a-d*n,t[8]=o*n+c*a,t[9]=s*n+h*a,t[10]=l*n+f*a,t[11]=u*n+d*a,t}function bj(t,r,i){let n=Math.sin(i),a=Math.cos(i),o=r[0],s=r[1],l=r[2],u=r[3],c=r[4],h=r[5],f=r[6],d=r[7];return r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a+c*n,t[1]=s*a+h*n,t[2]=l*a+f*n,t[3]=u*a+d*n,t[4]=c*a-o*n,t[5]=h*a-s*n,t[6]=f*a-l*n,t[7]=d*a-u*n,t}function bU(t,r,i){let n=r[0],a=r[1],o=r[2],s=r[3],l=n+n,u=a+a,c=o+o,h=n*l,f=n*u,d=n*c,p=a*u,m=a*c,g=o*c,y=s*l,v=s*u,_=s*c;return t[0]=1-(p+g),t[1]=f+_,t[2]=d-v,t[3]=0,t[4]=f-_,t[5]=1-(h+g),t[6]=m+y,t[7]=0,t[8]=d+v,t[9]=m-y,t[10]=1-(h+p),t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function bV(t,r){let i=r[0],n=r[1],a=r[2],o=r[4],s=r[5],l=r[6],u=r[8],c=r[9],h=r[10];return t[0]=Math.sqrt(i*i+n*n+a*a),t[1]=Math.sqrt(o*o+s*s+l*l),t[2]=Math.sqrt(u*u+c*c+h*h),t}function b$(t,r){let i=r[0],n=r[1],a=r[2],o=r[3],s=i+i,l=n+n,u=a+a,c=i*s,h=n*s,f=n*l,d=a*s,p=a*l,m=a*u,g=o*s,y=o*l,v=o*u;return t[0]=1-f-m,t[1]=h+v,t[2]=d-y,t[3]=0,t[4]=h-v,t[5]=1-c-m,t[6]=p+g,t[7]=0,t[8]=d+y,t[9]=
1361p-g,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function bG(t,r,i,n,a,o,s){let l=1/(i-r),u=1/(a-n),c=1/(o-s);return t[0]=2*o*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(i+r)*l,t[9]=(a+n)*u,t[10]=(s+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*c,t[15]=0,t}function bq(t,r,i,n,a){let o=1/Math.tan(r/2);if(t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=a&&a!==1/0){let r=1/(n-a);t[10]=(a+n)*r,t[14]=2*a*n*r}else t[10]=-1,t[14]=-2*n;return t}function bH(t,r,i,n,a,o,s){let l=1/(r-i),u=1/(n-a),c=1/(o-s);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(r+i)*l,t[13]=(a+n)*u,t[14]=(s+o)*c,t[15]=1,t}function bW(t,r,i,n){let a,o,s,l,u,c,h,f,d,p,m=r[0],g=r[1],y=r[2],v=n[0],_=n[1],b=n[2],x=i[0],w=i[1],E=i[2];return 1e-6>Math.abs(m-x)&&1e-6>Math.abs(g-w)&&1e-6>Math.abs(y-E)?bP(t):(a=1/Math.sqrt((f=m-x)*f+(d=g-w)*d+(p=y-E)*p),f*=a,d*=a,p*=a,(a=Math.sqrt((o=_*p-b*d)*o+(s=b*f-v*p)*s+(l=v*d-_*f)*l))?(o*=a=1/a,s*=a,l*=a):(o=0,s=0,l=0),(a=Math.sqrt((u=d*l-p*s)*u+(c=p*o-f*l)*c+(h=f*s-d*o)*h))?(u*=a=1/a,c*=a,h*=a):(u=0,c=0,h=0),t[0]=o,t[1]=u,t[2]=f,t[3]=0,t[4]=s,t[5]=c,t[6]=d,t[7]=0,t[8]=l,t[9]=h,t[10]=p,t[11]=0,t[12]=-(o*m+s*g+l*y),t[13]=-(u*m+c*g+h*y),t[14]=-(f*m+d*g+p*y),t[15]=1,t)}function bZ(t,r,i){return t[0]=r[0]-i[0],t[1]=r[1]-i[1],t[2]=r[2]-i[2],t[3]=r[3]-i[3],t[4]=r[4]-i[4],t[5]=r[5]-i[5],t[6]=r[6]-i[6],t[7]=r[7]-i[7],t[8]=r[8]-i[8],t[9]=r[9]-i[9],t[10]=r[10]-i[10],t[11]=r[11]-i[11],t[12]=r[12]-i[12],t[13]=r[13]-i[13],t[14]=r[14]-i[14],t[15]=r[15]-i[15],t}t.s(["add",0,function(t,r,i){return t[0]=r[0]+i[0],t[1]=r[1]+i[1],t[2]=r[2]+i[2],t[3]=r[3]+i[3],t[4]=r[4]+i[4],t[5]=r[5]+i[5],t[6]=r[6]+i[6],t[7]=r[7]+i[7],t[8]=r[8]+i[8],t[9]=r[9]+i[9],t[10]=r[10]+i[10],t[11]=r[11]+i[11],t[12]=r[12]+i[12],t[13]=r[13]+i[13],t[14]=r[14]+i[14],t[15]=r[15]+i[15],t},"adjoint",0,function(t,r){let i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],l=r[5],u=r[6],c=r[7],h=r[8],f=r[9],d=r[10],p=r[11],m=r[12],g=r[13],y=r[14],v=r[15],_=i*l-n*s,b=i*u-a*s,x=i*c-o*s,w=n*u-a*l,E=n*c-o*l,T=a*c-o*u,A=h*g-f*m,S=h*y-d*m,C=h*v-p*m,M=f*y-d*g,D=f*v-p*g,P=d*v-p*y;return t[0]=l*P-u*D+c*M,t[1]=a*D-n*P-o*M,t[2]=g*T-y*E+v*w,t[3]=d*E-f*T-p*w,t[4]=u*C-s*P-c*S,t[5]=i*P-a*C+o*S,t[6]=y*x-m*T-v*b,t[7]=h*T-d*x+p*b,t[8]=s*D-l*C+c*A,t[9]=n*C-i*D-o*A,t[10]=m*E-g*x+v*_,t[11]=f*x-h*E-p*_,t[12]=l*S-s*M-u*A,t[13]=i*M-n*S+a*A,t[14]=g*b-m*w-y*_,t[15]=h*w-f*b+d*_,t},"clone",0,function(t){let r=new bC(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},"copy",0,function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},"create",0,function(){let t=new bC(16);return bC!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},"decompose",0,function(t,r,i,n){r[0]=n[12],r[1]=n[13],r[2]=n[14];let a=n[0],o=n[1],s=n[2],l=n[4],u=n[5],c=n[6],h=n[8],f=n[9],d=n[10];i[0]=Math.sqrt(a*a+o*o+s*s),i[1]=Math.sqrt(l*l+u*u+c*c),i[2]=Math.sqrt(h*h+f*f+d*d);let p=1/i[0],m=1/i[1],g=1/i[2],y=a*p,v=o*m,_=s*g,b=l*p,x=u*m,w=c*g,E=h*p,T=f*m,A=d*g,S=y+x+A,C=0;return S>0?(C=2*Math.sqrt(S+1),t[3]=.25*C,t[0]=(w-T)/C,t[1]=(E-_)/C,t[2]=(v-b)/C):y>x&&y>A?(C=2*Math.sqrt(1+y-x-A),t[3]=(w-T)/C,t[0]=.25*C,t[1]=(v+b)/C,t[2]=(E+_)/C):x>A?(C=2*Math.sqrt(1+x-y-A),t[3]=(E-_)/C,t[0]=(v+b)/C,t[1]=.25*C,t[2]=(w+T)/C):(C=2*Math.sqrt(1+A-y-x),t[3]=(v-b)/C,t[0]=(E+_)/C,t[1]=(w+T)/C,t[2]=.25*C),t},"determinant",0,bO,"equals",0,function(t,r){let i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],m=t[12],g=t[13],y=t[14],v=t[15],_=r[0],b=r[1],x=r[2],w=r[3],E=r[4],T=r[5],A=r[6],S=r[7],C=r[8],M=r[9],D=r[10],P=r[11],I=r[12],k=r[13],O=r[14],N=r[15];return Math.abs(i-_)<=1e-6*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(a-x)<=1e-6*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(o-w)<=1e-6*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-E)<=1e-6*Math.max(1,Math.abs(s),Math.abs(E))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-A)<=1e-6*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(c-S)<=1e-6*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(h-C)<=1e-6*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(d-D)<=1e-6*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(p-P)<=1e-6*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(m-I)<=1e-6*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(g-k)<=1e-6*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(y-O)<=1e-6*Math.max(1,Math.abs(y),Math.abs(O))&&Math.abs(v-N)<=1e-6*Math.max(1,Math.abs(v),Math.abs(N))},"exactEquals",0,function(t,r){return t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]&&t[3]===r[3]&&t[4]===r[4]&&t[5]===r[5]&&t[6]===r[6]&&t[7]===r[7]&&t[8]===r[8]&&t[9]===r[9]&&t[10]===r[10]&&t[11]===r[11]&&t[12]===r[12]&&t[13]===r[13]&&t[14]===r[14]&&t[15]===r[15]},"frob",0,function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])},"fromQuat",0,b$,"fromQuat2",0,function(t,r){let i=new bC(3),n=-r[0],a=-r[1],o=-r[2],s=r[3],l=r[4],u=r[5],c=r[6],h=r[7],f=n*n+a*a+o*o+s*s;return f>0?(i[0]=(l*s+h*n+u*o-c*a)*2/f,i[1]=(u*s+h*a+c*n-l*o)*2/f,i[2]=(c*s+h*o+l*a-u*n)*2/f):(i[0]=(l*s+h*n+u*o-c*a)*2,i[1]=(u*s+h*a+c*n-l*o)*2,i[2]=(c*s+h*o+l*a-u*n)*2),bU(t,r,i),t},"fromRotation",0,function(t,r,i){let n,a,o,s=i[0],l=i[1],u=i[2],c=Math.sqrt(s*s+l*l+u*u);return c<1e-6?null:(s*=c=1/c,l*=c,u*=c,a=Math.sin(r),o=1-(n=Math.cos(r)),t[0]=s*s*o+n,t[1]=l*s*o+u*a,t[2]=u*s*o-l*a,t[3]=0,t[4]=s*l*o-u*a,t[5]=l*l*o+n,t[6]=u*l*o+s*a,t[7]=0,t[8]=s*u*o+l*a,t[9]=l*u*o-s*a,t[10]=u*u*o+n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},"fromRotationTranslation",0,bU,"fromRotationTranslationScale",0,function(t,r,i,n){let a=r[0],o=r[1],s=r[2],l=r[3],u=a+a,c=o+o,h=s+s,f=a*u,d=a*c,p=a*h,m=o*c,g=o*h,y=s*h,v=l*u,_=l*c,b=l*h,x=n[0],w=n[1],E=n[2];return t[0]=(1-(m+y))*x,t[1]=(d+b)*x,t[2]=(p-_)*x,t[3]=0,t[4]=(d-b)*w,t[5]=(1-(f+y))*w,t[6]=(g+v)*w,t[7]=0,t[8]=(p+_)*E,t[9]=(g-v)*E,t[10]=(1-(f+m))*E,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t},"fromRotationTranslationScaleOrigin",0,function(t,r,i,n,a){let o=r[0],s=r[1],l=r[2],u=r[3],c=o+o,h=s+s,f=l+l,d=o*c,p=o*h,m=o*f,g=s*h,y=s*f,v=l*f,_=u*c,b=u*h,x=u*f,w=n[0],E=n[1],T=n[2],A=a[0],S=a[1],C=a[2],M=(1-(g+v))*w,D=(p+x)*w,P=(m-b)*w,I=(p-x)*E,k=(1-(d+v))*E,O=(y+_)*E,N=(m+b)*T,L=(y-_)*T,R=(1-(d+g))*T;return t[0]=M,t[1]=D,t[2]=P,t[3]=0,t[4]=I,t[5]=k,t[6]=O,t[7]=0,t[8]=N,t[9]=L,t[10]=R,t[11]=0,t[12]=i[0]+A-(M*A+I*S+N*C),t[13]=i[1]+S-(D*A+k*S+L*C),t[14]=i[2]+C-(P*A+O*S+R*C),t[15]=1,t},"fromScaling",0,function(t,r){return t[0]=r[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=r[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},"fromTranslation",0,function(t,r){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},"fromValues",0,function(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g){let y=new bC(16);
1361return y[0]=t,y[1]=r,y[2]=i,y[3]=n,y[4]=a,y[5]=o,y[6]=s,y[7]=l,y[8]=u,y[9]=c,y[10]=h,y[11]=f,y[12]=d,y[13]=p,y[14]=m,y[15]=g,y},"fromXRotation",0,function(t,r){let i=Math.sin(r),n=Math.cos(r);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=i,t[7]=0,t[8]=0,t[9]=-i,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},"fromYRotation",0,function(t,r){let i=Math.sin(r),n=Math.cos(r);return t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=i,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},"fromZRotation",0,function(t,r){let i=Math.sin(r),n=Math.cos(r);return t[0]=n,t[1]=i,t[2]=0,t[3]=0,t[4]=-i,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},"frustum",0,bG,"getRotation",0,function(t,r){let i=new bC(3);bV(i,r);let n=1/i[0],a=1/i[1],o=1/i[2],s=r[0]*n,l=r[1]*a,u=r[2]*o,c=r[4]*n,h=r[5]*a,f=r[6]*o,d=r[8]*n,p=r[9]*a,m=r[10]*o,g=s+h+m,y=0;return g>0?(y=2*Math.sqrt(g+1),t[3]=.25*y,t[0]=(f-p)/y,t[1]=(d-u)/y,t[2]=(l-c)/y):s>h&&s>m?(y=2*Math.sqrt(1+s-h-m),t[3]=(f-p)/y,t[0]=.25*y,t[1]=(l+c)/y,t[2]=(d+u)/y):h>m?(y=2*Math.sqrt(1+h-s-m),t[3]=(d-u)/y,t[0]=(l+c)/y,t[1]=.25*y,t[2]=(f+p)/y):(y=2*Math.sqrt(1+m-s-h),t[3]=(l-c)/y,t[0]=(d+u)/y,t[1]=(f+p)/y,t[2]=.25*y),t},"getScaling",0,bV,"getTranslation",0,function(t,r){return t[0]=r[12],t[1]=r[13],t[2]=r[14],t},"identity",0,bP,"invert",0,bk,"lookAt",0,bW,"mul",0,bN,"multiply",0,bN,"multiplyScalar",0,function(t,r,i){return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=r[3]*i,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=r[7]*i,t[8]=r[8]*i,t[9]=r[9]*i,t[10]=r[10]*i,t[11]=r[11]*i,t[12]=r[12]*i,t[13]=r[13]*i,t[14]=r[14]*i,t[15]=r[15]*i,t},"multiplyScalarAndAdd",0,function(t,r,i,n){return t[0]=r[0]+i[0]*n,t[1]=r[1]+i[1]*n,t[2]=r[2]+i[2]*n,t[3]=r[3]+i[3]*n,t[4]=r[4]+i[4]*n,t[5]=r[5]+i[5]*n,t[6]=r[6]+i[6]*n,t[7]=r[7]+i[7]*n,t[8]=r[8]+i[8]*n,t[9]=r[9]+i[9]*n,t[10]=r[10]+i[10]*n,t[11]=r[11]+i[11]*n,t[12]=r[12]+i[12]*n,t[13]=r[13]+i[13]*n,t[14]=r[14]+i[14]*n,t[15]=r[15]+i[15]*n,t},"ortho",0,bH,"orthoNO",0,bH,"orthoZO",0,function(t,r,i,n,a,o,s){let l=1/(r-i),u=1/(n-a),c=1/(o-s);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(r+i)*l,t[13]=(a+n)*u,t[14]=o*c,t[15]=1,t},"perspective",0,bq,"perspectiveFromFieldOfView",0,function(t,r,i,n){let a=Math.tan(r.upDegrees*Math.PI/180),o=Math.tan(r.downDegrees*Math.PI/180),s=Math.tan(r.leftDegrees*Math.PI/180),l=Math.tan(r.rightDegrees*Math.PI/180),u=2/(s+l),c=2/(a+o);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-((s-l)*u*.5),t[9]=(a-o)*c*.5,t[10]=n/(i-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*i/(i-n),t[15]=0,t},"perspectiveNO",0,bq,"perspectiveZO",0,function(t,r,i,n,a){let o=1/Math.tan(r/2);if(t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=a&&a!==1/0){let r=1/(n-a);t[10]=a*r,t[14]=a*n*r}else t[10]=-1,t[14]=-n;return t},"rotate",0,bF,"rotateX",0,bB,"rotateY",0,bz,"rotateZ",0,bj,"scale",0,bR,"set",0,function(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y){return t[0]=r,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=l,t[7]=u,t[8]=c,t[9]=h,t[10]=f,t[11]=d,t[12]=p,t[13]=m,t[14]=g,t[15]=y,t},"str",0,function(t){return`mat4(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}, ${t[4]}, ${t[5]}, ${t[6]}, ${t[7]}, ${t[8]}, ${t[9]}, ${t[10]}, ${t[11]}, ${t[12]}, ${t[13]}, ${t[14]}, ${t[15]})`},"sub",0,bZ,"subtract",0,bZ,"targetTo",0,function(t,r,i,n){let a=r[0],o=r[1],s=r[2],l=n[0],u=n[1],c=n[2],h=a-i[0],f=o-i[1],d=s-i[2],p=h*h+f*f+d*d;p>0&&(h*=p=1/Math.sqrt(p),f*=p,d*=p);let m=u*d-c*f,g=c*h-l*d,y=l*f-u*h;return(p=m*m+g*g+y*y)>0&&(m*=p=1/Math.sqrt(p),g*=p,y*=p),t[0]=m,t[1]=g,t[2]=y,t[3]=0,t[4]=f*y-d*g,t[5]=d*m-h*y,t[6]=h*g-f*m,t[7]=0,t[8]=h,t[9]=f,t[10]=d,t[11]=0,t[12]=a,t[13]=o,t[14]=s,t[15]=1,t},"translate",0,bL,"transpose",0,bI],32664);var bY=t.i(32664),bY=bY;function bX(){let t=new bC(4);return bC!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function bK(t,r,i){return t[0]=r[0]+i[0],t[1]=r[1]+i[1],t[2]=r[2]+i[2],t[3]=r[3]+i[3],t}function bQ(t,r,i){return t[0]=r[0]-i[0],t[1]=r[1]-i[1],t[2]=r[2]-i[2],t[3]=r[3]-i[3],t}function bJ(t,r,i){return t[0]=r[0]*i[0],t[1]=r[1]*i[1],t[2]=r[2]*i[2],t[3]=r[3]*i[3],t}function b0(t,r,i){return t[0]=r[0]/i[0],t[1]=r[1]/i[1],t[2]=r[2]/i[2],t[3]=r[3]/i[3],t}function b1(t,r,i){return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=r[3]*i,t}function b2(t,r){let i=r[0]-t[0],n=r[1]-t[1],a=r[2]-t[2],o=r[3]-t[3];return Math.sqrt(i*i+n*n+a*a+o*o)}function b3(t,r){let i=r[0]-t[0],n=r[1]-t[1],a=r[2]-t[2],o=r[3]-t[3];return i*i+n*n+a*a+o*o}function b4(t){let r=t[0],i=t[1],n=t[2],a=t[3];return Math.sqrt(r*r+i*i+n*n+a*a)}function b6(t){let r=t[0],i=t[1],n=t[2],a=t[3];return r*r+i*i+n*n+a*a}function b5(t,r){let i=r[0],n=r[1],a=r[2],o=r[3],s=i*i+n*n+a*a+o*o;return s>0&&(s=1/Math.sqrt(s)),t[0]=i*s,t[1]=n*s,t[2]=a*s,t[3]=o*s,t}function b8(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]*r[3]}function b7(t,r,i,n){let a=r[0],o=r[1],s=r[2],l=r[3];return t[0]=a+n*(i[0]-a),t[1]=o+n*(i[1]-o),t[2]=s+n*(i[2]-s),t[3]=l+n*(i[3]-l),t}function b9(t,r,i){let n=r[0],a=r[1],o=r[2],s=r[3];return t[0]=i[0]*n+i[4]*a+i[8]*o+i[12]*s,t[1]=i[1]*n+i[5]*a+i[9]*o+i[13]*s,t[2]=i[2]*n+i[6]*a+i[10]*
1361o+i[14]*s,t[3]=i[3]*n+i[7]*a+i[11]*o+i[15]*s,t}function xe(t,r,i){let n=r[0],a=r[1],o=r[2],s=i[0],l=i[1],u=i[2],c=i[3],h=c*n+l*o-u*a,f=c*a+u*n-s*o,d=c*o+s*a-l*n,p=-s*n-l*a-u*o;return t[0]=h*c+-(p*s)+-(f*u)- -(d*l),t[1]=f*c+-(p*l)+-(d*s)- -(h*u),t[2]=d*c+-(p*u)+-(h*l)- -(f*s),t[3]=r[3],t}let xt=(Y=bX(),function(t,r,i,n,a,o){let s,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s<l;s+=r)Y[0]=t[s],Y[1]=t[s+1],Y[2]=t[s+2],Y[3]=t[s+3],a(Y,Y,o),t[s]=Y[0],t[s+1]=Y[1],t[s+2]=Y[2],t[s+3]=Y[3];return t});t.s(["add",0,bK,"ceil",0,function(t,r){return t[0]=Math.ceil(r[0]),t[1]=Math.ceil(r[1]),t[2]=Math.ceil(r[2]),t[3]=Math.ceil(r[3]),t},"clone",0,function(t){let r=new bC(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r},"copy",0,function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t},"create",0,bX,"cross",0,function(t,r,i,n){let a=i[0]*n[1]-i[1]*n[0],o=i[0]*n[2]-i[2]*n[0],s=i[0]*n[3]-i[3]*n[0],l=i[1]*n[2]-i[2]*n[1],u=i[1]*n[3]-i[3]*n[1],c=i[2]*n[3]-i[3]*n[2],h=r[0],f=r[1],d=r[2],p=r[3];return t[0]=f*c-d*u+p*l,t[1]=-(h*c)+d*s-p*o,t[2]=h*u-f*s+p*a,t[3]=-(h*l)+f*o-d*a,t},"dist",0,b2,"distance",0,b2,"div",0,b0,"divide",0,b0,"dot",0,b8,"equals",0,function(t,r){let i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return Math.abs(i-s)<=1e-6*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=1e-6*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=1e-6*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(o-c)<=1e-6*Math.max(1,Math.abs(o),Math.abs(c))},"exactEquals",0,function(t,r){return t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]&&t[3]===r[3]},"floor",0,function(t,r){return t[0]=Math.floor(r[0]),t[1]=Math.floor(r[1]),t[2]=Math.floor(r[2]),t[3]=Math.floor(r[3]),t},"forEach",0,xt,"fromValues",0,function(t,r,i,n){let a=new bC(4);return a[0]=t,a[1]=r,a[2]=i,a[3]=n,a},"inverse",0,function(t,r){return t[0]=1/r[0],t[1]=1/r[1],t[2]=1/r[2],t[3]=1/r[3],t},"len",0,b4,"length",0,b4,"lerp",0,b7,"max",0,function(t,r,i){return t[0]=Math.max(r[0],i[0]),t[1]=Math.max(r[1],i[1]),t[2]=Math.max(r[2],i[2]),t[3]=Math.max(r[3],i[3]),t},"min",0,function(t,r,i){return t[0]=Math.min(r[0],i[0]),t[1]=Math.min(r[1],i[1]),t[2]=Math.min(r[2],i[2]),t[3]=Math.min(r[3],i[3]),t},"mul",0,bJ,"multiply",0,bJ,"negate",0,function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t[3]=-r[3],t},"normalize",0,b5,"random",0,function(t,r){let i,n,a,o,s,l;r=void 0===r?1:r;do s=(i=2*bM()-1)*i+(n=2*bM()-1)*n;while(s>=1)do l=(a=2*bM()-1)*a+(o=2*bM()-1)*o;while(l>=1)let u=Math.sqrt((1-s)/l);return t[0]=r*i,t[1]=r*n,t[2]=r*a*u,t[3]=r*o*u,t},"round",0,function(t,r){return t[0]=bD(r[0]),t[1]=bD(r[1]),t[2]=bD(r[2]),t[3]=bD(r[3]),t},"scale",0,b1,"scaleAndAdd",0,function(t,r,i,n){return t[0]=r[0]+i[0]*n,t[1]=r[1]+i[1]*n,t[2]=r[2]+i[2]*n,t[3]=r[3]+i[3]*n,t},"set",0,function(t,r,i,n,a){return t[0]=r,t[1]=i,t[2]=n,t[3]=a,t},"sqrDist",0,b3,"sqrLen",0,b6,"squaredDistance",0,b3,"squaredLength",0,b6,"str",0,function(t){return`vec4(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]})`},"sub",0,bQ,"subtract",0,bQ,"transformMat4",0,b9,"transformQuat",0,xe,"zero",0,function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}],422642);var xr=t.i(422642),xr=xr,xi=t.i(25350);let xn=new xi.Log({id:"deck"});(eo=ef||(ef={}))[eo.Start=1]="Start",eo[eo.Move=2]="Move",eo[eo.End=4]="End",eo[eo.Cancel=8]="Cancel",(es=ed||(ed={}))[es.None=0]="None",es[es.Left=1]="Left",es[es.Right=2]="Right",es[es.Up=4]="Up",es[es.Down=8]="Down",es[es.Horizontal=3]="Horizontal",es[es.Vertical=12]="Vertical",es[es.All=15]="All",(el=ep||(ep={}))[el.Possible=1]="Possible",el[el.Began=2]="Began",el[el.Changed=4]="Changed",el[el.Ended=8]="Ended",el[el.Recognized=8]="Recognized",el[el.Cancelled=16]="Cancelled",el[el.Failed=32]="Failed";let xa="manipulation",xo="none",xs="pan-x",xl="pan-y";class xu{constructor(t,r){this.actions="",this.manager=t,this.set(r)}set(t){"compute"===t&&(t=this.compute()),this.manager.element&&(this.manager.element.style.touchAction=t,this.actions=t)}update(){this.set(this.manager.options.touchAction)}compute(){let t=[];for(let r of this.manager.recognizers)r.options.enable&&(t=t.concat(r.getTouchAction()));var r=t.join(" ");if(r.includes(xo))return xo;let i=r.includes(xs),n=r.includes(xl);return i&&n?xo:i||n?i?xs:xl:r.includes(xa)?xa:"auto"}}function xc(t){return t.trim().split(/\s+/g)}
1361function xh(t,r,i){if(t)for(let n of xc(r))t.addEventListener(n,i,!1)}function xf(t,r,i){if(t)for(let n of xc(r))t.removeEventListener(n,i,!1)}function xd(t){return(t.ownerDocument||t).defaultView}function xp(t){let r=t.length;if(1===r)return{x:Math.round(t[0].clientX),y:Math.round(t[0].clientY)};let i=0,n=0,a=0;for(;a<r;)i+=t[a].clientX,n+=t[a].clientY,a++;return{x:Math.round(i/r),y:Math.round(n/r)}}function xm(t){let r=[],i=0;for(;i<t.pointers.length;)r[i]={clientX:Math.round(t.pointers[i].clientX),clientY:Math.round(t.pointers[i].clientY)},i++;return{timeStamp:Date.now(),pointers:r,center:xp(r),deltaX:t.deltaX,deltaY:t.deltaY}}function xg(t,r){let i=r.x-t.x,n=r.y-t.y;return Math.sqrt(i*i+n*n)}function xy(t,r){let i=r.clientX-t.clientX,n=r.clientY-t.clientY;return Math.sqrt(i*i+n*n)}function xv(t,r){let i=r.clientX-t.clientX;return 180*Math.atan2(r.clientY-t.clientY,i)/Math.PI}function x_(t,r){return t===r?ed.None:Math.abs(t)>=Math.abs(r)?t<0?ed.Left:ed.Right:r<0?ed.Up:ed.Down}function xb(t,r,i){return{x:r/t||0,y:i/t||0}}function xx(t,r){return"pointerId"in t?t.pointerId:r}function xw(t,r){t.movementOrigin=new Map(r.map((t,r)=>[xx(t,r),{clientX:t.clientX,clientY:t.clientY}])),t.firstMovementTime=void 0}class xE{constructor(t){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=t=>{this.manager.options.enable&&this.handler(t)},this.manager=t,this.element=t.element,this.target=t.options.inputTarget||t.element}callback(t,r){var i;let n,a,o,s,l;i=this.manager,n=r.pointers.length,a=r.changedPointers.length,o=t&ef.Start&&n-a==0,s=t&(ef.End|ef.Cancel)&&n-a==0,r.isFirst=!!o,r.isFinal=!!s,o&&(i.session={}),r.eventType=t,l=function(t,r){var i,n;let a,o,s,l,u,{session:c}=t,{pointers:h}=r,{length:f}=h;c.firstInput||(c.firstInput=xm(r)),f>1&&!c.firstMultiple?c.firstMultiple=xm(r):1===f&&(c.firstMultiple=!1);let{firstInput:d,firstMultiple:p}=c,m=p?p.center:d.center,g=r.center=xp(h);r.timeStamp=Date.now(),r.deltaTime=r.timeStamp-d.timeStamp;let y=r.pointers.map(xx);if(c.movementOrigin?.size===y.length&&y.every(t=>c.movementOrigin.has(t))||xw(c,r.pointers),r.distancePerPointer=r.pointers.map((t,r)=>xy(c.movementOrigin.get(y[r]),t)),r.eventType&ef.Move&&r.distancePerPointer.some(t=>t>0)&&(c.firstMovementTime??(c.firstMovementTime=r.timeStamp)),r.movementDeltaTime=void 0===c.firstMovementTime?0:r.timeStamp-c.firstMovementTime,r.eventType&(ef.End|ef.Cancel)){let t=r.changedPointers.map(t=>xx(t,r.pointers.indexOf(t)));xw(c,r.pointers.filter((r,i)=>!t.includes(y[i])))}a=g.x-m.x,r.angle=180*Math.atan2(g.y-m.y,a)/Math.PI,r.distance=xg(m,g);let{deltaX:v,deltaY:_}=(o=r.center,s=c.offsetDelta,l=c.prevDelta,u=c.prevInput,(r.eventType===ef.Start||u?.eventType===ef.End)&&(l=c.prevDelta={x:u?.deltaX||0,y:u?.deltaY||0},s=c.offsetDelta={x:o.x,y:o.y}),{deltaX:l.x+(o.x-s.x),deltaY:l.y+(o.y-s.y)});r.deltaX=v,r.deltaY=_,r.offsetDirection=x_(r.deltaX,r.deltaY);let b=xb(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=b.x,r.overallVelocityY=b.y,r.overallVelocity=Math.abs(b.x)>Math.abs(b.y)?b.x:b.y,r.scale=p?(i=p.pointers,xy(h[0],h[1])/xy(i[0],i[1])):1,r.rotation=p?(n=p.pointers,xv(h[1],h[0])-xv(n[1],n[0])):0,r.maxPointers=c.prevInput?r.pointers.length>c.prevInput.maxPointers?r.pointers.length:c.prevInput.maxPointers:r.pointers.length;let x=t.element;return function(t,r){let i=t;for(;i;){if(i===r)return!0;i=i.parentNode}return!1}(r.srcEvent.target,x)&&(x=r.srcEvent.target),r.target=x,!function(t,r){let i,n,a,o,s=t.lastInterval||r,l=r.timeStamp-s.timeStamp;if(r.eventType!==ef.Cancel&&(l>25||void 0===s.velocity)){let u=r.deltaX-s.deltaX,c=r.deltaY-s.deltaY,h=xb(l,u,c);n=h.x,a=h.y,i=Math.abs(h.x)>Math.abs(h.y)?h.x:h.y,o=x_(u,c),t.lastInterval=r}else i=s.velocity,n=s.velocityX,a=s.velocityY,o=s.direction;r.velocity=i,r.velocityX=n,r.velocityY=a,r.direction=o}(c,r),r}(i,r),i.emit("hammer.input",l),i.recognize(l),i.session.prevInput=l}init(){xh(this.element,this.evEl,this.domHandler),xh(this.target,this.evTarget,this.domHandler),xh(xd(this.element),this.evWin,this.domHandler)}destroy(){xf(this.element,this.evEl,this.domHandler),xf(this.target,this.evTarget,this.domHandler),xf(xd(this.element),this.evWin,this.domHandler)}}let xT={pointerdown:ef.Start,pointermove:ef.Move,pointerup:ef.End,pointercancel:ef.Cancel,pointerout:ef.Cancel};class xA extends xE{constructor(t){super(t),this.evEl="pointerdown",this.evWin="pointermove pointerup pointercancel",this.store=this.manager.session.pointerEvents=[],this.init()}handler(t){let{store:r}=this,i=!1,n=xT[t.type],a=t.pointerType,o="touch"===a,s=r.findIndex(r=>r.pointerId===t.pointerId);n&ef.Start&&(t.buttons||o)?s<0&&(r.push(t),s=r.length-1):n&(ef.End|ef.Cancel)&&(i=!0),!(s<0)&&(r[s]=t,this.callback(n,{pointers:r,changedPointers:[t],eventType:n,pointerType:a,srcEvent:t}),i&&r.splice(s,1))}}let xS=["","webkit","Moz","MS","ms","o"],xC={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}};class xM{constructor(t,r){this.options={...xC,...r,cssProps:{...xC.cssProps,...r.cssProps},inputTarget:r.inputTarget||t},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new xA(this),this.touchAction=new xu(this,this.options.touchAction),this.toggleCssProps(!0)}set(t){return Object.assign(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this}stop(t){this.session.stopped=t?2:1}recognize(t){let r,{session:i}=this;if(i.stopped)return;this.session.prevented&&t.srcEvent.preventDefault();let{recognizers:n}=this,{curRecognizer:a}=i;(!a||a&&a.state&ep.Recognized)&&(a=i.curRecognizer=null);let o=0;for(;o<n.length;)r=n[o],2!==i.stopped&&(!a||r===a||r.canRecognizeWith(a))?r.recognize(t):r.reset(),!a&&r.state&(ep.Began|ep.Changed|ep.Ended)&&(a=i.curRecognizer=r),o++}get(t){let{recognizers:r}=this;for(let i=0;i<r.length;i++)if(r[i].options.event===t)return r[i];return null}add(t){if(Array.isArray(t)){for(let r of t)this.add(r);return this}let r=this.get(t.options.event);return r&&this.remove(r),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t}remove(t){if(Array.isArray(t)){for(let r of t)this.remove(r);return this}let r="string"==typeof t?this.get(t):t;if(r){let{recognizers:t}=this,i=t.indexOf(r);-1!==i&&(t.splice(i,1),this.touchAction.update())}return this}on(t,r){if(!t||!r)return;let{handlers:i}=this;for(let n of xc(t))i[n]=i[n]||[],i[n].push(r)}off(t,r){if(!t)return;let{handlers:i}=this;for(let n of xc(t))r?i[n]&&i[n].splice(i[n].indexOf(r),1):delete i[n]}emit(t,r){let i=this.handlers[t]&&this.handlers[t].slice();if(!i||!i.length)return;r.type=t,r.preventDefault=function(){r.srcEvent.preventDefault()};let n=0;for(;n<i.length;)i[n](r),n++}
1361destroy(){this.toggleCssProps(!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}toggleCssProps(t){let{element:r}=this;if(r){for(let[i,n]of Object.entries(this.options.cssProps)){let a=function(t,r){let i=r[0].toUpperCase()+r.slice(1);for(let n of xS){let a=n?n+i:r;if(a in t)return a}}(r.style,i);t?(this.oldCssProps[a]=r.style[a],r.style[a]=n):r.style[a]=this.oldCssProps[a]||""}t||(this.oldCssProps={})}}}let xD=1;function xP(t){return t&ep.Cancelled?"cancel":t&ep.Ended?"end":t&ep.Changed?"move":t&ep.Began?"start":""}class xI{constructor(t){this.options=t,this.id=xD++,this.state=ep.Possible,this.simultaneous={},this.requireFail=[]}set(t){return Object.assign(this.options,t),this.manager.touchAction.update(),this}recognizeWith(t){let r;if(Array.isArray(t)){for(let r of t)this.recognizeWith(r);return this}if("string"==typeof t){if(!(r=this.manager.get(t)))throw Error(`Cannot find recognizer ${t}`)}else r=t;let{simultaneous:i}=this;return i[r.id]||(i[r.id]=r,r.recognizeWith(this)),this}dropRecognizeWith(t){let r;if(Array.isArray(t)){for(let r of t)this.dropRecognizeWith(r);return this}return(r="string"==typeof t?this.manager.get(t):t)&&delete this.simultaneous[r.id],this}requireFailure(t){let r;if(Array.isArray(t)){for(let r of t)this.requireFailure(r);return this}if("string"==typeof t){if(!(r=this.manager.get(t)))throw Error(`Cannot find recognizer ${t}`)}else r=t;let{requireFail:i}=this;return -1===i.indexOf(r)&&(i.push(r),r.requireFailure(this)),this}dropRequireFailure(t){let r;if(Array.isArray(t)){for(let r of t)this.dropRequireFailure(r);return this}if(r="string"==typeof t?this.manager.get(t):t){let t=this.requireFail.indexOf(r);t>-1&&this.requireFail.splice(t,1)}return this}hasRequireFailures(){return!!this.requireFail.find(t=>t.options.enable)}canRecognizeWith(t){return!!this.simultaneous[t.id]}emit(t){if(!t)return;let{state:r}=this;r<ep.Ended&&this.manager.emit(this.options.event+xP(r),t),this.manager.emit(this.options.event,t),t.additionalEvent&&this.manager.emit(t.additionalEvent,t),r>=ep.Ended&&this.manager.emit(this.options.event+xP(r),t)}tryEmit(t){this.canEmit()?this.emit(t):this.state=ep.Failed}canEmit(){let t=0;for(;t<this.requireFail.length;){if(!(this.requireFail[t].state&(ep.Failed|ep.Possible)))return!1;t++}return!0}recognize(t){let r={...t};if(!this.options.enable){this.reset(),this.state=ep.Failed;return}this.state&(ep.Recognized|ep.Cancelled|ep.Failed)&&(this.state=ep.Possible),this.state=this.process(r),this.state&(ep.Began|ep.Changed|ep.Ended|ep.Cancelled)&&this.tryEmit(r)}getEventNames(){return[this.options.event]}reset(){}}class xk extends xI{attrTest(t){let r=this.options.pointers;return 0===r||t.pointers.length===r}coherentTest(t){let r=this.options.coherent;return!r?.length||r.some(r=>{var i,n;return i=t,(void 0===(n=r).distance||i.distance>=n.distance)&&(void 0===n.distancePerPointer||i.distancePerPointer.length>0&&i.distancePerPointer.every(t=>t>=n.distancePerPointer))&&(void 0===n.movementDeltaTime||i.movementDeltaTime>=n.movementDeltaTime)&&(void 0===n.rotation||Math.abs(((i.rotation+180)%360+360)%360-180)>=n.rotation)&&(void 0===n.scale||Math.abs(i.scale-1)>=n.scale)})}process(t){let{state:r}=this,{eventType:i}=t,n=r&(ep.Began|ep.Changed),a=this.attrTest(t);return n&&(i&ef.Cancel||!a)?r|ep.Cancelled:n||a?i&ef.End?r|ep.Ended:r&ep.Began?r|ep.Changed:ep.Began:ep.Failed}}let xO=["","start","move","end","cancel"];class xN extends xI{constructor(t={}){super({enable:!0,event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10,...t}),this.pTime=null,this.pCenter=null,this._timer=null,this._input=null,this.count=0}getTouchAction(){return[xa]}process(t){let{options:r}=this,i=t.pointers.length===r.pointers,n=t.distance<r.threshold,a=t.deltaTime<r.time;if(this.reset(),t.eventType&ef.Start&&0===this.count)return this.failTimeout();if(n&&a&&i){if(t.eventType!==ef.End)return this.failTimeout();let i=!this.pTime||t.timeStamp-this.pTime<r.interval,n=!this.pCenter||xg(this.pCenter,t.center)<r.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,n&&i?this.count+=1:this.count=1,this._input=t,0==this.count%r.taps)return this.hasRequireFailures()?(this._timer=setTimeout(()=>{this.state=ep.Recognized,this.tryEmit(this._input)},r.interval),ep.Began):ep.Recognized}return ep.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=ep.Failed},this.options.interval),ep.Failed}reset(){clearTimeout(this._timer)}emit(t){this.state===ep.Recognized&&(t.tapCount=this.count,this.manager.emit(this.options.event,t))}}class xL extends xk{constructor(){super(...arguments),this.wheelSession=null,this.wheelSessionUnsubscribe=null,this.handleWheelSessionEvent=t=>{"trackpad"===t.device&&this.handleTrackpadEvent(t)}}set(t){let{wheelSession:r,...i}=t;return r&&r!==this.wheelSession&&(this.wheelSessionUnsubscribe?.(),this.wheelSessionUnsubscribe=null,this.wheelSession=r),super.set(i),this.updateWheelSessionSubscription(),this}getTrackpadInput(t,r={}){let{srcEvent:i}=t,n=r.deltaX??t.deltaX,a=r.deltaY??t.deltaY,o=x_(n,a),s=Math.sqrt(t.deltaX*t.deltaX+t.deltaY*t.deltaY);return{pointers:[i,i],changedPointers:[i,i],pointerType:"trackpad",srcEvent:i,eventType:t.eventType,timeStamp:t.timeStamp,deltaTime:t.deltaTime,center:t.center,deltaX:n,deltaY:a,angle:180*Math.atan2(a,n)/Math.PI,distance:Math.sqrt(n*n+a*a),distancePerPointer:[s,s],movementDeltaT
1361ime:t.deltaTime,scale:1,rotation:0,direction:o,offsetDirection:o,velocity:t.velocity,velocityX:t.velocityX,velocityY:t.velocityY,overallVelocity:t.overallVelocity,overallVelocityX:t.overallVelocityX,overallVelocityY:t.overallVelocityY,maxPointers:2,target:i.target||this.manager.element,additionalEvent:"",...r}}updateWheelSessionSubscription(){let t=!!(this.wheelSession&&this.options.enable&&this.options.trackpad&&2===this.options.pointers);t&&!this.wheelSessionUnsubscribe?this.wheelSessionUnsubscribe=this.wheelSession.on(this.handleWheelSessionEvent):!t&&this.wheelSessionUnsubscribe&&(this.wheelSessionUnsubscribe(),this.wheelSessionUnsubscribe=null)}}let xR=["","start","move","end","cancel","up","down","left","right"];class xF extends xL{constructor(t={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:ed.All,trackpad:!1,coherent:[],...t}),this.trackpadGesture=!1,this.pX=null,this.pY=null}getTouchAction(){let{options:{direction:t}}=this,r=[];return t&ed.Horizontal&&r.push(xl),t&ed.Vertical&&r.push(xs),r}getEventNames(){return xR.map(t=>this.options.event+t)}directionTest(t){let{options:r}=this,i=!0,{distance:n}=t,{direction:a}=t,o=t.deltaX,s=t.deltaY;return a&r.direction||(r.direction&ed.Horizontal?(a=0===o?ed.None:o<0?ed.Left:ed.Right,i=o!==this.pX,n=Math.abs(t.deltaX)):(a=0===s?ed.None:s<0?ed.Up:ed.Down,i=s!==this.pY,n=Math.abs(t.deltaY))),t.direction=a,i&&n>r.threshold&&!!(a&r.direction)}attrTest(t){let r=!!(this.state&ep.Began),i=!(this.options.coherent?.length&&t.eventType&(ef.End|ef.Cancel));return super.attrTest(t)&&(r||i&&this.coherentTest(t)&&this.directionTest(t))}emit(t){this.pX=t.deltaX,this.pY=t.deltaY;let r=ed[t.direction].toLowerCase();r&&(t.additionalEvent=this.options.event+r),super.emit(t)}handleTrackpadEvent(t){t.isFirst&&(this.trackpadGesture=!t.srcEvent.ctrlKey,!this.trackpadGesture&&this.state&(ep.Recognized|ep.Cancelled|ep.Failed)&&(this.state=ep.Possible)),this.trackpadGesture&&(this.recognize(this.getTrackpadInput(t,{deltaX:-t.deltaX,deltaY:-t.deltaY,velocity:-t.velocity,velocityX:-t.velocityX,velocityY:-t.velocityY,overallVelocity:-t.overallVelocity,overallVelocityX:-t.overallVelocityX,overallVelocityY:-t.overallVelocityY})),t.isFinal&&(this.trackpadGesture=!1))}}let xB=["","start","move","end","cancel","in","out"];class xz{constructor(t,r,i){this.element=t,this.callback=r,this.options=i}listen(t,r){r?this.element.addEventListener(t,this.handleEvent,{passive:!1}):this.element.removeEventListener(t,this.handleEvent)}}let xj="u">typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"";"u">typeof window&&window;let xU=-1!==xj.indexOf("firefox");class xV extends xz{constructor(t,r,i){i.enable=i.enable??!1,super(t,r,i),this.handleEvent=t=>{if(!this.options.enable)return;let r=t.deltaY;globalThis.WheelEvent&&(xU&&t.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(r/=globalThis.devicePixelRatio),t.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(r*=40)),t.shiftKey&&r&&(r*=.25),this.callback({type:"wheel",center:{x:t.clientX,y:t.clientY},delta:-r,device:this.options.wheelSession?.device??"unknown",srcEvent:t,pointerType:"mouse",target:t.target})},i.enable&&(this.wheelSessionUnsubscribe=this.options.wheelSession?.on(()=>{}),this.listen("wheel",!0))}destroy(){this.listen("wheel",!1),this.wheelSessionUnsubscribe?.(),this.wheelSessionUnsubscribe=void 0}enableEventType(t,r){"wheel"===t&&this.options.enable!==r&&(this.options.enable=r,r&&!this.wheelSessionUnsubscribe&&(this.wheelSessionUnsubscribe=this.options.wheelSession?.on(()=>{})),this.listen("wheel",r),r||(this.wheelSessionUnsubscribe?.(),this.wheelSessionUnsubscribe=void 0))}}let x$={classificationDelay:32,endDelay:80};class xG{constructor(t,r={}){this.subscriptions=new Map,this.session=null,this.classificationTimer=null,this.endTimer=null,this.pressedControlKeys=new Set,this.listeningForControlKeys=!1,this.handleEvent=t=>{var r,i;let n,a;if(!this.hasSubscribers)return"unknown";let o=(r=t,i=this.pressedControlKeys.size>0,n=r.deltaX,a=r.deltaY,1===r.deltaMode&&(n*=40,a*=40),{event:r,timeStamp:r.timeStamp,deltaX:n,deltaY:a,isControlKeyDown:i}),s=this.session;if(s&&o.timeStamp-s.lastTimeStamp>=this.options.endDelay){if(this.end(),!this.hasSubscribers)return"unknown";s=null}s?(this.scheduleEnd(),this.addSample(s,o)):(s=this.startPendingSession(o),this.scheduleEnd());let{device:l}=s;return"unknown"===l&&"unknown"!==(l=xq(s.samples,!1))&&this.begin(s,l),l},this.finishClassification=()=>
1361{if(this.classificationTimer=null,!this.session||"unknown"!==this.session.device)return;let t=this.session,r=xq(t.samples,!0);this.begin(t,"unknown"===r?"mouse":r)},this.end=()=>{if(!this.session)return;if("unknown"===this.session.device){let t=this.session,r=xq(t.samples,!0);this.begin(t,"unknown"===r?"mouse":r)}if(!this.session)return;let t=this.session;this.emit(ef.End,t.lastEvent),this.reset()},this.handleKeyDown=t=>{"Control"===t.key&&this.pressedControlKeys.add(t.code||t.key)},this.handleKeyUp=t=>{"Control"===t.key&&(t.code?this.pressedControlKeys.delete(t.code):this.pressedControlKeys.clear())},this.handleWindowBlur=()=>{this.pressedControlKeys.clear()},this.element=t,this.options={...x$,...r},this.element?.addEventListener("wheel",this.handleEvent,{passive:!0})}get hasSubscribers(){return this.subscriptions.size>0}get device(){return this.session?.device??"unknown"}on(t){let r={listener:t};return this.subscriptions.set(t,r),this.updateControlKeyEventListeners(),()=>{this.subscriptions.get(t)===r&&this.off(t)}}off(t){this.subscriptions.delete(t),this.updateControlKeyEventListeners(),this.hasSubscribers||this.reset()}cancel(){let t=this.session;t&&"unknown"!==t.device&&this.emit(ef.Cancel,t.lastEvent),this.reset()}destroy(){this.cancel(),this.subscriptions.clear(),this.updateControlKeyEventListeners(),this.element?.removeEventListener("wheel",this.handleEvent)}startPendingSession(t){let r={samples:[t],device:"unknown",firstTimeStamp:t.timeStamp,lastTimeStamp:t.timeStamp,totalDeltaX:t.deltaX,totalDeltaY:t.deltaY,velocityX:0,velocityY:0,lastEvent:t.event};return this.session=r,this.classificationTimer=globalThis.setTimeout(this.finishClassification,this.options.classificationDelay),r}addSample(t,r){if(t.samples.push(r),t.lastTimeStamp=r.timeStamp,t.lastEvent=r.event,t.totalDeltaX+=r.deltaX,t.totalDeltaY+=r.deltaY,"unknown"!==t.device){let i=t.samples[t.samples.length-2],n=r.timeStamp-i.timeStamp;t.velocityX=n>
13610?r.deltaX/n:0,t.velocityY=n>0?r.deltaY/n:0,this.emit(ef.Move,r.event,{velocityX:t.velocityX,velocityY:t.velocityY})}}begin(t,r){t.device=r,this.clearClassificationTimer(),this.emit(ef.Start,t.samples[0].event);let i=t.lastTimeStamp-t.firstTimeStamp;t.velocityX=i>0?t.totalDeltaX/i:0,t.velocityY=i>0?t.totalDeltaY/i:0,this.emit(ef.Move,t.lastEvent,{velocityX:t.velocityX,velocityY:t.velocityY})}scheduleEnd(){this.clearEndTimer(),this.endTimer=globalThis.setTimeout(this.end,this.options.endDelay)}emit(t,r,i){let n=this.session;if(!n||"unknown"===n.device)return;let a=t===ef.Start,o=t===ef.End||t===ef.Cancel,s=a?n.firstTimeStamp:n.lastTimeStamp,l=a?0:Math.max(0,s-n.firstTimeStamp),u=a?0:n.totalDeltaX,c=a?0:n.totalDeltaY,h=l>0?u/l:0,f=l>0?c/l:0,d=a?0:i?.velocityX??n.velocityX,p=a?0:i?.velocityY??n.velocityY,m={eventType:t,device:n.device,srcEvent:r,timeStamp:s,center:{x:r.clientX,y:r.clientY},deltaX:u,deltaY:c,deltaTime:l,velocity:Math.abs(d)>Math.abs(p)?d:p,velocityX:d,velocityY:p,overallVelocity:Math.abs(h)>Math.abs(f)?h:f,overallVelocityX:h,overallVelocityY:f,isFirst:a,isFinal:o};for(let{listener:t}of[...this.subscriptions.values()])t(m)}reset(){this.clearClassificationTimer(),this.clearEndTimer(),this.session=null}clearClassificationTimer(){null!==this.classificationTimer&&(globalThis.clearTimeout(this.classificationTimer),this.classificationTimer=null)}clearEndTimer(){null!==this.endTimer&&(globalThis.clearTimeout(this.endTimer),this.endTimer=null)}updateControlKeyEventListeners(){let t=this.hasSubscribers,r="u">typeof window?window:globalThis.document?.defaultView;r&&t!==this.listeningForControlKeys&&(this.listeningForControlKeys=t,t?(r.addEventListener("keydown",this.handleKeyDown,!0),r.addEventListener("keyup",this.handleKeyUp,!0),r.addEventListener("blur",this.handleWindowBlur)):(r.removeEventListener("keydown",this.handleKeyDown,!0),r.removeEventListener("keyup",this.handleKeyUp,!0),r.removeEventListener("blur",this.handleWindowBlur),this.pressedControlKeys.clear()))}}function xq(t,r){return t.some(({event:t,isControlKeyDown:r})=>t.ctrlKey&&!r)?"trackpad":t.some(({event:t})=>0!==t.deltaMode)||t.some(xH)||t.every(({event:t})=>{let r=t.wheelDelta;return void 0!==r&&Math.abs(r)%40==0})?"mouse":t.some(({deltaX:t})=>0!==t)||t.length>1&&function(t){for(let r=0;r<t.length;r++){let i=t[r];if(Math.abs(i.deltaX)>40||Math.abs(i.deltaY)>40||r>0&&i.timeStamp-t[r-1].timeStamp>40)return!1}return!0}(t)?"trackpad":r?"mouse":"unknown"}function xH({event:t,deltaX:r,deltaY:i}){if(0!==r||0===i)return!1;if(Number.isInteger(Math.abs(i/4.000244140625)))return!0;let n=t.wheelDelta;return"number"==typeof n&&0!==n&&n%120==0}let xW=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseenter","mouseleave"];class xZ extends xz{constructor(t,r,i){super(t,r,{enable:!0,...i}),this.handleEvent=t=>{this.handleOverEvent(t),this.handleOutEvent(t),this.handleEnterEvent(t),this.handleLeaveEvent(t),this.handleMoveEvent(t)},this.pressed=!1;const{enable:n=!1}=this.options;this.enableMoveEvent=n,this.enableLeaveEvent=n,this.enableEnterEvent=n,this.enableOutEvent=n,this.enableOverEvent=n,n&&xW.forEach(t=>this.listen(t,!0))}destroy(){xW.forEach(t=>this.listen(t,!1))}enableEventType(t,r){switch(t){case"pointermove":this.enableMoveEvent!==r&&(this.enableMoveEvent=r,this.listen("mousedown",r),this.listen("mousemove",r),this.listen("mouseup",r));break;case"pointerover":this.enableOverEvent!==r&&(this.enableOverEvent=r,this.listen("mouseover",r));break;case"pointerout":this.enableOutEvent!==r&&(this.enableOutEvent=r,this.listen("mouseout",r));break;case"pointerenter":this.enableEnterEvent!==r&&(this.enableEnterEvent=r,this.listen("mouseenter",r));break;case"pointerleave":this.enableLeaveEvent!==r&&(this.enableLeaveEvent=r,this.listen("mouseleave",r))}}handleOverEvent(t){this.enableOverEvent&&"mouseover"===t.type&&this._emit("pointerover",t)}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this._emit("pointerout",t)}handleEnterEvent(t){this.enableEnterEvent&&"mouseenter"===t.type&&this._emit("pointerenter",t)}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this._emit("pointerleave",t)}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":0===t.buttons&&(this.pressed=!1),this.pressed||this._emit("pointermove",t);break;case"mouseup":this.pressed=!1}}_emit(t,r){this.callback({type:t,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:"mouse",target:r.target})}}let xY=["keydown","keyup"];class xX extends xz{constructor(t,r,i){super(t,r,{enable:!0,tabIndex:0,...i}),this.handleEvent=t=>{let r=t.target||t.srcElement;("INPUT"!==r.tagName||"text"!==r.type)&&"TEXTAREA"!==r.tagName&&(this.enableDownEvent&&"keydown"===t.type&&this.callback({type:"keydown",srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:"keyup",srcEvent:t,key:t.key,target:t.target}))};const{enable:n=!1}=this.options;this.enableDownEvent=n,this.enableUpEvent=n,t.tabIndex=this.options.tabIndex,t.style.outline="none",n&&xY.forEach(t=>this.listen(t,!0))}destroy(){xY.forEach(t=>this.listen(t,!1))}enableEventType(t,r){"keydown"===t&&this.enableDownEvent!==r&&(this.enableDownEvent=r,this.listen(t,r)),"keyup"===t&&this.enableUpEvent
1361!==r&&(this.enableUpEvent=r,this.listen(t,r))}}class xK extends xz{constructor(t,r,i){i.enable=i.enable??!1,super(t,r,i),this.handleEvent=t=>{this.options.enable&&this.callback({type:"contextmenu",center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})},i.enable&&this.listen("contextmenu",!0)}destroy(){this.listen("contextmenu",!1)}enableEventType(t,r){"contextmenu"===t&&this.options.enable!==r&&(this.options.enable=r,this.listen("contextmenu",r))}}let xQ={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},xJ={srcElement:"root",priority:0};class x0{constructor(t,r){this.handleEvent=t=>{if(this.isEmpty())return;let r=this._normalizeEvent(t),i=t.srcEvent.target;for(;i&&i!==r.rootElement;){if(this._emit(r,i),r.handled)return;i=i.parentNode}this._emit(r,"root")},this.eventManager=t,this.recognizerName=r,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(t,r,i,n=!1,a=!1){let{handlers:o,handlersByElement:s}=this,l={...xJ,...i},u=s.get(l.srcElement);u||(u=[],s.set(l.srcElement,u));let c={type:t,handler:r,srcElement:l.srcElement,priority:l.priority};n&&(c.once=!0),a&&(c.passive=!0),o.push(c),this._active=this._active||!c.passive;let h=u.length-1;for(;h>=0&&!(u[h].priority>=c.priority);)h--;u.splice(h+1,0,c)}remove(t,r){let{handlers:i,handlersByElement:n}=this;for(let a=i.length-1;a>=0;a--){let o=i[a];if(o.type===t&&o.handler===r){i.splice(a,1);let t=n.get(o.srcElement);t.splice(t.indexOf(o),1),0===t.length&&n.delete(o.srcElement)}}this._active=i.some(t=>!t.passive)}_emit(t,r){let i=this.handlersByElement.get(r);if(i){let r=!1,n=()=>{t.handled=!0},a=()=>{t.handled=!0,r=!0},o=[];for(let s=0;s<i.length;s++){let{type:l,handler:u,once:c}=i[s];if(u({...t,type:l,stopPropagation:n,stopImmediatePropagation:a}),c&&o.push(i[s]),r)break}for(let t=0;t<o.length;t++){let{type:r,handler:i}=o[t];this.remove(r,i)}}}_normalizeEvent(t){let r=this.eventManager.getElement();return{...t,...function(t){let r=xQ[t.srcEvent.type];if(!r)return null;let{buttons:i,button:n}=t.srcEvent,a=!1,o=!1,s=!1;return 2===r?(a=!!(1&i),o=!!(4&i),s=!!(2&i)):(a=0===n,o=1===n,s=2===n),{leftButton:a,middleButton:o,rightButton:s}}(t),...function(t,r){let i=t.center;if(!i)return null;let n=r.getBoundingClientRect(),a=n.width/r.offsetWidth||1,o=n.height/r.offsetHeight||1,s={x:(i.x-n.left-r.clientLeft)/a,y:(i.y-n.top-r.clientTop)/o};return{center:i,offsetCenter:s}}(t,r),preventDefault:()=>{t.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}}class x1{constructor(t=null,r={}){if(this._onBasicInput=t=>{this.manager.emit(t.srcEvent.type,t)},this._onOtherEvent=t=>{this.manager.emit(t.type,t)},this.options={recognizers:[],events:{},touchAction:"compute",tabIndex:0,cssProps:{},...r},this.events=new Map,this.element=t,this.wheelSession=new xG(t),!t)return;for(const r of(this.manager=new xM(t,this.options),this.options.recognizers)){const{recognizer:t,recognizeWith:i,requireFailure:n}=function(t){let r;if("recognizer"in t)return t;let i=Array.isArray(t)?[...t]:[t];return{recognizer:r="function"==typeof i[0]?new(i.shift())(i.shift()||{}):i.shift(),recognizeWith:"string"==typeof i[0]?[i[0]]:i[0],requireFailure:"string"==typeof i[1]?[i[1]]:i[1]}}(r);this.manager.add(t),i&&t.recognizeWith(i),n&&t.requireFailure(n)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new xV(t,this._onOtherEvent,{enable:!1,wheelSession:this.wheelSession}),this.moveInput=new xZ(t,this._onOtherEvent,{enable:!1}),this.keyInput=new xX(t,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new xK(t,this._onOtherEvent,{enable:!1}),this.on(this.options.events)}getElement(){return this.element}destroy(){this.element?(this.wheelInput.destroy(),this.wheelSession.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy()):this.wheelSession.destroy()}on(t,r,i){this._addEventHandler(t,r,i,!1)}once(t,r,i){this._addEventHandler(t,r,i,!0)}watch(t,r,i){this._addEventHandler(t,r,i,!1,!0)}off(t,r){this._removeEventHandler(t,r)}emit(t){this.manager?.emit(t.type,t)}_toggleRecognizer(t,r){let{manager:i}=this;if(!i)return;let n=i.get(t);n&&(n.set({enable:r,wheelSession:this.wheelSession}),i.touchAction.update()),this.wheelInput?.enableEventType(t,r),this.moveInput?.enableEventType(t,r),this.keyInput?.enableEventType(t,r),this.contextmenuInput?.enableEventType(t,r)}_addEventHandler(t,r,i,n,a){if("string"!=typeof t){for(let[o,s]of(i=r,Object.entries(t)))this._addEventHandler(o,s,i,n,a);return}let{manager:o,events:s}=this;if(!o)return;let l=s.get(t);!l&&(l=new x0(this,this._getRecognizerName(t)||t),s.set(t,l),o&&o.on(t,l.handleEvent)),l.add(t,r,i,n,a),l.isEmpty()||this._toggleRecognizer(l.recognizerName,!0)}_removeEventHandler(t,r){if("string"!=typeof t){for(let[r,i]of Object.entries(t))this._removeEventHandler(r,i);return}let{events:i}=this,n=i.get(t);if(n&&(n.remove(t,r),n.isEmpty())){let{recognizerName:t}=n,r=!1;for(let n of i.values())if(n.recognizerName===t&&!n.isEmpty()){r=!0;break}r||this._toggleRecognizer(t,!1)}}_getRecognizerName(t){return this.manager.recognizers.find(r=>r.getEventNames().includes(t))?.options.event}}let x2={DEFAULT:"default",LNGLAT:"lnglat",METER_OFFSETS:"meter-offsets",LNGLAT_OFFSETS:"lnglat-offsets",CARTESIAN:"cartesian"};Object.defineProperty(x2,"IDENTITY",{get:()=>(xn.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),x2.CARTESIAN)});let x3={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},x4={common:0,meters:1,pixels:2},x6={click:"onClick",dblclick:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},x5={multipan:[xF,{threshold:10,pointers:2,trackpad:!0}],pinch:[class extends xL{constructor(t={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,trackpad:!1,coherent:[],...t}),this.trackpadGesture=!1}getTouchAction(){return[xo]}getEventNames(){return xB.map(t=>this.options.event+t)}attrTest(t){let r=!!this.options.coherent?.length,i=!!(this.state&ep.Began),n=!(r&&t.eventType&(ef.End|ef.Cancel));return super.attrTest(t)&&(i||n&&(r?this.coherentTest(t):Math.abs(t.scale-1)>this.options.threshold))}emit(t){if(1!==t.scale){let r=t.scale<1?"in":"out";t.additionalEvent=this.options.event+r}super.emit(t)}handleTrackpadEvent(t){t.isFirst&&(this.trackpadGesture=t.srcEvent.ctrlKey,!this.trackpadGesture&&this.state&(ep.Recognized|ep.C
1361ancelled|ep.Failed)&&(this.state=ep.Possible)),this.trackpadGesture&&(this.recognize(this.getTrackpadInput(t,{deltaX:0,deltaY:0,velocity:0,velocityX:0,velocityY:0,overallVelocity:0,overallVelocityX:0,overallVelocityY:0,scale:Math.exp(-t.deltaY/100)})),t.isFinal&&(this.trackpadGesture=!1))}},{trackpad:!0},null,["multipan"]],pan:[xF,{threshold:1},["pinch"],["multipan"]],dblclick:[xN,{event:"dblclick",taps:2,enable:!1}],dblclickdrag:[class extends xI{constructor(t={}){super({enable:!0,event:"doubleclickdrag",pointers:1,interval:500,time:350,threshold:28,dragThreshold:1,pixelsPerScale:120,...t}),this._tapStart=null,this._lastTap=null,this._drag=null,this._emittedStart=!1}getTouchAction(){return[xa]}getEventNames(){return xO.map(t=>this.options.event+t)}process(t){let{options:r}=this;return t.pointers.length!==r.pointers?(this.reset(),ep.Failed):t.eventType&ef.Start?this._handleStart(t):t.eventType&ef.Move?this._handleMove(t):t.eventType&ef.Cancel?this._handleEnd(t,!0):t.eventType&ef.End?this._handleEnd(t,!1):ep.Failed}reset(){this._tapStart=null,this._lastTap=null,this._drag=null,this._emittedStart=!1}emit(t){if(t){if(this.state===ep.Began){if(!this._drag?.active||this._emittedStart)return;this._emittedStart=!0,this.manager.emit(`${this.options.event}start`,t),this.manager.emit(this.options.event,t);return}if(this.state===ep.Changed){if(!this._emittedStart)return;this.manager.emit(`${this.options.event}move`,t),this.manager.emit(this.options.event,t);return}if(this.state===ep.Ended){if(!this._emittedStart)return;this.manager.emit(this.options.event,t),this.manager.emit(`${this.options.event}end`,t),this._emittedStart=!1;return}if(this.state===ep.Cancelled){if(!this._emittedStart)return;this.manager.emit(this.options.event,t),this.manager.emit(`${this.options.event}cancel`,t),this._emittedStart=!1}}}_handleStart(t){let r=this._getPointerId(t);return this._lastTap&&this._isTapMatch(t,this._lastTap)?(this._tapStart=null,this._lastTap=null,this._drag={startCenter:t.center,pointerId:r,active:!1},this._emittedStart=!1,ep.Began):(this._tapStart={center:t.center,timeStamp:t.timeStamp,pointerId:r},this._lastTap=null,this._drag=null,this._emittedStart=!1,ep.Failed)}_handleMove(t){if(!this._drag||!this._isSamePointer(t,this._drag.pointerId))return ep.Failed;let r=this._drag.startCenter.y-t.center.y;return!this._drag.active&&Math.abs(r)<this.options.dragThreshold?ep.Began:(this._drag.active=!0,t.scale=Math.pow(2,r/this.options.pixelsPerScale),this._emittedStart?ep.Changed:ep.Began)}_handleEnd(t,r){if(this._drag&&this._isSamePointer(t,this._drag.pointerId)){let{active:i,startCenter:n}=this._drag;if(this._drag=null,this._tapStart=null,this._lastTap=null,!i)return this._emittedStart=!1,ep.Failed;let a=n.y-t.center.y;return t.scale=Math.pow(2,a/this.options.pixelsPerScale),r?ep.Cancelled:ep.Ended}return this._tapStart&&this._isSamePointer(t,this._tapStart.pointerId)?(this._isValidTap(t)?this._lastTap={center:t.center,timeStamp:t.timeStamp,pointerId:this._tapStart.pointerId}:this._lastTap=null,this._tapStart=null):r&&this.reset(),ep.Failed}_isTapMatch(t,r){return t.timeStamp-r.timeStamp<=this.options.interval&&xg(t.center,r.center)<=this.options.threshold}_isValidTap(t){return t.deltaTime<=this.options.time&&t.distance<=this.options.threshold}_getPointerId(t){return"pointerId"in t.srcEvent?t.srcEvent.pointerId:null}_isSamePointer(t,r){return null===r||this._getPointerId(t)===r}},{event:"dblclickdrag",enable:!1},["dblclick"],null],click:[xN,{event:"click"},["dblclickdrag"],["dblclick","dblclickdrag"]]};function x8(t){let r,i={};return n=>{for(let a in n)if(!function(t,r){if(t===r)return!0;if(Array.isArray(t)){let i=t.length;if(!r||r.length!==i)return!1;for(let n=0;n<i;n++)if(t[n]!==r[n])return!1;return!0}return!1}(n[a],i[a])){r=t(n),i=n;break}return r}}let x7=[0,0,0,0],x9=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],we=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],wt=[0,0,0],wr=[0,0,0],wi={default:-1,cartesian:0,lnglat:1,"meter-offsets":2,"lnglat-offsets":3};function wn(t){let r=wi[t];if(void 0===r)throw Error(`Invalid coordinateSystem: ${t}`);return r}let wa=x8(function({viewport:t,devicePixelRatio:r,coordinateSystem:i,coordinateOrigin:n}){let{projectionCenter:a,viewProjectionMatrix:o,originCommon:s,cameraPosCommon:l,shaderCoordinateOrigin:u,geospatialOrigin:c}=function(t,r,i){let{viewMatrixUncentered:n,projectionMatrix:a}=t,{viewMatrix:o,viewProjectionMatrix:s}=t,l=x7,u=x7,c=t.cameraPosition,{geospatialOrigin:h,shaderCoordinateOrigin:f,offsetMode:d}=wo(t,r,i);return d&&(u=t.projectPosition(h||f),c=[c[0]-u[0],c[1]-u[1],c[2]-u[2]],u[3]=1,l=xr.transformMat4([],u,s),o=n||o,s=bY.multiply([],a,o),s=bY.multiply([],s,x9)),{viewMatrix:o,viewProjectionMatrix:s,projectionCenter:l,originCommon:u,cameraPosCommon:c,shaderCoordinateOrigin:f,geospatialOrigin:h}}(t,i,n),h=t.getDistanceScales(),f=[t.width*r,t.height*r],d=xr.transformMat4([],[0,0,-t.focalDistance,1],t.projectionMatrix)[3]||1,p={coordinateSystem:wn(i),projectionMode:t.projectionMode,coordinateOrigin:u,commonOrigin:s.slice(0,3),center:a,pseudoMeters:!!t._pseudoMeters,viewportSize:f,devicePixelRatio:r,focalDistance:d,commonUnitsPerMeter:h.unitsPerMeter,commonUnitsPerWorldUnit:h.unitsPerMeter,commonUnitsPerWorldUnit2:wt,scale:t.scale,wrapLongitude:!1,viewProjectionMatrix:o,modelMatrix:we,cameraPosition:l};if(c){let r=t.getDistanceScales(c);switch(i){case"meter-offsets":p.commonUnitsPerWorldUnit=r.unitsPerMeter,p.commonUnitsPerWorldUnit2=r.unitsPerMeter2;break;case"lnglat":case"lnglat-offsets":t._pseudoMeters||(p.commonUnitsPerMeter=r.unitsPerMeter),p.commonUnitsPerWorldUnit=r.unitsPerDegree,p.commonUnitsPerWorldUnit2=r.unitsPerDegree2;break;case"cartesian":p.commonUnitsPerWorldUnit=[1,1,r.unitsPerMeter[2]],p.commonUnitsPerWorldUnit2=[0,0,r.unitsPerMeter2[2]]}}if(t.projectionMode===x3.GLOBE&&"meter-offsets"===i){let t=n[0]*M
1361ath.PI/180,r=n[1]*Math.PI/180,i=Math.cos(r),a=((n[2]||0)/6370972+1)*256;p.commonOrigin=[Math.sin(t)*i*a,-Math.cos(t)*i*a,Math.sin(r)*a]}return p});function wo(t,r,i=wr){let n;i.length<3&&(i=[i[0],i[1],0]);let a=i,o=!0;switch(n="lnglat-offsets"===r||"meter-offsets"===r?i:t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case x3.WEB_MERCATOR:("lnglat"===r||"cartesian"===r)&&(n=[0,0,0],o=!1);break;case x3.WEB_MERCATOR_AUTO_OFFSET:"lnglat"===r?a=n:"cartesian"===r&&(a=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],n=t.unprojectPosition(a),a[0]-=i[0],a[1]-=i[1],a[2]-=i[2]);break;case x3.IDENTITY:(a=t.position.map(Math.fround))[2]=a[2]||0;break;case x3.GLOBE:o=!1,n=null;break;default:o=!1}return{geospatialOrigin:n,shaderCoordinateOrigin:a,offsetMode:o}}let ws=["default","lnglat","meter-offsets","lnglat-offsets","cartesian"].map(t=>`const COORDINATE_SYSTEM_${t.toUpperCase().replaceAll("-","_")}: i32 = ${wn(t)};`).join(""),wl=Object.keys(x3).map(t=>`const PROJECTION_MODE_${t}: i32 = ${x3[t]};`).join(""),wu=Object.keys(x4).map(t=>`const UNIT_${t.toUpperCase()}: i32 = ${x4[t]};`).join(""),wc=`\ 1362${ws} 1363${wl} 1364${wu} 1365 1366const TILE_SIZE: f32 = 512.0; 1367const PI: f32 = 3.1415926536; 1368const WORLD_SCALE: f32 = TILE_SIZE / (PI * 2.0); 1369const ZERO_64_LOW: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0); 1370const EARTH_RADIUS: f32 = 6370972.0; // meters 1371const GLOBE_RADIUS: f32 = 256.0; 1372 1373// ----------------------------------------------------------------------------- 1374// Uniform block (converted from GLSL uniform block) 1375// ----------------------------------------------------------------------------- 1376struct ProjectUniforms { 1377 wrapLongitude: i32, 1378 coordinateSystem: i32, 1379 commonUnitsPerMeter: vec3<f32>, 1380 projectionMode: i32, 1381 scale: f32, 1382 commonUnitsPerWorldUnit: vec3<f32>, 1383 commonUnitsPerWorldUnit2: vec3<f32>, 1384 center: vec4<f32>, 1385 modelMatrix: mat4x4<f32>, 1386 viewProjectionMatrix: mat4x4<f32>, 1387 viewportSize: vec2<f32>, 1388 devicePixelRatio: f32, 1389 focalDistance: f32, 1390 cameraPosition: vec3<f32>, 1391 coordinateOrigin: vec3<f32>, 1392 commonOrigin: vec3<f32>, 1393 pseudoMeters: i32, 1394}; 1395 1396@group(0) @binding(auto) 1397var<uniform> project: ProjectUniforms; 1398 1399// ----------------------------------------------------------------------------- 1400// Geometry data shared across the project helpers. 1401// The active layer shader is responsible for populating this private module 1402// state before calling the project functions below. 1403// ----------------------------------------------------------------------------- 1404 1405// Structure to carry additional geometry data used by deck.gl filters. 1406struct Geometry { 1407 worldPosition: vec3<f32>, 1408 worldPositionAlt: vec3<f32>, 1409 position: vec4<f32>, 1410 normal: vec3<f32>, 1411 uv: vec2<f32>, 1412 pickingColor: vec3<f32>, 1413}; 1414 1415var<private> geometry: Geometry; 1416`,wh=`\ 1417${wc} 1418 1419// ----------------------------------------------------------------------------- 1420// Functions 1421// ----------------------------------------------------------------------------- 1422 1423// Returns an adjustment factor for commonUnitsPerMeter 1424fn _project_size_at_latitude(lat: f32) -> f32 { 1425 let y = clamp(lat, -89.9, 89.9); 1426 return 1.0 / cos(radians(y)); 1427} 1428 1429// Overloaded version: scales a value in meters at a given latitude. 1430fn _project_size_at_latitude_m(meters: f32, lat: f32) -> f32 { 1431 return meters * project.commonUnitsPerMeter.z * _project_size_at_latitude(lat); 1432} 1433 1434// Computes a non-linear scale factor based on geometry. 1435// (Note: This function relies on "geometry" being provided.) 1436fn project_size() -> f32 { 1437 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && 1438 project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && 1439 project.pseudoMeters == 0) { 1440 if (geometry.position.w == 0.0) { 1441 return _project_size_at_latitude(geometry.worldPosition.y); 1442 } 1443 let y: f32 = geometry.position.y / TILE_SIZE * 2.0 - 1.0; 1444 let y2 = y * y; 1445 let y4 = y2 * y2; 1446 let y6 = y4 * y2; 1447 return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; 1448 } 1449 return 1.0; 1450} 1451 1452// Overloads to scale offsets (meters to world units) 1453fn project_size_float(meters: f32) -> f32 { 1454 return meters * project.commonUnitsPerMeter.z * project_size(); 1455} 1456 1457fn project_size_vec2(meters: vec2<f32>) -> vec2<f32> { 1458 return meters * project.commonUnitsPerMeter.xy * project_size(); 1459} 1460 1461fn project_size_vec3(meters: vec3<f32>) -> vec3<f32> { 1462 return meters * project.commonUnitsPerMeter * project_size(); 1463} 1464 1465fn project_size_vec4(meters: vec4<f32>) -> vec4<f32> { 1466 return vec4<f32>(meters.xyz * project.commonUnitsPerMeter, meters.w); 1467} 1468 1469// Returns a rotation matrix aligning the zâaxis with the given up vector. 1470fn project_get_orientation_matrix(up: vec3<f32>) -> mat3x3<f32> { 1471 let uz = normalize(up); 1472 let ux = select( 1473 vec3<f32>(1.0, 0.0, 0.0), 1474 normalize(vec3<f32>(uz.y, -uz.x, 0.0)), 1475 abs(uz.z) == 1.0 1476 ); 1477 let uy = cross(uz, ux); 1478 return mat3x3<f32>(ux, uy, uz); 1479} 1480 1481// Since WGSL does not support "out" parameters, we return a struct. 1482struct RotationResult { 1483 needsRotation: bool, 1484 transform: mat3x3<f32>, 1485}; 1486 1487fn project_needs_rotation(commonPosition: vec3<f32>) -> RotationResult { 1488 if (project.projectionMode == PROJECTION_MODE_GLOBE) { 1489 return RotationResult(true, project_get_orientation_matrix(commonPosition)); 1490 } else { 1491 return RotationResult(false, mat3x3<f32>()); // identity alternative if needed 1492 }; 1493} 1494 1495// Projects a normal vector from the current coordinate system to world space. 1496fn project_normal(vector: vec3<f32>) -> vec3<f32> { 1497 let normal_modelspace = project.modelMatrix * vec4<f32>(vector, 0.0); 1498 var n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); 1499 let rotResult = project_needs_rotation(geometry.position.xyz); 1500 if (rotResult.needsRotation) { 1501 n = rotResult.transform * n; 1502 } 1503 return n; 1504} 1505 1506// Applies a scale offset based on y-offset (dy) 1507fn project_offset_(offset: vec4<f32>) -> vec4<f32> { 1508 let dy: f32 = offset.y; 1509 let commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; 1510 return vec4<f32>(offset.xyz * commonUnitsPerWorldUnit, offset.w); 1511} 1512 1513// Projects lng/lat coordinates to a unit tile [0,1] 1514fn project_mercator_(lnglat: vec2<f32>) -> vec2<f32> { 1515 var x = lnglat.x; 1516 if (project.wrapLongitude != 0) { 1517 x = ((x + 180.0) % 360.0) - 180.0; 1518 } 1519 let y = clamp(lnglat.y, -89.9, 89.9); 1520 return vec2<f32>( 1521 radians(x) + PI, 1522 PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5)) 1523 ) * WORLD_SCALE; 1524} 1525 1526// Projects lng/lat/z coordinates for a globe projection. 1527fn project_globe_(lnglatz: vec3<f32>) -> vec3<f32> { 1528 let lambda = radians(lnglatz.x); 1529 let phi = radians(lnglatz.y); 1530 let cosPhi = cos(phi); 1531 let D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; 1532 return vec3<f32>( 1533 sin(lambda) * cosPhi, 1534 -cos(lambda) * cosPhi, 1535 sin(phi) 1536 ) * D; 1537} 1538 1539// Projects positions (with an optional 64-bit low part) from the input 1540// coordinate system to the common space. 1541fn project_position_vec4_f64(position: vec4<f32>, position64Low: vec3<f32>) -> vec4<f32> { 1542 var position_world = project.modelMatrix * position; 1543 1544 // Work around for a Mac+NVIDIA bug: 1545 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { 1546 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1547 return vec4<f32>( 1548 project_mercator_(position_world.xy), 1549 _project_size_at_latitude_m(position_world.z, position_world.y), 1550 position_world.w 1551 ); 1552 } 1553 if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
1554 position_world = vec4f(position_world.xyz + project.coordinateOrigin, position_world.w); 1555 } 1556 } 1557 if (project.projectionMode == PROJECTION_MODE_GLOBE) { 1558 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1559 return vec4<f32>( 1560 project_globe_(position_world.xyz), 1561 position_world.w 1562 ); 1563 } 1564 if (project.coordinateSystem == COORDINATE_SYSTEM_METER_OFFSETS) { 1565 let enuMatrix = project_get_orientation_matrix(project.commonOrigin); 1566 let metersToCommon = GLOBE_RADIUS / EARTH_RADIUS; 1567 let offsetCommon = (enuMatrix * vec3<f32>(-position_world.x, -position_world.y, position_world.z)) * metersToCommon; 1568 return vec4<f32>(project.commonOrigin + offsetCommon, position_world.w); 1569 } 1570 } 1571 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 1572 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1573 if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { 1574 return vec4<f32>( 1575 project_mercator_(position_world.xy) - project.commonOrigin.xy, 1576 project_size_float(position_world.z), 1577 position_world.w 1578 ); 1579 } 1580 } 1581 } 1582 if (project.projectionMode == PROJECTION_MODE_IDENTITY || 1583 (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && 1584 (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 1585 project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { 1586 position_world = vec4f(position_world.xyz - project.coordinateOrigin, position_world.w); 1587 } 1588 1589 return project_offset_(position_world) + 1590 project_offset_(project.modelMatrix * vec4<f32>(position64Low, 0.0)); 1591} 1592 1593// Overloaded versions for different input types. 1594fn project_position_vec4_f32(position: vec4<f32>) -> vec4<f32> { 1595 return project_position_vec4_f64(position, ZERO_64_LOW); 1596} 1597 1598fn project_position_vec3_f64(position: vec3<f32>, position64Low: vec3<f32>) -> vec3<f32> { 1599 let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), position64Low); 1600 return projected_position.xyz; 1601} 1602 1603fn project_position_vec3_f32(position: vec3<f32>) -> vec3<f32> { 1604 let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), ZERO_64_LOW); 1605 return projected_position.xyz; 1606} 1607 1608fn project_position_vec2_f32(position: vec2<f32>) -> vec2<f32> { 1609 let projected_position = project_position_vec4_f64(vec4<f32>(position, 0.0, 1.0), ZERO_64_LOW); 1610 return projected_position.xy; 1611} 1612 1613// Transforms a common space position to clip space. 1614fn project_common_position_to_clipspace_with_projection(position: vec4<f32>, viewProjectionMatrix: mat4x4<f32>, center: vec4<f32>) -> vec4<f32> { 1615 var clipPosition = viewProjectionMatrix * position + center; 1616 // deck.gl projection matrices use WebGL's [-w, w] depth range; WebGPU clips z to [0, w]. 1617 clipPosition.z = (clipPosition.z + clipPosition.w) * 0.5; 1618 return clipPosition; 1619} 1620 1621// Uses the project viewProjectionMatrix and center. 1622fn project_common_position_to_clipspace(position: vec4<f32>) -> vec4<f32> { 1623 return project_common_position_to_clipspace_with_projection(position, project.viewProjectionMatrix, project.center); 1624} 1625 1626// Returns a clip space offset corresponding to a given number of screen pixels. 1627fn project_pixel_size_to_clipspace(pixels: vec2<f32>) -> vec2<f32> { 1628 let offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; 1629 return offset * project.focalDistance; 1630} 1631 1632fn project_meter_size_to_pixel(meters: f32) -> f32 { 1633 return project_size_float(meters) * project.scale; 1634} 1635 1636fn project_unit_size_to_pixel(size: f32, unit: i32) -> f32 { 1637 if (unit == UNIT_METERS) { 1638 return project_meter_size_to_pixel(size); 1639 } else if (unit == UNIT_COMMON) { 1640 return size * project.scale; 1641 } 1642 // UNIT_PIXELS: no scaling applied. 1643 return size; 1644} 1645 1646fn project_pixel_size_float(pixels: f32) -> f32 { 1647 return pixels / project.scale; 1648} 1649 1650fn project_pixel_size_vec2(pixels: vec2<f32>) -> vec2<f32> { 1651 return pixels / project.scale; 1652} 1653`,wf=["default","lnglat","meter-offsets","lnglat-offsets","cartesian"].map(t=>`const int COORDINATE_SYSTEM_${t.toUpperCase().replaceAll("-","_")} = ${wn(t)};`).join(""),wd=Object.keys(x3).map(t=>`const int PROJECTION_MODE_${t} = ${x3[t]};`).join(""),wp=Object.keys(x4).map(t=>`const int UNIT_${t.toUpperCase()} = ${x4[t]};`).join(""),wm=`\ 1654${wf} 1655${wd} 1656${wp} 1657layout(std140) uniform projectUniforms { 1658bool wrapLongitude; 1659int coordinateSystem; 1660vec3 commonUnitsPerMeter; 1661int projectionMode; 1662float scale;
1663vec3 commonUnitsPerWorldUnit; 1664vec3 commonUnitsPerWorldUnit2; 1665vec4 center; 1666mat4 modelMatrix; 1667mat4 viewProjectionMatrix; 1668vec2 viewportSize; 1669float devicePixelRatio; 1670float focalDistance; 1671vec3 cameraPosition; 1672vec3 coordinateOrigin; 1673vec3 commonOrigin; 1674bool pseudoMeters; 1675} project; 1676const float TILE_SIZE = 512.0; 1677const float PI = 3.1415926536; 1678const float WORLD_SCALE = TILE_SIZE / (PI * 2.0); 1679const vec3 ZERO_64_LOW = vec3(0.0); 1680const float EARTH_RADIUS = 6370972.0; 1681const float GLOBE_RADIUS = 256.0; 1682float project_size_at_latitude(float lat) { 1683float y = clamp(lat, -89.9, 89.9); 1684return 1.0 / cos(radians(y)); 1685} 1686float project_size() { 1687if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && 1688project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && 1689project.pseudoMeters == false) { 1690if (geometry.position.w == 0.0) { 1691return project_size_at_latitude(geometry.worldPosition.y); 1692} 1693float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0; 1694float y2 = y * y; 1695float y4 = y2 * y2; 1696float y6 = y4 * y2; 1697return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; 1698} 1699return 1.0; 1700} 1701float project_size_at_latitude(float meters, float lat) { 1702return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat); 1703} 1704float project_size(float meters) { 1705return meters * project.commonUnitsPerMeter.z * project_size(); 1706} 1707vec2 project_size(vec2 meters) { 1708return meters * project.commonUnitsPerMeter.xy * project_size(); 1709} 1710vec3 project_size(vec3 meters) { 1711return meters * project.commonUnitsPerMeter * project_size(); 1712} 1713vec4 project_size(vec4 meters) { 1714return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w); 1715} 1716mat3 project_get_orientation_matrix(vec3 up) { 1717vec3 uz = normalize(up); 1718vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0)); 1719vec3 uy = cross(uz, ux); 1720return mat3(ux, uy, uz); 1721} 1722bool project_needs_rotation(vec3 commonPosition, out mat3 transform) { 1723if (project.projectionMode == PROJECTION_MODE_GLOBE) { 1724transform = project_get_orientation_matrix(commonPosition); 1725return true; 1726} 1727return false; 1728} 1729vec3 project_normal(vec3 vector) { 1730vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0); 1731vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); 1732mat3 rotation; 1733if (project_needs_rotation(geometry.position.xyz, rotation)) { 1734n = rotation * n; 1735} 1736return n; 1737} 1738vec4 project_offset_(vec4 offset) { 1739float dy = offset.y; 1740vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; 1741return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w); 1742} 1743vec2 project_mercator_(vec2 lnglat) { 1744float x = lnglat.x; 1745if (project.wrapLongitude) {
1746x = mod(x + 180., 360.0) - 180.; 1747} 1748float y = clamp(lnglat.y, -89.9, 89.9); 1749return vec2( 1750radians(x) + PI, 1751PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5)) 1752) * WORLD_SCALE; 1753} 1754vec3 project_globe_(vec3 lnglatz) { 1755float lambda = radians(lnglatz.x); 1756float phi = radians(lnglatz.y); 1757float cosPhi = cos(phi); 1758float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; 1759return vec3( 1760sin(lambda) * cosPhi, 1761-cos(lambda) * cosPhi, 1762sin(phi) 1763) * D; 1764} 1765vec4 project_position(vec4 position, vec3 position64Low) { 1766vec4 position_world = project.modelMatrix * position; 1767if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { 1768if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1769return vec4( 1770project_mercator_(position_world.xy), 1771project_size_at_latitude(position_world.z, position_world.y), 1772position_world.w 1773); 1774} 1775if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) { 1776position_world.xyz += project.coordinateOrigin; 1777} 1778} 1779if (project.projectionMode == PROJECTION_MODE_GLOBE) { 1780if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1781return vec4( 1782project_globe_(position_world.xyz), 1783position_world.w 1784); 1785} 1786if (project.coordinateSystem == COORDINATE_SYSTEM_METER_OFFSETS) { 1787mat3 enuMatrix = project_get_orientation_matrix(project.commonOrigin); 1788float metersToCommon = GLOBE_RADIUS / EARTH_RADIUS; 1789vec3 offsetCommon = (enuMatrix * vec3(-position_world.xy, position_world.z)) * metersToCommon; 1790return vec4(project.commonOrigin + offsetCommon, position_world.w); 1791} 1792} 1793if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 1794if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1795if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { 1796return vec4( 1797project_mercator_(position_world.xy) - project.commonOrigin.xy, 1798project_size(position_world.z), 1799position_world.w 1800); 1801} 1802} 1803} 1804if (project.projectionMode == PROJECTION_MODE_IDENTITY || 1805(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && 1806(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 1807project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { 1808position_world.xyz -= project.coordinateOrigin; 1809} 1810return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0)); 1811} 1812vec4 project_position(vec4 position) { 1813return project_position(position, ZERO_64_LOW); 1814} 1815vec3 project_position(vec3 position, vec3 position64Low) { 1816vec4 projected_position = project_position(vec4(position, 1.0), position64Low); 1817return projected_position.xyz; 1818} 1819vec3 project_position(vec3 position) { 1820vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW); 1821return projected_position.xyz; 1822} 1823vec2 project_position(vec2 position) { 1824vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW); 1825return projected_position.xy; 1826} 1827vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) { 1828return viewProjectionMatrix * position + center; 1829} 1830vec4 project_common_position_to_clipspace(vec4 position) { 1831return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center); 1832} 1833vec2 project_pixel_size_to_clipspace(vec2 pixels) { 1834vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; 1835return offset * project.focalDistance; 1836} 1837float project_size_to_pixel(float meters) { 1838return project_size(meters) * project.scale; 1839} 1840vec2 project_size_to_pixel(vec2 meters) { 1841return project_size(meters) * project.scale; 1842} 1843float project_size_to_pixel(float size, int unit) { 1844if (unit == UNIT_METERS) return project_size_to_pixel(size); 1845if (unit == UNIT_COMMON) return size * project.scale; 1846return size; 1847} 1848float project_pixel_size(float pixels) { 1849return pixels / project.scale; 1850} 1851vec2 project_pixel_size(vec2 pixels) { 1852return pixels / project.scale; 1853} 1854`,wg={},wy={name:"project",dependencies:[bS.fp32,bA],source:wh,vs:wm,getUniforms:function(t=wg){return"viewport"in t?function({viewport:t,devicePixelRatio:r=1,modelMatrix:i=null,coordinateSystem:n="default",coordinateOrigin:a=wr,autoWrapLongitude:o=!1}){"default"===n&&(n=t.isGeospatial?"lnglat":"cartesian");let s=wa({viewport:t,devicePixelRatio:r,coordinateSystem:n,coordinateOrigin:a});return s.wrapLongitude=o,s.modelMatrix=i||we,s}(t):{}},uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3<f32>",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3<f32>",commonUnitsPerWorldUnit2:"vec3<f32>",center:"vec4<f32>",modelMatrix:"mat4x4<f32>",viewProjectionMatrix:"mat4x4<f32>",viewportSize:"vec2<f32>",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3<f32>",coordinateOrigin:"vec3<f32>",commonOrigin:"vec3<f32>",pseudoMeters:"f32"}}
1854,wv={name:"project32",dependencies:[wy],source:`\ 1855// Define a structure to hold both the clip-space position and the common position. 1856struct ProjectResult { 1857 clipPosition: vec4<f32>, 1858 commonPosition: vec4<f32>, 1859}; 1860 1861// This function mimics the GLSL version with the 'out' parameter by returning both values. 1862fn project_position_to_clipspace_and_commonspace( 1863 position: vec3<f32>, 1864 position64Low: vec3<f32>, 1865 offset: vec3<f32> 1866) -> ProjectResult { 1867 // Compute the projected position. 1868 let projectedPosition: vec3<f32> = project_position_vec3_f64(position, position64Low); 1869 1870 // Start with the provided offset. 1871 var finalOffset: vec3<f32> = offset; 1872 1873 // Get whether a rotation is needed and the rotation matrix. 1874 let rotationResult = project_needs_rotation(projectedPosition); 1875 1876 // If rotation is needed, update the offset. 1877 if (rotationResult.needsRotation) { 1878 finalOffset = rotationResult.transform * offset; 1879 } 1880 1881 // Compute the common position. 1882 let commonPosition: vec4<f32> = vec4<f32>(projectedPosition + finalOffset, 1.0); 1883 1884 // Convert to clip-space. 1885 let clipPosition: vec4<f32> = project_common_position_to_clipspace(commonPosition); 1886 1887 return ProjectResult(clipPosition, commonPosition); 1888} 1889 1890// A convenience overload that returns only the clip-space position. 1891fn project_position_to_clipspace( 1892 position: vec3<f32>, 1893 position64Low: vec3<f32>, 1894 offset: vec3<f32> 1895) -> vec4<f32> { 1896 return project_position_to_clipspace_and_commonspace(position, position64Low, offset).clipPosition; 1897} 1898`,vs:`\ 1899vec4 project_position_to_clipspace( 1900 vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition 1901) { 1902 vec3 projectedPosition = project_position(position, position64Low); 1903 mat3 rotation; 1904 if (project_needs_rotation(projectedPosition, rotation)) { 1905 // offset is specified as ENU 1906 // when in globe projection, rotate offset so that the ground alighs with the surface of the globe 1907 offset = rotation * offset; 1908 } 1909 commonPosition = vec4(projectedPosition + offset, 1.0); 1910 return project_common_position_to_clipspace(commonPosition); 1911} 1912 1913vec4 project_position_to_clipspace( 1914 vec3 position, vec3 position64Low, vec3 offset 1915) { 1916 vec4 commonPosition; 1917 return project_position_to_clipspace(position, position64Low, offset, commonPosition); 1918} 1919`};globalThis.mathgl=globalThis.mathgl||{config:{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1}};let w_=globalThis.mathgl.config;function wb(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function wx(t,r,i){return function(t,r,i){if(wb(t)){i=i||(t.clone?t.clone():Array(t.length));for(let n=0;n<i.length&&n<t.length;++n){let a="number"==typeof t?t:t[n];i[n]=r(a,n,i)}return i}return r(t)}(t,t=>Math.max(r,Math.min(i,t)))}function ww(t,r,i){return wb(t)?t.map((t,n)=>ww(t,r[n],i)):i*r+(1-i)*t}function wE(t,r,i){let n=w_.EPSILON;i&&(w_.EPSILON=i);try{if(t===r)return!0;if(wb(t)&&wb(r)){if(t.length!==r.length)return!1;for(let i=0;i<t.length;++i)if(!wE(t[i],r[i]))return!1;return!0}if(t&&t.equals)return t.equals(r);if(r&&r.equals)return r.equals(t);if("number"==typeof t&&"number"==typeof r)return Math.abs(t-r)<=w_.EPSILON*Math.max(1,Math.abs(t),Math.abs(r));return!1}finally{w_.EPSILON=n}}class wT extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=t[i+r];return this.check()}toArray(t=[],r=0){for(let i=0;i<this.ELEMENTS;++i)t[r+i]=this[i];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:wb(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(w_)}formatString(t){let r="";for(let i=0;i<this.ELEMENTS;++i)r+=(i>0?", ":"")+function(t,{precision:r=w_.precision}={}){return t=Math.round(t/w_.EPSILON)*w_.EPSILON,`${parseFloat(t.toPrecision(r))}`}(this[i],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!wE(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,i){if(void 0===i)return this.lerp(this,t,r);for(let n=0;n<this.ELEMENTS;++n){let a=t[n],o="number"==typeof r?r:r[n];this[n]=a+i*(o-a)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let i=0;i<this.ELEMENTS;
1919++i)this[i]=Math.min(Math.max(this[i],t[i]),r[i]);return this.check()}add(...t){for(let r of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=r[t];return this.check()}subtract(...t){for(let r of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=r[t];return this.check()}scale(t){if("number"==typeof t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(w_.debug&&!this.validate())throw Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=t;return this.check()}addScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,r){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],t),r);return this.check()}get elements(){return this}}function wA(t){if(!Number.isFinite(t))throw Error(`Invalid number ${JSON.stringify(t)}`);return t}function wS(t,r,i=""){if(w_.debug&&!function(t,r){if(t.length!==r)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}(t,r))throw Error(`math.gl: ${i} some fields set to invalid numbers'`);return t}function wC(t,r){if(!t)throw Error(`math.gl assertion ${r}`)}class wM extends wT{get x(){return this[0]}set x(t){this[0]=wA(t)}get y(){return this[1]}set y(t){this[1]=wA(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let i=0;i<this.ELEMENTS;++i){let n=this[i]-t[i];r+=n*n}return wA(r)}dot(t){let r=0;for(let i=0;i<this.ELEMENTS;++i)r+=this[i]*t[i];return wA(r)}normalize(){let t=this.magnitude();if(0!==t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=r[t];return this.check()}divide(...t){for(let r of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=r[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return wC(t>=0&&t<this.ELEMENTS,"index is out of range"),wA(this[t])}setComponent(t,r){return wC(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){return this.add(new this.constructor(t).multiplyScalar(r))}}function wD(){let t=new bC(3);return bC!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function wP(t){let r=t[0],i=t[1],n=t[2];return Math.sqrt(r*r+i*i+n*n)}function wI(t,r,i){let n=new bC(3);return n[0]=t,n[1]=r,n[2]=i,n}function wk(t,r,i){return t[0]=r[0]-i[0],t[1]=r[1]-i[1],t[2]=r[2]-i[2],t}function wO(t,r,i){return t[0]=r[0]*i[0],t[1]=r[1]*i[1],t[2]=r[2]*i[2],t}function wN(t,r,i){return t[0]=r[0]/i[0],t[1]=r[1]/i[1],t[2]=r[2]/i[2],t}function wL(t,r){let i=r[0]-t[0],n=r[1]-t[1],a=r[2]-t[2];return Math.sqrt(i*i+n*n+a*a)}function wR(t,r){let i=r[0]-t[0],n=r[1]-t[1],a=r[2]-t[2];return i*i+n*n+a*a}function wF(t){let r=t[0],i=t[1],n=t[2];return r*r+i*i+n*n}function wB(t,r){let i=r[0],n=r[1],a=r[2],o=i*i+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),t[0]=r[0]*o,t[1]=r[1]*o,t[2]=r[2]*o,t}function wz(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]}function wj(t,r,i){let n=r[0],a=r[1],o=r[2],s=i[0],l=i[1],u=i[2];return t[0]=a*u-o*l,t[1]=o*s-n*u,t[2]=n*l-a*s,t}function wU(t,r,i){let n=r[0],a=r[1],o=r[2],s=i[3]*n+i[7]*a+i[11]*o+i[15];return s=s||1,t[0]=(i[0]*n+i[4]*a+i[8]*o+i[12])/s,t[1]=(i[1]*n+i[5]*a+i[9]*o+i[13])/s,t[2]=(i[2]*n+i[6]*a+i[10]*
1919o+i[14])/s,t}function wV(t,r,i){let n=r[0],a=r[1],o=r[2];return t[0]=n*i[0]+a*i[3]+o*i[6],t[1]=n*i[1]+a*i[4]+o*i[7],t[2]=n*i[2]+a*i[5]+o*i[8],t}function w$(t,r,i){let n=i[0],a=i[1],o=i[2],s=i[3],l=r[0],u=r[1],c=r[2],h=a*c-o*u,f=o*l-n*c,d=n*u-a*l,p=a*d-o*f,m=o*h-n*d,g=n*f-a*h,y=2*s;return h*=y,f*=y,d*=y,p*=2,m*=2,g*=2,t[0]=l+h+p,t[1]=u+f+m,t[2]=c+d+g,t}function wG(t,r,i,n){let a=[],o=[];return a[0]=r[0]-i[0],a[1]=r[1]-i[1],a[2]=r[2]-i[2],o[0]=a[0],o[1]=a[1]*Math.cos(n)-a[2]*Math.sin(n),o[2]=a[1]*Math.sin(n)+a[2]*Math.cos(n),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function wq(t,r,i,n){let a=[],o=[];return a[0]=r[0]-i[0],a[1]=r[1]-i[1],a[2]=r[2]-i[2],o[0]=a[2]*Math.sin(n)+a[0]*Math.cos(n),o[1]=a[1],o[2]=a[2]*Math.cos(n)-a[0]*Math.sin(n),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function wH(t,r,i,n){let a=[],o=[];return a[0]=r[0]-i[0],a[1]=r[1]-i[1],a[2]=r[2]-i[2],o[0]=a[0]*Math.cos(n)-a[1]*Math.sin(n),o[1]=a[0]*Math.sin(n)+a[1]*Math.cos(n),o[2]=a[2],t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function wW(t,r){let i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],u=Math.sqrt((i*i+n*n+a*a)*(o*o+s*s+l*l));return Math.acos(Math.min(Math.max(u&&wz(t,r)/u,-1),1))}let wZ=(X=wD(),function(t,r,i,n,a,o){let s,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s<l;s+=r)X[0]=t[s],X[1]=t[s+1],X[2]=t[s+2],a(X,X,o),t[s]=X[0],t[s+1]=X[1],t[s+2]=X[2];return t});function wY(t,r,i){let n=r[0],a=r[1],o=r[2],s=i[3]*n+i[7]*a+i[11]*o||1;return t[0]=(i[0]*n+i[4]*a+i[8]*o)/s,t[1]=(i[1]*n+i[5]*a+i[9]*o)/s,t[2]=(i[2]*n+i[6]*a+i[10]*
1919o)/s,t}function wX(t,r,i){let n=r[0],a=r[1],o=r[2];return t[0]=i[0]*n+i[3]*a+i[6]*o,t[1]=i[1]*n+i[4]*a+i[7]*o,t[2]=i[2]*n+i[5]*a+i[8]*o,t[3]=r[3],t}t.s(["add",0,function(t,r,i){return t[0]=r[0]+i[0],t[1]=r[1]+i[1],t[2]=r[2]+i[2],t},"angle",0,wW,"bezier",0,function(t,r,i,n,a,o){let s=1-o,l=s*s,u=o*o,c=l*s,h=3*o*l,f=3*u*s,d=u*o;return t[0]=r[0]*c+i[0]*h+n[0]*f+a[0]*d,t[1]=r[1]*c+i[1]*h+n[1]*f+a[1]*d,t[2]=r[2]*c+i[2]*h+n[2]*f+a[2]*d,t},"ceil",0,function(t,r){return t[0]=Math.ceil(r[0]),t[1]=Math.ceil(r[1]),t[2]=Math.ceil(r[2]),t},"clone",0,function(t){let r=new bC(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r},"copy",0,function(t,r){return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},"create",0,wD,"cross",0,wj,"dist",0,wL,"distance",0,wL,"div",0,wN,"divide",0,wN,"dot",0,wz,"equals",0,function(t,r){let i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return Math.abs(i-o)<=1e-6*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-s)<=1e-6*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(a-l)<=1e-6*Math.max(1,Math.abs(a),Math.abs(l))},"exactEquals",0,function(t,r){return t[0]===r[0]&&t[1]===r[1]&&t[2]===r[2]},"floor",0,function(t,r){return t[0]=Math.floor(r[0]),t[1]=Math.floor(r[1]),t[2]=Math.floor(r[2]),t},"forEach",0,wZ,"fromValues",0,wI,"hermite",0,function(t,r,i,n,a,o){let s=o*o,l=s*(2*o-3)+1,u=s*(o-2)+o,c=s*(o-1),h=s*(3-2*o);return t[0]=r[0]*l+i[0]*u+n[0]*c+a[0]*h,t[1]=r[1]*l+i[1]*u+n[1]*c+a[1]*h,t[2]=r[2]*l+i[2]*u+n[2]*c+a[2]*h,t},"inverse",0,function(t,r){return t[0]=1/r[0],t[1]=1/r[1],t[2]=1/r[2],t},"len",0,wP,"length",0,wP,"lerp",0,function(t,r,i,n){let a=r[0],o=r[1],s=r[2];return t[0]=a+n*(i[0]-a),t[1]=o+n*(i[1]-o),t[2]=s+n*(i[2]-s),t},"max",0,function(t,r,i){return t[0]=Math.max(r[0],i[0]),t[1]=Math.max(r[1],i[1]),t[2]=Math.max(r[2],i[2]),t},"min",0,function(t,r,i){return t[0]=Math.min(r[0],i[0]),t[1]=Math.min(r[1],i[1]),t[2]=Math.min(r[2],i[2]),t},"mul",0,wO,"multiply",0,wO,"negate",0,function(t,r){return t[0]=-r[0],t[1]=-r[1],t[2]=-r[2],t},"normalize",0,wB,"random",0,function(t,r){r=void 0===r?1:r;let i=2*bM()*Math.PI,n=2*bM()-1,a=Math.sqrt(1-n*n)*r;return t[0]=Math.cos(i)*a,t[1]=Math.sin(i)*a,t[2]=n*r,t},"rotateX",0,wG,"rotateY",0,wq,"rotateZ",0,wH,"round",0,function(t,r){return t[0]=bD(r[0]),t[1]=bD(r[1]),t[2]=bD(r[2]),t},"scale",0,function(t,r,i){return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t},"scaleAndAdd",0,function(t,r,i,n){return t[0]=r[0]+i[0]*n,t[1]=r[1]+i[1]*n,t[2]=r[2]+i[2]*n,t},"set",0,function(t,r,i,n){return t[0]=r,t[1]=i,t[2]=n,t},"slerp",0,function(t,r,i,n){let a=Math.acos(Math.min(Math.max(wz(r,i),-1),1)),o=Math.sin(a),s=Math.sin((1-n)*a)/o,l=Math.sin(n*a)/o;return t[0]=s*r[0]+l*i[0],t[1]=s*r[1]+l*i[1],t[2]=s*r[2]+l*i[2],t},"sqrDist",0,wR,"sqrLen",0,wF,"squaredDistance",0,wR,"squaredLength",0,wF,"str",0,function(t){return`vec3(${t[0]}, ${t[1]}, ${t[2]})`},"sub",0,wk,"subtract",0,wk,"transformMat3",0,wV,"transformMat4",0,wU,"transformQuat",0,w$,"zero",0,function(t){return t[0]=0,t[1]=0,t[2]=0,t}],593311);let wK=[0,0,0];class wQ extends wM{static get ZERO(){return L||Object.freeze(L=new wQ(0,0,0)),L}constructor(t=0,r=0,i=0){super(-0,-0,-0),1==arguments.length&&wb(t)?this.copy(t):(w_.debug&&(wA(t),wA(r),wA(i)),this[0]=t,this[1]=r,this[2]=i)}set(t,r,i){return this[0]=t,this[1]=r,this[2]=i,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return w_.debug&&(wA(t.x),wA(t.y),wA(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=wA(t)}angle(t){return wW(this,t)}cross(t){return wj(this,this,t),this.check()}rotateX({radians:t,origin:r=wK}){return wG(this,this,r,t),this.check()}rotateY({radians:t,origin:r=wK}){return wq(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=wK}){return wH(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return wU(this,this,t),this.check()}transformAsVector(t){return wY(this,this,t),this.check()}transformByMatrix3(t){return wV(this,this,t),this.check()}transformByMatrix2(t){let r,i;return r=this[0],i=this[1],this[0]=t[0]*r+t[2]*i,this[1]=t[1]*r+t[3]*i,this[2]=this[2],this.check()}transformByQuaternion(t){return w$(this,this,t),this.check()}}class wJ extends wT{toString(){let t="[";if(w_.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let i=0;i<this.RANK;++i)t+=` ${this[i*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+"]"}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,i){return this[r*this.RANK+t]=wA(i),this}getColumn(t,r=Array(this.RANK).fill(-0)){let i=t*this.RANK;for(let t=0;t<this.RANK;++t)r[t]=this[i+t];return r}setColumn(t,r){let i=t*this.RANK;for(let t=0;t<this.RANK;++t)this[i+t]=r[t];return this}}function w0(){let t=new bC(2);return bC!=Float32Array&&(t[0]=0,t[1]=0),t}function w1(t,r,i){return t[0]=r[0]-i[0],t[1]=r[1]-i[1],t}function w2(t,r,i){return t[0]=r[0]*i[0],t[1]=r[1]*i[1],t}function w3(t,r,i){return t[0]=r[0]/i[0],t[1]=r[1]/i[1],t}function w4(t,r){let i=r[0]-t[0],n=r[1]-t[1];return Math.sqrt(i*i+n*n)}function w6(t,r){let i=r[0]-t[0],n=r[1]-t[1];return i*i+n*n}function w5(t){let r=t[0],i=t[1];return Math.sqrt(r*r+i*i)}function w8(t){let r=t[0],i=t[1];return r*r+i*i}function w7(t,r,i){let n=r[0],a=r[1];return t[0]=i[0]*n+i[3]*a+i[6],t[1]=i[1]*n+i[4]*a+i[7],t}function w9(t,r,i){let n=r[0],a=r[1];return t[0]=i[0]*n+i[4]*a+i[12],t[1]=i[1]*n+i[5]*a+i[13],t}let Ee=(K=w0(),function(t,r,i,n,a,o){let s,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s<l;s+=r)K[0]=t[s],K[1]=t[s+1],a(K,K,o),t[s]=K[0],t[s+1]=K[1];return t});t.s(["add",0,function(t,r,i){return t[0]=r[0]+i[0],t[1]=r[1]+i[1],t},"angle",0,function(t,r){let i=t[0],n=t[1],a=r[0],o=r[1],s=Math.sqrt((i*i+n*n)*(a*a+o*o));return Math.acos(Math.min(Math.max(s&&(i*a+n*o)/s,-1),1))},"ceil",0,function(t,r){return t[0]=Math.ceil(r[0]),t[1]=Math.ceil(r[1]),t},"clone",0,function(t){let r=new bC(2);return r[0]=t[0],r[1]=t[1],r},"copy",0,function(t,r){return t[0]=r[0],t[1]=r[1],t},"create",0,w0,"cross",0,function(t,r,i){let n=r[0]*i[1]-r[1]*i[0];return t[0]=t[1]=0,t[2]=n,t},"dist",0,w4,"distance",0,w4,"div",0,w3,"divide",0,w3,"dot",0,function(t,r){return t[0]*r[0]+t[1]*r[1]},"equals",0,function(t,r){let i=t[0],n=t[1],a=r[0],o=r[1];
1919return Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))},"exactEquals",0,function(t,r){return t[0]===r[0]&&t[1]===r[1]},"floor",0,function(t,r){return t[0]=Math.floor(r[0]),t[1]=Math.floor(r[1]),t},"forEach",0,Ee,"fromValues",0,function(t,r){let i=new bC(2);return i[0]=t,i[1]=r,i},"inverse",0,function(t,r){return t[0]=1/r[0],t[1]=1/r[1],t},"len",0,w5,"length",0,w5,"lerp",0,function(t,r,i,n){let a=r[0],o=r[1];return t[0]=a+n*(i[0]-a),t[1]=o+n*(i[1]-o),t},"max",0,function(t,r,i){return t[0]=Math.max(r[0],i[0]),t[1]=Math.max(r[1],i[1]),t},"min",0,function(t,r,i){return t[0]=Math.min(r[0],i[0]),t[1]=Math.min(r[1],i[1]),t},"mul",0,w2,"multiply",0,w2,"negate",0,function(t,r){return t[0]=-r[0],t[1]=-r[1],t},"normalize",0,function(t,r){let i=r[0],n=r[1],a=i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=r[0]*a,t[1]=r[1]*a,t},"random",0,function(t,r){r=void 0===r?1:r;let i=2*bM()*Math.PI;return t[0]=Math.cos(i)*r,t[1]=Math.sin(i)*r,t},"rotate",0,function(t,r,i,n){let a=r[0]-i[0],o=r[1]-i[1],s=Math.sin(n),l=Math.cos(n);return t[0]=a*l-o*s+i[0],t[1]=a*s+o*l+i[1],t},"round",0,function(t,r){return t[0]=bD(r[0]),t[1]=bD(r[1]),t},"scale",0,function(t,r,i){return t[0]=r[0]*i,t[1]=r[1]*i,t},"scaleAndAdd",0,function(t,r,i,n){return t[0]=r[0]+i[0]*n,t[1]=r[1]+i[1]*n,t},"set",0,function(t,r,i){return t[0]=r,t[1]=i,t},"sqrDist",0,w6,"sqrLen",0,w8,"squaredDistance",0,w6,"squaredLength",0,w8,"str",0,function(t){return`vec2(${t[0]}, ${t[1]})`},"sub",0,w1,"subtract",0,w1,"transformMat2",0,function(t,r,i){let n=r[0],a=r[1];return t[0]=i[0]*n+i[2]*a,t[1]=i[1]*n+i[3]*a,t},"transformMat2d",0,function(t,r,i){let n=r[0],a=r[1];return t[0]=i[0]*n+i[2]*a+i[4],t[1]=i[1]*n+i[3]*a+i[5],t},"transformMat3",0,w7,"transformMat4",0,w9,"zero",0,function(t){return t[0]=0,t[1]=0,t}],360113),(eu=em||(em={}))[eu.COL0ROW0=0]="COL0ROW0",eu[eu.COL0ROW1=1]="COL0ROW1",eu[eu.COL0ROW2=2]="COL0ROW2",eu[eu.COL0ROW3=3]="COL0ROW3",eu[eu.COL1ROW0=4]="COL1ROW0",eu[eu.COL1ROW1=5]="COL1ROW1",eu[eu.COL1ROW2=6]="COL1ROW2",eu[eu.COL1ROW3=7]="COL1ROW3",eu[eu.COL2ROW0=8]="COL2ROW0",eu[eu.COL2ROW1=9]="COL2ROW1",eu[eu.COL2ROW2=10]="COL2ROW2",eu[eu.COL2ROW3=11]="COL2ROW3",eu[eu.COL3ROW0=12]="COL3ROW0",eu[eu.COL3ROW1=13]="COL3ROW1",eu[eu.COL3ROW2=14]="COL3ROW2",eu[eu.COL3ROW3=15]="COL3ROW3";let Et=45*Math.PI/180,Er=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class Ei extends wJ{static get IDENTITY(){return F||Object.freeze(F=new Ei),F}static get ZERO(){return R||Object.freeze(R=new Ei([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),R}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return em}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1==arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g){return this[0]=t,this[1]=r,this[2]=i,this[3]=n,this[4]=a,this[5]=o,this[6]=s,this[7]=l,this[8]=u,this[9]=c,this[10]=h,this[11]=f,this[12]=d,this[13]=p,this[14]=m,this[15]=g,this.check()}setRowMajor(t,r,i,n,a,o,s,l,u,c,h,f,d,p,m,g){return this[0]=t,this[1]=a,this[2]=u,this[3]=d,this[4]=r,this[5]=o,this[6]=c,this[7]=p,this[8]=i,this[9]=s,this[10]=h,this[11]=m,this[12]=n,this[13]=l,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(Er)}fromObject(t){return this.check()}fromQuaternion(t){return b$(this,t),this.check()}frustum(t){var r,i,n,a,o,s;let{left:l,right:u,bottom:c,top:h,near:f=.1,far:d=500}=t;return d===1/0?(r=this,i=l,n=u,a=c,o=h,s=f,r[0]=2*s/(n-i),r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=2*s/(o-a),r[6]=0,r[7]=0,r[8]=(n+i)/(n-i),r[9]=(o+a)/(o-a),r[10]=-1,r[11]=-1,r[12]=0,r[13]=0,r[14]=-2*s,r[15]=0):bG(this,l,u,c,h,f,d),this.check()}lookAt(t){let{eye:r,center:i=[0,0,0],up:n=[0,1,0]}=t;return bW(this,r,i,n),this.check()}ortho(t){let{left:r,right:i,bottom:n,top:a,near:o=.1,far:s=500}=t;return bH(this,r,i,n,a,o,s),this.check()}orthographic(t){let{fovy:r=Et,aspect:i=1,focalDistance:n=1,near:a=.1,far:o=500}=t;En(r);let s=n*Math.tan(r/2),l=s*i;return this.ortho({left:-l,right:l,bottom:-s,top:s,near:a,far:o})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:i=1,near:n=.1,far:a=500}=t;return En(r),bq(this,r,i,n,a),this.check()}determinant(){return bO(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let i=this.getScale(r),n=1/i[0],a=1/i[1],o=1/i[2];return t[0]=this[0]*n,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*a,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*a,t[10]=this[10]*
1919o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let i=this.getScale(r),n=1/i[0],a=1/i[1],o=1/i[2];return t[0]=this[0]*n,t[1]=this[1]*a,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*a,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*a,t[8]=this[10]*o,t}transpose(){return bI(this,this),this.check()}invert(){return bk(this,this),this.check()}multiplyLeft(t){return bN(this,t,this),this.check()}multiplyRight(t){return bN(this,this,t),this.check()}rotateX(t){return bB(this,this,t),this.check()}rotateY(t){return bz(this,this,t),this.check()}rotateZ(t){return bj(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return bF(this,this,t,r),this.check()}scale(t){return bR(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return bL(this,this,t),this.check()}transform(t,r){return 4===t.length?(wS(r=b9(r||[-0,-0,-0,-0],t,this),4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let i,{length:n}=t;switch(n){case 2:i=w9(r||[-0,-0],t,this);break;case 3:i=wU(r||[-0,-0,-0],t,this);break;default:throw Error("Illegal vector")}return wS(i,t.length),i}transformAsVector(t,r){let i;switch(t.length){case 2:var n;let a,o,s;n=r||[-0,-0],a=t[0],o=t[1],s=this[3]*a+this[7]*o||1,n[0]=(this[0]*a+this[4]*o)/s,n[1]=(this[1]*a+this[5]*o)/s,i=n;break;case 3:i=wY(r||[-0,-0,-0],t,this);break;default:throw Error("Illegal vector")}return wS(i,t.length),i}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,i){return this.identity().translate([t,r,i])}}function En(t){if(t>2*Math.PI)throw Error("expected radians")}var xr=xr;function Ea(t,r){let i=xr.transformMat4([],r,t);return xr.scale(i,i,1/i[3]),i}function Eo(t,r,i){return t<r?r:t>i?i:t}let Es=Math.log2||function(t){return Math.log(t)*Math.LOG2E};var bY=bY,El=t.i(360113),El=El,Eu=t.i(593311),Eu=Eu;function Ec(t,r){if(!t)throw Error(r||"@math.gl/web-mercator: assertion failed.")}let Eh=Math.PI,Ef=Eh/4,Ed=Eh/180,Ep=180/Eh;function Em(t){let[r,i]=t;Ec(Number.isFinite(r)),Ec(Number.isFinite(i)&&i>=-90&&i<=90,"invalid latitude");let n=512*(Eh+Math.log(Math.tan(Ef+i*Ed*.5)))/(2*Eh);return[512*(r*Ed+Eh)/(2*Eh),n]}function Eg(t){let[r,i]=t,n=2*(Math.atan(Math.exp(i/512*(2*Eh)-Eh))-Ef);return[(r/512*(2*Eh)-Eh)*Ep,n*Ep]}function Ey(t){return 512/4003e4/Math.cos(t*Ed)}function Ev(t){let{latitude:r,longitude:i,highPrecision:n=!1}=t;Ec(Number.isFinite(r)&&Number.isFinite(i));let a=Math.cos(r*Ed),o=512/360/a,s=512/4003e4/a,l={unitsPerMeter:[s,s,s],metersPerUnit:[1/s,1/s,1/s],unitsPerDegree:[512/360,o,s],degreesPerUnit:[1/(512/360),1/o,1/s]};if(n){let t=Ed*Math.tan(r*Ed)/a,i=512/4003e4*t,n=i/o*s;l.unitsPerDegree2=[0,512/360*t/2,i],l.unitsPerMeter2=[n,0,n]}return l}function E_(t,r){let[i,n,a]=t,[o,s,l]=r,{unitsPerMeter:u,unitsPerMeter2:c}=Ev({longitude:i,latitude:n,highPrecision:!0}),h=Em(t);h[0]+=o*(u[0]+c[0]*s),h[1]+=s*(u[1]+c[1]*s);let f=Eg(h);return Number.isFinite(a)||Number.isFinite(l)?[f[0],f[1],(a||0)+(l||0)]:f}function Eb(t){return 2*Math.atan(.5/t)*Ep}function Ex(t){return .5/Math.tan(.5*t*Ed)}function Ew(t,r){let[i,n,a=0]=t;return Ec(Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(a)),Ea(r,[i,n,a,1])}function EE(t,r,i=0){let[n,a,o]=t;if(Ec(Number.isFinite(n)&&Number.isFinite(a),"invalid pixel coordinate"),Number.isFinite(o))return Ea(r,[n,a,o,1]);let s=Ea(r,[n,a,0,1]),l=Ea(r,[n,a,1,1]),u=s[2],c=l[2];return El.lerp([],s,l,u===c?0:((i||0)-u)/(c-u))}let ET=` 1920layout(std140) uniform shadowUniforms { 1921 bool drawShadowMap; 1922 bool useShadowMap; 1923 vec4 color; 1924 highp int lightId; 1925 float lightCount; 1926 mat4 viewProjectionMatrix0; 1927 mat4 viewProjectionMatrix1; 1928 vec4 projectCenter0; 1929 vec4 projectCenter1; 1930} shadow; 1931`,EA=` 1932const int max_lights = 2; 1933 1934out vec3 shadow_vPosition[max_lights]; 1935 1936vec4 shadow_setVertexPosition(vec4 position_commonspace) { 1937 mat4 viewProjectionMatrices[max_lights]; 1938 viewProjectionMatrices[0] = shadow.viewProjectionMatrix0; 1939 viewProjectionMatrices[1] = shadow.viewProjectionMatrix1; 1940 vec4 projectCenters[max_lights]; 1941 projectCenters[0] = shadow.projectCenter0; 1942 projectCenters[1] = shadow.projectCenter1; 1943 1944 if (shadow.drawShadowMap) { 1945 return project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[shadow.lightId], projectCenters[shadow.lightId]); 1946 } 1947 if (shadow.useShadowMap) { 1948 for (int i = 0; i < max_lights; i++) { 1949 if(i < int(shadow.lightCount)) { 1950 vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[i], projectCenters[i]); 1951 shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0; 1952 } 1953 } 1954 } 1955 return gl_Position; 1956} 1957`,ES=` 1958${ET} 1959${EA} 1960`,EC=` 1961const int max_lights = 2; 1962uniform sampler2D shadow_uShadowMap0; 1963uniform sampler2D shadow_uShadowMap1; 1964 1965in vec3 shadow_vPosition[max_lights]; 1966 1967const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0); 1968const vec4 bitUnpackShift = 1.0 / bitPackShift; 1969const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0); 1970 1971float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) { 1972 vec4 rgbaDepth = texture(shadowMap, position.xy); 1973 1974 float z = dot(rgbaDepth, bitUnpackShift); 1975 return smoothstep(0.001, 0.01, position.z - z); 1976} 1977 1978vec4 shadow_filterShadowColor(vec4 color) { 1979 if (shadow.drawShadowMap) { 1980 vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift); 1981 rgbaDepth -= rgbaDepth.gbaa * bitMask; 1982 return rgbaDepth; 1983 } 1984 if (shadow.useShadowMap) { 1985 float shadowAlpha = 0.0; 1986 shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0); 1987 if(shadow.lightCount > 1.0) { 1988 shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1); 1989 } 1990 shadowAlpha *= shadow.color.a / shadow.lightCount; 1991 float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha); 1992 1993 return vec4( 1994 mix(color.rgb, shadow.color.rgb, shadowAlpha / blendedAlpha), 1995 blendedAlpha 1996 ); 1997 } 1998 return color; 1999} 2000`,EM=` 2001${ET} 2002${EC} 2003`,ED=x8(function({viewport:t,center:r}){return new Ei(t.viewProjectionMatrix).invert().transform(r)}),EP=x8(function({viewport:t,shadowMatrices:r}){let i=[],n=t.pixelUnprojectionMatrix,a=t.isGeospatial?void 0:1,o=[[0,0,a],[t.width,0,a],[0,t.height,a],[t.width,t.height,a],[0,0,-1],[t.width,0,-1],[0,t.height,-1],[t.width,t.height,-1]].map(t=>(function(t,r){let[i,n,a]=t,o=EE([i,n,a],r);return Number.isFinite(a)?o:[o[0],o[1],0]})(t,n));for(let n of r){let r=n.clone().translate(new wQ(t.center).negate()),a=o.map(t=>r.transform(t)),s=new Ei().ortho({left:Math.min(...a.map(t=>t[0])),right:Math.max(...a.map(t=>t[0])),bottom:Math.min(...a.map(t=>t[1])),top:Math.max(...a.map(t=>t[1])),near:Math.min(...a.map(t=>-t[2])),far:Math.max(...a.map(t=>-t[2]))});i.push(s.multiplyRight(n))}return i}),EI=[0,0,0,1],Ek=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],EO={name:"shadow",dependencies:[wy],vs:ES,fs:EM,inject:{"vs:DECKGL_FILTER_GL_POSITION":` 2004 position = shadow_setVertexPosition(geometry.position); 2005 `,"fs:DECKGL_FILTER_COLOR":` 2006 color = shadow_filterShadowColor(color); 2007 `},getUniforms:function(t){let{shadowEnabled:r=!0,project:i}=t;if(!r||!i||!t.shadowMatrices||!t.shadowMatrices.length)return{drawShadowMap:!1,useShadowMap:!1,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};let n=wy.getUniforms(i),a=ED({viewport:i.viewport,center:n.center}),o=[],s=EP({shadowMatrices:t.shadowMatrices,viewport:i.viewport}).slice();for(let r=0;r<t.shadowMatrices.length;r++){let t=s[r],l=t.clone().translate(new wQ(i.viewport.center).negate());n.coordinateSystem===wn("lnglat")&&n.projectionMode===x3.WEB_MERCATOR?(s[r]=l,o[r]=a):(s[r]=t.clone().multiplyRight(Ek),o[r]=l.transform(a))}let l={drawShadowMap:!!t.drawToShadowMap,useShadowMap:!!t.shadowMaps&&t.shadowMaps.length>0,color:t.shadowColor||EI,lightId:t.shadowLightId||0,lightCount:t.shadowMatrices.length,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};for(let t=0;t<s.length;t++)l[`viewProjectionMatrix${t}`]=s[t],l[`projectCenter${t}`]=o[t];for(let r=0;r<2;r++)l[`shadow_uShadowMap${r}`]=t.shadowMaps&&t.shadowMaps[r]||t.dummyShadowMap;return l},uniformTypes:{drawShadowMap:"f32",useShadowMap:"f32",color:"vec4<f32>",lightId:"i32",lightCount:"f32",viewProjectionMatrix0:"mat4x4<f32>",viewProjectionMatrix1:"mat4x4<f32>",projectCenter0:"vec4<f32>",projectCenter1:"vec4<f32>"}},EN={props:{},uniforms:{},name:"picking",uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useByteColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useByteColors:!0,highlightedObjectColor:[0,0,0],highlightColor:[0,1,1,1]},vs:`\ 2008layout(std140) uniform pickingUniforms { 2009 float isActive; 2010 float isAttribute; 2011 float isHighlightActive; 2012 float useByteColors; 2013 vec3 highlightedObjectColor; 2014 vec4 highlightColor; 2015} picking; 2016
2017out vec4 picking_vRGBcolor_Avalid; 2018 2019// Normalize unsigned byte color to 0-1 range 2020vec3 picking_normalizeColor(vec3 color) { 2021 return picking.useByteColors > 0.5 ? color / 255.0 : color; 2022} 2023 2024// Normalize unsigned byte color to 0-1 range 2025vec4 picking_normalizeColor(vec4 color) { 2026 return picking.useByteColors > 0.5 ? color / 255.0 : color; 2027} 2028 2029bool picking_isColorZero(vec3 color) { 2030 return dot(color, vec3(1.0)) < 0.00001; 2031} 2032 2033bool picking_isColorValid(vec3 color) { 2034 return dot(color, vec3(1.0)) > 0.00001; 2035} 2036 2037// Check if this vertex is highlighted 2038bool isVertexHighlighted(vec3 vertexColor) { 2039 vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 2040 return 2041 bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor)); 2042} 2043 2044// Set the current picking color 2045void picking_setPickingColor(vec3 pickingColor) { 2046 pickingColor = picking_normalizeColor(pickingColor); 2047 2048 if (bool(picking.isActive)) { 2049 // Use alpha as the validity flag. If pickingColor is [0, 0, 0] fragment is non-pickable 2050 picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor)); 2051 2052 if (!bool(picking.isAttribute)) { 2053 // Stores the picking color so that the fragment shader can render it during picking 2054 picking_vRGBcolor_Avalid.rgb = pickingColor; 2055 } 2056 } else { 2057 // Do the comparison with selected item color in vertex shader as it should mean fewer compares 2058 picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor)); 2059 } 2060} 2061 2062void picking_setPickingAttribute(float value) { 2063 if (bool(picking.isAttribute)) { 2064 picking_vRGBcolor_Avalid.r = value; 2065 } 2066} 2067 2068void picking_setPickingAttribute(vec2 value) { 2069 if (bool(picking.isAttribute)) { 2070 picking_vRGBcolor_Avalid.rg = value; 2071 } 2072} 2073 2074void picking_setPickingAttribute(vec3 value) { 2075 if (bool(picking.isAttribute)) { 2076 picking_vRGBcolor_Avalid.rgb = value; 2077 } 2078} 2079`,fs:`\ 2080layout(std140) uniform pickingUniforms { 2081 float isActive; 2082 float isAttribute; 2083 float isHighlightActive; 2084 float useByteColors; 2085 vec3 highlightedObjectColor; 2086 vec4 highlightColor; 2087} picking; 2088 2089in vec4 picking_vRGBcolor_Avalid; 2090 2091/* 2092 * Returns highlight color if this item is selected. 2093 */ 2094vec4 picking_filterHighlightColor(vec4 color) { 2095 // If we are still picking, we don't highlight 2096 if (picking.isActive > 0.5) { 2097 return color; 2098 } 2099 2100 bool selected = bool(picking_vRGBcolor_Avalid.a); 2101 2102 if (selected) { 2103 // Blend in highlight color based on its alpha value 2104 float highLightAlpha = picking.highlightColor.a; 2105 float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha); 2106 float highLightRatio = highLightAlpha / blendedAlpha; 2107 2108 vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio); 2109 return vec4(blendedRGB, blendedAlpha); 2110 } else { 2111 return color; 2112 } 2113} 2114 2115/* 2116 * Returns picking color if picking enabled else unmodified argument. 2117 */ 2118vec4 picking_filterPickingColor(vec4 color) { 2119 if (bool(picking.isActive)) { 2120 if (picking_vRGBcolor_Avalid.a == 0.0) { 2121 discard; 2122 } 2123 return picking_vRGBcolor_Avalid; 2124 } 2125 return color; 2126} 2127 2128/* 2129 * Returns picking color if picking is enabled if not 2130 * highlight color if this item is selected, otherwise unmodified argument. 2131 */ 2132vec4 picking_filterColor(vec4 color) { 2133 vec4 highlightColor = picking_filterHighlightColor(color); 2134 return picking_filterPickingColor(highlightColor); 2135} 2136`,getUniforms:function(t={},r){let i={},n=bc(t.useByteColors,!0);return void 0===t.highlightedObjectColor||(null===t.highlightedObjectColor?i.isHighlightActive=!1:(i.isHighlightActive=!0,i.highlightedObjectColor=t.highlightedObjectColor.slice(0,3))),t.highlightColor&&(i.highlightColor=function(t,r=!0){let i=bh(t.slice(0,3),r),n=Number.isFinite(t[3]),a=n?t[3]:1;return[i[0],i[1],i[2],r&&n?a/255:a]}(t.highlightColor,n)),void 0!==t.isActive&&(i.isActive=!!t.isActive,i.isAttribute=!!t.isAttribute),void 0!==t.useByteColors&&(i.useByteColors=!!t.useByteColors),i}},EL=`\ 2137 float disabledPickingIndexCount; 2138 vec4 disabledPickingIndices0; 2139 vec4 disabledPickingIndices1; 2140 vec4 disabledPickingIndices2; 2141`;function ER(t){return t.replace(" vec4 highlightColor;\n} picking;",` vec4 highlightColor; 2142${EL}} picking;`)}function EF(t,r){return[t[r]||0,t[r+1]||0,t[r+2]||0,t[r+3]||0]}let EB=`\ 2143vec3 picking_getPickingColorFromIndex(float objectIndex) { 2144 if (objectIndex < 0.0 || objectIndex >= 16777215.0) { 2145 return vec3(0.0); 2146 } 2147 2148 for (int i = 0; i < 10; i++) { 2149 if (float(i) >= picking.disabledPickingIndexCount) { 2150 break; 2151 } 2152 vec4 disabledIndices = i < 4 2153 ? picking.disabledPickingIndices0 2154 : (i < 8 ? picking.disabledPickingIndices1 : picking.disabledPickingIndices2); 2155 float disabledIndex = disabledIndices[i - (i / 4) * 4]; 2156 if (disabledIndex == objectIndex) { 2157 return vec3(0.0); 2158 } 2159 } 2160 2161 float encodedIndex = objectIndex + 1.0; 2162 return vec3( 2163 mod(encodedIndex, 256.0), 2164 mod(floor(encodedIndex / 256.0), 256.0), 2165 mod(floor(encodedIndex / 65536.0), 256.0) 2166 ); 2167} 2168 2169vec3 picking_getPickingColorFromIndex(uint objectIndex) { 2170 return picking_getPickingColorFromIndex(float(objectIndex)); 2171} 2172 2173vec3 picking_getPickingColorFromInstanceID() { 2174 return picking_getPickingColorFromIndex(float(gl_InstanceID)); 2175} 2176 2177void picking_setPickingColorFromInstanceID() { 2178 picking_setPickingColor(picking_getPickingColorFromInstanceID()); 2179} 2180`,Ez=`\ 2181struct pickingUniforms { 2182 isActive: f32, 2183 isAttribute: f32, 2184 isHighlightActive: f32, 2185 useByteColors: f32, 2186 highlightedObjectColor: vec3<f32>, 2187 highlightColor: vec4<f32>, 2188 disabledPickingIndexCount: f32, 2189 disabledPickingIndices0: vec4<f32>, 2190 disabledPickingIndices1: vec4<f32>, 2191 disabledPickingIndices2: vec4<f32>, 2192}; 2193 2194@group(0) @binding(auto) var<uniform> picking: pickingUniforms; 2195 2196fn picking_normalizeColor(color: vec3<f32>) -> vec3<f32> { 2197 return select(color, color / 255.0, picking.useByteColors > 0.5); 2198} 2199 2200fn picking_normalizeColor4(color: vec4<f32>) -> vec4<f32> { 2201 return select(color, color / 255.0, picking.useByteColors > 0.5); 2202} 2203 2204fn picking_isColorZero(color: vec3<f32>) -> bool { 2205 return dot(color, vec3<f32>(1.0)) < 0.00001; 2206} 2207 2208fn picking_isColorValid(color: vec3<f32>) -> bool { 2209 return dot(color, vec3<f32>(1.0)) > 0.00001; 2210} 2211 2212fn picking_getPickingColorFromIndex(objectIndex: u32) -> vec3<f32> { 2213 if (objectIndex >= 16777215u) { 2214 return vec3<f32>(0.0); 2215 } 2216 2217 for (var i = 0; i < 10; i = i + 1) { 2218 if (f32(i) >= picking.disabledPickingIndexCount) { 2219 break; 2220 } 2221 let disabledIndices = select( 2222 picking.disabledPickingIndices2, 2223 select(picking.disabledPickingIndices1, picking.disabledPickingIndices0, i < 4), 2224 i < 8 2225 ); 2226 let disabledIndex = disabledIndices[i % 4]; 2227 if (disabledIndex == f32(objectIndex)) { 2228 return vec3<f32>(0.0); 2229 } 2230 } 2231 2232 let encodedIndex = objectIndex + 1u; 2233 return vec3<f32>( 2234 f32(encodedIndex % 256u), 2235 f32((encodedIndex / 256u) % 256u), 2236 f32((encodedIndex / 65536u) % 256u) 2237 ) / 255.0; 2238} 2239`,Ej={...EN,vs:`${ER(EN.vs)} 2240${EB}`,fs:ER(EN.fs),source:Ez,uniformTypes:{...EN.uniformTypes,disabledPickingIndexCount:"f32",disabledPickingIndices0:"vec4<f32>",disabledPickingIndices1:"vec4<f32>",disabledPickingIndices2:"vec4<f32>"},defaultUniforms:{...EN.defaultUniforms,useByteColors:!0,disabledPickingIndexCount:0,disabledPickingIndices0:[0,0,0,0],disabledPickingIndices1:[0,0,0,0],disabledPickingIndices2:[0,0,0,0]},getUniforms(t,r){let i=EN.getUniforms(t,r),n=t.disabledPickingIndices||[];return i.disabledPickingIndexCount=n.length,i.disabledPickingIndices0=EF(n,0),i.disabledPickingIndices1=EF(n,4),i.disabledPickingIndices2=EF(n,8),i},inject:{"vs:DECKGL_FILTER_GL_POSITION":` 2241 // for picking depth values 2242 picking_setPickingAttribute(position.z / position.w); 2243 `,"vs:DECKGL_FILTER_COLOR":` 2244 picking_setPickingColor(geometry.pickingColor); 2245 `,"fs:DECKGL_FILTER_COLOR":{order:99,injection:` 2246 // use highlight color if this fragment belongs to the selected object. 2247 color = picking_filterHighlightColor(color); 2248 2249 // use picking color if rendering to picking FBO. 2250 color = picking_filterPickingColor(color); 2251 `}}},EU=[bA],EV=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"],E$=[],EG=Symbol.for("component"),Eq=Symbol.for("propTypes"),EH=Symbol.for("deprecatedProps"),EW=Symbol.for("asyncPropDefaults"),EZ=Symbol.for("asyncPropOriginal"),EY=Symbol.for("asyncPropResolved");var EX=t.i(247167);let EK={};function EQ(t){EK=t}function EJ(t,r,i,n){xn.level>0&&EK[t]&&EK[t].call(null,r,i,n)}function E0(t,r=()=>!0){return Array.isArray(t)?function t(r,i,n){let a=-1;for(;++a<r.length;){let o=r[a];Array.isArray(o)?t(o,i,n):i(o)&&n.push(o)}return n}(t,r,[]):r(t)?[t]:[]}var E1=t.i(509685);let E2=t=>null!==t&&"object"==typeof t,E3=t=>E2(t)&&t.constructor===({}).constructor,E4=t=>"u">typeof SharedArrayBuffer&&t instanceof SharedArrayBuffer,E6=t=>E2(t)&&"number"==typeof t.byteLength&&"function"==typeof t.slice,E5=t=>"u">typeof Response&&t instanceof Response||E2(t)&&"function"==typeof t.arrayBuffer&&"function"==typeof t.text&&"function"==typeof t.json,E8=t=>"u">typeof Blob&&t instanceof Blob,E7=t=>{let r,i;return r=t,"u">typeof ReadableStream&&r instanceof ReadableStream||E2(r)&&"function"==typeof r.tee&&"function"==typeof r.cancel&&"function"==typeof r.getReader||E2(i=t)&&"function"==typeof i.read&&"function"==typeof i.pipe&&"boolean"==typeof i.readable};function E9(t,r){if(!t)throw Error(r||"loader assertion failed.")}function Te(t){return!!t&&(Array.isArray(t)&&(t=t[0]),Array.isArray(t?.extensions))}function Tt(t){let r;return E9(t,"null loader"),E9(Te(t),"invalid loader"),Array.isArray(t)&&(r=t[1],t={...t=t[0],options:{...t.options,...r}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}let Tr={};
2251class Ti extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response}let Tn=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Ta=/^([-\w.]+\/[-\w.+]+)/;function To(t,r){return t.toLowerCase()===r.toLowerCase()}function Ts(t){let r=Tn.exec(t);return r?r[1]:""}let Tl=/\?.*/;function Tu(t){return t.replace(Tl,"")}function Tc(t){return E5(t)?t.url:E8(t)?("name"in t?t.name:"")||"":"string"==typeof t?t:""}function Th(t){if(E5(t)){let r,i=t.headers.get("content-type")||"",n=Tu(t.url);return((r=Ta.exec(i))?r[1]:i)||Ts(n)}return E8(t)?t.type||"":"string"==typeof t?Ts(t):""}async function Tf(t){var r;if(E5(t))return t;let i={},n=E5(r=t)?r.headers["content-length"]||-1:E8(r)?r.size:"string"==typeof r?r.length:r instanceof ArrayBuffer||ArrayBuffer.isView(r)?r.byteLength:-1;n>=0&&(i["content-length"]=String(n));let a=Tc(t),o=Th(t);o&&(i["content-type"]=o);let s=await Tm(t);s&&(i["x-first-bytes"]=s),"string"==typeof t&&(t=new TextEncoder().encode(t));let l=new Response(t,{headers:i}
2251);return Object.defineProperty(l,"url",{value:a}),l}async function Td(t){if(!t.ok)throw await Tp(t)}async function Tp(t){let r=function(t){if(t.length<50)return t;let r=t.slice(t.length-15),i=t.substr(0,32);return`${i}...${r}`}(t.url),i=`Failed to fetch resource (${t.status}) ${t.statusText}: ${r}`;i=i.length>100?`${i.slice(0,100)}...`:i;let n={reason:t.statusText,url:t.url,response:t};try{let r=t.headers.get("Content-Type");n.reason=!t.bodyUsed&&r?.includes("application/json")?await t.json():await t.text()}catch(t){}return new Ti(i,n)}async function Tm(t){if("string"==typeof t)return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(t=>{let i=new FileReader;i.onload=r=>t(r?.target?.result),i.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=function(t){let r="",i=new Uint8Array(t);for(let t=0;t<i.byteLength;t++)r+=String.fromCharCode(i[t]);return btoa(r)}(t.slice(0,5));return`data:base64,${r}`}return null}async function Tg(t,r){if("string"==typeof t){var i;let n=function(t){for(let r in Tr)if(t.startsWith(r)){let i=Tr[r];t=t.replace(r,i)}return t.startsWith("http://")||t.startsWith("https://")||(t=`${t}`),t}(t);return!((i=n).startsWith("http:")||i.startsWith("https:"))&&!n.startsWith("data:")&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(n,r):await fetch(n,r)}return await Tf(t)}t.s(["dirname",0,function(t){let r=t?t.lastIndexOf("/"):-1;return r>=0?t.substr(0,r):""},"filename",0,function(t){let r=t?t.lastIndexOf("/"):-1;return r>=0?t.substr(r+1):t},"join",0,function(...t){return(t=t.map((r,i)=>(i&&(r=r.replace(RegExp("^/"),"")),i!==t.length-1&&(r=r.replace(RegExp("/$"),"")),r))).join("/")},"resolve",0,function(...t){let r,i=[];for(let r=0;r<t.length;r++)i[r]=t[r];let n="",a=!1;for(let t=i.length-1;t>=-1&&!a;t--){let o;t>=0?o=i[t]:(void 0===r&&(r=function(){if(void 0!==EX.default&&void 0!==EX.default.cwd)return EX.default.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}()),o=r),0!==o.length&&(n=`${o}/${n}`,a=47===o.charCodeAt(0))}return(n=function(t,r){let i,n="",a=-1,o=0,s=!1;for(let l=0;l<=t.length;++l){if(l<t.length)i=t.charCodeAt(l);else if(47===i)break;else i=47;if(47===i){if(a===l-1||1===o);else if(a!==l-1&&2===o){if(n.length<2||!s||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2)){if(n.length>2){let t=n.length-1,r=t;for(;r>=0&&47!==n.charCodeAt(r);--r);if(r!==t){n=-1===r?"":n.slice(0,r),a=l,o=0,s=!1;continue}}else if(2===n.length||1===n.length){n="",a=l,o=0,s=!1;continue}}r&&(n.length>0?n+="/..":n="..",s=!0)}else{let r=t.slice(a+1,l);n.length>0?n+=`/${r}`:n=r,s=!1}a=l,o=0}else 46===i&&-1!==o?++o:o=-1}return n}(n,!a),a)?`/${n}`:n.length>0?n:"."}],473276);var Ty=t.i(473276),Ty=Ty;let Tv=new xi.Log({id:"loaders.gl"});class T_{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}let Tb={self:"u">typeof self&&self,window:"u">typeof window&&window,global:t.g,document:"u">typeof document&&document};Tb.self||Tb.window||Tb.global,Tb.window||Tb.self||Tb.global,Tb.global||Tb.self||Tb.window,Tb.document;let Tx=("object"!=typeof EX.default||"[object process]"!==String(EX.default),!0),Tw=void 0!==EX.default&&EX.default.version&&/v([0-9]*)/.exec(EX.default.version);Tw&&parseFloat(Tw[1]);let TE={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,log:new class{console;constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}}
2251,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Tx,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},TT={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",maxMobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"
2251core.fetch.keepalive",signal:"core.fetch.signal"},TA=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms"];function TS(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function TC(){let t=TS();return t.globalOptions=t.globalOptions||{...TE,core:{...TE.core}},TM(t.globalOptions)}function TM(t){var r;let i,n=(i={...r=t},r.core&&(i.core={...r.core}),i);for(let t of(TI(n),TA))n.core&&void 0!==n.core[t]&&delete n[t];return n.core&&void 0!==n.core._workerType&&delete n._worker,n}function TD(t,r,i,n,a){let o=r||"Top level",s=r?`${r}.`:"";for(let l in t){let u=!r&&E2(t[l]),c="baseUri"===l&&!r,h="workerUrl"===l&&r;if(!(l in i)&&!c&&!h){if(l in n)Tv.level>0&&Tv.warn(`${o} loader option '${s}${l}' no longer supported, use '${n[l]}'`)();else if(!u&&Tv.level>0){let t=function(t,r){let i=t.toLowerCase(),n="";for(let a of r)for(let r in a.options){if(t===r)return`Did you mean '${a.id}.${r}'?`;let o=r.toLowerCase();(i.startsWith(o)||o.startsWith(i))&&(n=n||`Did you mean '${a.id}.${r}'?`)}return n}(l,a);Tv.warn(`${o} loader option '${s}${l}' not recognized. ${t}`)()}}}}function TP(t,r){for(let i in r)i in r&&(E3(r[i])&&E3(t[i])?t[i]={...t[i],...r[i]}:t[i]=r[i])}function TI(t){for(let r of(void 0!==t.baseUri&&(t.core||={},void 0===t.core.baseUrl&&(t.core.baseUrl=t.baseUri)),TA))if(void 0!==t[r]){let i=t.core=t.core||{};void 0===i[r]&&(i[r]=t[r])}let r=t._worker;void 0!==r&&(t.core||={},void 0===t.core._workerType&&(t.core._workerType=r))}function Tk(t,r){let i=TC(),n=t||i,a=n.fetch??n.core?.fetch;return"function"==typeof a?a:E2(a)?t=>Tg(t,a):r?.fetch?r?.fetch:Tg}let TO={self:"u">typeof self&&self,window:"u">typeof window&&window,global:t.g,document:"u">typeof document&&document};TO.self||TO.window||TO.global,TO.window||TO.self||TO.global,TO.global||TO.self||TO.window,TO.document;let TN="object"!=typeof EX.default||"[object process]"!==String(EX.default)||!0,TL="u">typeof window&&void 0!==window.orientation,TR=void 0!==EX.default&&EX.default.version&&/v([0-9]*)/.exec(EX.default.version);TR&&parseFloat(TR[1]);class TF{terminate(){}}function TB(t,r){if(!t)throw Error(r||"loaders.gl assertion failed.")}let Tz=new Map;function Tj(t){let r=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(r)}function TU(t){return!!t&&!!(t instanceof ArrayBuffer||"u">typeof MessagePort&&t instanceof MessagePort||"u">typeof ImageBitmap&&t instanceof ImageBitmap||"u">typeof OffscreenCanvas&&t instanceof OffscreenCanvas)}let TV=()=>{};class T${name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return"u">typeof Worker&&TN||!TN}constructor(t){const{name:r,source:i,url:n}=t;TB(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=TV,this.onError=t=>console.log(t),this.worker=TN?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=TV,this.onError=TV,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,r){r=r||function t(r,i=!0,n){let a=n||new Set;if(r){if(TU(r))a.add(r);else if(TU(r.buffer))a.add(r.buffer);else if(ArrayBuffer.isView(r));else if(i&&"object"==typeof r)for(let n in r)t(r[n],i,a)}return void 0===n?Array.from(a):[]}(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,t.message&&(r+=`${t.message} in `),t.lineno&&(r+=`:${t.lineno}:${t.colno}`),Error(r)}_createBrowserWorker(){var t,r,i;let n;this._loadableURL=(TB((t={source:this.source,url:this.url}
2251).source&&!t.url||!t.source&&t.url),(n=Tz.get(t.source||t.url))||(t.url&&(n=(r=t.url).startsWith("http")?Tj((i=r,`\ 2252try { 2253 importScripts('${i}'); 2254} catch (error) { 2255 console.error(error); 2256 throw error; 2257}`)):r,Tz.set(t.url,n)),t.source&&(n=Tj(t.source),Tz.set(t.source,n))),TB(n),n);let a=new Worker(this._loadableURL,{name:this.name});return a.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(Error("No data received"))},a.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},a.onmessageerror=t=>console.error(t),a}_createNodeWorker(){let t;if(this.url)t=new TF(this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,{eval:!1,type:this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs"});else if(this.source)t=new TF(this.source,{eval:!0});else throw Error("no worker");return t.on("message",t=>{this.onMessage(t)}),t.on("error",t=>{this.onError(t)}),t.on("exit",t=>{}),t}}class TG{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,r){this.name=t,this.workerThread=r,this.result=new Promise((t,r)=>{this._resolve=t,this._reject=r})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){TB(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){TB(this.isRunning),this.isRunning=!1,this._reject(t)}}class Tq{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return T$.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t,r=(t,r,i)=>t.done(i),i=(t,r)=>t.error(r)){let n=new Promise(n=>(this.jobQueue.push({name:t,onMessage:r,onError:i,onStart:n}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:t,backlog:this.jobQueue.length});let i=new TG(r.name,t);t.onMessage=t=>r.onMessage(i,t.type,t.payload),t.onError=t=>r.onError(i,t),r.onStart(i);try{await i.result}catch(t){console.error(`Worker exception: ${t}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!TN||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){return this.idleQueue.length>0?this.idleQueue.shift()||null:this.count<this._getMaxConcurrency()?(this.count++,new T$({name:`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`,source:this.source,url:this.url})):null}_getMaxConcurrency(){return TL?this.maxMobileConcurrency:this.maxConcurrency}}let TH={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class TW{props;workerPools=new Map;static _workerFarm;static isSupported(){return T$.isSupported()}static getWorkerFarm(t={}){return TW._workerFarm=TW._workerFarm||new TW({}),TW._workerFarm.setProps(t),TW._workerFarm}constructor(t){this.props={...TH},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){for(let r of(this.props={...this.props,...t},this.workerPools.values()))r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:i,url:n}=t,a=this.workerPools.get(r);return a||((a=new Tq({name:r,source:i,url:n})).setProps(this._getWorkerPoolProps()),this.workerPools.set(r,a)),a}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}
2257}async function TZ(t,r,i,n,a){let o=t.id,s=function(t,r={}){let i=r[t.id]||{},n=TN?t.workerFile||`${t.id}-worker.js`:`${t.id}-worker-node.js`,a=i.workerUrl;if(a||"compression"!==t.id||(a=r.workerUrl),"test"===(r._workerType||r?.core?._workerType)&&(a=TN?`modules/${t.module}/dist/${n}`:`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!a){let r=t.version;"latest"===r&&(r="latest");let i=r?`@${r}`:"";a=`https://unpkg.com/@loaders.gl/${t.module}${i}/dist/${n}`}return TB(a),a}(t,i),l=TW.getWorkerFarm(i?.core).getWorkerPool({name:o,url:s});(i=JSON.parse(JSON.stringify(i||{})))._workerLoaderId=t.id,n=JSON.parse(JSON.stringify(n||{}));let u=await l.startJob("process-on-worker",TY.bind(null,a));u.postMessage("process",{input:r,options:i,context:n});let c=await u.result;return await c.result}async function TY(t,r,i,n){switch(i){case"done":r.done(n);break;case"error":r.error(Error(n.error));break;case"process":let{id:a,input:o,options:s}=n;try{let i=await t(o,s);r.postMessage("done",{id:a,result:i})}catch(i){let t=i instanceof Error?i.message:"unknown error";r.postMessage("error",{id:a,error:t})}break;default:console.warn(`parse-with-worker unknown message ${i}`)}}let TX=(globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.5.2"),globalThis._loadersgl_.version);async function TK(t){let r=[];for await(let i of t)r.push(function(t){if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t)){let{buffer:r,byteOffset:i,byteLength:n}=t;return TQ(r,i,n)}return TQ(t)}(i));return function(...t){var r=t;let i=r.map(t=>t instanceof ArrayBuffer?new Uint8Array(t):t),n=new Uint8Array(i.reduce((t,r)=>t+r.byteLength,0)),a=0;for(let t of i)n.set(t,a),a+=t.byteLength;return n.buffer}(...r)}function TQ(t,r=0,i=t.byteLength-r){let n=new Uint8Array(t,r,i),a=new Uint8Array(n.length);return a.set(n),a.buffer}function TJ(t){return t&&"object"==typeof t&&t.isBuffer}function T0(t){if(TJ(t)||t instanceof ArrayBuffer)return t;if(E4(t))return T2(t);if(ArrayBuffer.isView(t)){let r=t.buffer;return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?r:r.slice(t.byteOffset,t.byteOffset+t.byteLength)}if("string"==typeof t)return new TextEncoder().encode(t).buffer;if(t&&"object"==typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw Error("toArrayBuffer")}function T1(t){if(t instanceof ArrayBuffer)return t;if(E4(t))return T2(t);let{buffer:r,byteOffset:i,byteLength:n}=t;return r instanceof ArrayBuffer&&0===i&&n===r.byteLength?r:T2(r,i,n)}function T2(t,r=0,i=t.byteLength-r){let n=new Uint8Array(t,r,i),a=new Uint8Array(n.length);return a.set(n),a.buffer}async function*T3(t,r){let i=r?.chunkSize||1048576,n=0;for(;n<t.size;){let r=n+i,a=await t.slice(n,r).arrayBuffer();n=r,yield a}}function T4(t,r){return Tx?T6(t,r):T5(t,r)}async function*T6(t,r){let i,n=t.getReader();try{for(;;){let t=i||n.read();r?._streamReadAhead&&(i=n.read());let{done:a,value:o}=await t;if(a)return;yield T0(o)}}catch(t){n.releaseLock()}}async function*T5(t,r){for await(let r of t)yield T0(r)}let T8="Cannot convert supplied data type";async function T7(t,r,i){let n,a;if("string"==typeof t||E6(t)){var o,s=t;if(r.text&&"string"==typeof s)return s;if(TJ(s)&&(s=s.buffer),E6(s)){let t=ArrayBuffer.isView(o=s)?o:new Uint8Array(o);return r.text&&!r.binary?new TextDecoder("utf8").decode(t):T0(t)}throw Error(T8)}if(E8(t)&&(t=await Tf(t)),E5(t))return await Td(t),r.binary?await t.arrayBuffer():await t.text();if(E7(t)&&(t=function(t,r){if("string"==typeof t)return function*(t,r){let i=r?.chunkSize||262144,n=0,a=new TextEncoder;for(;n<t.length;){let r=Math.min(t.length-n,i),o=t.slice(n,n+r);n+=r,yield T1(a.encode(o))}}(t,r);if(t instanceof ArrayBuffer)return function*(t,r={}){let{chunkSize:i=262144}=r,n=0;for(;n<t.byteLength;){let r=Math.min(t.byteLength-n,i),a=new ArrayBuffer(r),o=new Uint8Array(t,n,r);new Uint8Array(a).set(o),n+=r,yield a}}(t,r);if(E8(t))return T3(t,r);if(E7(t))return T4(t,r);if(E5(t)){let i=t.body;if(!i)throw Error("Readable stream not available on Response");return T4(i,r)}throw Error("makeIterator")}(t,i)),(n=t)&&"function"==typeof n[Symbol.iterator]||(a=t)&&"function"==typeof a[Symbol.asyncIterator])return TK(t);throw Error(T8)}var Ty=Ty,Ty=Ty;let T9="4.5.2",Ae=T9[0]>="0"&&T9[0]<="9"?`v${T9}
2257`:"",At=(Q=new xi.Log({id:"loaders.gl"}),globalThis.loaders||={},globalThis.loaders.log=Q,globalThis.loaders.version=Ae,globalThis.probe||={},globalThis.probe.loaders=Q,Q),Ar=()=>{let t=TS();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry},Ai=/\.([^.]+)$/;async function An(t,r=[],i,n){if(!As(t))return null;let a=TM(i||{});if(a.core||={},t instanceof Response&&Aa(t)){let i=Ao(await t.clone().text(),r,{...a,core:{...a.core,nothrow:!0}},n);if(i)return i}let o=Ao(t,r,{...a,core:{...a.core,nothrow:!0}},n);if(o)return o;if(E8(t)&&(o=Ao(t=await t.slice(0,10).arrayBuffer(),r,a,n)),!o&&t instanceof Response&&Aa(t)&&(o=Ao(await t.clone().text(),r,a,n)),!o&&!a.core.nothrow)throw Error(Al(t));return o}function Aa(t){let r=Th(t);return!!(r&&(r.startsWith("text/")||"application/json"===r||r.endsWith("+json")))}function Ao(t,r=[],i,n){var a,o,s,l,u,c;let h,f,d,p,m,g,y;if(!As(t))return null;let v=TM(i||{});if(v.core||={},r&&!Array.isArray(r))return Tt(r);let _=[];r&&(_=_.concat(r)),v.core.ignoreRegisteredLoaders||_.push(...Ar()),function(t){for(let r of t)Tt(r)}(_);let b=(a=t,o=_,s=v,l=n,h=Tc(a),f=Th(a),d=Tu(h)||l?.url,p=null,m="",s?.core?.mimeType&&(p=Au(o,s?.core?.mimeType),m=`match forced by supplied MIME type ${s?.core?.mimeType}`),p=p||(u=o,(y=(g=(c=d)&&Ai.exec(c))&&g[1])?function(t,r){for(let i of(r=r.toLowerCase(),t))for(let t of i.extensions)if(t.toLowerCase()===r)return i;return null}(u,y):null),m=m||(p?`matched url ${d}`:""),p=p||Au(o,f),m=m||(p?`matched MIME type ${f}`:""),p=p||function(t,r){if(!r)return null;for(let i of t)if("string"==typeof r){if(function(t,r){return r.testText?r.testText(t):(Array.isArray(r.tests)?r.tests:[r.tests]).some(r=>t.startsWith(r))}(r,i))return i}else if(ArrayBuffer.isView(r)){if(Ac(r.buffer,r.byteOffset,i))return i}else if(r instanceof ArrayBuffer&&Ac(r,0,i))return i;return null}(o,a),m=m||(p?`matched initial data ${Ah(a)}`:""),s?.core?.fallbackMimeType&&(p=p||Au(o,s?.core?.fallbackMimeType),m=m||(p?`matched fallback MIME type ${f}`:"")),m&&At.log(1,`selectLoader selected ${p?.name}: ${m}.`),p);if(!b&&!v.core.nothrow)throw Error(Al(t));return b}function As(t){return!(t instanceof Response)||204!==t.status}function Al(t){let r=Tc(t),i=Th(t),n="No valid loader found (";n+=(r?`${Ty.filename(r)}, `:"no url provided, ")+`MIME type: ${i?`"${i}"`:"not provided"}, `;let a=t?Ah(t):"";return n+((a?` first bytes: "${a}"`:"first bytes: not available")+")")}function Au(t,r){for(let i of t)if(i.mimeTypes?.some(t=>To(r,t))||To(r,`application/x.${i.id}`))return i;return null}function Ac(t,r,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some(i=>(function(t,r,i){if(E6(i))return function(t,r,i){if(i=i||t.byteLength,t.byteLength<i||r.byteLength<i)return!1;let n=new Uint8Array(t),a=new Uint8Array(r);for(let t=0;t<n.length;++t)if(n[t]!==a[t])return!1;return!0}(i,t,i.byteLength);switch(typeof i){case"function":return i(T1(t));case"string":let n=Af(t,r,i.length);return i===n;default:return!1}})(t,r,i))}function Ah(t,r=5){return"string"==typeof t?t.slice(0,r):ArrayBuffer.isView(t)?Af(t.buffer,t.byteOffset,r):t instanceof ArrayBuffer?Af(t,0,r):""}function Af(t,r,i){if(t.byteLength<r+i)return"";let n=new DataView(t),a="";for(let t=0;t<i;t++)a+=String.fromCharCode(n.getUint8(r+t));return a}async function Ad(t,r,i,n){var a,o,s,l,u,c,h;let f,d;!r||Array.isArray(r)||Te(r)||(n=void 0,i=r,r=void 0),t=await t,i=i||{};let p=Tc(t),m=function(t,r){let i;if(t&&!Array.isArray(t))return t;if(t&&(i=Array.isArray(t)?t:[t]),r&&r.loaders){let t=Array.isArray(r.loaders)?r.loaders:[r.loaders];i=i?[...i,...t]:t}return i&&i.length?i:void 0}(r,n),g=await An(t,m,i);if(!g)return null;let y=(function(t,r){for(let i of(TD(t,null,TE,TT,r),r)){let n=t&&t[i.id]||{},a=i.options&&i.options[i.id]||{},o=i.deprecatedOptions&&i.deprecatedOptions[i.id]||{};TD(n,i.id,a,o,r)}}(a=i,o=Array.isArray(o=(o=m)||[])?o:[o]),TM((s=g,l=a,u=p,d={...f=s.options||{}},f.core&&(d.core={...f.core}),TI(d),d.core?.log===null&&(d.core={...d.core,log:new T_}),TP(d,TM(TC())),TP(d,TM(l)),c=d,(h=u)&&c.core?.baseUrl===void 0&&(c.core||={},c.core.baseUrl=Ty.dirname(Tu(h))),function(t){let r=t.core;if(r)for(let i of TA)void 0!==r[i]&&(t[i]=r[i])}(d),d)));return n=function(t,r,i){if(i)return i;let n={fetch:Tk(r,t),...t};if(n.url){let t,r=Tu(n.url);n.baseUrl=r,t=n.url.match(Tl),n.queryString=t&&t[0],n.filename=Ty.filename(r),n.baseUrl=Ty.dirname(r)}return Array.isArray(n.loaders)||(n.loaders=null),n}({url:p,_parse:Ad,loaders:m},y,n||null),await Ap(g,t,y,n)}async function Ap(t,r,i,n){if(!function(t,r=TX){TB(t,"no worker provided");t.version}(t),i=function t(r,i,n=0){if(n>3)return i;let a={...r};for(let[r,o]of Object.entries(i))o&&"object"==typeof o&&!Array.isArray(o)?a[r]=t(
2257a[r]||{},i[r],n+1):a[r]=i[r];return a}(t.options||{},i),E5(r)){let{ok:t,redirected:i,status:a,statusText:o,type:s,url:l}=r;n.response={headers:Object.fromEntries(r.headers.entries()),ok:t,redirected:i,status:a,statusText:o,type:s,url:l}}if(r=await T7(r,t,i),t.parseTextSync&&"string"==typeof r)return t.parseTextSync(r,i,n);if(function(t,r){if(!TW.isSupported())return!1;let i=r?._nodeWorkers??r?.core?._nodeWorkers;if(!TN&&!i)return!1;let n=r?.worker??r?.core?.worker;return!!(t.worker&&n)}(t,i))return await TZ(t,r,i,n,Ad);if(t.parseText&&"string"==typeof r)return await t.parseText(r,i,n);if(t.parse)return await t.parse(r,i,n);throw TB(!t.parseSync),Error(`${t.id} loader - no parser found and worker is disabled`)}async function Am(t,r,i,n){let a,o;Array.isArray(r)||Te(r)?(a=r,o=i):(a=[],o=r);let s=Tk(o),l=t;if("string"==typeof t&&(l=await s(t)),E8(t)&&(l=await s(t)),"string"==typeof t){let r=TM(o||{});r.core?.baseUrl||(o={...o,core:{...o?.core,baseUrl:t}})}return Array.isArray(a),await Ad(l,a,o)}class Ag{constructor(t,r,i){this._loadCount=0,this._subscribers=new Set,this.id=t,this.context=i,this.setData(r)}subscribe(t){this._subscribers.add(t)}unsubscribe(t){this._subscribers.delete(t)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,r){if(t===this._data&&!r)return;this._data=t;let i=++this._loadCount,n=t;for(let r of("string"==typeof t&&(n=Am(t)),n instanceof Promise?(this.isLoaded=!1,this._loader=n.then(t=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=t)}).catch(t=>{this._loadCount===i&&(this.isLoaded=!0,this._error=t||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t),this._subscribers))r.onChange(this.getData())}}class Ay{constructor(t){this.protocol=t.protocol||"resource://",this._context={device:t.device,gl:t.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return!!t.startsWith(this.protocol)||t in this._resources}add({resourceId:t,data:r,forceUpdate:i=!1,persistent:n=!0}){let a=this._resources[t];a?a.setData(r,i):(a=new Ag(t,r,this._context),this._resources[t]=a),a.persistent=n}remove(t){let r=this._resources[t];r&&(r.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){let r=this._consumers[t];if(r){for(let t in r){let i=r[t],n=this._resources[i.resourceId];n&&n.unsubscribe(i)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:r,consumerId:i,requestId:n="default"}){let{_resources:a,protocol:o}=this;t.startsWith(o)&&(a[t=t.replace(o,"")]||this.add({resourceId:t,data:null,persistent:!1}));let s=a[t];if(this._track(i,n,s,r),s)return s.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let t in this._resources)this._resources[t].delete()}_track(t,r,i,n){let a=this._consumers,o=a[t]=a[t]||{},s=o[r],l=s&&s.resourceId&&this._resources[s.resourceId];l&&(l.unsubscribe(s),this.prune()),i&&(s?(s.onChange=n,s.resourceId=i.id):s={onChange:n,resourceId:i.id},o[r]=s,i.subscribe(s))}_prune(){for(let t of(this._pruneRequest=null,Object.keys(this._resources))){let r=this._resources[t];r.persistent||r.inUse()||(r.delete(),delete this._resources[t])}}}let Av=new class{constructor(t={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(t)}setOptions(t){Object.assign(this.opts,t)}allocate(t,r,{size:i=1,type:n,padding:a=0,copy:o=!1,initialize:s=!1,maxCount:l}){let u=n||t&&t.constructor||Float32Array,c=r*i+a;if(ArrayBuffer.isView(t)){if(c<=t.length)return t;if(c*t.BYTES_PER_ELEMENT<=t.buffer.byteLength)return new u(t.buffer,0,c)}let h=1/0;l&&(h=l*i+a);let f=this._allocate(u,c,s,h);return t&&o?f.set(t):s||f.fill(0,0,4),this._release(t),f}release(t){this._release(t)}_allocate(t,r,i,n){let a=Math.max(Math.ceil(r*this.opts.overAlloc),1);a>n&&(a=n);let o=this._pool,s=t.BYTES_PER_ELEMENT*a,l=o.findIndex(t=>t.byteLength>=s);if(l>=0){let r=new t(o.splice(l,1)[0],0,a);return i&&r.fill(0),r}return new t(a)}_release(t){if(!ArrayBuffer.isView(t))return;let r=this._pool,{buffer:i}=t,{byteLength:n}=i,a=r.findIndex(t=>t.byteLength>=n);a<0?r.push(i):(a>0||r.length<this.opts.poolSize)&&r.splice(a,0,i),r.length>this.opts.poolSize&&r.shift()}};
2257function A_(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ab(t,r){let i=t%r;return i<0?r+i:i}let Ax=new wQ;function Aw(t,r,i,n){Ax.set(t,r,i);let a=Ax.len();return{distance:n/a,normal:new wQ(-t/a,-r/a,-i/a)}}function AE(t,r){let{size:i=1,startIndex:n=0}=r,a=void 0!==r.endIndex?r.endIndex:t.length,o=(a-n)/i;B=Av.allocate(B,o,{type:Float32Array,size:2*i});let s=n,l=0;for(;s<a;){for(let r=0;r<i;r++){let n=t[s++];B[l+r]=n,B[l+r+i]=n-Math.fround(n)}l+=2*i}return B.subarray(0,o*i*2)}function AT(t){let r=null,i=!1;for(let n of t)n&&(r?(i||(r=[[r[0][0],r[0][1]],[r[1][0],r[1][1]]],i=!0),r[0][0]=Math.min(r[0][0],n[0][0]),r[0][1]=Math.min(r[0][1],n[0][1]),r[1][0]=Math.max(r[1][0],n[1][0]),r[1][1]=Math.max(r[1][1],n[1][1])):r=n);return r}var bY=bY;let AA=Math.PI/180,AS=A_(),AC=[0,0,0],AM={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};class AD{constructor(t={}){this._frustumPlanes={},this.id=t.id||this.constructor.displayName||"viewport",this.x=t.x||0,this.y=t.y||0,this.width=t.width||1,this.height=t.height||1,this.zoom=t.zoom||0,this.padding=t.padding,this.distanceScales=t.distanceScales||AM,this.focalDistance=t.focalDistance||1,this.position=t.position||AC,this.modelMatrix=t.modelMatrix||null;const{longitude:r,latitude:i}=t;this.isGeospatial=Number.isFinite(i)&&Number.isFinite(r),this._initProps(t),this._initMatrices(t),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?x3.WEB_MERCATOR:x3.WEB_MERCATOR_AUTO_OFFSET:x3.IDENTITY}equals(t){return t instanceof AD&&(this===t||t.width===this.width&&t.height===this.height&&t.scale===this.scale&&t.projectionMode===this.projectionMode&&t.resolution===this.resolution&&wE(t.distanceScales.unitsPerMeter,this.distanceScales.unitsPerMeter)&&wE(t.projectionMatrix,this.projectionMatrix)&&wE(t.viewMatrix,this.viewMatrix))}project(t,{topLeft:r=!0}={}){let i=Ew(this.projectPosition(t),this.pixelProjectionMatrix),[n,a]=i,o=r?a:this.height-a;return 2===t.length?[n,o]:[n,o,i[2]]}unproject(t,{topLeft:r=!0,targetZ:i}={}){let[n,a,o]=t,s=r?a:this.height-a,l=i&&i*this.distanceScales.unitsPerMeter[2],u=EE([n,s,o],this.pixelUnprojectionMatrix,l),[c,h,f]=this.unprojectPosition(u);return Number.isFinite(o)?[c,h,f]:Number.isFinite(i)?[c,h,i]:[c,h]}projectPosition(t){let[r,i]=this.projectFlat(t);return[r,i,(t[2]||0)*this.distanceScales.unitsPerMeter[2]]}unprojectPosition(t){let[r,i]=this.unprojectFlat(t);return[r,i,(t[2]||0)*this.distanceScales.metersPerUnit[2]]}projectFlat(t){if(this.isGeospatial){let r=Em(t);return r[1]=wx(r[1],-318,830),r}return t}unprojectFlat(t){return this.isGeospatial?Eg(t):t}getBounds(t={}){let r={targetZ:t.z||0},i=this.unproject([0,0],r),n=this.unproject([this.width,0],r),a=this.unproject([0,this.height],r),o=this.unproject([this.width,this.height],r);return[Math.min(i[0],n[0],a[0],o[0]),Math.min(i[1],n[1],a[1],o[1]),Math.max(i[0],n[0],a[0],o[0]),Math.max(i[1],n[1],a[1],o[1])]}getDistanceScales(t){return t&&this.isGeospatial?Ev({longitude:t[0],latitude:t[1],highPrecision:!0}):this.distanceScales}containsPixel({x:t,y:r,width:i=1,height:n=1}){return t<this.x+this.width&&this.x<t+i&&r<this.y+this.height&&this.y<r+n}getFrustumPlanes(){var t;return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,{left:Aw((t=this.viewProjectionMatrix)[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),right:Aw(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),bottom:Aw(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),top:Aw(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),near:Aw(t[3]+t[2],t[7]+t[6],t[11]+t[10],t[15]+t[14]),far:Aw(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14])}),this._frustumPlanes)}panByPosition(t,r,i){return null}_initProps(t){let r=t.longitude,i=t.latitude;this.isGeospatial&&(Number.isFinite(t.zoom)||(this.zoom=function(t){let{latitude:r}=t;return Ec(Number.isFinite(r)),Es(4003e4*Math.cos(r*Ed))-9}({latitude:i})+Math.log2(this.focalDistance)),this.distanceScales=t.distanceScales||Ev({latitude:i,longitude:r}));let n=Math.pow(2,this.zoom);this.scale=n;let{position:a,modelMatrix:o}=t,s=AC;if(a&&(s=o?new Ei(o).transformAsVector(a,[]):a),this.isGeospatial){let t=this.projectPosition([r,i,0]);this.center=new wQ(s).scale(this.distanceScales.unitsPerMeter).add(t)}else this.center=this.projectPosition(s)}_initMatrices(t){var r;let{viewMatrix:i=AS,projectionMatrix:n=null,orthographic:a=!1,fovyRadians:o,fovy:s=75,near:l=.1,far:u=1e3,padding:c=null,focalDistance:h=1}=t;this.viewMatrixUncentered=i,this.viewMatrix=new Ei().multiplyRight(i).translate(new wQ(this.center).negate()),this.projectionMatrix=n||function({width:t,height:r,orthographic:i,fovyRadians:n,focalDistance:a,padding:o,near:s,far:l}){let u=t/r,c=i?new Ei().orthographic({fovy:n,aspect:u,focalDistance:a,near:s,far:l}):new Ei().perspective({fovy:n,aspect:u,near:s,far:l});if(o){let{left:i=0,right:n=0,top:a=0,bottom:s=0}=o,l=wx((i+t-n)/2,0,t)-t/2,u=wx((a+r-s)/2,0,r)-r/2;c[8]-=2*l/t,c[9]+=2*u/r}return c}({width:this.width,height:this.height,orthographic:a,fovyRadians:o||s*AA,focalDistance:h,padding:c,near:l,far:u});let f=A_();bY.multiply(f,f,this.projectionMatrix),bY.multiply(f,f,this.viewMatrix),this.viewProjectionMatrix=f,this.viewMatrixInverse=bY.invert([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=[(r=this.viewMatrixInverse)[12],r[13],r[14]];let d=A_(),p=A_();bY.scale(d,d,[this.width/2,-this.height/2,1]),bY.translate(d,d,[1,-1,0]),bY.multiply(
2257p,d,this.viewProjectionMatrix),this.pixelProjectionMatrix=p,this.pixelUnprojectionMatrix=bY.invert(A_(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||xn.warn("Pixel project matrix not invertible")()}}AD.displayName="Viewport";let AP=AD;class AI{constructor(t,r){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=t=>{EJ("layerManager.activateViewport",this,t),t&&(this.context.viewport=t)};const{deck:i,stats:n,viewport:a,timeline:o}=r||{};this.layers=[],this.resourceManager=new Ay({device:t,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:t,gl:t?.gl,deck:i,shaderAssembler:function(t){let r=bt.ShaderAssembler.getDefaultShaderAssembler(t);for(let t of EU)r.addDefaultModule(t);for(let i of(r._hookFunctions.length=0,"glsl"===t?EV:E$))r.addShaderHook(i);return r}(t?.info?.shadingLanguage||"glsl"),defaultShaderModules:[bw],renderPass:void 0,stats:n||new E1.Stats({id:"deck.gl"}),viewport:a||new AP({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:o||new be,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){for(let t of(this.resourceManager.finalize(),this.layers))this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;for(let i of(t.clearRedrawFlags&&(this._needsRedraw=!1),this.layers)){let n=i.getNeedsRedraw(t);r=r||n}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(r=>t.find(t=>0===r.id.indexOf(t))):this.layers}setProps(t){"debug"in t&&(this._debug=t.debug),"userData"in t&&(this.context.userData=t.userData),"layers"in t&&(this._nextLayers=t.layers),"onError"in t&&(this.context.onError=t.onError)}setLayers(t,r){EJ("layerManager.setLayers",this,r,t),this._lastRenderedLayers=t;let i=E0(t,Boolean);for(let t of i)t.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){let t=this.needsUpdate();t&&(this.setNeedsRedraw(`updating layers: ${t}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}addDefaultShaderModule(t){let{defaultShaderModules:r}=this.context;r.find(r=>r.name===t.name)||(r.push(t),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(t){let{defaultShaderModules:r}=this.context,i=r.findIndex(r=>r.name===t.name);i>=0&&(r.splice(i,1),this._defaultShaderModulesChanged=!0)}_handleError(t,r,i){i.raiseError(r,`${t} of ${i}`)}_updateLayers(t,r){let i={};for(let r of t)i[r.id]?xn.warn(`Multiple old layers with same id ${r.id}`)():i[r.id]=r;if(this._defaultShaderModulesChanged){for(let r of t)r.setNeedsUpdate(),r.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}let n=[];this._updateSublayersRecursively(r,i,n),this._finalizeOldLayers(i);let a=!1;for(let t of n)if(t.hasUniformTransition()){a=`Uniform transition in ${t}`;break}this._needsUpdate=a,this.layers=n}_updateSublayersRecursively(t,r,i){for(let n of t){n.context=this.context;let t=r[n.id];null===t&&xn.warn(`Multiple new layers with same id ${n.id}`)(),r[n.id]=null;let a=null;try{this._debug&&t!==n&&n.validateProps(),t?(this._transferLayerState(t,n),this._updateLayer(n)):this._initializeLayer(n),i.push(n),a=n.isComposite?n.getSubLayers():null}catch(t){this._handleError("matching",t,n)}a&&this._updateSublayersRecursively(a,r,i)}}_finalizeOldLayers(t){for(let r in t){let i=t[r];i&&this._finalizeLayer(i)}}_initializeLayer(t){try{t._initialize(),t.lifecycle="Initialized"}catch(r){this._handleError("initialization",r,t)}}_transferLayerState(t,r){r._transferState(t),r.lifecycle="Matched. State transferred from previous layer",r!==t&&(t.lifecycle="Discarded. Awaiting garbage collection")}_updateLayer(t){try{t._update()}catch(r){this._handleError("update",r,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||`finalized ${t}`,t.lifecycle="No longer matched. Awaiting garbage collection";try{t._finalize(),t.lifecycle="Finalized! Awaiting garbage collection"}catch(r){this._handleError("finalization",r,t)}}}function Ak(t,r,i){if(t===r)return!0;
2257if(!i||!t||!r)return!1;if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!Ak(t[n],r[n],i-1))return!1;return!0}if(Array.isArray(r))return!1;if("object"==typeof t&&"object"==typeof r){let n=Object.keys(t),a=Object.keys(r);if(n.length!==a.length)return!1;for(let a of n)if(!r.hasOwnProperty(a)||!Ak(t[a],r[a],i-1))return!1;return!0}return!1}let AO="default-canvas";class AN{constructor(t){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=t.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=t.eventManager,this._eventManagers=t.eventManagers||{},this._viewEventManagers={},this._eventCallbacks={onViewStateChange:t.onViewStateChange,onInteractionStateChange:t.onInteractionStateChange},this._pickPosition=t.pickPosition,this._getCanvasContext=t.getCanvasContext,Object.seal(this),this.setProps(t)}finalize(){for(let t in this.controllers){let r=this.controllers[t];r&&r.finalize()}this.controllers={}}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}updateViewStates(){for(let t in this.controllers){let r=this.controllers[t];r&&r.updateTransition()}}getViewports(t){return t?this._viewports.filter(r=>{let i=!t.canvasId||this.getCanvasId(r.id)===t.canvasId,n=!("x"in t)||r.containsPixel(t);return i&&n}):this._viewports}getViews(){let t={};return this.views.forEach(r=>{t[r.id]=r}),t}getView(t){return this.views.find(r=>r.id===t)}getViewState(t){let r="string"==typeof t?this.getView(t):t,i=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(i):i}getViewport(t){return this._viewportMap[t]}getCanvasId(t){let r="string"==typeof t?this.getView(t):t;return r?this._viewEventManagers[r.id]?.canvasId||this._getCanvasIdFromView(r):void 0}unproject(t,r){let i=this.getViewports(),n={x:t[0],y:t[1]};for(let a=i.length-1;a>=0;--a){let o=i[a];if(o.containsPixel(n)){let i=t.slice();return i[0]-=o.x,i[1]-=o.y,o.unproject(i,r)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),("width"in t||"height"in t)&&this._setSize(t.width,t.height),"pickPosition"in t&&(this._pickPosition=t.pickPosition),"eventManagers"in t&&this._setEventManagers(t.eventManagers||{}),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,r){(t!==this.width||r!==this.height)&&(this.width=t,this.height=r,this.setNeedsUpdate("Size changed"))}_setViews(t){t=E0(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}_setViewState(t){t?(Ak(t,this.viewState,3)||this.setNeedsUpdate("viewState changed"),this.viewState=t):xn.warn("missing `viewState` or `initialViewState`")()}_setEventManagers(t){this._eventManagers!==t&&(this._eventManagers=t,this.setNeedsUpdate("eventManagers changed"))}_getCanvasIdFromView(t){return t.props.canvasId||this._getCanvasContext?.(t.id)?.id||AO}_getCanvasDimensions(t){let r=this._getCanvasContext?.(t.id),[i,n]=r?.getCSSSize()||[this.width,this.height];return{width:i,height:n}}_getViewEventManager(t){let r=this.getCanvasId(t)||AO;return{canvasId:r,eventManager:this._eventManagers[r]||this._eventManager}}_startViewportRebuild(){let t=this.controllers,r=this._viewEventManagers;return this._viewports=[],this.controllers={},this._viewEventManagers={},{oldControllers:t,oldViewEventManagers:r}}_getReusableController(t,r,i){return t&&(r?.canvasId!==i.canvasId||r?.eventManager!==i.eventManager)?(t.finalize(),null):t}_createController(t,r){return new r.type({timeline:this.timeline,eventManager:this._getViewEventManager(t).eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:r=>this.getView(t.id)?.makeViewport({viewState:r,...this._getCanvasDimensions(t)}),pickPosition:(r,i)=>this._pickPosition?.(r,i,t.id)})}_updateController(t,r,i,n){let a=t.controller;if(a&&i){let o={...r,...a,id:t.id,x:i.x,y:i.y,width:i.width,height:i.height};return n&&n.constructor===a.type||(n=this._createController(t,o)),n&&n.setProps(o),n}return null}_rebuildViewports(){let{views:t}=this,{oldControllers:r,oldViewEventManagers:i}=this._startViewportRebuild(),n=!1;for(let a=t.length;a--;){let o=t[a],{width:s,height:l}=this._getCanvasDimensions(o),u=this._getViewEventManager(o);this._viewEventManagers[o.id]=u;let c=this.getViewState(o),h=o.makeViewport({viewState:c,width:s,height:l}),f=this._getReusableController(r[o.id],i[o.id],u),d=!!o.controller;d&&!f&&(n=!0),(n||!d)&&f&&(f.finalize(),f=null),this.controllers[o.id]=this._updateController(o,c,h,f),h&&this._viewports.unshift(h)}for(let t in r){let i=r[t];i&&!this.controllers[t]&&i.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={}
2257,this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,r){return t.length!==r.length||t.some((i,n)=>!t[n].equals(r[n]))}}let AL=/^(?:\d+\.?\d*|\.\d+)$/;function AR(t){switch(typeof t){case"number":if(!Number.isFinite(t))throw Error(`Could not parse position string ${t}`);return{type:"literal",value:t};case"string":try{let r=function(t){let r=[],i=0;for(;i<t.length;){let n=t[i];if(/\s/.test(n)){i++;continue}if("+"===n||"-"===n||"("===n||")"===n||"%"===n){r.push({type:"symbol",value:n}),i++;continue}if(Az(n)||"."===n){let a=i,o="."===n;for(i++;i<t.length;){let r=t[i];if(Az(r)){i++;continue}if("."===r&&!o){o=!0,i++;continue}break}let s=t.slice(a,i);if(!AL.test(s))throw Error("Invalid number token");r.push({type:"number",value:parseFloat(s)});continue}if(Aj(n)){let n=i;for(;i<t.length&&Aj(t[i]);)i++;let a=t.slice(n,i).toLowerCase();r.push({type:"word",value:a});continue}throw Error("Invalid token in position string")}return r}(t);return new AB(r).parseExpression()}catch(i){let r=i instanceof Error?i.message:String(i);throw Error(`Could not parse position string ${t}: ${r}`)}default:throw Error(`Could not parse position string ${t}`)}}function AF(t,r){return function t(r,i){switch(r.type){case"literal":return r.value;case"percentage":return Math.round(r.value*i);case"binary":let n=t(r.left,i),a=t(r.right,i);return"+"===r.operator?n+a:n-a;default:throw Error("Unknown layout expression type")}}(t,r)}class AB{constructor(t){this.index=0,this.tokens=t}parseExpression(){let t=this.parseBinaryExpression();if(this.index<this.tokens.length)throw Error("Unexpected token at end of expression");return t}parseBinaryExpression(){var t;let r=this.parseFactor(),i=this.peek();for(;(t=i)&&"symbol"===t.type&&("+"===t.value||"-"===t.value);){this.index++;let t=this.parseFactor();r={type:"binary",operator:i.value,left:r,right:t},i=this.peek()}return r}parseFactor(){let t=this.peek();if(!t)throw Error("Unexpected end of expression");if("symbol"===t.type&&"+"===t.value)return this.index++,this.parseFactor();if("symbol"===t.type&&"-"===t.value)return this.index++,{type:"binary",operator:"-",left:{type:"literal",value:0},right:this.parseFactor()};if("symbol"===t.type&&"("===t.value){this.index++;let t=this.parseBinaryExpression();if(!this.consumeSymbol(")"))throw Error("Missing closing parenthesis");return t}if("word"===t.type&&"calc"===t.value){if(this.index++,!this.consumeSymbol("("))throw Error("Missing opening parenthesis after calc");let t=this.parseBinaryExpression();if(!this.consumeSymbol(")"))throw Error("Missing closing parenthesis");return t}if("number"===t.type){this.index++;let r=t.value,i=this.peek();return i&&"symbol"===i.type&&"%"===i.value?(this.index++,{type:"percentage",value:r/100}):(i&&"word"===i.type&&"px"===i.value&&this.index++,{type:"literal",value:r})}throw Error("Unexpected token in expression")}consumeSymbol(t){let r=this.peek();return!!r&&"symbol"===r.type&&r.value===t&&(this.index++,!0)}peek(){return this.tokens[this.index]||null}}function Az(t){return t>="0"&&t<="9"}function Aj(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}class AU{constructor(t){const{id:r,x:i=0,y:n=0,width:a="100%",height:o="100%",padding:s=null}=t;this.id=r||this.constructor.displayName||"view",this.props={...t,id:this.id},this._x=AR(i),this._y=AR(n),this._width=AR(a),this._height=AR(o),this._padding=s&&{left:AR(s.left||0),right:AR(s.right||0),top:AR(s.top||0),bottom:AR(s.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t||this.constructor===t.constructor&&Ak(this.props,t.props,2)}clone(t){return new this.constructor({...this.props,...t})}makeViewport({width:t,height:r,viewState:i}){i=this.filterViewState(i);let n=this.getDimensions({width:t,height:r});return n.height&&n.width?new(this.getViewportType(i))({...i,...this.props,...n}):null}getViewStateId(){let{viewState:t}=this.props;return"string"==typeof t?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&"object"==typeof this.props.viewState){if(!this.props.viewState.id)return this.props.viewState;var r=this.props.viewState;let i={...t};for(let t in r)"id"!==t&&(Array.isArray(i[t])&&Array.isArray(r[t])?i[t]=function(t,r){t=t.slice();for(let i=0;i<r.length;i++){let n=r[i];Number.isFinite(n)&&(t[i]=n)}return t}(i[t],r[t]):i[t]=r[t]);return i}return t}getDimensions({width:t,height:r}){let i={x:AF(this._x,t),y:AF(this._y,r),width:AF(this._width,t),height:AF(this._height,r)};return this._padding&&(i.padding={left:AF(this._padding.left,t),top:AF(this._padding.top,r),right:AF(this._padding.right,t),bottom:AF(this._padding.bottom,r)}),i}get controller(){let t=this.props.controller;return t?!0===t?{type:this.ControllerType}:"function"==typeof t?{type:t}:{type:this.ControllerType,...t}:null}}var El=El;let AV=Math.PI/180;function A$(t,r,i){let{pixelUnprojectionMatrix:n}=t,a=Ea(n,[r,0,1,1]),o=Ea(n,[r,t.height,1,1]),s=(i*t.distanceScales.unitsPerMeter[2]-a[2])/(o[2]-a[2]),l=Eg(El.lerp([],a,o,s));return l.push(i),l}var El=El;class AG extends AP{constructor(t={}){let r;const{latitude:i=0,longitude:n=0,zoom:a=0,pitch:o=0,bearing:s=0,nearZMultiplier:l=.1,farZMultiplier:u=1.01,nearZ:c,farZ:h,orthographic:f=!1,projectionMatrix:d,repeat:p=!1,worldOffset:m=0,position:g,padding:y,legacyMeterSizes:v=!1}=t;let{width:_,height:b,altitude:x=1.5}=t;const w=Math.pow(2,a);_=_||1,b=b||1;let E=null;if(d)r=Eb(x=d[5]/2);else{let n;if(t.fovy?x=Ex(r=t.fovy):r=Eb(x),y){const{top:t=0,bottom:r=0}=y;n=[0,wx((t+b-r)/2,0,b)-b/2]}E=function(t){let{width:r,height:i,altitude:n,pitch:a=0,offset:o,center:s,scale:l,nearZMultiplier:u=1,farZMultiplier:c=1}=t,{fovy:h=Eb(1.5)}=t;void 0!==n&&(h=Eb(n));let f=h*Ed,d=a*Ed,p=Ex(h),m=p;s&&(m+=s[2]*l/Math.cos(d)/i);let g=f*(.5+(o?o[1]:0)/i),y=Math.sin(g)*m/Math.sin(Eo(Math.PI/2-d-g,.01,Math.PI-.01));return{fov:f,aspect:r/i,focalDistance:p,near:u,far:Math.min((Math.sin(d)*y+m)*c,10*m)}}({width:_,height:b,scale:w,center:g&&[0,0,g[2]*Ey(i)],offset:n,pitch:o,fovy:r,nearZMultiplier:l,farZMultiplier:u}),Number.isFinite(c)&&(E.near=c),Number.isFinite(h)&&(E.far=h)}let T=function(t){let{height:r,pitch:i,bearing:n,altitude:a,scale:o,center:s}=t,l=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];bY.translate(l,l,[0,0,-a]),bY.rotateX(l,l,-i*Ed),bY.rotateZ(l,l,n*Ed);let u=o/r;return bY.scale(l,l,[u,u,u]),s&&bY.translate(l,l,Eu.negate([],s)),l}({height:b,pitch:o,bearing:s,scale:w,altitude:x});m&&(T=new Ei().translate([512*m,0,0]).multiplyLeft(T)),super({...t,width:_,height:b,viewMatrix:T,longitude:n,latitude:i,zoom:a,...E,fovy:r,focalDistance:x}),this.latitude=i,this.longitude=n,this.zoom=a,this.pitch=o,this.bearing=s,this.altitude=x,this.fovy=r,this.orthographic=f,this._subViewports=p?[]:null,this._pseudoMeters=v,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){let t=this.getBounds(),r=Math.floor((t[0]+180)/360),i=Math.ceil((t[2]-180)/360);for(let t=r;t<=i;t++){let r=t?new AG({...this,worldOffset:t}):this;this._subViewports.push(r)}}return this._subViewports}equals(t){return t instanceof AG&&t._pseudoMeters===this._pseudoMeters&&super.equals(t)}projectPosition(t){if(this._pseudoMeters)return super.projectPosition(t);let[r,i]=this.projectFlat(t);return[r,i,(t[2]||0)*Ey(t[1])]}unprojectPosition(t){if(this._pseudoMeters)return super.unprojectPosition(t);let[r,i]=this.unprojectFlat(t),n=(t[2]||0)/Ey(i);return[r,i,n]}addMetersToLngLat(t,r){return E_(t,r)}panByPosition(t,r,i){let n=EE(r,this.pixelUnprojectionMatrix),a=this.projectFlat(t),o=El.add([],a,El.negate([],n)),s=El.add([],this.center,o),[l,u]=this.unprojectFlat(s);return{longitude:l,latitude:u}}panByPosition3D(t,r){let i=t[2]||0,n=El.sub([],t,this.unproject(r,{targetZ:i}));return{longitude:this.longitude+n[0],latitude:this.latitude+n[1]}}getBounds(t={}){let r=function(t,r=0){let i,n,{width:a,height:o,unproject:s}=t,l={targetZ:r},u=s([0,o],l),c=s([a,o],l);return(t.fovy?.5*t.fovy*AV:Math.atan(.5/t.altitude))>(90-t.pitch)*AV-.01?(i=A$(t,0,r),n=A$(t,a,r)):(i=s([0,0],l),n=s([a,0],l)),[u,c,n,i]}(this,t.z||0);return[Math.min(r[0][0],r[1][0],r[2][0],r[3][0]),Math.min(r[0][1],r[1][1],r[2][1],r[3][1]),Math.max(r[0][0],r[1][0],r[2][0],r[3][0]),Math.max(r[0][1],r[1][1],r[2][1],r[3][1])]}fitBounds(t,r={}){let{width:i,height:n}=this,{longitude:a,latitude:o,zoom:s}=function(t){let{width:r,height:i,bounds:n,minExtent:a=0,maxZoom:
2257o=24,offset:s=[0,0]}=t,[[l,u],[c,h]]=n,f=function(t=0){return"number"==typeof t?{top:t,bottom:t,left:t,right:t}:(Ec(Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)),t)}(t.padding),d=Em([l,Eo(h,-85.051129,85.051129)]),p=Em([c,Eo(u,-85.051129,85.051129)]),m=[Math.max(Math.abs(p[0]-d[0]),a),Math.max(Math.abs(p[1]-d[1]),a)],g=[r-f.left-f.right-2*Math.abs(s[0]),i-f.top-f.bottom-2*Math.abs(s[1])];Ec(g[0]>0&&g[1]>0);let y=g[0]/m[0],v=g[1]/m[1],_=(f.right-f.left)/2/y,b=(f.top-f.bottom)/2/v,x=Eg([(p[0]+d[0])/2+_,(p[1]+d[1])/2+b]),w=Math.min(o,Es(Math.abs(Math.min(y,v))));return Ec(Number.isFinite(w)),{longitude:x[0],latitude:x[1],zoom:w}}({width:i,height:n,bounds:t,...r});return new AG({width:i,height:n,longitude:a,latitude:o,zoom:s})}}AG.displayName="WebMercatorViewport";class Aq{constructor(t){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=t}get inProgress(){return this._inProgress}start(t){this.cancel(),this.settings=t,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(null===this._handle){let{_timeline:t,settings:r}=this;this._handle=t.addChannel({delay:t.getTime(),duration:r.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}let AH=()=>{},AW={mode:"preserve"},AZ={mode:"hard"},AY=t=>t;class AX{constructor(t){this._onTransitionUpdate=t=>{let{time:r,settings:{interpolator:i,startProps:n,endProps:a,duration:o,easing:s}}=t,l=s(r/o),u=i.interpolateProps(n,a,l);this.propsInTransition=this.getControllerState({...this.props,...u},AW).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new Aq(t.timeline),this.onViewStateChange=t.onViewStateChange||AH,this.onStateChange=t.onStateChange||AH}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let r=!1,i=this.props;if(this.props=t,!i||this._shouldIgnoreViewportChange(i,t))return!1;if(this._isTransitionEnabled(t)){let n=i;if(this.transition.inProgress){let{interruption:t,endProps:r}=this.transition.settings;n={...i,...2===t?r:this.propsInTransition||i}}this._triggerTransition(n,t),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(t){let{transitionDuration:r,transitionInterpolator:i}=t;return(r>0||"auto"===r)&&!!i}_isUpdateDueToCurrentTransition(t){return!!this.transition.inProgress&&!!this.propsInTransition&&this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition)}_shouldIgnoreViewportChange(t,r){return this.transition.inProgress?3===this.transition.settings.interruption||this._isUpdateDueToCurrentTransition(r):!this._isTransitionEnabled(r)||r.transitionInterpolator.arePropsEqual(t,r)}_triggerTransition(t,r){let i=this.getControllerState(t,AW),n=this.getControllerState(r,AZ).shortestPathFrom(i),a=r.transitionInterpolator,o=a.getDuration?a.getDuration(t,r):r.transitionDuration;if(0===o)return;let s=a.initializeProps(t,n);this.propsInTransition={};let l={duration:o,easing:r.transitionEasing||AY,interpolator:a,interruption:r.transitionInterruption||1,startProps:s.start,endProps:s.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(l),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(r)}}}function AK(t,r){if(!t)throw Error(r||"deck.gl: assertion failed.")}class AQ{constructor(t){const{compare:r,extract:i,required:n}=t;this._propsToCompare=r,this._propsToExtract=i||r,this._requiredProps=n}arePropsEqual(t,r){for(let i of this._propsToCompare)if(!(i in t)||!(i in r)||!wE(t[i],r[i]))return!1;return!0}initializeProps(t,r){let i={},n={};for(let a of this._propsToExtract)(a in t||a in r)&&(i[a]=t[a],n[a]=r[a]);return this._checkRequiredProps(i),this._checkRequiredProps(n),{start:i,end:n}}getDuration(t,r){return r.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(r=>{let i=t[r];AK(Number.isFinite(i)||Array.isArray(i),`${r} is required for transition`)})}}let AJ=["longitude","latitude","zoom","bearing","pitch"],A0=["longitude","latitude","zoom"];class A1 extends AQ{constructor(t={}){const r=Array.isArray(t)?t:t.transitionProps,i=Array.isArray(t)?{}:t;i.transitionProps=Array.isArray(r)?{compare:r,required:r}
2257:r||{compare:AJ,required:A0},super(i.transitionProps),this.opts=i}initializeProps(t,r){let i=super.initializeProps(t,r),{makeViewport:n,around:a}=this.opts;if(n&&a){let o=n(t),s=n(r),l=o.unproject(a);i.start.around=a,Object.assign(i.end,{around:s.project(l),aroundPosition:l,width:r.width,height:r.height})}return i}interpolateProps(t,r,i){let n={};for(let a of this._propsToExtract)n[a]=ww(t[a]||0,r[a]||0,i);if(r.aroundPosition&&this.opts.makeViewport){let a=this.opts.makeViewport({...r,...n});Object.assign(n,a.panByPosition(r.aroundPosition,ww(t.around,r.around,i)))}return n}}let A2={transitionDuration:0},A3=t=>1-(1-t)*(1-t),A4=t=>1===t?1:1-Math.pow(2,-10*t),A6=["wheel"],A5=["panstart","panmove","panend"],A8=["pinchstart","pinchmove","pinchend"],A7=["multipanstart","multipanmove","multipanend"],A9=["dblclick"],Se=["dblclickdragstart","dblclickdragmove","dblclickdragend","dblclickdragcancel"],St=["keydown"],Sr={};class Si{constructor(t){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this._multiPanMode=null,this._multiPanStartCenter=null,this._doubleClickDragAnchor=null,this._suppressDoubleClickUntil=0,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.doubleClickDragZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.multiTouchDrag=null,this.trackpadGesture=!1,this.zoomAround="pointer",this.keyboard=!0,this.transitionManager=new AX({...t,getControllerState:(r,i)=>new this.ControllerState({...r,constraintContext:i,makeViewport:t.makeViewport}),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport,this.pickPosition=t.pickPosition}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(let t in this._events)this._events[t]&&this.eventManager?.off(t,this.handleEvent);this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;let r=this._eventStartBlocked;switch(t.type){case"panstart":return!r&&this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return!r&&!!this._isTrackpadGestureAllowed(t)&&this._onPinchStart(t);case"pinchmove":return!!this._isTrackpadGestureAllowed(t)&&this._onPinch(t);case"pinchend":return!!this._isTrackpadGestureAllowed(t)&&this._onPinchEnd(t);case"multipanstart":return!r&&this._onMultiPanStart(t);case"multipanmove":return this._onMultiPan(t);case"multipanend":return this._onMultiPanEnd(t);case"dblclick":return this._onDoubleClick(t);case"dblclickdragstart":return!r&&this._onDoubleClickDragStart(t);case"dblclickdragmove":return this._onDoubleClickDrag(t);case"dblclickdragend":case"dblclickdragcancel":return this._onDoubleClickDragEnd(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){let{x:r,y:i}=this.props,{offsetCenter:n}=t;return[n.x-r,n.y-i]}getZoomPosition(t){if("pointer"===this.zoomAround)return t;let r=this.makeViewport(this.controllerState.getViewportProps()),[i,n]=Ew(r.center,r.pixelProjectionMatrix);return[i,n]}isPointInBounds(t,r){let{width:i,height:n}=this.props;if(r&&r.handled)return!1;let a=t[0]>=0&&t[0]<=i&&t[1]>=0&&t[1]<=n;return a&&r&&r.stopPropagation(),a}isFunctionKeyPressed(t){let{srcEvent:r}=t;return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=r}setProps(t){void 0===t.maxBoundsPadding&&(t.maxBoundsPadding=null),t.dragMode&&(this.dragMode=t.dragMode);let r=this.props;this.props=t,"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);let{inertia:i}=t;this.inertia=Number.isFinite(i)?i:300*(!0===i);let{scrollZoom:n=!0,dragPan:a=!0,dragRotate:o=!0,doubleClickZoom:s=!0,doubleClickDragZoom:l=!1,touchZoom:u=!0,touchRotate:c=!1,multiTouchDrag:h=c?"rotate":null,trackpadGesture:f=!1,zoomAround:d="pointer",keyboard:p=!0}=t,m=!!this.onViewStateChange;if(this.toggleEvents(A6,m&&n),this.toggleEvents(A5,m),this.toggleEvents(A8,m&&(u||"rotate"===h)),this.toggleEvents(A7,m&&!!h),this.toggleEvents(A9,m&&s),this.toggleEvents(Se,m&&l),this.toggleEvents(St,m&&p),this.scrollZoom=n,this.dragPan=a,this.dragRotate=o,this.doubleClickZoom=s,this.doubleClickDragZoom=l,this.touchZoom=u,this.touchRotate="rotate"===h,this.multiTouchDrag=h,this.trackpadGesture=f,this.zoomAround=d,this.keyboard=p,(!r||r.height!==t.height||r.width!==t.width||r.maxBounds!==t.maxBounds||r.maxBoundsPadding!==t.maxBoundsPadding)&&t.maxBounds){let r=new this.ControllerState({...t,makeViewport:this.makeViewport}),i=r.getViewportProps();Object.keys(i).some(r=>!Ak(i[r],t[r],1))&&this.updateViewport(r)}}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,r){this.eventManager&&t.forEach(t=>{this._events[t]!==r&&(this._events[t]=r,r?this.eventManager.on(t,this.handleEvent):this.eventManager.off(t,this.handleEvent))})}updateViewport(t,r=null,i={}){let n={...t.getViewportProps(),...r},a=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(i),a){let t=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:n,interactionState:this._interactionState,oldViewState:t,viewId:this.props.id})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_getConstraintContext(t,r){return this.props.rubberBand?{mode:"update"===r?"elastic":"end"===r?"rebound":"hard"}:{mode:"hard"}}
2257_getReboundTransition(t,r){if("rebound"!==t.mode)return null;let i=r.getViewportProps();return Object.keys(i).some(t=>!Ak(this.props[t],i[t],1))?{...this._getTransitionProps(),transitionDuration:300,transitionEasing:A4}:null}_onPanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||"pan"===this.dragMode)&&(i=!i);let n=i?"pan":"rotate",a=this._getConstraintContext(n,"start"),o=i?this.controllerState.panStart({pos:r},a):this.controllerState.rotateStart({pos:r},a);return this._panMove=i,this.updateViewport(o,A2,{isDragging:!0}),!0}_onPan(t){return!!this.isDragging()&&(this._panMove?this._onPanMove(t):this._onPanRotate(t))}_onPanEnd(t){return!!this.isDragging()&&(this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t))}_onPanMove(t){if(!this.dragPan)return!1;let r=this.getCenter(t),i=this.controllerState.pan({pos:r},this._getConstraintContext("pan","update"));return this.updateViewport(i,A2,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){let{inertia:r}=this;if(this.dragPan&&r&&t.velocity){let i=this.getCenter(t),n=[i[0]+t.velocityX*r/2,i[1]+t.velocityY*r/2],a=this.controllerState.pan({pos:n}).panEnd();this.updateViewport(a,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:A3},{isDragging:!1,isPanning:!0})}else{let t=this.controllerState,r=this._getConstraintContext("pan","end"),i=t.panEnd(r),n=this._getReboundTransition(r,i);this.updateViewport(i,n,{isDragging:!1,isPanning:!!n})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;let r=this.getCenter(t),i=this.controllerState.rotate({pos:r},this._getConstraintContext("rotate","update"));return this.updateViewport(i,A2,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){let{inertia:r}=this;if(this.dragRotate&&r&&t.velocity){let i=this.getCenter(t),n=[i[0]+t.velocityX*r/2,i[1]+t.velocityY*r/2],a=this.controllerState.rotate({pos:n}).rotateEnd();this.updateViewport(a,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:A3},{isDragging:!1,isRotating:!0})}else{let t=this.controllerState,r=this._getConstraintContext("rotate","end"),i=t.rotateEnd(r),n=this._getReboundTransition(r,i);this.updateViewport(i,n,{isDragging:!1,isRotating:!!n})}return!0}_onWheel(t){if(!this.scrollZoom||this.trackpadGesture&&"mouse"!==t.device)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;t.srcEvent.preventDefault();let{speed:i=.01,smooth:n=!1}=!0===this.scrollZoom?{}:this.scrollZoom,{delta:a}=t,o=2/(1+Math.exp(-Math.abs(a*i)));a<0&&0!==o&&(o=1/o);let s=this.getZoomPosition(r),l=n?{...this._getTransitionProps({around:s}),transitionDuration:250}:A2,u=this.controllerState.zoom({pos:s,scale:o});return this.updateViewport(u,l,{isZooming:!0,isPanning:!0}),n||this._setInteractionState({isZooming:!1,isPanning:!1}),!0}_onMultiPanStart(t){let{multiTouchDrag:r}=this;if(!r||!this._isMultiPanEventAllowed(t,r))return!1;let i=t.offsetCenter;if(!this.isPointInBounds(this.getCenter(t),t))return!1;let n="trackpad"===t.pointerType,a={x:i.x-(n?0:t.deltaX),y:i.y-(n?0:t.deltaY)},o={...t,offsetCenter:a},s=this.getCenter(o),l="pan"===r?this.controllerState.panStart({pos:s},this._getConstraintContext("pan","start")):this.controllerState.rotateStart({pos:s},this._getConstraintContext("rotate","start"));return this._multiPanMode=r,this._multiPanStartCenter=a,this.updateViewport(l,A2,{isDragging:!0}),!0}_onMultiPan(t){let{mode:r,event:i}=this._getMultiPanEvent(t);return!!r&&!!i&&!!this.isDragging()&&("pan"===r?this._onPanMove(i):this._onPanRotate(i))}_onMultiPanEnd(t){let{mode:r,event:i}=this._getMultiPanEvent(t);if(!r||!i||!this.isDragging())return this._resetMultiPan(),!1;let n="pan"===r?this._onPanMoveEnd(i):this._onPanRotateEnd(i);return this._resetMultiPan(),n}_isTrackpadGestureAllowed(t){return"trackpad"!==t.pointerType||this.trackpadGesture}_isMultiPanEventAllowed(t,r){return"trackpad"===t.pointerType?this.trackpadGesture&&("pan"===r?this.dragPan:this.dragRotate):"touch"===t.pointerType&&("pan"===r?this.dragPan:this.dragRotate)}_getMultiPanEvent(t){let r=this._multiPanMode,i=this._multiPanStartCenter;return r&&i?{mode:r,event:{...t,offsetCenter:{x:i.x+t.deltaX,y:i.y+t.deltaY}}}:{mode:null,event:null}}_resetMultiPan(){this._multiPanMode=null,this._multiPanStartCenter=null}_onPinchStart(t){this._doubleClickDragAnchor=null;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.controllerState.zoomStart({pos:this.getZoomPosition(r)},this._getConstraintContext("zoom","start")).rotateStart({pos:r},this._getConstraintContext("rotate","start"));return Sr._startPinchRotation=t.rotation,Sr._lastPinchEvent=t,this.updateViewport(i,A2,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:i}=t,n=this.getCenter(t);r=r.zoom({pos:this.getZoomPosition(n),scale:i},this._getConstraintContext("zoom","update"))}if(this.touchRotate){let{rotation:i}=t;r=r.rotate({deltaAngleX:Sr._startPinchRotation-i},this._getConstraintContext("rotate","update"))}return this.updateViewport(r,A2,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),Sr._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:i}=Sr;if(this.touchZoom&&r&&i&&t.scale!==i.scale){let n=this.getCenter(t),a=this.getZoomPosition(n),o=this.controllerState.rotateEnd(),s=Math.log2(t.scale),l=(s-Math.log2(i.scale))/(t.deltaTime-i.deltaTime),u=Math.pow(2,s+l*r/2);o=o.zoom({pos:a,scale:u}).zoomEnd(),this.updateViewport(o,{...this._getTransitionProps({around:a}),transitionDuration:r,transitionEasing:A3},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let t=this.controllerState,r=this._getConstraintContext("zoom","end"),i=this._getConstraintContext("rotate","end"),n=t.zoomEnd(r).rotateEnd(i),a=this._getReboun
2257dTransition(this.touchZoom?r:i,n);this.updateViewport(n,a,{isDragging:!1,isPanning:!!a&&this.touchZoom,isZooming:!!a&&this.touchZoom,isRotating:!!a&&this.touchRotate})}return Sr._startPinchRotation=null,Sr._lastPinchEvent=null,!0}_onDoubleClick(t){if(!this.doubleClickZoom||Date.now()<this._suppressDoubleClickUntil)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let i=this.isFunctionKeyPressed(t),n=this.getZoomPosition(r),a=this.controllerState.zoom({pos:n,scale:i?.5:2});return this.updateViewport(a,this._getTransitionProps({around:n}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onDoubleClickDragStart(t){if(!this.doubleClickDragZoom)return this._doubleClickDragAnchor=null,!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return this._doubleClickDragAnchor=null,!1;this._doubleClickDragAnchor=this.getZoomPosition(r);let i=this.controllerState.zoomStart({pos:this._doubleClickDragAnchor},this._getConstraintContext("zoom","start"));return 1!==t.scale&&(i=i.zoom({pos:this._doubleClickDragAnchor,scale:t.scale},this._getConstraintContext("zoom","update"))),this.updateViewport(i,A2,{isDragging:!0,isPanning:!0,isZooming:!0}),!0}_onDoubleClickDrag(t){let r=this._doubleClickDragAnchor;if(!r)return!1;let i=this.controllerState.zoom({pos:r,scale:t.scale},this._getConstraintContext("zoom","update"));return this.updateViewport(i,A2,{isDragging:!0,isPanning:!0,isZooming:!0}),!0}_onDoubleClickDragEnd(t){if(!this._doubleClickDragAnchor)return!1;this._doubleClickDragAnchor=null;let r=this.controllerState,i=this._getConstraintContext("zoom","end"),n=r.zoomEnd(i),a=this._getReboundTransition(i,n);return this.updateViewport(n,a,{isDragging:!1,isPanning:!!a,isZooming:!!a}),this._suppressDoubleClickUntil=Date.now()+100,this.blockEvents(100),!0}_onKeyDown(t){let r;if(!this.keyboard)return!1;let i=this.isFunctionKeyPressed(t),{zoomSpeed:n,moveSpeed:a,rotateSpeedX:o,rotateSpeedY:s}=!0===this.keyboard?{}:this.keyboard,{controllerState:l}=this,u={};switch(t.srcEvent.code){case"Minus":r=i?l.zoomOut(n).zoomOut(n):l.zoomOut(n),u.isZooming=!0;break;case"Equal":r=i?l.zoomIn(n).zoomIn(n):l.zoomIn(n),u.isZooming=!0;break;case"ArrowLeft":i?(r=l.rotateLeft(o),u.isRotating=!0):(r=l.moveLeft(a),u.isPanning=!0);break;case"ArrowRight":i?(r=l.rotateRight(o),u.isRotating=!0):(r=l.moveRight(a),u.isPanning=!0);break;case"ArrowUp":i?(r=l.rotateUp(s),u.isRotating=!0):(r=l.moveUp(a),u.isPanning=!0);break;case"ArrowDown":i?(r=l.rotateDown(s),u.isRotating=!0):(r=l.moveDown(a),u.isPanning=!0);break;default:return!1}return this.updateViewport(r,this._getTransitionProps(),u),!0}_getTransitionProps(t){let{transition:r}=this;return r&&r.transitionInterpolator?t?{...r,transitionInterpolator:new A1({...t,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r:A2}}let Sn=Symbol("constraintAround");class Sa{constructor(t,r,i,n){this.makeViewport=i,this._viewportProps=this.applyConstraints(t,n),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}}function So(t,r,i){let n=t-r;return n&&Number.isFinite(n)?r+n*i/(i+Math.abs(n)):r}function Ss(t,r,i){let n=AF(AR(i?.left??0),t),a=AF(AR(i?.right??0),t),o=AF(AR(i?.top??0),r),s=AF(AR(i?.bottom??0),r);return{x:n,y:o,width:t-n-a,height:r-o-s}}function Sl(t,r,i){let[n,a]=t.project(r);return n=Number.isFinite(n)?n:t.width/2,a=Number.isFinite(a)?a:t.height/2,{left:n-i.x,right:i.x+i.width-n,top:a-i.y,bottom:i.y+i.height-a}}let Su=[[-1/0,-90],[1/0,90]];function Sc([t,r]){if(Math.abs(r)>90&&(r=90*Math.sign(r)),Number.isFinite(t)){let[i,n]=Em([t,r]);return[i,wx(n,0,512)]}let[,i]=Em([0,r]);return[t,wx(i,0,512)]}class Sh extends Sa{constructor(t){const{width:r,height:i,latitude:n,longitude:a,zoom:o,bearing:s=0,pitch:l=0,altitude:u=1.5,position:c=[0,0,0],maxZoom:h=20,minZoom:f=0,maxPitch:d=60,minPitch:p=0,startPanLngLat:m,startZoomLngLat:g,startRotatePos:y,startRotateLngLat:v,startBearing:_,startPitch:b,startZoom:x,normalize:w=!0,rubberBand:E=!1}=t,{[Sn]:T}=t;AK(Number.isFinite(a)),AK(Number.isFinite(n)),AK(Number.isFinite(o));const A=t.maxBounds||(w?Su:null);super({width:r,height:i,latitude:n,longitude:a,zoom:o,bearing:s,pitch:l,altitude:u,maxZoom:h,minZoom:f,maxPitch:d,minPitch:p,normalize:w,position:c,maxBounds:A,maxBoundsPadding:t.maxBoundsPadding||null,rubberBand:E,...{[Sn]:T}},{startPanLngLat:m,startZoomLngLat:g,startRotatePos:y,startRotateLngLat:v,startBearing:_,startPitch:b,startZoom:x},t.makeViewport,t.constraintContext),this.getAltitude=t.getAltitude}panStart({pos:t}
2257,r){return this._getUpdatedState({startPanLngLat:this._unproject(t)},r)}pan({pos:t,startPos:r},i){let n=this.getState().startPanLngLat||this._unproject(r);if(!n)return this;let a=this.makeViewport(this.getViewportProps()).panByPosition(n,t);return this._getUpdatedState(a,i)}panEnd(t){return this._getUpdatedState({startPanLngLat:null},t)}rotateStart({pos:t}){let r=this.getAltitude?.(t);return this._getUpdatedState({startRotatePos:t,startRotateLngLat:void 0!==r?this._unproject3D(t,r):void 0,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:r=0,deltaAngleY:i=0}){let n,{startRotatePos:a,startRotateLngLat:o,startBearing:s,startPitch:l}=this.getState();if(!a||void 0===s||void 0===l)return this;if(n=t?this._getNewRotation(t,a,l,s):{bearing:s+r,pitch:l+i},o){let t=this.makeViewport({...this.getViewportProps(),...n}),r="panByPosition3D"in t?"panByPosition3D":"panByPosition";return this._getUpdatedState({...n,...t[r](o,a)})}return this._getUpdatedState(n)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startRotateLngLat:null,startBearing:null,startPitch:null})}zoomStart({pos:t},r){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom},r)}zoom({pos:t,startPos:r,scale:i},n){let{startZoom:a,startZoomLngLat:o}=this.getState();return(o||(a=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(t)),o)?this._getUpdatedState({zoom:a+Math.log2(i),[Sn]:{position:o,screenPosition:t}},n):this}zoomEnd(t){return this._getUpdatedState({startZoomLngLat:null,startZoom:null},t)}zoomIn(t=2,r){return this._zoomFromCenter(t,r)}zoomOut(t=2,r){return this._zoomFromCenter(1/t,r)}moveLeft(t=100,r){return this._panFromCenter([t,0],r)}moveRight(t=100,r){return this._panFromCenter([-t,0],r)}moveUp(t=100,r){return this._panFromCenter([0,t],r)}moveDown(t=100,r){return this._panFromCenter([0,-t],r)}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){let r=t.getViewportProps(),i={...this.getViewportProps()},{bearing:n,longitude:a}=i;return Math.abs(n-r.bearing)>180&&(i.bearing=n<0?n+360:n-360),Math.abs(a-r.longitude)>180&&(i.longitude=a<0?a+360:a-360),i}applyConstraints(t,r){let i=t[Sn];delete t[Sn];let{maxPitch:n,minPitch:a,pitch:o,bearing:s,normalize:l,maxBounds:u,rubberBand:c}=t;l&&(s<-180||s>180)&&(t.bearing=Ab(s+180,360)-180),t.pitch=wx(o,a,n);let h=this._constrainZoom(t.zoom,t),f=c&&r?.mode==="elastic";if(t.zoom=r?.mode==="preserve"?t.zoom:f?So(t.zoom,h,1):h,i){let r=this.makeViewport(t);Object.assign(t,r.panByPosition(i.position,i.screenPosition))}if(l&&(t.longitude<-180||t.longitude>180)&&(t.longitude=Ab(t.longitude+180,360)-180),u){let i=Ss(t.width,t.height,t.maxBoundsPadding),n=Sl(this.makeViewport({...t,bearing:0,pitch:0}),[t.longitude,t.latitude],i),a=Sc(u[0]),o=Sc(u[1]),s=2**t.zoom,l=[a[0]+n.left/s,a[1]+n.bottom/s],c=[o[0]-n.right/s,o[1]-n.top/s],h=Sc([t.longitude,t.latitude]),d=[wx(h[0],l[0],c[0]),wx(h[1],l[1],c[1])],p=h.slice();if(i.width>=0&&(p[0]=r?.mode==="preserve"?h[0]:f?So(h[0],d[0],i.width/2/s):d[0]),i.height>=0&&(p[1]=r?.mode==="preserve"?h[1]:f?So(h[1],d[1],i.height/2/s):d[1]),p[0]!==h[0]||p[1]!==h[1]){let[r,i]=Eg(p);p[0]!==h[0]&&(t.longitude=r),p[1]!==h[1]&&(t.latitude=i)}}return t}_constrainZoom(t,r){r||(r=this.getViewportProps());let{maxZoom:i,maxBounds:n}=r,a=null!==n&&r.width>0&&r.height>0,{minZoom:o}=r;if(a){let t=Ss(r.width,r.height,r.maxBoundsPadding),a=Sc(n[0]),s=Sc(n[1]),l=s[0]-a[0],u=s[1]-a[1];t.width>0&&Number.isFinite(l)&&l>0&&(o=Math.max(o,Math.log2(t.width/l))),t.height>0&&Number.isFinite(u)&&u>0&&(o=Math.max(o,Math.log2(t.height/u))),o>i&&(o=i)}return wx(t,o,i)}_zoomFromCenter(t,r){let{width:i,height:n}=this.getViewportProps();return this.zoom({pos:[i/2,n/2],scale:t},r)}_panFromCenter(t,r){let{width:i,height:n}=this.getViewportProps();return this.pan({startPos:[i/2,n/2],pos:[i/2+t[0],n/2+t[1]]},r)}_getUpdatedState(t,r){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.get
2257State(),...t,constraintContext:r})}_unproject(t){let r=this.makeViewport(this.getViewportProps());return t&&r.unproject(t)}_unproject3D(t,r){return this.makeViewport(this.getViewportProps()).unproject(t,{targetZ:r})}_getNewRotation(t,r,i,n){let a=t[0]-r[0],o=t[1]-r[1],s=t[1],l=r[1],{width:u,height:c}=this.getViewportProps(),h=0;o>0?Math.abs(c-l)>5&&(h=o/(l-c)*1.2):o<0&&l>5&&(h=1-s/l),h=wx(h,-1,1);let{minPitch:f,maxPitch:d}=this.getViewportProps(),p=i;return h>0?p=i+h*(d-i):h<0&&(p=i-h*(f-i)),{pitch:p,bearing:n+a/u*180}}}class Sf extends Si{constructor(){super(...arguments),this.ControllerState=Sh,this.transition={transitionDuration:300,transitionInterpolator:new A1({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan",this.rotationPivot="center",this._getAltitude=t=>{if("2d"===this.rotationPivot)return 0;if("3d"===this.rotationPivot&&this.pickPosition){let{x:r,y:i}=this.props,n=this.pickPosition(r+t[0],i+t[1]);if(n&&n.coordinate&&n.coordinate.length>=3)return n.coordinate[2]}}}setProps(t){"rotationPivot"in t&&(this.rotationPivot=t.rotationPivot||"center"),t.getAltitude=this._getAltitude,t.position=t.position||[0,0,0],t.maxBounds=t.maxBounds||(!1===t.normalize?null:Su),super.setProps(t)}updateViewport(t,r=null,i={}){let n=t.getState();i.isDragging&&n.startRotateLngLat?i={...i,rotationPivotPosition:n.startRotateLngLat}:!1===i.isDragging&&(i={...i,rotationPivotPosition:void 0}),super.updateViewport(t,r,i)}}class Sd extends AU{constructor(t={}){super(t)}getViewportType(){return AG}get ControllerType(){return Sf}}Sd.displayName="MapView";let Sp=[255,255,255],Sm=0;class Sg{constructor(t={}){this.type="ambient";const{color:r=Sp}=t,{intensity:i=1}=t;this.id=t.id||`ambient-${Sm++}`,this.color=r,this.intensity=i}}let Sy=[255,255,255],Sv=[0,0,-1],S_=0;class Sb{constructor(t={}){this.type="directional";const{color:r=Sy}=t,{intensity:i=1}=t,{direction:n=Sv}=t,{_shadow:a=!1}=t;this.id=t.id||`directional-${S_++}`,this.color=r,this.intensity=i,this.type="directional",this.direction=new wQ(n).normalize().toArray(),this.shadow=a}getProjectedLight(t){return this}}class Sx{constructor(t,r={id:"pass"}){const{id:i}=r;this.id=i,this.device=t,this.props={...r}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}}let Sw={depthWriteEnabled:!0,depthCompare:"less-equal",blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one-minus-src-alpha",blendAlphaOperation:"add",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha"};class SE extends Sx{constructor(){super(...arguments),this._lastRenderIndex=-1}render(t){this._render(t)}_render(t){let{canvasContext:r=this.device.canvasContext}=t,i=t.target??r.getCurrentFramebuffer(),[n,a]=r.getDrawingBufferSize(),o=t.clearCanvas??!0,s=t.clearColor??(!!o&&[0,0,0,0]),l=!!o&&1,u=!!o&&0,c=t.colorMask??15,h={viewport:[0,0,n,a]};t.colorMask&&(h.colorMask=c),t.scissorRect&&(h.scissorRect=t.scissorRect);let{shaderModuleProps:f,viewports:d,views:p,onViewportActive:m,clearStack:g=!0}=t,y=t.pass||"unknown",v="webgpu"===this.device.type;g&&(this._lastRenderIndex=-1);let _=[];if(!d.length)return this.device.beginRenderPass({framebuffer:i,parameters:h,clearColor:s,clearDepth:l,clearStencil:u}).end(),this.device.submit(),_;try{for(let n of d){m?.(n);let a=this._getDrawLayerParams(n,t),o=p&&p[n.id],c=n.subViewports||[n];for(let n of v?c.map(t=>[t]):[c]){let c=this.device.beginRenderPass({framebuffer:i,parameters:h,clearColor:s,clearDepth:l,clearStencil:u});try{for(let s of n){let n=this._drawLayersInViewport(c,{target:i,canvasContext:r,shaderModuleProps:f,viewport:s,view:o,pass:y,layers:t.layers,isPicking:t.isPicking},a);_.push(n)}}finally{c.end(),v&&this.device.submit()}s=!1,l=!1,u=!1}}return _}finally{v||this.device.submit()}}_getDrawLayerParams(t,{layers:r,pass:i,isPicking:n=!1,layerFilter:a,cullRect:o,views:s,effects:l,canvasContext:u=this.device.canvasContext,shaderModuleProps:c},h=!1){let f=[],d=function t(r=0,i={}){let n={},a=(o,s)=>{let l,u=o.props._offset,c=o.id,h=o.parent&&o.parent.id;if(!h||h in i||a(o.parent,!1),h in n){let r=n[h]=n[h]||t(i[h],i);
2257l=r(o,s),n[c]=r}else Number.isFinite(u)?(l=u+(i[h]||0),n[c]=null):l=r;return s&&l>=r&&(r=l+1),i[c]=l,l};return a}(this._lastRenderIndex+1),p={layer:r[0],viewport:t,isPicking:n,renderPass:i,cullRect:o},m={};for(let n=0;n<r.length;n++){let o=r[n],g=this._shouldDrawLayer(o,p,a,m),y={shouldDrawLayer:g};g&&!h&&(y.shouldDrawLayer=!0,y.layerRenderIndex=d(o,g),y.shaderModuleProps=this._getShaderModuleProps(o,l,i,u,c),y.layerParameters={..."webgpu"===o.context.device.type?Sw:null,...o.context.deck?.props.parameters,...s?.[t.id]?.props.parameters,...this.getLayerParameters(o,n,t)}),f[n]=y}return f}_drawLayersInViewport(t,{layers:r,shaderModuleProps:i,pass:n,target:a,canvasContext:o,viewport:s,view:l,isPicking:u},c){let h=function(t,{canvasContext:r=t.canvasContext,shaderModuleProps:i,target:n,viewport:a}){let o=i?.project?.devicePixelRatio??r.cssToDeviceRatio(),[,s]=r.getDrawingBufferSize(),l=n?n.height:s;return[a.x*o,l-(a.y+a.height)*o,a.width*o,a.height*o]}(this.device,{canvasContext:o,shaderModuleProps:i,target:a,viewport:s});if(l){let{clear:t,clearColor:r,clearDepth:i,clearStencil:n}=l.props;if(t){let t=[0,0,0,0],o=1,s=0;Array.isArray(r)&&!u?t=[...r.slice(0,3),r[3]||255].map(t=>t/255):!1===r&&(t=!1),void 0!==i&&(o=i),void 0!==n&&(s=n),this.device.beginRenderPass({framebuffer:a,parameters:{viewport:h,scissorRect:h},clearColor:t,clearDepth:o,clearStencil:s}).end()}}let f={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};t.setParameters({viewport:h});for(let i=0;i<r.length;i++){let a=r[i],o=c[i],{shouldDrawLayer:l}=o;if(l&&a.props.pickable&&f.pickableCount++,a.isComposite&&f.compositeCount++,a.isDrawable&&o.shouldDrawLayer){let{layerRenderIndex:r,shaderModuleProps:i,layerParameters:l}=o;f.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,r),i.project&&(i.project.viewport=s),a.context.renderPass=t;try{a._drawLayer({renderPass:t,shaderModuleProps:i,uniforms:{layerIndex:r},parameters:l})}catch(t){a.raiseError(t,`drawing ${a} to ${n}`)}}}return f}shouldDrawLayer(t){return!0}getShaderModuleProps(t,r,i){return null}getLayerParameters(t,r,i){return t.props.parameters}_shouldDrawLayer(t,r,i,n){if(!(t.props.visible&&this.shouldDrawLayer(t)))return!1;r.layer=t;let a=t.parent;for(;a;){if(!a.props.visible||!a.filterSubLayer(r))return!1;r.layer=a,a=a.parent}if(i){let t=r.layer.id;if(t in n||(n[t]=i(r)),!n[t])return!1}return t.activateViewport(r.viewport),!0}_getShaderModuleProps(t,r,i,n,a){let o=n.cssToDeviceRatio(),s=t.internalState?.propsInTransition||t.props,l={layer:s,picking:{isActive:!1},project:{viewport:t.context.viewport,devicePixelRatio:o,modelMatrix:s.modelMatrix,coordinateSystem:s.coordinateSystem,coordinateOrigin:s.coordinateOrigin,autoWrapLongitude:t.wrapLongitude}};if(r)for(let i of r)ST(l,i.getShaderModuleProps?.(t,l));for(let r of t.context.defaultShaderModules)r.name in l||(l[r.name]={});return ST(l,this.getShaderModuleProps(t,r,l),a)}}function ST(t,...r){for(let i of r)if(i)for(let r in i)t[r]?Object.assign(t[r],i[r]):t[r]=i[r];return t}class SA extends SE{constructor(t,r){super(t,r);const i=t.createTexture({format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),n=t.createTexture({format:"depth16unorm",width:1,height:1});this.fbo=t.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[i],depthStencilAttachment:n})}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null)}getShadowMap(){return this.fbo.colorAttachments[0].texture}render(t){let r=this.fbo,i=this.device.canvasContext.cssToDeviceRatio(),n=t.viewports[0],a=n.width*i,o=n.height*i;(a!==r.width||o!==r.height)&&r.resize({width:a,height:o}),super.render({...t,clearColor:[1,1,1,1],target:r,pass:"shadow"})}getLayerParameters(t,r,i){return{...t.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}shouldDrawLayer(t){return!1!==t.props.shadowEnabled}getShaderModuleProps(t,r,i){return{shadow:{project:i.project,drawToShadowMap:!0}}}}let SS={color:[255,255,255],intensity:1},SC=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],SM=[0,0,0,200/255];class SD{constructor(t={}){this.id="lighting-effect",this.shadowColor=SM,this.shadow=!1,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.dummyShadowMap=null,this.setProps(t)}setup(t){this.context=t;let{device:r,deck:i}=t;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(r),i._addDefaultShaderModule(EO),this.dummyShadowMap=r.createTexture({width:1,height:1}))}setProps(t){for(let r in this.ambientLight=void 0,this.directionalLights=[],this.pointLights=[],t){let i=t[r];switch(i.type){case"ambient":this.ambientLight=i;break;case"directional":this.directionalLights.push(i);break;case"point":this.pointLights.push(i)}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(t=>t.shadow),this.context&&this.setup(this.context),this.props=t}preRender({layers:t,layerFilter:r,viewports:i,onViewportActive:n,views:a}
2257){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let o=0;o<this.shadowPasses.length;o++)this.shadowPasses[o].render({layers:t,layerFilter:r,viewports:i,onViewportActive:n,views:a,shaderModuleProps:{shadow:{shadowLightId:o,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}}})}}getShaderModuleProps(t,r){let i=this.shadow?{project:r.project,shadowMaps:this.shadowPasses.map(t=>t.getShadowMap()),dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{},n={enabled:!0,lights:this._getLights(t)},a=t.props.material;return{shadow:i,lighting:n,phongMaterial:a,gouraudMaterial:a}}cleanup(t){for(let t of this.shadowPasses)t.delete();this.shadowPasses.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,t.deck._removeDefaultShaderModule(EO))}_calculateMatrices(){let t=[];for(let r of this.directionalLights){let i=new Ei().lookAt({eye:new wQ(r.direction).negate()});t.push(i)}return t}_createShadowPasses(t){for(let r=0;r<this.directionalLights.length;r++){let i=new SA(t);this.shadowPasses[r]=i}}_applyDefaultLights(){let{ambientLight:t,pointLights:r,directionalLights:i}=this;t||0!==r.length||0!==i.length||(this.ambientLight=new Sg(SS),this.directionalLights.push(new Sb(SC[0]),new Sb(SC[1])))}_getLights(t){let r=[];for(let i of(this.ambientLight&&r.push(this.ambientLight),this.pointLights))r.push(i.getProjectedLight({layer:t}));for(let i of this.directionalLights)r.push(i.getProjectedLight({layer:t}));return r}}let SP=new SD;class SI{constructor(t){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=t,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(t){let r=this._defaultEffects;if(!r.find(r=>r.id===t.id)){let i=r.findIndex(r=>(r.order??1/0)-(t.order??1/0)>0);i<0?r.push(t):r.splice(i,0,t),t.setup(this._context),this._setEffects(this.effects)}}setProps(t){"effects"in t&&!Ak(t.effects,this.effects,1)&&this._setEffects(t.effects)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(t){let r={};for(let t of this.effects)r[t.id]=t;let i=[];for(let n of t){let t=r[n.id],a=n;t&&t!==n?t.setProps?(t.setProps(n.props),a=t):t.cleanup(this._context):t||n.setup(this._context),i.push(a),delete r[n.id]}for(let t in r)r[t].cleanup(this._context);this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),t.some(t=>t instanceof SD)||this._resolvedEffects.push(SP),this._needsRedraw="effects changed"}finalize(){for(let t of this._resolvedEffects)t.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class Sk extends SE{shouldDrawLayer(t){let{operation:r}=t.props;return r.includes("draw")||r.includes("terrain")}render(t){return this._render(t)}}let SO={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant",blendAlphaDstFactor:"zero"};class SN extends SE{constructor(){super(...arguments),this._colorEncoderState=null}render(t){return"pickingFBO"in t?this._drawPickingBuffer(t):{decodePickingColor:null,stats:super._render(t)}}_drawPickingBuffer({layers:t,layerFilter:r,views:i,viewports:n,onViewportActive:a,pickingFBO:o,deviceRect:{x:s,y:l,width:u,height:c},cullRect:h,effects:f,pass:d="picking",pickZ:p,canvasContext:m,shaderModuleProps:g,clearColor:y}){this.pickZ=p;let v=this._resetColorEncoder(p),_=super._render({target:o,layers:t,layerFilter:r,views:i,viewports:n,onViewportActive:a,cullRect:h,effects:f?.filter(t=>t.useInPicking),pass:d,canvasContext:m,isPicking:!0,shaderModuleProps:g,clearColor:y??[0,0,0,0],colorMask:15,scissorRect:[s,l,u,c]});return this._colorEncoderState=null,{decodePickingColor:v&&SR.bind(null,v),stats:_}}shouldDrawLayer(t){let{pickable:r,operation:i}=t.props;return r&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getShaderModuleProps(t,r,i){return{picking:{isActive:1,isAttribute:this.pickZ,disabledPickingIndices:t.internalState?.disabledPickingIndices},lighting:{enabled:!1}}}getLayerParameters(t,r,i){let n={...t.props.parameters},{pickable:a,operation:o}=t.props;
2257return this._colorEncoderState?a&&o.includes("draw")?(Object.assign(n,SO),n.blend=!0,"webgpu"===this.device.type?n.blendConstant=SL(this._colorEncoderState,t,i):n.blendColor=SL(this._colorEncoderState,t,i),o.includes("terrain")&&t.state?._hasPickingCover&&(n.blendAlphaSrcFactor="one")):o.includes("terrain")&&(n.blend=!1):n.blend=!1,n}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function SL(t,r,i){let n,{byLayer:a,byAlpha:o}=t,s=a.get(r);return s?(s.viewports.push(i),n=s.a):(n=a.size+1)<=255?(s={a:n,layer:r,viewports:[i]},a.set(r,s),o[n]=s):(xn.warn("Too many pickable layers, only picking the first 255")(),n=0),[0,0,0,n/255]}function SR(t,r){let i=t.byAlpha[r[3]];return i&&{pickedLayer:i.layer,pickedViewports:i.viewports,pickedObjectIndex:i.layer.decodePickingColor(r)}}class SF{constructor(t,r={}){this.device=t,this.stats=r.stats,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Sk(t),this.pickLayersPass=new SN(t),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(t){let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t};if(!t.viewports.length){let t=r.render(i),n="stats"in t?t.stats:t;this._updateStats(n);return}i.effects&&this._preRender(i.effects,i);let n=this.lastPostProcessEffect?this.renderBuffers[0]:i.target;this.lastPostProcessEffect&&(i.clearColor=[0,0,0,0],i.clearCanvas=!0);let a=r.render({...i,target:n}),o="stats"in a?a.stats:a;i.effects&&(this.lastPostProcessEffect&&(i.clearCanvas=void 0===t.clearCanvas||t.clearCanvas),this._postRender(i.effects,i)),this.renderCount++,EJ("deckRenderer.renderLayers",this,o,t),this._updateStats(o)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:t}=this;for(let r of t)r.delete();t.length=0}_updateStats(t){if(!this.stats)return;let r=0;for(let{visibleCount:i}of t)r+=i;this.stats.get("Layers rendered").addCount(r)}_preRender(t,r){for(let i of(this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{},t))r.preRenderStats[i.id]=i.preRender(r),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers(r.canvasContext)}_resizeRenderBuffers(t=this.device.canvasContext){let{renderBuffers:r}=this,i=t.getDrawingBufferSize(),[n,a]=i;for(let t of(0===r.length&&[0,1].map(t=>{let i=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:n,height:a});r.push(this.device.createFramebuffer({id:`deck-renderbuffer-${t}`,colorAttachments:[i]}))}),r))t.resize(i)}_postRender(t,r){let{renderBuffers:i}=this,n=r.target??r.canvasContext?.getCurrentFramebuffer()??r.target,a={...r,inputBuffer:i[0],swapBuffer:i[1]};for(let r of t)if(r.postRender){a.target=r.id===this.lastPostProcessEffect?n:void 0;let t=r.postRender(a);a.inputBuffer=t,a.swapBuffer=t===i[0]?i[1]:i[0]}}}var SB=t.i(706145),Sz=t.i(825458);let Sj={pickedColor:null,pickedObjectIndex:-1};function SU({pickedColors:t,decodePickingColor:r,deviceX:i,deviceY:n,deviceRadius:a,deviceRect:o}){let{x:s,y:l,width:u,height:c}=o,h=a*a,f=-1,d=0;for(let r=0;r<c;r++){let a=r+l-n,o=a*a;if(o>h)d+=4*u;else for(let r=0;r<u;r++){if(t[d+3]-1>=0){let t=r+s-i,n=t*t+o;n<=h&&(h=n,f=d)}d+=4}}if(f>=0){let i=t.slice(f,f+4),n=r(i);if(n){let t=Math.floor(f/4/u),r=f/4-t*u;return{...n,pickedColor:i,pickedX:s+r,pickedY:l+t}}xn.error("Picked non-existent layer. Is picking buffer corrupt?")()}return Sj}function SV({pickedColors:t,decodePickingColor:r}){let i=new Map;if(t){for(let n=0;n<t.length;n+=4)if(t[n+3]-1>=0){let a=t.slice(n,n+4),o=a.join(",");if(!i.has(o)){let t=r(a);t?i.set(o,{...t,color:a}):xn.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(i.values())}function S$({pickInfo:t,viewports:r,pixelRatio:i,x:n,y:a,z:o}){let s,l=r[0];if(r.length>1&&(l=function(t,r){for(let i=t.length-1;i>=0;i--){let n=t[i];if(n.containsPixel(r))return n}return t[0]}(t?.pickedViewports||r,{x:n,y:a})),l){let t=[n-l.x,a-l.y];void 0!==o&&(t[2]=o),s=l.unproject(t)}return{color:null,layer:null,viewport:l,index:-1,picked:!1,x:n,y:a,pixel:[n,a],c
2257oordinate:s,devicePixel:t&&"pickedX"in t?[t.pickedX,t.pickedY]:void 0,pixelRatio:i}}function SG(t){let{pickInfo:r,lastPickedInfo:i,mode:n,layers:a}=t,{pickedColor:o,pickedLayer:s,pickedObjectIndex:l}=r,u=s?[s]:[];if("hover"===n){let t=i.index,r=i.layerId,n=s?s.props.id:null;if(n!==r||l!==t){if(n!==r){let t=a.find(t=>t.props.id===r);t&&u.unshift(t)}i.layerId=n,i.index=l,i.info=null}}let c=S$(t),h=new Map;return h.set(null,c),u.forEach(t=>{let r={...c};t===s&&(r.color=o,r.index=l,r.picked=!0);let a=(r=Sq({layer:t,info:r,mode:n})).layer;t===s&&"hover"===n&&(i.info=r),h.set(a.id,r),"hover"===n&&a.updateAutoHighlight(r)}),h}function Sq({layer:t,info:r,mode:i}){for(;t&&r;){let n=r.layer||null;r.sourceLayer=n,r.layer=t,r=t.getPickingInfo({info:r,mode:i,sourceLayer:n}),t=t.parent}return r}class SH{constructor(t,r={}){this._pickable=!0,this.device=t,this.stats=r.stats,this.pickLayersPass=new SN(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){"layerFilter"in t&&(this.layerFilter=t.layerFilter),"_pickable"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}
2257pickObjectAsync(t){return this._pickClosestObjectAsync(t)}pickObjectsAsync(t){return this._pickVisibleObjectsAsync(t)}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:r,layers:i,viewports:n},a=this.lastPickedInfo.info){let o=a&&a.layer&&a.layer.id,s=a&&a.viewport&&a.viewport.id,l=o?i.find(t=>t.id===o):null,u=s&&n.find(t=>t.id===s)||n[0],c=u&&u.unproject([t-u.x,r-u.y]);return{...a,x:t,y:r,viewport:u,coordinate:c,layer:l}}_resizeBuffer(t=this.device.getDefaultCanvasContext()){if(!this.pickingFBO){let t=this.device.createTexture({format:"rgba8unorm",width:1,height:1,usage:Sz.Texture.RENDER_ATTACHMENT|Sz.Texture.COPY_SRC});if(this.pickingFBO=this.device.createFramebuffer({colorAttachments:[t],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float")){let t=this.device.createTexture({format:"rgba32float",width:1,height:1,usage:Sz.Texture.RENDER_ATTACHMENT|Sz.Texture.COPY_SRC}),r=this.device.createFramebuffer({colorAttachments:[t],depthStencilAttachment:"depth16unorm"});this.depthFBO=r}}let[r,i]=t.getDrawingBufferSize();this.pickingFBO?.resize({width:r,height:i}),this.depthFBO?.resize({width:r,height:i})}_getPickable(t){if(!1===this._pickable)return null;let r=t.filter(t=>this.pickLayersPass.shouldDrawLayer(t)&&!t.isComposite);return r.length?r:null}async _pickClosestObjectAsync({layers:t,views:r,viewports:i,x:n,y:a,radius:o=0,depth:s=1,mode:l="query",unproject3D:u,canvasContext:c=this.device.getDefaultCanvasContext(),onViewportActive:h,effects:f}){let d,p=c.cssToDeviceRatio(),m=this._getPickable(t);if(!m||0===i.length)return{result:[],emptyInfo:S$({viewports:i,x:n,y:a,pixelRatio:p})};this._resizeBuffer(c);let g=c.cssToDevicePixels([n,a],!0),y=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],v=Math.round(o*p),{width:_,height:b}=this.pickingFBO,x=this._getPickingRect({deviceX:y[0],deviceY:y[1],deviceRadius:v,deviceWidth:_,deviceHeight:b}),w={x:n-o,y:a-o,width:2*o+1,height:2*o+1},E=[],T=new Set;for(let t=0;t<s;t++){let o,g;o=x?SU({...await this._drawAndSampleAsync({layers:m,views:r,viewports:i,onViewportActive:h,deviceRect:x,cullRect:w,effects:f,pass:`picking:${l}`,canvasContext:c}),deviceX:y[0],deviceY:y[1],deviceRadius:v,deviceRect:x}):{pickedColor:null,pickedObjectIndex:-1};let _=this._getDepthLayers(o,m,u);if(_.length>0){let{pickedColors:t}=await this._drawAndSampleAsync({layers:_,views:r,viewports:i,onViewportActive:h,deviceRect:{x:o.pickedX??y[0],y:o.pickedY??y[1],width:1,height:1},cullRect:w,effects:f,pass:`picking:${l}:z`,canvasContext:c},!0);t[3]&&(g=t[0])}for(let r of(o.pickedLayer&&t+1<s&&(T.add(o.pickedLayer),o.pickedLayer.disablePickingIndex(o.pickedObjectIndex)),(d=SG({pickInfo:o,lastPickedInfo:this.lastPickedInfo,mode:l,layers:m,viewports:i,x:n,y:a,z:g,pixelRatio:p})).values()))r.layer&&E.push(r);if(!o.pickedColor)break}for(let t of T)t.restorePickingColors();return{result:E,emptyInfo:d.get(null)}}_pickClosestObject({layers:t,views:r,viewports:i,x:n,y:a,radius:o=0,depth:s=1,mode:l="query",unproject3D:u,canvasContext:c=this.device.getDefaultCanvasContext(),onViewportActive:h,effects:f}){let d,p=c.cssToDeviceRatio(),m=this._getPickable(t);if(!m||0===i.length)return{result:[],emptyInfo:S$({viewports:i,x:n,y:a,pixelRatio:p})};this._resizeBuffer(c);let g=c.cssToDevicePixels([n,a],!0),y=[g.x+Math.floor(g.width/2),g.y+Math.floor(g.height/2)],v=Math.round(o*p),{width:_,height:b}=this.pickingFBO,x=this._getPickingRect({deviceX:y[0],deviceY:y[1],deviceRadius:v,deviceWidth:_,deviceHeight:b}),w={x:n-o,y:a-o,width:2*o+1,height:2*o+1},E=[],T=new Set;for(let t=0;t<s;t++){let o,g;o=x?SU({...this._drawAndSample({layers:m,views:r,viewports:i,onViewportActive:h,deviceRect:x,cullRect:w,effects:f,pass:`picking:${l}`,canvasContext:c}),deviceX:y[0],deviceY:y[1],deviceRadius:v,deviceRect:x}):{pickedColor:null,pickedObjectIndex:-1};let _=this._getDepthLayers(o,m,u);if(_.length>0){let{pickedColors:t}=this._drawAndSample({layers:_,views:r,viewports:i,onViewportActive:h,deviceRect:{x:o.pickedX??y[0],y:o.pickedY??y[1],width:1,height:1},cullRect:w,effects:f,pass:`picking:${l}:z`,canvasContext:c},!0);t[3]&&(g=t[0])}for(let r of(o.pickedLayer&&t+1<s&&(T.add(o.pickedLayer),o.pickedLayer.disablePickingIndex(o.pickedObjectIndex)),(d=SG({pickInfo:o,lastPickedInfo:this.lastPickedInfo,mode:l,layers:m,viewports:i,x:n,y:a,z:g,pixelRatio:p}
2257)).values()))r.layer&&E.push(r);if(!o.pickedColor)break}for(let t of T)t.restorePickingColors();return{result:E,emptyInfo:d.get(null)}}async _pickVisibleObjectsAsync({layers:t,views:r,viewports:i,x:n,y:a,width:o=1,height:s=1,mode:l="query",maxObjects:u=null,canvasContext:c=this.device.getDefaultCanvasContext(),onViewportActive:h,effects:f}){let d=this._getPickable(t);if(!d||0===i.length)return[];this._resizeBuffer(c);let p=c.cssToDeviceRatio(),m=c.cssToDevicePixels([n,a],!0),g=m.x,y=m.y+m.height,v=c.cssToDevicePixels([n+o,a+s],!0),_=v.x+v.width,b=v.y,x=SV(await this._drawAndSampleAsync({layers:d,views:r,viewports:i,onViewportActive:h,deviceRect:{x:g,y:b,width:_-g,height:y-b},cullRect:{x:n,y:a,width:o,height:s},effects:f,pass:`picking:${l}`,canvasContext:c})),w=new Map,E=[],T=Number.isFinite(u);for(let t=0;t<x.length&&(!T||!(E.length>=u));t++){let r=x[t],i={color:r.pickedColor,layer:null,index:r.pickedObjectIndex,picked:!0,x:n,y:a,pixelRatio:p},o=(i=Sq({layer:r.pickedLayer,info:i,mode:l})).layer.id;w.has(o)||w.set(o,new Set);let s=w.get(o),u=i.object??i.index;s.has(u)||(s.add(u),E.push(i))}return E}_pickVisibleObjects({layers:t,views:r,viewports:i,x:n,y:a,width:o=1,height:s=1,mode:l="query",maxObjects:u=null,canvasContext:c=this.device.getDefaultCanvasContext(),onViewportActive:h,effects:f}){let d=this._getPickable(t);if(!d||0===i.length)return[];this._resizeBuffer(c);let p=c.cssToDeviceRatio(),m=c.cssToDevicePixels([n,a],!0),g=m.x,y=m.y+m.height,v=c.cssToDevicePixels([n+o,a+s],!0),_=v.x+v.width,b=v.y,x=SV(this._drawAndSample({layers:d,views:r,viewports:i,onViewportActive:h,deviceRect:{x:g,y:b,width:_-g,height:y-b},cullRect:{x:n,y:a,width:o,height:s},effects:f,pass:`picking:${l}`,canvasContext:c})),w=new Map,E=[],T=Number.isFinite(u);for(let t=0;t<x.length&&(!T||!(E.length>=u));t++){let r=x[t],i={color:r.pickedColor,layer:null,index:r.pickedObjectIndex,picked:!0,x:n,y:a,pixelRatio:p},o=(i=Sq({layer:r.pickedLayer,info:i,mode:l})).layer.id;w.has(o)||w.set(o,new Set);let s=w.get(o),u=i.object??i.index;s.has(u)||(s.add(u),E.push(i))}return E}async _drawAndSampleAsync({layers:t,views:r,viewports:i,onViewportActive:n,deviceRect:a,cullRect:o,effects:s,pass:l,canvasContext:u},c=!1){let h=c?this.depthFBO:this.pickingFBO,f={layers:t,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:n,pickingFBO:h,deviceRect:a,cullRect:o,effects:s,pass:l,canvasContext:u,pickZ:c,preRenderStats:{},isPicking:!0};for(let t of s)t.useInPicking&&(f.preRenderStats[t.id]=t.preRender(f));let{decodePickingColor:d,stats:p}=this.pickLayersPass.render(f);this._updateStats(p);let{x:m,y:g,width:y,height:v}=a,_=h.colorAttachments[0]?.texture;if(!_)throw Error("Picking framebuffer color attachment is missing");let b=await this._readTextureDataAsync(_,{x:m,y:g,width:y,height:v},c?Float32Array:Uint8Array);if(!c){let t=!1;for(let r=3;r<b.length;r+=4)if(0!==b[r]){t=!0;break}!t&&b.length>0&&xn.warn("Async pick readback returned only zero alpha values",{deviceRect:a,bytes:Array.from(b.subarray(0,Math.min(b.length,16)))})()}return{pickedColors:b,decodePickingColor:d}}async _readTextureDataAsync(t,r,i){let{width:n,height:a}=r,o=t.computeMemoryLayout(r),s=this.device.createBuffer({byteLength:o.byteLength,usage:SB.Buffer.COPY_DST|SB.Buffer.MAP_READ});try{t.readBuffer(r,s);let l=await s.readAsync(0,o.byteLength),u=i.BYTES_PER_ELEMENT;if(o.bytesPerRow%u!=0)throw Error(`Texture readback row stride ${o.bytesPerRow} is not aligned to ${u}-byte elements.`);let c=new i(l.buffer,l.byteOffset,o.byteLength/u),h=4*n,f=o.bytesPerRow/u;if(f<h)throw Error(`Texture readback row stride ${f} is smaller than packed row length ${h}.`);let d=new i(n*a*4);for(let t=0;t<a;t++){let r=t*f;d.set(c.subarray(r,r+h),t*h)}return d}finally{s.destroy()}}_drawAndSample({layers:t,views:r,viewports:i,onViewportActive:n,deviceRect:a,cullRect:o,effects:s,pass:l,canvasContext:u},c=!1){let h=c?this.depthFBO:this.pickingFBO,f={layers:t,layerFilter:this.layerFilter,views:r,viewports:i,onViewportActive:n,pickingFBO:h,deviceRect:a,cullRect:o,effects:s,pass:l,canvasContext:u,pickZ:c,preRenderStats:{},isPicking:!0};for(let t of s)t.useInPicking&&(f.preRenderStats[t.id]=t.preRender(f));let{decodePickingColor:d,stats:p}=this.pickLayersPass.render(f);this._updateStats(p);let{x:m,y:g,width:y,height:v}=a,_=new(c?Float32Array:Uint8Array)(y*v*4);return this.device.readPixelsToArrayWebGL(h,{sourceX:m,sourceY:g,sourceW
2257idth:y,sourceHeight:v,target:_}),{pickedColors:_,decodePickingColor:d}}_updateStats(t){if(!this.stats)return;let r=0;for(let{visibleCount:i}of t)r+=i;this.stats.get("Layers picked").addCount(r)}_getDepthLayers(t,r,i){if(!i||!this.depthFBO)return[];let{pickedLayer:n}=t,a=n?.state?.terrainDrawMode==="drape";return n&&!a?[n]:r.filter(t=>t.props.operation.includes("terrain"))}_getPickingRect({deviceX:t,deviceY:r,deviceRadius:i,deviceWidth:n,deviceHeight:a}){let o=Math.max(0,t-i),s=Math.max(0,r-i),l=Math.min(n,t+i+1)-o,u=Math.min(a,r+i+1)-s;return l<=0||u<=0?null:{x:o,y:s,width:l,height:u}}}let SW={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},SZ="root";class SY{constructor({deck:t,parentElement:r}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=t,r?.classList.add("deck-widget-container"),this.parentElement=r}getWidgets(){return this.resolvedWidgets}setProps(t){if(t.widgets&&!Ak(t.widgets,this.widgets,1)){let r=t.widgets.filter(Boolean);this._setWidgets(r)}}finalize(){for(let t of this.getWidgets())this._removeWidget(t);for(let t in this.defaultWidgets.length=0,this.resolvedWidgets.length=0,this.containers)this.containers[t].remove()}addDefault(t){this.defaultWidgets.find(r=>r.id===t.id)||(this._addWidget(t),this.defaultWidgets.push(t),this._setWidgets(this.widgets))}onRedraw({viewports:t,layers:r}){let i=t.reduce((t,r)=>(t[r.id]=r,t),{});for(let n of this.getWidgets()){let{viewId:a}=n;if(a){let t=i[a];t&&(n.onViewportChange&&n.onViewportChange(t),n.onRedraw?.({viewports:[t],layers:r}))}else{if(n.onViewportChange)for(let r of t)n.onViewportChange(r);n.onRedraw?.({viewports:t,layers:r})}}this.lastViewports=i,this._updateContainers()}onHover(t,r){for(let i of this.getWidgets()){let{viewId:n}=i;n&&n!==t.viewport?.id||i.onHover?.(t,r)}}getCanvasBounds(t){let r=this.deck?.getCanvas?.(),i=r?.getBoundingClientRect(),n=this.parentElement?.getBoundingClientRect(),a=this.deck?.getCanvasContext?.(t?.id);if(a&&n){a.updatePosition();let[t,r]=a.getPosition(),[i,o]=a.getCSSSize();return{x:t-n.left,y:r-n.top,width:i,height:o}}return{x:i&&n?i.left-n.left:0,y:i&&n?i.top-n.top:0,width:i?.width||this.deck?.width||0,height:i?.height||this.deck?.height||0}}onEvent(t,r){let i=x6[r.type];if(i)for(let n of this.getWidgets()){let{viewId:a}=n;a&&a!==t.viewport?.id||n[i]?.(t,r)}}_setWidgets(t){let r={};for(let t of this.resolvedWidgets)r[t.id]=t;for(let t of(this.resolvedWidgets.length=0,this.defaultWidgets))r[t.id]=null,this.resolvedWidgets.push(t);for(let i of t){let t=r[i.id];t?t.viewId!==i.viewId||t.placement!==i.placement?(this._removeWidget(t),this._addWidget(i)):i!==t&&(t.setProps(i.props),i=t):this._addWidget(i),r[i.id]=null,this.resolvedWidgets.push(i)}for(let t in r){let i=r[t];i&&this._removeWidget(i)}this.widgets=t}_addWidget(t){let{viewId:r=null,placement:i="top-left"}=t,n=t.props._container??r;t.widgetManager=this,t.deck=this.deck,t.rootElement=t._onAdd({deck:this.deck,viewId:r}),t.rootElement&&this._getContainer(n,i).append(t.rootElement),t.updateHTML()}_removeWidget(t){t.onRemove?.(),t.rootElement&&t.rootElement.remove(),t.rootElement=void 0,t.deck=void 0,t.widgetManager=void 0}_getContainer(t,r){if(t&&"string"!=typeof t)return t;let i=t||SZ,n=this.containers[i];n||((n=document.createElement("div")).style.pointerEvents="none",n.style.position="absolute",n.style.overflow="hidden",this.parentElement?.append(n),this.containers[i]=n);let a=n.querySelector(`.${r}`);return a||((a=globalThis.document.createElement("div")).className=r,a.style.position="absolute",a.style.zIndex="2",Object.assign(a.style,SW[r]),n.append(a)),a}_updateContainers(){for(let t in this.containers){let r=this.lastViewports[t]||null,i=t===SZ||r,n=this.containers[t];if(i){let t=this._getContainerBounds(r);n.style.display="block",n.style.left=`${t.x}px`,n.style.top=`${t.y}px`,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`}else n.style.display="none"}}_getContainerBounds(t){if(!t)return{x:0,y:0,width:this.parentElement?.clientWidth||this.deck.width,height:this.parentElement?.clientHeight||this.deck.height};let r=this.getCanvasBounds(t);return{x:r.x+t.x,y:r.y+t.y,width:t.width,height:t.height}}}function SX(t,r){r&&Object.entries(r).map(([r,i])=>{r.startsWith("--")?t.style.setProperty(r,i):t.style[r]=i})}class SK{constructor(t){this.viewId=null,this.props={...this.constructor.defaultProps,...t},this.id=this.props.id}setProps(t){let r=this.props,i=this.rootElement;if(i&&r.className!==t.className&&(r.className&&i.classList.remove(r.className),t.className&&i.classList.add(t.className)),i&&!Ak(r.style,t.style,1)){var n;(n=r.style)&&Object.keys(n).map(t=>
2257{t.startsWith("--")?i.style.removeProperty(t):i.style[t]=""}),SX(i,t.style)}Object.assign(this.props,t),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}get viewIds(){return this.viewId?[this.viewId]:this.deck?.getViews().map(t=>t.id)??[]}getViewState(t){return this.deck?.viewManager?.getViewState(t)||{}}setViewState(t,r){this.deck?._onViewStateChange({viewId:t,viewState:r,interactionState:{}})}onCreateRootElement(){let t=["deck-widget",this.className,this.props.className],r=document.createElement("div");return t.filter(t=>"string"==typeof t&&t.length>0).forEach(t=>r.classList.add(t)),SX(r,this.props.style),r}_onAdd(t){return this.onAdd(t)??this.onCreateRootElement()}onAdd(t){}onRemove(){}onViewportChange(t){}onRedraw(t){}onHover(t,r){}onClick(t,r){}onDrag(t,r){}onDragStart(t,r){}onDragEnd(t,r){}}SK.defaultProps={id:"widget",style:{},_container:null,className:""};let SQ={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class SJ extends SK{constructor(t={}){super(t),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(t)}onCreateRootElement(){let t=document.createElement("div");return t.className=this.className,Object.assign(t.style,SQ),t}onRenderHTML(t){}onViewportChange(t){this.isVisible&&t.id===this.lastViewport?.id&&!t.equals(this.lastViewport)&&this.setTooltip(null),this.lastViewport=t}onHover(t){let{deck:r}=this,i=r&&r.props.getTooltip;if(!i)return;let n=i(t),a=this.widgetManager?.getCanvasBounds(t.viewport),o=t.x+(a?.x||0),s=t.y+(a?.y||0);this.setTooltip(n,o,s)}setTooltip(t,r,i){let n=this.rootElement;if(n){if("string"==typeof t)n.innerText=t;else if(t)t.text&&(n.innerText=t.text),t.html&&(n.innerHTML=t.html),t.className&&(n.className=t.className);else{this.isVisible=!1,n.style.display="none";return}this.isVisible=!0,n.style.display="block",n.style.transform=`translate(${r}px, ${i}px)`,t&&"object"==typeof t&&"style"in t&&Object.assign(n.style,t.style)}}}SJ.defaultProps={...SK.defaultProps};class S0{constructor(t){this.targets={},this.order=[],this.eventManagers={},this._eventRootToCanvasId=new WeakMap,this._createEventManager=t.createEventManager,this._getEventRoot=t.getEventRoot}finalize(){for(let t of Object.values(this.targets))t.eventManager.destroy(),t.presentationContext.destroy();this.targets={},this.order=[],this.eventManagers={},this._eventRootToCanvasId=new WeakMap}syncCanvasEntries(t){let r=this._normalizeCanvasList(t.canvases),i={},n=[],a=new Map;for(let{canvas:t}of r){let r=this._getEventRoot(t);a.set(r,(a.get(r)||0)+1)}for(let{id:o,canvas:s}of r){let r=this._getEventRoot(s),l=1===a.get(r)?r:s,u=this.targets[o];if(!u||u.device!==t.device||u.canvas!==s||u.eventRoot!==l){u?.eventManager.destroy(),u?.presentationContext.destroy();let r=t.device.createPresentationContext({id:o,canvas:s,useDevicePixels:t.useDevicePixels,autoResize:!0});u={id:o,device:t.device,canvas:s,eventRoot:l,presentationContext:r,eventManager:this._createEventManager(l)}}this._eventRootToCanvasId.set(l,o),this._eventRootToCanvasId.set(s,o),i[o]=u,n.push(o)}for(let[t,r]of Object.entries(this.targets))i[t]||(r.eventManager.destroy(),r.presentationContext.destroy());this.targets=i,this.order=n;let o=Object.fromEntries(Object.entries(i).map(([t,r])=>[t,r.eventManager]));this._haveSameEventManagers(o)||(this.eventManagers=o)}getCanvasIdFromEvent(t){return t?this._eventRootToCanvasId.get(t):void 0}getTarget(t){return this.targets[t||this.order[0]||AO]||null}_normalizeCanvasList(t=[]){let r=new Set;return t.map((t,i)=>{let n,a;return"string"==typeof t?(AK(n=document.getElementById(t),`Canvas with id ${t} not found`),a=t):a=(n=t).id||`deckgl-canvas-${i}`,AK(!r.has(a),`Duplicate canvas id ${a}`),r.add(a),{id:a,canvas:n}})}_haveSameEventManagers(t){let r=Object.keys(t),i=Object.keys(this.eventManagers);return r.length===i.length&&r.every(r=>t[r]===this.eventManagers[r])}}let S1=globalThis.loaders?.parseImageNode,S2="u">typeof Image,S3="u">typeof ImageBitmap,S4=!!Tx||!!S1,S6=/^data:image\/svg\+xml/,S5=/\.svg((\?|#).*)?$/;function S8(t){return t&&(S6.test(t)||S5.test(t))}function S7(t,r){if(S8(r))throw Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function S9(t,r,i){let n=function(t,r){if(S8(r)){let r=new TextDecoder().decode(t);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(r=unescape(encodeURIComponent(r)))}catch(t){throw Error(t.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return S7(t,r)}(t,i),a=self.URL||self.webkitURL,o="string"!=typeof n&&a.createObjectURL(n);try{return await Ce(o||n,r)}finally{o&&a.revokeObjectURL(o)}}async function Ce(t,r){let i=new Image;return(i.src=t,r.image&&r.image.decode&&i.decode)?(await i.decode(),i):await new Promise((t,r)=>{try{i.onload=()=>t(i),i.onerror=t=>{let i=t instanceof Error?t.message:"error";r(Error(i))}}catch(t){r(t)}})}let Ct=!0;async function Cr(t,r,i){let n;n=S8(i)?await S9(t,r,i):S7(t,i);let a=r&&r.imagebitmap;return await Ci(n,a)}async function Ci(t,r=null){if((function(t){if(!t)return!0;for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r))return!1;return!0}(r)||!Ct)&&(r=null),r)try{return await createImageBitmap(t,r)}catch(t){console.warn(t),Ct=!1}return await createImageBitmap(t)}function Cn(t){var r,i;let n,a,o,s,l=Ca(t);return((n=Ca(l)).byteLength>=24&&0x89504e47===n.getUint32(0,!1)?{mimeType:"image/png",width:n.getUint32(16,!1),height:n.getUint32(20,!1)}:null)||function(t){let r=Ca(t);if(!(r.byteLength>=3&&65496===r.getUint16(0,!1)&&255===r.getUint8(2)))return null;let{tableMarkers:i,sofMarkers:n}=function(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}(),a=2;for(;a+9<r.byteLength;){let t=r.getUint16(a,!1);if(n.has(t))return{mimeType:"image/jpeg",height:r.getUint16(a+5,!1),width:r.getUint16(a+7,!1)};if(!i.has(t))break;a+=2,a+=r.getUint16(a,!1)}return null}(l)||((a=Ca(l)).byteLength>=10&&0x47494638===a.getUint32(0,!1)?{mimeType:"image/gif",width:a.getUint16(6,!0),height:a.getUint16(8,!0)}:null)||((o=Ca(l)).byteLength>=14&&16973===o.getUint16(0,!1)&&o.getUint32(2,!0)===o.byteLength?{mimeType:"image/bmp",width:o.getUint32(18,!0),height:o.getUint32(22,!0)}:null)||((s=!function(t,r,i=0){let n=[...r].map(t=>t.charCodeAt(0));for(let r=0;r<n.length;++r)if(n[r]!==t[r+i])return!1;return!0}(i=new Uint8Array((r=l)instanceof DataView?r.buffer:r),"ftyp",4)||(96&i[8])==0?null:function(t){switch(String.fromCharCode(...t.slice(8,12)).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"av
2257if",mimeType:"image/avif"};default:return null}}(i))?{mimeType:s.mimeType,width:0,height:0}:null)}function Ca(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw Error("toDataView")}async function Co(t,r){let{mimeType:i}=Cn(t)||{},n=globalThis.loaders?.parseImageNode;return E9(n),await n(t,i)}let Cs={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:"4.5.2",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],parse:async function t(t,r,i){let n,a=((r=r||{}).image||{}).type||"auto",{url:o}=i||{};switch(function(t){switch(t){case"auto":case"data":if(S3)return"imagebitmap";if(S2)return"image";if(S4)return"data";throw Error("Install '@loaders.gl/polyfills' to parse images under Node.js");default:return!function(t){switch(t){case"auto":return S3;case"imagebitmap":case"image":case"data":return;default:throw Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}(t),t}}(a)){case"imagebitmap":n=await Cr(t,r,o);break;case"image":n=await S9(t,r,o);break;case"data":n=await Co(t,r);break;default:E9(!1)}return"data"===a&&(n=function(t){switch(function(t){var r;let i=(r=t,"u">typeof ImageBitmap&&r instanceof ImageBitmap?"imagebitmap":"u">typeof Image&&r instanceof Image?"image":r&&"object"==typeof r&&r.data&&r.width&&r.height?"data":null);if(!i)throw Error("Not an image");return i}(t)){case"data":return t;case"image":case"imagebitmap":let r=document.createElement("canvas"),i=r.getContext("2d");if(!i)throw Error("getImageData");return r.width=t.width,r.height=t.height,i.drawImage(t,0,0),i.getImageData(0,0,t.width,t.height);default:throw Error("getImageData")}}(n)),n},tests:[t=>!!Cn(new DataView(t))],options:{image:{type:"auto",decode:!0}}},Cl={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:function(t){let r=t[0],i=t[t.length-1];return"{"===r&&"}"===i||"["===r&&"]"===i},parseTextSync:JSON.parse},Cu=function(){let t="9.4.0",r=globalThis.deck&&globalThis.deck.VERSION;if(r&&r!==t)throw Error(`deck.gl - multiple versions detected: ${r} vs ${t}`);if(!r){xn.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:xn,_registerLoggers:EQ};var i=[Cl,[Cs,{imagebitmap:{premultiplyAlpha:"none"}}]];let r=Ar();for(let t of i=Array.isArray(i)?i:[i]){let i=Tt(t);r.find(t=>i===t)||r.unshift(i)}}return t}();var Cc=t.i(780900),Ch=t.i(504819);let Cf="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.";class Cd{static defaultProps={...Cc.DEVICE_DEFAULT_PROPS,type:"best-available",adapters:void 0,waitForPageLoad:!0};stats=Ch.lumaStats;log=bs.log;VERSION="9.4.2";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw bs.log.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),bs.log.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),Error("luma.gl - multiple versions detected: see console log");bs.log.error("This version of luma.gl has already been initialized")()}bs.log.log(1,`${this.VERSION} - set luma.log.level=1 (or higher) to trace rendering`)(),globalThis.luma=this}async createDevice(t={}){let r={...Cd.defaultProps,...t},i=this.selectAdapter(r.type,r.adapters);if(!i)throw Error(Cf);return r.waitForPageLoad&&await i.pageLoaded,await i.create(r)}async attachDevice(t,r){let i=this._getTypeFromHandle(t,r.adapters),n=i&&this.selectAdapter(i,r.adapters);if(!n)throw Error(Cf);return await n?.attach?.(t,r)}registerAdapters(t){for(let r of t)this.preregisteredAdapters.set(r.type,r)}getSupportedAdapters(t=[]){return Array.from(this._getAdapterMap(t)).map(([,t])=>t).filter(t=>t.isSupported?.()).map(t=>t.type)}getBestAvailableAdapterType(t=[]){let r=this._getAdapterMap(t);for(let t of["webgpu","webgl","null"])if(r.get(t)?.isSupported?.())return t;return null}selectAdapter(t,r=[]){let i=t;"best-available"===t&&(i=this.getBestAvailableAdapterType(r));let n=this._getAdapterMap(r);return i&&n.get(i)||null}enforceWebGL2(t=!0,r=[]){let i=this._getAdapterMap(r).get("webgl");i||bs.log.warn("enforceWebGL2: webgl adapter not found")(),i?.enforceWebGL2?.(t)}setDefaultDeviceProps(t){Object.assign(Cd.defaultProps,t)}_getAdapterMap(t=[]){let r=new Map(this.preregisteredAdapters);for(let i of t)r.set(i.type,i);return r}_getTypeFromHandle(t,r=[]){return t instanceof WebGL2RenderingContext?"webgl":"u">typeof GPUDevice&&t instanceof GPUDevice||t?.queue?"webgpu":null===t?"null":(t instanceof WebGLRenderingContext?bs.log.warn("WebGL1 is not supported",t)():bs.log.warn("Unknown handle type",t)(),null)}}let Cp=new Cd;var Cm=t.i(740021);class Cg{get pageLoaded(){return Cv||(Cv=Cy&&"complete"===document.readyState||"u"<typeof window?Promise.resolve():new Promise(t=>window.addEventListener("load",()=>t()))),Cv}}let Cy=(0,Cm.isBrowser)()&&"u">typeof document,Cv=null;var C_=t.i(25387);let Cb={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}};var Cx=t.i(892563);let Cw=new class extends Cg{type="webgl";enforceWebGL2(t){!function(t=!0){let r=HTMLCanvasElement.prototype;if(!t&&r.originalGetContext){r.getContext=r.originalGetContext,r.originalGetContext=void 0;return}r.originalGetContext=r.getContext,r.getContext=function(t,r){if("webgl"===t||"experimental-webgl"===t){let t=this.originalGetContext("webgl2",r);return t instanceof HTMLElement&&function(t){t.getExtension("EXT_color_buffer_float");let r={...Cb,WEBGL_disjoint_timer_query:t.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:{drawBuffersWEBGL:r=>t.drawBuffers(r),COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067},OES_vertex_array_object:{VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES:()=>t.createVertexArray(),deleteVertexArrayOES:r=>t.deleteVertexArray(r),isVertexArrayOES:r=>t.isVertexArray(r),bindVertexArrayOES:r=>t.bindVertexArray(r)},ANGLE_instanced_arrays:{VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE:(...r)=>t.drawArraysInstanced(...r),drawElementsInstancedANGLE:(...r)=>t.drawElementsInstanced(...r),vertexAttribDivisorANGLE:(...r)=>t.vertexAttribDivisor(...r)}},i=t.getExtension.bind(t);t.getExtension=function(t){let n=i(t);return n||(t in r?r[t]:null)};
2257let n=t.getSupportedExtensions;t.getSupportedExtensions=function(){let i=n.apply(t)||[];return i?.concat(Object.keys(r))}}(t),t}return this.originalGetContext(t,r)}}(t)}isSupported(){return"u">typeof WebGL2RenderingContext}isDeviceHandle(t){return!!("u">typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext)||("u">typeof WebGLRenderingContext&&t instanceof WebGLRenderingContext&&bs.log.warn("WebGL1 is not supported",t)(),!1)}async attach(r,i={}){var n;let{WebGLDevice:a}=await t.A(276084);if(r instanceof a)return r;let o=a.getDeviceFromContext(r);if(o)return o;if(n=r,!("u">typeof WebGL2RenderingContext&&n instanceof WebGL2RenderingContext)&&(!n||"function"!=typeof n.createVertexArray))throw Error("Invalid WebGL2RenderingContext");i=CE(i),await CT(i);let s=!0===i.createCanvasContext?{}:i.createCanvasContext;return new a({...i,_handle:r,createCanvasContext:{canvas:r.canvas,autoResize:!1,...s}})}async create(r={}){let{WebGLDevice:i}=await t.A(276084);r=CE(r),await CT(r);try{let t=new i(r);bs.log.groupCollapsed(1,`WebGLDevice ${t.id} created`)();let n=`\ 2258${t._reused?"Reusing":"Created"} device with WebGL2 ${t.props.debug?"debug ":""}context: \ 2259${t.info.vendor}, ${t.info.renderer} for canvas: ${t.canvasContext.id}`;return bs.log.probe(1,n)(),bs.log.table(1,t.info)(),t}finally{bs.log.groupEnd(1)(),bs.log.info(1,"%cWebGL call tracing: luma.log.set('debug-webgl') ","color: white; background: blue; padding: 2px 6px; border-radius: 3px;")()}}};function CE(t){return{...t,debug:t.debug??C_.Device.defaultProps.debug,debugWebGL:t.debugWebGL??C_.Device.defaultProps.debugWebGL,debugSpectorJS:t.debugSpectorJS??!!bs.log.get("debug-spectorjs")}}async function CT(t){let r=[];for(let i of((t.debugWebGL||t.debug)&&r.push((0,Cx.loadRegisteredWebGLDeveloperTools)()),t.debugSpectorJS&&r.push((0,Cx.loadRegisteredSpectorJS)(t)),await Promise.allSettled(r)))"rejected"===i.status&&bs.log.error(`Failed to initialize debug libraries ${i.reason}`)()}let CA=0,CS={requestAnimationFrame:t=>{let r;return(r="u">typeof window?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame:null)?r.call(window,t):setTimeout(()=>t("u">typeof performance?performance.now():Date.now()),1e3/60)},cancelAnimationFrame:t=>{let r;(r="u">typeof window?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame:null)?r.call(window,t):clearTimeout(t)}};class CC{static defaultAnimationLoopProps={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>{console.error(t)},stats:void 0,autoResizeViewport:!1,animationFrameProvider:CS};device=null;canvas=null;props;animationProps=null;timeline=null;stats;sharedStats;cpuTime;gpuTime;frameRate;display;_needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;_error=null;_lastFrameTime=0;constructor(t){if(this.props={...CC.defaultAnimationLoopProps,...t},!(t=this.props).device)throw Error("No device provided");this.stats=t.stats||new E1.Stats({id:`animation-loop-${CA++}`}),this.sharedStats=Cp.stats.get("Animation Loop"),this.frameRate=this.stats.get("Frame Rate"),this.frameRate.setSampleSize(1),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.setProps({autoResizeViewport:t.autoResizeViewport,animationFrameProvider:t.animationFrameProvider}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null),this.device?._disableDebugGPUTime()}delete(){this.destroy()}reportError(t){this._error=t,this.props.onError(t),this.props.onError===CC.defaultAnimationLoopProps.onError&&"u">typeof window&&"u">typeof ErrorEvent&&window.dispatchEvent(new ErrorEvent("error",{error:t,message:t.message}))}setNeedsRedraw(t){return this._needsRedraw=this._needsRedraw||t,this}needsRedraw(){let t=this._needsRedraw;return this._needsRedraw=!1,t}setProps(t){if("autoResizeViewport"in t&&(this.props.autoResizeViewport=t.autoResizeViewport||!1),"animationFrameProvider"in t){let r=t.animationFrameProvider||CS;if(r!==this.props.animationFrameProvider){let t=null!==this._animationFrameId;t&&this._cancelAnimationFrame(),this.props.animationFrameProvider=r,t&&this._requestAnimationFrame()}}return this}
2259async start(){if(this._running)return this;this._running=!0;try{let t;if(!this._initialized){if(this._initialized=!0,await this._initDevice(),this._initialize(),!this._running)return null;await this.props.onInitialize(this._getAnimationProps())}if(!this._running)return null;return!1!==t&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this}catch(r){let t=r instanceof Error?r:Error("Unknown error");throw this.props.onError(t),t}}stop(){if(this._running){let t=this.animationProps;this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1,this._lastFrameTime=0,t&&this.props.onFinalize(t)}return this}redraw(t,r=null){return this.device?.isLost||this._error||(this._beginFrameTimers(t),this._setupFrame(),this.animationProps&&(this.animationProps.animationFrame=r),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers()),this}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport(),this.device?._enableDebugGPUTime()}_setDisplay(t){this.display&&(this.display.destroy(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_requestAnimationFrame(){this._running&&(this._animationFrameId=this.props.animationFrameProvider.requestAnimationFrame(this._animationFrame.bind(this)))}_cancelAnimationFrame(){null!==this._animationFrameId&&(this.props.animationFrameProvider.cancelAnimationFrame(this._animationFrameId),this._animationFrameId=null)}_animationFrame(t,r){if(this._running)try{this.redraw(t,r??null),this._requestAnimationFrame()}catch(r){let t=r instanceof Error?r:Error(String(r));this.reportError(t),this.stop()}}_renderFrame(t){if(this.display)return void this.display._renderFrame(t);let r=this.props.onRender(this._getAnimationProps());this.device&&!1!==r&&this.device.submit()}_clearNeedsRedraw(){this._needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){let t=this.device?.getDefaultCanvasContext();if(!this.device||!t)throw Error("loop");let r=t?.canvas,i=t.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:t,canvas:r,useDevicePixels:i,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,animationFrame:null,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:t,height:r,aspect:i}=this._getSizeAndAspect();(t!==this.animationProps.width||r!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),i!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=t,this.animationProps.height=r,this.animationProps.aspect=i,this.animationProps.needsRedraw=this._needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";let r=document.createElement("div");r.style.position="absolute",r.style.left="10px",r.style.bottom="10px",r.style.width="300px",r.style.background="white",this.canvas instanceof HTMLCanvasElement&&t.appendChild(this.canvas),t.appendChild(r);let i=this.props.onAddHTML(r);i&&(r.innerHTML=i)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[t,r]=this.device.getDefaultCanvasContext().getDrawingBufferSize();return{width:t,height:r,aspect:t>0&&r>0?t/r:1}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(t){let r=t??("u">typeof performance?performance.now():Date.now());if(this._lastFrameTime){let t=r-this._lastFrameTime;t>0&&this.frameRate.addTime(t)}this._lastFrameTime=r,this.device?._isDebugGPUTimeEnabled()&&this._consumeEncodedGpuTime(),this.cpuTime.timeStart()}_endFrameTimers(){this.device?._isDebugGPUTimeEnabled()&&this._consumeEncodedGpuTime(),this.cpuTime.timeEnd(),this._updateSharedStats()}_consumeEncodedGpuTime(){if(!this.device)return;let t=this.device.commandEncoder._gpuTimeMs;void 0!==t&&(this.gpuTime.addTime(t),this.device.commandEncoder._gpuTimeMs=void 0)}_updateSharedStats(){if(this.stats!==this.sharedStats){for(let t of Object.keys(this.sharedStats.stats)
2259)this.stats.stats[t]||delete this.sharedStats.stats[t];this.stats.forEach(t=>{let r=this.sharedStats.get(t.name,t.type);r.sampleSize=t.sampleSize,r.time=t.time,r.count=t.count,r.samples=t.samples,r.lastTiming=t.lastTiming,r.lastSampleTime=t.lastSampleTime,r.lastSampleCount=t.lastSampleCount,r._count=t._count,r._time=t._time,r._samples=t._samples,r._startTime=t._startTime,r._timerPending=t._timerPending})}}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(t){t instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[t.offsetX,t.offsetY])}_onMouseleave(t){this._getAnimationProps()._mousePosition=null}}function CM(){}let CD={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,pickAsync:"auto",layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,_canvases:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:CM,onWebGLInitialized:CM,onResize:CM,onViewStateChange:CM,onInteractionStateChange:CM,onBeforeRender:CM,onAfterRender:CM,onLoad:CM,onError:t=>xn.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:({isDragging:t})=>t?"grabbing":"grab",getTooltip:null,debug:!1,drawPickingColors:!1};class CP{constructor(t){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.eventManagers={},this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this._canvasContext=null,this._deviceResizeHandler=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new E1.Stats({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,layersCount:0,drawLayersCount:0,updateLayersCount:0,updateAttributesCount:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,pickLayersCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._hoverPickSequence=0,this._pointerDownPickSequence=0,this._needsRedraw="Initial render",this._canvasManager=new S0({createEventManager:t=>this._createEventManager(t),getEventRoot:t=>this._getEventRoot(t)}),this._ownedCanvas=null,this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,canvasId:void 0,event:null,unproject3D:!1},this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=null,this._onPointerMove=t=>{let{_pickRequest:r}=this,i=this._getCanvasIdFromEvent(t);if("pointerleave"===t.type)r.x=-1,r.y=-1,r.radius=0,r.canvasId=i;else{if(t.leftButton||t.rightButton)return;let n=t.offsetCenter;if(!n)return;r.x=n.x,r.y=n.y,r.radius=this.props.pickingRadius,r.canvasId=i}this.layerManager&&(this.layerManager.context.mousePosition={x:r.x,y:r.y}),r.event=t},this._onEvent=t=>{let r=x6[t.type],i=t.offsetCenter,n=this._getCanvasIdFromEvent(t);if(!r||!i||!this.layerManager)return;let a=this.layerManager.getLayers(),o=this._getInternalPickingMode();if(o){if("sync"===o){let r="click"===t.type&&this._shouldUnproject3D(a)?this._getFirstPickedInfo(this._pickPointSync(this._getPointPickOptions(i.x,i.y,{unproject3D:!0,canvasId:n},a))):this._getLastPointerDownPickingInfo(i.x,i.y,n,a);this._dispatchPickingEvent(r,t);return}(this._lastPointerDownInfoPromise||Promise.resolve(this._getLastPointerDownPickingInfo(i.x,i.y,n,a))).then(r=>{this._dispatchPickingEvent(r,t)}).catch(t=>this.props.onError?.(t))}},this._onPointerDown=t=>{let r=t.offsetCenter,i=this._getCanvasIdFromEvent(t);if(!r)return;let n=this._getInternalPickingMode();if(!n)return;let a=this.layerManager?.getLayers()||[],o=++this._pointerDownPickSequence;if("sync"===n){let t=this._pickPointSync({x:r.x,y:r.y,canvasId:i,radius:this.props.pickingRadius}),n=this._getFirstPickedInfo(t);this._lastPointerDownInfo=n,this._lastPointerDownInfoPromise=Promise.resolve(n);return}let s=this._pickPointAsync(this._getPointPickOptions(r.x,r.y,{canvasId:i},a)).then(t=>this._getFirstPickedInfo(t)).then(t=>(o===this._pointerDownPickSequence&&(this._lastPointerDownInfo=t),t)).catch(t=>{this.props.onError?.(t);let n=this.deckPicker&&this.viewManager?this._getLastPointerDownPickingInfo(r.x,r.y,i,a):{};return o===this._pointerDownPickSequence&&(this._lastPointerDownInfo=n),n});this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=s};const r=t;this.props={...CD,...t}
2259,t=this.props,this._validateCanvasConfiguration(t),t.viewState&&t.initialViewState&&xn.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,t.device&&(this.device=t.device,this._setDeviceCanvasContext(t.device));let i=this.device;!i&&t.gl&&(t.gl instanceof WebGLRenderingContext&&xn.error("WebGL1 context not supported.")(),i=Cw.attach(t.gl,{_cacheShaders:!0,_cachePipelines:!0,...this.props.deviceProps})),i||(i=this._createDevice(t)),this.animationLoop=this._createAnimationLoop(i,t),this.setProps(r),t._typedArrayManagerProps&&Av.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){this._restoreDeviceResizeHandler(),this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._hoverPickSequence++,this._pointerDownPickSequence++,this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,Object.keys(this._canvasManager.targets).length||this.eventManager?.destroy(),this.eventManager=null,this.eventManagers={},this.widgetManager?.finalize(),this.widgetManager=null,this._canvasManager.finalize(),this._isMultiCanvasMode()?this.canvas=null:this.canvas&&this.canvas===this._ownedCanvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null,this._ownedCanvas=null),this._canvasContext=null}setProps(t){this.stats.get("setProps Time").timeStart(),"onLayerHover"in t&&xn.removed("onLayerHover","onHover")(),"onLayerClick"in t&&xn.removed("onLayerClick","onClick")(),t.initialViewState&&!Ak(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),AK(!("_canvases"in t)||Array.isArray(t._canvases)===this._isMultiCanvasMode()),Object.assign(this.props,t),this._validateCanvasConfiguration(this.props),this._validateInternalPickingMode(),this.device&&this._isMultiCanvasMode()&&this._syncCanvasTargets(),this._setCanvasSize(this.props);let r=Object.create(this.props);if(Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState(),eventManagers:this.eventManagers}),t.device&&t.device.id!==this.device?.id){let r=t.device.getDefaultCanvasContext();this.animationLoop?.stop(),this._isMultiCanvasMode()||this.canvas===r.canvas||(this.canvas?.remove(),this.eventManager?.destroy(),this.canvas=null),this._setDeviceCanvasContext(t.device),xn.log(`recreating animation loop for new device! id=${t.device.id}`)(),this.animationLoop=this._createAnimationLoop(t.device,t),this.animationLoop.start()}if(this.animationLoop?.setProps(r),void 0!==t.useDevicePixels&&this._canvasContext?.setProps)for(let r of(this._canvasContext.setProps({useDevicePixels:t.useDevicePixels}),Object.values(this._canvasManager.targets)))r.presentationContext.setProps({useDevicePixels:t.useDevicePixels});this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r),this.widgetManager.setProps(r)),this.stats.get("setProps Time").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);let i=this.viewManager.needsRedraw(t),n=this.layerManager.needsRedraw(t),a=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return r||i||n||a||o}redraw(t){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});(r=t||r)&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return null!==this.viewManager}getViews(){return AK(this.viewManager),this.viewManager.views}getView(t){return AK(this.viewManager),this.viewManager.getView(t)}getViewports(t){return AK(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}getCanvasContext(t){let r=t?this.viewManager?.getView(t)?.props.canvasId:void 0;return this._getCanvasContext(r)}getEventManager(t){if(!t||!this.viewManager)return this.eventManager;let r=this.viewManager.getCanvasId(t)||AO;return this.eventManagers[r]||this.eventManager}async pickObjectAsync(t){let r=(await this._pickAsync("pickObjectAsync","pickObject Time",t)).result;return r.length?r[0]:null}async pickObjectsAsync(t){return await this._pickAsync("pickObjectsAsync","pickObjects Time",t)}pickObject(t){let r=this._pick("pickObject","pickObject Time",t).result;return r.length?r[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick("pickObject","pickMultipleObjects Time",t).result}pickObjects(t){return this._pick("pickObjects","pickObjects Time",t)}_pickPositionForController(t,r,i){return"sync"!==this._getInternalPickingMode()?null:this.pickObject({x:t,y:r,radius:0,unproject3D:!0,canvasId:i?this.viewManager?.getCanvasId(i):void 0})}_addResources(t,r=!1){for(let i in t)this.layerManager.resourceManager.add({resourceId:i,data:t[i],force
2259Update:r})}_removeResources(t){for(let r of t)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_addDefaultShaderModule(t){this.layerManager.addDefaultShaderModule(t)}_removeDefaultShaderModule(t){this.layerManager?.removeDefaultShaderModule(t)}_resolveInternalPickingMode(){let{pickAsync:t}=this.props,r=this.device?.type||this.props.deviceProps?.type;if("auto"===t)return"webgpu"===r?"async":"sync";if("sync"===t&&"webgpu"===r)throw Error('`pickAsync: "sync"` is not supported when Deck is using a WebGPU device.');return t}_getInternalPickingMode(){try{return this._resolveInternalPickingMode()}catch(t){return this.props.onError?.(t),null}}_validateInternalPickingMode(){this._getInternalPickingMode()}_getFirstPickedInfo({result:t,emptyInfo:r}){return t[0]||r}_shouldUnproject3D(t=this.layerManager?.getLayers()||[]){return t.some(t=>"3d"===t.props.pickable)}_getPointPickOptions(t,r,i={},n=this.layerManager?.getLayers()||[]){return{x:t,y:r,canvasId:i.canvasId,radius:this.props.pickingRadius,unproject3D:this._shouldUnproject3D(n),...i}}_pickPointSync(t){return this._pick("pickObject","pickObject Time",t)}_pickPointAsync(t){return this._pickAsync("pickObjectAsync","pickObject Time",t)}_getLastPointerDownPickingInfo(t,r,i,n=this.layerManager?.getLayers()||[]){return this.deckPicker.getLastPickedObject({x:t,y:r,layers:n,viewports:this.getViewports({x:t,y:r,canvasId:i})},this._lastPointerDownInfo)}_applyHoverCallbacks({result:t,emptyInfo:r},i){if(!this.widgetManager)return;this.cursorState.isHovering=t.length>0;let n=r,a=!1;for(let r of t)n=r,a=r.layer?.onHover(r,i)||a;a||(this.props.onHover?.(n,i),this.widgetManager.onHover(n,i))}_dispatchPickingEvent(t,r){if(!this.layerManager||!this.widgetManager)return;let i=x6[r.type];if(!i)return;let{layer:n}=t,a=n&&(n[i]||n.props[i]),o=this.props[i],s=!1;a&&(s=a.call(n,t,r)),s||(o?.(t,r),this.widgetManager.onEvent(t,r))}_pickAsync(t,r,i){AK(this.deckPicker);let{stats:n}=this,a=this._isMultiCanvasMode()?i.canvasId||this._getDefaultCanvasId():i.canvasId,o=this._getCanvasContext(a)||void 0;n.get("Pick Count").incrementCount(),n.get(r).timeStart(),this._resizeForCanvasTarget(a);let s=this.deckPicker[t]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports({...i,canvasId:a}),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i,canvasId:a,canvasContext:o});return n.get(r).timeEnd(),s}_pick(t,r,i){AK(this.deckPicker);let{stats:n}=this,a=this._isMultiCanvasMode()?i.canvasId||this._getDefaultCanvasId():i.canvasId,o=this._getCanvasContext(a)||void 0;n.get("Pick Count").incrementCount(),n.get(r).timeStart(),this._resizeForCanvasTarget(a);let s=this.deckPicker[t]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports({...i,canvasId:a}),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i,canvasId:a,canvasContext:o});return n.get(r).timeEnd(),s}_createCanvas(t){let r=t.canvas;return"string"==typeof r&&AK(r=document.getElementById(r)),r?this._ownedCanvas=null:((r=document.createElement("canvas")).id=t.id||"deckgl-overlay",t.width&&"number"==typeof t.width&&(r.width=t.width),t.height&&"number"==typeof t.height&&(r.height=t.height),(t.parent||document.body).appendChild(r),this._ownedCanvas=r),Object.assign(r.style,t.style),r}_isMultiCanvasMode(){return Array.isArray(this.props._canvases)}_getDefaultCanvasId(){return this._canvasManager.order[0]||AO}_validateCanvasConfiguration(t){Array.isArray(t._canvases)&&(AK(!t.canvas),AK(!t.gl),AK(!t.device?.canvasContext||t.device.getDefaultCanvasContext().offscreenCanvas))}_createEventManager(t){let r=new x1(t,{touchAction:this.props.touchAction,recognizers:Object.keys(x5).map(t=>{let[r,i,n,a]=x5[t],o=this.props.eventRecognizerOptions?.[t];return{recognizer:new r({...i,...o,event:t}),recognizeWith:n,requireFailure:a}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let t in x6)"dblclick"===t?r.watch(t,this._onEvent):r.on(t,this._onEvent);return r}_getEventRoot(t){return t.closest(".deck-events-root")||this.props.parent?.querySelector(".deck-events-root")||t}_syncCanvasTargets(){if(!this.device||!this._isMultiCanvasMode())return;this._canvasManager.syncCanvasEntries({device:this.device,canvases:this.props._canvase
2259s||[],useDevicePixels:this.props.useDevicePixels}),this.eventManagers=this._canvasManager.eventManagers;let t=this._getDefaultCanvasId();this.eventManager=this.eventManagers[t]||null,this.canvas=this._canvasManager.targets[t]?.canvas||null}_setCanvasContext(t){this._canvasContext=t,"style"in t.canvas&&(this.canvas=t.canvas)}_setDeviceCanvasContext(t,r={}){let i=t.getDefaultCanvasContext();this._setCanvasContext(i),this._setDeviceResizeHandler(t,r)}_setDeviceResizeHandler(t,r={}){let i=!!r.syncDrawingBuffer;if(this._deviceResizeHandler?.device===t){this._deviceResizeHandler.syncDrawingBuffer=i;return}this._restoreDeviceResizeHandler();let n=t=>{this._isMultiCanvasMode()?this._updateMultiCanvasDimensions():t===this._canvasContext&&this._canvasContext&&this._onCanvasContextResize(this._canvasContext,{syncDrawingBuffer:this._deviceResizeHandler?.syncDrawingBuffer})};t.props.onResize=n,this._deviceResizeHandler={device:t,onResize:n,syncDrawingBuffer:i}}_restoreDeviceResizeHandler(){let t=this._deviceResizeHandler;t&&t.device.props?.onResize===t.onResize&&(t.device.props.onResize=CM),this._deviceResizeHandler=null}_setCanvasSize(t){if(this._isMultiCanvasMode()||!this.canvas)return;let{width:r,height:i}=t;if(r||0===r){let t=Number.isFinite(r)?`${r}px`:r;this.canvas.style.width=t}if(i||0===i){let r=Number.isFinite(i)?`${i}px`:i;this.canvas.style.position=t.style?.position||"absolute",this.canvas.style.height=r}}_getCanvasIdFromEvent(t){return this._canvasManager.getCanvasIdFromEvent(t?.rootElement)}_getCanvasContext(t){return this._canvasManager.getTarget(t)?.presentationContext||this._canvasContext}_resizeForCanvasTarget(t){let r=this._canvasManager.getTarget(t);if(!r||!this.device?.canvasContext)return;let[i,n]=r.presentationContext.getDrawingBufferSize();this.device.canvasContext.setDrawingBufferSize(i,n)}_createDeviceCanvas(t){if(this._isMultiCanvasMode()){let r=globalThis.OffscreenCanvas;if(!r)throw Error("`_canvases` requires OffscreenCanvas support.");return new r("number"==typeof t.width&&Number.isFinite(t.width)?t.width:1,"number"==typeof t.height&&Number.isFinite(t.height)?t.height:1)}return this._createCanvas(t)}_updateCanvasSize(t=this._canvasContext){if(this._isMultiCanvasMode())return void this._updateMultiCanvasDimensions();let{canvas:r}=this,[i,n]=t?t.getCSSSize():[r?.clientWidth??r?.width??0,r?.clientHeight??r?.height??0];(i!==this.width||n!==this.height)&&(this.width=i,this.height=n,this.viewManager?.setProps({width:i,height:n}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:i,height:n},t||void 0))}_onCanvasContextResize(t,r={}){if(r.syncDrawingBuffer){let{width:r,height:i}=t.canvas;t.setDrawingBufferSize(r,i)}this._needsRedraw="Canvas resized",this._updateCanvasSize(t)}_updateMultiCanvasDimensions(){let[t,r]=this._getCanvasContext()?.getCSSSize()||[0,0];(t!==this.width||r!==this.height)&&(this.width=t,this.height=r,this.props.onResize({width:t,height:r})),this._needsRedraw="Canvas resized",this.viewManager?.setNeedsUpdate("Canvas resized"),this.viewManager?.setProps({width:this.width,height:this.height})}_createAnimationLoop(t,r){let{gl:i,onError:n}=r;return new CC({device:t,autoResizeDrawingBuffer:!i&&!Array.isArray(r._canvases),autoResizeViewport:!1,onInitialize:t=>this._setDevice(t.device),onRender:this._onRenderFrame.bind(this),onError:n})}_createDevice(t){let r=this.props.deviceProps?.createCanvasContext,i={adapters:[],_cacheShaders:!0,_cachePipelines:!0,...t.deviceProps};i.adapters.includes(Cw)||i.adapters.push(Cw);let n={alphaMode:this.props.deviceProps?.type==="webgpu"?"premultiplied":void 0};return Cp.createDevice({_reuseDevices:!0,type:"webgl",...i,createCanvasContext:{...n,..."object"==typeof r?r:void 0,canvas:this._createDeviceCanvas(t),useDevicePixels:this.props.useDevicePixels,autoResize:!0}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:t}=this.props,r=Array.isArray(t)?t:t?[t]:[new Sd({id:"default-view"})];return r.length&&this.props.controller&&(r[0]=r[0].clone({controller:this.props.controller})),r}_onContextLost(){let{onError:t}=this.props;this.animationLoop&&t&&t(Error("WebGL context is lost"))}_pickAndCallback(){let{_pickRequest:t}=this;if(t.event){let r=t.event,i=this.layerManager?.getLayers()||[],n=this._getPointPickOptions(t.x,t.y,{canvasId:t.canvasId,radius:t.radius,mode:t.mode},i),a=this._getInternalPickingMode(),o=++this._hoverPickSequence;if(t.event=null,t.canvasId=void 0,!a)return;if("sync"===a)return void this._applyHoverCallbacks(this._pickPointSync(n),r);this._pickPointAsync(n).then(({result:t,emptyInfo:i})=>{o===this._hoverPickSequence&&this._applyHoverCallbacks({result:t,emptyInfo:i},r)}).catch(t=>this.props.onError?.(t))}}
2259_updateCursor(){let t=this.props.getCursor(this.cursorState);if(this._isMultiCanvasMode()){for(let r of Object.values(this._canvasManager.targets))r.canvas.style.cursor=t;return}let r=this.props.parent||this.canvas;r&&(r.style.cursor=t)}_setDevice(t){if(this.device=t,this._validateInternalPickingMode(),!this.animationLoop)return;this._setDeviceCanvasContext(t,{syncDrawingBuffer:!!(this.props.gl&&this.props.device!==t)}),this._isMultiCanvasMode()?this._syncCanvasTargets():this.canvas&&!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild),"webgl"===this.device.type&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),"webgl"===this.device.type&&this.props.onWebGLInitialized(this.device.gl);let r=new be;if(r.play(),this.animationLoop.attachTimeline(r),!this._isMultiCanvasMode()){let t=this.canvas&&this._getEventRoot(this.canvas);AK(t),this.eventManager=this._createEventManager(t),this.eventManagers={[AO]:this.eventManager}}this.viewManager=new AN({timeline:r,eventManager:this.eventManager,eventManagers:this.eventManagers,getCanvasContext:this._isMultiCanvasMode()?this.getCanvasContext.bind(this):void 0,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),pickPosition:this._pickPositionForController.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let i=this.viewManager.getViewports()[0];this.layerManager=new AI(this.device,{deck:this,stats:this.stats,viewport:i,timeline:r}),this.effectManager=new SI({deck:this,device:this.device}),this.deckRenderer=new SF(this.device,{stats:this.stats}),this.deckPicker=new SH(this.device,{stats:this.stats});let n=this.props.parent?.querySelector(".deck-widgets-root")||(this._isMultiCanvasMode()?this.props.parent||this.canvas?.parentElement:null)||this.canvas?.parentElement;this.widgetManager=new SY({deck:this,parentElement:n}),this.widgetManager.addDefault(new SJ),this.setProps({}),this._updateCanvasSize(this._canvasContext),this.props.onLoad()}_drawLayers(t,r){let{device:i,gl:n}=this.layerManager.context;this.props.onBeforeRender({device:i,gl:n});let a={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...r};if(this._isMultiCanvasMode()&&"screen"===a.pass&&!a.target&&this._canvasManager.order.length)for(let t of this._canvasManager.order){let r=a.viewports.filter(r=>this.viewManager.getCanvasId(r.id)===t);if(!r.length){let r=this._canvasManager.targets[t];this._resizeForCanvasTarget(t),this.deckRenderer?.renderLayers({...a,canvasContext:r.presentationContext,target:r.presentationContext.getCurrentFramebuffer(),viewports:[],clearCanvas:!0}),r.presentationContext.present();continue}let i=this._canvasManager.targets[t];this._resizeForCanvasTarget(t);let n=i.presentationContext.getCurrentFramebuffer();this.deckRenderer?.renderLayers({...a,canvasContext:i.presentationContext,target:n,viewports:r}),i.presentationContext.present()}else this.deckRenderer?.renderLayers(a);"screen"===a.pass&&this.widgetManager.onRedraw({viewports:a.viewports,layers:a.layers}),this.props.onAfterRender({device:i,gl:n})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60==0&&(this._getMetrics(),this.stats.reset(),xn.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCursor(),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){let r=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:r},!this.props.viewState&&this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}
2259_getFrameStats(){let{stats:t}=this;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();let r=this.animationLoop.stats;t.get("GPU Time").addTime(r.get("GPU Time").lastTiming),t.get("CPU Time").addTime(r.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:t,stats:r}=this;t.fps=r.get("frameRate").getHz(),t.setPropsTime=r.get("setProps Time").time,t.updateAttributesTime=r.get("Update Attributes").time,t.framesRedrawn=r.get("Redraw Count").count,t.pickTime=r.get("pickObject Time").time+r.get("pickMultipleObjects Time").time+r.get("pickObjects Time").time,t.pickCount=r.get("Pick Count").count,t.layersCount=this.layerManager?.layers.length??0,t.drawLayersCount=r.get("Layers rendered").lastSampleCount,t.pickLayersCount=r.get("Layers picked").lastSampleCount,t.updateLayersCount=r.get("Layer updates").count,t.updateAttributesCount=r.get("Attributes updated").count,t.gpuTime=r.get("GPU Time").time,t.cpuTime=r.get("CPU Time").time,t.gpuTimePerFrame=r.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=r.get("CPU Time").getAverageTime();let i=Cp.stats.get("GPU Time and Memory");t.bufferMemory=i.get("Buffer Memory").count,t.textureMemory=i.get("Texture Memory").count,t.renderbufferMemory=i.get("Renderbuffer Memory").count,t.gpuMemory=i.get("GPU Memory").count}}CP.defaultProps=CD,CP.VERSION=Cu;var Eu=Eu,xr=xr;let CI=Math.PI/180,Ck=180/Math.PI;function CO(t){return 1>Math.abs(Ab(t+180,360)-180)}class CN extends AP{constructor(t={}){const{longitude:r=0,bearing:i=0,pitch:n=0,zoom:a=0,nearZMultiplier:o=.5,farZMultiplier:s=1,resolution:l=10}=t;let{latitude:u=0,height:c,altitude:h=1.5,fovy:f}=t;u=Math.max(Math.min(u,90),-90),c=c||1,f?h=Ex(f):f=Eb(h);const d=Math.pow(2,a-CL(Math.max(Math.min(u,85.051129),-85.051129))),p=n*CI,m=t.nearZ??o,g=t.farZ??(h+512*d/c/Math.max(Math.cos(p),.1))*s,y=new Ei().lookAt({eye:[0,-h,0],up:[0,0,1]}).rotateX(-p).rotateY(-i*CI).rotateX(u*CI).rotateZ(-r*CI).scale(d/c);super({...t,height:c,viewMatrix:y,longitude:r,latitude:u,zoom:a,distanceScales:function(){let t=Math.PI/180*256;return{unitsPerMeter:[4018225162502676e-20,4018225162502676e-20,4018225162502676e-20],unitsPerMeter2:[0,0,0],metersPerUnit:[24886.609375,24886.609375,24886.609375],unitsPerDegree:[t,t,4018225162502676e-20],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/t,1/t,24886.609375]}}(),fovy:f,focalDistance:h,near:m,far:g}),this.scale=d,this.latitude=u,this.longitude=r,this.bearing=i,this.pitch=n,this.fovy=f,this.resolution=l}get projectionMode(){return x3.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(t={}){let r={targetZ:t.z||0},i=this.unproject([0,this.height/2],r),n=this.unproject([this.width/2,0],r),a=this.unproject([this.width,this.height/2],r),o=this.unproject([this.width/2,this.height],r);return a[0]<this.longitude&&(a[0]+=360),i[0]>this.longitude&&(i[0]-=360),[Math.min(i[0],a[0],n[0],o[0]),Math.min(i[1],a[1],n[1],o[1]),Math.max(i[0],a[0],n[0],o[0]),Math.max(i[1],a[1],n[1],o[1])]}_getRayToGlobe(t,{topLeft:r=!0,targetZ:i}={}){let[n,a]=t,o=r?a:this.height-a,{pixelUnprojectionMatrix:s}=this,l=CR(s,[n,o,-1,1]),u=CR(s,[n,o,1,1]),c=Eu.sqrLen(Eu.sub([],l,u)),h=Eu.sqrLen(l),f=Eu.sqrLen(u),d=(4*h*f-(c-h-f)**2)/16*4/c;return{rayStartPosition:l,rayEndPosition:u,radius:((i||0)/6370972+1)*256,rayLengthSquared:c,rayStartDistanceSquared:h,distanceToCenterSquared:d}}_getRayDistanceToGlobeCenterRatio(t,r){let{distanceToCenterSquared:i,radius:n}=this._getRayToGlobe(t,r);return Math.sqrt(Math.max(0,i))/n}getZoomAnchorStrength(t){let r=this._getRayDistanceToGlobeCenterRatio(t);if(r>=1.15)return 0;let i=Math.max(0,Math.min(1,(r-.75)/.3999999999999999));return 1-i*i*(3-2*i)}unproject(t,{topLeft:r=!0,targetZ:i}={}){let n,[a,o,s]=t,l=r?o:this.height-o,{pixelUnprojectionMatrix:u}=this;if(Number.isFinite(s))n=CR(u,[a,l,s,1]);else{let{rayStartPosition:a,rayEndPosition:o,radius:s,rayLengthSquared:l,rayStartDistanceSquared:u,distanceToCenterSquared:c}=this._getRayToGlobe(t,{topLeft:r,targetZ:i}),h=(Math.sqrt(u-c)-Math.sqrt(Math.max(0,s*s-c)))/Math.sqrt(l);n=Eu.lerp([],a,o,h)}let[c,h,f]=this.unprojectPosition(n);return Number.isFinite(s)?[c,h,f]:Number.isFinite(i)?[c,h,i]:[c,h]}projectPosition(t){let[r,i,n=0]=t,a=r*CI,o=i*CI,s=Math.cos(o),l=(n/6370972+1)*256;return[Math.sin(a)*s*l,-Math.cos(a)*s*l,Math.sin(o)*l]}unprojectPosition(t){let[r,i,n]=t,a=Eu.len(t);return[Math.atan2(r,-i)*Ck,Math.asin(n/a)*Ck,(a/256-1)*6370972]}projectFlat(t){return t}unprojectFlat(t){return t}panByPosition(t,r,i){if(!i){let i=this.getZoomAnchorStrength(r);if(0===i)return{longitude:this.longitude,latitude:this.latitude};let n=this.unproject(r),a=Ab(t[0]-n[0]+180,360)-180,o=t[1]-n[1],s=Math.abs(n[1])>85.051129||Math.abs(a)>90;return CO(this.bearing)&&s?{longitude:this.longitude,latitude:this.latitude}:(CO(this.bearing)&&0!==o&&(i=Math.min(i,Math.max(0,((o>0?85.051129:-85.051129)-this.latitude)/o))),{longitude:this.longitude+a*i,latitude:Math.max(Math.min(this.latitude+o*i,90),-90)})}let[n,a,o]=t,s=.25/Math.pow(2,this.zoom-CL(this.latitude)),l=n+s*(i[0]-r[0]),u=a-s*(i[1]-r[1]),c={longitude:l,latitude:u=Math.max(Math.min(u,90),-90),zoom:o-CL(a)};return c.zoom+=CL(c.latitude),c}}function CL(t,r){return r&&(t=Math.max(Math.min(t,85.051129),-85.051129)),Math.log2(Math.PI*Math.cos(t*Math.PI/180)
2259)}function CR(t,r){let i=xr.transformMat4([],r,t);return xr.scale(i,i,1/i[3]),i}CN.displayName="GlobeViewport";var Eu=Eu;class CF extends wM{static get ZERO(){return z||Object.freeze(z=new CF(0,0,0,0)),z}constructor(t=0,r=0,i=0,n=0){super(-0,-0,-0,-0),wb(t)&&1==arguments.length?this.copy(t):(w_.debug&&(wA(t),wA(r),wA(i),wA(n)),this[0]=t,this[1]=r,this[2]=i,this[3]=n)}set(t,r,i,n){return this[0]=t,this[1]=r,this[2]=i,this[3]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return w_.debug&&(wA(t.x),wA(t.y),wA(t.z),wA(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=wA(t)}get w(){return this[3]}set w(t){this[3]=wA(t)}transform(t){return wU(this,this,t),this.check()}transformByMatrix3(t){return wX(this,this,t),this.check()}transformByMatrix2(t){let r,i;return r=this[0],i=this[1],this[0]=t[0]*r+t[2]*i,this[1]=t[1]*r+t[3]*i,this[2]=this[2],this[3]=this[3],this.check()}transformByQuaternion(t){return w$(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}}function CB(t,r,i){let n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],u=r[5],c=r[6],h=r[7],f=r[8],d=i[0],p=i[1],m=i[2],g=i[3],y=i[4],v=i[5],_=i[6],b=i[7],x=i[8];return t[0]=d*n+p*s+m*c,t[1]=d*a+p*l+m*h,t[2]=d*o+p*u+m*f,t[3]=g*n+y*s+v*c,t[4]=g*a+y*l+v*h,t[5]=g*o+y*u+v*f,t[6]=_*n+b*s+x*c,t[7]=_*a+b*l+x*h,t[8]=_*o+b*u+x*f,t}function Cz(t,r,i){let n=i[0],a=i[1];return t[0]=n*r[0],t[1]=n*r[1],t[2]=n*r[2],t[3]=a*r[3],t[4]=a*r[4],t[5]=a*r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t}function Cj(){let t=new bC(4);return bC!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function CU(t,r,i){let n=Math.sin(i*=.5);return t[0]=n*r[0],t[1]=n*r[1],t[2]=n*r[2],t[3]=Math.cos(i),t}function CV(t,r,i){let n=r[0],a=r[1],o=r[2],s=r[3],l=i[0],u=i[1],c=i[2],h=i[3];return t[0]=n*h+s*l+a*c-o*u,t[1]=a*h+s*u+o*l-n*c,t[2]=o*h+s*c+n*u-a*l,t[3]=s*h-n*l-a*u-o*c,t}let C$=(J=wD(),ee=wI(1,0,0),et=wI(0,1,0),function(t,r,i){let n=wz(r,i);return n<-.999999?(wj(J,ee,r),1e-6>wP(J)&&wj(J,et,r),wB(J,J),CU(t,J,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(wj(J,r,i),t[0]=J[0],t[1]=J[1],t[2]=J[2],t[3]=1+n,b5(t,t))});Cj(),Cj(),er=new bC(9),bC!=Float32Array&&(er[1]=0,er[2]=0,er[3]=0,er[5]=0,er[6]=0,er[7]=0),er[0]=1,er[4]=1,er[8]=1;let CG=[0,0,0,1];class Cq extends wT{constructor(t=0,r=0,i=0,n=1){super(-0,-0,-0,-0),Array.isArray(t)&&1==arguments.length?this.copy(t):this.set(t,r,i,n)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,i,n){return this[0]=t,this[1]=r,this[2]=i,this[3]=n,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return!function(t,r){let i,n=r[0]+r[4]+r[8];if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,i=.5/i,t[0]=(r[5]-r[7])*i,t[1]=(r[6]-r[2])*i,t[2]=(r[1]-r[3])*i;else{let n=0;r[4]>r[0]&&(n=1),r[8]>r[3*n+n]&&(n=2);let a=(n+1)%3,o=(n+2)%3;i=Math.sqrt(r[3*n+n]-r[3*a+a]-r[3*o+o]+1),t[n]=.5*i,i=.5/i,t[3]=(r[3*a+o]-r[3*o+a])*i,t[a]=(r[3*a+n]+r[3*n+a])*i,t[o]=(r[3*o+n]+r[3*n+o])*i}}(this,t),this.check()}fromAxisRotation(t,r){return CU(this,t,r),this.check()}identity(){return this[0]=0,this[1]=0,this[2]=0,this[3]=1,this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=wA(t)}get y(){return this[1]}set y(t){this[1]=wA(t)}get z(){return this[2]}set z(t){this[2]=wA(t)}get w(){return this[3]}set w(t){this[3]=wA(t)}len(){return b4(this)}lengthSquared(){return b6(this)}dot(t){return b8(this,t)}rotationTo(t,r){return C$(this,t,r),this.check()}add(t){return bK(this,this,t),this.check()}calculateW(){let t,r,i;return t=this[0],r=this[1],i=this[2],this[0]=t,this[1]=r,this[2]=i,this[3]=Math.sqrt(Math.abs(1-t*t-r*r-i*i)),this.check()}conjugate(){return this[0]=-this[0],this[1]=-this[1],this[2]=-this[2],this[3]=this[3],this.check()}invert(){let t,r,i,n,a,o;return t=this[0],r=this[1],i=this[2],o=(a=t*t+r*r+i*i+(n=this[3])*n)?1/a:0,this[0]=-t*o,this[1]=-r*o,this[2]=-i*o,this[3]=n*o,this.check()}lerp(t,r,i){return void 0===i?this.lerp(this,t,r):(b7(this,t,r,i),this.check())}multiplyRight(t){return CV(this,this,t),this.check()}multiplyLeft(t){return CV(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,0===t&&(this[3]=1),this.check()}rotateX(t){var r;let i,n,a,o,s,l;return r=.5*t,i=this[0],n=this[1],a=this[2],o=this[3],s=Math.sin(r),l=Math.cos(r),this[0]=i*l+o*s,this[1]=n*l+a*s,this[2]=a*l-n*s,this[3]=o*l-i*s,this.check()}rotateY(t){var r;let i,n,a,o,s,l;return r=.5*t,i=this[0],n=this[1],a=this[2],o=this[3],s=Math.sin(r),l=Math.cos(r),this[0]=i*l-a*s,this[1]=n*l+o*s,this[2]=a*l+i*s,this[3]=o*l-n*s,this.check()}rotateZ(t){var r;let i,n,a,o,s,l;return r=.5*t,i=this[0],n=this[1],a=this[2],o=this[3],s=Math.sin(r),l=Math.cos(r),this[0]=i*l+n*s,this[1]=n*l-i*s,this[2]=a*l+o*s,this[3]=o*l-a*s,this.check()}scale(t){return b1(this,this,t),this.check()}slerp(t,r,i){var n,a,o;let s,l,u,c,h,f,d,p,m,g,y,v,_,b,x,w;switch(arguments.length){case 1:({start:s=CG,target:l,ratio:u}=t);break;case 2:s=this,l=t,u=r;break;default:s=t,l=r,u=i}return n=s,a=l,o=u,m=n[0],g=n[1],y=n[2],v=n[3],_=a[0],b=a[1],(c=m*_+g*b+y*(x=a[2])+v*(w=a[3]))<0&&(c=-c,_=-_,b=-b,x=-x,w=-w),1-c>1e-6?(p=Math.sin(h=Math.acos(c)),f=Math.sin((1-o)*h)/p,d=Math.sin(o*h)/p):(f=1-o,d=o),this[0]=f*m+d*_,this[1]=f*g+d*b,this[2]=f*y+d*x,this[3]=f*v+d*w,this.check()}transformVector4(t,r=new CF){return xe(r,t,this),wS(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}let CH=Math.PI/180,CW=180/Math.PI;class CZ{static toPosition(t,r){let i=r*CH,n=t*CH,a=Math.cos(i);return[a*Math.cos(n),a*Math.sin(n),Math.sin(i)]}static toLngLat(t){return[Math.atan2(t[1],t[0])*CW,Math.asin(wx(t[2],-1,1))*CW]}static tangentBasis(t,r){let i=r*CH,n=t*CH,a=Math.sin(i),o=Math.sin(n),s=Math.cos(n);return{N:[-a*s,-a*o,Math.cos(i)],E:[-o,s,0]}}static upVector(t,r,i){let{N:n,E:a}=CZ.tangentBasis(t,r),o=i*CH,s=Math.cos(o),l=Math.sin(o);return[n[0]*s+a[0]*l,n[1]*s+a[1]*l,n[2]*s+a[2]*l]}static bearing(t,r,i){let{N:n,E:a}=CZ.tangentBasis(r,i);return Math.atan2(Eu.dot(t,a),Eu.dot(t,n))*CW}static cameraFrame(t,r,i){let n=CZ.toPosition(t,r),a=CZ.upVector(t,r,i),{N:o,E:s}=CZ.tangentBasis(t,r),l=i*CH,u=Math.cos(l),c=Math.sin(l),h=[s[0]*u-o[0]*c,s[1]*u-o[1]*c,s[2]*u-o[2]*c];return{position:n,up:a,axisHorizontal:Eu.cross([],n,h),axisVertical:Eu.cross([],n,a),longitude:t,latitude:r,bearing:i}}static angularDistance(t,r){let i=CZ.toPosition(t.longitude,t.latitude),n=CZ.toPosition(r.longitude,r.latitude);return Math.acos(wx(Eu.dot(i,n),-1,1))}static greatCircleAxis(t,r){let i=CZ.toPosition(t.longitude,t.latitude),n=CZ.toPosition(r.longitude,r.latitude);return Eu.normalize([],Eu.cross([],i,n))}static rotate(t,r,i){let n=new Cq().fromAxisRotation(r,i);return Eu.transformQuat([],t,n)}static rotateFrame(t,r,i,n){let a=CZ.rotate(t.position,t.axisHorizontal,r);a=CZ.rotate(a,t.axisVertical,i);let o=CZ.rotate(t.up,t.axisHorizontal,r);o=CZ.rotate(o,t.axisVertical,i);let[s,l]=CZ.toLngLat(a),u=n?0:CZ.bearing(o,s,l);return{...t,position:a,up:o,longitude:s,latitude:l,bearing:u}}static rotateFrameToMatch(t,r,i,n=1){let a=CZ.toPosition(...r),o=CZ.toPosition(...i),s=Eu.cross([],a,o),l=Eu.len(s),u=wx(Eu.dot(a,o),-1,1);if(l<1e-12){if(u>0)return t;s=Eu.cross([],a,t.up),1e-12>Eu.len(s)&&(s=Eu.cross([],a,t.axisVertical))}Eu.normalize(s,s);let c=Math.atan2(l,u)*wx(n,0,1),h=CZ.rotate(t.position,s,c),f=CZ.rotate(t.up,s,c),[d,p]=CZ.toLngLat(h);return{...t,position:h,up:f,longitude:d,latitude:p,bearing:CZ.bearing(f,d,p)}}}let CY=1/(1-Math.exp(-5)),CX=t=>(1-Math.exp(-5*t))*CY;class CK extends AQ{constructor(t){const r="axis"in t;super({compare:["longitude","latitude"],extract:r?["longitude","latitude","zoom","bearing"]:["longitude","latitude","zoom"],required:["longitude","latitude"]}),r?(this._mode="rotation",this._axis=t.axis,this._totalAngle=t.totalAngle):(this._mode="linear",this._targetL
2259ongitude=t.targetLongitude)}initializeProps(t,r){let i=super.initializeProps(t,r);return this._startZoom=t.zoom,"rotation"===this._mode?this._startFrame={...CZ.cameraFrame(t.longitude,t.latitude,t.bearing||0),axisHorizontal:this._axis}:i.end.longitude=this._targetLongitude,i}interpolateProps(t,r,i){if("rotation"===this._mode){let{longitude:t,latitude:r,bearing:n}=CZ.rotateFrame(this._startFrame,this._totalAngle*i,0),a=this._startZoom+CL(r,!0)-CL(this._startFrame.latitude,!0);return{bearing:n,longitude:t,latitude:r,zoom:a}}let n=t.longitude+(r.longitude-t.longitude)*i,a=t.latitude+(r.latitude-t.latitude)*i,o=this._startZoom+CL(a,!0)-CL(t.latitude,!0);return{longitude:n,latitude:a,zoom:o}}}let CQ=Math.PI/180,CJ=180/Math.PI;function C0(t,r=0){return 512*Math.sin(Math.min(180,t)*CQ/2)*Math.pow(2,r)}function C1(t,r=0){return 2*Math.asin(Math.min(1,t/Math.pow(2,r)/256/2))*CJ}class C2 extends Sh{constructor(t){const{startPanPos:r,startPanCameraFrame:i,startPanAngularRate:n,...a}=t;a.normalize=!1,super(a);const o=this._state;void 0!==r&&(o.startPanPos=r),void 0!==i&&(o.startPanCameraFrame=i),void 0!==n&&(o.startPanAngularRate=n)}panStart({pos:t}){let{latitude:r,longitude:i,zoom:n,bearing:a=0}=this.getViewportProps(),o=CZ.cameraFrame(i,r,a),s=Math.pow(2,n-CL(r,!0));return this._getUpdatedState({startPanPos:t,startPanCameraFrame:o,startPanAngularRate:.25/s*CQ,startZoom:n})}pan({pos:t,startPos:r}){let i=this.getState(),n=i.startPanPos||r;if(!n)return this;let a=i.startPanCameraFrame,o=i.startPanAngularRate,s=i.startZoom??this.getViewportProps().zoom;if(!a||!o)return this;let l=n[0]-t[0],u=n[1]-t[1],c=CZ.rotateFrame(a,l*o,-u*o),h=s+CL(c.latitude,!0)-CL(a.latitude,!0);return this._getUpdatedState({longitude:c.longitude,latitude:c.latitude,bearing:c.bearing,zoom:h})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanCameraFrame:null,startPanAngularRate:null,startZoom:null})}_panFromCenter(t){let{width:r,height:i}=this.getViewportProps(),n=[r/2,i/2];return this.panStart({pos:n}).pan({pos:[n[0]+t[0],n[1]+t[1]]}).panEnd()}applyConstraints(t){let r=t[Sn];delete t[Sn];let{latitude:i,maxBounds:n}=t;if(t.zoom=this._constrainZoom(t.zoom,t),r){let i=this.makeViewport(t),n=i.getZoomAnchorStrength(r.screenPosition);if(n>0){let a=i.unproject(r.screenPosition),o=CZ.cameraFrame(t.longitude,t.latitude,t.bearing||0),s=CZ.rotateFrameToMatch(o,[a[0],a[1]],[r.position[0],r.position[1]],n);t.longitude=s.longitude,t.latitude=s.latitude,t.bearing=s.bearing}}(t.longitude<-180||t.longitude>180)&&(t.longitude=Ab(t.longitude+180,360)-180),(t.bearing<-180||t.bearing>180)&&(t.bearing=Ab(t.bearing+180,360)-180),t.latitude=wx(t.latitude,-90,90),t.pitch=wx(t.pitch,t.minPitch,t.maxPitch);let a=n?Ss(t.width,t.height,t.maxBoundsPadding):null;if(n&&a&&(a.width>=0&&(t.longitude=wx(t.longitude,n[0][0],n[1][0])),a.height>=0&&(t.latitude=wx(t.latitude,n[0][1],n[1][1]))),n&&a){let r=Sl(this.makeViewport({...t,bearing:0,pitch:0}),[t.longitude,t.latitude],a),o=t.zoom-CL(i),s=n[1][0]-n[0][0],l=n[1][1]-n[0][1];if(a.height>=0&&l>0&&l<180){let i=Math.min(C1(a.height,o),l),s=a.height?i*r.bottom/a.height:C1(r.bottom,o),u=a.height?i*r.top/a.height:C1(r.top,o);t.latitude=wx(t.latitude,n[0][1]+s,n[1][1]-u)}if(a.width>=0&&s>0&&s<360){let i=Math.min(C1(a.width/Math.cos(t.latitude*CQ),o),s),l=a.width?i*r.left/a.width:C1(r.left/Math.cos(t.latitude*CQ),o),u=a.width?i*r.right/a.width:C1(r.right/Math.cos(t.latitude*CQ),o);t.longitude=wx(t.longitude,n[0][0]+l,n[1][0]-u)}}return t.latitude=wx(t.latitude,-90,90),t.latitude!==i&&(t.zoom+=CL(t.latitude,!0)-CL(i,!0)),t}_constrainZoom(t,r){r||(r=this.getViewportProps());let{maxZoom:i,maxBounds:n}=r,{minZoom:a}=r;if(null!==n&&r.width>0&&r.height>0){let t=Ss(r.width,r.height,r.maxBoundsPadding),o=n[0][1],s=n[1][1],l=Math.sign(o)===Math.sign(s)?Math.min(Math.abs(o),Math.abs(s)):0,u=CL(0),c=C0(n[1][0]-n[0][0])*Math.cos(l*CQ),h=C0(n[1][1]-n[0][1]);t.width>0&&c>0&&(a=Math.max(a,Math.log2(t.width/c)+u)),t.height>0&&h>0&&(a=Math.max(a,Math.log2(t.height/h)+u)),a>i&&(a=i)}let o=CL(r.latitude,!0)-CL(0,!0);return wx(t,a+o,i+o)}}class C3 extends Si{constructor(){super(...arguments),this.ControllerState=C2,this.transition={transitionDuration:300,transitionInterpolator:new A1({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan",this._panHistory=[]}_onPanStart(t){return this._panHistory=[],super._onPanStart(t)}_onMultiPanStart(t){return this._panHistory=[],super._onMultiPanStart(t)}_onPanMove(t){if(!this.dragPan)return!1;let r=this.getCenter(t),i=this.controllerState.pan({pos:r});this.updateViewport(i,{transitionDuration:0},{isDragging:!0,isPanning:!0});let{longitude:n,latitude:a}=i.getViewportProps();return this._panHistory.push({longitude:n,latitude:a,timestamp:Date.now()}),this._panHistory.length>5&&this._panHistory.shift(),!0}_onPanMoveEnd(t){let{inertia:r}=this;if(this.dragPan&&r&&this._panHistory.length>=2){let t=this._panHistory[0],i=this._panHistory[this._panHistory.length-1],n=i.timestamp-t.timestamp;if(n>0){let a=this.controllerState.getViewportProps(),o=CZ.angularDistance(t,i)/n;if(o>1e-6){let n=o*r/2,s=CZ.greatCircleAxis(t,i),l=CZ.cameraFrame(a.longitude,a.latitude,a.bearing||0),u=CZ.rotateFrame({...l,axisHorizontal:s}
2259,n,0),c=u.longitude,h=wx(u.latitude,-90,90),f=new CK({axis:s,totalAngle:n}),d=this.controllerState.panEnd();return this.updateViewport(d,{transitionInterpolator:f,transitionDuration:r,transitionEasing:CX,longitude:c,latitude:h},{isDragging:!1,isPanning:!0}),this._panHistory=[],!0}}}this._panHistory=[];let i=this.controllerState.panEnd();return this.updateViewport(i,null,{isDragging:!1,isPanning:!1}),!0}}let C4={cullMode:"back"};class C6 extends AU{constructor(t={}){super({...t,parameters:{...C4,...t.parameters}})}getViewportType(t){return t.zoom>12?AG:CN}get ControllerType(){return C3}}function C5(t){let r="mercator";try{r=t.getProjection?.()?.type||"mercator"}catch{}if("globe"===r)return"globe";if("mercator"!==r)throw Error(`Unsupported MapLibre projection: ${String(r)}`);return"mercator"}function C8(t){return!!t&&"object"==typeof t&&Number.isFinite(t.nearZ)&&Number.isFinite(t.farZ)}function C7(t){return t.props.beforeId?`deck-maplibre-layer-group-before:${t.props.beforeId}`:"deck-maplibre-layer-group-last"}C6.displayName="GlobeView";let C9="maplibre",Me=new WeakMap;function Mt(t,r){return r?{depthWriteEnabled:!0,depthCompare:"less-equal",depthBias:0,blend:!0,blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one-minus-src-alpha",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha",blendColorOperation:"add",blendAlphaOperation:"add"}:{}}function Mr(t){return"globe"===C5(t)?new C6({id:C9}):new Sd({id:C9})}function Mi(t){let{lng:r,lat:i}=t.getCenter(),n=t.getPadding(),a={longitude:(r+540)%360-180,latitude:i,zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch(),padding:{top:n.top??0,bottom:n.bottom??0,left:n.left??0,right:n.right??0},repeat:t.getRenderWorldCopies()},o=t.getCenterElevation?t.getCenterElevation():t.getCameraTargetElevation?.();return"number"==typeof o&&Number.isFinite(o)&&(a.position=[0,0,o]),a}function Mn(t){return Me.get(t)?.deck}function Ma(t){let r=Me.get(t);r&&(Ms(t,r),t.off("render",r.renderListener),r.deck.finalize(),Me.delete(t))}function Mo(t,r){r.watchingMove||(r.watchingMove=!0,t.on("move",r.moveListener))}function Ms(t,r){r.watchingMove&&(r.watchingMove=!1,t.off("move",r.moveListener))}function Ml(t,r,i){let n=Mi(r),a=t.getView(C9)||Mr(r);if(i){a.props.nearZMultiplier=.2;let t=r.getCanvas().clientHeight;t>0&&Number.isFinite(i.nearZ)&&Number.isFinite(i.farZ)&&(n.nearZ=i.nearZ/t,n.farZ=i.farZ/t)}return a.makeViewport({width:t.width,height:t.height,viewState:n})}class Mu{constructor(t){this.type="custom",this.map=null,AK(t.id,"id is required"),this.id=t.id,this.renderingMode=t.renderingMode||"3d",this.beforeId=t.beforeId}onAdd(t){this.map=t}onRemove(){this.map=null}render(t,r,i){if(!this.map)return;let n=Mn(this.map);n&&function(t,r,i,n){if(!t.isInitialized)return;let{currentViewport:a}=t.userData,o=!1;a||(a=Ml(t,r,n),t.userData.currentViewport=a,o=!0),a&&t._drawLayers("maplibre-repaint",{viewports:[a],layerFilter:r=>(!t.props.layerFilter||!!t.props.layerFilter(r))&&r.layer.props.beforeId===i.beforeId,clearStack:o,clearCanvas:!1})}(n,this.map,this,function(t,r){if(C8(t))return t;if(C8(r))return r;throw Error("MapLibreOverlay interleaved rendering requires MapLibre GL JS 4.5.1 or later")}(r,i))}}let Mc=new WeakMap;function Mh(t,r,i){if(!t||!t.isStyleLoaded())return;let n=Mc.get(t);n||(n=new Map,Mc.set(t,n));let a=E0(i,Boolean),o=new Set(a.map(C7));if(r!==i)for(let i of new Set(E0(r,Boolean).map(C7)))!o.has(i)&&n.has(i)&&(t.getLayer(i)&&t.removeLayer(i),n.delete(i));for(let r of a){let i=C7(r);if(n.has(i)){t.getLayer(i)||t.addLayer(n.get(i),r.props.beforeId);continue}if(t.getLayer(i))throw Error(`MapLibre style already contains a non-deck layer with id ${i}`);let a=new Mu({id:i,beforeId:r.props.beforeId});n.set(i,a),t.addLayer(a,r.props.beforeId)}for(let r of o){let i=n.get(r),a=t.getLayersOrder(),o=i.beforeId?a.indexOf(i.beforeId):a.length;o<0||a.indexOf(r)!==o-1&&t.moveLayer(r,i.beforeId)}}t.s(["MapLibreOverlay",0,class{constructor(t){this._handleStyleChange=()=>{Mh(this._map,this._props.layers,this._props.layers),this._map&&C5(this._map)&&this._deck?.setProps({views:this._getViews(this._map)})},this._updateContainerSize=()=>{if(this._map&&this._container){let{clientWidth:t,clientHeight:r}=this._map.getContainer();Object.assign(this._container.style,{width:`${t}px`,height:`${r}px`})}},this._updateViewState=()=>{let t=this._deck,r=this._map;t&&r&&(t.setProps({views:this._getViews(r),viewState:Mi(r)}),t.isInitialized&&t.redraw())},this._handleMouseEvent=t=>{let r=this._deck;if(!r||!r.isInitialized)return;let i={type:t.type,offsetCenter:t.point||{x:0,y:0},srcEvent:t},n=this._lastMouseDownPoint;switch(!t.point&&n&&t.originalEvent instanceof MouseEvent&&(i.deltaX=t.originalEvent.clientX-n.clientX,i.deltaY=t.originalEvent.clientY-n.clientY,i.offsetCenter={x:n.x+i.deltaX,y:n.y+i.deltaY}),i.type){case"mousedown":if(r._onPointerDown(i),!(t.originalEvent instanceof MouseEvent))return;this._lastMouseDownPoint={...i.offsetCenter,clientX:t.originalEvent.clientX,clientY:t.originalEvent.clientY};break;case"dragstart":i.type="panstart",r._onEvent(i);break;case"drag":i.type="panmove",r._onEvent(i);break;case"dragend":i.type="panend",r._onEvent(i);break;case"click":i.tapCount=1,r._onEvent(i);break;case"dblclick":i.type="click",i.tapCount=2,r._onEvent(i);break;case"mousemove":i.type="pointermove",r._onPointerMove(i);break;case"mouseout":i.type="pointerleave",r._onPointerMove(i);break;default:return}};const{interleaved:r=!1}=t;this._interleaved=r,this._props=this._filterProps(t)}_filterProps(t){let{interleaved:r,useDevicePixels:i,device:n,...a}=t;return this._interleaved||(void 0!==i&&Object.assign(a,{useDevicePixels:i}),void 0!==n&&Object.assign(a,{device:n})),a}setProps(t){this._interleaved&&t.layers&&Mh(this._map,this._props.layers,t.layers
2259),Object.assign(this._props,this._filterProps(t)),this._deck&&this._map&&this._deck.setProps({...this._props,views:this._getViews(this._map),parameters:{...Mt(this._map,this._interleaved),...this._props.parameters}})}onAdd(t){this._map=t;try{return this._interleaved?this._onAddInterleaved(t):this._onAddOverlaid(t)}catch(r){throw this._deck&&(this._interleaved?this._onRemoveInterleaved(t):this._onRemoveOverlaid(t)),this._deck=void 0,this._map=void 0,this._container=void 0,r}}onRemove(t){let r=this._map;r&&(this._interleaved?this._onRemoveInterleaved(r):this._onRemoveOverlaid(r)),this._deck=void 0,this._map=void 0,this._container=void 0}getDefaultPosition(){return"top-left"}pickObject(t){return AK(this._deck),this._deck.pickObject(t)}pickMultipleObjects(t){return AK(this._deck),this._deck.pickMultipleObjects(t)}pickObjects(t){return AK(this._deck),this._deck.pickObjects(t)}finalize(){this._map?.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}_onAddOverlaid(t){let r=document.createElement("div");return Object.assign(r.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=r,this._deck=new CP({...this._props,parent:r,deviceProps:{...this._props.deviceProps,createCanvasContext:{..."object"==typeof this._props.deviceProps?.createCanvasContext?this._props.deviceProps.createCanvasContext:void 0,pixelSizeSource:"css-dpr"}},parameters:{...Mt(t,!1),...this._props.parameters},views:this._getViews(t),viewState:Mi(t)}),t.on("resize",this._updateContainerSize),t.on("render",this._updateViewState),t.on("mousedown",this._handleMouseEvent),t.on("dragstart",this._handleMouseEvent),t.on("drag",this._handleMouseEvent),t.on("dragend",this._handleMouseEvent),t.on("mousemove",this._handleMouseEvent),t.on("mouseout",this._handleMouseEvent),t.on("click",this._handleMouseEvent),t.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),r}_onAddInterleaved(t){return this._deck=function(t,r){if(Me.has(t))throw Error("MapLibreOverlay supports one interleaved overlay per map");let i=t.getCanvas().getContext("webgl2");if(!i)throw Error("MapLibreOverlay interleaved rendering requires WebGL2.");let{device:n,...a}=r,o=new CP({...a,gl:i});try{var s=t,l=o;if(Me.get(s))throw Error("MapLibreOverlay supports one interleaved overlay per map");let r=l.props._customRender,i=l.props.onLoad,n={deck:l,watchingMove:!1,moveListener:()=>{var t,r;l.isInitialized?(t=l,r=s,t.setProps({viewState:Mi(r)}),t.needsRedraw({clearRedrawFlags:!0})):Ms(s,n)},renderListener:()=>{l.isInitialized&&function(t,r){let i=E0(t.props.layers,Boolean).some(t=>t&&!r.getLayer(C7(t))),n=t.getViewports(),a=n.findIndex(t=>t.id===C9),o=n.length>1||a<0;if(i||o){if(a>=0){n=n.slice();let i=Ml(t,r);i?n[a]=i:n.splice(a,1)}t._drawLayers("maplibre-repaint",{viewports:n,layerFilter:i=>(!t.props.layerFilter||t.props.layerFilter(i))&&(i.viewport.id!==C9||!r.getLayer(C7(i.layer))),clearCanvas:!1})}else{let r=t.device,i=r?.gl;t.props.onBeforeRender?.({device:r,gl:i}),t.props.onAfterRender?.({device:r,gl:i})}t.userData.currentViewport=null}(l,s)}};Me.set(s,n);let a={...l.props,_customRender:()=>{s.triggerRepaint(),r?.("")}};return a.views||(a.views=Mr(s)),Object.assign(a,{width:null,height:null,touchAction:"unset",viewState:Mi(s)}),l.isInitialized?Mo(s,n):a.onLoad=()=>{i?.(),Me.get(s)===n&&Mo(s,n)},l.setProps(a),s.on("render",n.renderListener),l}catch(r){throw Mn(t)===o?Ma(t):o.finalize(),r}}(t,{...this._props,views:this._getViews(t),parameters:{...Mt(t,!0),...this._props.parameters}}),t.on("styledata",this._handleStyleChange),Mh(t,[],this._props.layers),document.createElement("div")}_onRemoveOverlaid(t){t.off("resize",this._updateContainerSize),t.off("render",this._updateViewState),t.off("mousedown",this._handleMouseEvent),t.off("dragstart",this._handleMouseEvent),t.off("drag",this._handleMouseEvent),t.off("dragend",this._handleMouseEvent),t.off("mousemove",this._handleMouseEvent),t.off("mouseout",this._handleMouseEvent),t.off("click",this._handleMouseEvent),t.off("dblclick",this._handleMouseEvent),this._deck?.finalize()}_onRemoveInterleaved(t){t.off("styledata",this._handleStyleChange);try{Mh(t,this._props.layers,[])}finally{Ma(t)}}_getViews(t){if(!this._props.views)return Mr(t);let r=Array.isArray(this._props.views)?this._props.views:[this._props.views];return r.some(t=>t.id===C9)?this._props.views:[Mr(t),...r]}}],837866);var Mf=t.i(695002),Md=t.i(69004),Mp=t.i(144135);let Mm=Md.dataTypeDecoder.getDataType.bind(Md.dataTypeDecoder);function Mg(t,r,i){if(r.size>4)return null;let n="webgpu"===i&&"uint8"===r.type?"unorm8":r.type,a=r.size,o=!!("webgpu"!==i&&3===a&&n&&["uint8","sint8","unorm8","snorm8","uint16","sint16","unorm16","snorm16"].includes(n));return{attribute:t,format:a>1?`${n}x${a}${o?"-webgl":""}`:r.type,byteOffset:r.offset||0}}function My(t){return t.stride||t.size*t.bytesPerElement}function Mv(t,r){r.offset&&xn.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let i=My(t),n=(void 0!==r.vertexOffset?r.vertexOffset:t.vertexOffset||0)*i+(r.elementOffset||0)*t.bytesPerElement+(t.offset||0);return{...r,offset:n,stride:i}
2259}class M_{constructor(t,r,i){let n;this._buffer=null,this.device=t,this.id=r.id||"",this.size=r.size||1;const a=r.logicalType||r.type,o="float64"===a;let{defaultValue:s}=r;s=Number.isFinite(s)?[s]:s||Array(this.size).fill(0),n=o?"float32":!a&&r.isIndexed?"uint32":a||"float32";let l=function(t){switch(t){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return(0,Mp.getTypedArrayConstructor)(t)}}(a||n);this.doublePrecision=o,o&&!1===r.fp64&&(l=Float32Array),this.value=null,this.settings={...r,defaultType:l,defaultValue:s,logicalType:a,type:n,normalized:n.includes("norm"),size:this.size,bytesPerElement:l.BYTES_PER_ELEMENT},this.state={...i,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let t=this.getAccessor();return t.vertexOffset?t.vertexOffset*My(t):0}get numInstances(){return this.state.numInstances}set numInstances(t){this.state.numInstances=t}get isDoublePrecisionBuffer(){return this._shouldSplitDoublePrecisionValue(this.value)}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),Av.release(this.state.allocatedValue),this.state.allocatedValue=null}getBuffer(){return this.state.constant&&"webgpu"!==this.device.type?null:this.state.externalBuffer||this._buffer}getValue(t=this.id,r=null){let i={};if(this.state.constant){let n=this.value;if("webgpu"===this.device.type&&this._buffer)i[t]=this._buffer;else if(r){let a=Mv(this.getAccessor(),r),o=a.offset/n.BYTES_PER_ELEMENT,s=a.size||this.size;i[t]=n.subarray(o,o+s)}else i[t]=n}else i[t]=this.getBuffer();return this.doublePrecision&&(this.isDoublePrecisionBuffer?i[`${t}64Low`]=i[t]:i[`${t}64Low`]=new Float32Array(this.size)),i}_getBufferLayout(t=this.id,r=null){let i=this.getAccessor(),n=[],a={name:this.id,byteStride:"webgpu"===this.device.type&&this.state.constant?0:My(i)};if(this.doublePrecision){let a,o={high:a=Mv(i,r||{}),low:{...a,offset:a.offset+4*i.size}};n.push(Mg(t,{...i,...o.high},this.device.type),Mg(`${t}64Low`,{...i,...o.low},this.device.type))}else if(r){let a=Mv(i,r);n.push(Mg(t,{...i,...a},this.device.type))}else n.push(Mg(t,i,this.device.type));
2259return a.attributes=n.filter(Boolean),a}setAccessor(t){this.state.bufferAccessor=t}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let t=null;if(this.state.constant&&this.value){let r=Array.from(this.value);t=[r,r]}else{let{value:r,numInstances:i,size:n}=this,a=i*n;if(r&&a&&r.length>=a){let i=Array(n).fill(1/0),o=Array(n).fill(-1/0);for(let t=0;t<a;)for(let a=0;a<n;a++){let n=r[t++];n<i[a]&&(i[a]=n),n>o[a]&&(o[a]=n)}t=[i,o]}}return this.state.bounds=t,t}setData(t){let r,{state:i}=this;r=ArrayBuffer.isView(t)?{value:t}:t instanceof SB.Buffer?{buffer:t}:t;let n={...this.settings,...r};if(ArrayBuffer.isView(r.value)){if(!r.type)if(this.doublePrecision&&r.value instanceof Float64Array)n.type="float32";else{let t=Mm(r.value);n.type=n.normalized?t.replace("int","norm"):t}n.bytesPerElement=r.value.BYTES_PER_ELEMENT,n.stride=My(n)}if(i.bounds=null,r.constant){let t=r.value;if(t=this._normalizeValue(t,[],0),this.settings.normalized&&(t=this.normalizeConstant(t)),!(!i.constant||!this._areValuesEqual(t,this.value)))return!1;i.externalBuffer=null,i.constant=!0,this.value=ArrayBuffer.isView(t)?t:new Float32Array(t)}else if(r.buffer)i.externalBuffer=r.buffer,i.constant=!1,this.value=r.value||null;else if(r.value){this._checkExternalBuffer(r);let t=r.value,a=t;i.externalBuffer=null,i.constant=!1,this.value=t,this._shouldSplitDoublePrecisionValue(a)&&(a=AE(a,n),t instanceof Float32Array&&(n.stride=2*n.size*Float32Array.BYTES_PER_ELEMENT));let{buffer:o}=this,s=My(n),l=(n.vertexOffset||0)*s;if(this.settings.isIndexed){let t=this.settings.defaultType;a.constructor!==t&&(a=new t(a))}let u=a.byteLength+l+2*s;(!o||o.byteLength<u)&&(o=this._createBuffer(u)),o.write(a,l)}return this.setAccessor(n),!0}updateSubBuffer(t={}){this.state.bounds=null;let r=this.value,{startOffset:i=0,endOffset:n}=t,a=this._shouldSplitDoublePrecisionValue(r);this.buffer.write(a?AE(r,{size:this.size,startIndex:i,endIndex:n}):r.subarray(i,n),i*(a?8:r.BYTES_PER_ELEMENT)+this.byteOffset)}allocate(t,r=!1){let{state:i}=this,n=i.allocatedValue,a=Av.allocate(n,t+1,{size:this.size,type:this.settings.defaultType,copy:r});this.value=a;let o=this._shouldSplitDoublePrecisionValue(a),s=o&&a instanceof Float32Array?{...this.settings,stride:2*this.size*Float32Array.BYTES_PER_ELEMENT}:this.settings;this.setAccessor(s);let{byteOffset:l}=this,{buffer:u}=this,c=a.byteLength*(o&&a instanceof Float32Array?2:1);return(!u||u.byteLength<c+l)&&(u=this._createBuffer(c+l),r&&n&&u.write(this._shouldSplitDoublePrecisionValue(n)?AE(n,this):n,l)),i.allocatedValue=a,i.constant=!1,i.externalBuffer=null,!0}_shouldSplitDoublePrecisionValue(t){return!!(this.doublePrecision&&(t instanceof Float64Array||"webgpu"===this.device.type&&t instanceof Float32Array))}_checkExternalBuffer(t){let{value:r}=t;if(!ArrayBuffer.isView(r))throw Error(`Attribute ${this.id} value is not TypedArray`);let i=this.settings.defaultType,n=!1;if(this.doublePrecision&&(n=r.BYTES_PER_ELEMENT<4),n)throw Error(`Attribute ${this.id} does not support ${r.constructor.name}`);r instanceof i||!this.settings.normalized||"normalized"in t||xn.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(t){switch(this.settings.type){case"snorm8":return new Float32Array(t).map(t=>(t+128)/255*2-1);case"snorm16":return new Float32Array(t).map(t=>(t+32768)/65535*2-1);case"unorm8":return new Float32Array(t).map(t=>t/255);case"unorm16":return new Float32Array(t).map(t=>t/65535);default:return t}}_normalizeValue(t,r,i){let{defaultValue:n,size:a}=this.settings;if(Number.isFinite(t))return r[i]=t,r;if(!t){let t=a;for(;--t>=0;)r[i+t]=n[t];return r}switch(a){case 4:r[i+3]=Number.isFinite(t[3])?t[3]:n[3];case 3:r[i+2]=Number.isFinite(t[2])?t[2]:n[2];case 2:r[i+1]=Number.isFinite(t[1])?t[1]:n[1];case 1:r[i+0]=Number.isFinite(t[0])?t[0]:n[0];break;default:let o=a;for(;--o>=0;)r[i+o]=Number.isFinite(t[o])?t[o]:n[o]}return r}_areValuesEqual(t,r){if(!t||!r)return!1;let{size:i}=this;for(let n=0;n<i;n++)if(t[n]!==r[n])return!1;return!0}_createBuffer(t){this._buffer&&this._buffer.destroy();let{isIndexed:r,type:i}=this.settings,n="webgpu"!==this.device.type||r?(r?SB.Buffer.INDEX:SB.Buffer.VERTEX)|SB.Buffer.COPY_DST:SB.Buffer.VERTEX|SB.Buffer.STORAGE|SB.Buffer.COPY_DST|SB.Buffer.COPY_SRC;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:n,indexType:r?i:void 0,byteLength:t}),this._buffer}}let Mb=[],Mx=[];function Mw(t,r=0,i=1/0){let n=Mb,a={index:-1,data:t,target:[]};return t?"function"==typeof t[Symbol.iterator]?n=t:t.length>0&&(Mx.length=t.length,n=Mx):n=Mb,(r>0||Number.isFinite(i))&&(n=(Array.isArray(n)?n:Array.from(n)).slice(r,i),a.index=r-1),{iterable:n,objectInfo:a}}function ME(t){return t&&t[Symbol.asyncIterator]}function MT(t,r){let{size:i,stride:n,offset:a,startIndices:o,nested:s}=r,l=t.BYTES_PER_ELEMENT,u=n?n/l:i,c=a?a/l:0,h=Math.floor((t.length-c)/u);return(r,{index:n,target:a})=>{let l;if(!o){let r=n*u+c;for(let n=0;n<i;n++)a[n]=t[r+n];return a}let f=o[n],d=o[n+1]||h;if(s){l=Array(d-f);for(let r=f;r<d;r++){let n=r*u+c;a=Array(i);for(let r=0;r<i;r++)a[r]=t[n+r];l[r-f]=a}}else if(u===i)l=t.subarray(f*i+c,d*i+c);else{l=new t.constructor((d-f)*i);let r=0;for(let n=f;n<d;n++){let a=n*u+c;for(let n=0;n<i;n++)l[r++]=t[a+n]}}return l}}let MA=[],MS=[[0,1/0]],MC={interpolation:{duration:0,easing:t=>t},spring:{stiffness:.05,damping:.5}};function MM(t,r){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});let i=t.type||"interpolation";return{...MC[i],...r,...t,type:i}}class MD extends M_{constructor(t,r){super(t,r,{startIndices:null,constantValue:null,lastExter
2259nalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:MS}),this.constant=!1,this.settings.update=r.update||(r.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(t){this.state.startIndices=t}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:t=!1}={}){let r=this.state.needsRedraw;return this.state.needsRedraw=r&&!t,r}layoutChanged(){return this.state.layoutChanged}setAccessor(t){var r,i;(r=this.state).layoutChanged||(i=this.getAccessor(),r.layoutChanged=t.type!==i.type||t.size!==i.size||My(t)!==My(i)||(t.offset||0)!==(i.offset||0)),super.setAccessor(t)}getUpdateTriggers(){let{accessor:t}=this.settings;return[this.id].concat("function"!=typeof t&&t||[])}supportsTransition(){return!!this.settings.transition}getTransitionSetting(t){if(!t||!this.supportsTransition())return null;let{accessor:r}=this.settings,i=this.settings.transition;return MM(Array.isArray(r)?t[r.find(r=>t[r])]:t[r],i)}setNeedsUpdate(t=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),r){let{startRow:t=0,endRow:i=1/0}=r;this.state.updateRanges=function(t,r){if(t===MS||(r[0]<0&&(r[0]=0),r[0]>=r[1]))return t;let i=[],n=t.length,a=0;for(let o=0;o<n;o++){let n=t[o];n[1]<r[0]?(i.push(n),a=o+1):n[0]>r[1]?i.push(n):r=[Math.min(n[0],r[0]),Math.max(n[1],r[1])]}return i.splice(a,0,r),i}(this.state.updateRanges,[t,i])}else this.state.updateRanges=MS}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=MA}setNeedsRedraw(t=this.id){this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){let{state:r,settings:i}=this;if(i.noAlloc)return!1;if(i.update){let i=this.isConstant;return super.allocate(t,r.updateRanges!==MS),r.layoutChanged||(r.layoutChanged=i&&"webgpu"===this.device.type),!0}return!1}updateBuffer({numInstances:t,data:r,props:i,context:n}){if(!this.needsUpdate())return!1;let{state:{updateRanges:a},settings:{update:o,noAlloc:s}}=this,l=!0;if(o){for(let[s,l]of a)o.call(n,this,{data:r,startRow:s,endRow:l,props:i,numInstances:t});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset){if(this.constant){let t=this.value;this.value=null,this.setConstantValue(n,t)}else this.setData({value:this.value,constant:this.constant});this.constant=!1}else for(let[r,i]of a){let n=Number.isFinite(r)?this.getVertexOffset(r):0,a=Number.isFinite(i)?this.getVertexOffset(i):s||!Number.isFinite(t)?this.value.length:t*this.size;super.updateSubBuffer({startOffset:n,endOffset:a})}this._checkAttributeArray()}else l=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),l}setConstantValue(t,r){var i;if(void 0===r||"function"==typeof r)return!1;let n=this.isConstant,a=this.settings.transform&&t?this.settings.transform.call(t,r):r,o=this.settings.defaultType;this.state.constantValue=this._normalizeValue(a,new o(this.size),0);let s=this.setData({constant:!0,value:a});if("webgpu"===this.device.type){let t=this.state.constantValue;this.doublePrecision&&(t instanceof Float32Array||t instanceof Float64Array)&&(t=AE(t,{size:this.size}),this.setAccessor({...this.getAccessor(),stride:2*this.size*Float32Array.BYTES_PER_ELEMENT}));let r=this._buffer;(!r||r.byteLength<t.byteLength)&&(r=this._createBuffer(t.byteLength)),r.write(t),(i=this.state).layoutChanged||(i.layoutChanged=!n),this.constant=!1}return s&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0}getConstantValue(){return this.isConstant?this.state.constantValue:null}setExternalBuffer(t){let{state:r}=this;return t?(this.clearNeedsUpdate(),r.lastExternalBuffer===t||(r.lastExternalBuffer=t,this.setNeedsRedraw(),this.setData(t),!0)):(r.lastExternalBuffer=null,!1)}setBinaryValue(t,r=null){let{state:i,settings:n}=this;if(!t)return i.binaryValue=null,i.binaryAccessor=null,!1;if(n.noAlloc)return!1;if(i.binaryValue===t)return this.clearNeedsUpdate(),!0;if(i.binaryValue=t,this.setNeedsRedraw(),n.transform||r!==this.startIndices){ArrayBuffer.isView(t)&&(t={value:t});let a=t;AK(ArrayBuffer.isView(a.value),`invalid ${n.accessor}`);let o=!!a.size&&a.size!==this.size;return i.binaryAccessor=MT(a.value,{size:a.size||this.size,stride:a.str
2259ide,offset:a.offset,startIndices:r,nested:o}),!1}return this.clearNeedsUpdate(),this.setData(t),!0}getVertexOffset(t){let{startIndices:r}=this;return(r?t<r.length?r[t]:this.numInstances:t)*this.size}getValue(){let t=this.settings.shaderAttributes,r=super.getValue();if(!t)return r;for(let i in t)Object.assign(r,super.getValue(i,t[i]));return r}getBufferLayout(t){this.state.layoutChanged=!1;let r=this.settings.shaderAttributes,i=super._getBufferLayout(),{stepMode:n}=this.settings;if("dynamic"===n?i.stepMode=t?t.isInstanced?"instance":"vertex":"instance":i.stepMode=n??"vertex",!r)return i;for(let t in r){let n=super._getBufferLayout(t,r[t]);i.attributes.push(...n.attributes)}return i}_autoUpdater(t,{data:r,startRow:i,endRow:n,props:a,numInstances:o}){let{settings:s,state:l,value:u,size:c,startIndices:h}=t,{accessor:f,transform:d}=s,p=l.binaryAccessor||("function"==typeof f?f:a[f]);AK("function"==typeof p,`accessor "${f}" is not a function`);let m=t.getVertexOffset(i),{iterable:g,objectInfo:y}=Mw(r,i,n);for(let r of g){y.index++;let i=p(r,y);if(d&&(i=d.call(this,i)),h){let r=(y.index<h.length-1?h[y.index+1]:o)-h[y.index];if(i&&Array.isArray(i[0])){let r=m;for(let n of i)t._normalizeValue(n,u,r),r+=c}else i&&i.length>c?u.set(i,m):(t._normalizeValue(i,y.target,0),function({target:t,source:r,start:i=0,count:n=1}){let a=r.length,o=n*a,s=0;for(let n=i;s<a;s++)t[n++]=r[s];for(;s<o;)s<o-s?(t.copyWithin(i+s,i,i+s),s*=2):(t.copyWithin(i+s,i,i+o-s),s=o)}({target:u,source:y.target,start:m,count:r}));m+=r*c}else t._normalizeValue(i,u,m),m+=c}}_validateAttributeUpdaters(){let{settings:t}=this;if(!(t.noAlloc||"function"==typeof t.update))throw Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:t}=this,r=Math.min(4,this.size);if(t&&t.length>=r){let i=!0;switch(r){case 4:i=i&&Number.isFinite(t[3]);case 3:i=i&&Number.isFinite(t[2]);case 2:i=i&&Number.isFinite(t[1]);case 1:i=i&&Number.isFinite(t[0]);break;default:i=!1}if(!i)throw Error(`Illegal attribute generated for ${this.id}`)}}}var MP=t.i(314152);function MI({elementWise:t,func:r,inputs:i,output:n,outputBuffer:a}){let o=Array.isArray(i)?i:Object.values(i);for(let t of o)if(!t.value)throw Error(`${t} does not have CPU value`);let s=n.length,l=n.size,u=new n.ValueType(s*l);for(let i=0;i<s;i++){let n=o.map(t=>Mk(t,i));if(t)for(let t=0;t<l;t++)u[i*l+t]=r.apply(null,n.map(r=>r[t]));else r.call(null,u.subarray(i*l,i*l+l),...n)}let c=n.ValueType.BYTES_PER_ELEMENT,h=n.offset/c,f=n.stride/c,d=u;if(0!==h||f!==l){d=new n.ValueType(h+n.byteLength/c);for(let t=0;t<s;t++){let r=t*l,i=h+t*f,n=u.subarray(r,r+l);d.set(n,i),a.write(n,i*c)}}else a.write(u);return{success:!0,value:d}}function Mk(t,r){let i=t.value,n=t.size,a=t.offset/t.ValueType.BYTES_PER_ELEMENT,o=t.stride/t.ValueType.BYTES_PER_ELEMENT,s=a+(t.isConstant?0:r)*o,l=i.slice(s,s+n);if(!t.normalized)return l;let u=new Float32Array(n);for(let r=0;r<n;r++)u[r]=function(t,r){switch(r){case"uint8":return t/255;case"uint16":return t/65535;case"uint32":return t/0xffffffff;case"sint8":return Math.max(t/127,-1);case"sint16":return Math.max(t/32767,-1);case"sint32":return Math.max(t/0x7fffffff,-1);case"float32":return t;default:throw Error(`Unsupported normalized source type ${r}`)}}(l[r],t.type);return u}let MO=async({inputs:t,output:r,target:i})=>{let{ids:n,sourceValues:a}=t,o=n.value,s=a.value;if(!o)throw Error(`${n} does not have CPU value`);if(!s)throw Error(`${a} does not have CPU value`);let l=new r.ValueType(r.length*r.size),u=Array(r.size).fill(0);for(let t=0;t<r.length;t++){var c,h;let i=Number(Mk(n,t)[0]),o=(c=i,h=a.length,Number.isInteger(c)&&c>=0&&c<h)?Mk(a,i):u;l.set(o,t*r.size)}return i.write(l),{success:!0,value:l}},MN=async({inputs:t,output:r,target:i})=>{let{segments:n,vertexCount:a}=t,o=n.value;if(!o)throw Error(`${n} does not have CPU value`);var s=o,l=n,u=a;if(l.length<1)throw Error("segmentedMap segments must contain at least one segment start");let c=0;for(let t=0;t<l.length;t++){let r=s[ML(l,t)];if(0===t&&0!==r)throw Error(`segmentedMap segments must start at 0, got ${r}`);if(t>0&&r<c)throw Error(`segmentedMap segments must be non-decreasing, got ${r} after ${c}`);c=r}if(c>u)throw Error(`segmentedMap last segment start must be <= vertexCount, got ${c} > ${u}`);let h=new r.ValueType(r.length*r.size),f=0;for(let t=0;t<a;t++){for(;f+1<n.length&&o[ML(n,f+1)]<=t;)f++;let i=o[ML(n,f)],a=t*r.size;h[a]=f,h[a+1]=t-i}return i.write(h),{success:!0,value:h}};function ML(t,r){return t.offset/t.ValueType.BYTES_PER_ELEMENT+r*(t.stride/t.ValueType.BYTES_PER_ELEMENT)}
2259let MR=async({inputs:t,output:r,target:i})=>{let{condition:n,whenTrue:a,whenFalse:o}=t,s=new r.ValueType(r.length*r.size);for(let t=0;t<r.length;t++){let i=Mk(n,t),l=Mk(a,t),u=Mk(o,t);for(let c=0;c<r.size;c++){let h=MF(i,n.size,c);s[t*r.size+c]=0!==h?MF(l,a.size,c):MF(u,o.size,c)}}return i.write(s),{success:!0,value:s}};function MF(t,r,i){return i<r?t[i]:1===r?t[0]:0}t.s([],245812),t.i(245812),t.s(["arithmetic",0,({inputs:t,output:r,target:i})=>{for(let r of Object.values(t.namedInputs))if(!r.value)throw Error(`${r} does not have CPU value`);let n=new r.ValueType(r.length*r.size);for(let i=0;i<r.length;i++){let a=Object.fromEntries(Object.entries(t.namedInputs).map(([t,r])=>[t,Mk(r,i)]));for(let o=0;o<r.size;o++)n[i*r.size+o]=function t(r,i,n){switch(r.kind){case"input":{let t=i[r.name];if(n<t.length)return t[n];return 1===t.length?t[0]:0}case"literal":if(Array.isArray(r.value))return r.value[n]??0;return r.value;case"call":{!function(t,r){let i=MP.ARITHMETIC_OPERATIONS[t].arity;if(r!==i)throw Error(`Arithmetic op '${t}' expects ${i} args, got ${r}`)}(r.op,r.args.length);let a=r.args.map(r=>t(r,i,n));switch(r.op){case"add":return a[0]+a[1];case"subtract":return a[0]-a[1];case"multiply":return a[0]*a[1];case"divide":return a[0]/a[1];case"pow":return Math.pow(a[0],a[1]);case"sqrt":return Math.sqrt(a[0]);case"abs":return Math.abs(a[0]);case"sin":return Math.sin(a[0]);case"cos":return Math.cos(a[0]);case"tan":return Math.tan(a[0]);case"exp":return Math.exp(a[0]);case"log":return Math.log(a[0]);default:{let t=r.op;throw Error(`Unsupported arithmetic op ${t}`)}}}default:throw Error(`Unsupported expression node ${r.kind}`)}}(t.expression,a,o)}return i.write(n),{success:!0,value:n}},"dot",0,({inputs:t,output:r,target:i})=>{let{x:n,y:a}=t,o=new r.ValueType(r.length);for(let t=0;t<r.length;t++){let r=Mk(n,t),i=Mk(a,t),s=0;for(let t=0;t<n.size;t++)s+=r[t]*i[t];o[t]=s}return i.write(o),{success:!0,value:o}},"equalAll",0,({inputs:t,output:r,target:i})=>{let{x:n,y:a}=t,o=new r.ValueType(r.length);for(let t=0;t<r.length;t++){let r=Mk(n,t),i=Mk(a,t),s=1;for(let t=0;t<n.size;t++)if(r[t]!==i[t]){s=0;break}o[t]=s}return i.write(o),{success:!0,value:o}},"extent",0,({inputs:t,output:r,target:i})=>{let{sourceValues:n}=t;if(!n.value)throw Error(`${n} does not have CPU value`);let a=new r.ValueType(r.length*r.size);if(0===n.length)return{success:!1,error:Error(`${n} is empty`)};for(let t=0;t<n.size;t++){let i=Mk(n,0)[t],o=t*r.size,s=o+1;a[o]=i,a[s]=i;for(let r=1;r<n.length;r++){let i=Mk(n,r)[t];i<a[o]&&(a[o]=i),i>a[s]&&(a[s]=i)}}return i.write(a),{success:!0,value:a}},"fround",0,({inputs:t,output:r,target:i})=>MI({func:(t,r)=>{let i=t.length/2,n=new Float64Array(r.buffer);for(let r=0;r<i;r++){let a=n[r];t[r]=Math.fround(a),t[r+i]=a-t[r]}return t},inputs:t,output:r,outputBuffer:i}),"gather",0,MO,"interleave",0,({inputs:t,output:r,target:i})=>MI({func:(t,...r)=>{let i=0;for(let n of r)t.set(n,i),i+=n.length},inputs:t,output:r,outputBuffer:i}),"length",0,({inputs:t,output:r,target:i})=>{let{x:n}=t,a=new r.ValueType(r.length);for(let t=0;t<r.length;t++){let r=Mk(n,t),i=0;for(let t=0;t<n.size;t++)i+=r[t]*r[t];a[t]=Math.sqrt(i)}return i.write(a),{success:!0,value:a}},"segmentedMap",0,MN,"select",0,MR,"sequence",0,({inputs:t,output:r,target:i})=>{let n=new r.ValueType(r.length);for(let i=0;i<r.length;i++)n[i]=t.start+i*t.step;return i.write(n),{success:!0,value:n}},"swizzle",0,({inputs:t,output:r,target:i})=>{let{columns:n}=t;return MI({func:(t,r)=>{for(let i=0;i<n.length;i++)t[i]=r[n[i]]},inputs:{x:t.x},output:r,outputBuffer:i})}],683862);var MB=t.i(683862);let Mz=new class{_modules={cpu:MB};add(t,r){let i=this._modules[t];if("function"==typeof r.then){let n=Promise.all([Promise.resolve(i||{}),r]).then(([t,r])=>({...t,...r}));return this._modules[t]=n,n.then(r=>{this._modules[t]=r}).catch(r=>{bs.log.error(`Failed to register ${t} backend: ${r}`)()}),n}if(i&&"function"==typeof i.then){let n=Promise.resolve(i).then(t=>({...t,...r})).then(r=>(this._modules[t]=r,r)).catch(r=>{throw bs.log.error(`Failed to register ${t} backend: ${r}`)(),r});return this._modules[t]=n,n}let n={...i||{},...r};return this._modules[t]=n,Promise.resolve(n)}async get(r,i){let n=this._modules[r];if(!n)if("webgl"===r)n=this.add("webgl",t.A(170384));else if("webgpu"===r)n=this.add("webgpu",t.A(440706));else throw Error(`${r} backend not registered`);let a=(await n)[i];if("function"!=typeof a)throw Error(`${r} backend does not implement ${i}`);return a}getSync(t,r){let i=this._modules[t];if(!i)throw Error(`${t} backend not registered`);if("function"==typeof i.then)throw Error(`${t} backend is not loaded yet`);let n=i[r];if("function"!=typeof n)throw Error(`${t} backend does not implement ${r}`);return n}clear(){this._modules={}}};var Mj=t.i(311583),MU=t.i(962799),MV=t.i(474907);class M${gpuDataEvaluators;format;length;id;_gpuVector;_ownsGPUDataEvaluators;_destroyed=!1;static fromGPUVector(t){if(t.bufferLayout)throw Error(`GPUVectorEvaluator.fromGPUVector() does not accept interleaved vector "${t.name}"`);if(0===t.data.length)throw Error(`GPUVectorEvaluator.fromGPUVector() requires GPUData for "${t.name}"`);return new M$({id:t.name,gpuDataEvaluators:t.data.map(r=>MU.GPUDataEvaluator.fromGPUData(r,{id:t.name})),gpuVector:t,format:t.format})}static fromGPUDataEvaluators(t,r={}){return new M$({id:r.id,gpuDataEvaluators:t,format:r.format})}constructor({id:t,gpuDataEvaluators:r,gpuVector:i,format:n}){if(0===r.length)throw Error("GPUVectorEvaluator requires at least one GPUData evaluator");(function(t){let r=t[0];for(let i of t.slice(1))if(i.type!==r.type||i.size!==r.size||i.normalized!==r.normalized||i.format!==r.format)throw Error("GPUVectorEvaluator requires matching GPUData evaluator layouts")})(r),this.id=t,this.gpuDataEvaluators=r,this.format=n??r[0].format,this.length=r.reduce((t,r)=>t+r.length,0),this._gpuVector=i,this._ownsGPUDataEvaluators=!i}get evaluated(){return!!this._gpuVector}get gpuVector(){if(!this._gpuVector)throw Error(`${this} not evaluated`);return this._gpuVector}mapGPUData(t){return M$.fromGPUDataEvaluators(this.gpuDataEvaluators.map((r,i)=>t(r,i)),{id:this.id})}async evaluate(t,r={}){if(this._destroyed)throw Error(`GPUVectorEvaluator ${this} already destroyed`);if(this._gpuVector)return this._gpuVector;let i=await Promise.all(this.gpuDataEvaluators.map(i=>i.evaluate(t,r))),n=i[0],a=i.map(MG),o=r.format??this.format??n.format;return this._gpuVector=new MV.GPUVector({type:"data",name:r.name??this.id??"vector",format:o,data:a,stride:n.stride,byteStride:n.byteStride,rowByteLength:n.rowByteLength,bufferLayout:n.bufferLayout}),this._gpuVector}evaluateSync(t,r={}){if(this._destroyed)throw Error(`GPUVectorEvaluator ${this} already destroyed`);if(this._gpuVector)return this._gpuVector;let i=this.gpuDataEvaluators.map(i=>i.evaluateSync(t,r)),n=i[0],a=i.map(MG),o=r.format??this.format??n.format;return this._gpuVector=new MV.GPUVector({type:"data",name:r.name??this.id??"vector",format:o,data:a,stride:n.stride,byteStride:n.byteStride,rowByteLength:n.rowByteLength,bufferLayout:n.bufferLayout}),this._gpuVector}destroy(){if(this._ownsGPUDataEvaluators)for(let t of this.gpuDataEvaluators)t.destroy();this._gpuVector=void 0,this._destroyed=!0}toString(){return this.id??this.constructor.name}}function MG(t){let[r,...i]=t.data;if(!r||i.length>0)throw Error(`GPUVectorEvaluator requires one GPUData chunk for "${t.name}"`);return r}function Mq(t){return t instanceof MU.GPUDataEvaluator?[t.buffer]:t.gpuVector.data.map(t=>t.buffer instanceof Mj.DynamicBuffer?t.buffer.buffer:t.buffer)}class MH{inputs;
2259dependencies;constructor(t){this.inputs=t,this.dependencies=Array.from(t instanceof Array?t:Object.values(t)).filter(t=>t instanceof MU.GPUDataEvaluator)}async execute(t,r){return await this._resolveDependencies(t),await this._executeWithHandler(await Mz.get(this._getHandlerRegistry(t),this.name),r)}executeSync(t,r){var i;this._resolveDependenciesSync(t);let n=this._executeWithHandler(Mz.getSync(this._getHandlerRegistry(t),this.name),r);if(i=n,"function"==typeof i?.then)throw Error(`${this.name} returned a Promise in executeSync()`);return n}shouldExecuteOnCPU(){return this.output.length<=1&&Array.from(this.dependencies).every(t=>!!t.value)}_getHandlerRegistry(t){return this.shouldExecuteOnCPU()?"cpu":t.type}async _resolveDependencies(t){for(let r of this.dependencies)await r.evaluate(t);if("cpu"===this._getHandlerRegistry(t)||"null"===t.type)for(let t of this.dependencies)await t.ensureCPUValue()}_resolveDependenciesSync(t){for(let r of this.dependencies)r.evaluateSync(t);if("cpu"===this._getHandlerRegistry(t)||"null"===t.type)for(let t of this.dependencies)t.ensureCPUValueSync()}_executeWithHandler(t,r){return t({device:r.device,inputs:this.inputs,output:this.output,target:r})}}class MW extends MH{name="interleave";output;constructor(t){super(t);const{isConstant:r,type:i,length:n}=function(...t){let r=function(t){let r=0,i=0;for(let n of t){if("f"===n[0])return"float32";let t=n.endsWith("8")?8:n.endsWith("6")?16:32;"u"===n[0]?r=Math.max(r,t):i=Math.max(i,t)}return r&&!i?`uint${r}`:i&&r<32?`sint${Math.max(i,2*r)}`:"float32"}(t.map(t=>t.type));return"f"!==r[0]&&t.some(t=>t.normalized)&&(r="float32"),{isConstant:t.every(t=>t.isConstant),type:r,size:t.reduce((t,r)=>Math.max(t,r.size),0),length:t.reduce((t,r)=>Math.max(t,r.length),0)}}(...t);this.output=new MU.GPUDataEvaluator({isConstant:r,type:i,size:t.reduce((t,r)=>t+r.size,0),length:n,source:this})}toString(){return`_${this.inputs.join("_")}_`}}var MZ=t.i(593539);class MY{constructor(t,{id:r,isTransitionAttribute:i}){this.packedBuffers={},this.device=t,this.id=r,this.isTransitionAttribute=i,"webgpu"===this.device.type&&Mz.add("webgpu",{interleave:MZ.interleave})}hasGroups(t){return"webgpu"===this.device.type&&Object.values(t).some(t=>!!t.settings.bufferGroup)}finalize(){for(let t of Object.values(this.packedBuffers))t.packed.destroy();this.packedBuffers={}}getBufferLayouts(t,r){let i=this._getPackedGroups(t,r,{requireValues:!1,excludeAttributes:{}});return this._getBufferLayouts(t,i,r)}getBindings(t,r,i,n){let a=this._getPackedGroups(t,i,{requireValues:!0,excludeAttributes:n}),o={},s=new Set;for(let t of a.values()){let i=!this.packedBuffers[t.id]||t.attributes.some(t=>!!r[t.id]);for(let r of(o[t.id]=this._getPackedBuffer(t,i),t.attributes))s.add(r.id)}return{bufferLayouts:this._getBufferLayouts(t,a,i).filter(r=>!n[r.name]&&!t[r.name]?.settings.isIndexed),buffers:o,groupedAttributeIds:s}}_getPackedGroups(t,r,{requireValues:i,excludeAttributes:n}){let a=new Map;for(let r of Object.values(t)){let t=r.settings.bufferGroup;if(!t)continue;let i=a.get(t)||[];i.push(r),a.set(t,i)}let o=new Map;for(let[t,s]of a){let a=this._getPackedGroup(t,s,r,i,n);a&&o.set(t,a)}return o}_getPackedGroup(t,r,i,n,a){if(r.length<2)return null;let o=r.map(t=>t.getBufferLayout(i)),s=o[0].stepMode,l=Math.max(1,r[0].numInstances),u=n&&r.every(t=>t.isConstant);for(let t=0;t<r.length;t++){let i=r[t],u=i.getAccessor(),c=u.size*u.bytesPerElement;if(a[i.id]||i.settings.isIndexed||i.settings.noAlloc||i.doublePrecision||this.isTransitionAttribute(i.id)||o[t].stepMode!==s||i.numInstances!==r[0].numInstances||0!==(u.offset||0)||0!==(u.vertexOffset||0)||My(u)!==c||n&&(i.isConstant?!i.getConstantValue()||i.getConstantValue().byteLength<c:!ArrayBuffer.isView(i.value)||i.value.byteLength<l*c))return null}let c={},h=[],f=0;for(let t=0;t<r.length;t++){let i=r[t];for(let r of(f=MX(f),c[i.id]=f,o[t].attributes||[]))h.push({...r,byteOffset:f+(r.byteOffset||0)});f+=My(i.getAccessor())}return{id:t,attributes:r,byteStride:f=MX(f),byteOffsets:c,rowCount:l,layout:{name:t,byteStride:u?0:f,stepMode:s,attributes:h}}}_getBufferLayouts(t,r,i){let n=[],a=new Set,o=new Set;for(let t of r.values())for(let r of t.attributes)o.add(r.id);for(let s of Object.values(t)){let t=s.settings.bufferGroup,l=t&&r.get(t);l&&o.has(s.id)?a.has(l.id)||(n.push(l.layout),a.add(l.id)):n.push(s.getBufferLayout(i))}return n}_getPackedBuffer(t,r){let i=JSON.stringify({byteStride:t.layout.byteStride,attributes:t.layout.attributes}),n=this.packedBuffers[t.id];if(n&&n.layoutKey===i||(r=!0),r){n&&(n.packed.destroy(),delete this.packedBuffers[t.id]);let r=this._interleavePackedGroup(t);return this.packedBuffers[t.id]={packed:r,layoutKey:i},r.buffer}if(!n)throw Error(`Attribute buffer group ${t.id} has no packed buffer`);return n.packed.buffer}_interleavePackedGroup(t){let r=function(...t){if(0===t.length)throw Error("interleave() requires at least one input");return 1===t.length?(0,MU.getGPUDataEvaluator)(t[0]):new MW(t.map(MU.getGPUDataEvaluator)).output}(...t.attributes.map(r=>this._getInterleaveInput(t,r)));return!function(t,r){let i,n=(function t(r,i,n){var a;if((a=r)instanceof MU.GPUDataEvaluator||a instanceof M$)return void i.add(r);if(!(!r||"object"!=typeof r||n.has(r))){let a;if(n.add(r),Array.isArray(r)){for(let a of r)t(a,i,n);return}if((a=Object.getPrototypeOf(r))===Object.prototype||null===a)for(let a of Object.values(r))t(a,i,n)}}(r,i=new Set,new Set),Array.from(i));for(let r of n)r.evaluateSync(t);var a=n;let o=new Set(a.flatMap(Mq)),s=new Set;for(let t of a)!function t(r,i){if(r instanceof M$){for(let n of r.gpuDataEvaluators)t(n,i);return}let n=r.source;if(n){if(n instanceof MU.GPUDataEvaluator){i.has(n)||(i.add(n),t(n,i));return}for(let r of n.dependencies)i.has(r)||(i.add(r),t(r,i))}}(t,s);for(let t of s)t.evaluated&&!o.has(t.buffer)&&t.destroy()}(this.device,r),r}_getInterleaveInput(t,r){let i=My(r.getAccessor()),n=t.byteOffsets[r.id];if(MK(`${t.id}.${r.id} rowByteLength`,i),MK(`${t.id}.${r.id} groupByteOffset`,n),r.isConstant){let n=r.getConstantValue();if(!n)throw Error(`Attribute group ${t.id} is missing constant value ${r.id}`);return MK(`${t.id}.${r.id}
2259 constant byteOffset`,n.byteOffset),new MU.GPUDataEvaluator({id:r.id,type:"uint32",size:i/4,isConstant:!0,value:new Uint32Array(n.buffer,n.byteOffset,i/Uint32Array.BYTES_PER_ELEMENT)})}let a=r.getBuffer(),o=r.byteOffset,s=r.getAccessor().stride||i;if(MK(`${t.id}.${r.id} byteOffset`,o),MK(`${t.id}.${r.id} stride`,s),!a)throw Error(`Attribute group ${t.id} cannot interleave missing buffer ${r.id}`);return new MU.GPUDataEvaluator({id:r.id,type:"uint32",size:i/4,offset:o,stride:s,length:t.rowCount,buffer:a})}}function MX(t){return 4*Math.ceil(t/4)}function MK(t,r){if(r%4!=0)throw Error(`Attribute buffer groups require 32-bit alignment: ${t}=${r}`)}var MQ=t.i(443317);function MJ(t,r=[],i=0){let n=Math.fround(t),a=t-n;return r[i]=n,r[i+1]=a,r}let M0=`\ 2260 2261layout(std140) uniform fp64arithmeticUniforms { 2262 uniform float ONE; 2263 uniform float SPLIT; 2264} fp64; 2265 2266/* 2267About LUMA_FP64_CODE_ELIMINATION_WORKAROUND 2268 2269The purpose of this workaround is to prevent shader compilers from 2270optimizing away necessary arithmetic operations by swapping their sequences 2271or transform the equation to some 'equivalent' form. 2272 2273These helpers implement Dekker/Veltkamp-style error tracking. If the compiler 2274folds constants or reassociates the arithmetic, the high/low split can stop 2275tracking the rounding error correctly. That failure mode tends to look fine in 2276simple coordinate setup, but then breaks down inside iterative arithmetic such 2277as fp64 Mandelbrot loops. 2278 2279The method is to multiply an artifical variable, ONE, which will be known to 2280the compiler to be 1 only at runtime. The whole expression is then represented 2281as a polynomial with respective to ONE. In the coefficients of all terms, only one a 2282and one b should appear 2283 2284err = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE 2285*/ 2286 2287float prevent_fp64_optimization(float value) { 2288#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 2289 return value + fp64.ONE * 0.0; 2290#else 2291 return value; 2292#endif 2293} 2294 2295// Divide float number to high and low floats to extend fraction bits 2296vec2 split(float a) { 2297 // Keep SPLIT as a runtime uniform so the compiler cannot fold the Dekker 2298 // split into a constant expression and reassociate the recovery steps. 2299 float split = prevent_fp64_optimization(fp64.SPLIT); 2300 float t = prevent_fp64_optimization(a * split); 2301 float temp = t - a; 2302 float a_hi = t - temp; 2303 float a_lo = a - a_hi; 2304 return vec2(a_hi, a_lo); 2305} 2306 2307// Divide float number again when high float uses too many fraction bits 2308vec2 split2(vec2 a) { 2309 vec2 b = split(a.x); 2310 b.y += a.y; 2311 return b; 2312} 2313 2314// Special sum operation when a > b 2315vec2 quickTwoSum(float a, float b) { 2316#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 2317 float sum = (a + b) * fp64.ONE; 2318 float err = b - (sum - a) * fp64.ONE; 2319#else 2320 float sum = a + b; 2321 float err = b - (sum - a); 2322#endif 2323 return vec2(sum, err); 2324} 2325 2326// General sum operation 2327vec2 twoSum(float a, float b) { 2328 float s = (a + b); 2329#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 2330 float v = (s * fp64.ONE - a) * fp64.ONE; 2331 float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE + (b - v); 2332#else 2333 float v = s - a; 2334 float err = (a - (s - v)) + (b - v); 2335#endif 2336 return vec2(s, err); 2337} 2338 2339vec2 twoSub(float a, float b) { 2340 float s = (a - b); 2341#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 2342 float v = (s * fp64.ONE - a) * fp64.ONE; 2343 float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE - (b + v); 2344#else 2345 float v = s - a; 2346 float err = (a - (s - v)) - (b + v); 2347#endif 2348 return vec2(s, err); 2349} 2350 2351vec2 twoSqr(float a) { 2352 float prod = a * a; 2353 vec2 a_fp64 = split(a); 2354#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 2355 float err = ((a_fp64.x * a_fp64.x - prod) * fp64.ONE + 2.0 * a_fp64.x * 2356 a_fp64.y * fp64.ONE * fp64.ONE) + a_fp64.y * a_fp64.y * fp64.ONE * fp64.ONE * fp64.ONE; 2357#else 2358 float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y; 2359#endif 2360 return vec2(prod, err); 2361} 2362 2363vec2 twoProd(float a, float b) { 2364 float prod = a * b; 2365 vec2 a_fp64 = split(a); 2366 vec2 b_fp64 = split(b); 2367 // twoProd is especially sensitive because mul_fp64 and div_fp64 both depend 2368 // on the split terms and cross terms staying in the original evaluation 2369 // order. If the compiler folds or reassociates them, the low part tends to 2370 // collapse to zero or NaN on some drivers. 2371 float highProduct = prevent_fp64_optimization(a_fp64.x * b_fp64.x); 2372 float crossProduct1 = prevent_fp64_optimization(a_fp64.x * b_fp64.y); 2373 float crossProduct2 = prevent_fp64_optimization(a_fp64.y * b_fp64.x); 2374 float lowProduct = prevent_fp64_optimization(a_fp64.y * b_fp64.y); 2375#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 2376 float err1 = (highProduct - prod) * fp64.ONE; 2377 float err2 = crossProduct1 * fp64.ONE * fp64.ONE; 2378 float err3 = crossProduct2 * fp64.ONE * fp64.ONE * fp64.ONE; 2379 float err4 = lowProduct * fp64.ONE * fp64.ONE * fp64.ONE * fp64.ONE; 2380#else 2381 float err1 = highProduct - prod; 2382 float err2 = crossProduct1; 2383 float err3 = crossProduct2; 2384 float err4 = lowProduct; 2385#endif 2386 float err = ((err1 + err2) + err3) + err4; 2387 return vec2(prod, err); 2388} 2389 2390vec2 sum_fp64(vec2 a, vec2 b) { 2391 vec2 s, t;
2392 s = twoSum(a.x, b.x); 2393 t = twoSum(a.y, b.y); 2394 s.y += t.x; 2395 s = quickTwoSum(s.x, s.y); 2396 s.y += t.y; 2397 s = quickTwoSum(s.x, s.y); 2398 return s; 2399} 2400 2401vec2 sub_fp64(vec2 a, vec2 b) { 2402 vec2 s, t; 2403 s = twoSub(a.x, b.x); 2404 t = twoSub(a.y, b.y); 2405 s.y += t.x; 2406 s = quickTwoSum(s.x, s.y); 2407 s.y += t.y; 2408 s = quickTwoSum(s.x, s.y); 2409 return s; 2410} 2411 2412vec2 mul_fp64(vec2 a, vec2 b) { 2413 vec2 prod = twoProd(a.x, b.x); 2414 // y component is for the error 2415 prod.y += a.x * b.y; 2416#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 2417 prod = split2(prod); 2418#endif 2419 prod = quickTwoSum(prod.x, prod.y); 2420 prod.y += a.y * b.x; 2421#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 2422 prod = split2(prod); 2423#endif 2424 prod = quickTwoSum(prod.x, prod.y); 2425 return prod; 2426} 2427 2428vec2 div_fp64(vec2 a, vec2 b) { 2429 float xn = 1.0 / b.x; 2430#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 2431 vec2 yn = mul_fp64(a, vec2(xn, 0)); 2432#else 2433 vec2 yn = a * xn; 2434#endif 2435 float diff = (sub_fp64(a, mul_fp64(b, yn))).x; 2436 vec2 prod = twoProd(xn, diff); 2437 return sum_fp64(yn, prod); 2438} 2439 2440vec2 sqrt_fp64(vec2 a) { 2441 if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0); 2442 if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0); 2443 2444 float x = 1.0 / sqrt(a.x); 2445 float yn = a.x * x; 2446#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 2447 vec2 yn_sqr = twoSqr(yn) * fp64.ONE; 2448#else 2449 vec2 yn_sqr = twoSqr(yn); 2450#endif 2451 float diff = sub_fp64(a, yn_sqr).x; 2452 vec2 prod = twoProd(x * 0.5, diff); 2453#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 2454 return sum_fp64(split(yn), prod); 2455#else 2456 return sum_fp64(vec2(yn, 0.0), prod); 2457#endif 2458} 2459`,M1=`\ 2460struct Fp64F32Bits { 2461 sign: u32, 2462 baseExponent: i32, 2463 significand: u32, 2464 isZero: bool, 2465 isInf: bool, 2466 isNan: bool, 2467}; 2468 2469// Decode an f32 as (-1)^sign * significand * 2^baseExponent. 2470fn fp64_decode_f32_bits(bits: u32) -> Fp64F32Bits { 2471 let sign = bits >> 31u; 2472 let exponentBits = (bits >> 23u) & 0xffu; 2473 let fraction = bits & 0x7fffffu; 2474 2475 if (exponentBits == 0xffu) { 2476 return Fp64F32Bits(sign, 0, 0u, false, fraction == 0u, fraction != 0u); 2477 } 2478 if (exponentBits == 0u) { 2479 return Fp64F32Bits(sign, -149, fraction, fraction == 0u, false, false); 2480 } 2481 return Fp64F32Bits(sign, i32(exponentBits) - 150, 0x800000u | fraction, false, false, false); 2482} 2483 2484fn fp64_f32_magnitude_compare(aBits: u32, bBits: u32) -> i32 { 2485 let aMagnitude = aBits & 0x7fffffffu; 2486 let bMagnitude = bBits & 0x7fffffffu; 2487 if (aMagnitude == bMagnitude) { 2488 return 0; 2489 } 2490 return select(-1, 1, aMagnitude > bMagnitude); 2491} 2492 2493fn fp64_make_residual_f32_bits( 2494 exactSign: u32, 2495 exactMagnitude: vec2u, 2496 exactBaseExponent: i32, 2497 highBits: u32 2498) -> u32 { 2499 if (fp64_u64_is_zero(exactMagnitude)) { 2500 return 0u; 2501 } 2502 2503 let high = fp64_decode_f32_bits(highBits); 2504 if (high.isInf || high.isNan) { 2505 return exactSign << 31u; 2506 } 2507 if (high.isZero) { 2508 return fp64_make_f32_bits_from_u64(exactSign, exactMagnitude, exactBaseExponent); 2509 } 2510 2511 let commonBaseExponent = min(exactBaseExponent, high.baseExponent); 2512 let exactShift = exactBaseExponent - commonBaseExponent; 2513 let highShift = high.baseExponent - commonBaseExponent; 2514 2515 // A normal two-sum/two-product residual never needs a shift this large. 2516 // This guard gives deterministic underflow behavior outside that contract. 2517 if (exactShift >= 64 || highShift >= 64) { 2518 return exactSign << 31u; 2519 } 2520 2521 let exactAligned = fp64_u64_shift_left(exactMagnitude, u32(exactShift)); 2522 let highAligned = fp64_u64_shift_left(vec2u(0u, high.significand), u32(highShift)); 2523 let comparison = fp64_u64_compare(exactAligned, highAligned); 2524 if (comparison == 0) { 2525 return 0u; 2526 } 2527 2528 var residualSign = exactSign; 2529 var residualMagnitude: vec2u; 2530 if (comparison > 0) { 2531 residualMagnitude = fp64_u64_sub(exactAligned, highAligned); 2532 } else { 2533 residualSign = exactSign ^ 1u; 2534 residualMagnitude = fp64_u64_sub(highAligned, exactAligned); 2535 } 2536 return fp64_make_f32_bits_from_u64( 2537 residualSign, 2538 residualMagnitude, 2539 commonBaseExponent 2540 ); 2541} 2542 2543fn fp64_split_accumulator_bits( 2544 sign: u32, 2545 magnitude: vec2u, 2546 baseExponent: i32 2547) -> vec2u { 2548 let highBits = fp64_make_f32_bits_from_u64(sign, magnitude, baseExponent); 2549 let lowBits = fp64_make_residual_f32_bits(sign, magnitude, baseExponent, highBits); 2550 return vec2u(highBits, lowBits); 2551} 2552 2553fn fp64_two_sum_integer_bits(aBits: u32, bBits: u32) -> vec2u { 2554 let a = fp64_decode_f32_bits(aBits); 2555 let b = fp64_decode_f32_bits(bBits); 2556 2557 if (a.isNan || b.isNan) { 2558 return vec2u(0x7fc00000u, 0u); 2559 } 2560 if (a.isInf || b.isInf) { 2561 if (a.isInf && b.isInf && a.sign != b.sign) { 2562 return vec2u(0x7fc00000u, 0u); 2563 } 2564 return select(vec2u(bBits, 0u), vec2u(aBits, 0u), a.isInf); 2565 } 2566 if (a.isZero && b.isZero) { 2567 return vec2u((a.sign & b.sign) << 31u, 0u); 2568 } 2569 if (a.isZero) { 2570 return vec2u(bBits, 0u); 2571 } 2572 if (b.isZero) { 2573 return vec2u(aBits, 0u); 2574 } 2575 2576 let exponentDifference = select( 2577 b.baseExponent - a.baseExponent, 2578 a.baseExponent - b.baseExponent, 2579 a.baseExponent >= b.baseExponent 2580 ); 2581
2582 // Beyond half an ulp, rounding cannot change the larger operand. Returning 2583 // the smaller operand intact also avoids an unbounded integer alignment. 2584 // At a power-of-two boundary the spacing below the larger operand is half 2585 // the spacing above it, so an opposite-sign gap-25 operand can still change 2586 // the rounded high limb. Gap 26 is the first universally safe early-out. 2587 if (exponentDifference > 25) { 2588 if (fp64_f32_magnitude_compare(aBits, bBits) >= 0) { 2589 return vec2u(aBits, bBits); 2590 } 2591 return vec2u(bBits, aBits); 2592 } 2593 2594 let commonBaseExponent = min(a.baseExponent, b.baseExponent); 2595 let aMagnitude = fp64_u64_shift_left( 2596 vec2u(0u, a.significand), 2597 u32(a.baseExponent - commonBaseExponent) 2598 ); 2599 let bMagnitude = fp64_u64_shift_left( 2600 vec2u(0u, b.significand), 2601 u32(b.baseExponent - commonBaseExponent) 2602 ); 2603 2604 var resultSign = a.sign; 2605 var resultMagnitude: vec2u; 2606 if (a.sign == b.sign) { 2607 resultMagnitude = fp64_u64_add(aMagnitude, bMagnitude); 2608 } else { 2609 let comparison = fp64_u64_compare(aMagnitude, bMagnitude); 2610 if (comparison == 0) { 2611 return vec2u(0u, 0u); 2612 } 2613 if (comparison > 0) { 2614 resultMagnitude = fp64_u64_sub(aMagnitude, bMagnitude); 2615 } else { 2616 resultSign = b.sign; 2617 resultMagnitude = fp64_u64_sub(bMagnitude, aMagnitude); 2618 } 2619 } 2620 2621 return fp64_split_accumulator_bits(resultSign, resultMagnitude, commonBaseExponent); 2622} 2623 2624fn fp64_two_sum_integer(a: f32, b: f32) -> vec2f { 2625 let resultBits = fp64_two_sum_integer_bits(bitcast<u32>(a), bitcast<u32>(b)); 2626 return vec2f(bitcast<f32>(resultBits.x), bitcast<f32>(resultBits.y)); 2627} 2628 2629fn fp64_multiply_significands(a: u32, b: u32) -> vec2u { 2630 let aLow = a & 0xffffu; 2631 let aHigh = a >> 16u; 2632 let bLow = b & 0xffffu; 2633 let bHigh = b >> 16u; 2634 let lowProduct = aLow * bLow; 2635 let crossProduct = aLow * bHigh + aHigh * bLow; 2636 let highProduct = aHigh * bHigh; 2637 2638 var result = vec2u(0u, lowProduct); 2639 result = fp64_u64_add( 2640 result, 2641 fp64_u64_shift_left(vec2u(0u, crossProduct), 16u) 2642 ); 2643 result = fp64_u64_add(result, vec2u(highProduct, 0u)); 2644 return result; 2645} 2646 2647fn fp64_two_prod_integer_bits(aBits: u32, bBits: u32) -> vec2u { 2648 let a = fp64_decode_f32_bits(aBits); 2649 let b = fp64_decode_f32_bits(bBits); 2650 let resultSign = a.sign ^ b.sign; 2651 2652 if (a.isNan || b.isNan || ((a.isZero || b.isZero) && (a.isInf || b.isInf))) { 2653 return vec2u(0x7fc00000u, 0u); 2654 } 2655 if (a.isInf || b.isInf) { 2656 return vec2u((resultSign << 31u) | 0x7f800000u, resultSign << 31u); 2657 } 2658 if (a.isZero || b.isZero) { 2659 return vec2u(resultSign << 31u, resultSign << 31u); 2660 } 2661 2662 let magnitude = fp64_multiply_significands(a.significand, b.significand); 2663 return fp64_split_accumulator_bits( 2664 resultSign, 2665 magnitude, 2666 a.baseExponent + b.baseExponent 2667 ); 2668} 2669 2670fn fp64_two_prod_integer(a: f32, b: f32) -> vec2f { 2671 let resultBits = fp64_two_prod_integer_bits(bitcast<u32>(a), bitcast<u32>(b)); 2672 return vec2f(bitcast<f32>(resultBits.x), bitcast<f32>(resultBits.y)); 2673} 2674 2675fn fp64_round_add_integer(a: f32, b: f32) -> f32 { 2676 return fp64_two_sum_integer(a, b).x; 2677} 2678 2679fn fp64_round_mul_integer(a: f32, b: f32) -> f32 { 2680 return fp64_two_prod_integer(a, b).x; 2681} 2682 2683#ifndef LUMA_FP64_PREDICATE_ONLY 2684fn fp64_f32_finite_exponent(value: Fp64F32Bits) -> i32 { 2685 let mostSignificantBit = 31u - countLeadingZeros(value.significand); 2686 return value.baseExponent + i32(mostSignificantBit); 2687} 2688 2689fn fp64_scale_f32_integer(value: f32, exponent: i32) -> f32 { 2690 let decoded = fp64_decode_f32_bits(bitcast<u32>(value)); 2691 if (decoded.isZero || decoded.isInf || decoded.isNan) { 2692 return value; 2693 } 2694 let resultBits = fp64_make_f32_bits_from_u64( 2695 decoded.sign, 2696 vec2u(0u, decoded.significand), 2697 decoded.baseExponent + exponent 2698 ); 2699 return bitcast<f32>(resultBits); 2700} 2701 2702// Divide normalized significands so the hardware operation cannot overflow, 2703// underflow, or flush a subnormal result. Reapply the exponent with integer 2704// packing, which also produces subnormal correction limbs without relying on 2705// floating-point arithmetic to preserve them. 2706fn fp64_divide_f32_integer(aValue: f32, bValue: f32) -> f32 { 2707 let a = fp64_decode_f32_bits(bitcast<u32>(aValue)); 2708 let b = fp64_decode_f32_bits(bitcast<u32>(bValue)); 2709 if (a.isZero || b.isZero || a.isInf || b.isInf || a.isNan || b.isNan) { 2710 return aValue / bValue; 2711 } 2712 2713 let aMostSignificantBit = 31u - countLeadingZeros(a.significand); 2714 let bMostSignificantBit = 31u - countLeadingZeros(b.significand); 2715 let normalizedABits = fp64_make_f32_bits_from_u64( 2716 a.sign, 2717 vec2u(0u, a.significand), 2718 -i32(aMostSignificantBit) 2719 ); 2720 let normalizedBBits = fp64_make_f32_bits_from_u64( 2721 b.sign, 2722 vec2u(0u, b.significand), 2723 -i32(bMostSignificantBit) 2724 ); 2725 let normalizedQuotient = bitcast<f32>(normalizedABits) / bitcast<f32>(normalizedBBits); 2726 let quotient = fp64_decode_f32_bits(bitcast<u32>(normalizedQuotient)); 2727 let exponentShift = 2728 a.baseExponent + i32(aMostSignificantBit) - 2729 b.baseExponent - i32(bMostSignificantBit); 2730 let quotientBits = fp64_make_f32_bits_from_u64( 2731 quotient.sign, 2732 vec2u(0u, quotient.significand), 2733 quotient.baseExponent + exponentShift 2734 ); 2735 return bitcast<f32>(quotientBits); 2736} 2737#endif 2738 2739#ifndef LUMA_FP64_PREDICATE_ONLY 2740fn split(a: f32) -> vec2f { 2741 let aBits = bitcast<u32>(a); 2742 let decoded = fp64_decode_f32_bits(aBits); 2743 if (decoded.isZero || decoded.isInf || decoded.isNan) { 2744 return vec2f(a, 0.0); 2745 } 2746 2747 var roundedHigh = decoded.significand >> 12u; 2748 let remainder = decoded.significand & 0xfffu; 2749 if (remainder >
2749 0x800u || (remainder == 0x800u && (roundedHigh & 1u) == 1u)) { 2750 roundedHigh = roundedHigh + 1u; 2751 } 2752 var highMagnitude = vec2u(0u, roundedHigh << 12u); 2753 var highBits = fp64_make_f32_bits_from_u64( 2754 decoded.sign, 2755 highMagnitude, 2756 decoded.baseExponent 2757 ); 2758 // Rounding the high limb of a maximum-exponent value can overflow even 2759 // though the original value is finite. Truncate only in that boundary case 2760 // so split remains an exact finite decomposition. 2761 if (fp64_decode_f32_bits(highBits).isInf) { 2762 roundedHigh = decoded.significand >> 12u; 2763 highMagnitude = vec2u(0u, roundedHigh << 12u); 2764 highBits = fp64_make_f32_bits_from_u64( 2765 decoded.sign, 2766 highMagnitude, 2767 decoded.baseExponent 2768 ); 2769 } 2770 let lowBits = fp64_make_residual_f32_bits( 2771 decoded.sign, 2772 vec2u(0u, decoded.significand), 2773 decoded.baseExponent, 2774 highBits 2775 ); 2776 return vec2f(bitcast<f32>(highBits), bitcast<f32>(lowBits)); 2777} 2778 2779fn split2(a: vec2f) -> vec2f { 2780 var result = split(a.x); 2781 result.y = fp64_round_add_integer(result.y, a.y); 2782 return result; 2783} 2784#endif 2785 2786#ifndef LUMA_FP64_PREDICATE_ONLY 2787fn quickTwoSum(a: f32, b: f32) -> vec2f { 2788 return fp64_two_sum_integer(a, b); 2789} 2790#endif 2791 2792fn twoSum(a: f32, b: f32) -> vec2f { 2793 return fp64_two_sum_integer(a, b); 2794} 2795 2796fn twoSub(a: f32, b: f32) -> vec2f { 2797 let bBits = bitcast<u32>(b) ^ 0x80000000u; 2798 let resultBits = fp64_two_sum_integer_bits(bitcast<u32>(a), bBits); 2799 return vec2f(bitcast<f32>(resultBits.x), bitcast<f32>(resultBits.y)); 2800} 2801 2802#ifndef LUMA_FP64_PREDICATE_ONLY 2803fn twoSqr(a: f32) -> vec2f { 2804 return fp64_two_prod_integer(a, a); 2805} 2806 2807fn twoProd(a: f32, b: f32) -> vec2f { 2808 return fp64_two_prod_integer(a, b); 2809} 2810#endif 2811 2812fn sum_fp64(a: vec2f, b: vec2f) -> vec2f { 2813 var sum = fp64_two_sum_integer(a.x, b.x); 2814 let lowSum = fp64_two_sum_integer(a.y, b.y); 2815 sum.y = fp64_round_add_integer(sum.y, lowSum.x); 2816 sum = fp64_two_sum_integer(sum.x, sum.y); 2817 sum.y = fp64_round_add_integer(sum.y, lowSum.y); 2818 return fp64_two_sum_integer(sum.x, sum.y); 2819} 2820 2821fn sub_fp64(a: vec2f, b: vec2f) -> vec2f { 2822 let negatedB = vec2f( 2823 bitcast<f32>(bitcast<u32>(b.x) ^ 0x80000000u), 2824 bitcast<f32>(bitcast<u32>(b.y) ^ 0x80000000u) 2825 ); 2826 return sum_fp64(a, negatedB); 2827} 2828 2829fn mul_fp64(a: vec2f, b: vec2f) -> vec2f { 2830 var product = fp64_two_prod_integer(a.x, b.x); 2831 let crossProduct1 = fp64_round_mul_integer(a.x, b.y); 2832 product.y = fp64_round_add_integer(product.y, crossProduct1); 2833 product = fp64_two_sum_integer(product.x, product.y); 2834 let crossProduct2 = fp64_round_mul_integer(a.y, b.x); 2835 product.y = fp64_round_add_integer(product.y, crossProduct2); 2836 return fp64_two_sum_integer(product.x, product.y); 2837} 2838 2839#ifndef LUMA_FP64_PREDICATE_ONLY 2840fn fp64_scale_fp64_integer(value: vec2f, exponent: i32) -> vec2f { 2841 let high = fp64_scale_f32_integer(value.x, exponent); 2842 let low = fp64_scale_f32_integer(value.y, exponent); 2843 return sum_fp64(vec2f(high, 0.0), vec2f(low, 0.0)); 2844} 2845 2846fn fp64_div_fp64_normalized(a: vec2f, b: vec2f) -> vec2f { 2847 let quotientHigh = fp64_divide_f32_integer(a.x, b.x); 2848 var quotient = vec2f(quotientHigh, 0.0); 2849 2850 let remainder = sub_fp64(a, mul_fp64(b, quotient)); 2851 let quotientLow = fp64_divide_f32_integer(remainder.x, b.x); 2852 quotient = sum_fp64(quotient, vec2f(quotientLow, 0.0)); 2853 2854 let secondRemainder = sub_fp64(a, mul_fp64(b, quotient)); 2855 let correction = fp64_divide_f32_integer(secondRemainder.x, b.x); 2856 return sum_fp64(quotient, vec2f(correction, 0.0)); 2857} 2858 2859fn div_fp64(a: vec2f, b: vec2f) -> vec2f { 2860 let decodedA = fp64_decode_f32_bits(bitcast<u32>(a.x)); 2861 let decodedB = fp64_decode_f32_bits(bitcast<u32>(b.x)); 2862 if ( 2863 decodedA.isZero || decodedB.isZero || 2864 decodedA.isInf || decodedB.isInf || 2865 decodedA.isNan || decodedB.isNan 2866 ) { 2867 return fp64_div_fp64_normalized(a, b); 2868 } 2869 2870 let exponentA = fp64_f32_finite_exponent(decodedA); 2871 let exponentB = fp64_f32_finite_exponent(decodedB); 2872 // Correct the quotient near unity so b * q and the remainder stay clear of 2873 // both f32 underflow and overflow. The exponent difference is applied once. 2874 let normalizedA = fp64_scale_fp64_integer(a, -exponentA); 2875 let normalizedB = fp64_scale_fp64_integer(b, -exponentB); 2876 let normalizedQuotient = fp64_div_fp64_normalized(normalizedA, normalizedB); 2877 return fp64_scale_fp64_integer(normalizedQuotient, exponentA - exponentB); 2878} 2879 2880fn fp64_sqrt_fp64_normalized(a: vec2f) -> vec2f { 2881 let estimate = sqrt(a.x); 2882 let difference = sub_fp64(a, fp64_two_prod_integer(estimate, estimate)).x;
2883 let denominator = fp64_round_add_integer(estimate, estimate); 2884 let correction = fp64_divide_f32_integer(difference, denominator); 2885 return sum_fp64(vec2f(estimate, 0.0), vec2f(correction, 0.0)); 2886} 2887 2888fn sqrt_fp64(a: vec2f) -> vec2f { 2889 let decoded = fp64_decode_f32_bits(bitcast<u32>(a.x)); 2890 let decodedLow = fp64_decode_f32_bits(bitcast<u32>(a.y)); 2891 if (decoded.isZero && decodedLow.isZero) { 2892 return vec2f(0.0, 0.0); 2893 } 2894 if (decoded.sign == 1u) { 2895 let nanValue = fp64_nan(a.x); 2896 return vec2f(nanValue, nanValue); 2897 } 2898 2899 if (decoded.isInf || decoded.isNan) { 2900 return fp64_sqrt_fp64_normalized(a); 2901 } 2902 let exponent = fp64_f32_finite_exponent(decoded); 2903 // An even scale lets the final square-root rescale use an integer exponent. 2904 let evenExponent = exponent - (exponent & 1); 2905 let normalizedA = fp64_scale_fp64_integer(a, -evenExponent); 2906 let normalizedRoot = fp64_sqrt_fp64_normalized(normalizedA); 2907 return fp64_scale_fp64_integer(normalizedRoot, evenExponent / 2); 2908} 2909#endif 2910`,M2={name:"fp64arithmetic",source:`\ 2911struct Fp64ArithmeticUniforms { 2912 ONE: f32, 2913 SPLIT: f32, 2914}; 2915 2916@group(0) @binding(auto) var<uniform> fp64arithmetic : Fp64ArithmeticUniforms; 2917 2918#ifndef LUMA_FP64_F32_INPUT_ONLY 2919struct Fp64Bits { 2920 sign: u32, 2921 exponent: i32, 2922 significand: vec2u, 2923 isZero: bool, 2924 isInf: bool, 2925 isNan: bool, 2926}; 2927#endif 2928 2929#ifndef LUMA_FP64_PREDICATE_ONLY 2930fn fp64_nan(seed: f32) -> f32 { 2931 let nanBits = 0x7fc00000u | select(0u, 1u, seed < 0.0); 2932 return bitcast<f32>(nanBits); 2933} 2934#endif 2935 2936fn fp64_u64_is_zero(value: vec2u) -> bool { 2937 return value.x == 0u && value.y == 0u; 2938} 2939 2940fn fp64_u64_compare(a: vec2u, b: vec2u) -> i32 { 2941 if (a.x != b.x) { 2942 return select(-1, 1, a.x > b.x); 2943 } 2944 if (a.y != b.y) { 2945 return select(-1, 1, a.y > b.y); 2946 } 2947 return 0; 2948} 2949 2950fn fp64_u64_add(a: vec2u, b: vec2u) -> vec2u { 2951 let low = a.y + b.y; 2952 let carry = select(0u, 1u, low < a.y); 2953 return vec2u(a.x + b.x + carry, low); 2954} 2955 2956fn fp64_u64_sub(a: vec2u, b: vec2u) -> vec2u { 2957 let borrow = select(0u, 1u, a.y < b.y); 2958 return vec2u(a.x - b.x - borrow, a.y - b.y); 2959} 2960 2961fn fp64_u64_shift_left(value: vec2u, shift: u32) -> vec2u { 2962 if (shift == 0u) { 2963 return value; 2964 } 2965 if (shift < 32u) { 2966 return vec2u((value.x << shift) | (value.y >> (32u - shift)), value.y << shift); 2967 } 2968 if (shift == 32u) { 2969 return vec2u(value.y, 0u); 2970 } 2971 if (shift < 64u) { 2972 return vec2u(value.y << (shift - 32u), 0u); 2973 } 2974 return vec2u(0u); 2975} 2976 2977fn fp64_u64_shift_right(value: vec2u, shift: u32) -> vec2u { 2978 if (shift == 0u) { 2979 return value; 2980 } 2981 if (shift < 32u) { 2982 return vec2u(value.x >> shift, (value.y >> shift) | (value.x << (32u - shift))); 2983 } 2984 if (shift == 32u) { 2985 return vec2u(0u, value.x); 2986 } 2987 if (shift < 64u) { 2988 return vec2u(0u, value.x >> (shift - 32u)); 2989 } 2990 return vec2u(0u); 2991} 2992 2993fn fp64_u64_get_bit(value: vec2u, bitIndex: u32) -> bool { 2994 if (bitIndex >= 64u) { 2995 return false; 2996 } 2997 if (bitIndex >= 32u) { 2998 return ((value.x >> (bitIndex - 32u)) & 1u) != 0u; 2999 } 3000 return ((value.y >> bitIndex) & 1u) != 0u; 3001} 3002 3003fn fp64_u64_has_bits_below(value: vec2u, bitCount: u32) -> bool { 3004 if (bitCount == 0u) { 3005 return false; 3006 } 3007 if (bitCount >= 64u) { 3008 return !fp64_u64_is_zero(value); 3009 } 3010 if (bitCount > 32u) { 3011 let highBitCount = bitCount - 32u; 3012 let highMask = (1u << highBitCount) - 1u; 3013 return value.y != 0u || (value.x & highMask) != 0u; 3014 } 3015 if (bitCount == 32u) { 3016 return value.y != 0u; 3017 } 3018 let lowMask = (1u << bitCount) - 1u; 3019 return (value.y & lowMask) != 0u; 3020} 3021 3022#ifndef LUMA_FP64_F32_INPUT_ONLY 3023fn fp64_u64_shift_right_sticky(value: vec2u, shift: u32) -> vec2u { 3024 var shifted = fp64_u64_shift_right(value, shift); 3025 if (fp64_u64_has_bits_below(value, shift)) { 3026 shifted.y = shifted.y | 1u; 3027 } 3028 return shifted; 3029} 3030#endif 3031 3032fn fp64_u64_count_leading_zeros(value: vec2u) -> u32 { 3033 if (value.x != 0u) { 3034 return countLeadingZeros(value.x); 3035 } 3036 return 32u + countLeadingZeros(value.y); 3037} 3038 3039fn fp64_round_shift_right_to_u32(value: vec2u, shift: u32) -> u32 { 3040 if (shift == 0u) { 3041 return value.y; 3042 } 3043 3044 let truncated = fp64_u64_shift_right(value, shift); 3045 var rounded = truncated.y; 3046 let guard = fp64_u64_get_bit(value, shift - 1u); 3047 let hasTrailingBits = fp64_u64_has_bits_below(value, shift - 1u); 3048 if (guard && (hasTrailingBits || (rounded & 1u) == 1u)) { 3049 rounded = rounded + 1u; 3050 } 3051 return rounded; 3052} 3053 3054#ifndef LUMA_FP64_F32_INPUT_ONLY
3055fn fp64_round_shift_right(value: vec2u, shift: u32) -> vec2u { 3056 if (shift == 0u) { 3057 return value; 3058 } 3059 3060 var rounded = fp64_u64_shift_right(value, shift); 3061 let guard = fp64_u64_get_bit(value, shift - 1u); 3062 let hasTrailingBits = fp64_u64_has_bits_below(value, shift - 1u); 3063 if (guard && (hasTrailingBits || (rounded.y & 1u) == 1u)) { 3064 rounded = fp64_u64_add(rounded, vec2u(0u, 1u)); 3065 } 3066 return rounded; 3067} 3068#endif 3069 3070fn fp64_make_f32_bits_from_u64(sign: u32, significand: vec2u, baseExponent: i32) -> u32 { 3071 if (fp64_u64_is_zero(significand)) { 3072 return sign << 31u; 3073 } 3074 3075 let leadingZeros = fp64_u64_count_leading_zeros(significand); 3076 let mostSignificantBit = 63u - leadingZeros; 3077 var exponent = baseExponent + i32(mostSignificantBit); 3078 3079 if (exponent > 127) { 3080 return (sign << 31u) | 0x7f800000u; 3081 } 3082 3083 if (exponent >= -126) { 3084 let shift = i32(mostSignificantBit) - 23; 3085 var significand24: u32; 3086 if (shift > 0) { 3087 significand24 = fp64_round_shift_right_to_u32(significand, u32(shift)); 3088 } else { 3089 significand24 = fp64_u64_shift_left(significand, u32(-shift)).y; 3090 } 3091 3092 if (significand24 >= 0x1000000u) { 3093 significand24 = significand24 >> 1u; 3094 exponent = exponent + 1; 3095 if (exponent > 127) { 3096 return (sign << 31u) | 0x7f800000u; 3097 } 3098 } 3099 3100 return (sign << 31u) | (u32(exponent + 127) << 23u) | (significand24 & 0x7fffffu); 3101 } 3102 3103 let scaleExponent = baseExponent + 149; 3104 var mantissa: u32; 3105 if (scaleExponent >= 0) { 3106 mantissa = fp64_u64_shift_left(significand, u32(scaleExponent)).y; 3107 } else { 3108 mantissa = fp64_round_shift_right_to_u32(significand, u32(-scaleExponent)); 3109 } 3110 3111 if (mantissa >= 0x800000u) { 3112 return (sign << 31u) | 0x00800000u; 3113 } 3114 return (sign << 31u) | mantissa; 3115} 3116 3117#ifndef LUMA_FP64_F32_INPUT_ONLY 3118fn fp64_decode_bits(bits: vec2u) -> Fp64Bits { 3119 let sign = bits.x >> 31u; 3120 let exponentBits = (bits.x >> 20u) & 0x7ffu; 3121 let fractionHigh = bits.x & 0xfffffu; 3122 let fractionLow = bits.y; 3123 let fraction = vec2u(fractionHigh, fractionLow); 3124 3125 if (exponentBits == 0x7ffu) { 3126 let isInf = fp64_u64_is_zero(fraction); 3127 return Fp64Bits(sign, 0, vec2u(0u), false, isInf, !isInf); 3128 } 3129 3130 if (exponentBits == 0u) { 3131 let isZero = fp64_u64_is_zero(fraction); 3132 return Fp64Bits(sign, -1022, fraction, isZero, false, false); 3133 } 3134 3135 return Fp64Bits(sign, i32(exponentBits) - 1023, vec2u((1u << 20u) | fractionHigh, fractionLow), false, false, false); 3136} 3137 3138fn fp64_finite_magnitude_compare(a: Fp64Bits, b: Fp64Bits) -> i32 { 3139 if (a.exponent != b.exponent) { 3140 return select(-1, 1, a.exponent > b.exponent); 3141 } 3142 return fp64_u64_compare(a.significand, b.significand); 3143} 3144#endif 3145 3146#ifndef LUMA_FP64_F32_INPUT_ONLY 3147struct Fp64RawF32Bits { 3148 sign: u32, 3149 baseExponent: i32, 3150 significand: u32, 3151 isZero: bool, 3152 isInf: bool, 3153 isNan: bool, 3154}; 3155 3156// Decode an f32 as (-1)^sign * significand * 2^baseExponent. This shared 3157// integer representation lets normalization remain independent of the 3158// selected double-single arithmetic implementation. 3159fn fp64_decode_raw_f32_bits(bits: u32) -> Fp64RawF32Bits { 3160 let sign = bits >> 31u; 3161 let exponentBits = (bits >> 23u) & 0xffu; 3162 let fraction = bits & 0x7fffffu; 3163 3164 if (exponentBits == 0xffu) { 3165 return Fp64RawF32Bits(sign, 0, 0u, false, fraction == 0u, fraction != 0u); 3166 } 3167 if (exponentBits == 0u) { 3168 return Fp64RawF32Bits(sign, -149, fraction, fraction == 0u, false, false); 3169 } 3170 return Fp64RawF32Bits( 3171 sign, 3172 i32(exponentBits) - 150, 3173 0x800000u | fraction, 3174 false, 3175 false, 3176 false 3177 ); 3178} 3179 3180fn fp64_raw_f32_magnitude_compare(aBits: u32, bBits: u32) -> i32 { 3181 let aMagnitude = aBits & 0x7fffffffu; 3182 let bMagnitude = bBits & 0x7fffffffu; 3183 if (aMagnitude == bMagnitude) { 3184 return 0; 3185 } 3186 return select(-1, 1, aMagnitude > bMagnitude); 3187} 3188 3189fn fp64_make_raw_residual_f32_bits( 3190 exactSign: u32, 3191 exactMagnitude: vec2u, 3192 exactBaseExponent: i32, 3193 highBits: u32 3194) -> u32 { 3195 if (fp64_u64_is_zero(exactMagnitude)) { 3196 return 0u; 3197 } 3198 3199 let high = fp64_decode_raw_f32_bits(highBits); 3200 if (high.isInf || high.isNan) { 3201 return 0u; 3202 } 3203 if (high.isZero) { 3204 return fp64_make_f32_bits_from_u64(exactSign, exactMagnitude, exactBaseExponent); 3205 } 3206 3207 let commonBaseExponent = min(exactBaseExponent, high.baseExponent); 3208 let exactShift = exactBaseExponent - commonBaseExponent; 3209 let highShift = high.baseExponent - commonBaseExponent; 3210 if (exactShift >= 64 || highShift >= 64) { 3211 return 0u; 3212 } 3213 3214 let exactAligned = fp64_u64_shift_left(exactMagnitude, u32(exactShift)); 3215 let highAligned = fp64_u64_shift_left(vec2u(0u, high.significand), u32(highShift)); 3216 let comparison = fp64_u64_compare(exactAligned, highAligned); 3217 if (comparison == 0) { 3218 return 0u; 3219 } 3220 3221 var residualSign = exactSign; 3222 var residualMagnitude: vec2u; 3223 if (comparison > 0) { 3224 residualMagnitude = fp64_u64_sub(exactAligned, highAligned); 3225 } else { 3226 residualSign = exactSign ^ 1u; 3227 residualMagnitude = fp64_u64_sub(highAligned, exactAligned); 3228 } 3229 return fp64_make_f32_bits_from_u64( 3230 residualSign, 3231 residualMagnitude, 3232 commonBaseExponent 3233 ); 3234} 3235 3236fn fp64_split_raw_accumulator_bits( 3237 sign: u32, 3238 magnitude: vec2u, 3239 baseExponent: i32 3240) -> vec2u { 3241 if (fp64_u64_is_zero(magnitude)) { 3242 return vec2u(0u); 3243 } 3244 let highBits = fp64_make_f32_bits_from_u64(sign, magnitude, baseExponent); 3245 let rawLowBits = fp64_make_raw_residual_f32_bits(sign, magnitude, baseExponent, highBits); 3246 let lowBits = select(rawLowBits, 0u, (rawLowBits & 0x7fffffffu) == 0u); 3247 if ((highBits & 0x7fffffffu) == 0u && (lowBits & 0x7fffffffu) == 0u) { 3248 return vec2u(0u); 3249 } 3250 return vec2u(highBits, lowBits); 3251} 3252#endif 3253 3254#ifndef LUMA_FP64_F32_INPUT_ONLY 3255// Round an arithmetic accumulator to binary64 before splitting it. The 3256// aligned add/subtract paths retain three guard bits plus a sticky bit, which
3257// is sufficient for round-to-nearest-even at the binary64 boundary. 3258fn fp64_split_binary64_accumulator_bits( 3259 sign: u32, 3260 magnitude: vec2u, 3261 baseExponent: i32 3262) -> vec2u { 3263 if (fp64_u64_is_zero(magnitude)) { 3264 return vec2u(0u); 3265 } 3266 3267 let mostSignificantBit = 63u - fp64_u64_count_leading_zeros(magnitude); 3268 let exponent = baseExponent + i32(mostSignificantBit); 3269 if (exponent > 1023) { 3270 return vec2u((sign << 31u) | 0x7f800000u, 0u); 3271 } 3272 3273 var roundedMagnitude = magnitude; 3274 var roundedBaseExponent = baseExponent; 3275 if (exponent >= -1022) { 3276 if (mostSignificantBit > 52u) { 3277 let shift = mostSignificantBit - 52u; 3278 roundedMagnitude = fp64_round_shift_right(magnitude, shift); 3279 roundedBaseExponent = baseExponent + i32(shift); 3280 } 3281 } else { 3282 let shift = -1074 - baseExponent; 3283 if (shift > 0) { 3284 roundedMagnitude = fp64_round_shift_right(magnitude, u32(shift)); 3285 roundedBaseExponent = -1074; 3286 } 3287 } 3288 3289 if (fp64_u64_is_zero(roundedMagnitude)) { 3290 return vec2u(0u); 3291 } 3292 return fp64_split_raw_accumulator_bits(sign, roundedMagnitude, roundedBaseExponent); 3293} 3294#endif 3295 3296#ifndef LUMA_FP64_PREDICATE_ONLY 3297fn fp64_add_raw_f32_bits(aBits: u32, bBits: u32) -> vec2u { 3298 let a = fp64_decode_raw_f32_bits(aBits); 3299 let b = fp64_decode_raw_f32_bits(bBits); 3300 3301 if (a.isNan || b.isNan) { 3302 return vec2u(0x7fc00000u, 0u); 3303 } 3304 if (a.isInf || b.isInf) { 3305 if (a.isInf && b.isInf && a.sign != b.sign) { 3306 return vec2u(0x7fc00000u, 0u); 3307 } 3308 return select(vec2u(bBits, 0u), vec2u(aBits, 0u), a.isInf); 3309 } 3310 if (a.isZero && b.isZero) { 3311 return vec2u(0u); 3312 } 3313 if (a.isZero) { 3314 return vec2u(bBits, 0u); 3315 } 3316 if (b.isZero) { 3317 return vec2u(aBits, 0u); 3318 } 3319 3320 let exponentDifference = abs(a.baseExponent - b.baseExponent); 3321 if (exponentDifference > 25) { 3322 if (fp64_raw_f32_magnitude_compare(aBits, bBits) >= 0) { 3323 return vec2u(aBits, bBits); 3324 } 3325 return vec2u(bBits, aBits); 3326 } 3327 3328 let commonBaseExponent = min(a.baseExponent, b.baseExponent); 3329 let aMagnitude = fp64_u64_shift_left( 3330 vec2u(0u, a.significand), 3331 u32(a.baseExponent - commonBaseExponent) 3332 ); 3333 let bMagnitude = fp64_u64_shift_left( 3334 vec2u(0u, b.significand), 3335 u32(b.baseExponent - commonBaseExponent) 3336 ); 3337 3338 var resultSign = a.sign; 3339 var resultMagnitude: vec2u; 3340 if (a.sign == b.sign) { 3341 resultMagnitude = fp64_u64_add(aMagnitude, bMagnitude); 3342 } else { 3343 let comparison = fp64_u64_compare(aMagnitude, bMagnitude); 3344 if (comparison == 0) { 3345 return vec2u(0u); 3346 } 3347 if (comparison > 0) { 3348 resultMagnitude = fp64_u64_sub(aMagnitude, bMagnitude); 3349 } else { 3350 resultSign = b.sign; 3351 resultMagnitude = fp64_u64_sub(bMagnitude, aMagnitude); 3352 } 3353 } 3354 3355 return fp64_split_raw_accumulator_bits( 3356 resultSign, 3357 resultMagnitude, 3358 commonBaseExponent 3359 ); 3360} 3361#endif 3362 3363#ifndef LUMA_FP64_F32_INPUT_ONLY 3364fn fp64_add_aligned_magnitudes_to_fp64_bits( 3365 sign: u32, 3366 larger: Fp64Bits, 3367 smaller: Fp64Bits 3368) -> vec2u { 3369 let largeSignificand = fp64_u64_shift_left(larger.significand, 3u); 3370 let smallSignificand = fp64_u64_shift_right_sticky( 3371 fp64_u64_shift_left(smaller.significand, 3u), 3372 u32(larger.exponent - smaller.exponent) 3373 ); 3374 let resultSignificand = fp64_u64_add(largeSignificand, smallSignificand); 3375 return fp64_split_binary64_accumulator_bits( 3376 sign, 3377 resultSignificand, 3378 larger.exponent - 55 3379 ); 3380} 3381 3382fn fp64_sub_aligned_magnitudes_to_fp64_bits( 3383 sign: u32, 3384 larger: Fp64Bits, 3385 smaller: Fp64Bits 3386) -> vec2u { 3387 let largeSignificand = fp64_u64_shift_left(larger.significand, 3u); 3388 let smallSignificand = fp64_u64_shift_right_sticky( 3389 fp64_u64_shift_left(smaller.significand, 3u), 3390 u32(larger.exponent - smaller.exponent) 3391 ); 3392 let resultSignificand = fp64_u64_sub(largeSignificand, smallSignificand); 3393 return fp64_split_binary64_accumulator_bits( 3394 sign, 3395 resultSignificand, 3396 larger.exponent - 55 3397 ); 3398} 3399 3400fn fp64_add_aligned_magnitudes_to_f32_bits(sign: u32, larger: Fp64Bits, smaller: Fp64Bits) -> u32 { 3401 let largeSignificand = fp64_u64_shift_left(larger.significand, 3u); 3402 let smallSignificand = fp64_u64_shift_right_sticky( 3403 fp64_u64_shift_left(smaller.significand, 3u), 3404 u32(larger.exponent - smaller.exponent) 3405 ); 3406 let resultSignificand = fp64_u64_add(largeSignificand, smallSignificand); 3407 return fp64_make_f32_bits_from_u64(sign, resultSignificand, larger.exponent - 55); 3408} 3409 3410fn fp64_sub_aligned_magnitudes_to_f32_bits(sign: u32, larger: Fp64Bits, smaller: Fp64Bits) -> u32 { 3411 let largeSignificand = fp64_u64_shift_left(larger.significand, 3u); 3412 let smallSignificand = fp64_u64_shift_right_sticky( 3413 fp64_u64_shift_left(smaller.significand, 3u), 3414 u32(larger.exponent - smaller.exponent) 3415 ); 3416 let resultSignificand = fp64_u64_sub(largeSignificand, smallSignificand); 3417 return fp64_make_f32_bits_from_u64(sign, resultSignificand, larger.exponent - 55); 3418} 3419 3420// Subtract two raw binary64 values and round the exact result once to f32. 3421// The input words are canonical high/low words: .x contains sign/exponent/high 3422// fraction bits, and .y contains the low 32 fraction bits. 3423fn sub_fp64u32_to_f32_bits(aBits: vec2u, bBits: vec2u) -> u32 { 3424 let a = fp64_decode_bits(aBits); 3425 let b = fp64_decode_bits(bBits); 3426 let bSubtractionSign = b.sign ^ 1u; 3427 3428 if (a.isNan || b.isNan) { 3429 return 0x7fc00000u; 3430 } 3431 if (a.isInf && b.isInf) { 3432 if (a.sign == bSubtractionSign) { 3433 return (a.sign << 31u) | 0x7f800000u; 3434 } 3435 return 0x7fc00000u; 3436 } 3437 if (a.isInf) { 3438 return (a.sign << 31u) | 0x7f800000u; 3439 } 3440 if (b.isInf) { 3441 return (bSubtractionSign << 31u) | 0x7f800000u; 3442 } 3443 if (a.isZero && b.isZero) { 3444 return select(0u, 0x80000000u, a.sign == 1u && b.sign == 0u); 3445 } 3446 3447 let magnitudeComparison = fp64_finite_magnitude_compare(a, b); 3448 if (a.sign == bSubtractionSign) { 3449 if (magnitudeComparison >= 0) { 3450 return fp64_add_aligned_magnitudes_to_f32_bits(a.sign, a, b); 3451 } 3452 return fp64_add_aligned_magnitudes_to_f32_bits(a.sign, b, a); 3453 } 3454 3455 if (magnitudeComparison == 0) { 3456 return 0u; 3457 } 3458 if (magnitudeComparison > 0) { 3459 return fp64_sub_aligned_magnitudes_to_f32_bits(a.sign, a, b); 3460 } 3461 return fp64_sub_aligned_magnitudes_to_f32_bits(bSubtractionSign, b, a); 3462} 3463 3464fn sub_fp64u32_to_f32(aBits: vec2u, bBits: vec2u) -> f32 { 3465 return bitcast<f32>(sub_fp64u32_to_f32_bits(aBits, bBits)); 3466} 3467 3468// Subtract two raw binary64 values, round once to binary64, then split the 3469// result into normalized f32 limbs. Finite results must fit within the f32 3470// exponent range; larger magnitudes map to infinity and smaller magnitudes 3471// map to zero. The input words use canonical high/low word order. 3472fn sub_fp64u32_to_fp64_bits(aBits: vec2u, bBits: vec2u) -> vec2u { 3473 let a = fp64_decode_bits(aBits); 3474 let b = fp64_decode_bits(bBits); 3475 let bSubtractionSign = b.sign ^ 1u; 3476 3477 if (a.isNan || b.isNan) { 3478 return vec2u(0x7fc00000u, 0u); 3479 } 3480 if (a.isInf && b.isInf) { 3481 if (a.sign == bSubtractionSign) { 3482 return vec2u((a.sign << 31u) | 0x7f800000u, 0u); 3483 } 3484 return vec2u(0x7fc00000u, 0u); 3485 } 3486 if (a.isInf) { 3487 return vec2u((a.sign << 31u) | 0x7f800000u, 0u); 3488 } 3489 if (b.isInf) { 3490 return vec2u((bSubtractionSign << 31u) | 0x7f800000u, 0u); 3491 } 3492 if (a.isZero && b.isZero) { 3493 return vec2u(0u); 3494 } 3495 3496 let magnitudeComparison = fp64_finite_magnitude_compare(a, b); 3497 if (a.sign == bSubtractionSign) { 3498 if (magnitudeComparison >= 0) { 3499 return fp64_add_aligned_magnitudes_to_fp64_bits(a.sign, a, b); 3500 } 3501 return fp64_add_aligned_magnitudes_to_fp64_bits(a.sign, b, a); 3502 } 3503 3504 if (magnitudeComparison == 0) { 3505 return vec2u(0u); 3506 } 3507 if (magnitudeComparison > 0) { 3508 return fp64_sub_aligned_magnitudes_to_fp64_bits(a.sign, a, b); 3509 } 3510 return fp64_sub_aligned_magnitudes_to_fp64_bits(bSubtractionSign, b, a); 3511} 3512 3513fn sub_fp64u32_to_fp64(aBits: vec2u, bBits: vec2u) -> vec2f { 3514 let resultBits = sub_fp64u32_to_fp64_bits(aBits, bBits); 3515 return vec2f(bitcast<f32>(resultBits.x), bitcast<f32>(resultBits.y)); 3516} 3517#endif 3518 3519#ifndef LUMA_FP64_PREDICATE_ONLY 3520fn fp64_runtime_zero() -> f32 { 3521 return fp64arithmetic.ONE * 0.0; 3522} 3523 3524fn prevent_fp64_optimization(value: f32) -> f32 { 3525#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 3526 return value + fp64_runtime_zero(); 3527#else 3528 return value; 3529#endif 3530} 3531#endif 3532 3533#ifdef LUMA_FP64_INTEGER_ARITHMETIC 3534${M1}
3534 3535#else 3536fn split(a: f32) -> vec2f { 3537 let splitValue = prevent_fp64_optimization(fp64arithmetic.SPLIT + fp64_runtime_zero()); 3538 let t = prevent_fp64_optimization(a * splitValue); 3539 let temp = prevent_fp64_optimization(t - a); 3540 let aHi = prevent_fp64_optimization(t - temp); 3541 let aLo = prevent_fp64_optimization(a - aHi); 3542 return vec2f(aHi, aLo); 3543} 3544 3545fn split2(a: vec2f) -> vec2f { 3546 var b = split(a.x); 3547 b.y = b.y + a.y; 3548 return b; 3549} 3550 3551fn quickTwoSum(a: f32, b: f32) -> vec2f { 3552#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 3553 let sum = prevent_fp64_optimization((a + b) * fp64arithmetic.ONE); 3554 let err = prevent_fp64_optimization(b - (sum - a) * fp64arithmetic.ONE); 3555#else 3556 let sum = prevent_fp64_optimization(a + b); 3557 let err = prevent_fp64_optimization(b - (sum - a)); 3558#endif 3559 return vec2f(sum, err); 3560} 3561 3562fn twoSum(a: f32, b: f32) -> vec2f { 3563 let s = prevent_fp64_optimization(a + b); 3564#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 3565 let v = prevent_fp64_optimization((s * fp64arithmetic.ONE - a) * fp64arithmetic.ONE); 3566 let err = 3567 prevent_fp64_optimization((a - (s - v) * fp64arithmetic.ONE) * 3568 fp64arithmetic.ONE * 3569 fp64arithmetic.ONE * 3570 fp64arithmetic.ONE) + 3571 prevent_fp64_optimization(b - v); 3572#else 3573 let v = prevent_fp64_optimization(s - a); 3574 let err = prevent_fp64_optimization(a - (s - v)) + prevent_fp64_optimization(b - v); 3575#endif 3576 return vec2f(s, err); 3577} 3578 3579fn twoSub(a: f32, b: f32) -> vec2f { 3580 let s = prevent_fp64_optimization(a - b); 3581#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 3582 let v = prevent_fp64_optimization((s * fp64arithmetic.ONE - a) * fp64arithmetic.ONE); 3583 let err = 3584 prevent_fp64_optimization((a - (s - v) * fp64arithmetic.ONE) * 3585 fp64arithmetic.ONE * 3586 fp64arithmetic.ONE * 3587 fp64arithmetic.ONE) - 3588 prevent_fp64_optimization(b + v); 3589#else 3590 let v = prevent_fp64_optimization(s - a); 3591 let err = prevent_fp64_optimization(a - (s - v)) - prevent_fp64_optimization(b + v); 3592#endif 3593 return vec2f(s, err); 3594} 3595 3596fn twoSqr(a: f32) -> vec2f { 3597 let prod = prevent_fp64_optimization(a * a); 3598 let aFp64 = split(a); 3599 let highProduct = prevent_fp64_optimization(aFp64.x * aFp64.x); 3600 let crossProduct = prevent_fp64_optimization(2.0 * aFp64.x * aFp64.y); 3601 let lowProduct = prevent_fp64_optimization(aFp64.y * aFp64.y); 3602#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 3603 let err = 3604 (prevent_fp64_optimization(highProduct - prod) * fp64arithmetic.ONE + 3605 crossProduct * fp64arithmetic.ONE * fp64arithmetic.ONE) + 3606 lowProduct * fp64arithmetic.ONE * fp64arithmetic.ONE * fp64arithmetic.ONE; 3607#else 3608 let err = ((prevent_fp64_optimization(highProduct - prod) + crossProduct) + lowProduct); 3609#endif 3610 return vec2f(prod, err); 3611} 3612 3613fn twoProd(a: f32, b: f32) -> vec2f { 3614 let prod = prevent_fp64_optimization(a * b); 3615 let aFp64 = split(a); 3616 let bFp64 = split(b); 3617 let highProduct = prevent_fp64_optimization(aFp64.x * bFp64.x); 3618 let crossProduct1 = prevent_fp64_optimization(aFp64.x * bFp64.y); 3619 let crossProduct2 = prevent_fp64_optimization(aFp64.y * bFp64.x); 3620 let lowProduct = prevent_fp64_optimization(aFp64.y * bFp64.y); 3621#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 3622 let err1 = (highProduct - prod) * fp64arithmetic.ONE; 3623 let err2 = crossProduct1 * fp64arithmetic.ONE * fp64arithmetic.ONE; 3624 let err3 = crossProduct2 * fp64arithmetic.ONE * fp64arithmetic.ONE * fp64arithmetic.ONE; 3625 let err4 = 3626 lowProduct * 3627 fp64arithmetic.ONE * 3628 fp64arithmetic.ONE * 3629 fp64arithmetic.ONE * 3630 fp64arithmetic.ONE; 3631#else 3632 let err1 = highProduct - prod; 3633 let err2 = crossProduct1; 3634 let err3 = crossProduct2; 3635 let err4 = lowProduct; 3636#endif 3637 let err12InputA = prevent_fp64_optimization(err1); 3638 let err12InputB = prevent_fp64_optimization(err2); 3639 let err12 = prevent_fp64_optimization(err12InputA + err12InputB); 3640 let err123InputA = prevent_fp64_optimization(err12); 3641 let err123InputB = prevent_fp64_optimization(err3); 3642 let err123 = prevent_fp64_optimization(err123InputA + err123InputB); 3643 let err1234InputA = prevent_fp64_optimization(err123); 3644 let err1234InputB = prevent_fp64_optimization(err4); 3645 let err = prevent_fp64_optimization(err1234InputA + err1234InputB); 3646 return vec2f(prod, err); 3647} 3648 3649fn sum_fp64(a: vec2f, b: vec2f) -> vec2f { 3650 var s = twoSum(a.x, b.x); 3651 let t = twoSum(a.y, b.y); 3652 s.y = prevent_fp64_optimization(s.y + t.x); 3653 s = quickTwoSum(s.x, s.y); 3654 s.y = prevent_fp64_optimization(s.y + t.y); 3655 s = quickTwoSum(s.x, s.y); 3656 return s; 3657} 3658 3659fn sub_fp64(a: vec2f, b: vec2f) -> vec2f { 3660 var s = twoSub(a.x, b.x); 3661 let t = twoSub(a.y, b.y); 3662 s.y = prevent_fp64_optimization(s.y + t.x); 3663 s = quickTwoSum(s.x, s.y); 3664 s.y = prevent_fp64_optimization(s.y + t.y); 3665 s = quickTwoSum(s.x, s.y); 3666 return s; 3667} 3668 3669fn mul_fp64(a: vec2f, b: vec2f) -> vec2f { 3670 var prod = twoProd(a.x, b.x); 3671 let crossProduct1 = prevent_fp64_optimization(a.x * b.y); 3672 prod.y = prevent_fp64_optimization(prod.y + crossProduct1); 3673#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 3674 prod = split2(prod); 3675#endif 3676 prod = quickTwoSum(prod.x, prod.y); 3677 let crossProduct2 = prevent_fp64_optimization(a.y * b.x); 3678 prod.y = prevent_fp64_optimization(prod.y + crossProduct2); 3679#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 3680 prod = split2(prod); 3681#endif 3682 prod = quickTwoSum(prod.x, prod.y); 3683 return prod; 3684} 3685 3686#ifndef LUMA_FP64_PREDICATE_ONLY 3687fn div_fp64(a: vec2f, b: vec2f) -> vec2f { 3688 let xn = prevent_fp64_optimization(1.0 / b.x); 3689 let yn = mul_fp64(a, vec2f(xn, fp64_runtime_zero())); 3690 let diff = prevent_fp64_optimization(sub_fp64(a, mul_fp64(b, yn)).x); 3691 let prod = twoProd(xn, diff); 3692 return sum_fp64(yn, prod); 3693} 3694 3695fn sqrt_fp64(a: vec2f) -> vec2f { 3696 if (a.x == 0.0 && a.y == 0.0) { 3697 return vec2f(0.0, 0.0); 3698 } 3699 if (a.x < 0.0) { 3700 let nanValue = fp64_nan(a.x); 3701 return vec2f(nanValue, nanValue); 3702 } 3703 3704 let x = prevent_fp64_optimization(1.0 / sqrt(a.x)); 3705 let yn = prevent_fp64_optimization(a.x * x); 3706#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 3707 let ynSqr = twoSqr(yn) * fp64arithmetic.ONE; 3708#else 3709 let ynSqr = twoSqr(yn); 3710#endif 3711 let diff = prevent_fp64_optimization(sub_fp64(a, ynSqr).x); 3712 let prod = twoProd(prevent_fp64_optimization(x * 0.5), diff); 3713#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 3714 return sum_fp64(split(yn), prod); 3715#else
3716 return sum_fp64(vec2f(yn, 0.0), prod); 3717#endif 3718} 3719#endif 3720#endif 3721 3722#ifndef LUMA_FP64_PREDICATE_ONLY 3723fn fp64_f32_bits_is_nan(bits: u32) -> bool { 3724 return (bits & 0x7fffffffu) > 0x7f800000u; 3725} 3726 3727fn fp64_f32_bits_is_inf(bits: u32) -> bool { 3728 return (bits & 0x7fffffffu) == 0x7f800000u; 3729} 3730 3731fn fp64_compare_f32_bits(aBits: u32, bBits: u32) -> i32 { 3732 let aMagnitude = aBits & 0x7fffffffu; 3733 let bMagnitude = bBits & 0x7fffffffu; 3734 if (aMagnitude == 0u && bMagnitude == 0u) { 3735 return 0; 3736 } 3737 let aSign = aBits >> 31u; 3738 let bSign = bBits >> 31u; 3739 if (aSign != bSign) { 3740 return select(1, -1, aSign == 1u); 3741 } 3742 if (aMagnitude == bMagnitude) { 3743 return 0; 3744 } 3745 let magnitudeComparison = select(-1, 1, aMagnitude > bMagnitude); 3746 return select(magnitudeComparison, -magnitudeComparison, aSign == 1u); 3747} 3748 3749// Normalize an arbitrary pair of finite f32 limbs with integer accumulation. 3750// This is independent of LUMA_FP64_INTEGER_ARITHMETIC and canonicalizes every 3751// representation of zero to vec2f(+0.0, +0.0). 3752fn normalize_fp64(value: vec2f) -> vec2f { 3753 let resultBits = fp64_add_raw_f32_bits(bitcast<u32>(value.x), bitcast<u32>(value.y)); 3754 return vec2f(bitcast<f32>(resultBits.x), bitcast<f32>(resultBits.y)); 3755} 3756 3757fn is_nan_fp64(value: vec2f) -> bool { 3758 let normalized = normalize_fp64(value); 3759 return fp64_f32_bits_is_nan(bitcast<u32>(normalized.x)) || 3760 fp64_f32_bits_is_nan(bitcast<u32>(normalized.y)); 3761} 3762 3763fn is_finite_fp64(value: vec2f) -> bool { 3764 let normalized = normalize_fp64(value); 3765 let highBits = bitcast<u32>(normalized.x); 3766 let lowBits = bitcast<u32>(normalized.y); 3767 return !fp64_f32_bits_is_nan(highBits) && !fp64_f32_bits_is_nan(lowBits) && 3768 !fp64_f32_bits_is_inf(highBits) && !fp64_f32_bits_is_inf(lowBits); 3769} 3770 3771// Returns -1, 0, or 1. NaN is unordered and returns 0; call is_nan_fp64 or 3772// is_finite_fp64 first when 0 must mean a finite zero. 3773fn sign_fp64(value: vec2f) -> i32 { 3774 let normalized = normalize_fp64(value); 3775 let highBits = bitcast<u32>(normalized.x); 3776 let lowBits = bitcast<u32>(normalized.y); 3777 if (fp64_f32_bits_is_nan(highBits) || fp64_f32_bits_is_nan(lowBits)) { 3778 return 0; 3779 } 3780 if ((highBits & 0x7fffffffu) != 0u) { 3781 return select(1, -1, (highBits >> 31u) == 1u); 3782 } 3783 if ((lowBits & 0x7fffffffu) != 0u) { 3784 return select(1, -1, (lowBits >> 31u) == 1u); 3785 } 3786 return 0; 3787} 3788 3789// Compares double-single values and returns -1, 0, or 1. NaN is unordered 3790// and returns 0; callers that require equality semantics must first check 3791// is_nan_fp64 or is_finite_fp64. 3792fn compare_fp64(a: vec2f, b: vec2f) -> i32 { 3793 let normalizedA = normalize_fp64(a); 3794 let normalizedB = normalize_fp64(b); 3795 let aHighBits = bitcast<u32>(normalizedA.x); 3796 let aLowBits = bitcast<u32>(normalizedA.y); 3797 let bHighBits = bitcast<u32>(normalizedB.x); 3798 let bLowBits = bitcast<u32>(normalizedB.y); 3799 if (fp64_f32_bits_is_nan(aHighBits) || fp64_f32_bits_is_nan(aLowBits) || 3800 fp64_f32_bits_is_nan(bHighBits) || fp64_f32_bits_is_nan(bLowBits)) { 3801 return 0; 3802 } 3803 let highComparison = fp64_compare_f32_bits(aHighBits, bHighBits); 3804 if (highComparison != 0) { 3805 return highComparison; 3806 } 3807 return fp64_compare_f32_bits(aLowBits, bLowBits); 3808} 3809#endif 3810`,fs:M0,vs:M0,defaultUniforms:{ONE:1,SPLIT:4097},uniformTypes:{ONE:"f32",SPLIT:"f32"},fp64ify:MJ,fp64LowPart:function(t){return t-Math.fround(t)},fp64ifyMatrix4:function(t){let r=new Float32Array(32);for(let i=0;i<4;++i)for(let n=0;n<4;++n){let a=4*i+n;MJ(t[4*n+i],r,2*a)}return r}};function M3(t){let{source:r,target:i,start:n=0,size:a,getData:o}=t,s=t.end||i.length,l=r.length,u=s-n;if(l>u)return void i.set(r.subarray(0,u),n);if(i.set(r,n),!o)return;let c=l;for(;c<u;){let t=o(c,r);for(let r=0;r<a;r++)i[n+c]=t[r]||0,c++}}function M4(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw Error(`No defined attribute type for size "${t}"`)}}function M6(t){switch(t){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw Error("invalid type size")}}function M5(t){t.push(t.shift())}function M8({device:t,source:r,target:i}){return(!i||i.byteLength<r.byteLength)&&(i?.destroy(),i=t.createBuffer({byteLength:r.byteLength,usage:r.usage})),i}function M7({device:t,buffer:r,attribute:i,fromLength:n,toLength:a,fromStartIndices:o,getData:s=t=>t}){let l=i.isDoublePrecisionBuffer?2:1,u=i.size*l,c=i.byteOffset,h=i.settings.bytesPerElement<4?c/i.settings.bytesPerElement*4:c,f=i.startIndices,d=o&&f,p=i.isConstant;if(!d&&r&&n>=a)return r;let m=i.value instanceof Float64Array?Float32Array:i.value.constructor,g=p?i.value:new m(i.getBuffer().readSyncWebG
3810L(c,a*m.BYTES_PER_ELEMENT).buffer);if(i.settings.normalized&&!p){let t=s;s=(r,n)=>i.normalizeConstant(t(r,n))}let y=p?(t,r)=>s(g,r):(t,r)=>s(g.subarray(t+c,t+c+u),r),v=new Float32Array(r?r.readSyncWebGL(h,4*n).buffer:0),_=new Float32Array(a);return!function({source:t,target:r,size:i,getData:n,sourceStartIndices:a,targetStartIndices:o}){if(!a||!o)return M3({source:t,target:r,size:i,getData:n});let s=0,l=0,u=n&&((t,r)=>n(t+l,r)),c=Math.min(a.length,o.length);for(let n=1;n<c;n++){let c=a[n]*i,h=o[n]*i;M3({source:t.subarray(s,c),target:r,start:l,end:h,size:i,getData:u}),s=c,l=h}l<r.length&&M3({source:[],target:r,start:l,size:i,getData:u})}({source:v,target:_,sourceStartIndices:o,targetStartIndices:f,size:u,getData:y}),(!r||r.byteLength<_.byteLength+h)&&(r?.destroy(),r=t.createBuffer({byteLength:_.byteLength+h,usage:35050})),r.write(_,h),r}class M9{constructor({device:t,attribute:r,timeline:i}){this.buffers=[],this.currentLength=0,this.device=t,this.transition=new Aq(i),this.attribute=r,this.attributeInTransition=function(t){let{device:r,settings:i,value:n}=t,a=new MD(r,i);return a.setData({value:n instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:i.normalized}),a}(r),this.currentStartIndices=r.startIndices}get inProgress(){return this.transition.inProgress}start(t,r,i=1/0){this.settings=t,this.currentStartIndices=this.attribute.startIndices,this.currentLength=function(t,r){let{settings:i,value:n,size:a}=t,o=t.isDoublePrecisionBuffer?2:1,s=0,{shaderAttributes:l}=t.settings;if(l)for(let t of Object.values(l))s=Math.max(s,t.vertexOffset??0);return(i.noAlloc?n.length:(r+s)*a)*o}(this.attribute,r),this.transition.start({...t,duration:i})}update(){let t=this.transition.update();return t&&this.onUpdate(),t}setBuffer(t){let{stride:r}=this.attributeInTransition.getAccessor();this.attributeInTransition.setData({buffer:t,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value,stride:r})}cancel(){this.transition.cancel()}delete(){for(let t of(this.cancel(),this.buffers))t.destroy();this.buffers.length=0}}let De={name:"interpolation",vs:`\ 3811layout(std140) uniform interpolationUniforms { 3812 float time; 3813} interpolation; 3814`,uniformTypes:{time:"f32"}},Dt=`\ 3815#version 300 es 3816#define SHADER_NAME interpolation-transition-vertex-shader 3817 3818in ATTRIBUTE_TYPE aFrom; 3819in ATTRIBUTE_TYPE aTo; 3820out ATTRIBUTE_TYPE vCurrent; 3821 3822void main(void) { 3823 vCurrent = mix(aFrom, aTo, interpolation.time); 3824 gl_Position = vec4(0.0); 3825} 3826`,Dr=`\ 3827#version 300 es 3828#define SHADER_NAME interpolation-transition-vertex-shader 3829 3830in ATTRIBUTE_TYPE aFrom; 3831in ATTRIBUTE_TYPE aFrom64Low; 3832in ATTRIBUTE_TYPE aTo; 3833in ATTRIBUTE_TYPE aTo64Low; 3834out ATTRIBUTE_TYPE vCurrent; 3835out ATTRIBUTE_TYPE vCurrent64Low; 3836 3837vec2 mix_fp64(vec2 a, vec2 b, float x) { 3838 vec2 range = sub_fp64(b, a); 3839 return sum_fp64(a, mul_fp64(range, vec2(x, 0.0))); 3840} 3841 3842void main(void) { 3843 for (int i=0; i<ATTRIBUTE_SIZE; i++) { 3844 vec2 value = mix_fp64(vec2(aFrom[i], aFrom64Low[i]), vec2(aTo[i], aTo64Low[i]), interpolation.time); 3845 vCurrent[i] = value.x; 3846 vCurrent64Low[i] = value.y; 3847 } 3848 gl_Position = vec4(0.0); 3849} 3850`;function Di(t){return t.isDoublePrecisionBuffer}let Dn={name:"spring",vs:`\ 3851layout(std140) uniform springUniforms { 3852 float damping; 3853 float stiffness; 3854} spring; 3855`,uniformTypes:{damping:"f32",stiffness:"f32"}},Da=`\ 3856#version 300 es 3857#define SHADER_NAME spring-transition-vertex-shader 3858 3859#define EPSILON 0.00001 3860 3861in ATTRIBUTE_TYPE aPrev; 3862in ATTRIBUTE_TYPE aCur; 3863in ATTRIBUTE_TYPE aTo; 3864out ATTRIBUTE_TYPE vNext; 3865out float vIsTransitioningFlag; 3866 3867ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) { 3868 ATTRIBUTE_TYPE velocity = cur - prev; 3869 ATTRIBUTE_TYPE delta = dest - cur; 3870 ATTRIBUTE_TYPE force = delta * spring.stiffness; 3871 ATTRIBUTE_TYPE resistance = velocity * spring.damping; 3872 return force - resistance + velocity + cur; 3873} 3874 3875void main(void) { 3876 bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON; 3877 vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0; 3878 3879 vNext = getNextValue(aCur, aPrev, aTo); 3880 gl_Position = vec4(0, 0, 0, 1); 3881 gl_PointSize = 100.0; 3882} 3883`,Do=`\ 3884#version 300 es 3885#define SHADER_NAME spring-transition-is-transitioning-fragment-shader 3886 3887in float vIsTransitioningFlag; 3888 3889out vec4 fragColor; 3890 3891void main(void) { 3892 if (vIsTransitioningFlag == 0.0) { 3893 discard; 3894 } 3895 fragColor = vec4(1.0); 3896}`,Ds={interpolation:class extends M9{constructor({device:t,attribute:r,timeline:i}){super({device:t,attribute:r,timeline:i}),this.type="interpolation",this.transform=function(t,r){let i=r.size,n=M4(i),a=M6(i),o=r.getBufferLayout();return Di(r)?new MQ.BufferTransform(t,{vs:Dr,bufferLayout:[{name:"aFrom",byteStride:8*i,attributes:[{attribute:"aFrom",format:a,byteOffset:0},{attribute:"aFrom64Low",format:a,byteOffset:4*i}]},{name:"aTo",byteStride:8*i,attributes:[{attribute:"aTo",format:a,byteOffset:0},{attribute:"aTo64Low",format:a,byteOffset:4*i}]}],modules:[M2,De],defines:{ATTRIBUTE_TYPE:n,ATTRIBUTE_SIZE:i},moduleSettings:{},varyings:["vCurrent","vCurrent64Low"],bufferMode:35980,disableWarnings:!0}):new MQ.BufferTransform(t,{vs:Dt,bufferLayout:[{name:"aFrom",format:a},{name:"aTo",format:o.attributes[0].format}],modules:[De],defines:{ATTRIBUTE_TYPE:n},varyings:["vCurrent"],disableWarnings:!0})}(t,r)}start(t,r){let i=this.currentLength,n=this.currentStartIndices;if(super.start(t,r,t.duration),t.duration<=0)return void this.transition.cancel();let{buffers:a,attribute:o}=this;M5(a),a[0]=M7({device:this.device,buffer:a[0],attribute:o,fromLength:i,toLength:this.currentLength,fromStartIndices:n,getData:t.enter}),a[1]=M8({device:this.device,source:a[0],target:a[1]}),this.setBuffer(a[1]);let{transform:s}=this,l=s.model,u=Math.floor(this.currentLength/o.size);Di(o)&&(u/=2),l.setVertexCount(u),o.isConstant?(l.setAttributes({aFrom:a[0]}),l.setConstantAttributes({aTo:o.value})):l.setAttributes({aFrom:a[0],aTo:o.getBuffer()}),s.transformFeedback.setBuffers({vCurrent:a[1]})}onUpdate(){let{duration:t,easing:r}=this.settings,{time:i}=this.transition,n=i/t;r&&(n=r(n));let{model:a}=this.transform,o={time:n};a.shaderInputs.setProps({interpolation:o}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}},spring:class extends M9{constructor({device:t,attribute:r,timeline:i}){super({device:t,attribute:r,timeline:i}),this.type="spring",this.texture=function(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",width:1,height:1})}
3896(t),this.framebuffer=function(t,r){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[r]})}(t,this.texture),this.transform=function(t,r){let i=M4(r.size),n=M6(r.size);return new MQ.BufferTransform(t,{vs:Da,fs:Do,bufferLayout:[{name:"aPrev",format:n},{name:"aCur",format:n},{name:"aTo",format:r.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[Dn],defines:{ATTRIBUTE_TYPE:i},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}(t,r)}start(t,r){let i=this.currentLength,n=this.currentStartIndices;super.start(t,r);let{buffers:a,attribute:o}=this;for(let r=0;r<2;r++)a[r]=M7({device:this.device,buffer:a[r],attribute:o,fromLength:i,toLength:this.currentLength,fromStartIndices:n,getData:t.enter});a[2]=M8({device:this.device,source:a[0],target:a[2]}),this.setBuffer(a[1]);let{model:s}=this.transform;s.setVertexCount(Math.floor(this.currentLength/o.size)),o.isConstant?s.setConstantAttributes({aTo:o.value}):s.setAttributes({aTo:o.getBuffer()})}onUpdate(){let{buffers:t,transform:r,framebuffer:i,transition:n}=this,a=this.settings;r.model.setAttributes({aPrev:t[0],aCur:t[1]}),r.transformFeedback.setBuffers({vNext:t[2]});let o={stiffness:a.stiffness,damping:a.damping};r.model.shaderInputs.setProps({spring:o}),r.run({framebuffer:i,discard:!1,parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]}),M5(t),this.setBuffer(t[1]),this.device.readPixelsToArrayWebGL(i)[0]>0||n.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}}};class Dl{constructor(t,{id:r,timeline:i}){if(!t)throw Error("AttributeTransitionManager is constructed without device");this.id=r,this.device=t,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let t in this.transitions)this._removeTransition(t)}update({attributes:t,transitions:r,numInstances:i}){for(let n in this.numInstances=i||1,t){let i=t[n],a=i.getTransitionSetting(r);a&&this._updateAttribute(n,i,a)}for(let i in this.transitions){let n=t[i];n&&n.getTransitionSetting(r)||this._removeTransition(i)}}hasAttribute(t){let r=this.transitions[t];return r&&r.inProgress}getAttributes(){let t={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(t[r]=i.attributeInTransition)}return t}run(){if(0===this.numInstances)return!1;for(let t in this.transitions)this.transitions[t].update()&&(this.needsRedraw=!0);let t=this.needsRedraw;return this.needsRedraw=!1,t}_removeTransition(t){this.transitions[t].delete(),delete this.transitions[t]}_updateAttribute(t,r,i){let n=this.transitions[t],a=!n||n.type!==i.type;if(a){n&&this._removeTransition(t);let o=Ds[i.type];o?this.transitions[t]=new o({attribute:r,timeline:this.timeline,device:this.device}):(xn.error(`unsupported transition type '${i.type}'`)(),a=!1)}(a||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[t].start(i,this.numInstances))}}let Du="attributeManager.invalidate";class Dc{constructor(t,{id:r="attribute-manager",stats:i,timeline:n}={}){this.mergeBoundsMemoized=x8(AT),this.id=r,this.device=t,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new Dl(t,{id:`${r}-transitions`,timeline:n}),this.attributeBufferGroups="webgpu"===t.type?new MY(t,{id:r,isTransitionAttribute:t=>this.attributeTransitionManager.hasAttribute(t)}):null,Object.seal(this)}finalize(){for(let t in this.attributeBufferGroups?.finalize(),this.attributes)this.attributes[t].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(t={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!t.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(t){this._add(t)}addInstanced(t){this._add(t,{stepMode:"instance"})}remove(t){for(let r of t)void 0!==this.attributes[r]&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(t,r){let i=this._invalidateTrigger(t,r);EJ(Du,this,t,i)}invalidateAll(t){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,t);EJ(Du,this,"all")}update({data:t,numInstances:r,startIndices:i=null,transitions:n,props:a={},buffers:o={},context:s={}}){let l=!1;for(let n in EJ("attributeManager.updateStart",this),this.stats&&this.stats.get("Update Attributes").timeStart(),this.attributes){let u=this.attributes[n],c=u.settings.accessor;u.startIndices=i,u.numInstances=r,a[n]&&xn.removed(`props.${n}`,`data.attributes.${n}`)(),u.setExternalBuffer(o[n])||u.setBinaryValue("string"==typeof c?o[c]:void 0,t.startIndices)||"string"==typeof c&&!o[c]&&u.setConstantValue(s,a[c])||u.needsUpdate()&&(l=!0,this._updateAttribute({attribute:u,numInstances:r,data:t,props:a,context:s})),this.needsRedraw=this.needsRedraw||u.needsRedraw()}l&&EJ("attributeManager.updateEnd",this,r),this.stats&&(this.stats.get("Update Attributes").timeEnd(),l&&this.stats.get("Attributes updated").incrementCount()),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:n})}updateTransition(){let{attributeTransitionManager:t}=this,r=t.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(t){let r=t.map(t=>this.attributes[t]?.getBounds());return this.mergeBoundsMemoized(r)}getChangedAttributes(t={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:i}=this,n={...i.getAttributes()};for(let a in r){let o=r[a];o.needsRedraw(t)&&!i.hasAttribute(a)&&(n[a]=o)}return n}getBufferLayouts(t){return this.hasBufferGroups()?this.attributeBufferGroups.getBufferLayouts(this.getAttributes(),t):Object.values(this.getAttributes()).map(r=>r.getBufferLayout(t))}hasBufferGroups(){return!!this.attributeBufferGroups?.hasGroups(this.attributes)}getBufferGroupBindings(t,r,i={}){return this.attributeBufferGroups?this.attributeBufferGroups.getBindings(this.getAttributes(),t,r,i):{bufferLayouts:this.getBufferLayouts(r),buffers:{},groupedAttributeIds:new Set}}_add(t,r){for(let i in t){let n=t[i],a={...n,id:i,size:n.isIndexed&&1||n.size||1,...r};this.attributes[i]=new MD(this.device,a)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){let t={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEac
3896h(i=>{t[i]||(t[i]=[]),t[i].push(r)});this.updateTriggers=t}_invalidateTrigger(t,r){let{attributes:i,updateTriggers:n}=this,a=n[t];return a&&a.forEach(t=>{let n=i[t];n&&n.setNeedsUpdate(n.id,r)}),a}_updateAttribute(t){let{attribute:r,numInstances:i}=t;(EJ("attribute.updateStart",r),r.constant)?r.setConstantValue(t.context,r.value):(r.allocate(i)&&EJ("attribute.allocate",r,i),r.updateBuffer(t)&&(this.needsRedraw=!0,EJ("attribute.updateEnd",r,i)))}}function Dh(t,r,i,n,a){let o=r-t;return(i-r)*a+-o*n+o+r}function Df(t,r){if(Array.isArray(t)){let i=0;for(let n=0;n<t.length;n++){let a=t[n]-r[n];i+=a*a}return Math.sqrt(i)}return Math.abs(t-r)}let Dd={interpolation:class extends Aq{get value(){return this._value}_onUpdate(){let{time:t,settings:{fromValue:r,toValue:i,duration:n,easing:a}}=this,o=a(t/n);this._value=ww(r,i,o)}},spring:class extends Aq{get value(){return this._currValue}_onUpdate(){let{fromValue:t,toValue:r,damping:i,stiffness:n}=this.settings,{_prevValue:a=t,_currValue:o=t}=this,s=function(t,r,i,n,a){if(Array.isArray(i)){let o=[];for(let s=0;s<i.length;s++)o[s]=Dh(t[s],r[s],i[s],n,a);return o}return Dh(t,r,i,n,a)}(a,o,r,i,n),l=Df(s,r),u=Df(s,o);l<1e-5&&u<1e-5&&(s=r,this.end()),this._prevValue=o,this._currValue=s}}};class Dp{constructor(t){this.transitions=new Map,this.timeline=t}get active(){return this.transitions.size>0}add(t,r,i,n){let{transitions:a}=this;if(a.has(t)){let i=a.get(t),{value:n=i.settings.fromValue}=i;r=n,this.remove(t)}if(!(n=MM(n)))return;let o=Dd[n.type];if(!o)return void xn.error(`unsupported transition type '${n.type}'`)();let s=new o(this.timeline);s.start({...n,fromValue:r,toValue:i}),a.set(t,s)}remove(t){let{transitions:r}=this;r.has(t)&&(r.get(t).cancel(),r.delete(t))}update(){let t={};for(let[r,i]of this.transitions)i.update(),t[r]=i.value,i.inProgress||this.remove(r);return t}clear(){for(let t of this.transitions.keys())this.remove(t)}}function Dm({newProps:t,oldProps:r,ignoreProps:i={},propTypes:n={},triggerName:a="props"}){if(r===t)return!1;if("object"!=typeof t||null===t||"object"!=typeof r||null===r)return`${a} changed shallowly`;for(let o of Object.keys(t))if(!(o in i)){if(!(o in r))return`${a}.${o} added`;let i=Dg(t[o],r[o],n[o]);if(i)return`${a}.${o} ${i}`}for(let o of Object.keys(r))if(!(o in i)){if(!(o in t))return`${a}.${o} dropped`;if(!Object.hasOwnProperty.call(t,o)){let i=Dg(t[o],r[o],n[o]);if(i)return`${a}.${o} ${i}`}}return!1}function Dg(t,r,i){let n=i&&i.equal;return n&&!n(t,r,i)||!n&&(n=t&&r&&t.equals)&&!n.call(t,r)?"changed deeply":n||r===t?null:"changed shallowly"}function Dy(t,r,i){let n=t.updateTriggers[i];n=null==n?{}:n;let a=r.updateTriggers[i];return Dm({oldProps:a=null==a?{}:a,newProps:n,triggerName:i})}function Dv(t,r){if(!r)return t;let i={...t,...r};if("defines"in r&&(i.defines={...t.defines,...r.defines}),"modules"in r&&(i.modules=(t.modules||[]).concat(r.modules),r.modules.some(t=>"project64"===t.name))){let t=i.modules.findIndex(t=>"project32"===t.name);t>=0&&i.modules.splice(t,1)}if("inject"in r)if(t.inject){let n={...t.inject};for(let t in r.inject)n[t]=(n[t]||"")+r.inject[t];i.inject=n}else i.inject=r.inject;return i}var Eu=Eu,xr=xr;let D_=[0,0,0];function Db(t,r,i=!1){let n=r.projectPosition(t);if(i&&r instanceof AG){let[i,a,o=0]=t,s=r.getDistanceScales([i,a]);n[2]=o*s.unitsPerMeter[2]}return n}function Dx(t,{viewport:r,modelMatrix:i,coordinateSystem:n,coordinateOrigin:a,offsetMode:o}){let[s,l,u=0]=t;switch(i&&([s,l,u]=xr.transformMat4([],[s,l,u,1],i)),n){case"default":return Dx(t,{viewport:r,modelMatrix:i,coordinateSystem:r.isGeospatial?"lnglat":"cartesian",coordinateOrigin:a,offsetMode:o});case"lnglat":return Db([s,l,u],r,o);case"lnglat-offsets":return Db([s+a[0],l+a[1],u+(a[2]||0)],r,o);case"meter-offsets":return Db(E_(a,[s,l,u]),r,o);case"cartesian":return r.isGeospatial?[s+a[0],l+a[1],u+a[2]]:r.projectPosition([s,l,u]);default:throw Error(`Invalid coordinateSystem: ${n}`)}}let Dw={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},DE={},DT={boolean:{validate:(t,r)=>!0,equal:(t,r,i)=>!!t==!!r},number:{validate:(t,r)=>Number.isFinite(t)&&(!("max"in r)||t<=r.max)&&(!("min"in r)||t>=r.min)},color:{validate:(t,r)=>r.optional&&!t||DS(t)&&(3===t.length||4===t.length),equal:(t,r,i)=>Ak(t,r,1)},accessor:{validate(t,r){let i=DC(t);return"function"===i||i===DC(r.value)},equal:(t,r,i)=>"function"==typeof r||Ak(t,r,1)},array:{validate:(t,r)=>r.optional&&!t||DS(t),equal(t,r,i){let{compare:n}=i,a=Number.isInteger(n)?n:+!!n;return n?Ak(t,r,a):t===r}},object:{equal(t,r,i){if(i.ignore)return!0;let{compare:n}=i,a=Number.isInteger(n)?n:+!!n;return n?Ak(t,r,a):t===r}},function:{validate:(t,r)=>r.optional&&!t||"function"==typeof t,equal:(t,r,i)=>!i.compare&&!1!==i.ignore||t===r},data:{transform:(t,r,i)=>{if(!t)return t;let{dataTransform:n}=i.props;return n?n(t):"string"==typeof t.shape&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,r,i)=>{let n=i.context;return n&&n.device?function(t,r,i,n){if(i instanceof Sz.Texture)return i;i.constructor&&"Object"!==i.constructor.name&&(i={data:i});let a=null;i.compressed&&(a={minFilter:"linear",mipmapFilter:i.data.length>1?"nearest":"linear"});let{width:o,height:s}=i.data,l=r.createTexture({...i,sampler:{...Dw,...a,...n},mipLevels:r.getMipLevelCount(o,s)});return"webgl"===r.type?l.generateMipmapsWebGL():"webgpu"===r.type&&r.generateMipmapsWebGPU(l),DE[l.id]=t,l}(i.id,n.device,t,{...r.parameters,...i.props.textureParameters}):null},release:(t,r,i)=>{var n;n=i.id,t&&t instanceof Sz.Texture&&DE[t.id]===n&&(t.delete(),delete DE[t.id])}}};function DA(t,r){return"type"in r?{name:t,...DT[r.type],...r}:"value"in r?{name:t,type:DC(r.value),...r}:{name:t,type:"object",value:r}}function DS(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function DC(t){return DS(t)?"array":null===t?"null":typeof t}function DM(t,r){return Object.prototype.hasOwnProperty.call(t,r)}let DD=0;class DP{constructor(...t){this.props=function(t,r){let i;for(let t=r.length-1;t>=0;t--){let n=r[t];"extensions"in n&&(i=n.extensions)}let n=Object.create(function t(r,i){var n,a;if(!(r instanceof DI.constructor))return{};let o="_mergedDefaultProps";if(i)for(let t of i){let r=t.constructor;r&&(o+=`:${r.extensionName||r.name}`)}let s=DM(n=r,a=o)&&n[a];return s||(r[o]=function(r,i){var n;let a;if(!r.prototype)return null;let o=t(Object.getPrototypeOf(r)),s=function(t){let r={},i={},n={};
3896for(let[a,o]of Object.entries(t)){let t=o?.deprecatedFor;if(t)n[a]=Array.isArray(t)?t:[t];else{let t=function(t,r){switch(DC(r)){case"object":return DA(t,r);case"array":return DA(t,{type:"array",value:r,compare:!1});case"boolean":return DA(t,{type:"boolean",value:r});case"number":return DA(t,{type:"number",value:r});case"function":return DA(t,{type:"function",value:r,compare:!0});default:return{name:t,type:"unknown",value:r}}}(a,o);r[a]=t,i[a]=t.value}}return{propTypes:r,defaultProps:i,deprecatedProps:n}}(function(t,r){return DM(t,r)&&t[r]}(r,"defaultProps")||{}),l=Object.assign(Object.create(null),o,s.defaultProps),u=Object.assign(Object.create(null),o?.[Eq],s.propTypes),c=Object.assign(Object.create(null),o?.[EH],s.deprecatedProps);for(let r of i){let i=t(r.constructor);i&&(Object.assign(l,i),Object.assign(u,i[Eq]),Object.assign(c,i[EH]))}return Object.defineProperties(l,{id:{writable:!0,value:((a=(n=r).componentName)||xn.warn(`${n.name}.componentName not specified`)(),a||n.name)}}),function(t,r){let i={},n={};for(let t in r){let a=r[t],{name:o,value:s}=a;a.async&&(i[o]=s,n[o]=function(t){return{enumerable:!0,set(r){"string"==typeof r||r instanceof Promise||ME(r)?this[EZ][t]=r:this[EY][t]=r},get(){if(this[EY]){if(t in this[EY])return this[EY][t]||this[EW][t];if(t in this[EZ]){let r=this[EG]&&this[EG].internalState;if(r&&r.hasAsyncProp(t))return r.getAsyncProp(t)||this[EW][t]}}return this[EW][t]}}}(o))}t[EW]=i,t[EZ]={},Object.defineProperties(t,n)}(l,u),function(t,r){for(let i in r)Object.defineProperty(t,i,{enumerable:!1,set(t){let n=`${this.id}: ${i}`;for(let n of r[i])DM(this,n)||(this[n]=t);xn.deprecated(n,r[i].join("/"))()}})}(l,c),l[Eq]=u,l[EH]=c,0!==i.length||DM(r,"_propTypes")||(r._propTypes=u),l}(r,i||[]))}(t.constructor,i));n[EG]=t,n[EZ]={},n[EY]={};for(let t=0;t<r.length;++t){let i=r[t];for(let t in i)n[t]=i[t]}return Object.freeze(n),n}(this,t),this.id=this.props.id,this.count=DD++}clone(t){let{props:r}=this,i={};for(let t in r[EW])t in r[EY]?i[t]=r[EY][t]:t in r[EZ]&&(i[t]=r[EZ][t]);return new this.constructor({...r,...i,...t})}}DP.componentName="Component",DP.defaultProps={};let DI=DP,Dk=Object.freeze({});class DO{constructor(t){this.component=t,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let t in this.asyncProps){let r=this.asyncProps[t];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||Dk}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(t){return t in this.asyncProps}getAsyncProp(t){let r=this.asyncProps[t];return r&&r.resolvedValue}isAsyncPropLoading(t){if(t){let r=this.asyncProps[t];return!!(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let t in this.asyncProps)if(this.isAsyncPropLoading(t))return!0;return!1}reloadAsyncProp(t,r){this._watchPromise(t,Promise.resolve(r))}setAsyncProps(t){this.component=t[EG]||this.component;let r=t[EY]||{},i=t[EZ]||t,n=t[EW]||{};for(let t in r){let i=r[t];this._createAsyncPropData(t,n[t]),this._updateAsyncProp(t,i),r[t]=this.getAsyncProp(t)}for(let t in i){let r=i[t];this._createAsyncPropData(t,n[t]),this._updateAsyncProp(t,r)}}_fetch(t,r){return null}_onResolve(t,r){}_onError(t,r){}_updateAsyncProp(t,r){if(this._didAsyncInputValueChange(t,r)){if("string"==typeof r&&(r=this._fetch(t,r)),r instanceof Promise)return void this._watchPromise(t,r);if(ME(r))return void this._resolveAsyncIterable(t,r);this._setPropValue(t,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps)for(let t in this.oldAsyncProps=Object.create(this.oldProps),this.asyncProps)Object.defineProperty(this.oldAsyncProps,t,{enumerable:!0,value:this.oldProps[t]})}_didAsyncInputValueChange(t,r){let i=this.asyncProps[t];return r!==i.resolvedValue&&r!==i.lastValue&&(i.lastValue=r,!0)}_setPropValue(t,r){this._freezeAsyncOldProps();let i=this.asyncProps[t];i&&(r=this._postProcessValue(i,r),i.resolvedValue=r,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(t,r,i){let n=this.asyncProps[t];n&&i>=n.resolvedLoadCount&&void 0!==r&&(this._freezeAsyncOldProps(),n.resolvedValue=r,n.resolvedLoadCount=i,this.onAsyncPropUpdated(t,r))}_watchPromise(t,r){let i=this.asyncProps[t];if(i){i.pendingLoadCount++;let n=i.pendingLoadCount;r.then(r=>{this.component&&(r=this._postProcessValue(i,r),this._setAsyncPropValue(t,r,n),this._onRes
3896olve(t,r))}).catch(r=>{this._onError(t,r)})}}async _resolveAsyncIterable(t,r){if("data"!==t)return void this._setPropValue(t,r);let i=this.asyncProps[t];if(!i)return;i.pendingLoadCount++;let n=i.pendingLoadCount,a=[],o=0;for await(let i of r){if(!this.component)return;let{dataTransform:r}=this.component.props;Object.defineProperty(a=r?r(i,a):a.concat(i),"__diff",{enumerable:!1,value:[{startRow:o,endRow:a.length}]}),o=a.length,this._setAsyncPropValue(t,a,n)}this._onResolve(t,a)}_postProcessValue(t,r){let i=t.type;return i&&this.component&&(i.release&&i.release(t.resolvedValue,i,this.component),i.transform)?i.transform(r,i,this.component):r}_createAsyncPropData(t,r){if(!this.asyncProps[t]){let i=this.component&&this.component.props[Eq];this.asyncProps[t]={type:i&&i[t],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}}class DN extends DO{constructor({attributeManager:t,layer:r}){super(r),this.attributeManager=t,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1,this.disabledPickingIndices=[]}get layer(){return this.component}_fetch(t,r){let i=this.layer,n=i?.props.fetch;return n?n(r,{propName:t,layer:i}):super._fetch(t,r)}_onResolve(t,r){let i=this.layer;if(i){let n=i.props.onDataLoad;"data"===t&&n&&n(r,{propName:t,layer:i})}}_onError(t,r){let i=this.layer;i&&i.raiseError(r,`loading ${t} of ${this.layer}`)}}let DL=Object.freeze([]),DR=x8(({oldViewport:t,viewport:r})=>t.equals(r)),DF=new Uint8ClampedArray(0);function DB(t){return t.rowIndexes||t.pickingColors||t.instancePickingColors}function Dz(t){return t.rowIndexes}function Dj(t){return t.pickingColors||t.instancePickingColors}let DU={data:{type:"data",value:DL,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,{propName:r,layer:i,loaders:n,loadOptions:a,signal:o})=>{let{resourceManager:s}=i.context;a=a||i.getLoadOptions(),n=n||i.props.loaders,o&&(a={...a,core:{...a?.core,fetch:{...a?.core?.fetch,signal:o}}});let l=s.contains(t);return(l||a||(s.add({resourceId:t,data:Am(t,n),persistent:!1}),l=!0),l)?s.subscribe({resourceId:t,onChange:t=>i.internalState?.reloadAsyncProp(r,t),consumerId:i.id,requestId:r}):Am(t,n,a)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:"default",coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:t})=>[0,-(100*t)]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}};class DV extends DI{constructor(){super(...arguments),this.internalState=null,this.lifecycle="Awaiting state",this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let t=this;for(;t.parent;)t=t.parent;return t}toString(){let t=this.constructor.layerName||this.constructor.name;return`${t}({id: '${this.props.id}'})`}project(t){AK(this.internalState);let r=this.internalState.viewport||this.context.viewport,[i,n,a]=Ew(Dx(t,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),r.pixelProjectionMatrix);return 2===t.length?[i,n]:[i,n,a]}unproject(t){return AK(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(t)}projectPosition(t,r){return AK(this.internalState),function(t,r){let{viewport:i,coordinateSystem:n,coordinateOrigin:a,modelMatrix:o,fromCoordinateSystem:s,fromCoordinateOrigin:l}=function(t){let{viewport:r,modelMatrix:i,coordinateOrigin:n}=t,{coordinateSystem:a,fromCoordinateSystem:o,fromCoordinateOrigin:s}=t;return"default"===a&&(a=r.isGeospatial?"lnglat":"cartesian"),void 0===o?o=a:"default"===o&&(o=r.isGeospatial?"lnglat":"cartesian"),void 0===s&&(s=n),{viewport:r,coordinateSystem:a,coordinateOrigin:n,modelMatrix:i,fromCoordinateSystem:o,fromCoordinateOrigin:s}}(r),{autoOffset:u=!0}=r,{geospatialOrigin:c=D_,shaderCoordinateOrigin:h=D_,offsetMode:f=!1}=u?wo(i,n,a):{},d=Dx(t,{viewport:i,modelMatrix:o,coordinateSystem:s,coordinateOrigin:l,offsetMode:f});if(f){let t=i.projectPosition(c||h);Eu.sub(d,d,t)}return d}(t,{viewport:this.internalState.viewport||this.context.viewport,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}get isDrawable(){return!0}setState(t){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,t),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return!!this.internalState&&!this.internalState.isAsyncPropLoading()}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let t=this.state;return t&&(t.models||t.model&&[t.model])||[]}setShaderModuleProps(...t){for(let r of this.getModels())r.shaderInputs.setProps(...t)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:t}=this.props;return"default"===t||"lnglat"===t||"cartesian"===t}onHover(t,r){return!!this.props.onHover&&(this.props.onHover(t,r)||!1)}onClick(t,r){return!!this.props.onClick&&(this.props.onClick(t,r)||!1)}nullPickingColor(){return[0,0,0]}encodePickingColor(t,r=[]){return r[0]=t+1&255,r[1]=t+1>>8&255,r[2]=t+1>>8>>8&255,r}decodePickingColor(t){AK(t instanceof Uint8Array);let[r,i,n]=t;return r+256*i+65536*n-1}getNumInstances(){if(Number.isFinite(this.props.numInstances))return this.props.numInstances;if(this.state&&void 0!==this.state.numInstances)return this.state.numInstances;var t,r,i=this.props.data;if(null===(t=i)||"object"!=typeof t)throw Error("count(): argument not an object");
3896if("function"==typeof i.count)return i.count();if(Number.isFinite(i.size))return i.size;if(Number.isFinite(i.length))return i.length;if(null!==(r=i)&&"object"==typeof r&&r.constructor===Object)return Object.keys(i).length;throw Error("count(): argument not a container")}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(t){for(let r of(t=Dv(t,{disableWarnings:!0,modules:this.context.defaultShaderModules}),this.props.extensions))t=Dv(t,r.getShaders.call(this,r));return t}shouldUpdateState(t){return t.changeFlags.propsOrDataChanged}updateState(t){let r=this.getAttributeManager(),{dataChanged:i}=t.changeFlags;if(i&&r)if(Array.isArray(i))for(let t of i)r.invalidateAll(t);else r.invalidateAll();if(r){let{props:i}=t,n=this.internalState.hasPickingBuffer,a=Number.isInteger(i.highlightedObjectIndex)||!!i.pickable||i.extensions.some(t=>t.getNeedsPickingBuffer.call(this,t));if(n!==a){this.internalState.hasPickingBuffer=a;let t=DB(r.attributes);t&&(a&&t.constant&&(t.constant=!1,r.invalidate(t.id)),t.value||a||(t.constant=!0,t.value=Dz(r.attributes)?[0xffffff]:[0,0,0]))}}}finalizeState(t){for(let t of this.getModels())t.destroy();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(t){for(let r of this.getModels())r.draw(t.renderPass)}getPickingInfo({info:t,mode:r,sourceLayer:i}){let{index:n}=t;return n>=0&&Array.isArray(this.props.data)&&(t.object=this.props.data[n]),t}raiseError(t,r){r&&(t=Error(`${r}: ${t.message}`,{cause:t})),this.props.onError?.(t)||this.context?.onError?.(t,this)}getNeedsRedraw(t={clearRedrawFlags:!1}){return this._getNeedsRedraw(t)}needsUpdate(){return!!this.internalState&&(this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()))}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(t){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=t,r&&DR({oldViewport:r,viewport:t})||(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(t="all"){let r=this.getAttributeManager();r&&("all"===t?r.invalidateAll():r.invalidate(t))}updateAttributes(t){let r=!1;for(let i in t)t[i].layoutChanged()&&(r=!0);for(let i of this.getModels())this._setModelAttributes(i,t,r)}_updateAttributes(){let t=this.getAttributeManager();if(!t)return;let r=this.props,i=this.getNumInstances(),n=this.getStartIndices();t.update({data:r.data,numInstances:i,startIndices:n,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let a=t.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(a)}_updateAttributeTransition(){let t=this.getAttributeManager();t&&t.updateTransition()}_updateUniformTransition(){let{uniformTransitions:t}=this.internalState;if(t.active){let r=t.update(),i=Object.create(this.props);for(let t in r)Object.defineProperty(i,t,{value:r[t]});return i}return this.props}calculateInstancePickingColors(t,{numInstances:r}){if(t.constant)return;let i=Math.floor(DF.length/4);this.internalState.usesPickingColorCache=!0;let n=r>0&&0===DF[0];if(i<r||n){r>0xffffff&&xn.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")();let t=Math.floor((DF=Av.allocate(DF,r,{size:4,copy:!0,maxCount:Math.max(r,0xffffff)})).length/4),a=[0,0,0],o=n?0:i;for(let r=o;r<t;r++)this.encodePickingColor(r,a),DF[4*r+0]=a[0],DF[4*r+1]=a[1],DF[4*r+2]=a[2],DF[4*r+3]=0}t.value=DF.subarray(0,4*r)}_setModelAttributes(t,r,i=!1){if(!Object.keys(r).length)return;let n=this.getAttributeManager();if(n?.hasBufferGroups())return void this._setGroupedModelAttributes(t,n,r);if(i){let i=this.getAttributeManager();t.setBufferLayout(i.getBufferLayouts(t)),r=i.getAttributes()}let a=t.userData?.excludeAttributes||{},o={},s={};for(let i in r){if(a[i])continue;let n=r[i].getValue();for(let a in n){let l=n[a];l instanceof SB.Buffer?r[i].settings.isIndexed?t.setIndexBuffer(l):o[a]=l:l&&(s[a]=l)}}t.setAttributes(o),t.setConstantAttributes(s)}_setGroupedModelAttributes(t,r,i){let n=t.userData?.excludeAttributes||{},a=r.getBufferGroupBindings(i,t,n);t.setBufferLayout(a.bufferLayouts);let o={...a.buffers},s={},l=r.getAttributes();for(let r in l){if(n[r]||a.groupedAttributeIds.has(r))continue;let i=l[r],u=i.getValue();for(let r in u){let n=u[r];n instanceof SB.Buffer?i.settings.isIndexed?t.setIndexBuffer(n):o[r]=n:n&&(s[r]=n)}}t.setAttributes(o),t.setConstantAttributes(s)}disablePickingIndex(t){let r=this.props.data;if(!("attributes"in r))return void this._disablePickingIndex(t);let i=this.getAttributeManager().attributes,n=Dz(i),a=Dj(i),o=n&&r.attributes&&r.attributes[n.id];if(o&&o.value){let i=o.value;for(let a=0;a<r.length;
3896a++)i[n.getVertexOffset(a)]===t&&this._disablePickingIndex(a);return}let s=a&&r.attributes&&r.attributes[a.id];if(s&&s.value){let i=s.value,n=this.encodePickingColor(t);for(let t=0;t<r.length;t++){let r=a.getVertexOffset(t);i[r]===n[0]&&i[r+1]===n[1]&&i[r+2]===n[2]&&this._disablePickingIndex(t)}}else this._disablePickingIndex(t)}_disablePickingIndex(t){let r=this.getAttributeManager().attributes,i=Dz(r);if(i){let r=i.getVertexOffset(t),n=new Uint32Array(i.getVertexOffset(t+1)-r);n.fill(0xffffff),i.buffer.write(n,r*n.BYTES_PER_ELEMENT);return}let n=Dj(r);if(!n){var a;this.internalState&&(a=this.internalState.disabledPickingIndices,10===a.length?xn.warn("pickMultipleObjects can only exclude 10 previously picked objects for layers without picking buffers")():a.push(t));return}let o=n.getVertexOffset(t),s=n.getVertexOffset(t+1);n.buffer.write(new Uint8Array(s-o),o)}restorePickingColors(){let t=this.getAttributeManager().attributes,r=DB(t);if(!r){this.internalState&&(this.internalState.disabledPickingIndices.length=0);return}let i=Dj(t);this.internalState.usesPickingColorCache&&i&&i.value.buffer!==DF.buffer&&(i.value=DF.subarray(0,i.value.length)),r.updateSubBuffer({startOffset:0})}_initialize(){AK(!this.internalState),EJ("layer.initialize",this);let t=this._getAttributeManager();for(let r of(this.internalState=new DN({attributeManager:t,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(xn.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),t)}),this.internalState.uniformTransitions=new Dp(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context),this.props.extensions))r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(t){EJ("layer.matched",this,this===t);let{state:r,internalState:i}=t;this!==t&&(this.internalState=i,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let t=this.needsUpdate();if(EJ("layer.update",this,t),!t)return;this.context.stats.get("Layer updates").incrementCount();let r=this.props,i=this.context,n=this.internalState,a=i.viewport,o=this._updateUniformTransition();n.propsInTransition=o,i.viewport=n.viewport||a,this.props=o;try{let t=this._getUpdateParams(),r=this.getModels();if(i.device)this.updateState(t);else try{this.updateState(t)}catch(t){}for(let r of this.props.extensions)r.updateState.call(this,t,r);this.setNeedsRedraw(),this._updateAttributes();let n=this.getModels()[0]!==r[0];this._postUpdate(t,n)}finally{i.viewport=a,this.props=r,this._clearChangeFlags(),n.needsUpdate=!1,n.resetOldProps()}}_finalize(){for(let t of(EJ("layer.finalize",this),this.finalizeState(this.context),this.props.extensions))t.finalizeState.call(this,this.context,t)}_drawLayer({renderPass:t,shaderModuleProps:r=null,uniforms:i={},parameters:n={}}){this._updateAttributeTransition();let a=this.props,o=this.context;this.props=this.internalState.propsInTransition||a;try{r&&this.setShaderModuleProps(r);let{getPolygonOffset:a}=this.props,s=a&&a(i)||[0,0];o.device instanceof Mf.WebGLDevice&&o.device.setParametersWebGL({polygonOffset:s});let l=o.device instanceof Mf.WebGLDevice?null:function(t){let{blendConstant:r,...i}=t;return r?{pipelineParameters:i,renderPassParameters:{blendConstant:r}}:{pipelineParameters:i}}(n);if(function(t,r,i,n){for(let a of t)"webgpu"===a.device.type?(function(t,r){let i=r.props.framebuffer||(r.framebuffer??null);if(!i)return;let n=i.colorAttachments.map(t=>t?.texture?.format??null),a=i.depthStencilAttachment?.texture?.format;(!function(t,r){if(t===r)return!0;if(!t||!r||t.length!==r.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==r[i])return!1;return!0}(t.props.colorAttachmentFormats,n)||t.props.depthStencilAttachmentFormat!==a)&&(t.props.colorAttachmentFormats=n,t.props.depthStencilAttachmentFormat=a,t._setPipelineNeedsUpdate("attachment formats"))}(a,r),a.setParameters({...a.parameters,...n?.pipelineParameters})):a.setParameters(i)}(this.getModels(),t,n,l),o.device instanceof Mf.WebGLDevice)o.device.withParametersWebGL(n,()=>{let a={renderPass:t,shaderModuleProps:r,uniforms:i,parameters:n,context:o};for(let t of this.props.extensions)t.draw.call(this,a,t);this.draw(a)});else{l?.renderPassParameters&&t.setParameters(l.renderPassParameters);let a={renderPass:t,shaderModuleProps:r,uniforms:i,parameters:n,context:o};for(let t of this.props.extensions)t.draw.call(this,a,t);this.draw(a)}}finally{this.props=a}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(t){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let i in t)if(t[i]){let n=!1;if("dataChanged"===i){let a=t[i],o=r[i];a&&Array.isArray(o)&&(r.dataChanged=Array.isArray(a)?o.concat(a):a,n=!0)}r[i]||(r[i]=t[i],n=!0),n&&EJ("layer.changeFlag",this,i,t)}let i=!!(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=i,r.somethingChanged=i||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(t,r){let i,n,a,o=(i=Dm({newProps:t,oldProps:r,propTypes:t[Eq],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=function(t,r){if(null===r)return"oldProps is null, initial diff";let i=!1,{dataComparator:n,_dataDiff:a}=t;return n?n(t.data,r.data)||(i="Data comparator detected a change"):t.data!==r.data&&(i="A new data container was supplied"),i&&a&&(i=a(t.data,r.data)||i),i}(t,r),a=!1,n||(a=function(t,r){if(null===r||"all"in t.updateTriggers&&Dy(t,r,"all"))return{all:!0};let i={},n=!1;for(let a in t.updateTriggers)"all"!==a&&Dy(t,r,a)&&(i[a]=!0,n=!0);return!!n&&i}(t,r)),{dataChanged:n,propsChanged:i,updateTriggersChanged:a,extensionsChanged:function(t,r){if(null===r)return!0;let i=r.extensions,{extensions:n}=t;if(n===i)return!1;if(!i||!n||n.length!==i.length)return!0;for(let t=0;t<n.length;t++)if(!n[t].equals(i[t]))return!0;return!1}(t,r),transitionsChanged:function(t,r){if(!t.transitions)return!1;let i={},n=t[Eq],a=!1;for(let o in t.transitions){let s=n[o],l=s&&s.type;("number"===l||"color"===l||"array"===l)&&Dg(t[o],r[o],s)&&(i[o]=!0,a=!0)}return!!a&&i}(t,r)});if(o.updateTriggersChanged)for(let t in o.updateTriggersChanged)o.updateTriggersChanged[t]&&this.invalidateAttribute(t);if(o.transitionsChanged)for(let i in o.transitionsChanged)this.internalState.uniformTransitions.add(i,r[i],t[i],t.transitions?.[i]);return this.setChangeFlags(o)}validateProps(){!function(t){let r=t[Eq];for(let i in r){let n=r[i],{validate:a}=n;
3896if(a&&!a(t[i],n))throw Error(`Invalid prop ${i}: ${t[i]}`)}}(this.props)}updateAutoHighlight(t){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(t)}_updateAutoHighlight(t){let r={highlightedObjectColor:t.picked?t.color:null},{highlightColor:i}=this.props;t.picked&&"function"==typeof i&&(r.highlightColor=i(t)),this.setShaderModuleProps({picking:r}),this.setNeedsRedraw()}_getAttributeManager(){let t=this.context;return new Dc(t.device,{id:this.props.id,stats:t.stats,timeline:t.timeline})}_postUpdate(t,r){let{props:i,oldProps:n}=t,a=this.state.model;a?.isInstanced&&a.setInstanceCount(this.getNumInstances());let{autoHighlight:o,highlightedObjectIndex:s,highlightColor:l}=i;if(r||n.autoHighlight!==o||n.highlightedObjectIndex!==s||n.highlightColor!==l){let t={};Array.isArray(l)&&(t.highlightColor=l),(r||n.autoHighlight!==o||s!==n.highlightedObjectIndex)&&(t.highlightedObjectColor=Number.isFinite(s)&&s>=0?this.encodePickingColor(s):null),this.setShaderModuleProps({picking:t})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(t){if(!this.internalState)return!1;let r=!1;r=this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),n=!!i&&i.getNeedsRedraw(t);if(r=r||n)for(let t of this.props.extensions)t.onNeedsRedraw.call(this,t);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}DV.defaultProps=DU,DV.layerName="Layer";let D$=DV;class DG extends D${get isComposite(){return!0}get isDrawable(){return!1}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(t=>t.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(t){}setState(t){super.setState(t),this.setNeedsUpdate()}getPickingInfo({info:t}){let{object:r}=t;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(t.object=r.__source.object,t.index=r.__source.index),t}filterSubLayer(t){return!0}shouldRenderSubLayer(t,r){return r&&r.length}getSubLayerClass(t,r){let{_subLayerProps:i}=this.props;return i&&i[t]&&i[t].type||r}getSubLayerRow(t,r,i){return t.__source={parent:this,object:r,index:i},t}getSubLayerAccessor(t){if("function"==typeof t){let r={index:-1,data:this.props.data,target:[]};return(i,n)=>i&&i.__source?(r.index=i.__source.index,t(i.__source.object,r)):t(i,n)}return t}getSubLayerProps(t={}){let{opacity:r,pickable:i,visible:n,parameters:a,getPolygonOffset:o,highlightedObjectIndex:s,autoHighlight:l,highlightColor:u,coordinateSystem:c,coordinateOrigin:h,wrapLongitude:f,positionFormat:d,modelMatrix:p,extensions:m,fetch:g,operation:y,_subLayerProps:v}=this.props,_={id:"",updateTriggers:{},opacity:r,pickable:i,visible:n,parameters:a,getPolygonOffset:o,highlightedObjectIndex:s,autoHighlight:l,highlightColor:u,coordinateSystem:c,coordinateOrigin:h,wrapLongitude:f,positionFormat:d,modelMatrix:p,extensions:m,fetch:g,operation:y},b=v&&t.id&&v[t.id],x=b&&b.updateTriggers,w=t.id||"sublayer";if(b){let r=this.props[Eq],i=t.type?t.type._propTypes:{};for(let t in b){let n=i[t]||r[t];n&&"accessor"===n.type&&(b[t]=this.getSubLayerAccessor(b[t]))}}for(let r of(Object.assign(_,t,b),_.id=`${this.props.id}-${w}`,_.updateTriggers={all:this.props.updateTriggers?.all,...t.updateTriggers,...x},m)){let t=r.getSubLayerProps.call(this,r);t&&Object.assign(_,t,{updateTriggers:Object.assign(_.updateTriggers,t.updateTriggers)})}return _}_updateAutoHighlight(t){for(let r of this.getSubLayers())r.updateAutoHighlight(t)}_getAttributeManager(){return null}_postUpdate(t,r){let i=this.internalState.subLayers,n=!i||this.needsUpdate();for(let t of(n&&(i=E0(this.renderLayers(),Boolean),this.internalState.subLayers=i),EJ("compositeLayer.renderLayers",this,n,i),i))t.parent=this}}DG.layerName="CompositeLayer";let Dq=DG;var DH=t.i(134810),DW=t.i(99023);let DZ=`\ 3897layout(std140) uniform iconUniforms { 3898 float sizeScale; 3899 vec2 iconsTextureDim; 3900 float sizeBasis;
3901 float sizeMinPixels; 3902 float sizeMaxPixels; 3903 bool billboard; 3904 highp int sizeUnits; 3905 float alphaCutoff; 3906} icon; 3907`,DY={name:"icon",vs:DZ,fs:DZ,uniformTypes:{sizeScale:"f32",iconsTextureDim:"vec2<f32>",sizeBasis:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",billboard:"f32",sizeUnits:"i32",alphaCutoff:"f32"}},DX=`\ 3908#version 300 es 3909#define SHADER_NAME icon-layer-vertex-shader 3910in vec2 positions; 3911in vec3 instancePositions; 3912in vec3 instancePositions64Low; 3913in float instanceSizes; 3914in float instanceAngles; 3915in vec4 instanceColors; 3916#ifdef USE_ROW_INDEXES 3917in float rowIndexes; 3918#endif 3919in vec4 instanceIconFrames; 3920in float instanceColorModes; 3921in vec2 instanceOffsets; 3922in vec2 instancePixelOffset; 3923out float vColorMode; 3924out vec4 vColor; 3925out vec2 vTextureCoords; 3926out vec2 uv; 3927vec2 rotate_by_angle(vec2 vertex, float angle) { 3928float angle_radian = angle * PI / 180.0; 3929float cos_angle = cos(angle_radian); 3930float sin_angle = sin(angle_radian); 3931mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); 3932return rotationMatrix * vertex; 3933} 3934void main(void) { 3935geometry.worldPosition = instancePositions; 3936geometry.uv = positions; 3937#ifdef USE_ROW_INDEXES 3938geometry.pickingColor = picking_getPickingColorFromIndex(rowIndexes); 3939#else 3940geometry.pickingColor = picking_getPickingColorFromInstanceID(); 3941#endif 3942uv = positions; 3943vec2 iconSize = instanceIconFrames.zw; 3944float sizePixels = clamp( 3945project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),
3946icon.sizeMinPixels, icon.sizeMaxPixels 3947); 3948float iconConstraint = icon.sizeBasis == 0.0 ? iconSize.x : iconSize.y; 3949float instanceScale = iconConstraint == 0.0 ? 0.0 : sizePixels / iconConstraint; 3950vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets; 3951pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale; 3952pixelOffset += instancePixelOffset; 3953pixelOffset.y *= -1.0; 3954if (icon.billboard) { 3955gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 3956DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3957vec3 offset = vec3(pixelOffset, 0.0); 3958DECKGL_FILTER_SIZE(offset, geometry); 3959gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 3960} else { 3961vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); 3962DECKGL_FILTER_SIZE(offset_common, geometry); 3963gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); 3964DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 3965} 3966vTextureCoords = mix( 3967instanceIconFrames.xy, 3968instanceIconFrames.xy + iconSize, 3969(positions.xy + 1.0) / 2.0 3970) / icon.iconsTextureDim; 3971vColor = instanceColors; 3972DECKGL_FILTER_COLOR(vColor, geometry); 3973vColorMode = instanceColorModes; 3974} 3975`,DK=`\ 3976#version 300 es 3977#define SHADER_NAME icon-layer-fragment-shader 3978precision highp float; 3979uniform sampler2D iconsTexture; 3980in float vColorMode; 3981in vec4 vColor; 3982in vec2 vTextureCoords; 3983in vec2 uv; 3984out vec4 fragColor; 3985void main(void) { 3986geometry.uv = uv; 3987vec4 texColor = texture(iconsTexture, vTextureCoords); 3988vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode); 3989float a = texColor.a * layer.opacity * vColor.a; 3990if (a < icon.alphaCutoff) { 3991discard; 3992} 3993fragColor = vec4(color, a); 3994DECKGL_FILTER_COLOR(fragColor, geometry); 3995} 3996`,DQ=`\ 3997struct IconUniforms { 3998 sizeScale: f32, 3999 iconsTextureDim: vec2<f32>, 4000 sizeBasis: f32, 4001 sizeMinPixels: f32, 4002 sizeMaxPixels: f32, 4003 billboard: i32, 4004 sizeUnits: i32, 4005 alphaCutoff: f32 4006}; 4007 4008@group(0) @binding(auto) var<uniform> icon: IconUniforms; 4009@group(0) @binding(auto) var iconsTexture : texture_2d<f32>; 4010@group(0) @binding(auto) var iconsTextureSampler : sampler; 4011 4012fn rotate_by_angle(vertex: vec2<f32>, angle_deg: f32) -> vec2<f32> { 4013 let angle_radian = angle_deg * PI / 180.0; 4014 let c = cos(angle_radian); 4015 let s = sin(angle_radian); 4016 let rotation = mat2x2<f32>(vec2<f32>(c, s), vec2<f32>(-s, c)); 4017 return rotation * vertex; 4018} 4019 4020struct Attributes { 4021 @builtin(instance_index) instanceIndex : u32, 4022 @location(0) positions: vec2<f32>, 4023 4024 @location(1) instancePositions: vec3<f32>, 4025 @location(2) instancePositions64Low: vec3<f32>, 4026 @location(3) instanceSizes: f32, 4027 @location(4) instanceAngles: f32, 4028 @location(5) instanceColors: vec4<f32>, 4029 @location(6) instanceIconFrames: vec4<f32>, 4030 @location(7) instanceColorModes: f32, 4031 @location(8) instanceOffsets: vec2<f32>, 4032 @location(9) instancePixelOffset: vec2<f32>, 4033 PICKING_COLOR_ATTRIBUTE 4034}; 4035 4036struct Varyings { 4037 @builtin(position) position: vec4<f32>, 4038 4039 @location(0) vColorMode: f32, 4040 @location(1) vColor: vec4<f32>, 4041 @location(2) vTextureCoords: vec2<f32>, 4042 @location(3) uv: vec2<f32>, 4043 @location(4) pickingColor: vec3<f32>, 4044}; 4045 4046@vertex 4047fn vertexMain(inp: Attributes) -> Varyings { 4048 // write geometry fields used by filters + FS 4049 geometry.worldPosition = inp.instancePositions; 4050 geometry.uv = inp.positions; 4051 geometry.pickingColor = PICKING_COLOR_VALUE; 4052 4053 var outp: Varyings; 4054 outp.uv = inp.positions; 4055 4056 let iconSize = inp.instanceIconFrames.zw; 4057 4058 // convert size in meters to pixels, then clamp 4059 let sizePixels = clamp( 4060 project_unit_size_to_pixel(inp.instanceSizes * icon.sizeScale, icon.sizeUnits),
4061 icon.sizeMinPixels, icon.sizeMaxPixels 4062 ); 4063 4064 // scale icon height to match instanceSize 4065 let iconConstraint = select(iconSize.y, iconSize.x, icon.sizeBasis == 0.0); 4066 let instanceScale = select(sizePixels / iconConstraint, 0.0, iconConstraint == 0.0); 4067 4068 // scale and rotate vertex in "pixel" units; then add per-instance pixel offset 4069 var pixelOffset = inp.positions / 2.0 * iconSize + inp.instanceOffsets; 4070 pixelOffset = rotate_by_angle(pixelOffset, inp.instanceAngles) * instanceScale; 4071 pixelOffset = pixelOffset + inp.instancePixelOffset; 4072 pixelOffset.y = pixelOffset.y * -1.0; 4073 4074 if (icon.billboard != 0) { 4075 var pos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, vec3<f32>(0.0)); // TODO, &geometry.position); 4076 // DECKGL_FILTER_GL_POSITION(pos, geometry); 4077 4078 var offset = vec3<f32>(pixelOffset, 0.0); 4079 // DECKGL_FILTER_SIZE(offset, geometry); 4080 let clipOffset = project_pixel_size_to_clipspace(offset.xy); 4081 pos = vec4<f32>(pos.x + clipOffset.x, pos.y + clipOffset.y, pos.z, pos.w); 4082 outp.position = pos; 4083 } else { 4084 var offset_common = vec3<f32>(project_pixel_size_vec2(pixelOffset), 0.0); 4085 // DECKGL_FILTER_SIZE(offset_common, geometry); 4086 var pos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, offset_common); // TODO, &geometry.position); 4087 // DECKGL_FILTER_GL_POSITION(pos, geometry); 4088 outp.position = pos; 4089 } 4090 4091 let uvMix = (inp.positions.xy + vec2<f32>(1.0, 1.0)) * 0.5; 4092 outp.vTextureCoords = mix(inp.instanceIconFrames.xy, inp.instanceIconFrames.xy + iconSize, uvMix) / icon.iconsTextureDim; 4093 4094 outp.vColor = inp.instanceColors; 4095 // DECKGL_FILTER_COLOR(outp.vColor, geometry); 4096 4097 outp.vColorMode = inp.instanceColorModes; 4098 outp.pickingColor = geometry.pickingColor; 4099 4100 return outp; 4101} 4102 4103@fragment 4104fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> { 4105 // expose to deck.gl filter hooks 4106 geometry.uv = inp.uv; 4107 4108 let texColor = textureSample(iconsTexture, iconsTextureSampler, inp.vTextureCoords); 4109 4110 // if colorMode == 0, use pixel color from the texture 4111 // if colorMode == 1 (or picking), use texture as transparency mask 4112 let rgb = mix(texColor.rgb, inp.vColor.rgb, inp.vColorMode); 4113 let a = texColor.a * layer.opacity * inp.vColor.a; 4114 4115 if (a < icon.alphaCutoff) { 4116 discard; 4117 } 4118 4119 if (picking.isActive > 0.5) { 4120 if (!picking_isColorValid(inp.pickingColor)) { 4121 discard; 4122 } 4123 return vec4<f32>(inp.pickingColor, 1.0); 4124 } 4125 4126 var fragColor = deckgl_premultiplied_alpha(vec4<f32>(rgb, a)); 4127 4128 if (picking.isHighlightActive > 0.5) { 4129 let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 4130 if (picking_isColorZero(abs(inp.pickingColor - highlightedObjectColor))) { 4131 let highLightAlpha = picking.highlightColor.a; 4132 let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha); 4133 if (blendedAlpha > 0.0) { 4134 let highLightRatio = highLightAlpha / blendedAlpha; 4135 fragColor = vec4<f32>( 4136 mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio), 4137 blendedAlpha 4138 ); 4139 } else { 4140 fragColor = vec4<f32>(fragColor.rgb, 0.0); 4141 } 4142 } 4143 } 4144 4145 return fragColor; 4146} 4147`,DJ=()=>{},D0={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},D1={x:0,y:0,width:0,height:0};function D2(t){return t&&(t.id||t.url)}function D3(t){let{device:r}=t;"webgl"===r.type?t.generateMipmapsWebGL():"webgpu"===r.type&&r.generateMipmapsWebGPU(t)}function D4(t,r,i){for(let n=0;n<r.length;n++){let{icon:a,xOffset:o}=r[n];t[D2(a)]={...a,x:o,y:i}}}class D6{constructor(t,{onUpdate:r=DJ,onError:i=DJ}){this._loadOptions=null,this._texture=null,this._externalTexture=null,this._mapping={},this._samplerParameters=null,this._pendingCount=0,this._autoPacking=!1,this._xOffset=0,this._yOffset=0,this._rowHeight=0,this._buffer=4,this._canvasWidth=1024,this._canvasHeight=0,this._canvas=null,this.device=t,this.onUpdate=r,this.onError=i}finalize(){this._texture?.delete()}getTexture(){return this._texture||this._externalTexture}getIconMapping(t){let r=this._autoPacking?D2(t):t;return this._mapping[r]||D1}setProps({loadOptions:t,autoPacking:r,iconAtlas:i,iconMapping:n,textureParameters:a}){t&&(this._loadOptions=t),void 0!==r&&(this._autoPacking=r),n&&(this._mapping=n),i&&(this._texture?.delete(),this._texture=null,this._externalTexture=i),a&&(this._samplerParameters=a)}
4147get isLoaded(){return 0===this._pendingCount}packIcons(t,r){if(!this._autoPacking||"u"<typeof document)return;let i=Object.values(function(t,r,i){if(!t||!r)return null;i=i||{};let n={},{iterable:a,objectInfo:o}=Mw(t);for(let t of a){o.index++;let a=r(t,o),s=D2(a);if(!a)throw Error("Icon is missing.");if(!a.url)throw Error("Icon url is missing.");n[s]||i[s]&&a.url===i[s].url||(n[s]={...a,source:t,sourceIndex:o.index})}return n}(t,r,this._mapping)||{});if(i.length>0){let{mapping:t,xOffset:r,yOffset:n,rowHeight:a,canvasHeight:o}=function({icons:t,buffer:r,mapping:i={},xOffset:n=0,yOffset:a=0,rowHeight:o=0,canvasWidth:s}){let l=[];for(let u=0;u<t.length;u++){let c=t[u];if(!i[D2(c)]){let{height:t,width:u}=c;n+u+r>s&&(D4(i,l,a),n=0,a=o+a+r,o=0,l=[]),l.push({icon:c,xOffset:n}),n=n+u+r,o=Math.max(o,t)}}return l.length>0&&D4(i,l,a),{mapping:i,rowHeight:o,xOffset:n,yOffset:a,canvasWidth:s,canvasHeight:Math.pow(2,Math.ceil(Math.log2(o+a+r)))}}({icons:i,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=a,this._mapping=t,this._xOffset=r,this._yOffset=n,this._canvasHeight=o,this._texture||(this._texture=this.device.createTexture({format:"rgba8unorm",data:null,width:this._canvasWidth,height:this._canvasHeight,sampler:this._samplerParameters||D0,mipLevels:this.device.getMipLevelCount(this._canvasWidth,this._canvasHeight)})),this._texture.height!==this._canvasHeight&&(this._texture=function(t,r,i,n){let{width:a,height:o,device:s}=t,l=s.createTexture({format:"rgba8unorm",width:r,height:i,sampler:n,mipLevels:s.getMipLevelCount(r,i)}),u=s.createCommandEncoder();u.copyTextureToTexture({sourceTexture:t,destinationTexture:l,width:a,height:o});let c=u.finish();return s.submit(c),D3(l),t.destroy(),l}(this._texture,this._canvasWidth,this._canvasHeight,this._samplerParameters||D0)),this.onUpdate(!0),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(i)}}_loadIcons(t){let r=this._canvas.getContext("2d",{willReadFrequently:!0});for(let i of t)this._pendingCount++,Am(i.url,this._loadOptions).then(t=>{let n=D2(i),a=this._mapping[n],{x:o,y:s,width:l,height:u}=a,{image:c,width:h,height:f}=function(t,r,i,n){let a=Math.min(i/r.width,n/r.height),o=Math.floor(r.width*a),s=Math.floor(r.height*a);return 1===a?{image:r,width:o,height:s}:(t.canvas.height=s,t.canvas.width=o,t.clearRect(0,0,o,s),t.drawImage(r,0,0,r.width,r.height,0,0,o,s),{image:t.canvas,width:o,height:s})}(r,t,l,u),d=o+(l-h)/2,p=s+(u-f)/2;this._texture?.copyExternalImage({image:c,x:d,y:p,width:h,height:f}),a.x=d,a.y=p,a.width=h,a.height=f,this._texture&&D3(this._texture),this.onUpdate(h!==l||f!==u)}).catch(t=>{this.onError({url:i.url,source:i.source,sourceIndex:i.sourceIndex,loadOptions:this._loadOptions,error:t})}).finally(()=>{this._pendingCount--})}}let D5=[0,0,0,255],D8={iconAtlas:{type:"image",value:null,async:!0},iconMapping:{type:"object",value:{},async:!0},sizeScale:{type:"number",value:1,min:0},billboard:!0,sizeUnits:"pixels",sizeBasis:"height",sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:"number",value:.05,min:0,max:1},getPosition:{type:"accessor",value:t=>t.position},getIcon:{type:"accessor",value:t=>t.icon},getColor:{type:"accessor",value:D5},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},onIconError:{type:"function",value:null,optional:!0},textureParameters:{type:"object",ignore:!0,value:null}};class D7 extends D${getShaders(){let t=!!this.props.data?.attributes?.rowIndexes;return super.getShaders({vs:DX,fs:DK,source:DQ.replace("PICKING_COLOR_ATTRIBUTE",t?"@location(10) rowIndexes: u32,":"").replace("PICKING_COLOR_VALUE",t?"picking_getPickingColorFromIndex(inp.rowIndexes)":"picking_getPickingColorFromIndex(inp.instanceIndex)"),defines:t?{USE_ROW_INDEXES:!0}:{},modules:[wv,bE,Ej,DY]})}initializeState(){this.state={iconManager:new D6(this.context.device,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})},this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,bufferGroup:"icon-instance-data",accessor:"get
4147Size",defaultValue:1},instanceIconDefs:{size:7,bufferGroup:"icon-instance-data",accessor:"getIcon",transform:this.getInstanceIconDef,shaderAttributes:{instanceOffsets:{size:2,elementOffset:0},instanceIconFrames:{size:4,elementOffset:2},instanceColorModes:{size:1,elementOffset:6}}},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,bufferGroup:"icon-instance-data",accessor:"getColor",defaultValue:D5},instanceAngles:{size:1,transition:!0,bufferGroup:"icon-instance-data",accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,bufferGroup:"icon-instance-data",accessor:"getPixelOffset"},...this.props.data?.attributes?.rowIndexes?{rowIndexes:{size:1,type:"uint32",noAlloc:!0}}:{}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:n}=t,a=this.getAttributeManager(),{iconAtlas:o,iconMapping:s,data:l,getIcon:u,textureParameters:c}=r,{iconManager:h}=this.state;if("string"==typeof o)return;let f=o||this.internalState.isAsyncPropLoading("iconAtlas");h.setProps({loadOptions:r.loadOptions,autoPacking:!f,iconAtlas:o,iconMapping:f?s:null,textureParameters:c}),f?i.iconMapping!==r.iconMapping&&a.invalidate("getIcon"):(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getIcon))&&h.packIcons(l,u),n.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),a.invalidateAll())}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(t){super.finalizeState(t),this.state.iconManager.finalize()}draw({uniforms:t}){this._drawModel(this.state.model)}
4147_drawModel(t){let{sizeScale:r,sizeBasis:i,sizeMinPixels:n,sizeMaxPixels:a,sizeUnits:o,billboard:s,alphaCutoff:l}=this.props,{iconManager:u}=this.state,c=u.getTexture();if(c){let u={iconsTexture:c,iconsTextureDim:[c.width,c.height],sizeUnits:x4[o],sizeScale:r,sizeBasis:+("height"===i),sizeMinPixels:n,sizeMaxPixels:a,billboard:s,alphaCutoff:l};t.shaderInputs.setProps({icon:u}),t.draw(this.context.renderPass)}}_getModel(t=this.props.id){return new DH.Model(this.context.device,{...this.getShaders(),id:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new DW.Geometry({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([-1,-1,1,-1,-1,1,1,1])}}}),isInstanced:!0})}_onUpdate(t){t?(this.getAttributeManager()?.invalidate("getIcon"),this.setNeedsUpdate()):this.setNeedsRedraw()}_onError(t){let r=this.getCurrentLayer()?.props.onIconError;r?r(t):xn.error(t.error.message)()}getInstanceIconDef(t){let{x:r,y:i,width:n,height:a,mask:o,anchorX:s=n/2,anchorY:l=a/2}=this.state.iconManager.getIconMapping(t);return[n/2-s,a/2-l,r,i,n,a,+!!o]}}D7.defaultProps=D8,D7.layerName="IconLayer";let D9=D7,Pe=`\ 4148layout(std140) uniform scatterplotUniforms { 4149 float radiusScale; 4150 float radiusMinPixels; 4151 float radiusMaxPixels; 4152 float lineWidthScale; 4153 float lineWidthMinPixels; 4154 float lineWidthMaxPixels; 4155 float stroked; 4156 float filled; 4157 bool antialiasing; 4158 bool billboard; 4159 highp int radiusUnits; 4160 highp int lineWidthUnits; 4161} scatterplot; 4162`,Pt={name:"scatterplot",vs:Pe,fs:Pe,source:"",uniformTypes:{radiusScale:"f32",radiusMinPixels:"f32",radiusMaxPixels:"f32",lineWidthScale:"f32",lineWidthMinPixels:"f32",lineWidthMaxPixels:"f32",stroked:"f32",filled:"f32",antialiasing:"f32",billboard:"f32",radiusUnits:"i32",lineWidthUnits:"i32"}},Pr=`\ 4163#version 300 es 4164#define SHADER_NAME scatterplot-layer-vertex-shader 4165in vec3 positions; 4166in vec3 instancePositions; 4167in vec3 instancePositions64Low; 4168in float instanceRadius; 4169in float instanceLineWidths; 4170in vec4 instanceFillColors; 4171in vec4 instanceLineColors; 4172#ifdef USE_ROW_INDEXES 4173in float rowIndexes; 4174#endif 4175in vec2 instancePixelOffset; 4176out vec4 vFillColor; 4177out vec4 vLineColor; 4178out vec2 unitPosition; 4179out float innerUnitRadius; 4180out float outerRadiusPixels; 4181void main(void) { 4182geometry.worldPosition = instancePositions; 4183outerRadiusPixels = clamp( 4184project_size_to_pixel(scatterplot.radiusScale * instanceRadius, scatterplot.radiusUnits), 4185scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels 4186); 4187float lineWidthPixels = clamp( 4188project_size_to_pixel(scatterplot.lineWidthScale * instanceLineWidths, scatterplot.lineWidthUnits), 4189scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels 4190); 4191outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0; 4192float edgePadding = scatterplot.antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0; 4193unitPosition = edgePadding * positions.xy; 4194geometry.uv = unitPosition; 4195#ifdef USE_ROW_INDEXES 4196geometry.pickingColor = picking_getPickingColorFromIndex(rowIndexes); 4197#else 4198geometry.pickingColor = picking_getPickingColorFromInstanceID(); 4199#endif 4200innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / outerRadiusPixels; 4201if (scatterplot.billboard) { 4202gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 4203DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4204vec3 offset = edgePadding * positions * outerRadiusPixels; 4205offset.xy += instancePixelOffset; 4206DECKGL_FILTER_SIZE(offset, geometry); 4207gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 4208} else { 4209vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels); 4210offset.xy += project_pixel_size(instancePixelOffset); 4211DECKGL_FILTER_SIZE(offset, geometry); 4212gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position); 4213DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4214} 4215vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity); 4216DECKGL_FILTER_COLOR(vFillColor, geometry); 4217vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity); 4218DECKGL_FILTER_COLOR(vLineColor, geometry); 4219} 4220`,Pi=`\ 4221#version 300 es 4222#define SHADER_NAME scatterplot-layer-fragment-shader 4223precision highp float; 4224in vec4 vFillColor; 4225in vec4 vLineColor; 4226in vec2 unitPosition; 4227in float innerUnitRadius; 4228in float outerRadiusPixels; 4229out vec4 fragColor; 4230void main(void) { 4231geometry.uv = unitPosition; 4232float distToCenter = length(unitPosition) * outerRadiusPixels; 4233float inCircle = scatterplot.antialiasing ? 4234smoothedge(distToCenter, outerRadiusPixels) : 4235step(distToCenter, outerRadiusPixels); 4236if (inCircle == 0.0) { 4237discard; 4238} 4239if (scatterplot.stroked > 0.5) { 4240float isLine = scatterplot.antialiasing ? 4241smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) : 4242step(innerUnitRadius * outerRadiusPixels, distToCenter); 4243if (scatterplot.filled > 0.5) { 4244fragColor = mix(vFillColor, vLineColor, isLine); 4245} else { 4246if (isLine == 0.0) { 4247discard; 4248} 4249fragColor = vec4(vLineColor.rgb, vLineColor.a * isLine); 4250} 4251} else if (scatterplot.filled < 0.5) { 4252discard; 4253} else { 4254fragColor = vFillColor; 4255} 4256fragColor.a *= inCircle; 4257DECKGL_FILTER_COLOR(fragColor, geometry); 4258} 4259`,Pn=`\ 4260// Main shaders 4261 4262struct ScatterplotUniforms { 4263 radiusScale: f32, 4264 radiusMinPixels: f32, 4265 radiusMaxPixels: f32, 4266 lineWidthScale: f32, 4267 lineWidthMinPixels: f32, 4268 lineWidthMaxPixels: f32, 4269 stroked: f32, 4270 filled: i32, 4271 antialiasing: i32, 4272 billboard: i32, 4273 radiusUnits: i32, 4274 lineWidthUnits: i32, 4275}; 4276 4277@group(0) @binding(0) var<uniform> scatterplot: ScatterplotUniforms; 4278 4279struct Attributes { 4280 @builtin(instance_index) instanceIndex : u32, 4281 @builtin(vertex_index) vertexIndex : u32, 4282 @location(0) positions: vec3<f32>, 4283 @location(1) instancePositions: vec3<f32>, 4284 @location(2) instancePositions64Low: vec3<f32>, 4285 @location(3) instanceRadius: f32, 4286 @location(4) instanceLineWidths: f32, 4287 @location(5) instanceFillColors: vec4<f32>, 4288 @location(6) instanceLineColors: vec4<f32>, 4289 @location(7) instancePixelOffset: vec2<f32>, 4290 PICKING_COLOR_ATTRIBUTE 4291}; 4292
4293struct Varyings { 4294 @builtin(position) position: vec4<f32>, 4295 @location(0) vFillColor: vec4<f32>, 4296 @location(1) vLineColor: vec4<f32>, 4297 @location(2) unitPosition: vec2<f32>, 4298 @location(3) innerUnitRadius: f32, 4299 @location(4) outerRadiusPixels: f32, 4300 @location(5) pickingColor: vec3<f32>, 4301 @location(6) clipCoordinates: vec2<f32>, 4302}; 4303 4304@vertex 4305fn vertexMain(attributes: Attributes) -> Varyings { 4306 var varyings: Varyings; 4307 4308 // Draw an inline geometry constant array clip space triangle to verify that rendering works. 4309 // var positions = array<vec2<f32>, 3>(vec2(0.0, 0.5), vec2(-0.5, -0.5), vec2(0.5, -0.5)); 4310 // if (attributes.instanceIndex == 0) { 4311 // varyings.position = vec4<f32>(positions[attributes.vertexIndex], 0.0, 1.0); 4312 // return varyings; 4313 // } 4314 4315 geometry.worldPosition = attributes.instancePositions; 4316 4317 // Multiply out radius and clamp to limits 4318 varyings.outerRadiusPixels = clamp( 4319 project_unit_size_to_pixel(scatterplot.radiusScale * attributes.instanceRadius, scatterplot.radiusUnits), 4320 scatterplot.radiusMinPixels, scatterplot.radiusMaxPixels 4321 ); 4322 4323 // Multiply out line width and clamp to limits 4324 let lineWidthPixels = clamp( 4325 project_unit_size_to_pixel(scatterplot.lineWidthScale * attributes.instanceLineWidths, scatterplot.lineWidthUnits), 4326 scatterplot.lineWidthMinPixels, scatterplot.lineWidthMaxPixels 4327 ); 4328 4329 // outer radius needs to offset by half stroke width 4330 varyings.outerRadiusPixels += scatterplot.stroked * lineWidthPixels / 2.0; 4331 // Expand geometry to accommodate edge smoothing 4332 // WGSL selects the second value when the condition is true, so keep the antialiased path second. 4333 let edgePadding = select( 4334 1.0, 4335 (varyings.outerRadiusPixels + SMOOTH_EDGE_RADIUS) / varyings.outerRadiusPixels, 4336 scatterplot.antialiasing != 0 4337 ); 4338 4339 // position on the containing square in [-1, 1] space 4340 varyings.unitPosition = edgePadding * attributes.positions.xy; 4341 geometry.uv = varyings.unitPosition; 4342 geometry.pickingColor = PICKING_COLOR_VALUE; 4343 4344 varyings.innerUnitRadius = 1.0 - scatterplot.stroked * lineWidthPixels / varyings.outerRadiusPixels; 4345 4346 if (scatterplot.billboard != 0) { 4347 let projectedPosition = project_position_to_clipspace_and_commonspace( 4348 attributes.instancePositions, 4349 attributes.instancePositions64Low, 4350 vec3<f32>(0.0) 4351 ); 4352 geometry.position = projectedPosition.commonPosition; 4353 varyings.position = projectedPosition.clipPosition; 4354 // DECKGL_FILTER_GL_POSITION(varyings.position, geometry); 4355 var offset = edgePadding * attributes.positions * varyings.outerRadiusPixels; 4356 offset = vec3<f32>(offset.xy + attributes.instancePixelOffset, offset.z); 4357 // DECKGL_FILTER_SIZE(offset, geometry); 4358 let clipPixels = project_pixel_size_to_clipspace(offset.xy); 4359 varyings.position = vec4<f32>(varyings.position.x + clipPixels.x, varyings.position.y + clipPixels.y, varyings.position.z, varyings.position.w); 4360 geometry.position = vec4<f32>( 4361 geometry.position.xy + project_pixel_size_vec2(offset.xy), 4362 geometry.position.zw 4363 ); 4364 } else { 4365 var offset = edgePadding * attributes.positions * project_pixel_size_float(varyings.outerRadiusPixels); 4366 offset = vec3<f32>(offset.xy + project_pixel_size_vec2(attributes.instancePixelOffset), offset.z); 4367 // DECKGL_FILTER_SIZE(offset, geometry); 4368 let projectedPosition = project_position_to_clipspace_and_commonspace( 4369 attributes.instancePositions, 4370 attributes.instancePositions64Low, 4371 offset 4372 ); 4373 geometry.position = projectedPosition.commonPosition; 4374 varyings.position = projectedPosition.clipPosition; 4375 // DECKGL_FILTER_GL_POSITION(varyings.position, geometry); 4376 } 4377 4378 varyings.clipCoordinates = geometry.position.xy; 4379 clip_filterPosition(&varyings.position, geometry.worldPosition.xy); 4380 4381 // Apply opacity to instance color, or return instance picking color 4382 varyings.vFillColor = vec4<f32>(attributes.instanceFillColors.rgb, attributes.instanceFillColors.a * layer.opacity); 4383 // DECKGL_FILTER_COLOR(varyings.vFillColor, geometry); 4384 varyings.vLineColor = vec4<f32>(attributes.instanceLineColors.rgb, attributes.instanceLineColors.a * layer.opacity); 4385 // DECKGL_FILTER_COLOR(varyings.vLineColor, geometry); 4386 varyings.pickingColor = geometry.pickingColor; 4387 4388 return varyings; 4389} 4390 4391@fragment 4392fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> { 4393 // var geometry: Geometry; 4394 // geometry.uv = unitPosition; 4395 4396 let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels; 4397 let inCircle = select( 4398 step(distToCenter, varyings.outerRadiusPixels), 4399 smoothedge(distToCenter, varyings.outerRadiusPixels), 4400 scatterplot.antialiasing != 0 4401 ); 4402 4403 if (inCircle == 0.0) { 4404 discard; 4405 } 4406 4407 var fragColor: vec4<f32>; 4408 4409 if (scatterplot.stroked != 0) { 4410 let isLine = select( 4411 step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter), 4412 smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter), 4413 scatterplot.antialiasing != 0 4414 ); 4415 4416 if (scatterplot.filled != 0) { 4417 fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine); 4418 } else { 4419 if (isLine == 0.0) { 4420 discard; 4421 } 4422 fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine); 4423 } 4424 } else if (scatterplot.filled == 0) { 4425 discard; 4426 } else { 4427 fragColor = varyings.vFillColor; 4428 } 4429 4430 fragColor.a *= inCircle; 4431 4432 clip_filterColor(varyings.clipCoordinates); 4433 4434 if (picking.isActive > 0.5) { 4435 if (!picking_isColorValid(varyings.pickingColor)) { 4436 discard; 4437 } 4438 return vec4<f32>(varyings.pickingColor, 1.0); 4439 } 4440 4441 if (picking.isHighlightActive > 0.5) { 4442 let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 4443 if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) { 4444 let highLightAlpha = picking.highlightColor.a; 4445 let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha); 4446 if (blendedAlpha > 0.0) { 4447 let highLightRatio = highLightAlpha / blendedAlpha; 4448 fragColor = vec4<f32>( 4449 mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio), 4450 blendedAlpha 4451 ); 4452 } else { 4453 fragColor = vec4<f32>(fragColor.rgb, 0.0); 4454 } 4455 } 4456 } 4457 4458 // Apply premultiplied alpha as required by transparent canvas 4459 fragColor = deckgl_premultiplied_alpha(fragColor); 4460 4461 return fragColor; 4462 // return vec4<f32>(0, 0, 1, 1); 4463} 4464`,Pa={name:"clip",source:`\ 4465struct ClipUniforms { 4466 enabled: i32, 4467 mode: i32, 4468 bounds: vec4<f32>, 4469}; 4470 4471@group(2) @binding(auto) var<uniform> clipUniforms: ClipUniforms; 4472 4473fn clip_isInBounds(coordinates: vec2<f32>) -> bool { 4474 return coordinates.x >= clipUniforms.bounds.x && 4475 coordinates.y >= clipUniforms.bounds.y && 4476 coordinates.x < clipUniforms.bounds.z && 4477 coordinates.y < clipUniforms.bounds.w; 4478} 4479 4480fn clip_filterPosition(position: ptr<function, vec4<f32>>, instanceCoordinates: vec2<f32>) { 4481 if ( 4482 clipUniforms.enabled != 0 && 4483 clipUniforms.mode == 1 && 4484 !clip_isInBounds(instanceCoordinates) 4485 ) { 4486 *position = vec4<f32>(2.0, 2.0, 2.0, 1.0); 4487 } 4488} 4489 4490fn clip_filterColor(geometryCoordinates: vec2<f32>) { 4491 if ( 4492 clipUniforms.enabled != 0 && 4493 clipUniforms.mode == 0 && 4494 !clip_isInBounds(geometryCoordinates) 4495 ) { 4496 discard; 4497 } 4498} 4499`,props:{},uniforms:{},bindingLayout:[{name:"clip",group:2}],uniformTypes:{enabled:"i32",mode:"i32",bounds:"vec4<f32>"},defaultUniforms:{enabled:0,mode:0,bounds:[0,0,1,1]},getUniforms(t={}){let r={};return void 0!==t.enabled&&(r.enabled=+!!t.enabled),void 0!==t.mode&&(r.mode=+("instance"===t.mode)),void 0!==t.bounds&&(r.bounds=t.bounds),r}}
4499,Po=[0,0,0,255],Ps={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:t=>t.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:Po},getLineColor:{type:"accessor",value:Po},getLineWidth:{type:"accessor",value:1},getPixelOffset:{type:"accessor",value:[0,0]},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class Pl extends D${getShaders(){let t=!!this.props.data?.attributes?.rowIndexes;return super.getShaders({vs:Pr,fs:Pi,source:Pn.replace("PICKING_COLOR_ATTRIBUTE",t?"@location(8) rowIndexes: u32,":"").replace("PICKING_COLOR_VALUE",t?"picking_getPickingColorFromIndex(attributes.rowIndexes)":"picking_getPickingColorFromIndex(attributes.instanceIndex)"),defines:t?{USE_ROW_INDEXES:!0}:{},modules:[wv,bE,Ej,Pt,..."webgpu"===this.context.device.type?[Pa]:[]]})}initializeState(){let t=this.props.data?.attributes?.rowIndexes?{rowIndexes:{size:1,type:"uint32",noAlloc:!0}}:{};this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1,bufferGroup:"scatterplot-instance-data"},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255],bufferGroup:"scatterplot-instance-data"},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255],bufferGroup:"scatterplot-instance-data"},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1,bufferGroup:"scatterplot-instance-data"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset",bufferGroup:"scatterplot-instance-data"},...t})}updateState(t){super.updateState(t),t.changeFlags.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:t}){let{radiusUnits:r,radiusScale:i,radiusMinPixels:n,radiusMaxPixels:a,stroked:o,filled:s,billboard:l,antialiasing:u,lineWidthUnits:c,lineWidthScale:h,lineWidthMinPixels:f,lineWidthMaxPixels:d}=this.props,p={stroked:o,filled:s,billboard:l,antialiasing:u,radiusUnits:x4[r],radiusScale:i,radiusMinPixels:n,radiusMaxPixels:a,lineWidthUnits:x4[c],lineWidthScale:h,lineWidthMinPixels:f,lineWidthMaxPixels:d},m=this.state.model;m.shaderInputs.setProps({scatterplot:p}),m.draw(this.context.renderPass)}_getModel(){return new DH.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new DW.Geometry({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0])}}}),isInstanced:!0})}}Pl.defaultProps=Ps,Pl.layerName="ScatterplotLayer";let Pu=`\ 4500layout(std140) uniform sdfUniforms { 4501 float gamma; 4502 bool enabled; 4503 float buffer; 4504 float outlineBuffer; 4505 vec4 outlineColor; 4506} sdf; 4507`,Pc={name:"sdf",vs:Pu,fs:Pu,uniformTypes:{gamma:"f32",enabled:"f32",buffer:"f32",outlineBuffer:"f32",outlineColor:"vec4<f32>"}},Ph={none:0,start:1,center:2,end:3},Pf={name:"text",vs:`\ 4508layout(std140) uniform textUniforms {
4509 highp vec2 cutoffPixels; 4510 highp ivec2 align; 4511 highp float fontSize; 4512 bool flipY; 4513} text; 4514 4515#define ALIGN_MODE_START ${Ph.start} 4516#define ALIGN_MODE_CENTER ${Ph.center} 4517#define ALIGN_MODE_END ${Ph.end} 4518`,getUniforms:({contentCutoffPixels:t=[0,0],contentAlignHorizontal:r="none",contentAlignVertical:i="none",fontSize:n,viewport:a})=>({cutoffPixels:t,align:[Ph[r],Ph[i]],fontSize:n,flipY:a?.flipY??!1}),uniformTypes:{cutoffPixels:"vec2<f32>",align:"vec2<i32>",fontSize:"f32",flipY:"f32"}},Pd=`\ 4519#version 300 es 4520#define SHADER_NAME multi-icon-layer-vertex-shader 4521in vec2 positions; 4522in vec3 instancePositions; 4523in vec3 instancePositions64Low; 4524in float instanceSizes; 4525in float instanceAngles; 4526in vec4 instanceColors; 4527in float rowIndexes; 4528in vec4 instanceIconFrames; 4529in float instanceColorModes; 4530in vec2 instanceOffsets; 4531in vec2 instancePixelOffset; 4532in vec4 instanceClipRect; 4533out float vColorMode; 4534out vec4 vColor; 4535out vec2 vTextureCoords; 4536out vec2 uv; 4537vec2 rotate_by_angle(vec2 vertex, float angle) { 4538float angle_radian = angle * PI / 180.0; 4539float cos_angle = cos(angle_radian); 4540float sin_angle = sin(angle_radian); 4541mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); 4542return rotationMatrix * vertex; 4543} 4544float getPixelOffsetFromAlignment(float anchor, float extent, float clipStart, float clipEnd, int mode) { 4545if (clipEnd < clipStart) return 0.0; 4546if (mode == ALIGN_MODE_START) { 4547return max(- (anchor + clipStart), 0.0); 4548} 4549if (mode == ALIGN_MODE_CENTER) { 4550float _min = max(0., anchor + clipStart); 4551float _max = min(extent, anchor + clipEnd); 4552return _min < _max ? (_min + _max) / 2.0 - anchor : 0.0; 4553} 4554if (mode == ALIGN_MODE_END) { 4555return min(extent - (anchor + clipEnd), 0.); 4556} 4557return 0.0; 4558} 4559void main(void) { 4560geometry.worldPosition = instancePositions; 4561geometry.uv = positions; 4562geometry.pickingColor = picking_getPickingColorFromIndex(rowIndexes); 4563uv = positions; 4564vec2 iconSize = instanceIconFrames.zw; 4565float sizePixels = clamp( 4566project_size_to_pixel(instanceSizes * icon.sizeScale, icon.sizeUnits),
4567icon.sizeMinPixels, icon.sizeMaxPixels 4568); 4569float instanceScale = sizePixels / text.fontSize; 4570vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets; 4571pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale; 4572pixelOffset += instancePixelOffset; 4573pixelOffset.y *= -1.0; 4574vec2 anchorPosScreen; 4575if (icon.billboard) { 4576gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 4577anchorPosScreen = gl_Position.xy / gl_Position.w; 4578DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4579vec3 offset = vec3(pixelOffset, 0.0); 4580DECKGL_FILTER_SIZE(offset, geometry); 4581gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 4582} else { 4583vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); 4584if (text.flipY) { 4585offset_common.y *= -1.; 4586} 4587DECKGL_FILTER_SIZE(offset_common, geometry); 4588vec4 anchorPos = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0)); 4589anchorPosScreen = anchorPos.xy / anchorPos.w; 4590gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); 4591DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 4592} 4593anchorPosScreen = vec2(anchorPosScreen.x + 1.0, 1.0 - anchorPosScreen.y) / 2.0 * project.viewportSize / project.devicePixelRatio; 4594vec2 xy = project_size_to_pixel(instanceClipRect.xy); 4595vec2 wh = project_size_to_pixel(instanceClipRect.zw); 4596if (text.flipY) { 4597xy.y = -xy.y - wh.y; 4598} 4599if (text.align.x > 0 || text.align.y > 0) { 4600vec2 viewportPixels = project.viewportSize / project.devicePixelRatio; 4601vec2 scrollPixels = vec2( 4602getPixelOffsetFromAlignment(anchorPosScreen.x, viewportPixels.x, xy.x, xy.x + wh.x, text.align.x), 4603-getPixelOffsetFromAlignment(anchorPosScreen.y, viewportPixels.y, -xy.y - wh.y, -xy.y, text.align.y) 4604); 4605pixelOffset += scrollPixels; 4606gl_Position.xy += project_pixel_size_to_clipspace(scrollPixels); 4607} 4608if (instanceClipRect.z >= 0.) { 4609if (pixelOffset.x < xy.x || pixelOffset.x > xy.x + wh.x) { 4610gl_Position = vec4(0.0); 4611} 4612else if (text.cutoffPixels.x > 0.) { 4613float vpWidth = project.viewportSize.x / project.devicePixelRatio; 4614float l = max(anchorPosScreen.x + xy.x, 0.0); 4615float r = min(anchorPosScreen.x + xy.x + wh.x, vpWidth); 4616if (r - l < text.cutoffPixels.x) { 4617gl_Position = vec4(0.0); 4618} 4619} 4620} 4621if (instanceClipRect.w >= 0.) { 4622if (pixelOffset.y < xy.y || pixelOffset.y > xy.y + wh.y) { 4623gl_Position = vec4(0.0); 4624} 4625else if (text.cutoffPixels.y > 0.) { 4626float vpHeight = project.viewportSize.y / project.devicePixelRatio; 4627float t = max(anchorPosScreen.y - xy.y - wh.y, 0.0); 4628float b = min(anchorPosScreen.y - xy.y, vpHeight); 4629if (b - t < text.cutoffPixels.y) { 4630gl_Position = vec4(0.0); 4631} 4632} 4633} 4634vTextureCoords = mix( 4635instanceIconFrames.xy, 4636instanceIconFrames.xy + iconSize, 4637(positions.xy + 1.0) / 2.0 4638) / icon.iconsTextureDim; 4639vColor = instanceColors; 4640DECKGL_FILTER_COLOR(vColor, geometry); 4641vColorMode = instanceColorModes; 4642} 4643`,Pp=`\ 4644#version 300 es 4645#define SHADER_NAME multi-icon-layer-fragment-shader 4646precision highp float; 4647uniform sampler2D iconsTexture; 4648in vec4 vColor; 4649in vec2 vTextureCoords; 4650in vec2 uv; 4651out vec4 fragColor; 4652void main(void) { 4653geometry.uv = uv; 4654if (!bool(picking.isActive)) { 4655float alpha = texture(iconsTexture, vTextureCoords).a; 4656vec4 color = vColor; 4657if (sdf.enabled) { 4658float distance = alpha; 4659alpha = smoothstep(sdf.buffer - sdf.gamma, sdf.buffer + sdf.gamma, distance); 4660if (sdf.outlineBuffer > 0.0) { 4661float inFill = alpha; 4662float inBorder = smoothstep(sdf.outlineBuffer - sdf.gamma, sdf.outlineBuffer + sdf.gamma, distance); 4663color = mix(sdf.outlineColor, vColor, inFill); 4664alpha = inBorder; 4665} 4666} 4667float a = alpha * color.a; 4668if (a < icon.alphaCutoff) { 4669discard; 4670} 4671fragColor = vec4(color.rgb, a * layer.opacity); 4672} 4673DECKGL_FILTER_COLOR(fragColor, geometry); 4674} 4675`,Pm=function({collision:t=!1}={}){return`\ 4676struct IconUniforms { 4677 sizeScale: f32, 4678 iconsTextureDim: vec2<f32>, 4679 sizeBasis: f32, 4680 sizeMinPixels: f32, 4681 sizeMaxPixels: f32, 4682 billboard: i32, 4683 sizeUnits: i32, 4684 alphaCutoff: f32 4685}; 4686 4687struct TextUniforms { 4688 cutoffPixels: vec2<f32>, 4689 align: vec2<i32>, 4690 fontSize: f32, 4691 flipY: f32 4692}; 4693 4694struct SdfUniforms { 4695 gamma: f32, 4696 enabled: f32, 4697 buffer: f32, 4698 outlineBuffer: f32, 4699 outlineColor: vec4<f32> 4700}; 4701 4702${t?`\ 4703struct CollisionUniforms { 4704 sort: i32, 4705 enabled: i32 4706}; 4707`:""} 4708 4709const ALIGN_MODE_START: i32 = 1; 4710const ALIGN_MODE_CENTER: i32 = 2; 4711const ALIGN_MODE_END: i32 = 3; 4712 4713@group(0) @binding(auto) var<uniform> icon: IconUniforms; 4714@group(0) @binding(auto) var<uniform> text: TextUniforms; 4715@group(0) @binding(auto) var<uniform> sdf: SdfUniforms; 4716${t?"@group(0) @binding(auto) var<uniform> collision: CollisionUniforms;":""} 4717@group(0) @binding(auto) var iconsTexture : texture_2d<f32>; 4718@group(0) @binding(auto) var iconsTextureSampler : sampler; 4719${t?`\ 4720@group(0) @binding(auto) var collision_texture : texture_2d<f32>; 4721`:""} 4722 4723fn rotate_by_angle(vertex: vec2<f32>, angle_deg: f32) -> vec2<f32> { 4724 let angle_radian = angle_deg * PI / 180.0; 4725 let c = cos(angle_radian); 4726 let s = sin(angle_radian); 4727 let rotation = mat2x2<f32>(vec2<f32>(c, -s), vec2<f32>(s, c)); 4728 return rotation * vertex; 4729} 4730 4731fn get_pixel_offset_from_alignment( 4732 anchor: f32, 4733 extent: f32, 4734 clipStart: f32, 4735 clipEnd: f32, 4736 mode: i32 4737) -> f32 { 4738 if (clipEnd < clipStart) { 4739 return 0.0; 4740 } 4741 if (mode == ALIGN_MODE_START) {
4742 return max(-(anchor + clipStart), 0.0); 4743 } 4744 if (mode == ALIGN_MODE_CENTER) { 4745 let minValue = max(0.0, anchor + clipStart); 4746 let maxValue = min(extent, anchor + clipEnd); 4747 if (minValue < maxValue) { 4748 return (minValue + maxValue) / 2.0 - anchor; 4749 } 4750 return 0.0; 4751 } 4752 if (mode == ALIGN_MODE_END) { 4753 return min(extent - (anchor + clipEnd), 0.0); 4754 } 4755 return 0.0; 4756} 4757 4758${t?`\ 4759fn collision_match(texCoords: vec2<f32>, pickingColor: vec3<f32>) -> f32 { 4760 let textureSize = vec2<i32>(textureDimensions(collision_texture)); 4761 let pixelCoords = clamp( 4762 vec2<i32>(texCoords * vec2<f32>(textureSize)), 4763 vec2<i32>(0), 4764 textureSize - vec2<i32>(1) 4765 ); 4766 let collisionPickingColor = textureLoad(collision_texture, pixelCoords, 0); 4767 let delta = dot(abs(collisionPickingColor.rgb - pickingColor), vec3<f32>(1.0)); 4768 return step(delta, 0.001); 4769} 4770 4771fn collision_is_visible(texCoords: vec2<f32>, pickingColor: vec3<f32>) -> f32 { 4772 if (collision.enabled == 0) { 4773 return 1.0; 4774 } 4775 4776 var accumulator = 0.0; 4777 let stepSize = vec2<f32>(1.0) / project.viewportSize; 4778 4779 for (var i: i32 = -2; i <= 2; i = i + 1) { 4780 for (var j: i32 = -2; j <= 2; j = j + 1) { 4781 let delta = vec2<f32>(f32(j), f32(i)) * stepSize; 4782 accumulator = accumulator + collision_match(texCoords + delta, pickingColor); 4783 } 4784 } 4785 4786 return pow(accumulator / 25.0, 2.2); 4787} 4788`:""} 4789 4790struct Attributes { 4791 @location(0) positions: vec2<f32>, 4792 4793 @location(1) instancePositions: vec3<f32>, 4794 @location(2) instancePositions64Low: vec3<f32>, 4795 @location(3) instanceSizes: f32, 4796 @location(4) instanceAngles: f32, 4797 @location(5) instanceColors: vec4<f32>, 4798 @location(6) instanceIconFrames: vec4<f32>, 4799 @location(7) instanceColorModes: f32, 4800 @location(8) instanceOffsets: vec2<f32>, 4801 @location(9) instancePixelOffset: vec2<f32>, 4802 @location(10) rowIndexes: u32, 4803 @location(11) instanceClipRect: vec4<f32>, 4804 ${t?"@location(12) collisionPriorities: f32,":""} 4805}; 4806 4807struct Varyings { 4808 @builtin(position) position: vec4<f32>, 4809 4810 @location(0) vColorMode: f32, 4811 @location(1) vColor: vec4<f32>, 4812 @location(2) vTextureCoords: vec2<f32>, 4813 @location(3) uv: vec2<f32>, 4814 @location(4) pickingColor: vec3<f32>, 4815}; 4816 4817@vertex 4818fn vertexMain(inp: Attributes) -> Varyings { 4819 geometry.worldPosition = inp.instancePositions; 4820 geometry.uv = inp.positions; 4821 geometry.pickingColor = picking_getPickingColorFromIndex(inp.rowIndexes); 4822 4823 var outp: Varyings; 4824 outp.uv = inp.positions; 4825 4826 let iconSize = inp.instanceIconFrames.zw; 4827 4828 let sizePixels = clamp( 4829 project_unit_size_to_pixel(inp.instanceSizes * icon.sizeScale, icon.sizeUnits),
4830 icon.sizeMinPixels, icon.sizeMaxPixels 4831 ); 4832 let instanceScale = sizePixels / text.fontSize; 4833 4834 var pixelOffset = inp.positions / 2.0 * iconSize + inp.instanceOffsets; 4835 pixelOffset = rotate_by_angle(pixelOffset, inp.instanceAngles) * instanceScale; 4836 pixelOffset = pixelOffset + inp.instancePixelOffset; 4837 pixelOffset.y = pixelOffset.y * -1.0; 4838 4839 var pos: vec4<f32>; 4840 var anchorPosScreen: vec2<f32>; 4841 if (icon.billboard != 0) { 4842 pos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, vec3<f32>(0.0)); 4843 anchorPosScreen = pos.xy / pos.w; 4844 4845 let clipOffset = project_pixel_size_to_clipspace(pixelOffset); 4846 pos = vec4<f32>(pos.x + clipOffset.x, pos.y + clipOffset.y, pos.z, pos.w); 4847 } else { 4848 var offsetCommon = vec3<f32>(project_pixel_size_vec2(pixelOffset), 0.0); 4849 if (text.flipY > 0.5) { 4850 offsetCommon.y = offsetCommon.y * -1.0; 4851 } 4852 let anchorPos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, vec3<f32>(0.0)); 4853 anchorPosScreen = anchorPos.xy / anchorPos.w; 4854 pos = project_position_to_clipspace(inp.instancePositions, inp.instancePositions64Low, offsetCommon); 4855 } 4856 4857 anchorPosScreen = vec2<f32>(anchorPosScreen.x + 1.0, 1.0 - anchorPosScreen.y) / 2.0 * 4858 project.viewportSize / project.devicePixelRatio; 4859 var xy = project_size_vec2(inp.instanceClipRect.xy) * project.scale; 4860 var wh = project_size_vec2(inp.instanceClipRect.zw) * project.scale; 4861 4862 if (text.flipY > 0.5) { 4863 xy.y = -xy.y - wh.y; 4864 } 4865 if (text.align.x > 0 || text.align.y > 0) { 4866 let viewportPixels = project.viewportSize / project.devicePixelRatio; 4867 let scrollPixels = vec2<f32>( 4868 get_pixel_offset_from_alignment(anchorPosScreen.x, viewportPixels.x, xy.x, xy.x + wh.x, text.align.x), 4869 -get_pixel_offset_from_alignment(anchorPosScreen.y, viewportPixels.y, -xy.y - wh.y, -xy.y, text.align.y) 4870 ); 4871 pixelOffset = pixelOffset + scrollPixels; 4872 let scrollClipOffset = project_pixel_size_to_clipspace(scrollPixels); 4873 pos.x = pos.x + scrollClipOffset.x; 4874 pos.y = pos.y + scrollClipOffset.y; 4875 } 4876 4877 if (inp.instanceClipRect.z >= 0.0) { 4878 if (pixelOffset.x < xy.x || pixelOffset.x > xy.x + wh.x) { 4879 pos = vec4<f32>(0.0); 4880 } else if (text.cutoffPixels.x > 0.0) { 4881 let viewportWidth = project.viewportSize.x / project.devicePixelRatio; 4882 let left = max(anchorPosScreen.x + xy.x, 0.0); 4883 let right = min(anchorPosScreen.x + xy.x + wh.x, viewportWidth); 4884 if (right - left < text.cutoffPixels.x) { 4885 pos = vec4<f32>(0.0); 4886 } 4887 } 4888 } 4889 if (inp.instanceClipRect.w >= 0.0) { 4890 if (pixelOffset.y < xy.y || pixelOffset.y > xy.y + wh.y) { 4891 pos = vec4<f32>(0.0); 4892 } else if (text.cutoffPixels.y > 0.0) { 4893 let viewportHeight = project.viewportSize.y / project.devicePixelRatio; 4894 let top = max(anchorPosScreen.y - xy.y - wh.y, 0.0); 4895 let bottom = min(anchorPosScreen.y - xy.y, viewportHeight); 4896 if (bottom - top < text.cutoffPixels.y) { 4897 pos = vec4<f32>(0.0); 4898 } 4899 } 4900 } 4901 4902 ${t?`\ 4903 if (collision.sort != 0) { 4904 pos.z = -0.001 * inp.collisionPriorities * pos.w; 4905 } 4906 `:""} 4907 4908 let uvMix = (inp.positions.xy + vec2<f32>(1.0, 1.0)) * 0.5; 4909 outp.vTextureCoords = mix(inp.instanceIconFrames.xy, inp.instanceIconFrames.xy + iconSize, uvMix) / icon.iconsTextureDim; 4910 4911 outp.position = pos; 4912 outp.vColor = inp.instanceColors; 4913 outp.vColorMode = inp.instanceColorModes; 4914 outp.pickingColor = picking_getPickingColorFromIndex(inp.rowIndexes); 4915 4916 return outp; 4917} 4918 4919@fragment 4920fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> { 4921 geometry.uv = inp.uv; 4922 4923 let texColor = textureSample(iconsTexture, iconsTextureSampler, inp.vTextureCoords); 4924 var alpha = texColor.a; 4925 var color = inp.vColor; 4926 4927 if (sdf.enabled > 0.5) { 4928 let distance = alpha; 4929 alpha = smoothstep(sdf.buffer - sdf.gamma, sdf.buffer + sdf.gamma, distance); 4930 4931 if (sdf.outlineBuffer > 0.0) { 4932 let inFill = alpha; 4933 let inBorder = smoothstep(sdf.outlineBuffer - sdf.gamma, sdf.outlineBuffer + sdf.gamma, distance); 4934 color = mix(sdf.outlineColor, inp.vColor, inFill); 4935 alpha = inBorder; 4936 } 4937 } else if (inp.vColorMode == 0.0) { 4938 color = texColor; 4939 } 4940 4941 var a = alpha * color.a * layer.opacity; 4942 if (a < icon.alphaCutoff) { 4943 discard; 4944 } 4945 4946 if (picking.isActive > 0.5) { 4947 if (!picking_isColorValid(inp.pickingColor)) { 4948 discard; 4949 } 4950 return vec4<f32>(inp.pickingColor, 1.0); 4951 } 4952 4953 ${t?`\ 4954 let collisionFade = collision_is_visible(inp.position.xy / project.viewportSize, inp.pickingColor); 4955 a = a * collisionFade; 4956 if (a <= 0.0001) { 4957 discard; 4958 } 4959 `:""} 4960 4961 var fragColor = deckgl_premultiplied_alpha(vec4<f32>(color.rgb, a)); 4962 4963 if (picking.isHighlightActive > 0.5) { 4964 let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 4965 if (picking_isColorZero(abs(inp.pickingColor - highlightedObjectColor))) { 4966 let highLightAlpha = picking.highlightColor.a; 4967 let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha); 4968 if (blendedAlpha > 0.0) { 4969 let highLightRatio = highLightAlpha / blendedAlpha; 4970 fragColor = vec4<f32>( 4971 mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio), 4972 blendedAlpha 4973 ); 4974 } else { 4975 fragColor = vec4<f32>(fragColor.rgb, 0.0); 4976 } 4977 } 4978 } 4979 4980 return fragColor; 4981} 4982`}();class Pg extends D9{getShaders(){let t=super.getShaders();return{...t,modules:[...t.modules,Pf,Pc],vs:Pd,fs:Pp,source:Pm}}initializeState(){super.initializeState();let t=this.getAttributeManager();t.attributes.instanceIconDefs.settings.update=this.calculateInstanceIconDefs,t.addInstanced({rowIndexes:{type:"uint32",size:1,bufferGroup:"icon-instance-data",accessor:(t,{index:r})=>r},instanceClipRect:{size:4,bufferGroup:"icon-instance-data",accessor:"getContentBox",defaultValue:[0,0,-1,-1]}})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:n}=t,{outlineColor:a}=r;if(n.extensionsChanged){this.state.fillModel?.destroy();let t="webgpu"===this.context.device.type?this._getModel(`${this.props.id}-fill`):void 0;this.setState({fillModel:t,models:t?[this.state.model,t]:[this.state.model]})}if(n.updateTriggersChanged&&(n.updateTriggersChanged.getIcon||n.updateTriggersChanged.getIconOffsets)&&this.getAttributeManager().invalidate("instanceIconDefs"),a!==i.outlineColor){let t=[a[0]/255,a[1]/255,a[2]/255,(a[3]??255)/255];this.setState({outlineColor:t})}!r.sdf&&r.outlineWidth&&xn.warn(`${this.id}: fontSettings.sdf is required to render outline`)()}draw(t){let{sdf:r,smoothing:i,fontSize:n,outlineWidth:a,contentCutoffPixels:o,contentAlignHorizontal:s,contentAlignVertical:l}=this.props,{outlineColor:u}=this.state,c=a?Math.max(i,.75*(1-a)):-1,h=this.state.model,f={buffer:.75,outlineBuffer:c,gamma:i,enabled:!!r,outlineColor:u},d={contentCutoffPixels:o,contentAlignHorizontal:s,contentAlignVertical:l,fontSize:n,viewport:this.context.viewport};if(h.shaderInputs.setProps({sdf:f,text:d}),super.draw(t),r&&a){let{iconManager:t}=this.state;if(t.getTexture()){let t=this.state.fillModel||h;t.shaderInputs.setProps({sdf:{...f,outlineBuffer:.75},text:d}),this._drawModel(t)}}}calculateInstanceIconDefs(t,{startRow:r,endRow:i}){let{data:n,getIcon:a,getIconOffsets:o}=this.props,s=t.getVertexOffset(r),l=t.value,{iterable:u,objectInfo:c}=Mw(n,r,i);for(let r of u){c.index++;let i=a(r,c),n=o(r,c);if(i){let r=0;for(let a of Array.from(i)){let i=super.getInstanceIconDef(a);i[0]=n[2*r],i[1]+=n[2*r+1],i[6]=1,l.set(i,s),s+=t.size,r++}}}}}Pg.defaultProps={getIconOffsets:{type:"accessor",value:t=>t.offsets},getContentBox:{type:"accessor",value:[0,0,-1,-1]},fontSize:1,alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]},contentCutoffPixels:{type:"array",value:[0,0]},contentAlignHorizontal:"none",contentAlignVertical:"none"},Pg.layerName="MultiIconLayer";let Py=new Float64Array(256);for(let t=0;t<256;t++){let r=.5-Math.pow(t/255,1/2.2);Py[t]=r*Math.abs(r)}Py[255]=-1e20;class Pv{constructor({fontSize:t=24,buffer:r=3,radius:i=8,cutoff:n=.25,fontFamily:a="sans-serif",fontWeight:o="normal",fontStyle:s="normal",lang:l=null}={}){this.buffer=r,this.radius=i,this.cutoff=n,this.lang=l;const u=this.size=t+4*r,c=this._createCanvas(u),h=this.ctx=c.getContext("2d",{willReadFrequently:!0});h.font=`${s} ${o} ${t}px ${a}`,h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(t){if("u">typeof OffscreenCanvas)return new OffscreenCanvas(t,t);let r=document.createElement("canvas");return r.width=r.height=t,r}draw(t){let{width:r,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(i),l=Math.floor(-a),u=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o)-l)),c=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(n))),h=u+2*this.buffer,f=c+2*this.buffer,d=Math.max(h*f,0),p=new Uint8ClampedArray(d),m={data:p,width:h,height:f,glyphWidth:u,glyphHeight:c,glyphTop:s,glyphLeft:l,glyphAdvance:r};if(0===u||0===c)return m;let{ctx:g,buffer:y,gridInner:v,gridOuter:_}=this;this.lang&&(g.lang=this.lang),g.clearRect(y,y,u,c),g.fillText(t,y-l,y+s);let b=g.getImageData(y,y,u,c);_.fill(1e20,0,d),v.fill(0,0,d);let x=3;for(let t=0;t<c;t++){let r=(t+y)*h+y;for(let t=0;t<u;t++,x+=4,r++){let t=b.data[x];if(0===t)continue;let i=Py[t];_[r]=Math.max(0,i),v[r]=Math.max(0,-i)}}P_(_,0,0,h,f,h,this.f,this.v,this.z);let w=Math.min(y,1);P_(v,y-w,y-w,u+2*w,c+2*w,h,this.f,this.v,this.z);let E=255/this.radius,T=255*(1-this.cutoff);for(let t=0;t<d;t++){let r=Math.sqrt(_[t])-Math.sqrt(v[t]);p[t]=Math.round(T-E*r)}return m}}function P_(t,r,i,n,a,o,s,l,u){for(let c=r;c<r+n;c++)Pb(t,i*o+c,o,a,s,l,u);for(let c=i;c<i+a;c++)Pb(t,c*o+r,1,n,s,l,u)}function Pb(t,r,i,n,a,o,s){o[0]=0,s[0]=-1e20,s[1]=1e20,a[0]=t[r];for(let l=1,u=0,c=0;l<n;l++){a[l]=t[r+l*i];let n=l*l;
4982do{let t=o[u];c=(a[l]-a[t]+n-t*t)/(l-t)/2}while(c<=s[u]&&--u>-1)o[++u]=l,s[u]=c,s[u+1]=1e20}for(let l=0,u=0;l<n;l++){for(;s[u+1]<l;)u++;let n=o[u],c=l-n;t[r+l*i]=a[n]+c*c}}let Px=[];function Pw(t,r,i,n){let a=0;for(let o=r;o<i;o++){let r=t[o];a+=n[r]?.advance||0}return a}function PE(t,r,i,n,a,o){let s=r,l=0;for(let u=r;u<i;u++){let r=Pw(t,u,u+1,a);l+r>n&&(s<u&&o.push(u),s=u,l=0),l+=r}return l}class PT{constructor(t=5){this._cache={},this._order=[],this.limit=t}get(t){let r=this._cache[t];return r&&(this._deleteOrder(t),this._appendOrder(t)),r}set(t,r){this._cache[t]?this.delete(t):Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[t]=r,this._appendOrder(t)}delete(t){this._cache[t]&&(delete this._cache[t],this._deleteOrder(t))}_deleteOrder(t){let r=this._order.indexOf(t);r>=0&&this._order.splice(r,1)}_appendOrder(t){this._order.push(t)}}let PA={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:function(){let t=[];for(let r=32;r<128;r++)t.push(String.fromCharCode(r));return t}(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1},PS=new PT(3);function PC(t,r,i,n){t.font=`${n} ${i}px ${r}`,t.fillStyle="#000",t.textBaseline="alphabetic",t.textAlign="left"}class PM{constructor(){this.props={...PA}}get atlas(){return this._atlas}get mapping(){return this._atlas&&this._atlas.mapping}setProps(t={}){Object.assign(this.props,t),t._getFontRenderer&&(this._getFontRenderer=t._getFontRenderer),this._key=this._getKey();let r=function(t,r){let i;i=new Set("string"==typeof r?Array.from(r):r);let n=PS.get(t);if(!n)return i;for(let t in n.mapping)i.has(t)&&i.delete(t);return i}(this._key,this.props.characterSet),i=PS.get(this._key);if(i&&0===r.size){this._atlas!==i&&(this._atlas=i);return}let n=this._generateFontAtlas(r,i);this._atlas=n,PS.set(this._key,n)}_generateFontAtlas(t,r){let i,{fontFamily:n,fontWeight:a,fontSize:o,buffer:s,sdf:l,radius:u,cutoff:c}=this.props,h=r&&r.data;h||((h=document.createElement("canvas")).width=1024);let f=h.getContext("2d",{willReadFrequently:!0});PC(f,n,o,a);let d=t=>(function(t,r,i){if(void 0===i){let i=t.measureText("A");return i.fontBoundingBoxAscent?{advance:0,width:0,ascent:Math.ceil(i.fontBoundingBoxAscent),descent:Math.ceil(i.fontBoundingBoxDescent)}:{advance:0,width:0,ascent:.9*r,descent:.3*r}}let n=t.measureText(i);return n.actualBoundingBoxAscent?{advance:n.width,width:Math.ceil(n.actualBoundingBoxRight-n.actualBoundingBoxLeft),ascent:Math.ceil(n.actualBoundingBoxAscent),descent:Math.ceil(n.actualBoundingBoxDescent)}:{advance:n.width,width:n.width,ascent:.9*r,descent:.3*r}})(f,o,t);this._getFontRenderer?i=this._getFontRenderer(this.props):l&&(i={measure:d,draw:function({fontSize:t,buffer:r,radius:i,cutoff:n,fontFamily:a,fontWeight:o}){let s=new Pv({fontSize:t,buffer:r,radius:i,cutoff:n,fontFamily:a,fontWeight:`${o}`});return t=>{let{data:i,width:n,height:a}=s.draw(t),o=new ImageData(n,a);for(let t=0;t<i.length;t++)o.data[4*t+3]=i[t];return{data:o,left:r,top:r}}}(this.props)});let{mapping:p,canvasHeight:m,xOffset:g,yOffsetMin:y,yOffsetMax:v}=function({characterSet:t,measureText:r,buffer:i,maxCanvasWidth:n,mapping:a={},xOffset:o=0,yOffsetMin:s=0,yOffsetMax:l=0}){let u=o,c=s,h=l;for(let o of t)if(!a[o]){let{advance:t,width:s,ascent:l,descent:f}=r(o),d=l+f;u+s+2*i>n&&(u=0,c=h),a[o]={x:u+i,y:c+i,width:s,height:d,advance:t,anchorX:s/2,anchorY:l},u+=s+2*i,h=Math.max(h,c+d+2*i)}return{mapping:a,xOffset:u,yOffsetMin:c,yOffsetMax:h,canvasHeight:Math.pow(2,Math.ceil(Math.log2(h)))}}({measureText:t=>i?i.measure(t):d(t),buffer:s,characterSet:t,maxCanvasWidth:1024,...r&&{mapping:r.mapping,xOffset:r.xOffset,yOffsetMin:r.yOffsetMin,yOffsetMax:r.yOffsetMax}});if(h.height!==m){let t=h.height>0?f.getImageData(0,0,h.width,h.height):null;h.height=m,t&&f.putImageData(t,0,0)}if(PC(f,n,o,a),i)for(let r of t){let t=p[r],n=t.width,{data:a,left:o=0,top:s=0}=i.draw(r),l=t.x-o,u=t.y-s,c=Math.max(0,Math.round(l)),d=Math.max(0,Math.round(u)),m=Math.min(a.width,h.width-c),g=Math.min(a.height,h.height-d);f.putImageData(a,c,d,0,0,m,g),t.x=c,t.y=d,t.width=m,t.height=g,t.anchorX+=m/2-o-n/2,t.anchorY+=s}else for(let r of t){let t=p[r];f.fillText(r,t.x,t.y+t.anchorY)}let _=i?i.measure():d();return{baselineOffset:(_.ascent-_.descent)/2,xOffset:g,yOffsetMin:y,yOffsetMax:v,mapping:p,data:h,width:h.width,height:h.height}}_getKey(){let{fontFamily:t,fontWeight:r,fontSize:i,buffer:n,sdf:a,radius:o,cutoff:s}=this.props;return a?`${t} ${r} ${i} ${n} ${o} ${s}`:`${t} ${r} ${i} ${n}`}}let PD=`\
4983layout(std140) uniform textBackgroundUniforms { 4984 bool billboard; 4985 float sizeScale; 4986 float sizeMinPixels; 4987 float sizeMaxPixels; 4988 vec4 borderRadius; 4989 vec4 padding; 4990 highp int sizeUnits; 4991 bool stroked; 4992} textBackground; 4993`,PP={name:"textBackground",source:`\ 4994struct TextBackgroundUniforms { 4995 billboard: f32, 4996 sizeScale: f32, 4997 sizeMinPixels: f32, 4998 sizeMaxPixels: f32, 4999 borderRadius: vec4<f32>, 5000 padding: vec4<f32>, 5001 sizeUnits: i32, 5002 stroked: f32, 5003}; 5004 5005@group(0) @binding(auto) var<uniform> textBackground: TextBackgroundUniforms; 5006`,vs:PD,fs:PD,uniformTypes:{billboard:"f32",sizeScale:"f32",sizeMinPixels:"f32",sizeMaxPixels:"f32",borderRadius:"vec4<f32>",padding:"vec4<f32>",sizeUnits:"i32",stroked:"f32"}},PI=`\ 5007#version 300 es 5008#define SHADER_NAME text-background-layer-vertex-shader 5009in vec2 positions; 5010in vec3 instancePositions; 5011in vec3 instancePositions64Low; 5012in vec4 instanceRects; 5013in vec4 instanceClipRect; 5014in float instanceSizes; 5015in float instanceAngles; 5016in vec2 instancePixelOffsets; 5017in float instanceLineWidths; 5018in vec4 instanceFillColors; 5019in vec4 instanceLineColors; 5020out vec4 vFillColor; 5021out vec4 vLineColor; 5022out float vLineWidth; 5023out vec2 uv; 5024out vec2 dimensions; 5025vec2 rotate_by_angle(vec2 vertex, float angle) { 5026float angle_radian = radians(angle); 5027float cos_angle = cos(angle_radian); 5028float sin_angle = sin(angle_radian); 5029mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle); 5030return rotationMatrix * vertex; 5031} 5032void main(void) { 5033geometry.worldPosition = instancePositions; 5034geometry.uv = positions; 5035geometry.pickingColor = picking_getPickingColorFromInstanceID(); 5036uv = positions; 5037vLineWidth = instanceLineWidths; 5038float sizePixels = clamp( 5039project_size_to_pixel(instanceSizes * textBackground.sizeScale, textBackground.sizeUnits), 5040textBackground.sizeMinPixels, textBackground.sizeMaxPixels 5041); 5042float instanceScale = sizePixels / text.fontSize; 5043dimensions = instanceRects.zw * instanceScale + textBackground.padding.xy + textBackground.padding.zw; 5044vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * instanceScale + mix(-textBackground.padding.xy, textBackground.padding.zw, positions); 5045pixelOffset = rotate_by_angle(pixelOffset, instanceAngles); 5046pixelOffset += instancePixelOffsets; 5047pixelOffset.y *= -1.0; 5048vec2 xy = project_size_to_pixel(instanceClipRect.xy); 5049vec2 wh = project_size_to_pixel(instanceClipRect.zw); 5050if (text.flipY) { 5051xy.y = -xy.y - wh.y; 5052} 5053if (instanceClipRect.z >= 0.0) { 5054dimensions.x = wh.x; 5055pixelOffset.x = xy.x + uv.x * wh.x + mix(-textBackground.padding.x, textBackground.padding.z, uv.x); 5056} 5057if (instanceClipRect.w >= 0.0) { 5058dimensions.y = wh.y; 5059pixelOffset.y = xy.y + uv.y * wh.y + mix(-textBackground.padding.y, textBackground.padding.w, uv.y); 5060} 5061if (textBackground.billboard) { 5062gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position); 5063DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 5064vec3 offset = vec3(pixelOffset, 0.0); 5065DECKGL_FILTER_SIZE(offset, geometry); 5066gl_Position.xy += project_pixel_size_to_clipspace(offset.xy); 5067} else { 5068vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0); 5069if (text.flipY) { 5070offset_common.y *= -1.; 5071} 5072DECKGL_FILTER_SIZE(offset_common, geometry); 5073gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); 5074DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 5075} 5076vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * layer.opacity); 5077DECKGL_FILTER_COLOR(vFillColor, geometry); 5078vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * layer.opacity); 5079DECKGL_FILTER_COLOR(vLineColor, geometry); 5080} 5081`,Pk=`\ 5082#version 300 es 5083#define SHADER_NAME text-background-layer-fragment-shader 5084precision highp float; 5085in vec4 vFillColor; 5086in vec4 vLineColor; 5087in float vLineWidth; 5088in vec2 uv; 5089in vec2 dimensions; 5090out vec4 fragColor; 5091float round_rect(vec2 p, vec2 size, vec4 radii) { 5092vec2 pixelPositionCB = (p - 0.5) * size; 5093vec2 sizeCB = size * 0.5; 5094float maxBorderRadius = min(size.x, size.y) * 0.5; 5095vec4 borderRadius = vec4(min(radii, maxBorderRadius)); 5096borderRadius.xy = 5097(pixelPositionCB.x > 0.0) ? borderRadius.xy : borderRadius.zw; 5098borderRadius.x = (pixelPositionCB.y > 0.0) ? borderRadius.x : borderRadius.y; 5099vec2 q = abs(pixelPositionCB) - sizeCB + borderRadius.x; 5100return -(min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - borderRadius.x); 5101} 5102float rect(vec2 p, vec2 size) { 5103vec2 pixelPosition = p * size; 5104return min(min(pixelPosition.x, size.x - pixelPosition.x), 5105min(pixelPosition.y, size.y - pixelPosition.y)); 5106} 5107vec4 get_stroked_fragColor(float dist) { 5108float isBorder = smoothedge(dist, vLineWidth); 5109return mix(vFillColor, vLineColor, isBorder); 5110} 5111void main(void) { 5112geometry.uv = uv;
5113if (textBackground.borderRadius != vec4(0.0)) { 5114float distToEdge = round_rect(uv, dimensions, textBackground.borderRadius); 5115float shapeAlpha = smoothedge(-distToEdge, 0.0); 5116if (shapeAlpha == 0.0) { 5117discard; 5118} 5119if (textBackground.stroked) { 5120fragColor = get_stroked_fragColor(distToEdge); 5121} else { 5122fragColor = vFillColor; 5123} 5124fragColor.a *= shapeAlpha; 5125} else { 5126if (textBackground.stroked) { 5127float distToEdge = rect(uv, dimensions); 5128fragColor = get_stroked_fragColor(distToEdge); 5129} else { 5130fragColor = vFillColor; 5131} 5132} 5133DECKGL_FILTER_COLOR(fragColor, geometry); 5134} 5135`,PO=`\ 5136struct TextUniforms { 5137 cutoffPixels: vec2<f32>, 5138 align: vec2<i32>, 5139 fontSize: f32, 5140 flipY: f32, 5141}; 5142 5143@group(0) @binding(auto) var<uniform> text: TextUniforms; 5144 5145fn rotate_by_angle(vertex: vec2<f32>, angle: f32) -> vec2<f32> { 5146 let angleRadian = radians(angle); 5147 let cosine = cos(angleRadian); 5148 let sine = sin(angleRadian); 5149 let rotationMatrix = mat2x2<f32>( 5150 vec2<f32>(cosine, -sine), 5151 vec2<f32>(sine, cosine) 5152 ); 5153 return rotationMatrix * vertex; 5154} 5155 5156struct Attributes { 5157 @builtin(instance_index) instanceIndex: u32, 5158 @location(0) positions: vec2<f32>, 5159 @location(1) instancePositions: vec3<f32>, 5160 @location(2) instancePositions64Low: vec3<f32>, 5161 @location(3) instanceSizes: f32, 5162 @location(4) instanceAngles: f32, 5163 @location(5) instanceRects: vec4<f32>, 5164 @location(6) instanceClipRect: vec4<f32>, 5165 @location(7) instancePixelOffsets: vec2<f32>, 5166 @location(8) instanceFillColors: vec4<f32>, 5167 @location(9) instanceLineColors: vec4<f32>, 5168 @location(10) instanceLineWidths: f32, 5169}; 5170 5171struct Varyings { 5172 @builtin(position) position: vec4<f32>, 5173 @location(0) vFillColor: vec4<f32>, 5174 @location(1) vLineColor: vec4<f32>, 5175 @location(2) vLineWidth: f32, 5176 @location(3) uv: vec2<f32>, 5177 @location(4) dimensions: vec2<f32>, 5178 @location(5) pickingColor: vec3<f32>, 5179}; 5180 5181@vertex 5182fn vertexMain(attributes: Attributes) -> Varyings { 5183 geometry.worldPosition = attributes.instancePositions; 5184 geometry.uv = attributes.positions; 5185 geometry.pickingColor = picking_getPickingColorFromIndex(attributes.instanceIndex); 5186 5187 var varyings: Varyings; 5188 varyings.uv = attributes.positions; 5189 varyings.vLineWidth = attributes.instanceLineWidths; 5190 5191 let sizePixels = clamp( 5192 project_unit_size_to_pixel( 5193 attributes.instanceSizes * textBackground.sizeScale, 5194 textBackground.sizeUnits 5195 ), 5196 textBackground.sizeMinPixels, 5197 textBackground.sizeMaxPixels 5198 ); 5199 let instanceScale = sizePixels / text.fontSize; 5200 5201 varyings.dimensions = attributes.instanceRects.zw * instanceScale + 5202 textBackground.padding.xy + textBackground.padding.zw; 5203 5204 var pixelOffset = 5205 (attributes.positions * attributes.instanceRects.zw + attributes.instanceRects.xy) * 5206 instanceScale + 5207 mix(-textBackground.padding.xy, textBackground.padding.zw, attributes.positions); 5208 pixelOffset = rotate_by_angle(pixelOffset, attributes.instanceAngles); 5209 pixelOffset = pixelOffset + attributes.instancePixelOffsets; 5210 pixelOffset.y = pixelOffset.y * -1.0; 5211 5212 var xy = project_size_vec2(attributes.instanceClipRect.xy) * project.scale; 5213 let wh = project_size_vec2(attributes.instanceClipRect.zw) * project.scale; 5214 if (text.flipY > 0.5) { 5215 xy.y = -xy.y - wh.y; 5216 } 5217 if (attributes.instanceClipRect.z >= 0.0) { 5218 varyings.dimensions.x = wh.x; 5219 pixelOffset.x = xy.x + varyings.uv.x * wh.x + mix( 5220 -textBackground.padding.x, 5221 textBackground.padding.z, 5222 varyings.uv.x 5223 ); 5224 } 5225 if (attributes.instanceClipRect.w >= 0.0) { 5226 varyings.dimensions.y = wh.y; 5227 pixelOffset.y = xy.y + varyings.uv.y * wh.y + mix( 5228 -textBackground.padding.y, 5229 textBackground.padding.w, 5230 varyings.uv.y 5231 ); 5232 } 5233 5234 if (textBackground.billboard > 0.5) { 5235 var position = project_position_to_clipspace( 5236 attributes.instancePositions, 5237 attributes.instancePositions64Low, 5238 vec3<f32>(0.0) 5239 ); 5240 let clipOffset = project_pixel_size_to_clipspace(pixelOffset); 5241 position = vec4<f32>( 5242 position.x + clipOffset.x, 5243 position.y + clipOffset.y, 5244 position.z, 5245 position.w 5246 ); 5247 varyings.position = position; 5248 } else { 5249 var offsetCommon = vec3<f32>(project_pixel_size_vec2(pixelOffset), 0.0); 5250 if (text.flipY > 0.5) { 5251 offsetCommon.y = offsetCommon.y * -1.0; 5252 } 5253 varyings.position = project_position_to_clipspace( 5254 attributes.instancePositions, 5255 attributes.instancePositions64Low, 5256 offsetCommon 5257 ); 5258 } 5259 5260 varyings.vFillColor = vec4<f32>( 5261 attributes.instanceFillColors.rgb, 5262 attributes.instanceFillColors.a * layer.opacity 5263 ); 5264 varyings.vLineColor = vec4<f32>( 5265 attributes.instanceLineColors.rgb, 5266 attributes.instanceLineColors.a * layer.opacity 5267 ); 5268 varyings.pickingColor = geometry.pickingColor; 5269 return varyings; 5270} 5271 5272fn round_rect(point: vec2<f32>, size: vec2<f32>, radii: vec4<f32>) -> f32 { 5273 let pixelPosition = (point - 0.5) * size; 5274 let halfSize = size * 0.5; 5275 let maxBorderRadius = min(size.x, size.y) * 0.5; 5276 var borderRadius = min(radii, vec4<f32>(maxBorderRadius)); 5277 5278 borderRadius = select(borderRadius.zwxy, borderRadius, pixelPosition.x > 0.0); 5279 let radius = select(borderRadius.y, borderRadius.x, pixelPosition.y > 0.0);
5280 let q = abs(pixelPosition) - halfSize + radius; 5281 return -(min(max(q.x, q.y), 0.0) + length(max(q, vec2<f32>(0.0))) - radius); 5282} 5283 5284fn rect(point: vec2<f32>, size: vec2<f32>) -> f32 { 5285 let pixelPosition = point * size; 5286 return min( 5287 min(pixelPosition.x, size.x - pixelPosition.x), 5288 min(pixelPosition.y, size.y - pixelPosition.y) 5289 ); 5290} 5291 5292fn get_stroked_frag_color( 5293 distanceToEdge: f32, 5294 lineWidth: f32, 5295 fillColor: vec4<f32>, 5296 lineColor: vec4<f32> 5297) -> vec4<f32> { 5298 let isBorder = smoothedge(distanceToEdge, lineWidth); 5299 return mix(fillColor, lineColor, isBorder); 5300} 5301 5302@fragment 5303fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> { 5304 geometry.uv = varyings.uv; 5305 var fragColor: vec4<f32>; 5306 5307 if (any(textBackground.borderRadius != vec4<f32>(0.0))) { 5308 let distanceToEdge = round_rect( 5309 varyings.uv, 5310 varyings.dimensions, 5311 textBackground.borderRadius 5312 ); 5313 let shapeAlpha = smoothedge(-distanceToEdge, 0.0); 5314 if (shapeAlpha == 0.0) { 5315 discard; 5316 } 5317 if (textBackground.stroked > 0.5) { 5318 fragColor = get_stroked_frag_color( 5319 distanceToEdge, 5320 varyings.vLineWidth, 5321 varyings.vFillColor, 5322 varyings.vLineColor 5323 ); 5324 } else { 5325 fragColor = varyings.vFillColor; 5326 } 5327 fragColor.a = fragColor.a * shapeAlpha; 5328 } else if (textBackground.stroked > 0.5) { 5329 let distanceToEdge = rect(varyings.uv, varyings.dimensions); 5330 fragColor = get_stroked_frag_color( 5331 distanceToEdge, 5332 varyings.vLineWidth, 5333 varyings.vFillColor, 5334 varyings.vLineColor 5335 ); 5336 } else { 5337 fragColor = varyings.vFillColor; 5338 } 5339 5340 if (picking.isActive > 0.5) { 5341 if (!picking_isColorValid(varyings.pickingColor)) { 5342 discard; 5343 } 5344 return vec4<f32>(varyings.pickingColor, 1.0); 5345 } 5346 5347 if (picking.isHighlightActive > 0.5) { 5348 let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 5349 if (picking_isColorZero(abs(varyings.pickingColor - highlightedObjectColor))) { 5350 let highlightAlpha = picking.highlightColor.a; 5351 let blendedAlpha = highlightAlpha + fragColor.a * (1.0 - highlightAlpha); 5352 if (blendedAlpha > 0.0) { 5353 let highlightRatio = highlightAlpha / blendedAlpha; 5354 fragColor = vec4<f32>( 5355 mix(fragColor.rgb, picking.highlightColor.rgb, highlightRatio), 5356 blendedAlpha 5357 ); 5358 } else { 5359 fragColor = vec4<f32>(fragColor.rgb, 0.0); 5360 } 5361 } 5362 } 5363 5364 return deckgl_premultiplied_alpha(fragColor); 5365} 5366`,PN={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,fontSize:1,borderRadius:{type:"object",value:0},padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getClipRect:{type:"accessor",value:[0,0,-1,-1]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}};class PL extends D${getShaders(){return super.getShaders({vs:PI,fs:Pk,source:PO,modules:[wv,bE,Ej,PP,Pf]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,bufferGroup:"text-background-instance-data",accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,bufferGroup:"text-background-instance-data",accessor:"getAngle"},instanceRects:{size:4,bufferGroup:"text-background-instance-data",accessor:"getBoundingRect"},instanceClipRect:{size:4,bufferGroup:"text-background-instance-data",accessor:"getClipRect",defaultValue:[0,0,-1,-1]},instancePixelOffsets:{size:2,transition:!0,bufferGroup:"text-background-instance-data",accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,bufferGroup:"text-background-instance-data",accessor:"getLineWidth",defaultValue:1}})}updateState(t){super.updateState(t);let{changeFlags:r}=t;r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:t}
5366){let{billboard:r,sizeScale:i,sizeUnits:n,sizeMinPixels:a,sizeMaxPixels:o,getLineWidth:s,fontSize:l}=this.props,{padding:u,borderRadius:c}=this.props;u.length<4&&(u=[u[0],u[1],u[0],u[1]]),Array.isArray(c)||(c=[c,c,c,c]);let h=this.state.model,f={billboard:r,stroked:!!s,borderRadius:c,padding:u,sizeUnits:x4[n],sizeScale:i,sizeMinPixels:a,sizeMaxPixels:o},d={fontSize:l,viewport:this.context.viewport};h.shaderInputs.setProps({textBackground:f,text:d}),h.draw(this.context.renderPass)}_getModel(){return new DH.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new DW.Geometry({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array([0,0,1,0,0,1,1,1])}}}),isInstanced:!0})}}PL.defaultProps=PN,PL.layerName="TextBackgroundLayer";let PR={start:1,middle:0,end:-1},PF={top:1,center:0,bottom:-1},PB=[0,0,0,255],Pz={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:PB},getBorderWidth:{type:"accessor",value:0},backgroundBorderRadius:{type:"object",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:PA.characterSet},fontFamily:PA.fontFamily,fontWeight:PA.fontWeight,lineHeight:1,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:PB},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},contentCutoffPixels:{type:"array",value:[0,0]},contentAlignHorizontal:"none",contentAlignVertical:"none",getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:PB},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},getContentBox:{type:"accessor",value:[0,0,-1,-1]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}};class Pj extends Dq{constructor(){super(...arguments),this.getBoundingRect=(t,r)=>{let{size:[i,n]}=this.transformParagraph(t,r),{getTextAnchor:a,getAlignmentBaseline:o}=this.props;return[(PR["function"==typeof a?a(t,r):a]-1)*i/2,(PF["function"==typeof o?o(t,r):o]-1)*n/2,i,n]},this.getIconOffsets=(t,r)=>{let{getTextAnchor:i,getAlignmentBaseline:n}=this.props,{x:a,y:o,rowWidth:s,size:[,l]}=this.transformParagraph(t,r),u=PR["function"==typeof i?i(t,r):i],c=PF["function"==typeof n?n(t,r):n],h=a.length,f=Array(2*h),d=0;for(let t=0;t<h;t++)f[d++]=(u-1)*s[t]/2+a[t],f[d++]=(c-1)*l/2+o[t];return f}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new PM},this.props.maxWidth>0&&xn.once(1,"v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(t){let{props:r,oldProps:i,changeFlags:n}=t;(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||r.lineHeight!==i.lineHeight||r.wordBreak!==i.wordBreak||r.maxWidth!==i.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:t}){return t.object=t.index>=0?this.props.data[t.index]:null,t}_updateFontAtlas(){let{fontSettings:t,fontFamily:r,fontWeight:i,_getFontRenderer:n}=this.props,{fontAtlasManager:a,characterSet:o}=this.state,s={...t,characterSet:o,fontFamily:r,fontWeight:i,_getFontRenderer:n};if(!a.mapping)return a.setProps(s),!0;for(let t in s)if(s[t]!==a.props[t])return a.setProps(s),!0;return!1}_updateText(){let t,{data:r,characterSet:i}=this.props,n=r.attributes?.getText,{getText:a}=this.props,o=r.startIndices,s="auto"===i&&new Set;if(n&&o){let{texts:i,characterCount:l}=function({value:t,length:r,stride:i,offset:n,startIndices:a,characterSet:o}){let s=t.BYTES_PER_ELEMENT,l=i?i/s:1,u=n?n/s:0,c=a[r]||Math.ceil((t.length-u)/l),h=o&&new Set,f=Array(r),d=t;if(l>1||u>0){d=new t.constructor(c);for(let r=0;r<c;r++)d[r]=t[r*l+u]}for(let t=0;t<r;t++){let r=a[t],i=a[t+1]||c,n=d.subarray(r,i);
5366f[t]=String.fromCodePoint.apply(null,n),h&&n.forEach(h.add,h)}if(h)for(let t of h)o.add(String.fromCodePoint(t));return{texts:f,characterCount:c}}({...ArrayBuffer.isView(n)?{value:n}:n,length:r.length,startIndices:o,characterSet:s});t=l,a=(t,{index:r})=>i[r]}else{let{iterable:i,objectInfo:n}=Mw(r);for(let r of(o=[0],t=0,i)){n.index++;let i=Array.from(a(r,n)||"");s&&i.forEach(s.add,s),t+=i.length,o.push(t)}}this.setState({getText:a,startIndices:o,numInstances:t,characterSet:s||i})}transformParagraph(t,r){let{fontAtlasManager:i}=this.state,n=i.mapping,{baselineOffset:a}=i.atlas,{fontSize:o}=i.props,s=this.state.getText,{wordBreak:l,lineHeight:u,maxWidth:c}=this.props;return function(t,r,i,n,a,o){let s=Array.from(t),l=s.length,u=Array(l),c=Array(l),h=Array(l),f=("break-word"===n||"break-all"===n)&&isFinite(a)&&a>0,d=[0,0],p=[0,0],m=0,g=r+i/2,y=0,v=0;for(let t=0;t<=l;t++){let r=s[t];if(("\n"===r||t===l)&&(v=t),v>y){let t=f?function(t,r,i,n,a=0,o){void 0===o&&(o=t.length);let s=[];return"break-all"===r?PE(t,a,o,i,n,s):!function(t,r,i,n,a,o){let s=r,l=r,u=r,c=0;for(let h=r;h<i;h++)if(" "===t[h]?u=h+1:(" "===t[h+1]||h+1===i)&&(u=h+1),u>l){let r=Pw(t,l,u,a);c+r>n&&(s<l&&(o.push(l),s=l,c=0),r>n&&(r=PE(t,l,u,n,a,o),s=o[o.length-1])),l=u,c+=r}}(t,a,o,i,n,s),s}(s,n,a,o,y,v):Px;for(let r=0;r<=t.length;r++){let n=0===r?y:t[r-1],a=r<t.length?t[r]:v;!function(t,r,i,n,a,o){let s=0,l=0;for(let a=r;a<i;a++){let r=n[t[a]];r&&(l=Math.max(l,r.height))}for(let o=r;o<i;o++){let r=t[o],i=n[r];i?(a[o]=s+i.anchorX,s+=i.advance):(xn.warn(`Missing character: ${r} (${r.codePointAt(0)})`)(),a[o]=s,s+=32)}o[0]=s,o[1]=l}(s,n,a,o,u,p);for(let t=n;t<a;t++)c[t]=g,h[t]=p[0];m++,g+=i,d[0]=Math.max(d[0],p[0])}y=v}"\n"===r&&(u[y]=0,c[y]=0,h[y]=0,y++)}return d[1]=m*i,{x:u,y:c,rowWidth:h,size:d}}(s(t,r)||"",a,u*o,l,c*o,n)}renderLayers(){let{startIndices:t,numInstances:r,getText:i,fontAtlasManager:{atlas:n,mapping:a},styleVersion:o}=this.state,{data:s,_dataDiff:l,getPosition:u,getColor:c,getSize:h,getAngle:f,getPixelOffset:d,getBackgroundColor:p,getBorderColor:m,getBorderWidth:g,getContentBox:y,backgroundBorderRadius:v,backgroundPadding:_,background:b,billboard:x,fontSettings:w,outlineWidth:E,outlineColor:T,sizeScale:A,sizeUnits:S,sizeMinPi
vendor: 1,528 bytes, line 5366
5366xels:C,sizeMaxPixels:M,contentCutoffPixels:D,contentAlignHorizontal:P,contentAlignVertical:I,transitions:k,updateTriggers:O}=this.props,N=this.getSubLayerClass("characters",Pg),L=this.getSubLayerClass("background",PL),{fontSize:R}=this.state.fontAtlasManager.props;return[b&&new L({getFillColor:p,getLineColor:m,getLineWidth:g,borderRadius:v,padding:_,getPosition:u,getSize:h,getAngle:f,getPixelOffset:d,getClipRect:y,billboard:x,sizeScale:A,sizeUnits:S,sizeMinPixels:C,sizeMaxPixels:M,fontSize:R,transitions:k&&{getPosition:k.getPosition,getAngle:k.getAngle,getSize:k.getSize,getFillColor:k.getBackgroundColor,getLineColor:k.getBorderColor,getLineWidth:k.getBorderWidth,getPixelOffset:k.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:O.getPosition,getAngle:O.getAngle,getSize:O.getSize,getFillColor:O.getBackgroundColor,getLineColor:O.getBorderColor,getLineWidth:O.getBorderWidth,getPixelOffset:O.getPixelOffset,getBoundingRect:{getText:O.getText,getTextAnchor:O.getTextAnchor,getAlignmentBaseline:O.getAlignmentBaseline,styleVersion:o}}}),{data:s.attributes&&s.attributes.background?{length:s.length,attributes:s.attributes.background}:s,_dataDiff:l,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new N({sdf:w.sdf,smoothing:Number.isFinite(w.smoothing)?w.smoothing:PA.smoothing,outlineWidth:E/(w.radius||PA.radius),outlineColor:T,iconAtlas:n,iconMapping:a,getPosition:u,getColor:c,getSize:h,getAngle:f,getPixelOffset:d,getContentBox:y,billboard:x,sizeScale:A,sizeUnits:S,sizeMinPi
5366xels:C,sizeMaxPixels:M,fontSize:R,contentCutoffPixels:D,contentAlignHorizontal:P,contentAlignVertical:I,transitions:k&&{getPosition:k.getPosition,getAngle:k.getAngle,getColor:k.getColor,getSize:k.getSize,getPixelOffset:k.getPixelOffset,getContentBox:k.getContentBox}},this.getSubLayerProps({id:"characters",updateTriggers:{all:O.getText,getPosition:O.getPosition,getAngle:O.getAngle,getColor:O.getColor,getSize:O.getSize,getPixelOffset:O.getPixelOffset,getContentBox:O.getContentBox,getIconOffsets:{getTextAnchor:O.getTextAnchor,getAlignmentBaseline:O.getAlignmentBaseline,styleVersion:o}}}),{data:s,_dataDiff:l,startIndices:t,numInstances:r,getIconOffsets:this.getIconOffsets,getIcon:i})]}static set fontAtlasCacheLimit(t){xn.assert(Number.isFinite(t)&&t>=3,"Invalid cache limit"),PS=new PT(t)}}Pj.defaultProps=Pz,Pj.layerName="TextLayer";class PU{constructor(t){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;const{attributes:r={}}=t;this.typedArrayManager=Av,this.attributes={},this._attributeDefs=r,this.opts=t,this.updateGeometry(t)}updateGeometry(t){Object.assign(this.opts,t);let{data:r,buffers:i={},getGeometry:n,geometryBuffer:a,positionFormat:o,dataChanged:s,normalize:l=!0}=this.opts;if(this.data=r,this.getGeometry=n,this.positionSize=a&&a.size||("XY"===o?2:3),this.buffers=i,this.normalize=l,a&&(AK(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(a),l||(i.vertexPositions=a)),this.geometryBuffer=i.vertexPositions,Array.isArray(s))for(let t of s)this._rebuildGeometry(t);else this._rebuildGeometry()}updatePartialGeometry({startRow:t,endRow:r}){this._rebuildGeometry({startRow:t,endRow:r})}getGeometryFromBuffer(t){let r=t.value||t;return ArrayBuffer.isView(r)?MT(r,{size:this.positionSize,offset:t.offset,stride:t.stride,startIndices:this.data.startIndices}):null}_allocate(t,r){let{attributes:i,buffers:n,_attributeDefs:a,typedArrayManager:o}=this;for(let s in a)if(s in n)o.release(i[s]),i[s]=null;else{let n=a[s];n.copy=r,i[s]=o.allocate(i[s],t,n)}}_forEachGeometry(t,r,i){let{data:n,getGeometry:a}=this,{iterable:o,objectInfo:s}=Mw(n,r,i);for(let r of o)s.index++,t(a?a(r,s):null,s.index)}_rebuildGeometry(t){if(!this.data)return;let{indexStarts:r,vertexStarts:i,instanceCount:n}=this,{data:a,geometryBuffer:o}=this,{startRow:s=0,endRow:l=1/0}=t||{},u={};if(t||(r=[0],i=[0]),this.normalize||!o)this._forEachGeometry((t,r)=>{let n=t&&this.normalizeGeometry(t);u[r]=n,i[r+1]=i[r]+(n?this.getGeometrySize(n):0)},s,l),n=i[i.length-1];else if(n=(i=a.startIndices)[a.length]||0,ArrayBuffer.isView(o))n=n||o.length/this.positionSize;else if(o instanceof SB.Buffer){let t=4*this.positionSize;n=n||o.byteLength/t}
5366else if(o.buffer){let t=o.stride||4*this.positionSize;n=n||o.buffer.byteLength/t}else if(o.value){let t=o.value,r=o.stride/t.BYTES_PER_ELEMENT||this.positionSize;n=n||t.length/r}this._allocate(n,!!t),this.indexStarts=r,this.vertexStarts=i,this.instanceCount=n;let c={};this._forEachGeometry((t,a)=>{let o=u[a]||t;c.vertexStart=i[a],c.indexStart=r[a],c.geometrySize=(a<i.length-1?i[a+1]:n)-i[a],c.geometryIndex=a,this.updateGeometryAttributes(o,c)},s,l),this.vertexCount=r[r.length-1]}}function PV(t,r,i,n,a=[]){let o,s;if(8&i)o=(n[3]-t[1])/(r[1]-t[1]),s=3;else if(4&i)o=(n[1]-t[1])/(r[1]-t[1]),s=1;else if(2&i)o=(n[2]-t[0])/(r[0]-t[0]),s=2;else{if(!(1&i))return null;o=(n[0]-t[0])/(r[0]-t[0]),s=0}for(let i=0;i<t.length;i++)a[i]=(1&s)===i?n[s]:o*(r[i]-t[i])+t[i];return a}function P$(t,r){let i=0;return t[0]<r[0]?i|=1:t[0]>r[2]&&(i|=2),t[1]<r[1]?i|=4:t[1]>r[3]&&(i|=8),i}function PG(t,r){let i=r.length,n=t.length;if(n>0){let a=!0;for(let o=0;o<i;o++)if(t[n-i+o]!==r[o]){a=!1;break}if(a)return!1}for(let a=0;a<i;a++)t[n+a]=r[a];return!0}function Pq(t,r){let i=r.length;for(let n=0;n<i;n++)t[n]=r[n]}function PH(t,r,i,n,a=[]){let o=n+r*i;for(let r=0;r<i;r++)a[r]=t[o+r];return a}function PW(t,r){let i,n,{size:a=2,broken:o=!1,gridResolution:s=10,gridOffset:l=[0,0],startIndex:u=0,endIndex:c=t.length}=r||{},h=(c-u)/a,f=[],d=[f],p=PH(t,0,a,u),m=PX(p,s,l,[]),g=[];PG(f,p);for(let r=1;r<h;r++){for(n=P$(i=PH(t,r,a,u,i),m);n;){var y,v,_;PV(p,i,n,m,g);let t=P$(g,m);t&&(PV(p,g,t,m,g),n=t),PG(f,g),Pq(p,g),y=m,v=s,8&(_=n)?(y[1]+=v,y[3]+=v):4&_?(y[1]-=v,y[3]-=v):2&_?(y[0]+=v,y[2]+=v):1&_&&(y[0]-=v,y[2]-=v),o&&f.length>a&&(f=[],d.push(f),PG(f,p)),n=P$(i,m)}PG(f,i),Pq(p,i)}return o?d:d[0]}function PZ(t,r=null,i){if(!t.length)return[];let{size:n=2,gridResolution:a=10,gridOffset:o=[0,0],edgeTypes:s=!1}=i||{},l=[],u=[{pos:t,types:s?Array(t.length/n).fill(1):null,holes:r||[]}],c=[[],[]],h=[];for(;u.length;){let{pos:t,types:r,holes:i}=u.shift();(function(t,r,i,n){let a=1/0,o=-1/0,s=1/0,l=-1/0;for(let n=0;n<i;n+=r){let r=t[n],i=t[n+1];a=r<a?r:a,o=r>o?r:o,s=i<s?i:s,l=i>l?i:l}n[0][0]=a,n[0][1]=s,n[1][0]=o,n[1][1]=l})(t,n,i[0]||t.length,c),h=PX(c[0],a,o,h);let f=P$(c[1],h);if(f){let a=PY(t,r,n,0,i[0]||t.length,h,f),o={pos:a[0].pos,types:a[0].types,holes:[]},l={pos:a[1].pos,types:a[1].types,holes:[]};u.push(o,l);for(let u=0;u<i.length;u++)(a=PY(t,r,n,i[u],i[u+1]||t.length,h,f))[0]&&(o.holes.push(o.pos.length),o.pos=PK(o.pos,a[0].pos),s&&(o.types=PK(o.types,a[0].types))),a[1]&&(l.holes.push(l.pos.length),l.pos=PK(l.pos,a[1].pos),s&&(l.types=PK(l.types,a[1].types)))}else{let n={positions:t};s&&(n.edgeTypes=r),i.length&&(n.holeIndices=i),l.push(n)}}return l}function PY(t,r,i,n,a,o,s){let l,u,c,h=(a-n)/i,f=[],d=[],p=[],m=[],g=[],y=PH(t,h-1,i,n),v=Math.sign(8&s?y[1]-o[3]:y[0]-o[2]),_=r&&r[h-1],b=0,x=0;for(let a=0;a<h;a++)l=PH(t,a,i,n,l),u=Math.sign(8&s?l[1]-o[3]:l[0]-o[2]),c=r&&r[n/i+a],u&&v&&v!==u&&(PV(y,l,s,o,g),PG(f,g)&&p.push(_),PG(d,g)&&m.push(_)),u<=0?(PG(f,l)&&p.push(c),b-=u):p.length&&(p[p.length-1]=0),u>=0?(PG(d,l)&&m.push(c),x+=u):m.length&&(m[m.length-1]=0),Pq(y,l),v=u,_=c;return[b?{pos:f,types:r&&p}:null,x?{pos:d,types:r&&m}:null]}function PX(t,r,i,n){let a=Math.floor((t[0]-i[0])/r)*r+i[0],o=Math.floor((t[1]-i[1])/r)*r+i[1];return n[0]=a,n[1]=o,n[2]=a+r,n[3]=o+r,n}function PK(t,r){for(let i=0;i<r.length;i++)t.push(r[i]);return t}function PQ(t,r,i,n){let a,o=t[0];for(let s=i;s<n;s+=r){let r=(a=t[s])-o;(r>180||r<-180)&&(a-=360*Math.round(r/360)),t[s]=o=a}}function PJ(t,r){let i,n=t.length/r;for(let a=0;a<n&&((i=t[a*r])+180)%360==0;a++);let a=-(360*Math.round(i/360));if(0!==a)for(let i=0;i<n;i++)t[i*r]+=a}class P0 extends PU{constructor(t){super({...t,attributes:{positions:{size:3,padding:18,initialize:!0,type:t.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:t.isWebGPU?Float32Array:Uint8ClampedArray}}})}get(t){return this.attributes[t]}getPathSegmentIndices(t){let r=this.attributes.segmentTypes,i=this.vertexStarts[t],n=Math.min(this.vertexStarts[t+1]??this.instanceCount,this.instanceCount),a=[];for(let t=i;t<n-1;t++)(4&r[t])==0&&a.push(t);return a.length&&(4&r[i])!=0&&a.unshift(a.pop()),a}getGeometryFromBuffer(t){return this.normalize||this.opts.isWebGPU?super.getGeometryFromBuffer(t):null}normalizeGeometry(t){return this.normalize?function(t,r,i,n){let a;if(Array.isArray(t[0])){a=Array(t.length*r);for(let i=0;i<t.length;i++)for(let n=0;n<r;n++)a[i*r+n]=t[i][n]||0}else a=t;return i?PW(a,{size:r,gridResolution:i}):n?function(t,r){let{size:i=2,startIndex:n=0,endIndex:a=t.length,normalize:o=!0}=r||{},s=t.slice(n,a);PQ(s,i,0,a-n);let l=PW(s,{size:i,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(o)for(let t of l)PJ(t,i);return l}(a,{size:r}):a}(t,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):t}getGeometrySize(t){if(P1(t)){let r=0;for(let i of t)r+=this.getGeometrySize(i);return r}let r=this.getPathLength(t);return r<2?0:this.isClosed(t)?r<3?0:r+2:r}updateGeometryAttributes(t,r){if(0!==r.geometrySize)if(t&&P1(t))for(let i of t){let t=this.getGeometrySize(i);r.geometrySize=t,this.updateGeometryAttributes(i,r),r.vertexStart+=t}else this._updateSegmentTypes(t,r),this._updatePositions(t,r)}_updateSegmentTypes(t,r){let i=this.attributes.segmentTypes,n=!!t&&this.isClosed(t),{vertexStart:a,geometrySize:o}=r;i.fill(0,a,a+o),n?(i[a]=4,i[a+o-2]=4):(i[a]+=1,i[a+o-2]+=2),i[a+o-1]=4}_updatePositions(t,r){let{positions:i}=this.attributes;if(!i||!t)return;let{vertexStart:n,geometrySize:a}=r,o=[,,,];for(let r=n,s=0;s<a;r++,s++)this.getPointOnPath(t,s,o),i[3*r]=o[0],i[3*r+1]=o[1],i[3*r+2]=o[2]}getPathLength(t){return t.length/this.positionSize}getPointOnPath(t,r,i=[]){let{positionSize:n}=this;r*n>=t.length&&(r+=1-t.length/n);let a=r*n;return i[0]=t[a],i[1]=t[a+1],i[2]=3===n&&t[a+2]||0,i}isClosed(t){if(!this.normalize)return!!this.opts.loop;let{positionSize:r}=this,i=t.length-r;return t[0]===t[i]&&t[1]===t[i+1]&&(2===r||t[2]===t[i+2])}}function P1(t){return Array.isArray(t[0])}let P2=`\ 5367layout(std140) uniform pathUniforms { 5368 float widthScale; 5369 float widthMinPixels; 5370 float widthMaxPixels; 5371 float jointType; 5372 float capType; 5373 float miterLimit; 5374 bool billboard; 5375 highp int widthUnits; 5376} path; 5377`,P3={name:"path",source:`\ 5378struct PathUniforms { 5379 widthScale: f32, 5380 widthMinPixels: f32, 5381 widthMaxPixels: f32, 5382 jointType: f32, 5383 capType: f32, 5384 miterLimit: f32, 5385 billboard: f32, 5386 widthUnits: i32, 5387}; 5388 5389@group(0) @binding(auto) 5390var<uniform> path: PathUniforms; 5391`,vs:P2,fs:P2,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",jointType:"f32",capType:"f32",miterLimit:"f32",billboard:"f32",widthUnits:"i32"}},P4=`\ 5392const EPSILON: f32 = 0.001; 5393const ZERO_OFFSET: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0); 5394 5395struct JoinResult { 5396 offset: vec3<f32>, 5397 cornerOffset: vec2<f32>, 5398 miterLength: f32, 5399 pathPosition: vec2<f32>, 5400 pathLength: f32, 5401 jointType: f32, 5402}; 5403 5404struct Attributes { 5405 @location(0) positions: vec2<f32>, 5406 @location(1) instanceTypes: f32, 5407 @location(2) instanceLeftPositions: vec3<f32>, 5408 @location(3) instanceStartPositions: vec3<f32>, 5409 @location(4) instanceEndPositions: vec3<f32>, 5410 @location(5) instanceRightPositions: vec3<f32>, 5411 @location(6) instanceLeftPositions64Low: vec3<f32>, 5412 @location(7) instanceStartPositions64Low: vec3<f32>, 5413 @location(8) instanceEndPositions64Low: vec3<f32>, 5414 @location(9) instanceRightPositions64Low: vec3<f32>, 5415 @location(10) instanceStrokeWidths: f32, 5416 @location(11) instanceColors: vec4<f32>, 5417 @location(12) rowIndexes: u32, 5418}; 5419
5420struct Varyings { 5421 @builtin(position) position: vec4<f32>, 5422 @location(0) vColor: vec4<f32>, 5423 @location(1) vCornerOffset: vec2<f32>, 5424 @location(2) vMiterLength: f32, 5425 @location(3) vPathPosition: vec2<f32>, 5426 @location(4) vPathLength: f32, 5427 @location(5) vJointType: f32, 5428 // Location 6 is reserved for TripsLayer's injected vTime varying. 5429 @location(7) clipCoordinates: vec2<f32>, 5430#ifdef DASH_ENABLED 5431 @location(8) vPathBounds: vec2<f32>, 5432#endif 5433}; 5434 5435fn flipIfTrue(flag: bool) -> f32 { 5436 return select(1.0, -1.0, flag); 5437} 5438 5439fn clipLine(position: vec4<f32>, refPosition: vec4<f32>) -> vec4<f32> { 5440 if (position.w < EPSILON) { 5441 let r = (EPSILON - refPosition.w) / (position.w - refPosition.w); 5442 return refPosition + (position - refPosition) * r; 5443 } 5444 return position; 5445} 5446 5447#ifdef DASH_ENABLED 5448// Return the visible interval of the original segment before clipLine moves either endpoint. 5449fn getClippedPathRange(startW: f32, endW: f32) -> vec2<f32> { 5450 let startClipped = startW < EPSILON; 5451 let endClipped = endW < EPSILON; 5452 if (startClipped && endClipped) { 5453 return vec2<f32>(0.0, 0.0); 5454 } 5455 if (startClipped || endClipped) { 5456 let intersection = clamp((EPSILON - startW) / (endW - startW), 0.0, 1.0); 5457 if (startClipped) { 5458 return vec2<f32>(intersection, 1.0); 5459 } 5460 return vec2<f32>(0.0, intersection); 5461 } 5462 return vec2<f32>(0.0, 1.0); 5463} 5464#endif 5465 5466fn getLineJoinOffset( 5467 prevPoint: vec3<f32>, 5468 currPoint: vec3<f32>, 5469 nextPoint: vec3<f32>, 5470 width: vec2<f32>, 5471#ifdef DASH_ENABLED 5472 sourcePathLength: f32, 5473 sourcePathRange: vec2<f32>, 5474#endif 5475#ifdef ANTIALIASING 5476 coverageScale: f32, 5477#endif 5478 positions: vec2<f32>, 5479 instanceTypes: f32 5480) -> JoinResult { 5481 let isEnd = positions.x > 0.0; 5482 let sideOfPath = positions.y; 5483 let isJoint = select(0.0, 1.0, sideOfPath == 0.0); 5484 5485 var deltaA3 = currPoint - prevPoint; 5486 var deltaB3 = nextPoint - currPoint; 5487 5488 let rotationResult = project_needs_rotation(currPoint); 5489 if (path.billboard == 0.0 && rotationResult.needsRotation) { 5490 deltaA3 = rotationResult.transform * deltaA3; 5491 deltaB3 = rotationResult.transform * deltaB3; 5492 } 5493 5494 let deltaA = deltaA3.xy / width; 5495 let deltaB = deltaB3.xy / width; 5496 5497 let lenA = length(deltaA); 5498 let lenB = length(deltaB); 5499 5500 let dirA = select(vec2<f32>(0.0, 0.0), normalize(deltaA), lenA > 0.0); 5501 let dirB = select(vec2<f32>(0.0, 0.0), normalize(deltaB), lenB > 0.0); 5502 5503 let perpA = vec2<f32>(-dirA.y, dirA.x); 5504 let perpB = vec2<f32>(-dirB.y, dirB.x); 5505 5506 var tangent = dirA + dirB; 5507 tangent = select(perpA, normalize(tangent), length(tangent) > 0.0); 5508 let miterVec = vec2<f32>(-tangent.y, tangent.x); 5509 let dir = select(dirB, dirA, isEnd); 5510 let perp = select(perpB, perpA, isEnd); 5511#ifdef DASH_ENABLED 5512 let segmentLength2D = select(lenB, lenA, isEnd); 5513 5514 // Extrusion happens in the XY plane, so segmentLength2D is a 2D length and pathPosition.y 5515 // below measures 2D distance along the segment. For a path that also moves in Z the true 5516 // arc length is longer by this ratio. Scaling pathLength and pathPosition.y by it makes 5517 // the coordinate measure real 3D distance while leaving the joint tests unchanged, since 5518 // they compare the two against each other and both are scaled alike. Billboard mode 5519 // extrudes in clip space, where the perspective divide has already reduced the segment to 5520 // its screen projection, so its complete common-space length is supplied by the caller. 5521 // Mirrors path-layer-vertex.glsl.ts. 5522 let currDelta3 = select(deltaB3, deltaA3, isEnd); 5523 let currLength2D = length(currDelta3.xy); 5524 // Do not clamp a valid denominator to EPSILON: high-zoom Web Mercator deltas are often 5525 // smaller than that in common space, and changing their scale corrupts even flat paths. 5526 let safeLength2D = select(1.0, currLength2D, currLength2D > 0.0); 5527 var arcLengthRatio = 1.0; 5528 var pathPositionOffset = 0.0; 5529 var pathLength = segmentLength2D; 5530 if (path.billboard != 0.0) { 5531 // clipLine may shorten the visible screen-space segment. Preserve the corresponding interval 5532 // of the complete common-space arclength instead of compressing the full dash period into the 5533 // visible span. Keep pathLength complete so justification is stable as the camera clips it. 5534 let visiblePathLength = sourcePathLength * (sourcePathRange.y - sourcePathRange.x); 5535 arcLengthRatio = 0.0; 5536 if (segmentLength2D > 0.0) { 5537 arcLengthRatio = visiblePathLength / segmentLength2D; 5538 } 5539 pathPositionOffset = sourcePathLength * sourcePathRange.x; 5540 pathLength = sourcePathLength; 5541 } else if (currLength2D > 0.0) { 5542 arcLengthRatio = length(currDelta3) / safeLength2D; 5543 pathLength = segmentLength2D * arcLengthRatio; 5544 } 5545#else 5546 let pathLength = select(lenB, lenA, isEnd); 5547#endif 5548 5549 let sinHalfA = abs(dot(miterVec, perp)); 5550 let cosHalfA = abs(dot(dirA, miterVec)); 5551 let turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x); 5552 let cornerPosition = sideOfPath * turnDirection; 5553 5554 var miterSize = 1.0 / max(sinHalfA, EPSILON); 5555 miterSize = mix( 5556 min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)), 5557 miterSize, 5558 step(0.0, cornerPosition) 5559 ); 5560 5561 var offsetVec = 5562 mix(miterVec * miterSize, perp, step(0.5, cornerPosition)) * 5563 (sideOfPath + isJoint * turnDirection); 5564 5565 let isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0)); 5566 let isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0)); 5567 let isCap = isStartCap || isEndCap; 5568 5569 var jointType = path.jointType; 5570 if (isCap) { 5571 offsetVec = mix( 5572 perp * sideOfPath, 5573 dir * path.capType * 4.0 * flipIfTrue(isStartCap), 5574 isJoint 5575 ); 5576 jointType = path.capType; 5577 } 5578 5579#ifdef ANTIALIASING 5580 let coverageOffsetVec = offsetVec * coverageScale; 5581 var miterLength = dot(coverageOffsetVec, miterVec * turnDirection); 5582#else 5583 var miterLength = dot(offsetVec, miterVec * turnDirection); 5584#endif 5585 miterLength = select(miterLength, isJoint, isCap); 5586 5587#ifdef ANTIALIASING 5588 let offsetFromStartOfPath = coverageOffsetVec + deltaA * select(0.0, 1.0, isEnd); 5589#else 5590 let offsetFromStartOfPath = offsetVec + deltaA * select(0.0, 1.0, isEnd); 5591#endif 5592 let pathPosition = vec2<f32>( 5593 dot(offsetFromStartOfPath, perp), 5594#ifdef DASH_ENABLED 5595 pathPositionOffset + dot(offsetFromStartOfPath, dir) * arcLengthRatio 5596#else 5597 dot(offsetFromStartOfPath, dir) 5598#endif 5599 ); 5600 let isValid = step(f32(instanceTypes), 3.5); 5601#ifdef ANTIALIASING 5602 var offset = vec3<f32>(coverageOffsetVec * width * isValid, 0.0); 5603#else 5604 var offset = vec3<f32>(offsetVec * width * isValid, 0.0); 5605#endif 5606 5607 if (path.billboard == 0.0 && rotationResult.needsRotation) { 5608 offset = rotationResult.transform * offset; 5609 } 5610 5611#ifdef ANTIALIASING 5612 return JoinResult( 5613 offset, coverageOffsetVec, miterLength, pathPosition, pathLength, jointType 5614 ); 5615#else 5616 return JoinResult(offset, offsetVec, miterLength, pathPosition, pathLength, jointType); 5617#endif 5618} 5619 5620@vertex 5621fn vertexMain(attributes: Attributes) -> Varyings { 5622 var varyings: Varyings; 5623 5624 geometry.pickingColor = picking_getPickingColorFromIndex(attributes.rowIndexes); 5625 5626 let isEnd = attributes.positions.x; 5627 5628 let prevPosition = mix(attributes.instanceLeftPositions, attributes.instanceStartPositions, isEnd); 5629 let prevPosition64Low = mix( 5630 attributes.instanceLeftPositions64Low, 5631 attributes.instanceStartPositions64Low, 5632 isEnd 5633 ); 5634 let currPosition = mix(attributes.instanceStartPositions, attributes.instanceEndPositions, isEnd); 5635 let currPosition64Low = mix( 5636 attributes.instanceStartPositions64Low, 5637 attributes.instanceEndPositions64Low, 5638 isEnd 5639 ); 5640 let nextPosition = mix(attributes.instanceEndPositions, attributes.instanceRightPositions, isEnd); 5641 let nextPosition64Low = mix( 5642 attributes.instanceEndPositions64Low, 5643 attributes.instanceRightPositions64Low, 5644 isEnd 5645 ); 5646 5647 geometry.worldPosition = currPosition; 5648 5649 let widthPixels = 5650 clamp( 5651 project_unit_size_to_pixel(attributes.instanceStrokeWidths * path.widthScale, path.widthUnits), 5652 path.widthMinPixels, 5653 path.widthMaxPixels 5654 ) / 2.0; 5655 5656 if (path.billboard != 0.0) { 5657#ifdef DASH_ENABLED 5658 let prevProjection = project_position_to_clipspace_and_commonspace( 5659 prevPosition, prevPosition64Low, ZERO_OFFSET 5660 ); 5661 let nextProjection = project_position_to_clipspace_and_commonspace( 5662 nextPosition, nextPosition64Low, ZERO_OFFSET 5663 ); 5664 let prevPositionCommon = prevProjection.commonPosition.xyz; 5665 let nextPositionCommon = nextProjection.commonPosition.xyz; 5666 var prevPositionScreen = prevProjection.clipPosition; 5667 var nextPositionScreen = nextProjection.clipPosition; 5668#else 5669 var prevPositionScreen = project_position_to_clipspace( 5670 prevPosition, prevPosition64Low, ZERO_OFFSET 5671 ); 5672 var nextPositionScreen = project_position_to_clipspace( 5673 nextPosition, nextPosition64Low, ZERO_OFFSET 5674 ); 5675#endif
5676 let currProjection = project_position_to_clipspace_and_commonspace( 5677 currPosition, currPosition64Low, ZERO_OFFSET 5678 ); 5679 geometry.position = currProjection.commonPosition; 5680 var currPositionScreen = currProjection.clipPosition; 5681#ifdef DASH_ENABLED 5682 let currPositionCommon = currProjection.commonPosition.xyz; 5683 let sourcePathStartScreen = mix(currPositionScreen, prevPositionScreen, isEnd); 5684 let sourcePathEndScreen = mix(nextPositionScreen, currPositionScreen, isEnd); 5685 let billboardPathRange = getClippedPathRange( 5686 sourcePathStartScreen.w, sourcePathEndScreen.w 5687 ); 5688#endif 5689 5690 prevPositionScreen = clipLine(prevPositionScreen, currPositionScreen); 5691 nextPositionScreen = clipLine(nextPositionScreen, currPositionScreen); 5692 currPositionScreen = clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd)); 5693 5694#ifdef ANTIALIASING 5695 let coverageScale = select( 5696 1.0, 5697 (widthPixels + 0.5 / project.devicePixelRatio) / max(widthPixels, 1e-6), 5698 widthPixels > 0.0 5699 ); 5700#endif 5701#ifdef DASH_ENABLED 5702 let currentDeltaCommon = select( 5703 nextPositionCommon - currPositionCommon, 5704 currPositionCommon - prevPositionCommon, 5705 isEnd > 0.0 5706 ); 5707 let billboardPathLength = select( 5708 0.0, 5709 length(currentDeltaCommon) * project.scale / (widthPixels * project.focalDistance), 5710 widthPixels > 0.0 5711 ); 5712#endif 5713 let join = getLineJoinOffset( 5714 prevPositionScreen.xyz / prevPositionScreen.w, 5715 currPositionScreen.xyz / currPositionScreen.w, 5716 nextPositionScreen.xyz / nextPositionScreen.w, 5717 project_pixel_size_to_clipspace(vec2<f32>(widthPixels, widthPixels)), 5718#ifdef DASH_ENABLED 5719 billboardPathLength, 5720 billboardPathRange, 5721#endif 5722#ifdef ANTIALIASING 5723 coverageScale, 5724#endif 5725 attributes.positions, 5726 attributes.instanceTypes 5727 ); 5728#ifdef DASH_ENABLED 5729 // Phase and justification use the complete source segment, while cap and joint coverage 5730 // must still recognize the endpoints moved by clipLine. 5731 varyings.vPathBounds = billboardPathLength * billboardPathRange; 5732#endif 5733 5734 geometry.uv = join.pathPosition; 5735 varyings.position = vec4<f32>( 5736 currPositionScreen.xyz + join.offset * currPositionScreen.w, 5737 currPositionScreen.w 5738 ); 5739 varyings.vCornerOffset = join.cornerOffset; 5740 varyings.vMiterLength = join.miterLength; 5741 varyings.vPathPosition = join.pathPosition; 5742 varyings.vPathLength = join.pathLength; 5743 varyings.vJointType = join.jointType; 5744 } else { 5745 let prevPositionCommon = project_position_vec3_f64(prevPosition, prevPosition64Low); 5746 let currPositionCommon = project_position_vec3_f64(currPosition, currPosition64Low); 5747 let nextPositionCommon = project_position_vec3_f64(nextPosition, nextPosition64Low); 5748 5749 let width = vec2<f32>( 5750 project_pixel_size_float(widthPixels), 5751 project_pixel_size_float(widthPixels) 5752 ); 5753#ifdef ANTIALIASING 5754 let coverageScale = select( 5755 1.0, 5756 (widthPixels + 0.5 / project.devicePixelRatio) / max(widthPixels, 1e-6), 5757 widthPixels > 0.0 5758 ); 5759#endif 5760 let join = getLineJoinOffset( 5761 prevPositionCommon, 5762 currPositionCommon, 5763 nextPositionCommon, 5764 width, 5765#ifdef DASH_ENABLED 5766 1.0, 5767 vec2<f32>(0.0, 1.0), 5768#endif 5769#ifdef ANTIALIASING 5770 coverageScale, 5771#endif 5772 attributes.positions, 5773 attributes.instanceTypes 5774 ); 5775#ifdef DASH_ENABLED 5776 varyings.vPathBounds = vec2<f32>(0.0, join.pathLength); 5777#endif 5778 5779 geometry.position = vec4<f32>(currPositionCommon + join.offset, 1.0); 5780 geometry.uv = join.pathPosition; 5781 varyings.position = project_common_position_to_clipspace(geometry.position); 5782 varyings.vCornerOffset = join.cornerOffset; 5783 varyings.vMiterLength = join.miterLength; 5784 varyings.vPathPosition = join.pathPosition; 5785 varyings.vPathLength = join.pathLength; 5786 varyings.vJointType = join.jointType; 5787 } 5788 5789 varyings.clipCoordinates = geometry.position.xy; 5790 clip_filterPosition(&varyings.position, geometry.worldPosition.xy); 5791 5792 varyings.vColor = vec4<f32>( 5793 attributes.instanceColors.rgb, 5794 attributes.instanceColors.a * layer.opacity 5795 ); 5796 return varyings; 5797} 5798 5799@fragment 5800fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> { 5801 geometry.uv = varyings.vPathPosition; 5802 5803#ifdef ANTIALIASING 5804 // Coordinates of the outer silhouette, in units of half-width: rounded joints and caps are 5805 // bounded by the corner offset, everywhere else by the edge of the stroke. Dividing by the 5806 // screen-space derivative converts the distance to the boundary into device pixels, which stays 5807 // correct under perspective foreshortening and under extensions that rescale the stroke. 5808#ifdef DASH_ENABLED 5809 let isCorner = 5810 varyings.vPathPosition.y < varyings.vPathBounds.x || 5811 varyings.vPathPosition.y > varyings.vPathBounds.y; 5812#else 5813 let isCorner = varyings.vPathPosition.y < 0.0 || varyings.vPathPosition.y > varyings.vPathLength; 5814#endif 5815 let isRound = varyings.vJointType > 0.5; 5816 5817 // Distance to the silhouette in device pixels, from the derivative of the coordinate that 5818 // bounds it. Computed before the discards below: derivatives need uniform control flow and are 5819 // undefined after a discard in the quad. See dev-docs/RFCs/v9.4/analytic-antialiasing-rfc.md 5820 let bodyCoord = abs(varyings.vPathPosition.x); 5821 let cornerCoord = length(varyings.vCornerOffset); 5822 // Both evaluated so each derivative stays on one field across the corner/body boundary 5823 let bodyPixels = (1.0 - bodyCoord) / max(fwidth(bodyCoord), 1e-6); 5824 let cornerPixels = (1.0 - cornerCoord) / max(fwidth(cornerCoord), 1e-6); 5825#ifdef PATH_STYLE_OFFSET 5826 // Rounded corners still intersect the stroke-width envelope. Extensions may remap
5827 // vPathPosition.x independently of vCornerOffset, as PathStyleExtension does for offsets. 5828 let edgePixels = select(bodyPixels, min(cornerPixels, bodyPixels), isRound && isCorner); 5829#else 5830 let edgePixels = select(bodyPixels, cornerPixels, isRound && isCorner); 5831#endif 5832 5833 // Fragments outside the coverage ramp must not write depth or picking colors. 5834 if (edgePixels <= -SMOOTH_EDGE_RADIUS) { 5835 discard; 5836 } 5837 5838 if (isCorner) { 5839 if (!isRound && varyings.vMiterLength > path.miterLimit + 1.0) { 5840 discard; 5841 } 5842 } 5843 5844 var color = varyings.vColor; 5845 5846 // Feather one device pixel across the width only, before premultiplication. edgePixels is a 5847 // signed device-pixel distance and SMOOTH_EDGE_RADIUS is 0.5, so this ramps across one pixel. 5848 color.a *= smoothedge(0.0, edgePixels); 5849#else 5850#ifdef DASH_ENABLED 5851 if ( 5852 varyings.vPathPosition.y < varyings.vPathBounds.x || 5853 varyings.vPathPosition.y > varyings.vPathBounds.y 5854 ) { 5855#else 5856 if ( 5857 varyings.vPathPosition.y < 0.0 || 5858 varyings.vPathPosition.y > varyings.vPathLength 5859 ) { 5860#endif 5861 if (varyings.vJointType > 0.5 && length(varyings.vCornerOffset) > 1.0) { 5862 discard; 5863 } 5864 if ( 5865 varyings.vJointType < 0.5 && 5866 varyings.vMiterLength > path.miterLimit + 1.0 5867 ) { 5868 discard; 5869 } 5870 } 5871#endif 5872 5873 // Fragment-layer injections that discard pixels must run after analytic coverage derivatives. 5874 // See TripsLayer, which rejects fragments outside of the active time window at this anchor. 5875 // DECKGL_FILTER_COLOR 5876 clip_filterColor(varyings.clipCoordinates); 5877#ifdef ANTIALIASING 5878 return deckgl_premultiplied_alpha(color); 5879#else 5880 return deckgl_premultiplied_alpha(varyings.vColor); 5881#endif 5882} 5883`,P6=`\ 5884#version 300 es 5885#define SHADER_NAME path-layer-vertex-shader 5886in vec2 positions; 5887in float instanceTypes; 5888in vec3 instanceStartPositions; 5889in vec3 instanceEndPositions; 5890in vec3 instanceLeftPositions; 5891in vec3 instanceRightPositions; 5892in vec3 instanceLeftPositions64Low; 5893in vec3 instanceStartPositions64Low; 5894in vec3 instanceEndPositions64Low; 5895in vec3 instanceRightPositions64Low; 5896in float instanceStrokeWidths; 5897in vec4 instanceColors; 5898in float rowIndexes; 5899uniform float opacity; 5900out vec4 vColor; 5901out vec2 vCornerOffset; 5902out float vMiterLength; 5903out vec2 vPathPosition; 5904out float vPathLength; 5905out float vJointType; 5906#ifdef DASH_ENABLED 5907out vec2 vPathBounds; 5908#endif 5909const float EPSILON = 0.001; 5910const vec3 ZERO_OFFSET = vec3(0.0); 5911float flipIfTrue(bool flag) { 5912return -(float(flag) * 2. - 1.); 5913} 5914vec3 getLineJoinOffset( 5915vec3 prevPoint, vec3 currPoint, vec3 nextPoint, 5916vec2 width 5917#ifdef DASH_ENABLED 5918, float sourcePathLength, vec2 sourcePathRange 5919#endif 5920#ifdef ANTIALIASING 5921, float coverageScale 5922#endif 5923) { 5924bool isEnd = positions.x > 0.0; 5925float sideOfPath = positions.y; 5926float isJoint = float(sideOfPath == 0.0); 5927vec3 deltaA3 = (currPoint - prevPoint); 5928vec3 deltaB3 = (nextPoint - currPoint); 5929mat3 rotationMatrix; 5930bool needsRotation = !path.billboard && project_needs_rotation(currPoint, rotationMatrix); 5931if (needsRotation) { 5932deltaA3 = deltaA3 * rotationMatrix; 5933deltaB3 = deltaB3 * rotationMatrix; 5934} 5935vec2 deltaA = deltaA3.xy / width; 5936vec2 deltaB = deltaB3.xy / width; 5937float lenA = length(deltaA); 5938float lenB = length(deltaB); 5939vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0); 5940vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0); 5941vec2 perpA = vec2(-dirA.y, dirA.x); 5942vec2 perpB = vec2(-dirB.y, dirB.x); 5943vec2 tangent = dirA + dirB; 5944tangent = length(tangent) > 0. ? normalize(tangent) : perpA; 5945vec2 miterVec = vec2(-tangent.y, tangent.x); 5946vec2 dir = isEnd ? dirA : dirB; 5947vec2 perp = isEnd ? perpA : perpB; 5948float L = isEnd ? lenA : lenB; 5949#ifdef DASH_ENABLED 5950vec3 currDelta3 = isEnd ? deltaA3 : deltaB3; 5951float currLength2D = length(currDelta3.xy); 5952float arcLengthRatio = 1.0; 5953float pathPositionOffset = 0.0; 5954float pathLength = L; 5955if (path.billboard) { 5956float visiblePathLength = sourcePathLength * (sourcePathRange.y - sourcePathRange.x); 5957arcLengthRatio = L > 0.0 ? visiblePathLength / L : 0.0; 5958pathPositionOffset = sourcePathLength * sourcePathRange.x; 5959pathLength = sourcePathLength; 5960} else if (currLength2D > 0.0) { 5961arcLengthRatio = length(currDelta3) / currLength2D; 5962pathLength = L * arcLengthRatio; 5963} 5964#endif 5965float sinHalfA = abs(dot(miterVec, perp));
5966float cosHalfA = abs(dot(dirA, miterVec)); 5967float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x); 5968float cornerPosition = sideOfPath * turnDirection; 5969float miterSize = 1.0 / max(sinHalfA, EPSILON); 5970miterSize = mix( 5971min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)), 5972miterSize, 5973step(0.0, cornerPosition) 5974); 5975vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition)) 5976* (sideOfPath + isJoint * turnDirection); 5977bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0)); 5978bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0)); 5979bool isCap = isStartCap || isEndCap; 5980if (isCap) { 5981offsetVec = mix(perp * sideOfPath, dir * path.capType * 4.0 * flipIfTrue(isStartCap), isJoint); 5982vJointType = path.capType; 5983} else { 5984vJointType = path.jointType; 5985} 5986#ifdef ANTIALIASING 5987vec2 coverageOffsetVec = offsetVec * coverageScale; 5988#ifdef DASH_ENABLED 5989vPathLength = pathLength; 5990#else 5991vPathLength = L; 5992#endif 5993vCornerOffset = coverageOffsetVec; 5994vMiterLength = dot(vCornerOffset, miterVec * turnDirection); 5995vMiterLength = isCap ? isJoint : vMiterLength; 5996vec2 offsetFromStartOfPath = coverageOffsetVec + deltaA * float(isEnd); 5997vPathPosition = vec2( 5998dot(offsetFromStartOfPath, perp), 5999#ifdef DASH_ENABLED 6000pathPositionOffset + dot(offsetFromStartOfPath, dir) * arcLengthRatio 6001#else 6002dot(offsetFromStartOfPath, dir) 6003#endif 6004); 6005geometry.uv = vPathPosition; 6006float isValid = step(instanceTypes, 3.5); 6007vec3 offset = vec3(coverageOffsetVec * width * isValid, 0.0); 6008#else 6009#ifdef DASH_ENABLED 6010vPathLength = pathLength; 6011#else 6012vPathLength = L; 6013#endif 6014vCornerOffset = offsetVec; 6015vMiterLength = dot(vCornerOffset, miterVec * turnDirection); 6016vMiterLength = isCap ? isJoint : vMiterLength; 6017vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd); 6018vPathPosition = vec2( 6019dot(offsetFromStartOfPath, perp), 6020#ifdef DASH_ENABLED 6021pathPositionOffset + dot(offsetFromStartOfPath, dir) * arcLengthRatio 6022#else 6023dot(offsetFromStartOfPath, dir) 6024#endif 6025); 6026geometry.uv = vPathPosition; 6027float isValid = step(instanceTypes, 3.5); 6028vec3 offset = vec3(offsetVec * width * isValid, 0.0); 6029#endif 6030if (needsRotation) { 6031offset = rotationMatrix * offset; 6032} 6033return offset; 6034} 6035void clipLine(inout vec4 position, vec4 refPosition) { 6036if (position.w < EPSILON) { 6037float r = (EPSILON - refPosition.w) / (position.w - refPosition.w); 6038position = refPosition + (position - refPosition) * r; 6039} 6040} 6041#ifdef DASH_ENABLED 6042vec2 getClippedPathRange(float startW, float endW) { 6043bool startClipped = startW < EPSILON; 6044bool endClipped = endW < EPSILON; 6045if (startClipped && endClipped) { 6046return vec2(0.0); 6047} 6048if (startClipped || endClipped) { 6049float intersection = clamp((EPSILON - startW) / (endW - startW), 0.0, 1.0); 6050return startClipped ? vec2(intersection, 1.0) : vec2(0.0, intersection); 6051} 6052return vec2(0.0, 1.0); 6053} 6054#endif 6055void main() { 6056geometry.pickingColor = picking_getPickingColorFromIndex(rowIndexes); 6057vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity); 6058float isEnd = positions.x; 6059vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd); 6060vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd); 6061vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd); 6062vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd); 6063vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd); 6064vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd); 6065geometry.worldPosition = currPosition; 6066vec2 widthPixels = vec2(clamp( 6067project_size_to_pixel(instanceStrokeWidths * path.widthScale, path.widthUnits), 6068path.widthMinPixels, path.widthMaxPixels) / 2.0); 6069vec3 width; 6070if (path.billboard) { 6071#ifdef DASH_ENABLED 6072vec4 prevPositionCommon; 6073vec4 nextPositionCommon; 6074vec4 prevPositionScreen = project_position_to_clipspace( 6075prevPosition, prevPosition64Low, ZERO_OFFSET, prevPositionCommon 6076); 6077#else 6078vec4 prevPositionScreen = project_position_to_clipspace( 6079prevPosition, prevPosition64Low, ZERO_OFFSET 6080); 6081#endif 6082vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position); 6083#ifdef DASH_ENABLED 6084vec4 nextPositionScreen = project_position_to_clipspace( 6085nextPosition, nextPosition64Low, ZERO_OFFSET, nextPositionCommon 6086); 6087#else 6088vec4 nextPositionScreen = project_position_to_clipspace( 6089nextPosition, nextPosition64Low, ZERO_OFFSET 6090); 6091#endif 6092#ifdef DASH_ENABLED
6093vec4 sourcePathStartScreen = mix(currPositionScreen, prevPositionScreen, isEnd); 6094vec4 sourcePathEndScreen = mix(nextPositionScreen, currPositionScreen, isEnd); 6095vec2 billboardPathRange = getClippedPathRange( 6096sourcePathStartScreen.w, sourcePathEndScreen.w 6097); 6098#endif 6099clipLine(prevPositionScreen, currPositionScreen); 6100clipLine(nextPositionScreen, currPositionScreen); 6101clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd)); 6102width = vec3(widthPixels, 0.0); 6103DECKGL_FILTER_SIZE(width, geometry); 6104#ifdef ANTIALIASING 6105vec2 coveragePadding = vec2(0.5 / project.devicePixelRatio); 6106float coverageScale = length(width.xy) > 0.0 6107? length(width.xy + coveragePadding) / length(width.xy) 6108: 1.0; 6109#endif 6110#ifdef DASH_ENABLED 6111vec3 currentDeltaCommon = isEnd > 0.0 6112? geometry.position.xyz - prevPositionCommon.xyz 6113: nextPositionCommon.xyz - geometry.position.xyz; 6114float billboardPathLength = width.x > 0.0 6115? length(currentDeltaCommon) * project.scale / (width.x * project.focalDistance) 6116: 0.0; 6117#endif 6118vec3 offset = getLineJoinOffset( 6119prevPositionScreen.xyz / prevPositionScreen.w, 6120currPositionScreen.xyz / currPositionScreen.w, 6121nextPositionScreen.xyz / nextPositionScreen.w, 6122project_pixel_size_to_clipspace(width.xy) 6123#ifdef DASH_ENABLED 6124, 6125billboardPathLength, billboardPathRange 6126#endif 6127#ifdef ANTIALIASING 6128, 6129coverageScale 6130#endif 6131); 6132#ifdef DASH_ENABLED 6133vPathBounds = billboardPathLength * billboardPathRange; 6134#endif 6135DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry); 6136gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w); 6137} else { 6138prevPosition = project_position(prevPosition, prevPosition64Low); 6139currPosition = project_position(currPosition, currPosition64Low); 6140nextPosition = project_position(nextPosition, nextPosition64Low); 6141width = vec3(project_pixel_size(widthPixels), 0.0); 6142DECKGL_FILTER_SIZE(width, geometry); 6143#ifdef ANTIALIASING 6144vec2 coveragePadding = project_pixel_size(vec2(0.5 / project.devicePixelRatio));
6145float coverageScale = length(width.xy) > 0.0 6146? length(width.xy + coveragePadding) / length(width.xy) 6147: 1.0; 6148#endif 6149vec3 offset = getLineJoinOffset( 6150prevPosition, currPosition, nextPosition, width.xy 6151#ifdef DASH_ENABLED 6152, 1.0, vec2(0.0, 1.0) 6153#endif 6154#ifdef ANTIALIASING 6155, coverageScale 6156#endif 6157); 6158#ifdef DASH_ENABLED 6159vPathBounds = vec2(0.0, vPathLength); 6160#endif 6161geometry.position = vec4(currPosition + offset, 1.0); 6162gl_Position = project_common_position_to_clipspace(geometry.position); 6163DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 6164} 6165DECKGL_FILTER_COLOR(vColor, geometry); 6166} 6167`,P5=`\ 6168#version 300 es 6169#define SHADER_NAME path-layer-fragment-shader 6170precision highp float; 6171in vec4 vColor; 6172in vec2 vCornerOffset; 6173in float vMiterLength; 6174in vec2 vPathPosition; 6175in float vPathLength; 6176in float vJointType; 6177#ifdef DASH_ENABLED 6178in vec2 vPathBounds; 6179#endif 6180out vec4 fragColor; 6181void main(void) { 6182geometry.uv = vPathPosition; 6183#ifdef ANTIALIASING 6184#ifdef DASH_ENABLED 6185bool isCorner = vPathPosition.y < vPathBounds.x || vPathPosition.y > vPathBounds.y; 6186#else 6187bool isCorner = vPathPosition.y < 0.0 || vPathPosition.y > vPathLength; 6188#endif 6189bool isRound = vJointType > 0.5; 6190float bodyCoord = abs(vPathPosition.x); 6191float cornerCoord = length(vCornerOffset); 6192float bodyPixels = (1.0 - bodyCoord) / max(fwidth(bodyCoord), 1e-6); 6193float cornerPixels = (1.0 - cornerCoord) / max(fwidth(cornerCoord), 1e-6); 6194#ifdef PATH_STYLE_OFFSET 6195float edgePixels = isRound && isCorner ? min(cornerPixels, bodyPixels) : bodyPixels; 6196#else 6197float edgePixels = isRound && isCorner ? cornerPixels : bodyPixels; 6198#endif 6199if (edgePixels <= -SMOOTH_EDGE_RADIUS) { 6200discard; 6201} 6202if (isCorner) { 6203if (!isRound && vMiterLength > path.miterLimit + 1.0) { 6204discard; 6205} 6206} 6207fragColor = vColor; 6208fragColor.a *= smoothedge(0.0, edgePixels); 6209#else 6210#ifdef DASH_ENABLED 6211if (vPathPosition.y < vPathBounds.x || vPathPosition.y > vPathBounds.y) { 6212#else 6213if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) { 6214#endif 6215if (vJointType > 0.5 && length(vCornerOffset) > 1.0) { 6216discard; 6217} 6218if (vJointType < 0.5 && vMiterLength > path.miterLimit + 1.0) { 6219discard; 6220} 6221} 6222fragColor = vColor; 6223#endif 6224DECKGL_FILTER_COLOR(fragColor, geometry); 6225} 6226`,P8=[0,0,0,255],P7={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},antialiasing:!1,billboard:!1,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:P8},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},P9={enter:(t,r)=>r.length?r.subarray(r.length-t.length):t};function Ie(t,r){return t===r||!!(t&&r&&t.length===r.length&&t.every((t,i)=>t===r[i]))}class It extends D${getShaders(){let{antialiasing:t}=this.props;return super.getShaders({vs:P6,fs:P5,source:P4,defines:t?{ANTIALIASING:1}:{},modules:[wv,bE,Ej,P3,..."webgpu"===this.context.device.type?[Pa]:[]]})}get wrapLongitude(){return!1}getBounds(){return"webgpu"===this.context.device.type?null:this.getAttributeManager()?.getBounds(["vertexPositions"])}getPathProjectionScale(t){let r=this.props.coordinateSystem;if(!this.getAttributeManager()?.getAttributes().instanceDashOffsets)return null;if(t instanceof AG&&t.zoom>=12&&("default"===r||"lnglat"===r||"cartesian"===r)){let i=wy.getUniforms({viewport:t,coordinateSystem:r,coordinateOrigin:this.props.coordinateOrigin,autoWrapLongitude:this.wrapLongitude});return[t.projectionMode,i.coordinateOrigin[1],i.commonOrigin[1],...i.commonUnitsPerWorldUnit,...i.commonUnitsPerWorldUnit2,i.commonUnitsPerMeter[2]]}let i=function(t){if(t.isGeospatial)return null;let{unitsPerMeter:r}=t.distanceScales;return[r[0],r[1],r[2]]}(t);return i?[t.projectionMode,...i]:[t.projectionMode]}shouldUpdateState(t){let{viewport:r}=this.context;return super.shouldUpdateState(t)||this.state?.tessellationResolution!==r.resolution||!Ie(this.state?.pathProjectionScale,this.getPathProjectionScale(r))}initializeState(){let t="webgpu"===this.context.device.type;this.getAttributeManager().addInstanced({...t?{pathPositions:{size:24,type:"float32",transition:!1,accessor:"getPath",update:this.calculateWebGPUPositions,shaderAttributes:{instanceLeftPositions:{size:3,elementOffset:0},instanceStartPositions:{size:3,elementOffset:3},instanceEndPositions:{size:3,elementOffset:6},instanceRightPositions:{size:3,elementOffset:9},instanceLeftPositions64Low:{size:3,elementOffset:12},instanceStartPositions64Low:{size:3,elementOffset:15},instanceEndPositions64Low:{size:3,elementOffset:18},instanceRightPositions64Low:{size:3,elementOffset:21}},noAlloc:!0}}:{vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:P9,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}}},instanceTypes:{size:1,type:t?"float32":"uint8",update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:!t&&P9,defaultValue:1,bufferGroup:"path-instance-data"},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:!t&&P9,defaultValue:P8,bufferGroup:"path-instance-data"},rowIndexes:{size:1,type:"uint32",accessor:(t,{index:r})=>t&&t.__source?t.__source.index:r,bufferGroup:"path-instance-data"}}),this.setState({pathTesselator:new P0({fp64:this.use64bitPositions(),isWebGPU:t}),tessellationResolution:this.context.viewport.resolution,pathProjectionScale:this.getPathProjectionScale(this.context.viewport)})}updateState(t){super.updateState(t);let{props:r,oldProps:i,changeFlags:n}=t,a=this.getAttributeManager(),{viewport:o}=this.context,s=this.state.tessellationResolution!==o.resolution,l=this.getPathProjectionScale(o),u=!Ie(this.state.pathProjectionScale,l),c=n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPath)||r._pathType!==i._pathType||r.positionFormat!==i.positionFormat||r.wrapLongitude!==i.wrapLongitude||s;if(n.dataChanged||c){let{pathTesselator:t}=this.state,i=r.data.attributes||{};t.updateGeometry({data:r.data,geometryBuffer:i.getPath,buffers:i,normalize:!r._pathType,loop:"loop"===r._pathType,getGeometry:r.getPath,positionFormat:r.positionFormat,wrapLongitude:r.wrapLongitude,resolution:o.resolution,dataChanged:c?void 0:n.dataChanged}),this.setState({numInstances:t.instanceCount,startIndices:t.vertexStarts,tessellationResolution:o.resolution,pathProjectionScale:l}),!n.dataChanged||c?a.invalidateAll():u&&a.invalidate("instanceDashOffsets")}else u&&(this.setState({pathProjectionScale:l}),a.invalidate("instanceDashOffsets"));(n.extensionsChanged||r.antialiasing!==i.antialiasing)&&(this.state.model?.destroy(),this.state.model=this._getModel(),a.invalidateAll())}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(t=>t.__source.index===i)),r}disablePickingIndex(t){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===t&&this._disablePickingIndex(i);else super.disablePickingIndex(t)}draw({uniforms:t}){let{jointRounded:r,capRounded:i,billboard:n,miterLimit:a,widthUnits:o,widthScale:s,widthMinPixels:l,widthMaxPixels:u}=this.props,c=this.state.model,h={jointType:Number(r),capType:Number(i),billboard:n,widthUnits:x4[o],widthScale:s,miterLimit:a,widthMinPixels:l,widthMaxPixels:u};c.shaderInputs.setProps({path:h}),c.draw(this.context.renderPass)}_getModel(){return new DH.Model(this.context.device,{...this.get
6226Shaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new DW.Geometry({topology:"triangle-list",attributes:{indices:new Uint16Array([0,1,2,1,4,2,1,3,4,3,5,4]),positions:{value:new Float32Array([0,0,0,-1,0,1,1,-1,1,1,1,0]),size:2}}}),isInstanced:!0})}calculatePositions(t){let{pathTesselator:r}=this.state;t.startIndices=r.vertexStarts,t.value=r.get("positions")}calculateSegmentTypes(t){let{pathTesselator:r}=this.state;t.startIndices=r.vertexStarts,t.value=r.get("segmentTypes")}calculateWebGPUPositions(t){let{pathTesselator:r}=this.state,i=r.get("positions");if(!i){t.value=null;return}let n=r.instanceCount,a=new Float32Array(24*n),o=[-1,0,1,2];for(let t=0;t<n;t++){let r=24*t;for(let s=0;s<4;s++){let l=t+o[s],u=r+3*s;for(let t=0;t<3;t++){let r=l>=0&&l<n?i[3*l+t]:0,o=Math.fround(r);a[u+t]=o,a[u+t+12]=r-o}}}t.startIndices=r.vertexStarts,t.value=a}}It.defaultProps=P7,It.layerName="PathLayer";var Ir=t.i(54008);function Ii(t,r,i={}){return function(t,r={}){return Math.sign(Ia(t,r))}(t,i)!==r&&(function(t,r){let{start:i=0,end:n=t.length,size:a=2}=r,o=(n-i)/a,s=Math.floor(o/2);for(let r=0;r<s;++r){let n=i+r*a,s=i+(o-1-r)*a;for(let r=0;r<a;++r){let i=t[n+r];t[n+r]=t[s+r],t[s+r]=i}}}(t,i),!0)}let In={x:0,y:1,z:2};function Ia(t,r={}){let{start:i=0,end:n=t.length,plane:a="xy"}=r,o=r.size||2,s=0,l=In[a[0]],u=In[a[1]];for(let r=i,a=n-o;r<n;r+=o)s+=(t[r+l]-t[a+l])*(t[r+u]+t[a+u]),a=r;return s/2}let Io={isClosed:!0};function Is(t){return"positions"in t?t.positions:t}function Il(t){return"holeIndices"in t?t.holeIndices:null}function Iu(t,r,i,n,a){let o,s,l=r,u=i.length;for(let r=0;r<u;r++)for(let a=0;a<n;a++)t[l++]=i[r][a]||0;if(o=i[0],s=i[i.length-1],o[0]!==s[0]||o[1]!==s[1]||o[2]!==s[2])for(let r=0;r<n;r++)t[l++]=i[0][r]||0;return Io.start=r,Io.end=l,Io.size=n,Ii(t,a,Io),l}function Ic(t,r,i,n,a=0,o,s){let l=(o=o||i.length)-a;if(l<=0)return r;let u=r;for(let r=0;r<l;r++)t[u++]=i[a+r];if(!function(t,r,i,n){for(let a=0;a<r;a++)if(t[i+a]!==t[n-r+a])return!1;return!0}(i,n,a,o))for(let r=0;r<n;r++)t[u++]=i[a+r];return Io.start=r,Io.end=u,Io.size=n,Ii(t,s,Io),u}function Ih(t,r,i){let n=t.length/3,a=0;for(let o=0;o<n;o++){let s=(o+1)%n;a+=t[3*o+r]*t[3*s+i],a-=t[3*s+r]*t[3*o+i]}return Math.abs(a/2)}function If(t,r,i,n){let a=t.length/3;for(let o=0;o<a;o++){let a=3*o,s=t[a+0],l=t[a+1],u=t[a+2];t[a+r]=s,t[a+i]=l,t[a+n]=u}}class Id extends PU{constructor(t){const{fp64:r,IndexType:i=Uint32Array}=t;super({...t,attributes:{positions:{size:3,type:r?Float64Array:Float32Array},vertexValid:{type:Uint16Array,size:1},indices:{type:i,size:1}}})}get(t){let{attributes:r}=this;return"indices"===t?r.indices&&r.indices.subarray(0,this.vertexCount):r[t]}updateGeometry(t){super.updateGeometry(t);let r=this.buffers.indices;if(r)this.vertexCount=(r.value||r).length;else if(this.data&&!this.getGeometry)throw Error("missing indices buffer")}normalizeGeometry(t){if(this.normalize){let r=function(t,r){var i,n=t;if(!Array.isArray(n=n&&n.positions||n)&&!ArrayBuffer.isView(n))throw Error("invalid polygon");let a=[],o=[];if("positions"in t){let{positions:i,holeIndices:n}=t;if(n){let t=0;for(let s=0;s<=n.length;s++)t=Ic(a,t,i,r,n[s-1],n[s],0===s?1:-1),o.push(t);return o.pop(),{positions:a,holeIndices:o}}t=i}if(!Array.isArray(t[0]))return Ic(a,0,t,r,0,a.length,1),a;if(!((i=t).length>=1&&i[0].length>=2&&Number.isFinite(i[0][0]))){let i=0;for(let[n,s]of t.entries())i=Iu(a,i,s,r,0===n?1:-1),o.push(i);return o.pop(),{positions:a,holeIndices:o}}return Iu(a,0,t,r,1),a}(t,this.positionSize);return this.opts.resolution?PZ(Is(r),Il(r),{size:this.positionSize,gridResolution:this.opts.resolution,edgeTypes:!0}):this.opts.wrapLongitude?function(t,r=null,i){let{size:n=2,normalize:a=!0,edgeTypes:o=!1}=i||{};r=r||[];let s=[],l=[],u=0,c=0;for(let a=0;a<=r.length;a++){let o=r[a]||t.length,h=c,f=function(t,r,i,n){let a=-1,o=-1;for(let s=i+1;s<n;s+=r){let r=Math.abs(t[s]);r>a&&(a=r,o=s-1)}return o}(t,n,u,o);for(let r=f;r<o;r++)s[c++]=t[r];for(let r=u;r<f;r++)s[c++]=t[r];PQ(s,n,h,c),function(t,r,i,n,a=85.051129){let o=t[i],s=t[n-r];if(Math.abs(o-s)>180){let n=PH(t,0,r,i);n[0]+=360*Math.round((s-o)/360),PG(t,n),n[1]=Math.sign(n[1])*a,PG(t,n),n[0]=o,PG(t,n)}}(s,n,h,c,i?.maxLatitude),u=o,l[a]=c}l.pop();let h=PZ(s,l,{size:n,gridResolution:360,gridOffset:[-180,-180],edgeTypes:o});if(a)for(let t of h)PJ(t.positions,n);return h}(Is(r),Il(r),{size:this.positionSize,maxLatitude:86,edgeTypes:!0}):r}return t}getGeometrySize(t){if(Ip(t)){let r=0;for(let i of t)r+=this.getGeometrySize(i);return r}return Is(t).length/this.positionSize}getGeometryFromBuffer(t){return this.normalize||!this.buffers.indices?super.getGeometryFromBuffer(t):null}updateGeometryAttributes(t,r){if(t&&Ip(t))for(let i of t){let t=this.getGeometrySize(i);r.geometrySize=t,this.updateGeometryAttributes(i,r),r.vertexStart+=t,r.indexStart=this.indexStarts[r.geometryIndex+1]}else this._updateIndices(t,r),this._updatePositions(t,r),this._updateVertexValid(t,r)}_updateIndices(t,{geometryIndex:r,vertexStart:i,indexStart:n}){let{attributes:a,indexStarts:o,typedArrayManager:s}=this,l=a.indices;if(!l||!t)return;let u=n,c=function(t,r,i,n){let a=Il(t);a&&(a=a.map(t=>t/r));let o=Is(t),s=n&&3===r;
6226if(i){let t=o.length;o=o.slice();let n=[];for(let a=0;a<t;a+=r){n[0]=o[a],n[1]=o[a+1],s&&(n[2]=o[a+2]);let t=i(n);o[a]=t[0],o[a+1]=t[1],s&&(o[a+2]=t[2])}}if(s){let t=Ih(o,0,1),r=Ih(o,0,2),n=Ih(o,1,2);if(!t&&!r&&!n)return[];t>r&&t>n||(r>n?(i||(o=o.slice()),If(o,0,2,1)):(i||(o=o.slice()),If(o,2,0,1)))}return(0,Ir.default)(o,a,r)}(t,this.positionSize,this.opts.preproject,this.opts.full3d);l=s.allocate(l,n+c.length,{copy:!0});for(let t=0;t<c.length;t++)l[u++]=c[t]+i;o[r+1]=n+c.length,a.indices=l}_updatePositions(t,{vertexStart:r,geometrySize:i}){let{attributes:{positions:n},positionSize:a}=this;if(!n||!t)return;let o=Is(t);for(let t=r,s=0;s<i;t++,s++){let r=o[s*a],i=o[s*a+1],l=a>2?o[s*a+2]:0;n[3*t]=r,n[3*t+1]=i,n[3*t+2]=l}}_updateVertexValid(t,{vertexStart:r,geometrySize:i}){let{positionSize:n}=this,a=this.attributes.vertexValid,o=t&&Il(t);if(t&&t.edgeTypes?a.set(t.edgeTypes,r):a.fill(1,r,r+i),o)for(let t=0;t<o.length;t++)a[r+o[t]/n-1]=0;a[r+i-1]=0}}function Ip(t){return Array.isArray(t)&&t.length>0&&!Number.isFinite(t[0])}let Im=`\ 6227layout(std140) uniform solidPolygonUniforms { 6228 bool extruded; 6229 bool isWireframe; 6230 float elevationScale; 6231} solidPolygon; 6232`,Ig={name:"solidPolygon",source:`\ 6233struct SolidPolygonUniforms { 6234 extruded: f32, 6235 isWireframe: f32, 6236 elevationScale: f32, 6237}; 6238 6239@group(0) @binding(auto) var<uniform> solidPolygon: SolidPolygonUniforms; 6240`,vs:Im,fs:Im,uniformTypes:{extruded:"f32",isWireframe:"f32",elevationScale:"f32"}},Iy=`\ 6241in vec4 fillColors; 6242in vec4 lineColors; 6243in float rowIndexes; 6244out vec4 vColor; 6245struct PolygonProps { 6246vec3 positions; 6247vec3 positions64Low; 6248vec3 normal; 6249float elevations; 6250}; 6251vec3 project_offset_normal(vec3 vector) { 6252if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 6253project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) { 6254return normalize(vector * project.commonUnitsPerWorldUnit); 6255} 6256return project_normal(vector); 6257} 6258void calculatePosition(PolygonProps props) { 6259vec3 pos = props.positions; 6260vec3 pos64Low = props.positions64Low; 6261vec3 normal = props.normal; 6262vec4 colors = solidPolygon.isWireframe ? lineColors : fillColors; 6263geometry.worldPosition = props.positions; 6264geometry.pickingColor = picking_getPickingColorFromIndex(rowIndexes); 6265if (solidPolygon.extruded) { 6266pos.z += props.elevations * solidPolygon.elevationScale; 6267} 6268gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position); 6269DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 6270if (solidPolygon.extruded) { 6271#ifdef IS_SIDE_VERTEX 6272normal = project_offset_normal(normal); 6273#else 6274normal = project_normal(normal); 6275#endif 6276geometry.normal = normal; 6277vec3 lightColor = lighting_getLightColor(colors.rgb, project.cameraPosition, geometry.position.xyz, geometry.normal); 6278vColor = vec4(lightColor, colors.a * layer.opacity); 6279} else { 6280vColor = vec4(colors.rgb, colors.a * layer.opacity); 6281} 6282DECKGL_FILTER_COLOR(vColor, geometry); 6283} 6284`,Iv=`\ 6285#version 300 es 6286#define SHADER_NAME solid-polygon-layer-vertex-shader 6287in vec3 vertexPositions; 6288in vec3 vertexPositions64Low; 6289in float elevations; 6290${Iy} 6291void main(void) { 6292PolygonProps props; 6293props.positions = vertexPositions; 6294props.positions64Low = vertexPositions64Low; 6295props.elevations = elevations; 6296props.normal = vec3(0.0, 0.0, 1.0); 6297calculatePosition(props); 6298} 6299`,I_=`\ 6300#version 300 es 6301#define SHADER_NAME solid-polygon-layer-vertex-shader-side 6302#define IS_SIDE_VERTEX 6303in vec2 positions; 6304in vec3 vertexPositions; 6305in vec3 nextVertexPositions; 6306in vec3 vertexPositions64Low; 6307in vec3 nextVertexPositions64Low; 6308in float elevations; 6309in float instanceVertexValid; 6310${Iy} 6311void main(void) { 6312if(instanceVertexValid < 0.5){ 6313gl_Position = vec4(0.); 6314return; 6315} 6316PolygonProps props; 6317vec3 pos; 6318vec3 pos64Low; 6319vec3 nextPos; 6320vec3 nextPos64Low; 6321#if RING_WINDING_ORDER_CW == 1 6322pos = vertexPositions; 6323pos64Low = vertexPositions64Low; 6324nextPos = nextVertexPositions; 6325nextPos64Low = nextVertexPositions64Low; 6326#else 6327pos = nextVertexPositions; 6328pos64Low = nextVertexPositions64Low; 6329nextPos = vertexPositions; 6330nextPos64Low = vertexPositions64Low; 6331#endif 6332props.positions = mix(pos, nextPos, positions.x); 6333props.positions64Low = mix(pos64Low, nextPos64Low, positions.x); 6334props.normal = vec3( 6335pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y), 6336nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x), 63370.0); 6338props.elevations = elevations * positions.y; 6339calculatePosition(props); 6340} 6341`,Ib=`\ 6342#version 300 es 6343#define SHADER_NAME solid-polygon-layer-fragment-shader 6344precision highp float; 6345in vec4 vColor; 6346out vec4 fragColor; 6347void main(void) { 6348fragColor = vColor; 6349geometry.uv = vec2(0.); 6350DECKGL_FILTER_COLOR(fragColor, geometry); 6351} 6352`;function Ix(){return`\ 6353fn project_offset_normal(vector: vec3<f32>) -> vec3<f32> { 6354 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 6355 project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) { 6356 return normalize(vector * project.commonUnitsPerWorldUnit); 6357 } 6358 return project_normal(vector); 6359} 6360 6361fn apply_polygon_color( 6362 colors: vec4<f32>, 6363 normal: vec3<f32>, 6364 position: vec4<f32> 6365) -> vec4<f32> { 6366 if (solidPolygon.extruded > 0.5) { 6367 let lightColor = lighting_getLightColor2( 6368 colors.rgb, 6369 project.cameraPosition, 6370 position.xyz, 6371 normal 6372 ); 6373 return vec4<f32>(lightColor, colors.a * layer.opacity); 6374 } 6375 return vec4<f32>(colors.rgb, colors.a * layer.opacity); 6376} 6377`}function Iw(){return`\ 6378@fragment 6379fn fragmentMain(inp: Varyings) -> @location(0) vec4<f32> { 6380 geometry.uv = vec2<f32>(0.0, 0.0); 6381 6382 clip_filterColor(inp.clipCoordinates); 6383 6384 if (picking.isActive > 0.5) { 6385 if (!picking_isColorValid(inp.pickingColor)) { 6386 discard; 6387 } 6388 return vec4<f32>(inp.pickingColor, 1.0); 6389 } 6390 6391 var fragColor = inp.vColor; 6392 6393 if (picking.isHighlightActive > 0.5) { 6394 let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 6395 if (picking_isColorZero(abs(inp.pickingColor - highlightedObjectColor))) { 6396 let highLightAlpha = picking.highlightColor.a; 6397 let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha); 6398 if (blendedAlpha > 0.0) { 6399 let highLightRatio = highLightAlpha / blendedAlpha; 6400 fragColor = vec4<f32>( 6401 mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio), 6402 blendedAlpha 6403 ); 6404 } else { 6405 fragColor = vec4<f32>(fragColor.rgb, 0.0); 6406 } 6407 } 6408 } 6409 6410 return deckgl_premultiplied_alpha(fragColor); 6411} 6412`}let IE=[0,0,0,255],IT={enter:(t,r)=>r.length?r.subarray(r.length-t.length):t};class IA extends D${getShaders(t){var r;let i=this.props._normalize||"CCW"!==this.props._windingOrder?1:0;return super.getShaders({vs:"top"===t?Iv:I_,fs:Ib,source:(r=!!i,"top"===t?`\ 6413${Ix()} 6414 6415struct Attributes { 6416 @location(0) vertexPositions: vec3<f32>, 6417 @location(1) vertexPositions64Low: vec3<f32>, 6418 @location(2) elevations: f32, 6419 @location(3) fillColors: vec4<f32>, 6420 @location(4) lineColors: vec4<f32>, 6421 @location(5) rowIndexes: u32, 6422}; 6423
6424struct Varyings { 6425 @builtin(position) position: vec4<f32>, 6426 @location(0) vColor: vec4<f32>, 6427 @location(1) pickingColor: vec3<f32>, 6428 @location(2) clipCoordinates: vec2<f32>, 6429}; 6430 6431@vertex 6432fn vertexMain(attributes: Attributes) -> Varyings { 6433 var outp: Varyings; 6434 6435 var pos = attributes.vertexPositions; 6436 if (solidPolygon.extruded > 0.5) { 6437 pos.z += attributes.elevations * solidPolygon.elevationScale; 6438 } 6439 6440 geometry.worldPosition = attributes.vertexPositions; 6441 geometry.pickingColor = picking_getPickingColorFromIndex(attributes.rowIndexes); 6442 6443 let projectedPosition = project_position_to_clipspace_and_commonspace( 6444 pos, 6445 attributes.vertexPositions64Low, 6446 vec3<f32>(0.0) 6447 ); 6448 geometry.position = projectedPosition.commonPosition; 6449 outp.position = projectedPosition.clipPosition; 6450 6451 let normal = project_normal(vec3<f32>(0.0, 0.0, 1.0)); 6452 geometry.normal = normal; 6453 6454 let colors = select( 6455 attributes.fillColors, 6456 attributes.lineColors, 6457 solidPolygon.isWireframe > 0.5 6458 ); 6459 outp.vColor = apply_polygon_color(colors, normal, geometry.position); 6460 outp.pickingColor = geometry.pickingColor; 6461 6462 outp.clipCoordinates = geometry.position.xy; 6463 clip_filterPosition(&outp.position, geometry.worldPosition.xy); 6464 6465 return outp; 6466} 6467 6468${Iw()} 6469`:`\ 6470const RING_WINDING_ORDER_CW: bool = ${r?"true":"false"}; 6471 6472${Ix()} 6473 6474struct Attributes { 6475 @location(0) positions: vec2<f32>, 6476 @location(1) vertexPositions: vec3<f32>, 6477 @location(2) vertexPositions64Low: vec3<f32>, 6478 @location(3) nextVertexPositions: vec3<f32>, 6479 @location(4) nextVertexPositions64Low: vec3<f32>, 6480 @location(5) vertexValid: f32, 6481 @location(6) elevations: f32, 6482 @location(7) fillColors: vec4<f32>, 6483 @location(8) lineColors: vec4<f32>, 6484 @location(9) rowIndexes: u32, 6485}; 6486 6487struct Varyings { 6488 @builtin(position) position: vec4<f32>, 6489 @location(0) vColor: vec4<f32>, 6490 @location(1) pickingColor: vec3<f32>, 6491 @location(2) clipCoordinates: vec2<f32>, 6492}; 6493 6494@vertex 6495fn vertexMain(attributes: Attributes) -> Varyings { 6496 var outp: Varyings; 6497 outp.position = vec4<f32>(0.0); 6498 outp.vColor = vec4<f32>(0.0); 6499 outp.pickingColor = picking_getPickingColorFromIndex(attributes.rowIndexes); 6500 outp.clipCoordinates = vec2<f32>(0.0); 6501 6502 if (attributes.vertexValid < 0.5) { 6503 return outp; 6504 } 6505 6506 let pos = select(attributes.nextVertexPositions, attributes.vertexPositions, RING_WINDING_ORDER_CW); 6507 let pos64Low = select( 6508 attributes.nextVertexPositions64Low, 6509 attributes.vertexPositions64Low, 6510 RING_WINDING_ORDER_CW 6511 ); 6512 let nextPos = select(attributes.vertexPositions, attributes.nextVertexPositions, RING_WINDING_ORDER_CW); 6513 let nextPos64Low = select( 6514 attributes.vertexPositions64Low, 6515 attributes.nextVertexPositions64Low, 6516 RING_WINDING_ORDER_CW 6517 ); 6518 6519 let position = mix(pos, nextPos, attributes.positions.x); 6520 let position64Low = mix(pos64Low, nextPos64Low, attributes.positions.x); 6521 6522 var worldPosition = position; 6523 if (solidPolygon.extruded > 0.5) { 6524 worldPosition.z += attributes.elevations * attributes.positions.y * solidPolygon.elevationScale; 6525 } 6526 6527 geometry.worldPosition = position; 6528 geometry.pickingColor = picking_getPickingColorFromIndex(attributes.rowIndexes); 6529 6530 let projectedPosition = project_position_to_clipspace_and_commonspace( 6531 worldPosition, 6532 position64Low, 6533 vec3<f32>(0.0) 6534 ); 6535 geometry.position = projectedPosition.commonPosition; 6536 outp.position = projectedPosition.clipPosition; 6537 6538 let normal = project_offset_normal(vec3<f32>( 6539 pos.y - nextPos.y + (pos64Low.y - nextPos64Low.y), 6540 nextPos.x - pos.x + (nextPos64Low.x - pos64Low.x), 6541 0.0 6542 )); 6543 geometry.normal = normal; 6544 6545 let colors = select( 6546 attributes.fillColors, 6547 attributes.lineColors, 6548 solidPolygon.isWireframe > 0.5 6549 ); 6550 outp.vColor = apply_polygon_color(colors, normal, geometry.position); 6551 outp.pickingColor = geometry.pickingColor; 6552 6553 outp.clipCoordinates = geometry.position.xy; 6554 clip_filterPosition(&outp.position, geometry.worldPosition.xy); 6555 6556 return outp; 6557} 6558 6559${Iw()} 6560`),defines:{RING_WINDING_ORDER_CW:i},modules:[wv,bE,b_,Ej,Ig,..."webgpu"===this.context.device.type?[Pa]:[]]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let t,{viewport:r}=this.context,{coordinateSystem:i}=this.props,{_full3d:n}=this.props;r.isGeospatial&&"default"===i&&(i="lnglat"),"lnglat"===i&&(t=n?r.projectPosition.bind(r):r.projectFlat.bind(r)),this.setState({numInstances:0,polygonTesselator:new Id({preproject:t,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let a=this.getAttributeManager(),o="webgpu"===this.context.device.type;a.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:!0},vertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:IT,accessor:"getPolygon",update:this.calculatePositions,noAlloc:!0,...o?{}:{shaderAttributes:{nextVertexPositions:{vertexOffset:1}}}},...o?{nextVertexPositions:{size:3,type:"float64",stepMode:"dynamic",fp64:this.use64bitPositions(),transition:!1,update:this.calculateNextPositions,noAlloc:!0}}:{},[o?"vertexValid":"instanceVertexValid"]:{size:1,type:o?"float32":"uint16",stepMode:"instance",update:this.calculateVertexValid,noAlloc:!0},elevations:{size:1,stepMode:"dynamic",transition:IT,accessor:"getElevation",bufferGroup:"solid-polygon-instance-data"},fillColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:IT,accessor:"getFillColor",defaultValue:IE,bufferGroup:"solid-polygon-instance-data"},lineColors:{size:this.props.colorFormat.length,type:"unorm8",stepMode:"dynamic",transition:IT,accessor:"getLineColor",defaultValue:IE,bufferGroup:"solid-polygon-instance-data"},rowIndexes:{size:1,type:"uint32",stepMode:"dynamic",accessor:(t,{index:r})=>t&&t.__source?t.__source.index:r,bufferGroup:"solid-polygon-instance-data"}})}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(t=>t.__source.index===i)),r}disablePickingIndex(t){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===t&&this._disablePickingIndex(i);else super.disablePickingIndex(t)}draw({uniforms:t}){let{extruded:r,filled:i,wireframe:n,elevationScale:a}=this.props,{topModel:o,sideModel:s,wireframeModel:l,polygonTesselator:u}=this.state,c={extruded:!!r,elevationScale:a,isWireframe:!1};l&&n&&(l.setInstanceCount(u.instanceCount-1),l.shaderInputs.setProps({solidPolygon:{...c,isWireframe:!0}}),l.draw(this.context.renderPass)),s&&i&&(s.setInstanceCount(u.instanceCount-1),s.shaderInputs.setProps({solidPolygon:c}),s.draw(this.context.renderPass)),o&&i&&(o.setVertexCount(u.vertexCount),o.shaderInputs.setProps({solidPolygon:c}),o.draw(this.context.renderPass))}updateState(t){super.updateState(t),this.updateGeometry(t);let{props:r,oldProps:i,changeFlags:n}=t,a=this.getAttributeManager();(n.extensionsChanged||r.filled!==i.filled||r.extruded!==i.extruded)&&(this.state.models?.forEach(t=>t.destroy()),this.setState(this._getModels()),a.invalidateAll())}updateGeometry({props:t,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:r}=this.state,n=t.data.attributes||{};r.updateGeometry({data:t.data,normalize:t._normalize,geometryBuffer:n.getPolygon,buffers:"webgpu"===this.context.device.type?{...n}:n,getGeometry:t.getPolygon,positionFormat:t.positionFormat,wrapLongitude:t.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:t._full3d}),this.setState({numInstances:r.instanceCount,startIndices:r.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let t,r,i,{id:n,filled:a,extruded:o}=this.props;if(a){let r=this.getShaders("top");r.defines={...r.defines,NON_INSTANCED_MODEL:1};let i=this.getAttributeManager().getBufferLayouts({isInstanced:!1});"webgpu"===this.context.device.type&&(i=i.filter(t=>"indices"!==t.name&&"vertexValid"!==t.name&&"instanceVertexValid"!==t.name&&"nextVertexPositions"!==t.name)),t=new DH.Model(this.context.device,{...r,id:`${n}-top`,topology:"triangle-list",bufferLayout:i,isIndexed:!0,userData:{excludeAttributes:{vertexValid:!0,instanceVertexValid:!0,nextVertexPositions:!0}}})}if(o){let t=this.getAttributeManager().getBufferLayouts({isInstanced:!0});"webgpu"===this.context.device.type&&(t=t.filter(t=>"indices"!==t.name)),r=new DH.Model(this.context.device,{...this.get
6560Shaders("side"),id:`${n}-side`,bufferLayout:t,geometry:new DW.Geometry({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),i=new DH.Model(this.context.device,{...this.getShaders("side"),id:`${n}-wireframe`,bufferLayout:t,geometry:new DW.Geometry({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})}return{models:[r,i,t].filter(Boolean),topModel:t,sideModel:r,wireframeModel:i}}calculateIndices(t){let{polygonTesselator:r}=this.state;t.startIndices=r.indexStarts,t.value=r.get("indices")}calculatePositions(t){let{polygonTesselator:r}=this.state;t.startIndices=r.vertexStarts;let i=this.props.data.attributes?.getPolygon;if("webgpu"===this.context.device.type&&ArrayBuffer.isView(i?.value)){let{value:n,size:a=3,offset:o=0,stride:s}=i,l=o/n.BYTES_PER_ELEMENT,u=s?s/n.BYTES_PER_ELEMENT:a,c=new Float64Array(3*r.instanceCount);for(let t=0;t<r.instanceCount;t++){let r=l+t*u,i=3*t;c[i]=n[r],c[i+1]=n[r+1],c[i+2]=a>2?n[r+2]:0}t.value=c;return}t.value=r.get("positions")}calculateVertexValid(t){let r=this.props.data.attributes?.instanceVertexValid?.value,i="webgpu"===this.context.device.type&&r?r:this.state.polygonTesselator.get("vertexValid");t.value="webgpu"===this.context.device.type&&i?Float32Array.from(i):i}calculateNextPositions(t){let{polygonTesselator:r}=this.state,i=this.getAttributeManager().getAttributes(),n=i.vertexPositions.value,a=this.props.data.attributes?.instanceVertexValid?.value||i.vertexValid?.value||r.get("vertexValid");if(t.startIndices=r.vertexStarts,!n){t.value=n;return}let o=n.length/3,s=new n.constructor(n.length);for(let t=0;t<o;t++){let r=3*t,i=a?.[t]&&t+1<o?r+3:r;for(let t=0;t<3;t++)s[r+t]=n[i+t]}t.value=s}}IA.defaultProps={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:IE},getLineColor:{type:"accessor",value:IE},material:!0},IA.layerName="SolidPolygonLayer";let IS={circle:{type:Pl,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:D9,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:Pj,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPi
6560xels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},IC={type:It,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",lineAntialiasing:"antialiasing",getLineColor:"getColor",getLineWidth:"getWidth"}},IM={type:IA,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function ID({type:t,props:r}){let i={};for(let n in r)i[n]=t.defaultProps[r[n]];return i}function IP(t,r){let{transitions:i,updateTriggers:n}=t.props,a={updateTriggers:{},transitions:i&&{getPosition:i.geometry}};for(let o in r){let s=r[o],l=t.props[o];o.startsWith("get")&&(l=t.getSubLayerAccessor(l),a.updateTriggers[s]=n[o],i&&(a.transitions[s]=i[o])),a[s]=l}return a}function II(t,r,i={}){let n={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:a=0,endRow:o=t.length}=i;for(let i=a;i<o;i++){let a=t[i],{geometry:o}=a;if(o)if("GeometryCollection"===o.type){xn.assert(Array.isArray(o.geometries),"GeoJSON does not have geometries array");let{geometries:t}=o;for(let o=0;o<t.length;o++)Ik(t[o],n,r,a,i)}else Ik(o,n,r,a,i)}return n}function Ik(t,r,i,n,a){let{type:o,coordinates:s}=t,{pointFeatures:l,lineFeatures:u,polygonFeatures:c,polygonOutlineFeatures:h}=r;if(!function(t,r){let i=IO[t];for(xn.assert(i,`Unknown GeoJSON type ${t}`);r&&--i>0;)r=r[0];return r&&Number.isFinite(r[0])}(o,s))return void xn.warn(`${o} coordinates are malformed`)();switch(o){case"Point":l.push(i({geometry:t},n,a));break;case"MultiPoint":s.forEach(t=>{l.push(i({geometry:{type:"Point",coordinates:t}},n,a))});break;case"LineString":u.push(i({geometry:t},n,a));break;case"MultiLineString":s.forEach(t=>{u.push(i({geometry:{type:"LineString",coordinates:t}},n,a))});break;case"Polygon":c.push(i({geometry:t},n,a)),s.forEach(t=>{h.push(i({geometry:{type:"LineString",coordinates:t}},n,a))});break;case"MultiPolygon":s.forEach(t=>{c.push(i({geometry:{type:"Polygon",coordinates:t}},n,a)),t.forEach(t=>{h.push(i({geometry:{type:"LineString",coordinates:t}},n,a))})})}}let IO={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function IN(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function IL(t){return t.geometry.coordinates}let IR=["points","linestrings","polygons"],IF={...ID(IS.circle),...ID(IS.icon),...ID(IS.text),...ID(IC),...ID(IM),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:t=>t.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}};class IB extends Dq{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:t,changeFlags:r}){if(!r.dataChanged)return;let{data:i}=this.props,n=i&&"points"in i&&"polygons"in i&&"lines"in i;this.setState({binary:n}),n?this._updateStateBinary({props:t,changeFlags:r}):this._updateStateJSON({props:t,changeFlags:r})}_updateStateBinary({props:t,changeFlags:r}){let i=function(t){let r=IN(),{points:i,lines:n,polygons:a}=t,o=function(t){let r={points:null,lines:null,polygons:null};for(let i in r){let n=t[i].globalFeatureIds.value;r[i]=new Uint32Array(n)}return r}(t);r.points.data={length:i.positions.value.length/i.positions.size,attributes:{...i.attributes,getPosition:i.positions,rowIndexes:{size:1,type:"uint32",value:o.points}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},r.lines.data={length:n.pathIndices.value.length-1,startIndices:n.pathIndices.value,attributes:{...n.attributes,getPath:n.positions,rowIndexes:{size:1,type:"uint32",value:o.lines}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.lines._pathType="open";let s=Array(a.positions.value.length/a.positions.size).fill(1);for(let t of a.primitivePolygonIndices.value)s[t-1]=0;return r.polygons.data={length:a.polygonIndices.value.length-1,startIndices:a.polygonIndices.value,attributes:{...a.attributes,getPolygon:a.positions,instanceVertexValid:{size:1,value:new Uint16Array(s)},rowIndexes:{size:1,type:"uint32",value:o.polygons}},properties:a.properties,numericProps:a.numericProps,featureIds:a.featureIds},r.polygons._normalize=!1,a.triangles&&(r.polygons.data.attributes.indices=a.triangles.value),r.polygonsOutline.data={length:a.primitivePolygonIndices.value.length-1,startIndices:a.primitivePolygonIndices.value,attributes:{...a.attributes,getPath:a.positions,rowIndexes:{size:1,type:"uint32",value:o.polygons}},properties:a.properties,numericProps:a.numericProps,featureIds:a.featureIds},r.polygonsOutline._pathType="open",r}(t.data);this.setState({layerProps:i})}_updateStateJSON({props:t,changeFlags:r}){let i=function(t){if(Array.isArray(t))return t;switch(xn.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return xn.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}(t.data),n=this.getSubLayerRow.bind(this),a={},o={};if(Array.isArray(r.dataChanged)){let t=this.state.features;for(let r in t)a[r]=t[r].slice(),o[r]=[];for(let s of r.dataChanged){let r=II(i,n,s);for(let i in t)o[i].push(function({data:t,getIndex:r,dataRange:i,replace:n}){let{startRow:a=0,endRow:o=1/0}=i,s=t.length,l=s,u=s;for(let i=0;i<s;i++){let n=r(t[i]);if(l>i&&n>=a&&(l=i),n>=o){u=i;break}}let c=l,h=u-l!==n.length?t.slice(u):void 0;for(let r=0;r<n.length;r++)t[c++]=n[r];if(h){for(let r=0;r<h.length;r++)t[c++]=h[r];t.length=c}return{startRow:l,endRow:l+n.length}}({data:a[i],getIndex:t=>t.__source.index,dataRange:s,replace:r[i]}))}}else a=II(i,n);let s=function(t,r){let i=IN(),{pointFeatures:n,lineFeatures:a,pol
6560ygonFeatures:o,polygonOutlineFeatures:s}=t;return i.points.data=n,i.points._dataDiff=r.pointFeatures&&(()=>r.pointFeatures),i.points.getPosition=IL,i.lines.data=a,i.lines._dataDiff=r.lineFeatures&&(()=>r.lineFeatures),i.lines.getPath=IL,i.polygons.data=o,i.polygons._dataDiff=r.polygonFeatures&&(()=>r.polygonFeatures),i.polygons.getPolygon=IL,i.polygonsOutline.data=s,i.polygonsOutline._dataDiff=r.polygonOutlineFeatures&&(()=>r.polygonOutlineFeatures),i.polygonsOutline.getPath=IL,i}(a,o);this.setState({features:a,featuresDiff:o,layerProps:s})}getPickingInfo(t){let r=super.getPickingInfo(t),{index:i,sourceLayer:n}=r;return r.featureType=IR.find(t=>n.id.startsWith(`${this.id}-${t}-`)),i>=0&&n.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(r.index=this.props.data.points.globalFeatureIds.value[i]),r}_updateAutoHighlight(t){let r=`${this.id}-points-`,i="points"===t.featureType;for(let n of this.getSubLayers())n.id.startsWith(r)===i&&n.updateAutoHighlight(t)}_renderPolygonLayer(){let{extruded:t,wireframe:r}=this.props,{layerProps:i}=this.state,n="polygons-fill",a=this.shouldRenderSubLayer(n,i.polygons?.data)&&this.getSubLayerClass(n,IM.type);if(a){let o=IP(this,IM.props),s=t&&r;return s||delete o.getLineColor,o.updateTriggers.lineColors=s,new a(o,this.get
6560SubLayerProps({id:n,updateTriggers:o.updateTriggers}),i.polygons)}return null}_renderLineLayers(){let{extruded:t,stroked:r}=this.props,{layerProps:i}=this.state,n="polygons-stroke",a="linestrings",o=!t&&r&&this.shouldRenderSubLayer(n,i.polygonsOutline?.data)&&this.getSubLayerClass(n,IC.type),s=this.shouldRenderSubLayer(a,i.lines?.data)&&this.getSubLayerClass(a,IC.type);if(o||s){let t=IP(this,IC.props);return[o&&new o(t,this.getSubLayerProps({id:n,updateTriggers:t.updateTriggers}),i.polygonsOutline),s&&new s(t,this.getSubLayerProps({id:a,updateTriggers:t.updateTriggers}),i.lines)]}return null}_renderPointLayers(){let{pointType:t}=this.props,{layerProps:r,binary:i}=this.state,{highlightedObjectIndex:n}=this.props;!i&&Number.isFinite(n)&&(n=r.points.data.findIndex(t=>t.__source.index===n));let a=new Set(t.split("+")),o=[];for(let t of a){let a=`points-${t}`,s=IS[t],l=s&&this.shouldRenderSubLayer(a,r.points?.data)&&this.getSubLayerClass(a,s.type);if(l){let u=IP(this,s.props),c=r.points;if("text"===t&&i){let{rowIndexes:t,...r}=c.data.attributes;c={...c,data:{...c.data,attributes:r}}}o.push(new l(u,this.getSubLayerProps({id:a,updateTriggers:u.updateTriggers,highlightedObjectIndex:n}),c))}}return o}renderLayers(){let{extruded:t}=this.props,r=this._renderPolygonLayer();return[!t&&r,this._renderLineLayers(),this._renderPointLayers(),t&&r]}getSubLayerAccessor(t){let{binary:r}=this.state;return r&&"function"==typeof t?(r,i)=>{let{data:n,index:a}=i;return t(function(t,r){if(!t)return null;let i="startIndices"in t?t.startIndices[r]:r,n=t.featureIds.value[i];return -1!==i?function(t,r,i){let n={properties:{...t.properties[r]}};for(let r in t.numericProps)n.properties[r]=t.numericProps[r].value[i];return n}(t,n,i):null}(n,a),i)}:super.getSubLayerAccessor(t)}}IB.layerName="GeoJsonLayer",IB.defaultProps=IF;class Iz{static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(t){t&&(this.opts=t)}equals(t){return this===t||this.constructor===t.constructor&&Ak(this.opts,t.opts,1)}getShaders(t){return null}getSubLayerProps(t){let{defaultProps:r}=t.constructor,i={updateTriggers:{}};for(let t in r)if(t in this.props){let n=r[t],a=this.props[t];i[t]=a,n&&"accessor"===n.type&&(i.updateTriggers[t]=this.props.updateTriggers[t],"function"==typeof a&&(i[t]=this.getSubLayerAccessor(a)))}return i}initializeState(t,r){}updateState(t,r){}onNeedsRedraw(t){}getNeedsPickingBuffer(t){return!1}draw(t,r){}finalizeState(t,r){}}Iz.defaultProps={},Iz.extensionName="LayerExtension";let Ij=Iz,IU=` 6561layout(std140) uniform clipUniforms { 6562 vec4 bounds; 6563} clip; 6564 6565bool clip_isInBounds(vec2 position) { 6566 return position.x >= clip.bounds[0] && position.y >= clip.bounds[1] && position.x < clip.bounds[2] && position.y < clip.bounds[3]; 6567} 6568`,IV={name:"clip",vs:IU,uniformTypes:{bounds:"vec4<f32>"}},I$={"vs:#decl":` 6569out float clip_isVisible; 6570`,"vs:DECKGL_FILTER_GL_POSITION":` 6571 clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy)); 6572`,"fs:#decl":` 6573in float clip_isVisible; 6574`,"fs:DECKGL_FILTER_COLOR":` 6575 if (clip_isVisible < 0.5) discard; 6576`},IG={name:"clip",fs:IU,uniformTypes:{bounds:"vec4<f32>"}},Iq={"vs:#decl":` 6577out vec2 clip_commonPosition; 6578`,"vs:DECKGL_FILTER_GL_POSITION":` 6579 clip_commonPosition = geometry.position.xy; 6580`,"fs:#decl":` 6581in vec2 clip_commonPosition; 6582`,"fs:DECKGL_FILTER_COLOR":` 6583 if (!clip_isInBounds(clip_commonPosition)) discard; 6584`};class IH extends Ij{getShaders(){let t="instancePositions"in this.getAttributeManager().attributes;return(void 0!==this.props.clipByInstance&&(t=!!this.props.clipByInstance),this.state.clipByInstance=t,"webgpu"===this.context.device.type)?{}:t?{modules:[IV],inject:I$}:{modules:[IG],inject:Iq}}draw(){let{clipBounds:t}=this.props,r={};if(this.state.clipByInstance)r.bounds=t;else{let i=this.projectPosition([t[0],t[1],0]),n=this.projectPosition([t[2],t[3],0]);r.bounds=[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[0],n[0]),Math.max(i[1],n[1])]}"webgpu"===this.context.device.type&&(r.enabled=!0,r.mode=this.state.clipByInstance?"instance":"geometry"),this.setShaderModuleProps({clip:r})}}function IW(t,r,i,n,a,o,s){let l,u;void 0===o&&(o=Ia(t,{start:r,end:i,size:n,plane:s}));let c=In[s[0]],h=In[s[1]];if(a===o<0)for(l=r;l<i;l+=n)u=I6(l,t[l+c],t[l+h],u);else for(l=i-n;l>=r;l-=n)u=I6(l,t[l+c],t[l+h],u);return u&&IJ(u,u.next)&&(I5(u),u=u.next),u}function IZ(t,r){let i;if(!t)return t;r||(r=t);let n=t;do if(i=!1,!n.steiner&&(IJ(n,n.next)||0===IQ(n.prev,n,n.next))){if(I5(n),(n=r=n.prev)===n.next)break;
6584i=!0}else n=n.next;while(i||n!==r)return r}IH.defaultProps={clipBounds:[0,0,1,1],clipByInstance:void 0},IH.extensionName="ClipExtension";function IY(t,r){return t.x-r.x}function IX(t,r,i,n,a){return(t=((t=((t=((t=((t=(t-i)*a|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(r=((r=((r=((r=((r=(r-n)*a|0)|r<<8)&0xff00ff)|r<<4)&0xf0f0f0f)|r<<2)&0x33333333)|r<<1)&0x55555555)<<1}function IK(t,r,i,n,a,o,s,l){return(a-s)*(r-l)>=(t-s)*(o-l)&&(t-s)*(n-l)>=(i-s)*(r-l)&&(i-s)*(o-l)>=(a-s)*(n-l)}function IQ(t,r,i){return(r.y-t.y)*(i.x-r.x)-(r.x-t.x)*(i.y-r.y)}function IJ(t,r){return t.x===r.x&&t.y===r.y}function I0(t,r,i,n){let a=I2(IQ(t,r,i)),o=I2(IQ(t,r,n)),s=I2(IQ(i,n,t)),l=I2(IQ(i,n,r));return!!(a!==o&&s!==l||0===a&&I1(t,i,r)||0===o&&I1(t,n,r)||0===s&&I1(i,t,n)||0===l&&I1(i,r,n))}function I1(t,r,i){return r.x<=Math.max(t.x,i.x)&&r.x>=Math.min(t.x,i.x)&&r.y<=Math.max(t.y,i.y)&&r.y>=Math.min(t.y,i.y)}function I2(t){return t>0?1:t<0?-1:0}function I3(t,r){return 0>IQ(t.prev,t,t.next)?IQ(t,r,t.next)>=0&&IQ(t,t.prev,r)>=0:0>IQ(t,r,t.prev)||0>IQ(t,t.next,r)}function I4(t,r){let i=new I8(t.i,t.x,t.y),n=new I8(r.i,r.x,r.y),a=t.next,o=r.prev;return t.next=r,r.prev=t,i.next=a,a.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function I6(t,r,i,n){let a=new I8(t,r,i);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function I5(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)}class I8{constructor(t,r,i){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=i}}function I7(t,r){let i={};for(let n in t)i[n]={value:t[n],size:r};return i}function I9(t,r,i,n){for(let a in t.numericProps)if(a in r){let o=r[a];t.numericProps[a].fill(o,i,i+n)}}function ke(t,r){let i={};for(let n in t)r.includes(n)||(i[n]=t[n]);return i}var kt=t.i(404109);function kr(t,r){for(let i=0;i<t.length;++i)t[i]/=r}class ki{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;static types=["Unknown","Point","LineString","Polygon"];constructor(t,r,i,n,a,o){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=n,this._values=a,this._geometryInfo=o,t.readFields(ka,this,r)}toGeoJSONFeature(t,r){let i=this.loadGeometry();return"wgs84"===t?kn(this,i,t=>(function t(r,i,n){if("number"!=typeof r[0][0]){for(let a of r)t(a,i,n);return}let a=n*Math.pow(2,i.z),o=n*i.x,s=n*i.y;for(let t=0;t<r.length;t++){let i=r[t];i[0]=(i[0]+o)*360/a-180;let n=180-(i[1]+s)*360/a;i[1]=360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90}})(t,r,this.extent)):kn(this,i,function t(r,i){if(Array.isArray(r[0])){for(let n of r)t(n,i);return}r[0]/=i,r[1]/=i})}toBinaryFeature(t,r){let i=this.loadFlatGeometry();return"wgs84"===t?this._toBinaryCoordinates(i,t=>(function(t,r,i){let{x:n,y:a,z:o}=r,s=i*Math.pow(2,o),l=i*n,u=i*a;for(let r=0,i=t.length;r<i;r+=2){t[r]=(t[r]+l)*360/s-180;let i=180-(t[r+1]+u)*360/s;t[r+1]=360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90}})(t,r,this.extent)):this._toBinaryCoordinates(i,kr)}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,i=1,n=0,a=0,o=0,s=1/0,l=-1/0,u=1/0,c=-1/0;for(;t.pos<r;){if(n<=0){let r=t.readVarint();i=7&r,n=r>>3}if(n--,1===i||2===i)a+=t.readSVarint(),o+=t.readSVarint(),a<s&&(s=a),a>l&&(l=a),o<u&&(u=o),o>c&&(c=o);else if(7!==i)throw Error(`unknown command ${i}`)}return[s,u,l,c]}_toBinaryCoordinates(t,r){let i;switch(r(t.data,this.extent),this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,i={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/2,i={type:"LineString",...t};break;case 3:for(let r of(i=function(t){let r,i=t.indices.length,n="Polygon";if(i<=1)return{type:n,data:t.data,areas:[[Ia(t.data)]],indices:[t.indices]};let a=[],o=[],s=[],l=[],u=0;for(let n,c=0,h;c<i;c++){h=t.indices[c]-u,n=t.indices[c+1]-u||t.data.length;let i=Ia(t.data.slice(h,n));if(0===i){let r=t.data.slice(0,h),i=t.data.slice(n);t.data=r.concat(i),u+=n-h;continue}void 0===r&&(r=i<0),r===i<0?(l.length&&(a.push(s),o.push(l)),l=[h],s=[i]):(s.push(i),l.push(h))}return a.push(s),l.length&&o.push(l),{type:n,areas:a,indices:o,data:t.data}}(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=i.indices.length,i.indices))this._geometryInfo.polygonRingsCount+=r.length;this._geometryInfo.polygonPositionsCount+=i.data.length/2;break;default:throw Error(`Invalid geometry type: ${this.type}`)}let n={type:"Feature",geometry:i,properties:this.properties};return null!==this.id&&(n.id=this.id),n}loadGeometry(){let t,r=this._pbf;r.pos=this._geometry;let i=r.readVarint()+r.pos,n=1,a=0,o=0,s=0,l=[];for(;r.pos<i;){if(a<=0){let t=r.readVarint();n=7&t,a=t>>3}switch(a--,n){case 1:case 2:o+=r.readSVarint(),s+=r.readSVarint(),1===n&&(t&&l.push(t),t=[]),t&&t.push([o,s]);break;case 7:t&&t.push(t[0].slice());break;default:throw Error(`unknown command ${n}`)}}return t&&l.push(t),l}loadFlatGeometry(){let t,r=this._pbf;r.pos=this._geometry;let i=r.readVarint()+r.pos,n=1,a=0,o=0,s=0,l=0,u=[],c=[];for(;r.pos<i;)if(a<=0&&(n=7&(t=r.readVarint()),a=t>>3),a--,1===n||2===n)o+=r.readSVarint(),s+=r.readSVarint(),1===n&&u.push(l),c.push(o,s),l+=2;else if(7===n){if(l>0){let t=u[u.length-1];c.push(c[t],c[t+1]),l+=2}}else throw Error(`unknown command ${n}`);return{data:c,indices:u}}}function kn(t,r,i){let n,a,o,s=ki.types[t.type];switch(t.type){case 1:let l=[];for(n=0;n<r.length;n++)l[n]=r[n][0];i(o=l,t.extent);break;case 2:for(o=r,n=0;n<o.length;n++)i(o[n],t.extent);break;case 3:for(o=function(t){let r,i,n=t.length;if(n<=1)return[t];let a=[];for(let o=0;o<n;o++){let n=function(t){let r=0;for(let i=0,n=t.length-1,a,o;i<t.length;n=i++)a=t[i],r+=((o=t[n])[0]-a[0])*(a[1]+o[1]);return r}(t[o]);0!==n&&(void 0===i&&(i=n<0),i===n<0?(r&&a.push(r),r=[t[o]]):r&&r.push(t[o]))}return r&&a.push(r),a}(r),n=0;n<o.length;n++)for(a=0;a<o[n].length;a++)i(o[n][a],t.extent);break;default:throw Error("illegal vector tile type")}1===o.length?o=o[0]:s=`Multi${s}`;let u={type:"Feature",geometry:{type:s,coordinates:o},properties:t.properties};return null!==t.id&&(u.id=t.id),u}function ka(t,r,i){r&&i&&(1===t?r.id=i.readVarint():2===t?function(t,r){let i=t.readVarint()+t.pos;for(;t.pos<i;){let i=r._keys[t.readVarint()],n=r._values[t.readVarint()];r.properties[i]=n}}(i,r):3===t?r.type=i.readVarint():4===t&&(r._geometry=i.pos))}class ko{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ks,this,r),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new ki(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let i=this._pbf.readVarint()+this._pbf.pos;return new ki(this._pbf,i,this.extent,this._keys,this._values,r)}}function ks(t,r,i){r&&i&&(15===t?r.version=i.readVarint():1===t?r.name=i.readString():5===t?r.extent=i.readVarint():2===t?r._features.push(i.pos):3===t?r._keys.push(i.readString()):4===t&&r._values.push(function(t){let r=null,i=t.readVarint()+t.pos;for(;t.pos<i;){let i=t.readVarint()>>3;r=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return r}
6584(i)))}class kl{layers;constructor(t,r){this.layers=t.readFields(ku,{},r)}}function ku(t,r,i){if(3===t&&i){let t=new ko(i,i.readVarint()+i.pos);t.length&&r&&(r[t.name]=t)}}function kc(t,r){let i=function(t){if(!t?.mvt)throw Error("mvt options required");if(t.mvt?.coordinates==="wgs84"&&!t.mvt.tileIndex)throw Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.gis&&At.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),t.mvt}(r),n=r?.gis?.format||r?.mvt?.shape||r?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:kh(t,i)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:kf(t,i)};case"geojson":return kf(t,i);case"binary-geometry":case"binary":return kh(t,i);default:throw Error(n||"undefined shape")}}function kh(t,r){let i,n,[a,o]=function(t,r){let i=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[i,n];let a=new kl(new kt.default(t));return(r&&Array.isArray(r.layers)?r.layers:Object.keys(a.layers)).forEach(t=>{let o=a.layers[t];if(o)for(let a=0;a<o.length;a++){let s=function(t,r,i){let n=t.toBinaryFeature(r.coordinates||"local",r.tileIndex);return r.layerProperty&&n.properties&&(n.properties[r.layerProperty]=i),n}(o.getBinaryFeature(a,n),r,t);i.push(s)}}),[i,n]}(t,r),s=(n=Object.keys(i=function(t){let r={};for(let a of t)if(a.properties)for(let t in a.properties){var i,n;let o=a.properties[t];r[t]=(i=o,(n=r[t])!==Array&&Number.isFinite(i)?n===Float64Array||Math.fround(i)!==i?Float64Array:Float32Array:Array)}return r}(a)).filter(t=>i[t]!==Array),function(t,r,i){var n,a,o,s;let l,{pointPositionsCount:u,pointFeaturesCount:c,linePositionsCount:h,linePathsCount:f,lineFeaturesCount:d,polygonPositionsCount:p,polygonObjectsCount:m,polygonRingsCount:g,polygonFeaturesCount:y,propArrayTypes:v,coordLength:_}=r,{numericPropKeys:b=[],PositionDataType:x=Float32Array,triangulate:w=!0}=i,E=t[0]&&"id"in t[0],T=t.length>65535?Uint32Array:Uint16Array,A={type:"Point",positions:new x(u*_),globalFeatureIds:new T(u),featureIds:c>65535?new Uint32Array(u):new Uint16Array(u),numericProps:{},properties:[],fields:[]},S={type:"LineString",pathIndices:h>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new x(h*_),globalFeatureIds:new T(h),featureIds:d>65535?new Uint32Array(h):new Uint16Array(h),numericProps:{},properties:[],fields:[]},C={type:"Polygon",polygonIndices:p>65535?new Uint32Array(m+1):new Uint16Array(m+1),primitivePolygonIndices:p>65535?new Uint32Array(g+1):new Uint16Array(g+1),positions:new x(p*_),globalFeatureIds:new T(p),featureIds:y>65535?new Uint32Array(p):new Uint16Array(p),numericProps:{},properties:[],fields:[]};for(let t of(w&&(C.triangles=[]),[A,S,C]))for(let r of b){let i=v[r];t.numericProps[r]=new i(t.positions.length/_)}S.pathIndices[f]=h,C.polygonIndices[m]=p,C.primitivePolygonIndices[g]=p;let M={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let r of t){let t=r.geometry,i=r.properties||{};switch(t.type){case"Point":(function(t,r,i,n,a){r.positions.set(t.data,i.pointPosition*n);let o=t.data.length/n;I9(r,a,i.pointPosition,o),r.globalFeatureIds.fill(i.feature,i.pointPosition,i.pointPosition+o),r.featureIds.fill(i.pointFeature,i.pointPosition,i.pointPosition+o),i.pointPosition+=o})(t,A,M,_,i),A.properties.push(ke(i,b)),E&&A.fields.push({id:r.id}),M.pointFeature++;break;case"LineString":(function(t,r,i,n,a){r.positions.set(t.data,i.linePosition*n);let o=t.data.length/n;I9(r,a,i.linePosition,o),r.globalFeatureIds.fill(i.feature,i.linePosition,i.linePosition+o),r.featureIds.fill(i.lineFeature,i.linePosition,i.linePosition+o);for(let a=0,o=t.indices.length;a<o;++a){let s=t.indices[a],l=a===o-1?t.data.length:t.indices[a+1];r.pathIndices[i.linePath++]=i.linePosition,i.linePosition+=(l-s)/n}})(t,S,M,_,i),S.properties.push(ke(i,b)),E&&S.fields.push({id:r.id}),M.lineFeature++;break;case"Polygon":(function(t,r,i,n,a){r.positions.set(t.data,i.polygonPosition*n);let o=t.data.length/n;I9(r,a,i.polygonPosition,o),r.globalFeatureIds.fill(i.feature,i.polygonPosition,i.polygonPosition+o),r.featureIds.fill(i.polygonFeature,i.polygonPosition,i.polygonPosition+o);for(let a=0,o=t.indices.length;a<o;++a){let o=i.polygonPosition;r.polygonIndices[i.polygonObject++]=o;let s=t.areas[a],l=t.indices[a],u=t.indices[a+1];for(let a=0,o=l.length;a<o;++a){let s=l[a],c=a===o-1?void 0===u?t.data.length:u[0]:l[a+1];r.primitivePolygonIndices[i.polygonRing++]=i.polygonPosition,i.polygonPosition+=(c-s)/n}!function(t,r,i,{startPosition:n,endPosition:a,coordLength:o}
6584){if(!t.triangles)return;let s=t.positions.subarray(n*o,a*o),l=i[0],u=function(t,r,i=2,n,a="xy"){let o,s,l,u,c,h,f,d=r&&r.length,p=d?r[0]*i:t.length,m=IW(t,0,p,i,!0,n&&n[0],a),g=[];if(!m||m.next===m.prev)return g;if(d&&(m=function(t,r,i,n,a,o){let s,l,u,c,h,f=[];for(s=0,l=r.length;s<l;s++)u=r[s]*n,c=s<l-1?r[s+1]*n:t.length,(h=IW(t,u,c,n,!1,a&&a[s+1],o))===h.next&&(h.steiner=!0),f.push(function(t){let r=t,i=t;do(r.x<i.x||r.x===i.x&&r.y<i.y)&&(i=r),r=r.next;while(r!==t)return i}(h));for(f.sort(IY),s=0;s<f.length;s++)i=function(t,r){let i=function(t,r){let i,n,a=r,o=t.x,s=t.y,l=-1/0;do{if(s<=a.y&&s>=a.next.y&&a.next.y!==a.y){let t=a.x+(s-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(t<=o&&t>l&&(l=t,i=a.x<a.next.x?a:a.next,t===o))return i}a=a.next}while(a!==r)if(!i)return null;let u=i,c=i.x,h=i.y,f=1/0;a=i;do{var d,p;o>=a.x&&a.x>=c&&o!==a.x&&IK(s<h?o:l,s,c,h,s<h?l:o,s,a.x,a.y)&&(n=Math.abs(s-a.y)/(o-a.x),I3(a,t)&&(n<f||n===f&&(a.x>i.x||a.x===i.x&&(d=i,p=a,0>IQ(d.prev,d,p.prev)&&0>IQ(p.next,d,d.next))))&&(i=a,f=n)),a=a.next}while(a!==u)return i}(t,r);if(!i)return r;let n=I4(i,t);return IZ(n,n.next),IZ(i,i.next)}(f[s],i);return i}(t,r,m,i,n,a)),t.length>80*i){u=s=t[0],c=l=t[1];for(let r=i;r<p;r+=i)h=t[r],f=t[r+1],h<u&&(u=h),f<c&&(c=f),h>s&&(s=h),f>l&&(l=f);o=0!==(o=Math.max(s-u,l-c))?32767/o:0}return function t(r,i,n,a,o,s,l){let u,c;if(!r)return;!l&&s&&function(t,r,i,n){let a=t;do 0===a.z&&(a.z=IX(a.x,a.y,r,i,n)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==t)a.prevZ.nextZ=null,a.prevZ=null,function(t){let r,i,n,a,o,s,l,u,c=1;do{for(a=t,t=null,u=null,n=0;a;){for(n++,s=a,o=0,i=0;i<c&&(o++,s=s.nextZ);i++);for(l=c;o>0||l>0&&s;)0!==o&&(0===l||!s||a.z<=s.z)?(r=a,a=a.nextZ,o--):(r=s,s=s.nextZ,l--),u?u.nextZ=r:t=r,r.prevZ=u,u=r;a=s}u.nextZ=null,c*=2}while(n>1)}(a)}(r,a,o,s);let h=r;for(;r.prev!==r.next;){if(u=r.prev,c=r.next,s?function(t,r,i,n){let a=t.prev,o=t.next;if(IQ(a,t,o)>=0)return!1;let s=a.x,l=t.x,u=o.x,c=a.y,h=t.y,f=o.y,d=s<l?s<u?s:u:l<u?l:u,p=c<h?c<f?c:f:h<f?h:f,m=s>l?s>u?s:u:l>u?l:u,g=c>h?c>f?c:f:h>f?h:f,y=IX(d,p,r,i,n),v=IX(m,g,r,i,n),_=t.prevZ,b=t.nextZ;for(;_&&_.z>=y&&b&&b.z<=v;){if(_.x>=d&&_.x<=m&&_.y>=p&&_.y<=g&&_!==a&&_!==o&&IK(s,c,l,h,u,f,_.x,_.y)&&IQ(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=d&&b.x<=m&&b.y>=p&&b.y<=g&&b!==a&&b!==o&&IK(s,c,l,h,u,f,b.x,b.y)&&IQ(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=m&&_.y>=p&&_.y<=g&&_!==a&&_!==o&&IK(s,c,l,h,u,f,_.x,_.y)&&IQ(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=v;){if(b.x>=d&&b.x<=m&&b.y>=p&&b.y<=g&&b!==a&&b!==o&&IK(s,c,l,h,u,f,b.x,b.y)&&IQ(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(r,a,o,s):function(t){let r=t.prev,i=t.next;if(IQ(r,t,i)>=0)return!1;let n=r.x,a=t.x,o=i.x,s=r.y,l=t.y,u=i.y,c=n<a?n<o?n:o:a<o?a:o,h=s<l?s<u?s:u:l<u?l:u,f=n>a?n>o?n:o:a>o?a:o,d=s>l?s>u?s:u:l>u?l:u,p=i.next;for(;p!==r;){if(p.x>=c&&p.x<=f&&p.y>=h&&p.y<=d&&IK(n,s,a,l,o,u,p.x,p.y)&&IQ(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(r)){i.push(u.i/n|0),i.push(r.i/n|0),i.push(c.i/n|0),I5(r),r=c.next,h=c.next;continue}if((r=c)===h){l?1===l?t(r=function(t,r,i){let n=t;do{let a=n.prev,o=n.next.next;!IJ(a,o)&&I0(a,n,n.next,o)&&I3(a,o)&&I3(o,a)&&(r.push(a.i/i|0),r.push(n.i/i|0),r.push(o.i/i|0),I5(n),I5(n.next),n=t=o),n=n.next}while(n!==t)return IZ(n)}(IZ(r),i,n),i,n,a,o,s,2):2===l&&function(r,i,n,a,o,s){let l=r;do{let r=l.next.next;for(;r!==l.prev;){var u,c;if(l.i!==r.i&&(u=l,c=r,u.next.i!==c.i&&u.prev.i!==c.i&&!function(t,r){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==r.i&&i.next.i!==r.i&&I0(i,i.next,t,r))return!0;i=i.next}while(i!==t)return!1}(u,c)&&(I3(u,c)&&I3(c,u)&&function(t,r){let i=t,n=!1,a=(t.x+r.x)/2,o=(t.y+r.y)/2;do i.y>o!=i.next.y>o&&i.next.y!==i.y&&a<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next;while(i!==t)return n}(u,c)&&(IQ(u.prev,u,c.prev)||IQ(u,c.prev,c))||IJ(u,c)&&IQ(u.prev,u,u.next)>0&&IQ(c.prev,c,c.next)>0))){let u=I4(l,r);l=IZ(l,l.next),u=IZ(u,u.next),t(l,i,n,a,o,s,0),t(u,i,n,a,o,s,0);return}r=r.next}l=l.next}while(l!==r)}(r,i,n,a,o,s):t(IZ(r),i,n,a,o,s,1);break}}}(m,g,i,u,c,o,0),g}(s,i.slice(1).map(t=>(t-l)/o),o,r);for(let r=0,i=u.length;r<i;++r)t.triangles.push(n+u[r])}(r,s,l,{startPosition:o,endPosition:i.polygonPosition,coordLength:n})}})(t,C,M,_,i),C.properties.push(ke(i,b)),E&&C.fields.push({id:r.id}),M.polygonFeature++;break;default:throw Error("Invalid geometry type")}M.feature++}return n=A,a=S,o=C,s=_,(l={shape:"binary-feature-collection",points:{...n,positions:{value:n.positions,size:s},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:I7(n.numericProps,1)},lines:{...a,positions:{value:a.positions,size:s},pathIndices:{value:a.pathIndices,size:1},globalFeatureIds:{value:a.globalFeatureIds,size:1},featureIds:{value:a.featureIds,size:1},numericProps:I7(a.numericProps,1)},polygons:{...o,positions:{value:o.positions,size:s},polygonIndices:{value:o.polygonIndices,size:1},primitivePolygonIndices:{value:o.primitivePolygonIndices,size:1},globalFeatureIds:{value:o.globalFeatureIds,size:1},featureIds:{value:o.featureIds,size:1},numericProps:I7(o.numericProps,1)}}).polygons&&o.triangles&&(l.polygons.triangles={value:new Uint32Array(o.triangles),size:1}),l}(a,{propArrayTypes:i,...o},{numericPropKeys:n,PositionDataType:Float32Array,triangulate:!0}));return s.byteLength=t.byteLength,s}function kf(t,r){if(t.byteLength<=0)return[];let i=[],n=new kl(new kt.default(t));return(Array.isArray(r.layers)?r.layers:Object.keys(n.layers)).forEac
6584h(t=>{let a=n.layers[t];if(a)for(let n=0;n<a.length;n++){let o=function(t,r,i){let n=t.toGeoJSONFeature(r.coordinates||"local",r.tileIndex);return r.layerProperty&&(n.properties||={},n.properties[r.layerProperty]=i),n}(a.getGeoJSONFeature(n),r,t);i.push(o)}}),i}let kd={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],category:"geometry",dataType:null,batchType:null,version:"4.5.2",worker:!0,options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}};function kp(t,r,i){r=r||0,i=i||t.value.length/t.size;let n=[];for(let a=r;a<i;a++){let r=[];for(let i=a*t.size;i<(a+1)*t.size;i++)r.push(Number(t.value[i]));n.push(r)}return n}function km(t,r){let i=r?.globalFeatureId;return void 0!==i?function(t,r){for(let i of kg(t)){let t=0,n=i.featureIds.value[0];for(let a=0;a<i.featureIds.value.length;a++){let o=i.featureIds.value[a];if(o!==n){if(r===i.globalFeatureIds.value[t])return ky(i,t,a);t=a,n=o}}if(r===i.globalFeatureIds.value[t])return ky(i,t,i.featureIds.value.length)}throw Error(`featureId:${r} not found`)}(t,i):function(t){let r=[];for(let i of t){if(0===i.featureIds.value.length)continue;let t=0,n=i.featureIds.value[0];for(let a=0;a<i.featureIds.value.length;a++){let o=i.featureIds.value[a];o!==n&&(r.push(ky(i,t,a)),t=a,n=o)}r.push(ky(i,t,i.featureIds.value.length))}return r}(kg(t,r?.type))}function kg(t,r){let i=[];return t.points&&(t.points.type="Point",i.push(t.points)),t.lines&&(t.lines.type="LineString",i.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",i.push(t.polygons)),i}function ky(t,r,i){let n=function(t,r,i){switch(t.type){case"Point":return function(t,r,i){let{positions:n}=t,a=kp(n,r,i);return a.length>1?{type:"MultiPoint",coordinates:a}:{type:"Point",coordinates:a[0]}}(t,r,i);case"LineString":return function(t,r=-1/0,i=1/0){let{positions:n}=t,a=t.pathIndices.value.filter(t=>t>=r&&t<=i);if(!(a.length>2))return{type:"LineString",coordinates:kp(n,a[0],a[1])};let o=[];for(let t=0;t<a.length-1;t++){let r=kp(n,a[t],a[t+1]);o.push(r)}return{type:"MultiLineString",coordinates:o}}(t,r,i);case"Polygon":return function t(r,i=-1/0,n=1/0){let{positions:a}=r,o=r.polygonIndices.value.filter(t=>t>=i&&t<=n),s=r.primitivePolygonIndices.value.filter(t=>t>=i&&t<=n);if(!(o.length>2)){let t=[];for(let r=0;r<s.length-1;r++){let i=kp(a,s[r],s[r+1]);t.push(i)}return{type:"Polygon",coordinates:t}}let l=[];for(let i=0;i<o.length-1;i++){let n=t(r,o[i],o[i+1]).coordinates;l.push(n)}return{type:"MultiPolygon",coordinates:l}}(t,r,i);default:throw Error(`Unsupported geometry type: ${t?.type}`)}}(t,r,i);return{type:"Feature",geometry:n,properties:function(t,r=0){let i=Object.assign({},t.properties[t.featureIds.value[r]]);for(let n in t.numericProps)i[n]=t.numericProps[n].value[r];return i}(t,r),...function(t,r=0){return t.fields&&t.fields[t.featureIds.value[r]]}(t,r)}}({...kd,parse:async(t,r)=>kc(t,r),parseSync:kc,binary:!0});let kv={Point:k_,MultiPoint:function(t,r,i){return kb(t,r,i)},LineString:function(t,r,i){return kb(t,r,i)},MultiLineString:function(t,r,i){return t.map(t=>kb(t,r,i))},Polygon:kx,MultiPolygon:function(t,r,i){return t.map(t=>kx(t,r,i))}};function k_([t,r],[i,n],a){let o=ww(i[0],n[0],t),s=ww(i[1],n[1],r);return a.unprojectFlat([o,s])}function kb(t,r,i){return t.map(t=>k_(t,r,i))}function kx(t,r,i){return t.map(t=>kb(t,r,i))}let kw=["points","lines","polygons"];function kE(t,r,i,n){for(let a=i;a<n;a++)if(r(t[a],a))return a;return -1}let kT={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class kA{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...kT,...t},this.stats=new E1.Stats({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}setProps(t){void 0!==t.throttleRequests&&(this.props.throttleRequests=t.throttleRequests),void 0!==t.maxRequests&&(this.props.maxRequests=t.maxRequests),void 0!==t.debounceTime&&(this.props.debounceTime=t.debounceTime)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);
6584let i={handle:t,priority:0,getPriority:r},n=new Promise(t=>(i.resolve=t,i));return this.requestQueue.push(i),this.requestMap.set(t,n),this._issueNewRequests(),n}_issueRequest(t){let{handle:r,resolve:i}=t,n=!1,a=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:a}):Promise.resolve({done:a})}_issueNewRequests(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){null!==this.updateTimer&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let r=0;r<t;++r){let t=this.requestQueue.shift();t&&this._issueRequest(t)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let i=t[r];!this._updateRequest(i)&&(t.splice(r,1),this.requestMap.delete(i.handle),r--)}t.sort((t,r)=>t.priority-r.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0)||(t.resolve(null),!1)}}class kS{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,getRequestPriority:r,requestScheduler:i,onLoad:n,onError:a}){let o,{index:s,id:l,bbox:u,userData:c,zoom:h}=this,f=this._loaderId;this._abortController=new AbortController;let{signal:d}=this._abortController,p=await i.scheduleRequest(this,r);if(!p){this._isCancelled=!0;return}if(this._isCancelled)return void p.done();let m=null;try{m=await t({index:s,id:l,bbox:u,userData:c,zoom:h,signal:d})}catch(t){o=t||!0}finally{p.done()}if(f===this._loaderId){if(this._loader=void 0,this.content=m,this._isCancelled&&!m){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,o?a(o,this):n(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}}let kC=new wQ,kM=new wQ;class kD{constructor(t=[0,0,0],r=[0,0,0],i){i=i||kC.copy(t).add(r).scale(.5),this.center=new wQ(i),this.halfDiagonal=new wQ(r).subtract(this.center),this.minimum=new wQ(t),this.maximum=new wQ(r)}clone(){return new kD(this.minimum,this.maximum,this.center)}equals(t){return this===t||!!t&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:r}=this,i=kM.from(t.normal),n=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),a=this.center.dot(i)+t.distance;return a-n>0?1:a+n<0?-1:0}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r,i=kC.from(t).subtract(this.center),{halfDiagonal:n}=this,a=0;return(r=Math.abs(i.x)-n.x)>0&&(a+=r*r),(r=Math.abs(i.y)-n.y)>0&&(a+=r*r),(r=Math.abs(i.z)-n.z)>0&&(a+=r*r),a}}var bY=bY;let kP=new wQ,kI=new wQ;class kk{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new wQ,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=kP.from(r),this.center=new wQ().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new kk(this.center,this.radius)}union(t){let r=this.center,i=this.radius,n=t.center,a=t.radius,o=kP.copy(n).subtract(r),s=o.magnitude();if(i>=s+a)return this.clone();if(a>=s+i)return t.clone();let l=(i+s+a)*.5;return kI.copy(o).scale((-i+l)/s).add(r),this.center.copy(kI),this.radius=l,this}expand(t){let r=kP.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let r=bY.getScaling(kP,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){return Math.max(0,kP.from(t).subtract(this.center).len()-this.radius)}intersectPlane(t){let r=this.center,i=this.radius,n=t.normal.dot(r)+t.distance;return n<-i?-1:n<i?0:1}}(ec=eg||(eg={}))[ec.COL0ROW0=0]="COL0ROW0",ec[ec.COL0ROW1=1]="COL0ROW1",ec[ec.COL0ROW2=2]="COL0ROW2",ec[ec.COL1ROW0=3]="COL1ROW0",ec[ec.COL1ROW1=4]="COL1ROW1",ec[ec.COL1ROW2=5]="COL1ROW2",ec[ec.COL2ROW0=6]="COL2ROW0",ec[ec.COL2ROW1=7]="COL2ROW1",ec[ec.COL2ROW2=8]="COL2ROW2";let kO=Object.freeze([1,0,0,0,1,0,0,0,1]);class kN extends wJ{static get IDENTITY(){return kL||Object.freeze(kL=new kN),kL}static get ZERO(){return j||Object.freeze(j=new kN([0,0,0,0,0,0,0,0,0])),j}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return eg}constructor(t,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1==arguments.length&&Array.isArray(t)?this.copy(t):r.length>0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5
6584]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(kO)}fromObject(t){return this.check()}fromQuaternion(t){let r,i,n,a,o,s,l,u,c,h,f,d,p,m,g,y;return r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,l=n+n,u=r*o,c=i*o,h=i*s,f=n*o,d=n*s,p=n*l,m=a*o,g=a*s,y=a*l,this[0]=1-h-p,this[3]=c-y,this[6]=f+g,this[1]=c+y,this[4]=1-u-p,this[7]=d-m,this[2]=f-g,this[5]=d+m,this[8]=1-u-h,this.check()}set(t,r,i,n,a,o,s,l,u){return this[0]=t,this[1]=r,this[2]=i,this[3]=n,this[4]=a,this[5]=o,this[6]=s,this[7]=l,this[8]=u,this.check()}setRowMajor(t,r,i,n,a,o,s,l,u){return this[0]=t,this[1]=n,this[2]=s,this[3]=r,this[4]=a,this[5]=l,this[6]=i,this[7]=o,this[8]=u,this.check()}determinant(){let t,r,i,n,a,o,s,l,u;return t=this[0],r=this[1],i=this[2],n=this[3],a=this[4],o=this[5],s=this[6],l=this[7],t*((u=this[8])*a-o*l)+r*(-u*n+o*s)+i*(l*n-a*s)}transpose(){return!function(t,r){if(t===r){let i=r[1],n=r[2],a=r[5];t[1]=r[3],t[2]=r[6],t[3]=i,t[5]=r[7],t[6]=n,t[7]=a}else t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8]}(this,this),this.check()}invert(){let t,r,i,n,a,o,s,l,u,c,h,f,d;return t=this[0],r=this[1],i=this[2],n=this[3],a=this[4],o=this[5],s=this[6],l=this[7],c=(u=this[8])*a-o*l,(d=t*c+r*(h=-u*n+o*s)+i*(f=l*n-a*s))&&(d=1/d,this[0]=c*d,this[1]=(-u*r+i*l)*d,this[2]=(o*r-i*a)*d,this[3]=h*d,this[4]=(u*t-i*s)*d,this[5]=(-o*t+i*n)*d,this[6]=f*d,this[7]=(-l*t+r*s)*d,this[8]=(a*t-r*n)*d),this.check()}multiplyLeft(t){return CB(this,t,this),this.check()}multiplyRight(t){return CB(this,this,t),this.check()}rotate(t){let r,i,n,a,o,s,l,u,c,h,f;return r=this[0],i=this[1],n=this[2],a=this[3],o=this[4],s=this[5],l=this[6],u=this[7],c=this[8],h=Math.sin(t),f=Math.cos(t),this[0]=f*r+h*a,this[1]=f*i+h*o,this[2]=f*n+h*s,this[3]=f*a-h*r,this[4]=f*o-h*i,this[5]=f*s-h*n,this[6]=l,this[7]=u,this[8]=c,this.check()}scale(t){return Array.isArray(t)?Cz(this,this,t):Cz(this,this,[t,t]),this.check()}translate(t){let r,i,n,a,o,s,l,u,c,h,f;return r=this[0],i=this[1],n=this[2],a=this[3],o=this[4],s=this[5],l=this[6],u=this[7],c=this[8],h=t[0],f=t[1],this[0]=r,this[1]=i,this[2]=n,this[3]=a,this[4]=o,this[5]=s,this[6]=h*r+f*a+l,this[7]=h*i+f*o+u,this[8]=h*n+f*s+c,this.check()}transform(t,r){let i;switch(t.length){case 2:i=w7(r||[-0,-0],t,this);break;case 3:i=wV(r||[-0,-0,-0],t,this);break;case 4:i=wX(r||[-0,-0,-0,-0],t,this);break;default:throw Error("Illegal vector")}return wS(i,t.length),i}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}}let kL=null,kR=new wQ,kF=new wQ,kB=new wQ,kz=new wQ,kj=new wQ,kU=new wQ,kV=new wQ;class k${constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new wQ().from(t),this.halfAxes=new kN(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new wQ(t).len(),new wQ(r).len(),new wQ(i).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2),n=new wQ(t).normalize(),a=new wQ(r).normalize(),o=new wQ(i).normalize();return new Cq().fromMatrix3(new kN([...n,...a,...o]))}fromCenterHalfSizeQuaternion(t,r,i){let n=new Cq(i),a=new kN().fromQuaternion(n);return a[0]=a[0]*r[0],a[1]=a[1]*r[0],a[2]=a[2]*r[0],a[3]=a[3]*r[1],a[4]=a[4]*r[1],a[5]=a[5]*r[1],a[6]=a[6]*r[2],a[7]=a[7]*r[2],a[8]=a[8]*r[2],this.center=new wQ().from(t),this.halfAxes=a,this}clone(){return new k$(this.center,this.halfAxes)}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new kk){let r=this.halfAxes,i=r.getColumn(0,kB),n=r.getColumn(1,kz),a=r.getColumn(2,kj),o=kR.copy(i).add(n).add(a);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let r=this.center,i=t.normal,n=this.halfAxes,a=i.x,o=i.y,s=i.z,l=Math.abs(a*n[0]+o*n[1]+s*n[2])+Math.abs(a*n[3]+o*n[4]+s*n[5])+Math.abs(a*n[6]+o*n[7]+s*n[8]),u=i.dot(r)+t.distance;return u<=-l?-1:1*!!(u>=l)}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r,i=kF.from(t).subtract(this.center),n=this.halfAxes,a=n.getColumn(0,kB),o=n.getColumn(1,kz),s=n.getColumn(2,kj),l=a.magnitude(),u=o.magnitude(),c=s.magnitude();a.normalize(),o.normalize(),s.normalize();let h=0;return(r=Math.abs(i.dot(a))-l)>0&&(h+=r*r),(r=Math.abs(i.dot(o))-u)>0&&(h+=r*r),(r=Math.abs(i.dot(s))-c)>0&&(h+=r*r),h}computePlaneDistances(t,r,i=[-0,-0]){let n=1/0,a=-1/0,o=this.center,s=this.halfAxes,l=s.getColumn(0,kB),u=s.getColumn(1,kz),c=s.getColumn(2,kj),h=kU.copy(l).add(u).add(c).add(o),f=kV.copy(h).subtract(t),d=r.dot(f);return n=Math.min(d,n),a=Math.max(d,a),h.copy(o).add(l).add(u).subtract(c),f.copy(h).subtract(t),n=Math.min(d=r.dot(f),n),a=Math.max(d,a),h.copy(o).add(l).subtract(u).add(c),f.copy(h).subtract(t),n=Math.min(d=r.dot(f),n),a=Math.max(d,a),h.copy(o).add(l).subtract(u).subtract(c),f.copy(h).subtract(t),n=Math.min(d=r.dot(f),n),a=Math.max(d,a),o.copy(h).subtract(l).add(u).add(c),f.copy(h).subtract(t),n=Math.min(d=r.dot(f),n),a=Math.max(d,a),o.copy(h).subtract(l).add(u).subtract(c),f.copy(h).subtract(t),n=Math.min(d=r.dot(f),n),a=Math.max(d,a),o.copy(h).subtract(l).subtract(u).add(c),f.copy(h).subtract(t),n=Math.min(d=r.dot(f),n),a=Math.max(d,a),o.copy(h).subtract(l).subtract(u).subtract(c),f.copy(h).subtract(t),n=Math.min(d=r.dot(f),n),a=Math.max(d,a),i[0]=n,i[1]=a,i}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,kB);r.transformAsPoint(t);let i=this.halfAxes.getColumn(1,kz);i.transformAsPoint(t);let n=this.halfAxes.getColumn(2,kj);return n.transformAsPoint(t),this.halfAxes=new kN([...r,...i,...n]),this}getTransform(){throw Error("not implemented")}}
6584let kG=new wQ,kq=new wQ;class kH{constructor(t=[0,0,1],r=0){this.normal=new wQ,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return wC(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=kG.from(t),this.normal.from(r).normalize();let i=-this.normal.dot(t);return this.distance=i,this}fromCoefficients(t,r,i,n){return this.normal.set(t,r,i),wC(wE(this.normal.len(),1)),this.distance=n,this}clone(){return new kH(this.normal,this.distance)}equals(t){return wE(this.distance,t.distance)&&wE(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=kq.copy(this.normal).transformAsVector(t).normalize(),i=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(i,r)}projectPointOntoPlane(t,r=[0,0,0]){let i=kG.from(t),n=this.getPointDistance(i),a=kq.copy(this.normal).scale(n);return i.subtract(a).to(r)}}let kW=[new wQ([1,0,0]),new wQ([0,1,0]),new wQ([0,0,1])],kZ=new wQ,kY=new wQ;class kX{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*kW.length;let r=t.center,i=t.radius,n=0;for(let t of kW){let a=this.planes[n],o=this.planes[n+1];a||(a=this.planes[n]=new kH),o||(o=this.planes[n+1]=new kH);let s=kZ.copy(t).scale(-i).add(r);a.fromPointNormal(s,t);let l=kZ.copy(t).scale(i).add(r),u=kY.copy(t).negate();o.fromPointNormal(l,u),n+=2}return this}computeVisibility(t){let r=1;for(let i of this.planes)switch(t.intersectPlane(i)){case -1:return -1;case 0:r=0}return r}computeVisibilityWithPlaneMask(t,r){if(wC(Number.isFinite(r),"parentPlaneMask is required."),r===kX.MASK_OUTSIDE||r===kX.MASK_INSIDE)return r;let i=kX.MASK_INSIDE,n=this.planes;for(let a=0;a<this.planes.length;++a){let o=a<31?1<<a:0;if(a<31&&(r&o)==0)continue;let s=n[a],l=t.intersectPlane(s);if(-1===l)return kX.MASK_OUTSIDE;0===l&&(i|=o)}return i}}kX.MASK_OUTSIDE=0xffffffff,kX.MASK_INSIDE=0,kX.MASK_INDETERMINATE=0x7fffffff,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ,new wQ;let kK=Math.PI/2,kQ=Math.PI/4,kJ=Math.PI/6,k0=2*Math.PI;t.s(["EPSILON1",0,.1,"EPSILON10",0,1e-10,"EPSILON11",0,1e-11,"EPSILON12",0,1e-12,"EPSILON13",0,1e-13,"EPSILON14",0,1e-14,"EPSILON15",0,1e-15,"EPSILON16",0,1e-16,"EPSILON17",0,1e-17,"EPSILON18",0,1e-18,"EPSILON19",0,1e-19,"EPSILON2",0,.01,"EPSILON20",0,1e-20,"EPSILON3",0,.001,"EPSILON4",0,1e-4,"EPSILON5",0,1e-5,"EPSILON6",0,1e-6,"EPSILON7",0,1e-7,"EPSILON8",0,1e-8,"EPSILON9",0,1e-9,"PI_OVER_FOUR",0,kQ,"PI_OVER_SIX",0,kJ,"PI_OVER_TWO",0,kK,"TWO_PI",0,k0],894069);var k1=t.i(894069),k1=k1;let k2=new kN,k3=new kN,k4=new kN,k6=new kN,k5=new kN,k8=[1,0,0],k7=[2,2,1],k9=new wQ,Oe=new wQ,Ot=new wQ,Or=new wQ,Oi=new wQ,On=new kN,Oa={diagonal:new kN,unitary:new kN},Oo=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],Os=Oo.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Ol=Os.concat([[.25,.5],[.75,.5]]);class Ou{constructor(t,r,i){this.x=t,this.y=r,this.z=i}get children(){if(!this._children){let t=2*this.x,r=2*this.y,i=this.z+1;this._children=[new Ou(t,r,i),new Ou(t,r+1,i),new Ou(t+1,r,i),new Ou(t+1,r+1,i)]}return this._children}update(t){let{viewport:r,cullingVolume:i,elevationBounds:n,minZ:a,maxZ:o,bounds:s,offset:l,project:u}=t,c=this.getBoundingVolume(n,l,u);if(s&&!this.insideBounds(s)||0>i.computeVisibility(c)||u&&this.beyondHorizon(r.cameraPosition,u,n[1]))return!1;if(!this.childVisible){let{z:t}=this;if(t<o&&t>=a&&(t+=Math.floor(Math.log2(c.distanceTo(r.cameraPosition)*r.scale/r.height))),t>=o)return this.selected=!0,!0}for(let r of(this.selected=!1,this.childVisible=!0,this.children))r.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let r of this._children)r.getSelected(t);return t}beyondHorizon(t,r,i){let n=t[0],a=t[1],o=t[2],s=Math.sqrt(n*n+a*a+o*o),l=180*Math.atan2(n,-a)/Math.PI,u=180*Math.asin(o/s)/Math.PI,[c,h]=Og(this.x,this.y,this.z),[f,d]=Og(this.x+1,this.y+1,this.z),p=(c+f)/2,m=r([Math.max(c,Math.min(p+((l-p+540)%360-180),f)),Math.max(d,Math.min(u,h)),i]);return m[0]*n+m[1]*a+m[2]*o<=m[0]*m[0]+m[1]*m[1]+m[2]*m[2]}insideBounds([t,r,i,n]){let a=512/Math.pow(2,this.z);return this.x*a<i&&this.y*a<n&&(this.x+1)*a>t&&(this.y+1)*a>r}getBoundingVolume(t,r,i){if(i){let r=this.z<1?Ol:this.z<2?Os:Oo,n=[];for(let a of r){let r=Og(this.x+a[0],this.y+a[1],this.z);r[2]=t[0],n.push(i(r)),t[0]!==t[1]&&(r[2]=t[1],n.push(i(r)))}return function(t,r=new k$){if(!t||0===t.length)return r.halfAxes=new kN([0,0,0,0,0,0,0,0,0]),r.center=new wQ,r;let i=t.length,n=new wQ(0,0,0);for(let r of t)n.add(r);let a=1/i;n.multiplyByScalar(a);let o=0,s=0,l=0,u=0,c=0,h=0;for(let r of t){let t=k9.copy(r).subtract(n);o+=t.x*t.x,s+=t.x*t.y,l+=t.x*t.z,u+=t.y*t.y,c+=t.y*t.z,h+=t.z*t.z}o*=a,s*=a,l*=a,u*=a,c*=a,h*=a,On[0]=o,On[1]=s,On[2]=l,On[3]=s,On[4]=u,On[5]=c,On[6]=l,On[7]=c,On[8]=
6584h;let{unitary:f}=function(t,r={}){let i=k1.EPSILON20,n=0,a=0;k3.identity(),k4.copy(t);let o=i*function(t){let r=0;for(let i=0;i<9;++i){let n=t[i];r+=n*n}return Math.sqrt(r)}(k4);for(;a<10&&function(t){let r=0;for(let i=0;i<3;++i){let n=t[k2.getElementIndex(k7[i],k8[i])];r+=2*n*n}return Math.sqrt(r)}(k4)>o;)(function(t,r){let i=k1.EPSILON15,n=0,a=1;for(let r=0;r<3;++r){let i=Math.abs(t[k2.getElementIndex(k7[r],k8[r])]);i>n&&(a=r,n=i)}let o=k8[a],s=k7[a],l=1,u=0;if(Math.abs(t[k2.getElementIndex(s,o)])>i){let r,i=(t[k2.getElementIndex(s,s)]-t[k2.getElementIndex(o,o)])/2/t[k2.getElementIndex(s,o)];l=1/Math.sqrt(1+(r=i<0?-1/(-i+Math.sqrt(1+i*i)):1/(i+Math.sqrt(1+i*i)))*r),u=r*l}kN.IDENTITY.to(r),r[k2.getElementIndex(o,o)]=r[k2.getElementIndex(s,s)]=l,r[k2.getElementIndex(s,o)]=u,r[k2.getElementIndex(o,s)]=-u})(k4,k6),k5.copy(k6).transpose(),k4.multiplyRight(k6),k4.multiplyLeft(k5),k3.multiplyRight(k6),++n>2&&(++a,n=0);return r.unitary=k3.toTarget(r.unitary),r.diagonal=k4.toTarget(r.diagonal),r}(On,Oa),d=r.halfAxes.copy(f),p=d.getColumn(0,Ot),m=d.getColumn(1,Or),g=d.getColumn(2,Oi),y=-Number.MAX_VALUE,v=-Number.MAX_VALUE,_=-Number.MAX_VALUE,b=Number.MAX_VALUE,x=Number.MAX_VALUE,w=Number.MAX_VALUE;for(let r of t)k9.copy(r),y=Math.max(k9.dot(p),y),v=Math.max(k9.dot(m),v),_=Math.max(k9.dot(g),_),b=Math.min(k9.dot(p),b),x=Math.min(k9.dot(m),x),w=Math.min(k9.dot(g),w);p=p.multiplyByScalar(.5*(b+y)),m=m.multiplyByScalar(.5*(x+v)),g=g.multiplyByScalar(.5*(w+_)),r.center.copy(p).add(m).add(g);let E=Oe.set(y-b,v-x,_-w).multiplyByScalar(.5),T=new kN([E[0],0,0,0,E[1],0,0,0,E[2]]);return r.halfAxes.multiplyRight(T),r}(n)}let n=512/Math.pow(2,this.z),a=this.x*n+512*r,o=512-(this.y+1)*n;return new kD([a,o,t[0]],[a+n,o+n,t[1]])}}let Oc=[-1/0,-1/0,1/0,1/0],Oh={type:"object",value:null,validate:(t,r)=>r.optional&&null===t||"string"==typeof t||Array.isArray(t)&&t.every(t=>"string"==typeof t),equal:(t,r)=>{if(t===r)return!0;if(!Array.isArray(t)||!Array.isArray(r))return!1;let i=t.length;if(i!==r.length)return!1;for(let n=0;n<i;n++)if(t[n]!==r[n])return!1;return!0}};function Of(t,r){let i=[r.transformAsPoint([t[0],t[1]]),r.transformAsPoint([t[2],t[1]]),r.transformAsPoint([t[0],t[3]]),r.transformAsPoint([t[2],t[3]])];return[Math.min(...i.map(t=>t[0])),Math.min(...i.map(t=>t[1])),Math.max(...i.map(t=>t[0])),Math.max(...i.map(t=>t[1]))]}function Od(t,r){if(!t||!t.length)return null;let{index:i,id:n}=r;if(Array.isArray(t)){let r=Math.abs(n.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))%t.length;t=t[r]}let a=t;for(let t of Object.keys(i)){let r=RegExp(`{${t}}`,"g");a=a.replace(r,String(i[t]))}return Number.isInteger(i.y)&&Number.isInteger(i.z)&&(a=a.replace(/\{-y\}/g,String(Math.pow(2,i.z)-i.y-1))),a}function Op({viewport:t,z:r,cullRect:i}){return(t.subViewports||[t]).map(t=>(function t(r,i,n){if(!Array.isArray(i)){let t=n.x-r.x,a=n.y-r.y,{width:o,height:s}=n,l={targetZ:i},u=r.unproject([t,a],l),c=r.unproject([t+o,a],l),h=r.unproject([t,a+s],l),f=r.unproject([t+o,a+s],l);return[Math.min(u[0],c[0],h[0],f[0]),Math.min(u[1],c[1],h[1],f[1]),Math.max(u[0],c[0],h[0],f[0]),Math.max(u[1],c[1],h[1],f[1])]}let a=t(r,i[0],n),o=t(r,i[1],n);return[Math.min(a[0],o[0]),Math.min(a[1],o[1]),Math.max(a[2],o[2]),Math.max(a[3],o[3])]})(t,r||0,i))}function Om(t,r){return 512*Math.pow(2,t)/r}function Og(t,r,i){let n=Om(i,512),a=Math.PI-2*Math.PI*r/n;return[t/n*360-180,180/Math.PI*Math.atan(.5*(Math.exp(a)-Math.exp(-a)))]}function Oy(t,r,i,n){let a=Om(i,n);return[t/a*512,r/a*512]}let Ov="best-available",O_={[Ov]:function(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&!Ox(r)&&Ow(r);for(let r of t)r.isVisible=!!(2&r.state)},"no-overlap":function(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&Ox(r);for(let r of Array.from(t).sort((t,r)=>t.zoom-r.zoom))if(r.isVisible=!!(2&r.state),r.children&&(r.isVisible||1&r.state))for(let t of r.children)t.state=1;else r.isSelected&&Ow(r)},never:()=>{}},Ob={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,visibleMinZoom:null,visibleMaxZoom:null,onTileLoad:()=>{}
6584,onTileUnload:()=>{},onTileError:()=>{}};function Ox(t){let r=t;for(;r;){if(r.isLoaded||r.content)return r.state|=2,!0;r=r.parent}return!1}function Ow(t){for(let r of t.children)r.isLoaded||r.content?r.state|=2:Ow(r)}let OE={TilesetClass:class{constructor(t){this._getCullBounds=function(t){let r,i={};return n=>{for(let a in n)if(!function(t,r){if(t===r)return!0;if(Array.isArray(t)){let i=t.length;if(!r||r.length!==i)return!1;for(let n=0;n<i;n++)if(t[n]!==r[n])return!1;return!0}return!1}(n[a],i[a])){r=t(n),i=n;break}return r}}(Op),this.opts={...Ob,...t},this.setOptions(this.opts),this.onTileLoad=t=>{this.opts.onTileLoad?.(t),null!==this.opts.maxCacheByteSize&&(this._cacheByteSize+=t.byteLength,this._resizeCache())},this._requestScheduler=new kA({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new Ei,this._modelMatrixInverse=new Ei}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return null!==this._selectedTiles&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return null!==this._selectedTiles&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom)),this._viewport=null}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let r=this._cache.get(t);this._selectedTiles&&this._selectedTiles.includes(r)?r.setNeedsReload():this._cache.delete(t)}}update(t,{zRange:r,modelMatrix:i}={zRange:null,modelMatrix:null}){let n=i?new Ei(i):new Ei,a=!n.equals(this._modelMatrix);if(this._viewport&&t.equals(this._viewport)&&wE(this._zRange,r)&&!a)this.needsReload&&(this._selectedTiles=this._selectedTiles.map(t=>this._getTile(t.index,!0)));else{a&&(this._modelMatrixInverse=n.clone().invert(),this._modelMatrix=n),this._viewport=t,this._zRange=r;let i=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=i.map(t=>this._getTile(t,!0)),this._dirty&&this._rebuildTree()}let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,r,i){if(!t.isVisible)return!1;if(r&&this._viewport){let n=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:a}=t;for(let[t,r,o,s]of n){let n;if("west"in a)n=a.west<o&&a.east>t&&a.south<s&&a.north>r;else{if(i&&!Ei.IDENTITY.equals(i)){let[t,r,n,o]=Of([a.left,a.top,a.right,a.bottom],i);a={left:t,top:r,right:n,bottom:o}}let l=Math.min(a.top,a.bottom),u=Math.max(a.top,a.bottom);n=a.left<o&&a.right>t&&l<s&&u>r}if(n)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:r,minZoom:i,zRange:n,modelMatrix:a,modelMatrixInverse:o}){let{tileSize:s,extent:l,zoomOffset:u,visibleMinZoom:c,visibleMaxZoom:h}=this.opts;return function({viewport:t,maxZoom:r,minZoom:i,zRange:n,extent:a,tileSize:o=512,modelMatrix:s,modelMatrixInverse:l,zoomOffset:u=0,visibleMinZoom:c,visibleMaxZoom:h}){let f=t.isGeospatial?Math.round(t.zoom+Math.log2(512/o)+u):Math.ceil(t.zoom+u);if("number"==typeof i&&Number.isFinite(i)&&f<i){if(!a)return[];f=i}if("number"==typeof r&&Number.isFinite(r)&&f>r&&(f=r),null!=c&&t.zoom<c||null!=h&&t.zoom>h)return[];let d=a;return s&&l&&a&&!t.isGeospatial&&(d=Of(a,s)),t.isGeospatial?function(t,r,i,n){let a=t instanceof CN?t.projectPosition:null,o=new kX(Object.values(t.getFrustumPlanes()).map(({normal:t,distance:r})=>new kH(t.clone().negate(),r))),s=t.distanceScales.unitsPerMeter[2],l=i&&i[0]*s||0,u=i&&i[1]*s||0,c=t instanceof AG&&t.pitch<=60?r:0;if(n){let[t,r,i,a]=n,o=Em([t,a]),s=Em([i,r]);n=[o[0],512-o[1],s[0],512-s[1]]}let h=new Ou(0,0,0),f={viewport:t,project:a,cullingVolume:o,elevationBounds:[l,u],minZ:c,maxZ:r,bounds:n,offset:0};if(h.update(f),t instanceof AG&&t.subViewports&&t.subViewports.length>1){for(f.offset=-1;h.update(f)&&!(--f.offset<-3););for(f.offset=1;h.update(f)&&!(++f.offset>3););}return h.getSelected()}(t,f,n,a):function(t,r,i,n,a){var o,s;let l,u=(o=t,s=n,l=o.getBounds(),o.isGeospatial?[Math.max(l[0],s[0]),Math.max(l[1],s[1]),Math.min(l[2],s[2]),Math.min(l[3],s[3])]:[Math.max(Math.min(l[0],s[2]),s[0]),Math.max(Math.min(l[1],s[3]),s[1]),Math.min(Math.max(l[2],s[0]),s[2]),Math.min(Math.max(l[3],s[1]),s[3])]),c=Om(r,i),[h,f,d,p]=a?Of(u,a).map(t=>t*c/512):u.map(t=>t*c/512),m=[];for(let t=Math.floor(h);t<d;t++)for(let i=Math.floor(f);i<p;i++)m.push({x:t,y:i,z:r});return m}(t,f,o,d||Oc,l)}({viewport:t,maxZoom:r,minZoom:i,zRange:n,tileSize:s,extent:l,modelMatrix:a,modelMatrixInverse:o,zoomOffset:u,visibleMinZoom:c,visibleMaxZoom:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:r}=this.opts;
6584return{bbox:function(t,r,i,n,a=512){if(t.isGeospatial){let[t,a]=Og(r,i,n),[o,s]=Og(r+1,i+1,n);return{west:t,north:a,east:o,south:s}}let[o,s]=Oy(r,i,n,a),[l,u]=Oy(r+1,i+1,n,a);return{left:o,top:s,right:l,bottom:u}}(this._viewport,t.x,t.y,t.z,r)}}getParentIndex(t){let r=Math.floor(t.x/2);return{x:r,y:Math.floor(t.y/2),z:t.z-1}}updateTileStates(){let t=this.opts.refinementStrategy||Ov,r=Array(this._cache.size),i=0;for(let t of this._cache.values())r[i++]=t.isVisible,t.isSelected=!1,t.isVisible=!1;for(let t of this._selectedTiles)t.isSelected=!0,t.isVisible=!0;for(let n of(("function"==typeof t?t:O_[t])(Array.from(this._cache.values())),i=0,this._cache.values()))if(r[i++]!==n.isVisible)return!0;return!1}_getRequestPriority(t){if(!t.isSelected&&!t.isVisible)return -1;let r=this._getTileDistancePriority(t);return t.isSelected?0+r:1e8+r}_getTileDistancePriority(t){let{width:r,height:i}=this._viewport||{};if(!this._viewport||!r||!i)return 0;try{let n=this._getTileScreenCorners(t.bbox),a=[r/2,i/2];if(4===n.length){if(this._isPointInPolygon(a,n))return 0;let t=n.reduce((t,r,i)=>{let o=n[(i+1)%n.length];return Math.min(t,this._getPointToSegmentDistanceSquared(a,r,o))},Number.MAX_SAFE_INTEGER);return Math.min(t,0x5f5e0ff)}}catch{}return 0x5f5e0ff}_getTileScreenCorners(t){return("west"in t?[[t.west,t.south],[t.east,t.south],[t.east,t.north],[t.west,t.north]]:[[t.left,t.top],[t.right,t.top],[t.right,t.bottom],[t.left,t.bottom]]).map(t=>this._viewport.project(t)).filter(([t,r])=>Number.isFinite(t)&&Number.isFinite(r))}_isPointInPolygon(t,r){let i=!1,[n,a]=t;for(let t=0,o=r.length-1;t<r.length;o=t++){let[s,l]=r[t],[u,c]=r[o];l>a!=c>a&&n<(u-s)*(a-l)/(c-l)+s&&(i=!i)}return i}_getPointToSegmentDistanceSquared(t,r,i){let[n,a]=t,[o,s]=r,[l,u]=i,c=l-o,h=u-s,f=c*c+h*h,d=f?Math.max(0,Math.min(1,((n-o)*c+(a-s)*h)/f)):0,p=n-(o+d*c),m=a-(s+d*h);return p*p+m*m}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=[],i=0;for(let t of this._cache.values())t.isLoading&&(i++,t.isSelected||t.isVisible||r.push(t));for(;t>0&&i>t&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:t}=this;for(let r of t.values())r.parent=null,r.children&&(r.children.length=0);for(let r of t.values()){let t=this._getNearestAncestor(r);r.parent=t,t?.children&&t.children.push(r)}}_resizeCache(){let{_cache:t,opts:r}=this,i=r.maxCacheSize??(null!==r.maxCacheByteSize?1/0:5*this.selectedTiles.length),n=r.maxCacheByteSize??1/0;if(t.size>i||this._cacheByteSize>n){for(let[a,o]of t)if(o.isVisible||o.isSelected||(this._cacheByteSize-=null!==r.maxCacheByteSize?o.byteLength:0,t.delete(a),this.opts.onTileUnload?.(o)),t.size<=i&&this._cacheByteSize<=n)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((t,r)=>t.zoom-r.zoom),this._dirty=!1)}_getTile(t,r){let i=this.getTileId(t),n=this._cache.get(i),a=!1;return!n&&r?(Object.assign(n=new kS(t),this.getTileMetadata(n.index)),Object.assign(n,{id:i,zoom:this.getTileZoom(n.index)}),a=!0,this._cache.set(i,n),this._dirty=!0):n&&n.needsReload&&(a=!0),n&&a&&n.loadData({getData:this.opts.getTileData,getRequestPriority:this._getRequestPriority.bind(this),requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),n}_getNearestAncestor(t){let{_minZoom:r=0}=this,i=t.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let t=this._getTile(i);if(t)return t}return null}},data:{type:"data",value:[]},dataComparator:Oh.equal,renderSubLayers:{type:"function",value:t=>new IB(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Ov,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,visibleMinZoom:null,visibleMaxZoom:null};class OT extends Dq{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&(!t.content||!t.layers||t.layers.every(t=>t.isLoaded)))}
6584shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:r}=this.state,i=t.propsOrDataChanged||t.updateTriggersChanged,n=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),n?r.reloadAll():r.tiles.forEach(t=>{t.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:n,extent:a,maxZoom:o,minZoom:s,maxRequests:l,debounceTime:u,zoomOffset:c,visibleMinZoom:h,visibleMaxZoom:f}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:o,minZoom:s,tileSize:t,refinementStrategy:n,extent:a,maxRequests:l,debounceTime:u,zoomOffset:c,visibleMinZoom:h,visibleMaxZoom:f,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:r,modelMatrix:i}=this.props,n=t.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:a}=t,o=this.state.isLoaded!==a,s=this.state.frameNumber!==n;a&&(o||s)&&this._onViewportLoad(),s&&this.setState({frameNumber:n}),this.state.isLoaded=a}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:r}=this.props;r&&r(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,r){this.props.onTileError(t),r.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:r,getTileData:i,fetch:n}=this.props,{signal:a}=t;return(t.url="string"==typeof r||Array.isArray(r)?Od(r,t):null,i)?i(t):n&&t.url?n(t.url,{propName:"data",layer:this,signal:a}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let r=t.sourceLayer,i=r.props.tile,n=t.info;return n.picked&&(n.tile=i),n.sourceTile=i,n.sourceTileSubLayer=r,n}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){let{visibleMinZoom:t,visibleMaxZoom:r,minZoom:i,extent:n}=this.props,a=this.context.viewport.zoom;if(null!=t&&a<t||null!=r&&a>r||null!=i&&!n&&a<i){for(let t of this.state.tileset.tiles)t.layers=null;return[]}return this.state.tileset.tiles.map(t=>{let r=this.getSubLayerPropsByTile(t);if(t.isLoaded||t.content)if(t.layers)r&&t.layers[0]&&Object.keys(r).some(i=>t.layers[0].props[i]!==r[i])&&(t.layers=t.layers.map(t=>t.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=E0(i,Boolean).map(i=>i.clone({tile:t,...r}))}return t.layers})}filterSubLayer({layer:t,cullRect:r}){let{tile:i}=t.props,{modelMatrix:n}=this.props;return this.state.tileset.isTileVisible(i,r,n?new Ei(n):null)}}OT.defaultProps=OE,OT.layerName="TileLayer";let OA=OT,OS={...IB.defaultProps,data:Oh,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[kd],binary:!0};class OC extends OA{initializeState(){super.initializeState();let t=void 0===this.context.viewport.resolution&&this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return!!(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps:r,context:i,changeFlags:n}){n.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:r,context:i,changeFlags:n}),this._setWGS84PropertyForTiles());let{highlightColor:a}=t;a!==r.highlightColor&&Array.isArray(a)&&this.setState({highlightColor:a})}async _updateTileData(){var t;let r=this.props.data,i=null;if("string"!=typeof r||(t=r,/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)))r&&"object"==typeof r&&"tilejson"in r&&(i=r);else{let{onDataLoad:t,fetch:n}=this.props;this.setState({data:null,tileJSON:null});try{i=await n(r,{propName:"data",layer:this,loaders:[]})}catch(t){this.raiseError(t,"loading TileJSON"),r=null}t&&t(i,{propName:"data",layer:this})}i&&(r=i.tiles),this.setState({data:r,tileJSON:i})}_getTilesetOptions(){let t=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:i,maxZoom:n}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>i&&(t.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(n)||r.maxzoom<n)&&(t.maxZoom=r.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:r,binary:i}=this.state,{index:n,signal:a}=t,o=Od(r,t);if(!o)return Promise.reject("Invalid URL");let s=this.getLoadOptions(),{fetch:l}=this.props;return l(o,{propName:"data",layer:this,loadOptions:s={...s,core:{...s?.core,mimeType:"application/x-protobuf"},mvt:{...s?.mvt,shape:i?"binary":"geojson",coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:n}},signal:a})}renderSubLayers(t){let{x:r,y:i,z:n}=t.tile.index,a=Math.pow(2,n),o=512/a,s=new Ei().scale([o,-o,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=s,t.coordinateOrigin=[512*r/a,512*(1-i/a),0],t.coordinateSystem=x2.CARTESIAN,t.extensions=[...t.extensions||[],new IH]);let l=super.renderSubLayers(t);return!this.state.binary||l instanceof IB||xn.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),l}_updateAutoHighlight(t){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:i,hoveredFeatureLayerName:n}=this.state,a=t.object,o=null,s=null;a&&(o=OD(a,r),s=OP(a));let{highlightColor:l}=this.props;"function"==typeof l&&(l=l(t)),(i!==o||n!==s)&&this.setState({highlightColor:l,hoveredFeatureId:o,hoveredFeatureLayerName:s})}_isWGS84(){return!!this.context.viewport.resolution}getPickingInfo(t){let r=super.getPickingInfo(t);if(this.state.binary&&-1!==r.index){let{data:i}=t.sourceLayer.props;r.object=km(i,{globalFeatureId:r.index})}return r.object&&!this._isWGS84()&&(r.object=Ok(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:r,hoveredFeatureLayerName:i,binary:n}=this.state,{uniqueIdProperty:a,highlightedFeatureId:o}=this.props,s=t.content,l=OI(o);if(!(OI(r)||l))return -1;let u=l?o:r;if(Array.isArray(s))return s.findIndex(t=>{let r=OD(t,a)===u,n=l||OP(t)===i;return r&&n});if(s&&n){var c=l?"":i;for(let t of kw){let r=s[t]&&function(t,r,i,n){let a=t.featureIds.value;if(!a.length)return -1;let o=0,s=a[a.length-1]+1;if(n){let r=function(t,r){if(!t.__layers){let r={},{properties:i}=t;
6584for(let t=0;t<i.length;t++){let{layerName:n}=i[t];n&&(r[n]?r[n][1]=t:r[n]=[t,t])}t.__layers=r}return t.__layers[r]}(t,n);if(!r)return -1;o=r[0],s=r[1]+1}let l=-1;if(r in t.numericProps){let n=t.numericProps[r].value.findIndex((t,r)=>t===i&&a[r]>=o&&a[r]<s);return n>=0?t.globalFeatureIds.value[n]:-1}return r?l=kE(t.properties,t=>t[r]===i,o,s):t.fields&&(l=kE(t.fields,t=>t.id===i,o,s)),l>=0?function(t,r){if(!t.__ids){let r=[],i=t.featureIds.value,n=t.globalFeatureIds.value;for(let t=0;t<i.length;t++)r[i[t]]=n[t];t.__ids=r}return t.__ids[r]}(t,l):-1}(s[t],a,u,c);if(r>=0)return r}}return -1}_pickObjects(t){let{deck:r,viewport:i}=this.context,n=i.width,a=i.height,o=i.x,s=i.y,l=[this.id];return r.pickObjects({x:o,y:s,width:n,height:a,layerIds:l,maxObjects:t})}getRenderedFeatures(t=null){let r=this._pickObjects(t),i=new Set,n=[];for(let t of r){let r=OD(t.object,this.props.uniqueIdProperty);void 0===r?n.push(t.object):i.has(r)||(i.add(r),n.push(t.object))}return n}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(r=>{r.hasOwnProperty(t)||Object.defineProperty(r,t,{get:()=>{var t;if(!r.content)return null;if(this.state.binary&&Array.isArray(r.content)&&!r.content.length)return[];let{bbox:i}=r;if(void 0===r._contentWGS84&&Number.isFinite((t=i).west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)){let t=this.state.binary?km(r.content):r.content;r._contentWGS84=t.map(t=>Ok(t,i,this.context.viewport))}return r._contentWGS84}})})}}OC.layerName="MVTLayer",OC.defaultProps=OS;let OM=OC;function OD(t,r){return t.properties&&r?t.properties[r]:"id"in t?t.id:void 0}function OP(t){return t.properties?.layerName||null}function OI(t){return null!=t&&""!==t}function Ok(t,r,i){let n={...t,geometry:{type:t.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>{var n;let a,o;return(n=t.geometry,a=i.projectFlat([r.west,r.north]),o=i.projectFlat([r.east,r.south]),{...n,coordinates:kv[n.type](n.coordinates,[a,o],i)}).coordinates}}),n}function OO(t,r){return t?.rpid!=null&&r.has(String(t.rpid))||t?.rgid!=null&&r.has(String(t.rgid))||t?.ruid!=null&&r.has(String(t.ruid))||t?.rguid!=null&&r.has(String(t.rguid))}function ON(){}t.s(["extractGeoLevelCode",0,function(t){if(t.key){let r=String(t.key).match(/^([A-Za-z]+)\d+$/);if(r)return r[1]}if(t.level){let r=String(t.level).match(/^DataGeo(\w+)$/);if(r)return r[1]}return"Other"},"isImplicitlySelected",0,OO],338646),t.s(["default",0,class extends OM{static layerName="CensusMapperMVTLayer";_pickObjects(t){let{deck:r,viewport:i}=this.context;if(!r||!i)return[];let n=i.width,a=i.height,o=i.x,s=i.y,l=[this.id];return r.pickObjects({x:o,y:s,width:n,height:a,layerIds:l,maxObjects:t})}_updateAutoHighlight(t){var r,i,n;let{uniqueIdProperty:a}=this.props,{hoveredFeatureId:o,hoveredFeatureLayerName:s}=this.state,l=t.object,u=null,c=null;l&&(r=l,i=a,u=r.properties&&i?r.properties[i]:"id"in r?r.id:void 0,n=l,c=n.properties?.layerName||null);let{highlightColor:h}=this.props;"function"==typeof h&&(h=h(t)),(o!==u||s!==c)&&this.setState({highlightColor:h,hoveredFeatureId:u,hoveredFeatureLayerName:c})}clearHighlight(){if(!this.state)return;let{hoveredFeatureId:t,hoveredFeatureLayerName:r}=this.state;(null!==t||null!==r)&&this.setState({hoveredFeatureId:null,hoveredFeatureLayerName:null})}invalidateAllFillColors(){let t=this.state?.tileset?._cache;if(t)for(let r of t.values())for(let t of r.layers??[])t?.state?.attributeManager&&(t.state.attributeManager.invalidateAll(),t.setNeedsUpdate(),t.setNeedsRedraw())}applySelectionColors(t){let r=r=>{for(let i of r){if(!i.__value)continue;let r=i.id??"";r&&t.has(r)?i.__value.fillColor=[65,182,230]:OO(i,t)&&(i.__value.fillColor=[180,220,240])}};this.getSubLayers().forEach(t=>{let i=t.props.data?.polygons?.properties;i&&(r(i),t.state?.attributeManager&&(t.state.attributeManager.invalidateAll(),t.setNeedsUpdate(),t.setNeedsRedraw()))});let i=this.state?.tileset?._cache;if(i)for(let t of i.values()){let i=t.data?.polygons?.properties;i?.length&&r(i)}}applyIndexChange(t,r){let i=i=>{for(let n of i){if(!n.__value?.variables?.rawValue)continue;let i=n.__value.variables.rawValue[t];"object"!=typeof i||Array.isArray(i)||null===i||(void 0!==i.error&&(n.__value.uncertainty=i.error),i=void 0!==i.value?i.value:i.values[0]),n.__value.mapValue=i,n.__value.fillColor=r(i)}};
6584this.getSubLayers().forEach(t=>{let r=t.props.data?.polygons?.properties;r&&(i(r),t.state?.attributeManager&&(t.state.attributeManager.invalidateAll(),t.setNeedsUpdate(),t.setNeedsRedraw()))});let n=this.state?.tileset?._cache;if(n)for(let t of n.values()){let r=t.data?.polygons?.properties;r?.length&&i(r)}this.setNeedsUpdate(),this.setNeedsRedraw()}setComputedValues(t){this.getSubLayers().forEach(r=>{r.props.data&&r.props.data.polygons&&r.props.data.polygons.properties&&(r.props.data.polygons.properties.forEach(r=>{let i=t({properties:r});r.__value=i||{variables:{},value:null,mapValue:null}}),r.state?.attributeManager&&r.state.attributeManager.invalidateAll(),r.setNeedsUpdate(),r.setNeedsRedraw())}),this.setNeedsUpdate(),this.setNeedsRedraw()}getPickingInfo(t){let r=t.sourceLayer,i=r.props.tile,n=t.info;return n.picked&&(n.tile=i),n.sourceTile=i,n.sourceTileSubLayer=r,-1!==n.index&&(n.object={properties:t.sourceLayer.props.data.polygons.properties[n.index]}),n}constructor(t){const r=t.data_layer,i=r.subdomains[0],n=t.base_url??"";super({...t,beforeId:t.beforeId||"landcover-natural",pickable:!0,minZoom:r.min,maxZoom:r.min,interpolate:!0,zoomOffset:0,uniqueIdProperty:"id",key:i,getFeatureId:t=>t.properties.id,data:[n+"/tiles/geo/"+i+"/{z}/{x}/{y}.mvt"]})}getRawRenderedFeatures(t=0,r=!1){let i;if(void 0===this.context||void 0===this.context.deck)return console.log("No deck context defined (yet?)"),[];let{deck:n,viewport:a}=this.context,o=a.x,s=a.y,l=a.width,u=a.height,c=t>0&&r?Math.max(0,l-t):l,h=t>0&&!r?Math.max(0,u-t):u,f=[this.id];try{i=n.pickObjects({x:o,y:s,width:c,height:h,layerIds:f})}catch{return[]}return i.map(t=>t.object).filter(Boolean).map(t=>t.properties)}getUniqueIdProperty(){return this.props.uniqueIdProperty||"id"}async mixCensusData(t,r,i,n=ON){if(!t)return null;let a=["pop","dw","hh","pop2","dw2","hh2","a","pop11","hh11","dw11","pop11_r","pop16","hh16","dw16"],o=t.polygons?.properties||[],s=t.polygons?.featureIds.value||[],l=t.polygons?.numericProps||[],u={};if(s.forEach((t,r)=>{u[t]=r}),o.length>0){let t=o.map(t=>t.id);try{let n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({vectors:i,geo_ids:t})}),s=await n.json();o.forEach((t,r)=>{var n,o;(n=Object.keys(t),o=Object.fromEntries(a.map(t=>[t,1])),n.filter(t=>t in o)).forEach(r=>t[r]=+t[r]),Object.keys(l).forEach(i=>{t[i]=l[i].value[u[r]]});let c=s[t.id];if(void 0!==c)for(let[r,i]of Object.entries(c))null===i?t[r]=NaN:t[r]=+i;i.forEach(r=>{r in t||(t[r]=0)});let h=this.props.valueFunction?.({properties:t});t.__value||(t.__value=h||{variables:{},value:null,mapValue:null})})}catch(t){console.warn("Failed to fetch or mix census data:",t)}}return t}getTileData(t){let r=super.getTileData(t),i=this.props.data?.[0]||"";return i=i.replace("{x}",t.index.x).replace("{y}",t.index.y).replace("{z}",t.index.z).replace(/\?.*$/,"").replace(/\/geo\//g,"/data/").replace(/\.mvt$/,".json"),r.then(t=>this.mixCensusData(t,i,this.props.vectors||[]))}}],273447)},778804,(t,r,i)=>{"use strict";var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),y=Symbol.for("react.client.reference");function v(t){if("object"==typeof t&&null!==t){var r=t.$$typeof;switch(r){case n:switch(t=t.type){case o:case l:case s:case f:case d:case g:return t;default:switch(t=t&&t.$$typeof){case c:case h:case m:case p:case u:return t;default:return r}}case a:return r}}}i.ContextConsumer=u,i.ContextProvider=c,i.Element=n,i.ForwardRef=h,i.Fragment=o,i.Lazy=m,i.Memo=p,i.Portal=a,i.Profiler=l,i.StrictMode=s,i.Suspense=f,i.SuspenseList=d,i.isContextConsumer=function(t){return v(t)===u},i.isContextProvider=function(t){return v(t)===c},i.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===n},i.isForwardRef=function(t){return v(t)===h},i.isFragment=function(t){return v(t)===o},i.isLazy=function(t){return v(t)===m},i.isMemo=function(t){return v(t)===p},i.isPortal=function(t){return v(t)===a},i.isProfiler=function(t){return v(t)===l},i.isStrictMode=function(t){return v(t)===s},i.isSuspense=function(t){return v(t)===f},i.isSuspenseList=function(t){return v(t)===d},i.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===o||t===l||t===s||t===f||t===d||t===g||"object"==typeof t&&null!==t&&(t.$$typeof===m||t.$$typeof===p||t.$$typeof===c||t.$$typeof===u||t.$$typeof===h||t.$$typeof===y||void 0!==t.getModuleId)||!1},i.typeOf=v},179684,(t,r,i)=>{"use strict";t.i(247167),r.exports=t.r(778804)},287741,(t,r,i)=>{!function(r,i,n){function a(t){var r,i=this,n=(r=0xefc8249d,function(t){t=String(t);for(var i=0;i<t.length;i++){var n=.02519603282416938*(r+=t.charCodeAt(i));r=n>>>0,n-=r,n*=r,r=n>>>0,n-=r,r+=0x100000000*n}return(r>>>0)*23283064365386963e-26});i.next=function(){var t=2091639*i.s0+23283064365386963e-26*i.c;return i.s0=i.s1,i.s1=i.s2,i.s2=t-(i.c=0|t)},i.c=1,i.s0=n(" "),i.s1=n(" "),i.s2=n(" "),i.s0-=n(t),i.s0<0&&(i.s0+=1),i.s1-=n(t),i.s1<0&&(i.s1+=1),i.s2-=n(t),i.s2<0&&(i.s2+=1)}function o(t,r){return r.c=t.c,r.s0=t.s0,r.s1=t.s1,r.s2=t.s2,r}function s(t,r){var i=new a(t),n=r&&r.state,s=i.next;return s.int32=function(){return 0x100000000*i.next()|0},s.double=function(){return s()+(2097152*s()|0)*11102230246251565e-32},s.quick=s,n&&("object"==typeof n&&o(n,i),s.state=function(){return o(i,{})}),s}
6584if(i&&i.exports)i.exports=s;else if(n&&n.amd)t.r,void 0!==s&&t.v(s);else this.alea=s}(t.e,r,"function"==typeof define&&define)},989057,(t,r,i)=>{!function(r,i,n){function a(t){var r=this,i="";r.x=0,r.y=0,r.z=0,r.w=0,r.next=function(){var t=r.x^r.x<<11;return r.x=r.y,r.y=r.z,r.z=r.w,r.w^=r.w>>>19^t^t>>>8},t===(0|t)?r.x=t:i+=t;for(var n=0;n<i.length+64;n++)r.x^=i.charCodeAt(n),r.next()}function o(t,r){return r.x=t.x,r.y=t.y,r.z=t.z,r.w=t.w,r}function s(t,r){var i=new a(t),n=r&&r.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var t=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===t)return t},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&o(n,i),s.state=function(){return o(i,{})}),s}if(i&&i.exports)i.exports=s;else if(n&&n.amd)t.r,void 0!==s&&t.v(s);else this.xor128=s}(t.e,r,"function"==typeof define&&define)},226605,(t,r,i)=>{!function(r,i,n){function a(t){var r=this,i="";r.next=function(){var t=r.x^r.x>>>2;return r.x=r.y,r.y=r.z,r.z=r.w,r.w=r.v,(r.d=r.d+362437|0)+(r.v=r.v^r.v<<4^(t^t<<1))|0},r.x=0,r.y=0,r.z=0,r.w=0,r.v=0,t===(0|t)?r.x=t:i+=t;for(var n=0;n<i.length+64;n++)r.x^=i.charCodeAt(n),n==i.length&&(r.d=r.x<<10^r.x>>>4),r.next()}function o(t,r){return r.x=t.x,r.y=t.y,r.z=t.z,r.w=t.w,r.v=t.v,r.d=t.d,r}function s(t,r){var i=new a(t),n=r&&r.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var t=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===t)return t},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&o(n,i),s.state=function(){return o(i,{})}),s}if(i&&i.exports)i.exports=s;else if(n&&n.amd)t.r,void 0!==s&&t.v(s);else this.xorwow=s}(t.e,r,"function"==typeof define&&define)},858753,(t,r,i)=>{!function(r,i,n){function a(t){var r=this;r.next=function(){var t,i,n=r.x,a=r.i;return t=n[a],t^=t>>>7,i=t^t<<24^((t=n[a+1&7])^t>>>10)^((t=n[a+3&7])^t>>>3)^((t=n[a+4&7])^t<<7),t=n[a+7&7],t^=t<<13,i^=t^t<<9,n[a]=i,r.i=a+1&7,i};var i,n=t,a=[];if(n===(0|n))a[0]=n;else for(i=0,n=""+n;i<n.length;++i)a[7&i]=a[7&i]<<15^n.charCodeAt(i)+a[i+1&7]<<13;for(;a.length<8;)a.push(0);for(i=0;i<8&&0===a[i];++i);for(8==i?a[7]=-1:a[i],r.x=a,r.i=0,i=256;i>0;--i)r.next()}function o(t,r){return r.x=t.x.slice(),r.i=t.i,r}function s(t,r){null==t&&(t=+new Date);var i=new a(t),n=r&&r.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var t=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===t)return t},s.int32=i.next,s.quick=s,n&&(n.x&&o(n,i),s.state=function(){return o(i,{})}),s}if(i&&i.exports)i.exports=s;else if(n&&n.amd)t.r,void 0!==s&&t.v(s);else this.xorshift7=s}(t.e,r,"function"==typeof define&&define)},125600,(t,r,i)=>{!function(r,i,n){function a(t){var r=this;r.next=function(){var t,i,n=r.w,a=r.X,o=r.i;return r.w=n=n+0x61c88647|0,i=a[o+34&127],t=a[o=o+1&127],i^=i<<13,t^=t<<17,i^=i>>>15,t^=t>>>12,i=a[o]=i^t,r.i=o,i+(n^n>>>16)|0},!function(t,r){var i,n,a,o,s,l=[],u=128;for(r===(0|r)?(n=r,r=null):(r+="\0",n=0,u=Math.max(u,r.length)),a=0,o=-32;o<u;++o)r&&(n^=r.charCodeAt((o+32)%r.length)),0===o&&(s=n),n^=n<<10,n^=n>>>15,n^=n<<4,n^=n>>>13,o>=0&&(s=s+0x61c88647|0,a=0==(i=l[127&o]^=n+s)?a+1:0);for(a>=128&&(l[127&(r&&r.length||0)]=-1),a=127,o=512;o>0;--o)n=l[a+34&127],i=l[a=a+1&127],n^=n<<13,i^=i<<17,n^=n>>>15,i^=i>>>12,l[a]=n^i;t.w=s,t.X=l,t.i=a}(r,t)}function o(t,r){return r.i=t.i,r.w=t.w,r.X=t.X.slice(),r}function s(t,r){null==t&&(t=+new Date);var i=new a(t),n=r&&r.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var t=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===t)return t},s.int32=i.next,s.quick=s,n&&(n.X&&o(n,i),s.state=function(){return o(i,{})}),s}if(i&&i.exports)i.exports=s;else if(n&&n.amd)t.r,void 0!==s&&t.v(s);else this.xor4096=s}(t.e,r,"function"==typeof define&&define)},314038,(t,r,i)=>{!function(r,i,n){function a(t){var r=this,i="";r.next=function(){var t=r.b,i=r.c,n=r.d,a=r.a;return t=t<<25^t>>>7^i,i=i-n|0,n=n<<24^n>>>8^a,a=a-t|0,r.b=t=t<<20^t>>>12^i,r.c=i=i-n|0,r.d=n<<16^i>>>16^a,r.a=a-t|0},r.a=0,r.b=0,r.c=-0x61c88647,r.d=0x517cc1b7,t===Math.floor(t)?(r.a=t/0x100000000|0,r.b=0|t):i+=t;for(var n=0;n<i.length+20;n++)r.b^=i.charCodeAt(n),r.next()}function o(t,r){return r.a=t.a,r.b=t.b,r.c=t.c,r.d=t.d,r}function s(t,r){var i=new a(t),n=r&&r.state,s=function(){return(i.next()>>>0)/0x100000000};return s.double=function(){do var t=((i.next()>>>11)+(i.next()>>>0)/0x100000000)/2097152;while(0===t)return t}
6584,s.int32=i.next,s.quick=s,n&&("object"==typeof n&&o(n,i),s.state=function(){return o(i,{})}),s}if(i&&i.exports)i.exports=s;else if(n&&n.amd)t.r,void 0!==s&&t.v(s);else this.tychei=s}(t.e,r,"function"==typeof define&&define)},232034,(t,r,i)=>{!function(i,n,a){var o,s="random",l=a.pow(256,6),u=a.pow(2,52),c=2*u;function h(t,r,h){var g=[],y=p(function t(r,i){var n,a=[],o=typeof r;if(i&&"object"==o)for(n in r)try{a.push(t(r[n],i-1))}catch(t){}return a.length?a:"string"==o?r:r+"\0"}((r=!0==r?{entropy:!0}:r||{}).entropy?[t,m(n)]:null==t?function(){try{var t;return o&&(t=o.randomBytes)?t=t(256):(t=new Uint8Array(256),(i.crypto||i.msCrypto).getRandomValues(t)),m(t)}catch(t){var r=i.navigator,a=r&&r.plugins;return[+new Date,i,a,i.screen,m(n)]}}():t,3),g),v=new f(g),_=function(){for(var t=v.g(6),r=l,i=0;t<u;)t=(t+i)*256,r*=256,i=v.g(1);for(;t>=c;)t/=2,r/=2,i>>>=1;return(t+i)/r};return _.int32=function(){return 0|v.g(4)},_.quick=function(){return v.g(4)/0x100000000},_.double=_,p(m(v.S),n),(r.pass||h||function(t,r,i,n){return(n&&(n.S&&d(n,v),t.state=function(){return d(v,{})}),i)?(a[s]=t,r):t})(_,y,"global"in r?r.global:this==a,r.state)}function f(t){var r,i=t.length,n=this,a=0,o=n.i=n.j=0,s=n.S=[];for(i||(t=[i++]);a<256;)s[a]=a++;for(a=0;a<256;a++)s[a]=s[o=255&o+t[a%i]+(r=s[a])],s[o]=r;(n.g=function(t){for(var r,i=0,a=n.i,o=n.j,s=n.S;t--;)r=s[a=255&a+1],i=256*i+s[255&(s[a]=s[o=255&o+r])+(s[o]=r)];return n.i=a,n.j=o,i})(256)}function d(t,r){return r.i=t.i,r.j=t.j,r.S=t.S.slice(),r}function p(t,r){for(var i,n=t+"",a=0;a<n.length;)r[255&a]=255&(i^=19*r[255&a])+n.charCodeAt(a++);return m(r)}function m(t){return String.fromCharCode.apply(0,t)}if(p(a.random(),n),r.exports){r.exports=h;try{o={}}catch(t){}}else if("function"==typeof define&&define.amd)t.r,void 0!==h&&t.v(h);else a["seed"+s]=h}("u">typeof self?self:t.e,[],Math)},289378,(t,r,i)=>{var n=t.r(287741),a=t.r(989057),o=t.r(226605),s=t.r(858753),l=t.r(125600),u=t.r(314038),c=t.r(232034);c.alea=n,c.xor128=a,c.xorwow=o,c.xorshift7=s,c.xor4096=l,c.tychei=u,r.exports=c},865834,(t,r,i)=>{function n(){}n.prototype={on:function(t,r,i){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:r,ctx:i}),this},once:function(t,r,i){var n=this;function a(){n.off(t,a),r.apply(i,arguments)}return a._=r,this.on(t,a,i)},emit:function(t){for(var r=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),n=0,a=i.length;n<a;n++)i[n].fn.apply(i[n].ctx,r);return this},off:function(t,r){var i=this.e||(this.e={}),n=i[t],a=[];if(n&&r)for(var o=0,s=n.length;o<s;o++)n[o].fn!==r&&n[o].fn._!==r&&a.push(n[o]);return a.length?i[t]=a:delete i[t],this}},r.exports=n,r.exports.TinyEmitter=n},768108,(t,r,i)=>{t.e,r.exports=function(){"use strict";function t(){return!0}function r(){return!1}function i(){}let n="Argument is not a typed-function.";return function a(){let o,s;function l(t){return"object"==typeof t&&null!==t&&t.constructor===Object}let u=[{name:"number",test:function(t){return"number"==typeof t}},{name:"string",test:function(t){return"string"==typeof t}},{name:"boolean",test:function(t){return"boolean"==typeof t}},{name:"Function",test:function(t){return"function"==typeof t}},{name:"Array",test:Array.isArray},{name:"Date",test:function(t){return t instanceof Date}},{name:"RegExp",test:function(t){return t instanceof RegExp}},{name:"Object",test:l},{name:"null",test:function(t){return null===t}},{name:"undefined",test:function(t){return void 0===t}}],c={name:"any",test:t,isAny:!0},h=0,f={createCount:0};function d(t){let r,i=o.get(t);if(i)return i;let n='Unknown type "'+t+'"',a=t.toLowerCase();for(r of s)if(r.toLowerCase()===a){n+='. Did you mean "'+r+'" ?';break}throw TypeError(n)}function p(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any",i=r?d(r).index:s.length,n=[];for(let r=0;r<t.length;++r){if(!t[r]||"string"!=typeof t[r].name||"function"!=typeof t[r].test)throw TypeError("Object with properties {name: string, test: function} expected");let a=t[r].name;if(o.has(a))throw TypeError('Duplicate type name "'+a+'"');n.push(a),o.set(a,{name:a,test:t[r].test,isAny:t[r].isAny,index:i+r,conversionsTo:[]})}let a=s.slice(i);s=s.slice(0,i).concat(n).concat(a);for(let t=i+n.length;t<s.length;++t)o.get(s[t]).index=t}function m(){o=new Map,s=[],h=0,p([c],!1)}function g(t){let r=s.filter(r=>{let i=o.get(r);return!i.isAny&&i.test(t)});return r.length?r:["any"]}function y(t){return t&&"function"==typeof t&&"_typedFunctionData"in t}function v(t,r,i){let a,o;if(!y(t))throw TypeError(n);let s=i&&i.exact,l=w(Array.isArray(r)?r.join(","):r),u=_(l);if(!s||u in t.signatures){let r=t._typedFunctionData.signatureMap.get(u);if(r)return r}let c=l.length;if(s){let r;for(r in a=[],t.signatures)a.push(t._typedFunctionData.signatureMap.get(r))}else a=t._typedFunctionData.signatures;for(let t=0;t<c;++t){let r,i=l[t],n=[];for(r of a){let a=A(r.params,t);
6584if(a&&(!i.restParam||a.restParam)){if(!a.hasAny){let t=x(a);if(i.types.some(r=>!t.has(r.name)))continue}n.push(r)}}if(0===(a=n).length)break}for(o of a)if(o.params.length<=c)return o;throw TypeError("Signature not found (signature: "+(t.name||"unnamed")+"("+_(l,", ")+"))")}function _(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return t.map(t=>t.name).join(r)}function b(t){let r=function(t){if(0===t.length)return[];let r=t.map(d);if(1===t.length)return r[0].conversionsTo;let i=new Set(t),n=new Set;for(let t=0;t<r.length;++t)for(let a of r[t].conversionsTo)i.has(a.from)||n.add(a.from);let a=[];for(let t of n){let i=h+1,n=null;for(let a=0;a<r.length;++a)for(let o of r[a].conversionsTo)o.from===t&&o.index<i&&(i=o.index,n=o);a.push(n)}return a}(t.types.map(t=>t.name)),i=t.hasAny,n=t.name,a=r.map(function(t){let r=d(t.from);return i=r.isAny||i,n+="|"+t.from,{name:t.from,typeIndex:r.index,test:r.test,isAny:r.isAny,conversion:t,conversionIndex:t.index}});return{types:t.types.concat(a),name:n,hasAny:i,hasConversion:a.length>0,restParam:t.restParam}}function x(t){return t.typeSet||(t.typeSet=new Set,t.types.forEach(r=>t.typeSet.add(r.name))),t.typeSet}function w(t){let r=[];if("string"!=typeof t)throw TypeError("Signatures must be strings");let i=t.trim();if(""===i)return r;let n=i.split(",");for(let t=0;t<n.length;++t){let i=function(t){let r=0===t.indexOf("..."),i=(r?t.length>3?t.slice(3):"any":t).split("|").map(t=>d(t.trim())),n=!1,a=r?"...":"";return{types:i.map(function(t){return n=t.isAny||n,a+=t.name+"|",{name:t.name,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:null,conversionIndex:-1}}),name:a.slice(0,-1),hasAny:n,hasConversion:!1,restParam:r}}(n[t].trim());if(i.restParam&&t!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+n[t]+'": only allowed for the last parameter');if(0===i.types.length)return null;r.push(i)}return r}function E(t){let r=R(t);return!!r&&r.restParam}function T(r){if(!r||0===r.types.length)return t;if(1===r.types.length)return d(r.types[0].name).test;if(2===r.types.length){let t=d(r.types[0].name).test,i=d(r.types[1].name).test;return function(r){return t(r)||i(r)}}{let t=r.types.map(function(t){return d(t.name).test});return function(r){for(let i=0;i<t.length;i++)if(t[i](r))return!0;return!1}}}function A(t,r){return r<t.length?t[r]:E(t)?R(t):null}function S(t,r){let i=A(t,r);return i?x(i):new Set}function C(t){return null===t.conversion||void 0===t.conversion}function M(t,r){let i=new Set;return t.forEach(t=>{let n;for(n of S(t.params,r))i.add(n)}),i.has("any")?["any"]:Array.from(i)}function D(t,r,i){let n,a,o,s=t||"unnamed",l=i;for(o=0;o<r.length;o++){let t=[];if(l.forEach(i=>{let n=T(A(i.params,o));
6584(o<i.params.length||E(i.params))&&n(r[o])&&t.push(i)}),0===t.length){if((a=M(l,o)).length>0){let t=g(r[o]);return(n=TypeError("Unexpected type of argument in function "+s+" (expected: "+a.join(" or ")+", actual: "+t.join(" | ")+", index: "+o+")")).data={category:"wrongType",fn:s,index:o,actual:t,expected:a},n}}else l=t}let u=l.map(function(t){return E(t.params)?1/0:t.params.length});if(r.length<Math.min.apply(null,u))return(n=TypeError("Too few arguments in function "+s+" (expected: "+(a=M(l,o)).join(" or ")+", index: "+r.length+")")).data={category:"tooFewArgs",fn:s,index:r.length,expected:a},n;let c=Math.max.apply(null,u);if(r.length>c)return(n=TypeError("Too many arguments in function "+s+" (expected: "+c+", actual: "+r.length+")")).data={category:"tooManyArgs",fn:s,index:r.length,expectedLength:c},n;let h=[];for(let t=0;t<r.length;++t)h.push(g(r[t]).join("|"));return(n=TypeError('Arguments of type "'+h.join(", ")+'" do not match any of the defined signatures of function '+s+".")).data={category:"mismatch",actual:h},n}function P(t){let r=s.length+1;for(let i=0;i<t.types.length;i++)r=Math.min(r,t.types[i].typeIndex);return r}function I(t){let r=h+1;for(let i=0;i<t.types.length;i++)C(t.types[i])||(r=Math.min(r,t.types[i].conversionIndex));return r}function k(t,r){let i,n,a=t.params,o=r.params,s=R(a),l=R(o),u=E(a),c=E(o);
6584if(u&&s.hasAny){if(!c||!l.hasAny)return 1e7}else if(c&&l.hasAny)return -1e7;let h=0,f=0;for(i of a)i.hasAny&&++h,i.hasConversion&&++f;let d=0,p=0;for(i of o)i.hasAny&&++d,i.hasConversion&&++p;if(h!==d)return(h-d)*1e6;if(u&&s.hasConversion){if(!c||!l.hasConversion)return 1e5}else if(c&&l.hasConversion)return -1e5;if(f!==p)return(f-p)*1e4;if(u){if(!c)return 1e3}else if(c)return -1e3;let m=(a.length-o.length)*(u?-100:100);if(0!==m)return m;let g=[],y=0;for(let t=0;t<a.length;++t){let r=function(t,r){if(t.hasAny){if(!r.hasAny)return .1}else if(r.hasAny)return -.1;if(t.restParam){if(!r.restParam)return .01}else if(r.restParam)return -.01;let i=P(t)-P(r);if(i<0)return -.001;if(i>0)return .001;let n=I(t),a=I(r);if(t.hasConversion){if(!r.hasConversion)return(1+n)*1e-6}else if(r.hasConversion)return-(1e-6*(1+a));let o=n-a;return o<0?-1e-7:1e-7*(o>0)}(a[t],o[t]);g.push(r),y+=r}if(0!==y)return(y<0?-10:10)+y;let v=9,_=9/(g.length+1);for(n of g){if(0!==n)return(n<0?-v:v)+n;v-=_}return 0}function O(t){let r,i,n,a,o=[],s=[],l="";t.types.forEach(function(t){t.conversion&&(l+=t.conversion.from+"~>"+t.conversion.to+",",o.push(d(t.conversion.from).test),s.push(t.conversion.convert))}),l=l?l.slice(0,-1):"pass";let u=t=>t;switch(s.length){case 0:break;case 1:r=o[0],n=s[0],u=function(t){return r(t)?n(t):t};break;case 2:r=o[0],i=o[1],n=s[0],a=s[1],u=function(t){return r(t)?n(t):i(t)?a(t):t};break;default:u=function(t){for(let r=0;r<s.length;r++)if(o[r](t))return s[r](t);return t}}return Object.defineProperty(u,"name",{value:l}),u}function N(t,r,i){throw D(t,r,i)}function L(t){return F(t,0,t.length-1)}function R(t){return t[t.length-1]}function F(t,r,i){return Array.prototype.slice.call(t,r,i)}function B(t,r){return{referTo:{references:t,callback:r}}}function z(t){if("function"!=typeof t)throw TypeError("Callback function expected as first argument");return{referToSelf:{callback:t}}}function j(t){return t&&"object"==typeof t.referTo&&Array.isArray(t.referTo.references)&&"function"==typeof t.referTo.callback}function U(t){return t&&"object"==typeof t.referToSelf&&"function"==typeof t.referToSelf.callback}function V(t,r){if(!t)return r;if(r&&r!==t){let i=Error("Function names do not match (expected: "+t+", actual: "+r+")");throw i.data={actual:r,expected:t},i}return t}m(),p(u);let $=f;function G(t){if(!t||"string"!=typeof t.from||"string"!=typeof t.to||"function"!=typeof t.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");if(t.to===t.from)throw SyntaxError('Illegal to define conversion from "'+t.from+'" to itself.')}return(f=function(t){let n="string"==typeof t,a=+!!n,o=n?t:"",s={};for(let t=a;t<arguments.length;++t){let r,i=arguments[t],a={};if("function"==typeof i?(r=i.name,"string"==typeof i.signature?a[i.signature]=i:y(i)&&(a=i.signatures)):l(i)&&(a=i,n||(r=function(t){let r;for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(y(t[i])||"string"==typeof t[i].signature)&&(r=V(r,t[i].name));return r}(i))),0===Object.keys(a).length){let r=TypeError("Argument to 'typed' at index "+t+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw r.data={index:t,argument:i},r}n||(o=V(o,r)),function(t,r){let i;for(i in r)if(Object.prototype.hasOwnProperty.call(r,i)){if(i in t&&r[i]!==t[i]){let n=Error('Signature "'+i+'" is defined twice');throw n.data={signature:i,sourceFunction:r[i],destFunction:t[i]},n}t[i]=r[i]}}(s,a)}return function(t,n){let a,o,s;if(f.createCount++,0===Object.keys(n).length)throw SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&(s=/\bthis(\(|\.signatures\b)/,Object.keys(n).forEach(t=>{let r=n[t];if(s.test(r.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}));let l=[],u=[],c={},h=[];for(a in n){let t;if(!Object.prototype.hasOwnProperty.call(n,a))continue;let r=w(a);if(!r)continue;l.forEach(function(t){if(function(t,r){let i=Math.max(t.length,r.length);for(let n=0;n<i;n++){let i,a=S(t,n),o=S(r,n),s=!1;for(i of o)if(a.has(i)){s=!0;break}if(!s)return!1}let n=t.length,a=r.length,o=E(t),s=E(r);return o?s?n===a:a>=n:s?n>=a:n===a}(t,r))throw TypeError('Conflicting signatures "'+_(t)+'" and "'+_(r)+'".')}),l.push(r);let i=u.length;for(t of(u.push(n[a]),function t(r,i,n){if(!(i<r.length))return[n];{var a,o;let s=r[i],l=[];
6584if(s.restParam){let t=s.types.filter(C);t.length<s.types.length&&l.push({types:t,name:"..."+t.map(t=>t.name).join("|"),hasAny:t.some(t=>t.isAny),hasConversion:!1,restParam:!0}),l.push(s)}else l=s.types.map(function(t){return{types:[t],name:t.name,hasAny:t.isAny,hasConversion:t.conversion,restParam:!1}});return a=l,o=function(a){return t(r,i+1,n.concat([a]))},Array.prototype.concat.apply([],a.map(o))}}(r.map(b),0,[]))){let r=_(t);h.push({params:t,name:r,fn:i}),t.every(t=>!t.hasConversion)&&(c[r]=i)}}h.sort(k);let d=function(t,r,i){let n=t.map(t=>U(t)?z(t.referToSelf.callback):j(t)?B(t.referTo.references,t.referTo.callback):t),a=Array(n.length).fill(!1),o=!0;for(;o;){o=!1;let t=!0;for(let s=0;s<n.length;++s){if(a[s])continue;let l=n[s];if(U(l))n[s]=l.referToSelf.callback(i),n[s].referToSelf=l.referToSelf,a[s]=!0,t=!1;else if(j(l)){let i=function(t,r,i){let n,a=[];for(n of t){let t=i[n];if("number"!=typeof t)throw TypeError('No definition for referenced signature "'+n+'"');if("function"!=typeof(t=r[t]))return!1;a.push(t)}return a}(l.referTo.references,n,r);i?(n[s]=l.referTo.callback.apply(this,i),n[s].referTo=l.referTo,a[s]=!0,t=!1):o=!0}}if(t&&o)throw SyntaxError("Circular reference detected in resolving typed.referTo")}return n}(u,c,ed);for(o in c)Object.prototype.hasOwnProperty.call(c,o)&&(c[o]=d[c[o]]);let p=[],m=new Map;for(o of h)m.has(o.name)||(o.fn=d[o.fn],p.push(o),m.set(o.name,o));let g=p[0]&&p[0].params.length<=2&&!E(p[0].params),y=p[1]&&p[1].params.length<=2&&!E(p[1].params),v=p[2]&&p[2].params.length<=2&&!E(p[2].params),x=p[3]&&p[3].params.length<=2&&!E(p[3].params),A=p[4]&&p[4].params.length<=2&&!E(p[4].params),M=p[5]&&p[5].params.length<=2&&!E(p[5].params);for(let t=0;t<p.length;++t)p[t].test=function(t){let r,i,n;if(E(t)){let i=(r=L(t).map(T)).length,n=T(R(t)),a=function(t){for(let r=i;r<t.length;r++)if(!n(t[r]))return!1;return!0};return function(t){for(let i=0;i<r.length;i++)if(!r[i](t[i]))return!1;return a(t)&&t.length>=i+1}}return 0===t.length?function(t){return 0===t.length}:1===t.length?(i=T(t[0]),function(t){return i(t[0])&&1===t.length}):2===t.length?(i=T(t[0]),n=T(t[1]),function(t){return i(t[0])&&n(t[1])&&2===t.length}):(r=t.map(T),function(t){for(let i=0;i<r.length;i++)if(!r[i](t[i]))return!1;return t.length===r.length})}(p[t].params);let D=g?T(p[0].params[0]):r,P=y?T(p[1].params[0]):r,I=v?T(p[2].params[0]):r,N=x?T(p[3].params[0]):r,V=A?T(p[4].params[0]):r,$=M?T(p[5].params[0]):r,G=g?T(p[0].params[1]):r,q=y?T(p[1].params[1]):r,H=v?T(p[2].params[1]):r,W=x?T(p[3].params[1]):r,Z=A?T(p[4].params[1]):r,Y=M?T(p[5].params[1]):r;for(let t=0;t<p.length;++t)p[t].implementation=function(t,r){let i=r,n="";if(t.some(t=>t.hasConversion)){let a=E(t),o=t.map(O);n=o.map(t=>t.name).join(";"),i=function(){let t=[],i=a?arguments.length-1:arguments.length;for(let r=0;r<i;r++)t[r]=o[r](arguments[r]);return a&&(t[i]=arguments[i].map(o[i])),r.apply(this,t)}}let a=i;if(E(t)){let r=t.length-1;a=function(){return i.apply(this,F(arguments,0,r).concat([F(arguments,r)]))}}return n&&Object.defineProperty(a,"name",{value:n}),a}(p[t].params,p[t].fn);let X=g?p[0].implementation:i,K=y?p[1].implementation:i,Q=v?p[2].implementation:i,J=x?p[3].implementation:i,ee=A?p[4].implementation:i,et=M?p[5].implementation:i,er=g?p[0].params.length:-1,ei=y?p[1].params.length:-1,en=v?p[2].params.length:-1,ea=x?p[3].params.length:-1,eo=A?p[4].params.length:-1,es=M?p[5].params.length:-1,el=6*!!(g&&y&&v&&x&&A&&M),eu=p.length,ec=p.map(t=>t.test),eh=p.map(t=>t.implementation),ef=function(){for(let t=el;t<eu;t++)if(ec[t](arguments))return eh[t].apply(this,arguments);return f.onMismatch(t,arguments,p)};function ed(t,r){return arguments.length===er&&D(t)&&G(r)?X.apply(this,arguments):arguments.length===ei&&P(t)&&q(r)?K.apply(this,arguments):arguments.length===en&&I(t)&&H(r)?Q.apply(this,arguments):arguments.length===ea&&N(t)&&W(r)?J.apply(this,arguments):arguments.length===eo&&V(t)&&Z(r)?ee.apply(this,arguments):arguments.length===es&&$(t)&&Y(r)?et.apply(this,arguments):ef.apply(this,arguments)}try{Object.defineProperty(ed,"name",{value:t})}catch(t){}return ed.signatures=c,ed._typedFunctionData={signatures:p,signatureMap:m},ed}(o||"",s)}).create=a,f.createCount=$.createCount,f.onMismatch=N,f.throwMismatchError=N,f.createError=D,f.clear=m,f.clearConversions=function(){let t;for(t of s)o.get(t).conversionsTo=[];h=0},f.addTypes=p,f._findType=d,f.referTo=function(){let t=L(arguments).map(t=>_(w(t))),r=R(arguments);if("function"!=typeof r)throw TypeError("Callback function expected as last argument");return B(t,r)},f.referToSelf=z,f.convert=function(t,r){let i=d(r);if(i.test(t))return t;let n=i.conversionsTo;if(0===n.length)throw Error("There are no conversions to "+r+" defined.");for(let r=0;r<n.length;r++)if(d(n[r].from).test(t))return n[r].convert(t);throw Error("Cannot convert "+t+" to "+r)},f.findSignature=v,f.find=function(t,r,i){return v(t,r,i).implementation},f.isTypedFunction=y,f.warnAgainstDeprecatedThis=!0,f.addType=function(t,r){let i="any";
6584!1!==r&&o.has("Object")&&(i="Object"),f.addTypes([t],i)},f.addConversion=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};G(t);let i=d(t.to),n=i.conversionsTo.find(r=>r.from===t.from);if(n)if(r&&r.override)f.removeConversion({from:n.from,to:t.to,convert:n.convert});else throw Error('There is already a conversion from "'+t.from+'" to "'+i.name+'"');i.conversionsTo.push({from:t.from,to:i.name,convert:t.convert,index:h++})},f.addConversions=function(t,r){t.forEach(t=>f.addConversion(t,r))},f.removeConversion=function(t){G(t);let r=d(t.to),i=function(t,r){for(let i=0;i<t.length;i++)if(r(t[i]))return t[i]}(r.conversionsTo,r=>r.from===t.from);if(!i)throw Error("Attempt to remove nonexistent conversion from "+t.from+" to "+t.to);if(i.convert!==t.convert)throw Error("Conversion to remove does not match existing conversion");let n=r.conversionsTo.indexOf(i);r.conversionsTo.splice(n,1)},f.resolve=function(t,r){if(!y(t))throw TypeError(n);let i=t._typedFunctionData.signatures;for(let t=0;t<i.length;++t)if(i[t].test(r))return i[t];return null},f}()}()},614595,(t,r,i)=>{"use strict";var n=t.r(271645),a="function"==typeof Object.is?Object.is:function(t,r){return t===r&&(0!==t||1/t==1/r)||t!=t&&r!=r},o=n.useSyncExternalStore,s=n.useRef,l=n.useEffect,u=n.useMemo,c=n.useDebugValue;i.useSyncExternalStoreWithSelector=function(t,r,i,n,h){var f=s(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;var p=o(t,(f=u(function(){function t(t){if(!l){if(l=!0,o=t,t=n(t),void 0!==h&&d.hasValue){var r=d.value;if(h(r,t))return s=r}return s=t}if(r=s,a(o,t))return r;var i=n(t);return void 0!==h&&h(r,i)?(o=t,r):(o=t,s=i)}var o,s,l=!1,u=void 0===i?null:i;return[function(){return t(r())},null===u?void 0:function(){return t(u())}]},[r,i,n,h]))[0],f[1]);return l(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},313027,(t,r,i)=>{"use strict";t.i(247167),r.exports=t.r(614595)},755838,(t,r,i)=>{"use strict";var n=t.r(271645),a="function"==typeof Object.is?Object.is:function(t,r){return t===r&&(0!==t||1/t==1/r)||t!=t&&r!=r},o=n.useState,s=n.useEffect,l=n.useLayoutEffect,u=n.useDebugValue;function c(t){var r=t.getSnapshot;t=t.value;try{var i=r();return!a(t,i)}catch(t){return!0}}var h="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(t,r){return r()}:function(t,r){var i=r(),n=o({inst:{value:i,getSnapshot:r}}),a=n[0].inst,h=n[1];return l(function(){a.value=i,a.getSnapshot=r,c(a)&&h({inst:a})},[t,i,r]),s(function(){return c(a)&&h({inst:a}),t(function(){c(a)&&h({inst:a})})},[t]),u(i),i};i.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:h},802239,(t,r,i)=>{"use strict";t.i(247167),r.exports=t.r(755838)},752822,(t,r,i)=>{"use strict";var n=t.r(271645),a=t.r(802239),o="function"==typeof Object.is?Object.is:function(t,r){return t===r&&(0!==t||1/t==1/r)||t!=t&&r!=r},s=a.useSyncExternalStore,l=n.useRef,u=n.useEffect,c=n.useMemo,h=n.useDebugValue;i.useSyncExternalStoreWithSelector=function(t,r,i,n,a){var f=l(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;var p=s(t,(f=c(function(){function t(t){if(!u){if(u=!0,s=t,t=n(t),void 0!==a&&d.hasValue){var r=d.value;if(a(r,t))return l=r}return l=t}if(r=l,o(s,t))return r;var i=n(t);return void 0!==a&&a(r,i)?(s=t,r):(s=t,l=i)}var s,l,u=!1,c=void 0===i?null:i;return[function(){return t(r())},null===c?void 0:function(){return t(c())}]},[r,i,n,a]))[0],f[1]);return u(function(){d.hasValue=!0,d.value=p},[p]),h(p),p}},430224,(t,r,i)=>{"use strict";t.i(247167),r.exports=t.r(752822)},929702,t=>{t.q("/_next/static/media/featureProcessor.1i48q9ary79pm.ts")},510914,t=>{"use strict";t.s(["default",0,function(r,i){return(n,a)=>(function(r,i,n,a){let o="SharedWorker"===r.name,s=t.b,l=[n.map(r=>t.h("string"==typeof r?r:r.path,s)).reverse(),t.X,s],u=["NEXT_DEPLOYMENT_ID","NEXT_CLIENT_ASSET_SUFFIX"];for(let t=0;t<u.length;t++)l.push(globalThis[u[t]]);let c=new URL(t.h(i,s),location.origin),h=JSON.stringify(l);return o?c.searchParams.set("params",h):c.hash="#params="+encodeURIComponent(h),new r(c,a?{...a,type:void 0}:void 0)})(n,r,i,a)}])},855614,t=>{t.v(t.r(510914).default("static/chunks/turbopack-worker-2ru9m5gbh1na6.js",["static/chunks/39-gd1uvzbuzf.js","static/chunks/turbopack-1zycbojputdo0.js"]))}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.