clone

an offline map explorer where each world, from a game map to a city's open data, ships as one .atlas file

fix: let the flip keep the reader's place

Dami committed f799a54
Pressing the backquote deep over a canyon and landing on the whole
chart loses the thread. The two cameras now answer to one another
through the declared mapping: the globe opens facing what the chart
was showing, the chart opens on what the globe was facing, each at a
comparable closeness. The scale pairing is a rule of thumb -- the
whole disc reads like the whole chart, each halving of altitude like
one more zoom -- which is all "the same spot" needs.
commit
f799a54e97fc730c85d7c6dbca9d6ed94799fedb
parent
37fe05402c2e9224a91e7684dd211a35b513e2b2
author
Dami <dami.etoile@gmail.com>
2 files changed, +287 -247
Massets/app.js492+++++++++++++++---------------
Mfrontend/src/globe.js42+++-
M assets/app.js +246 -246
@@ -1,18 +1,18 @@
1-(()=>{var pse=Object.create;var P4=Object.defineProperty;var Ase=Object.getOwnPropertyDescriptor;var mse=Object.getOwnPropertyNames;var gse=Object.getPrototypeOf,_se=Object.prototype.hasOwnProperty;var xse=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},yse=(i,e)=>{for(var t in e)P4(i,t,{get:e[t],enumerable:!0})},vse=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of mse(e))!_se.call(i,r)&&r!==t&&P4(i,r,{get:()=>e[r],enumerable:!(n=Ase(e,r))||n.enumerable});return i};var bse=(i,e,t)=>(t=i!=null?pse(gse(i)):{},vse(e||!i||!i.__esModule?P4(t,"default",{value:i,enumerable:!0}):t,i));var A$=xse((uv,m6)=>{(function(i,e){typeof uv=="object"&&typeof m6=="object"?m6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof uv=="object"?uv.FrameTicker=e():i.FrameTicker=e()})(uv,function(){return(function(i){function e(n){if(t[n])return t[n].exports;var r=t[n]={exports:{},id:n,loaded:!1};return i[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var t={};return e.m=i,e.c=t,e.p="",e(0)})([function(i,e,t){"use strict";var n=t(1),r=(function(){function s(o,a,l){o===void 0&&(o=NaN),a===void 0&&(a=NaN),l===void 0&&(l=!1),this._minFPS=a,this._maxFPS=o,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,l||this.resume()}return s.prototype.updateOnce=function(o){o(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},s.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},s.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(s.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"timeScale",{get:function(){return this._timeScale},set:function(o){this._timeScale!==o&&(this._timeScale=o)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),s.prototype.animateOnce=function(){var o=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return o.onFrame()})},s.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},s.prototype.update=function(o,a){a===void 0&&(a=!0),this._currentTick++,this._currentTime+=o,this._tickDeltaTime=o,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),a&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.getTimer=function(){return Date.now()},s})();Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(i,e,t){(function(n,r){i.exports=r()})(this,function(){return(function(n){function r(o){if(s[o])return s[o].exports;var a=s[o]={exports:{},id:o,loaded:!1};return n[o].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var s={};return r.m=n,r.c=s,r.p="",r(0)})([function(n,r){"use strict";var s=(function(){function o(){this.functions=[]}return o.prototype.add=function(a){return this.functions.indexOf(a)===-1&&(this.functions.push(a),!0)},o.prototype.remove=function(a){var l=this.functions.indexOf(a);return l>-1&&(this.functions.splice(l,1),!0)},o.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},o.prototype.dispatch=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c=this.functions.concat();c.forEach(function(u){u.apply(void 0,a)})},Object.defineProperty(o.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),o})();Object.defineProperty(r,"__esModule",{value:!0}),r.default=s}])})}])})});var I9=i=>new Promise(e=>setTimeout(e,i)),is=i=>document.querySelector(i);async function wse(){for(let i=0;i<300&&!(window.__atlasDebug&&!is("#map-loading")?.checkVisibility?.());i+=1)await I9(100)}async function Sse(){let i="";for(let e=0;e<100;e+=1){await I9(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let t=window.__atlasDebug.snapshot(),n=JSON.stringify([t.zoom,t.center,t.resolution,t.tileStats]);if(n===i)return;i=n}}function ld(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Tse(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Ese(i){is("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function C0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function I4(i,e){let t=is(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function N4(i,e=!1){let t=is("#parity-badge");t||(t=document.createElement("div"),t.id="parity-badge",t.style.cssText="position:fixed;top:8px;right:8px;z-index:9999;padding:6px 12px;font:700 13px monospace;border-radius:6px;color:#fff;pointer-events:none;",document.body.append(t)),t.style.background=e?"#b3261e":"#1a7f37",t.textContent=i}async function Mse(){let i=[],e=async p=>{await Sse(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await wse(),localStorage.clear();let t=is("#game-select"),n=t.options[0].value;C0(t,n),await e("initial"),I4("#pin-search","a"),await e("search-a");let r=is(".search-result");r&&(r.click(),await e("search-select-first"),is("#close-detail").click(),await e("detail-closed")),I4("#pin-search",""),await e("search-cleared");let s=is(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=is(".only-button");if(o){o.click(),await e("solo-first");let p=is("#solo-chip");p&&!p.hidden&&p.click(),await e("solo-cleared")}let a=is("#legend .layer-title");a&&(a.click(),await e("section-folded"),is("#expand-all").click(),await e("sections-unfolded")),is("#hide-all").click(),await e("all-hidden"),is("#show-all").click(),await e("all-shown");let l=is(".zone-index-item");l&&(l.click(),await e("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-unhighlighted")),ld("g"),await e("grid-open"),I4("#grid-input","m"),await e("grid-descended"),ld(" "),await e("subgrid-hidden"),ld(" "),ld("Escape"),await e("grid-ascended"),ld("Escape"),await e("grid-closed"),ld("z"),await e("labels-on"),Tse("z"),await e("labels-off"),ld("b",{metaKey:!0}),await e("sidebar-collapsed"),ld("b",{metaKey:!0}),await e("sidebar-restored"),is("#zoom-in").click(),await e("zoomed-in");let c=is("#overview-dock");c&&!is("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),is("#zoom-out").click(),await e("zoomed-out"),Ese("Escape"),await e("viewport-escape");let u=is("#variant-select");u.options.length>1&&(C0(u,u.options[1].value),await e("variant-second"),C0(u,u.options[0].value),await e("variant-first"));let f=is("#map-select");return f.options.length>1&&(C0(f,f.options[1].value),await e("map-second"),C0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(C0(t,t.options[1].value),await e("game-second"),C0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var L4=!1;async function N9(){if(!L4){L4=!0,N4("parity tour running\u2026");try{let i=await Mse(),e=await fetch("/parity/result",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i,null,2)}),t=(await e.text()).trim();if(!e.ok)throw new Error(`saving failed: ${e.status} ${t}`);N4(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){N4(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{L4=!1}}}window.__atlasTour=N9;window.addEventListener("keydown",i=>{i.key==="F9"&&N9()});var nn=i=>document.querySelector(i),we={game:nn("#game-select"),map:nn("#map-select"),variant:nn("#variant-select"),variantField:nn("#variant-field"),legend:nn("#legend"),search:nn("#pin-search"),searchResults:nn("#dock-results"),dock:nn("#dock"),dockCount:nn("#dock-count"),dockFlag:nn("#dock-flag"),dockFold:nn("#dock-fold"),dockRailName:nn("#dock-rail-name"),visibleCount:nn("#visible-count"),viewport:nn("#map"),globe:nn("#globe"),globeToggle:nn("#globe-toggle"),layers:nn("#layers"),zoneToggle:nn("#zone-toggle"),zoneCount:nn("#zone-count"),zoneIndex:nn("#zone-index"),zoneList:nn("#zone-list"),loading:nn("#map-loading"),labelsHint:nn("#labels-hint"),gridHint:nn("#grid-hint"),soloChip:nn("#solo-chip"),overview:nn("#overview"),overviewShelf:nn("#overview-shelf"),overviewDock:nn("#overview-dock"),overviewCanvas:nn("#overview-canvas"),overviewViewport:nn("#overview-viewport"),gridNavigator:nn("#grid-navigator"),gridInput:nn("#grid-input"),gridBack:nn("#grid-back"),subgridToggle:nn("#subgrid-toggle"),detail:nn("#pin-detail"),detailTitle:nn("#detail-title"),detailCategory:nn("#detail-category"),detailDescription:nn("#detail-description"),detailID:nn("#detail-id"),detailCoordinates:nn("#detail-coordinates"),detailCell:nn("#detail-cell"),detailCellField:nn("#detail-cell-field"),detailSource:nn("#detail-source"),detailSourceField:nn("#detail-source-field"),detailLinks:nn("#detail-links"),detailDot:nn("#detail-dot"),sidebar:nn("#sidebar"),mobileLegend:nn("#mobile-legend"),fatal:nn("#fatal-error"),fatalMessage:nn("#fatal-message"),emptyState:nn("#empty-state"),emptyPath:nn("#empty-path"),emptyOpen:nn("#empty-open"),addBundles:nn("#add-bundles")};function R0(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var k={catalog:null,game:null,map:null,variant:null,engine:null,projection:null,layers:null,sources:null,hiddenCategories:new Set,collapsedSections:new Set,pins:[],pinByID:new Map,selectedPin:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,globeActive:!1,subgridVisible:!0,gridPrefix:"",zonesVisible:!0,zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,mapRun:0,textByMap:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Qm=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Gl="0123456789bcdefghjkmnpqrstuvwxyz";var D4="atlas.session";var L9={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"};var ps={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function F4(i){let e=Er();for(let t=0,n=i.length;t<n;++t)N0(e,i[t]);return e}function Cse(i,e,t){let n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return al(n,r,s,o,t)}function Jm(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function Jb(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function cd(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function xc(i,e){return cx(i,e[0],e[1])}function pu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function cx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function Qb(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=ps.UNKNOWN;return o<t?l=l|ps.LEFT:o>r&&(l=l|ps.RIGHT),a<n?l=l|ps.BELOW:a>s&&(l=l|ps.ABOVE),l===ps.UNKNOWN&&(l=ps.INTERSECTING),l}function Er(){return[1/0,1/0,-1/0,-1/0]}function al(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function P0(i){return al(1/0,1/0,-1/0,-1/0,i)}function ew(i,e){let t=i[0],n=i[1];return al(t,n,t,n,e)}function eg(i,e,t,n,r){let s=P0(r);return O4(s,i,e,t,n)}function I0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function tw(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function N0(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function O4(i,e,t,n,r){for(;t<n;t+=r)Rse(i,e[t],e[t+1]);return i}function Rse(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function nw(i,e){let t;return t=e(tg(i)),t||(t=e(ng(i)),t)||(t=e(ig(i)),t)||(t=e(zl(i)),t)?t:!1}function ux(i){let e=0;return mu(i)||(e=Wn(i)*gr(i)),e}function tg(i){return[i[0],i[1]]}function ng(i){return[i[2],i[1]]}function Oa(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function D9(i,e){let t;if(e==="bottom-left")t=tg(i);else if(e==="bottom-right")t=ng(i);else if(e==="top-left")t=zl(i);else if(e==="top-right")t=ig(i);else throw new Error("Invalid corner");return t}function hx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=B4(i,e,t,n);return al(Math.min(s,a,c,f),Math.min(o,l,u,p),Math.max(s,a,c,f),Math.max(o,l,u,p),r)}function B4(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,p=i[0],x=i[1];return[p-l+f,x-c-u,p-l-f,x-c+u,p+l-f,x+c+u,p+l+f,x+c-u,p-l+f,x-c-u]}function gr(i){return i[3]-i[1]}function Au(i,e,t){let n=t||Er();return _r(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):P0(n),n}function U4(i,e){if(!_r(i,e))return[i.slice()];if(pu(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function zl(i){return[i[0],i[3]]}function ig(i){return[i[2],i[3]]}function Wn(i){return i[2]-i[0]}function _r(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function mu(i){return i[2]<i[0]||i[3]<i[1]}function F9(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function O9(i,e,t){let n=!1,r=Qb(i,e),s=Qb(i,t);if(r===ps.INTERSECTING||s===ps.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],p=t[0],x=t[1],v=(x-f)/(p-u),w,S;s&ps.ABOVE&&!(r&ps.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&ps.RIGHT&&!(r&ps.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&ps.BELOW&&!(r&ps.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&ps.LEFT&&!(r&ps.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function B9(i,e,t,n){if(mu(i))return P0(t);let r=[];if(n>1){let a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return Cse(s,o,t)}function k4(i,e){let t=e.getExtent(),n=Oa(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Wn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function iw(i,e,t){if(e.canWrapX()){let n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];k4(i,e);let r=Wn(n);if(Wn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function U9(i,e){let t=[i];for(let n=0,r=e.length;n<r&&t.length>0;++n){let s=[];for(let o=0,a=t.length;o<a;++o)s.push(...U4(t[o],e[n]));t=s}return t}var k9={info:1,warn:2,error:3,none:4},Pse=k9.info;function rw(...i){Pse>k9.warn||console.warn(...i)}function _i(i,e,t){return Math.min(Math.max(i,e),t)}function G9(i,e,t,n,r,s){let o=r-t,a=s-n;if(o!==0||a!==0){let l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return yc(i,e,t,n)}function yc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function z9(i){let e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){let l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;let o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){let l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}let t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function sw(i){return i*180/Math.PI}function vc(i){return i*Math.PI/180}function gu(i,e){let t=i%e;return t*e<0?t+e:t}function Po(i,e,t){return i+t*(e-i)}function L0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function fx(i,e){return Math.floor(L0(i,e))}function dx(i,e){return Math.ceil(L0(i,e))}function ow(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function V9(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function D0(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function rg(i,e){let t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function q9(i,e){return i[0]*=e,i[1]*=e,i}function aw(i,e){if(e.canWrapX()){let t=Wn(e.getExtent()),n=H9(i,e,t);n&&(i[0]-=n*t)}return i}function H9(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Wn(n),r=Math.floor((i[0]-n[0])/t)),r}function W9(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(_i(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var $h={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var G4=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||$h[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},ud=G4;var px=6378137,sg=Math.PI*px,Ise=[-sg,-sg,sg,sg],Nse=[-180,-85,180,85],lw=px*Math.log(Math.tan(Math.PI/2)),hd=class extends ud{constructor(e){super({code:e,units:"m",extent:Ise,global:!0,worldExtent:Nse,getPointResolution:function(t,n){return t/Math.cosh(n[1]/px)}})}},z4=[new hd("EPSG:3857"),new hd("EPSG:102100"),new hd("EPSG:102113"),new hd("EPSG:900913"),new hd("http://www.opengis.net/def/crs/EPSG/0/3857"),new hd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function j9(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=sg*i[s]/180;let o=px*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>lw?o=lw:o<-lw&&(o=-lw),e[s+1]=o}return e}function X9(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/sg,e[s+1]=360*Math.atan(Math.exp(i[s+1]/px))/Math.PI-90;return e}var Lse=6378137,$9=[-180,-90,180,90],Dse=Math.PI*Lse/180,Yh=class extends ud{constructor(e,t){super({code:e,units:"degrees",extent:$9,axisOrientation:t,global:!0,metersPerUnit:Dse,worldExtent:$9})}},V4=[new Yh("CRS:84"),new Yh("EPSG:4326","neu"),new Yh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Yh("urn:ogc:def:crs:OGC:2:84"),new Yh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Yh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Yh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var q4={};function Y9(i){return q4[i]||q4[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function K9(i,e){q4[i]=e}function _u(i){for(let e in i)delete i[e]}function bc(i){let e;for(e in i)return!1;return!e}var og={};function ag(i,e,t){let n=i.getCode(),r=e.getCode();n in og||(og[n]={}),og[n][r]=t}function cw(i,e){return i in og&&e in og[i]?og[i][e]:null}var uw=.9996,Vl=.00669438,fw=Vl*Vl,dw=fw*Vl,F0=Vl/(1-Vl),Z9=Math.sqrt(1-Vl),lg=(1-Z9)/(1+Z9),tG=lg*lg,H4=tG*lg,W4=H4*lg,nG=W4*lg,iG=1-Vl/4-3*fw/64-5*dw/256,Fse=3*Vl/8+3*fw/32+45*dw/1024,Ose=15*fw/256+45*dw/1024,Bse=35*dw/3072,Use=3/2*lg-27/32*H4+269/512*nG,kse=21/16*tG-55/32*W4,Gse=151/96*H4-417/128*nG,zse=1097/512*W4,hw=6378137;function Vse(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/uw/(hw*iG),a=o+Use*Math.sin(2*o)+kse*Math.sin(4*o)+Gse*Math.sin(6*o)+zse*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,p=f*f,x=p*p,v=1-Vl*c,w=Math.sqrt(1-Vl*c),S=hw/w,T=(1-Vl)/v,P=F0*u**2,R=P*P,C=n/(S*uw),L=C*C,D=L*C,F=D*C,N=F*C,B=N*C,z=a-f/T*(L/2-F/24*(5+3*p+10*P-4*R-9*F0))+B/720*(61+90*p+298*P+45*x-252*F0-3*R),V=(C-D/6*(1+2*p+P)+N/120*(5-2*P+28*p-3*R+8*F0+24*x))/u;return V=ow(V+vc(rG(t.number)),-Math.PI,Math.PI),[sw(V),sw(z)]}var Q9=-80,J9=84,qse=-180,Hse=180;function Wse(i,e,t){i=ow(i,qse,Hse),e<Q9?e=Q9:e>J9&&(e=J9);let n=vc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=vc(i),u=rG(t.number),f=vc(u),p=hw/Math.sqrt(1-Vl*r**2),x=F0*s**2,v=s*ow(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,P=T*v,R=P*v,C=hw*(iG*n-Fse*Math.sin(2*n)+Ose*Math.sin(4*n)-Bse*Math.sin(6*n)),L=uw*p*(v+S/6*(1-a+x)+P/120*(5-18*a+l+72*x-58*F0))+5e5,D=uw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+R/720*(61-58*a+l+600*x-330*F0)));return t.north||(D+=1e7),[L,D]}function rG(i){return(i-1)*6-180+3}var jse=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function sG(i){let e=0;for(let r of jse){let s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function eG(i,e){return function(t,n,r,s){let o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){let l=t[a],c=t[a+1],u=i(l,c,e);n[a]=u[0],n[a+1]=u[1]}return n}}function oG(i){return sG(i)?new ud({code:i,units:"m"}):null}function aG(i){let e=sG(i.getCode());return e?{forward:eG(Wse,e),inverse:eG(Vse,e)}:null}var Xse=63710088e-1;function j4(i,e,t){t=t||Xse;let n=vc(i[1]),r=vc(e[1]),s=(r-n)/2,o=vc(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var $se=[aG],Yse=[oG];var $4=!0;function cG(i){$4=!(i===void 0?!0:i)}function K4(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function Y4(i){K9(i.getCode(),i),ag(i,i,K4)}function Kse(i){i.forEach(Y4)}function As(i){if(typeof i!="string")return i;let e=Y9(i);if(e)return e;for(let t of Yse){let n=t(i);if(n)return n}return null}function Z4(i,e,t,n){i=As(i);let r,s=i.getPointResolutionFunc();if(s){if(r=s(e,t),n&&n!==i.getUnits()){let o=i.getMetersPerUnit();o&&(r=r*o/$h[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=O0(i,As("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);let u=j4(c.slice(0,2),c.slice(2,4)),f=j4(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?$h[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function lG(i){Kse(i),i.forEach(function(e){i.forEach(function(t){e!==t&&ag(e,t,K4)})})}function Zse(i,e,t,n){i.forEach(function(r){e.forEach(function(s){ag(r,s,t),ag(s,r,n)})})}function pw(i,e){return i?typeof i=="string"?As(i):i:As(e)}function uG(i){return(function(e,t,n,r){let s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){let a=i(e.slice(o,o+n)),l=a.length;for(let c=0,u=r;c<u;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t})}function cg(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||O0(i,e)===K4)&&t}function O0(i,e){let t=i.getCode(),n=e.getCode(),r=cw(t,n);if(r)return r;let s=null,o=null;for(let l of $se)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=X4(s.inverse,o.forward);else{let l=cw(t,a);l&&(r=X4(l,o.forward))}else{let l=cw(a,n);l&&(r=X4(s.inverse,l))}return r&&(Y4(i),Y4(e),ag(i,e,r)),r}function X4(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function B0(i,e){let t=As(i),n=As(e);return O0(t,n)}function ug(i,e,t){let n=B0(e,t);if(!n){let r=As(e).getCode(),s=As(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function hG(i,e,t,n){let r=B0(e,t);return B9(i,r,void 0,n)}var wc=null;function U0(){return wc}function Ax(i,e){return wc?ug(i,e,wc):i}function Sc(i,e){return wc?ug(i,wc,e):($4&&!D0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&($4=!1,rw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function fd(i,e){return wc?hG(i,e,wc):i}function Tc(i,e){return wc?hG(i,wc,e):i}function fG(i,e){if(!wc)return i;let t=As(e).getMetersPerUnit(),n=wc.getMetersPerUnit();return t&&n?i*t/n:i}function Qse(){lG(z4),lG(V4),Zse(V4,z4,j9,X9)}Qse();function Q4(i){return i[0]>0&&i[1]>0}function dG(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function Vr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var Aw=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function k0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new Aw(i,e,t,n)}var mw=Aw;function pG(i,e,t){let n,r;t=t||Ba;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function Ba(i,e){return i>e?1:i<e?-1:0}function AG(i,e){return i<e?1:i>e?-1:0}function hg(i,e,t){if(i[0]<=e)return 0;let n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){let s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function mG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Ec(i,e){let t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function Io(i,e){let t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function gG(i,e,t){let n=e||Ba;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function zn(i,e){if(!i)throw new Error(e)}function _G(i,e,t,n,r){return!nw(r,function(o){return!dd(i,e,t,n,o[0],o[1])})}function dd(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){let c=i[e],u=i[e+1];l<=s?u>s&&(c-a)*(s-l)-(r-a)*(u-l)>0&&o++:u<=s&&(c-a)*(s-l)-(r-a)*(u-l)<0&&o--,a=c,l=u}return o!==0}function mx(i,e,t,n,r,s){if(t.length===0||!dd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(dd(i,t[o-1],t[o],n,r,s))return!1;return!0}function xG(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){let l=t[o];if(mx(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function yG(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function gw(i,e,t,n,r,s){return s=s??O4(Er(),i,e,t,n),_r(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:yG(i,e,t,n,function(o,a){return O9(r,o,a)}):!1}function J4(i,e,t,n,r){return!!(gw(i,e,t,n,r)||dd(i,e,t,n,r[0],r[1])||dd(i,e,t,n,r[0],r[3])||dd(i,e,t,n,r[2],r[1])||dd(i,e,t,n,r[2],r[3]))}function eP(i,e,t,n,r){if(!J4(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(_G(i,t[s-1],t[s],n,r)&&!gw(i,t[s-1],t[s],n,r))return!1;return!0}function vG(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(eP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function $n(){throw new Error("Unimplemented abstract method.")}var Jse=0;function Nn(i){return i.ol_uid||(i.ol_uid=String(++Jse))}function fg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function eoe(i,e,t){return i+"/"+e+"/"+t}function dg(i,e,t,n,r){return`${Nn(i)},${e},${eoe(t,n,r)}`}function bG(i){return toe(i[0],i[1],i[2])}function toe(i,e,t){return(e<<i)+t}function wG(i,e){let t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;let s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}var pg=[0,0,0],pd=5,tP=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,zn(gG(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,zn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=zl(s)),zn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,zn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,zn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new mw(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=k0(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let s=e[1]*2,o=e[2]*2;return k0(s,s+1,o,o+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],s=e[1],o=e[2];if(t===r)return k0(s,o,s,o,n);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),u=Math.floor(o*l);if(t<r)return k0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return k0(c,f,u,p,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,pg);let r=pg[1],s=pg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,pg);let o=pg[1],a=pg[2];return k0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Vr(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=Vr(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return al(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){let o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),c=Vr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=dx(u,pd)-1,f=dx(f,pd)-1):(u=fx(u,pd),f=fx(f,pd)),fg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=Vr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=dx(c,pd)-1,u=dx(u,pd)-1):(c=fx(c,pd),u=fx(u,pd)),fg(n,c,u,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){let n=hg(this.resolutions_,e,t||0);return _i(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return J4(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}},gx=tP;function _w(i){let e=i.getDefaultTileGrid();return e||(e=ioe(i),i.setDefaultTileGrid(e)),e}function TG(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=xw(t);if(!xc(s,r)){let o=Wn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function noe(i,e,t,n){n=n!==void 0?n:"top-left";let r=MG(i,e,t);return new gx({extent:i,origin:D9(i,n),resolutions:r,tileSize:t})}function EG(i){let e=i||{},t=e.extent||As("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:MG(t,e.maxZoom,e.tileSize,e.maxResolution)};return new gx(n)}function MG(i,e,t,n){e=e!==void 0?e:42,t=Vr(t!==void 0?t:256);let r=gr(i),s=Wn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function ioe(i,e,t,n){let r=xw(i);return noe(r,e,t,n)}function xw(i){i=As(i);let e=i.getExtent();if(!e){let t=180*$h.degrees/i.getMetersPerUnit();e=al(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Un(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function Ag(i,e,t,n){return Un(i,e,t,n,!0)}function ii(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),_u(i))}var Jt={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var nP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ad=nP;function Kh(){return!0}function Zh(){return!1}function Qh(){}function yw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Io(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function CG(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}var iP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Xs=iP;var rP=class extends Ad{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let s=t?new Xs(e):e;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let c=0,u=r.length;c<u;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,Qh);delete o[n]}return l}disposeInternal(){this.listeners_&&_u(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=Qh,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},md=rP;var G0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",roe=G0.includes("safari")&&!G0.includes("chrom"),bIe=roe&&(G0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(G0)),RG=G0.includes("webkit")&&!G0.includes("edge"),sP=G0.includes("macintosh"),PG=typeof devicePixelRatio<"u"?devicePixelRatio:1,Ls=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,oP=typeof Image<"u"&&Image.prototype.decode;var vw=(function(){let i=!1;try{let e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})();function IG(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[Ag(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&oP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(Ag(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ii)}}function soe(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s),e&&(i.src=e)})}function NG(i,e){return e&&(i.src=e),i.src&&oP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):soe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function aP(i){return Math.pow(i,3)}function ql(i){return 1-aP(1-i)}function LG(i){return 3*i*i-2*i*i*i}function DG(i){return i}var lP=class extends md{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(Jt.CHANGE)}release(){this.setState(rn.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==rn.EMPTY){if(this.state!==rn.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){$n()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:aP(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},mg=lP;function Si(i,e,t,n){let r;return t&&t.length?r=t.shift():Ls?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}var cP;function _x(){return cP||(cP=Si(1,1)),cP}function z0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function uP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function FG(i){for(;i.lastChild;)i.lastChild.remove()}function OG(i,e){let t=i.childNodes;for(let n=0;;++n){let r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function bw(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function ll(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var hP=class extends mg{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,Ls?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=rn.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=rn.ERROR,this.unlistenImage_(),this.image_=ooe(),this.changed()}handleImageLoad_(){if(Ls)this.state=rn.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=rn.LOADED:this.state=rn.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==rn.ERROR&&(this.state=rn.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==rn.IDLE&&(this.state=rn.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=IG(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function ooe(){let i=Si(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var ww=hP;var fP,V0=[];function BG(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function dP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function aoe(){if(fP===void 0){let i=Si(6,6,V0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",BG(i,4,5,4,0),BG(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;fP=dP(e,0)||dP(e,4)||dP(e,8),z0(i),V0.push(i.canvas)}return fP}function UG(i,e,t,n){let r=ug(t,e,i),s=Z4(e,n,t),o=e.getMetersPerUnit();o!==void 0&&(s*=o);let a=i.getMetersPerUnit();a!==void 0&&(s/=a);let l=i.getExtent();if(!l||xc(l,r)){let c=Z4(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function kG(i,e,t,n){let r=Oa(t),s=UG(i,e,r,n);return(!isFinite(s)||s<=0)&&nw(t,function(o){return s=UG(i,e,o,n),isFinite(s)&&s>0}),s}function GG(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Si(Math.round(t*i),Math.round(t*e),V0);if(f||(v.imageSmoothingEnabled=!1),l.length===0)return v.canvas;v.scale(t,t);function w(L){return Math.round(L*t)/t}v.globalCompositeOperation="lighter";let S=Er();l.forEach(function(L,D,F){tw(S,L.extent)});let T,P=t/n,R=(f?1:1+Math.pow(2,-24))/P;if(!p||l.length!==1||c!==0){if(T=Si(Math.round(Wn(S)*P),Math.round(gr(S)*P),V0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*P,D=-(r[3]-S[3])*P,F=Wn(r)*P,N=gr(r)*P;T.rect(L,D,F,N),T.clip()}l.forEach(function(L,D,F){if(L.image.width>0&&L.image.height>0){if(L.clipExtent){T.save();let H=(L.clipExtent[0]-S[0])*P,K=-(L.clipExtent[3]-S[3])*P,J=Wn(L.clipExtent)*P,j=gr(L.clipExtent)*P;T.rect(f?H:Math.round(H),f?K:Math.round(K),f?J:Math.round(H+J)-Math.round(H),f?j:Math.round(K+j)-Math.round(K)),T.clip()}let N=(L.extent[0]-S[0])*P,B=-(L.extent[3]-S[3])*P,z=Wn(L.extent)*P,V=gr(L.extent)*P;T.drawImage(L.image,c,c,L.image.width-2*c,L.image.height-2*c,f?N:Math.round(N),f?B:Math.round(B),f?z:Math.round(N+z)-Math.round(N),f?V:Math.round(B+V)-Math.round(B)),L.clipExtent&&T.restore()}})}let C=zl(o);return a.getTriangles().forEach(function(L,D,F){let N=L.source,B=L.target,z=N[0][0],V=N[0][1],H=N[1][0],K=N[1][1],J=N[2][0],j=N[2][1],Z=w((B[0][0]-C[0])/s),ee=w(-(B[0][1]-C[1])/s),ae=w((B[1][0]-C[0])/s),ce=w(-(B[1][1]-C[1])/s),de=w((B[2][0]-C[0])/s),ve=w(-(B[2][1]-C[1])/s),Ie=z,Qe=V;z=0,V=0,H-=Ie,K-=Qe,J-=Ie,j-=Qe;let Ue=[[H,K,0,0,ae-Z],[J,j,0,0,de-Z],[0,0,H,K,ce-ee],[0,0,J,j,ve-ee]],mt=z9(Ue);if(!mt)return;if(v.save(),v.beginPath(),aoe()||!f){v.moveTo(ae,ce);let ze=4,$e=Z-ae,Et=ee-ce;for(let Tt=0;Tt<ze;Tt++)v.lineTo(ae+w((Tt+1)*$e/ze),ce+w(Tt*Et/(ze-1))),Tt!=ze-1&&v.lineTo(ae+w((Tt+1)*$e/ze),ce+w((Tt+1)*Et/(ze-1)));v.lineTo(de,ve)}else v.moveTo(ae,ce),v.lineTo(Z,ee),v.lineTo(de,ve);v.clip(),v.transform(mt[0],mt[2],mt[1],mt[3],Z,ee),v.translate(S[0]-Ie,S[3]-Qe);let Me;if(T)Me=T.canvas,v.scale(R,-R);else{let ze=l[0],$e=ze.extent;Me=ze.image,v.scale(Wn($e)/Me.width,-gr($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&(z0(T),V0.push(T.canvas)),u&&(v.save(),v.globalCompositeOperation="source-over",v.strokeStyle="black",v.lineWidth=1,a.getTriangles().forEach(function(L,D,F){let N=L.target,B=(N[0][0]-C[0])/s,z=-(N[0][1]-C[1])/s,V=(N[1][0]-C[0])/s,H=-(N[1][1]-C[1])/s,K=(N[2][0]-C[0])/s,J=-(N[2][1]-C[1])/s;v.beginPath(),v.moveTo(V,H),v.lineTo(B,z),v.lineTo(K,J),v.closePath(),v.stroke()}),v.restore()),v.canvas}var loe=[1,0,0,1,0,0],QIe=new Array(6);function $s(){return loe.slice(0)}function zG(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function Mr(i,e){let t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function lo(i,e,t,n,r,s,o,a){let l=Math.sin(s),c=Math.cos(s);return i[0]=n*c,i[1]=r*l,i[2]=-n*l,i[3]=r*c,i[4]=o*n*c-a*n*l+e,i[5]=o*r*l+a*r*c+t,i}function Tw(i,e){let t=coe(e);zn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function coe(i){return i[0]*i[3]-i[1]*i[2]}var uoe=[1e5,1e5,1e5,1e5,2,2];function VG(i){return"matrix("+i.join(", ")+")"}function Sw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function qG(i,e){let t=Sw(i),n=Sw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*uoe[r])!==0)return!1;return!0}var hoe=10,HG=.25,pP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?uG(R=>Mr(a,ug(R,this.targetProj_,this.sourceProj_))):B0(this.targetProj_,this.sourceProj_);this.transformInv_=function(R){let C=R[0]+"/"+R[1];return l[C]||(l[C]=c(R)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Wn(r)>=Wn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Wn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Wn(this.targetProj_.getExtent()):null;let u=zl(n),f=ig(n),p=ng(n),x=tg(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),P=hoe+(o?Math.max(0,Math.ceil(Math.log2(ux(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,p,x,v,w,S,T,P),this.wrapsXInSource_){let R=1/0;this.triangles_.forEach(function(C,L,D){R=Math.min(R,C.source[0][0],C.source[1][0],C.source[2][0])}),this.triangles_.forEach(C=>{if(Math.max(C.source[0][0],C.source[1][0],C.source[2][0])-R>this.sourceWorldWidth_/2){let L=[[C.source[0][0],C.source[0][1]],[C.source[1][0],C.source[1][1]],[C.source[2][0],C.source[2][1]]];L[0][0]-R>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-R>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-R>this.sourceWorldWidth_/2&&(L[2][0]-=this.sourceWorldWidth_);let D=Math.min(L[0][0],L[1][0],L[2][0]);Math.max(L[0][0],L[1][0],L[2][0])-D<this.sourceWorldWidth_/2&&(C.source=L)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=F4([s,o,a,l]),f=this.sourceWorldWidth_?Wn(u)/this.sourceWorldWidth_:null,p=this.sourceWorldWidth_,x=this.sourceProj_.canWrapX()&&f>.5&&f<1,v=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=F4([e,t,n,r]);v=Wn(S)/this.targetWorldWidth_>HG||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>HG||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!_r(u,this.maxSourceExtent_))return;let w=0;if(!v&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)v=!0;else if(w=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!v){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),P;x?P=(gu(s[0],p)+gu(a[0],p))/2-gu(T[0],p):P=(s[0]+a[0])/2-T[0];let R=(s[1]+a[1])/2-T[1];v=P*P+R*R>this.errorThresholdSquared_}if(v){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),P=[(r[0]+e[0])/2,(r[1]+e[1])/2],R=this.transformInv_(P);this.addQuad_(e,t,S,P,s,o,T,R,c-1),this.addQuad_(P,S,n,r,R,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),P=[(n[0]+r[0])/2,(n[1]+r[1])/2],R=this.transformInv_(P);this.addQuad_(e,S,P,r,s,T,R,l,c-1),this.addQuad_(S,t,n,P,T,o,a,R,c-1)}return}}if(x){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=Er();return this.triangles_.forEach(function(t,n,r){let s=t.source;N0(e,s[0]),N0(e,s[1]),N0(e,s[2])}),e}getTriangles(){return this.triangles_}},WG=pP;var AP=class extends mg{constructor(e,t,n,r,s,o,a,l,c,u,f,p){super(s,rn.IDLE,p),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let x=r.getTileCoordExtent(this.wrappedTileCoord_),v=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=v?Au(x,v):x;if(ux(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=Au(w,T):w=T);let P=r.getResolution(this.wrappedTileCoord_[0]),R=kG(e,n,S,P);if(!isFinite(R)||R<=0){this.state=rn.EMPTY;return}let C=u!==void 0?u:.5;if(this.triangulation_=new WG(e,n,S,w,R*C,P),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(R);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=_i(L[1],w[1],w[3]),L[3]=_i(L[3],w[1],w[3])):L=Au(L,w)),!ux(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=Wn(T),F=Math.floor((L[0]-T[0])/D)),iw(L.slice(),e,!0).forEach(B=>{let z=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let V=z.minX;V<=z.maxX;V++)for(let H=z.minY;H<=z.maxY;H++){let K=F*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,V,H,a),offset:K})}++F}),this.sourceTiles_.length===0&&(this.state=rn.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==rn.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=rn.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=GG(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=rn.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==rn.IDLE){this.state=rn.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==rn.IDLE||n==rn.LOADING){e++;let r=Un(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ii(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==rn.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(ii),this.sourcesListenerKeys_=null}release(){this.canvas_&&(z0(this.canvas_.getContext("2d")),V0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Ew=AP;var foe=/\{z\}/g,doe=/\{x\}/g,poe=/\{y\}/g,Aoe=/\{-y\}/g;function jG(i,e,t,n,r){return i.replace(foe,e.toString()).replace(doe,t.toString()).replace(poe,n.toString()).replace(Aoe,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function XG(i){let e=[],t=/\{([a-z])-([a-z])\}/.exec(i);if(t){let n=t[1].charCodeAt(0),r=t[2].charCodeAt(0),s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){let n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function moe(i,e){return(function(t,n,r){if(!t)return;let s,o=t[0];if(e){let a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return jG(i,o,t[1],t[2],s)})}function $G(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=moe(i[r],e);return goe(n)}function goe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=bG(e),s=gu(r,i.length);return i[s](e,t,n)})}var Mc={PROPERTYCHANGE:"propertychange"};var gg=class extends md{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Jt.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Un(this,e[s],t);return r}return Un(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=Ag(this,e[s],t)}else n=Ag(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)_oe(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}};gg.prototype.on;gg.prototype.once;gg.prototype.un;function _oe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ii(i[e]);else ii(i)}var Mw=gg;var Cw=class extends Xs{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},mP=class extends Mw{constructor(e){super(),this.on,this.once,this.un,Nn(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new Cw(n,e,t)),n=Mc.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Cw(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||(this.values_={});if(n)r[e]=t;else{let s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],bc(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},ms=mP;var gP=class extends ms{constructor(e){super(),this.projection=As(e.projection),this.attributions_=YG(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e==="ready"?Promise.resolve():e==="error"?Promise.reject(new Error("Source failed to load")):new Promise((t,n)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),t()):s==="error"&&(this.un("change",r),n(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=YG(e),this.changed()}setState(e){this.state_=e,this.changed()}};function YG(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Rw=gP;var _P=class extends Rw{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;let t=[256,256];this.tileGrid&&Vr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Nn(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return $n()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:_w(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=Vr(r.getTileSize(e),this.tmpSize);return s==1?o:dG(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=TG(r,e,n)),wG(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Pw=class extends Xs{constructor(e,t){super(e),this.tile=t}},KG=_P;var Iw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var xP=class i extends KG{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Nn(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=Iw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?Iw.TILELOADERROR:r==rn.LOADED?Iw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Pw(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){let t=XG(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2-`);this.generateTileUrlFunction_?this.setTileUrlFunction($G(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},ZG=xP;var yP=class extends ZG{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:xoe,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:ww,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!cg(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||cg(t,e)))return this.tileGrid;let n=Nn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=_w(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?rn.IDLE:rn.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(Jt.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||cg(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),p=this.getTileCoordForTileUrlFunction(l,s),x=new Ew(a,u,s,f,l,p,this.getTilePixelRatio(r),this.getGutter(),(v,w,S,T)=>this.getTileInternal(v,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return x.key=c,x}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=dg(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);let c=this.createTile_(e,t,n,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=As(e);if(n){let r=Nn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function xoe(i,e){if(Ls){let t=i.getCrossOrigin(),n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include");let s={mode:n,credentials:r,referrerPolicy:i.getReferrerPolicy()};fetch(e,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=i.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}var QG=yP;var vP=class extends QG{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:EG({extent:xw(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}},JG=vP;function Cc(){if(!k.map||!k.variant||k.settling)return;let i=k.engine?.getView();try{let e=ez();e.last=k.game.slug,e.games[k.game.slug]={game:k.game.slug,map:k.map.slug,variant:k.map.variants.indexOf(k.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...k.hiddenCategories],collapsed:[...k.collapsedSections],overviewDocked:k.overviewDocked,dockFolded:k.dockFolded,dockDismissed:k.dockDismissed},localStorage.setItem(D4,JSON.stringify(e))}catch{}}function ez(){try{let i=JSON.parse(localStorage.getItem(D4)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function _g(i){let e=ez(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function xg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function tz(){if(!k.game||!k.map)return;let i=`#${k.game.slug}/${k.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var bP=class i extends ms{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(ii(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=Un(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?yoe(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function yoe(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(zn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var gd=bP;function Ua(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){let c=i[l],u=i[l+1];s[a++]=r[0]*c+r[2]*u+r[4],s[a++]=r[1]*c+r[3]*u+r[5];for(let f=2;f<o;f++)s[a++]=i[l+f]}return s&&s.length!=a&&(s.length=a),s}function Nw(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let p=e;p<t;p+=n){let x=i[p]-c,v=i[p+1]-u;o[f++]=c+x*a-v*l,o[f++]=u+x*l+v*a;for(let w=p+2;w<p+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function nz(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let p=i[f]-l,x=i[f+1]-c;a[u++]=l+r*p,a[u++]=c+s*x;for(let v=f+2;v<f+n;++v)a[u++]=i[v]}return a&&a.length!=u&&(a.length=u),a}function iz(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let c=l+2;c<l+n;++c)o[a++]=i[c]}return o&&o.length!=a&&(o.length=a),o}var rz=$s(),voe=[NaN,NaN],wP=class extends ms{constructor(){super(),this.extent_=Er(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=yw((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return $n()}closestPointXY(e,t,n,r){return $n()}containsXY(e,t){return this.closestPointXY(e,t,voe,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return $n()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&P0(t),this.extentRevision_=this.getRevision()}return F9(this.extent_,e)}rotate(e,t){$n()}scale(e,t,n){$n()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return $n()}getType(){return $n()}applyTransform(e){$n()}intersectsExtent(e){return $n()}translate(e,t){$n()}transform(e,t){let n=As(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=gr(c)/gr(l);lo(rz,c[0],c[3],u,-u,0,0,0);let f=Ua(s,0,s.length,a,rz,o),p=B0(n,t);return p?p(f,f,a):f}:B0(n,t);return this.applyTransform(r),this}},sz=wP;var SP=class extends sz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return eg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return $n()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=oz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){$n()}setLayout(e,t,n){let r;if(e)r=oz(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=boe(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Nw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=Oa(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();nz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();iz(n,0,n.length,r,e,t,n),this.changed()}}};function boe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function oz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function az(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return Ua(n,0,n.length,r,e,t)}var xu=SP;function lz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function xx(i,e,t,n){for(let r=0,s=t.length;r<s;++r){let o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function TP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=xx(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function cz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=TP(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}var EP=class i extends xu{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=yc(e,t,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return ew(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return cx(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=lz(this.flatCoordinates,0,e,this.stride),this.changed()}},Jh=EP;function MP(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1],a=0,l=0;for(;e<t;e+=n){let c=i[e]-s,u=i[e+1]-o;r+=l*c-a*u,a=c,l=u}return r/2}function CP(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=MP(i,e,a,n),e=a}return r}function uz(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=CP(i,e,a,n),e=a[a.length-1]}return r}function hz(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let p=((r-a)*c+(s-l)*u)/(c*c+u*u);if(p>1)f=t;else if(p>0){for(let x=0;x<n;++x)o[x]=Po(i[e+x],i[t+x],p);o.length=n;return}else f=e}for(let p=0;p<n;++p)o[p]=i[f+p];o.length=n}function RP(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=yc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function PP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=RP(i,e,a,n,r),e=a}return r}function fz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=PP(i,e,a,n,r),e=a[a.length-1]}return r}function IP(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=yc(o,a,i[e],i[e+1]),p<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,p}return c}u=u||[NaN,NaN];let x=e+n;for(;x<t;)if(hz(i,x-n,x,n,o,a,u),p=yc(o,a,u[0],u[1]),p<c){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n,x+=n}else x+=n*Math.max((Math.sqrt(p)-Math.sqrt(c))/r|0,1);if(s&&(hz(i,t-n,e,n,o,a,u),p=yc(o,a,u[0],u[1]),p<c)){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function NP(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=IP(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function dz(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=NP(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function yu(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function yg(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=yu(i,e,l,n,r[s]),e=l}return r.length=s,r}function yx(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=l.length===1&&l[0]===e?[]:yg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function vx(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),p=c.pop(),x=0,v=i[p],w=i[p+1],S=i[f],T=i[f+1];for(let P=p+n;P<f;P+=n){let R=i[P],C=i[P+1],L=G9(R,C,v,w,S,T);L>x&&(u=P,x=L)}x>r&&(l[(u-e)/n]=1,p+n<u&&c.push(p,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function pz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=vx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function _d(i,e){return e*Math.round(i/e)}function woe(i,e,t,n,r,s,o){if(e==t)return o;let a=_d(i[e],r),l=_d(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=_d(i[e],r),u=_d(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=_d(i[e],r),p=_d(i[e+1],r);if(e+=n,f==c&&p==u)continue;let x=c-a,v=u-l,w=f-a,S=p-l;if(x*S==v*w&&(x<0&&w<x||x==w||x>0&&w>x)&&(v<0&&S<v||v==S||v>0&&S>v)){c=f,u=p;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=p}return s[o++]=c,s[o++]=u,o}function bx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=woe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Az(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=bx(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var LP=class i extends xu{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(RP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),IP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return MP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return yu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=vx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return gw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xx(this.flatCoordinates,0,e,this.stride),this.changed()}},DP=LP;function wx(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v=r[s+1],w=[];for(let P=0,R=t.length;P<R;++P){let C=t[P];for(u=i[C-n],p=i[C-n+1],a=e;a<C;a+=n)f=i[a],x=i[a+1],(v<=p&&x<=v||p<=v&&v<=x)&&(c=(v-p)/(x-p)*(f-u)+u,w.push(c)),u=f,p=x}let S=NaN,T=-1/0;for(w.sort(Ba),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let P=Math.abs(f-u);P>T&&(c=(u+f)/2,mx(i,e,t,n,c,v)&&(S=c,T=P)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,v,T),o):[S,v,T]}function Lw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=wx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function mz(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){let s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function FP(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){let a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function OP(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=FP(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function gz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!OP(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Dw(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=FP(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&mz(i,e,a,n),e=a}return e}function BP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Dw(i,e,t[s],n,r);return e}function _z(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=FP(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}var Fw=class i extends xu{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Ec(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(PP(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),NP(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return mx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return CP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Dw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,yg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Oa(this.getExtent());this.flatInteriorPoint_=wx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Jh(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new DP(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o],c=new DP(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;OP(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Dw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=bx(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return eP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=TP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},vu=Fw;function UP(i){if(mu(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new Fw(s,"XY",[s.length])}function xz(){let i=k.variant?.surface;return i?[i.x,-(i.y+i.height),i.x+i.width,-i.y]:Su()}function yz(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),vz(),k.gridEnabled?(we.gridInput.focus(),we.gridInput.select()):we.viewport.focus({preventScroll:!0}),!0):i.key===" "&&k.gridEnabled&&i.target!==we.subgridToggle?(i.preventDefault(),Sx(!k.subgridVisible),!0):i.key==="Escape"&&k.gridEnabled?(i.preventDefault(),kP(),!0):!1}function vz(i=!k.gridEnabled){k.gridEnabled=i,i&&Sx(!0),Bw(),bu(),k.layers.pins.changed(),k.layers.text.changed(),k.layers.priority.changed()}function Sx(i){k.subgridVisible=i,k.layers.grid.changed(),k.layers.gridContext.changed(),we.subgridToggle.setAttribute("aria-pressed",String(i)),we.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),bz()}function bz(){if(!k.gridEnabled){we.gridHint.textContent="G \xB7 grid off";return}we.gridHint.textContent=`G-${k.gridPrefix||"root"}`+(k.subgridVisible?"":" no subgrid")}function Tx(i){let e=q0(),t=[...i.toLocaleLowerCase()].filter(r=>Gl.includes(r)).slice(0,e).join(""),n=t!==k.gridPrefix;k.gridPrefix=t,k.gridEnabled||(k.gridEnabled=!0),Bw(),bu(),k.layers.pins.changed(),k.layers.text.changed(),k.layers.priority.changed(),n&&(Rc(),k.engine.getView().fit(vg(),{size:k.engine.getSize(),padding:[52,52,52,52],maxZoom:wu(k.variant),duration:180}))}function kP(){if(k.gridEnabled){if(!k.gridPrefix){vz(!1);return}Tx(k.gridPrefix.slice(0,-1))}}function Bw(){if(!k.sources||(k.sources.grid.clear(),k.sources.gridContext.clear(),we.gridNavigator.hidden=!k.gridEnabled,bz(),!k.gridEnabled||!k.variant))return;let i=q0();if(we.gridInput.maxLength=i,we.gridInput.value=k.gridPrefix,we.gridBack.title=k.gridPrefix?"Back one geohash level":"Close geohash grid",Toe(),k.gridPrefix.length>=i){Ow(k.gridPrefix,vg(),"leaf");return}k.gridPrefix&&Ow(k.gridPrefix,vg(),"scope");for(let e of Gl){let t=k.gridPrefix+e;Ow(t,GP(t),"child")}}function Toe(){for(let i=0;i<k.gridPrefix.length;i++){let e=k.gridPrefix.slice(0,i),t=k.gridPrefix.slice(0,i+1);for(let n of Gl){let r=e+n;r!==t&&Ow(r,GP(r),"neighbor",k.gridPrefix.length-i)}}}function Ow(i,e,t,n=0){let[r,s,o,a]=e,l=k.pins.filter(f=>{if(f.filteredHidden)return!1;let[p,x]=f.coordinate;return p>=r&&p<=o&&x>=s&&x<=a}).length,c=new gd({geometry:new vu([[[r,s],[r,a],[o,a],[o,s],[r,s]]]),gridCell:{hash:i,extent:e,role:t,count:l,contextDistance:n},priority:t==="neighbor"?-n*100+Gl.indexOf(i[i.length-1]):Gl.indexOf(i[i.length-1])});(t==="neighbor"?k.sources.gridContext:k.sources.grid).addFeature(c)}function vg(){return GP(k.gridPrefix)}function GP(i){let e=[...xz()],t=!0;for(let n of i){let r=Gl.indexOf(n);if(!(r<0))for(let s of[16,8,4,2,1]){if(t){let o=(e[0]+e[2])/2;r&s?e[0]=o:e[2]=o}else{let o=(e[1]+e[3])/2;r&s?e[1]=o:e[3]=o}t=!t}}return e}function q0(){return 3}function wz(i,e=q0()){let t=[...xz()],[n,r]=i;if(n<t[0]||n>t[2]||r<t[1]||r>t[3])return"";let s=!0,o="";for(let a=0;a<e;a++){let l=0;for(let c of[16,8,4,2,1]){if(s){let u=(t[0]+t[2])/2;n>=u?(l|=c,t[0]=u):t[2]=u}else{let u=(t[1]+t[3])/2;r>=u?(l|=c,t[1]=u):t[3]=u}s=!s}o+=Gl[l]}return o}function bg(i){if(!k.gridEnabled||!k.gridPrefix)return!1;let e=vg(),[t,n]=i.coordinate;return t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]}function H0(){return L9[k.map?.iconOutset==="dark"?"dark":"light"]}function Eoe(i){let e=k.map?.iconOutset==="dark",t=Coe(i);return(e?t>.3:t<.88)?i:Moe(i,e?.74:.42)}function Moe(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(R=>parseInt(t.slice(R,R+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let p=(1-Math.abs(2*e-1))*f,x=p*(1-Math.abs(c/60%2-1)),v=e-p/2,[w,S,T]=c<60?[p,x,0]:c<120?[x,p,0]:c<180?[0,p,x]:c<240?[0,x,p]:c<300?[x,0,p]:[p,0,x],P=R=>Math.round((R+v)*255).toString(16).padStart(2,"0");return`#${P(w)}${P(S)}${P(T)}`}function Coe(i){let e=String(i).replace("#","");if(e.length!==6)return .5;let t=n=>parseInt(e.slice(n,n+2),16)/255;return .2126*t(0)+.7152*t(2)+.0722*t(4)}function Uw(i){let e=Math.abs(Number(i)||0);return Qm[(Math.imul(e,2654435761)>>>0)%Qm.length]}function ef(i,e){let t=String(i||"#ffffff").replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.slice(0,6).padEnd(6,"f"),r=Number.parseInt(n,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${e})`}function wg(i,e){i.style.setProperty("--pin-color",W0(e))}function W0(i){return Eoe(i.color||Uw(i.id))}function Sg(i,e,t){if(i.classList.remove("has-source-icon"),i.style.removeProperty("--pin-icon"),i.textContent="",!e.iconAsset){i.textContent=t;return}i.style.setProperty("--pin-icon",`url("${zP(e.iconAsset)}")`),i.classList.add("has-source-icon")}function zP(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${k.game.base}/icons/${e}`}function Pc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Sz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function Tz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3-4-`).trim()}function Ic(i){return new Intl.NumberFormat().format(i)}function cl(i,e,t){return Math.min(t,Math.max(e,i))}function kw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var Roe=100;function xd(){if(!we.searchResults)return;let i=k.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,Roe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=k.search?"No visible locations match.":"Nothing is enabled. Show a category to list its locations.",t.append(n)}for(let n of e){let r=document.createElement("button");r.type="button",r.className="search-result",k.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),wg(r,n.category);let s=document.createElement("span");s.className="result-dot",Sg(s,n.category,Pc(n.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=n.location.title;let l=document.createElement("small");l.textContent=`${n.category.title} \xB7 ${n.group.title}`,o.append(a,l),r.append(s,o),t.append(r)}if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${Ic(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}we.searchResults.replaceChildren(t),Ioe(i.length),Poe()}var Ez=28;function Poe(){let i=k.selectedPin?.location.title||"",e=i.length>Ez?`${i.slice(0,Ez-1).trimEnd()}\u2026`:i;we.dockRailName.textContent=e?` \xB7 ${e}`:"",we.dockRailName.hidden=!e}function Ioe(i){we.dockCount.textContent=`${Ic(i)} ${i===1?"location":"locations"}`,k.search?(we.dockFlag.textContent=`\u201C${k.search}\u201D`,we.dockFlag.hidden=!1):k.hiddenCategories.size>0?(we.dockFlag.textContent="filtered",we.dockFlag.hidden=!1):we.dockFlag.hidden=!0}function Gw(){!k.dockFolded||k.dockDismissed||zw(!1)}function VP(i){k.dockDismissed=i,zw(i)}function zw(i,e=!0){k.dockFolded=i,we.dock.classList.toggle("is-folded",i),we.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";we.dockFold.setAttribute("aria-label",t),we.dockFold.setAttribute("title",t),e&&Cc()}function qP(i){k.hiddenCategories.delete(i.category.id),Mx(),Hl(),yd(),Ex(i,!0)}function Ex(i,e=!1){k.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),bu(),k.layers.pins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.textDetail.changed(),k.layers.priority.changed(),we.detailTitle.textContent=i.location.title,we.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,we.detailDescription.textContent="",we.detailLinks.hidden=!0,Loe(i),we.detailID.textContent=String(i.location.id),we.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=wz(i.coordinate);we.detailCell.textContent=t,we.detailCellField.hidden=!t;let n=Noe(i);if(we.detailSource.textContent=n,we.detailSourceField.hidden=!n,wg(we.detailDot,i.category),Sg(we.detailDot,i.category,Pc(i.category.title)),we.detail.hidden=!1,Gw(),xd(),e){let r=k.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(wu(k.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function Noe(i){let e=k.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(k.pinSourceIndex?.map!==k.map){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}k.pinSourceIndex={map:k.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return k.pinSourceIndex.byID.get(i.location.id)||t}async function Loe(i){let e=await Mz();if(k.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],we.detailDescription.textContent=Tz(t.d)||"No description is included in the archive.",Doe(i)}function Doe(i){let e=(i.location.links||[]).filter(n=>k.pinByID.has(n.locationId));if(we.detailLinks.hidden=e.length===0,!e.length){we.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}we.detailLinks.replaceChildren(t)}function Rc(){let i=k.selectedPin!==null;k.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),k.sources&&(bu(),k.layers.pins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.textDetail.changed(),k.layers.priority.changed()),we.detail.hidden=!0,i&&xd()}function Tu(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function Cz(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function Tg(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(p,x){return[c-(x-s)/a*(c-f),l+(p-r)/o*(u-l)]},toWorld(p,x){return[r+(x-l)/(u-l)*o,s+(c-p)/(c-f)*a]}}}var qw=[NaN,NaN,NaN,0],HP;function Foe(){return HP||(HP=Si(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),HP}var Ooe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Boe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Uoe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,koe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Vw(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Rx(i){throw new Error('failed to parse "'+i+'" as color')}function Rz(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Boe)||i.match(Ooe)||i.match(Uoe);if(s){let o=s[4],a=100/255;return[_i(Vw(s[1],a)+.5|0,0,255),_i(Vw(s[2],a)+.5|0,0,255),_i(Vw(s[3],a)+.5|0,0,255),o!==void 0?_i(Vw(o,100),0,1):1]}Rx(i)}if(i.startsWith("#")){if(koe.test(i)){let s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let u=parseInt(s.substring(l,l+o),16);o===1&&(u+=u<<4),a[l/o]=u}return a[3]=a[3]/255,a}Rx(i)}let e=Foe();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&Rx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Rz(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=L0(r[3]/255,3),r}function Pz(i){return typeof i=="string"?i:Ix(i)}var Goe=1024,Cx={},WP=0;function Iz(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function jP(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function XP(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function $P(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function YP(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function KP(i){let e=$P(i[0]),t=$P(i[1]),n=$P(i[2]),r=YP(e*.222488403+t*.716873169+n*.06060791),s=500*(YP(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-YP(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function Nz(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=XP(e),s=XP(e+t/500*Math.cos(n)),o=XP(e-t/200*Math.sin(n)),a=jP(s*3.021973625-r*1.617392459-o*.404875592),l=jP(s*-.943766287+r*1.916279586+o*.027607165),c=jP(s*.069407491-r*.22898585+o*1.159737864);return[_i(a+.5|0,0,255),_i(l+.5|0,0,255),_i(c+.5|0,0,255),i[3]]}function Px(i){if(i==="none")return qw;if(Cx.hasOwnProperty(i))return Cx[i];if(WP>=Goe){let t=0;for(let n in Cx)(t++&3)===0&&(delete Cx[n],--WP)}let e=Rz(i);e.length!==4&&Rx(i);for(let t of e)isNaN(t)&&Rx(i);return Cx[i]=e,++WP,e}function Wl(i){return Array.isArray(i)?i:Px(i)}function Ix(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);let r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}var QP=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=ZP(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=ZP(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=ZP(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Mn.IDLE&&n.load(),n.getImageState()===Mn.LOADING?n.ready().then(()=>{this.patternCache_[s]=_x().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=_x().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function ZP(i,e){let t=e?Wl(e):"null";return i+":"+t}var No=new QP;var Nx=null,Hw=class extends md{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Mn.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mn.LOADED){Nx||(Nx=Si(1,1,void 0,{willReadFrequently:!0})),Nx.drawImage(this.image_,0,0);try{Nx.getImageData(0,0,1,1),this.tainted_=!1}catch{Nx=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Jt.CHANGE)}handleImageError_(){this.imageState_=Mn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Si(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&NG(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mn.LOADED)return;let t=this.image_,n=Si(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Pz(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)e();else{let t=()=>{(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)&&(this.removeEventListener(Jt.CHANGE,t),e())};this.addEventListener(Jt.CHANGE,t)}})),this.ready_}};function vd(i,e,t,n,r,s){let o=e===void 0?void 0:No.get(e,r);return o||(o=new Hw(i,i&&"src"in i?i.src||void 0:e,t,n,r),No.set(e,r,o,s)),s&&o&&!No.getPattern(e,r)&&No.set(e,r,o,s),o}var Lz=Hw;function ka(i){return i?Array.isArray(i)?Ix(i):typeof i=="object"&&"src"in i?zoe(i):i:null}function zoe(i){if(!i.offset||!i.size)return No.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=No.getPattern(e,i.color);if(t)return t;let n=No.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Si(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),vd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),No.getPattern(e,i.color)}var Lx="ol-hidden";var bd="ol-unselectable";var Eg="ol-control",JP="ol-collapsed",Voe=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),Dz=["style","variant","weight","size","lineHeight","family"],Ww={normal:400,bold:700},jw=function(i){let e=i.match(Voe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=Dz.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[Dz[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in Ww&&(t.weight=Ww[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var Xw="10px sans-serif",Ds="#000",Eu="round",Ga=[],za=0,Mu="round",tf=10,Oz=0,Lo="#000",wd="center",X0="middle",nf=[0,0,0,0],rf=1,j0=new ms,Dx=null,Fz,eI={},qoe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Hoe(i,e,t){return`${i} ${e} 16px "${t}"`}var Bz=(function(){let e,t;async function n(s){await t.ready;let o=jw(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=Ww[f.weight]||f.weight;p===a&&f.style===o.style&&x==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=j0.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(_u(eI),j0.set(c,100)):(u+=10,j0.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Ls?self.fonts:document.fonts);let o=jw(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(qoe.has(c))continue;let u=Hoe(o.style,o.weight,c);j0.get(u)===void 0&&(j0.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Woe=(function(){let i;return function(e){let t=eI[e];if(t==null){if(Ls){let n=jw(e),r=Uz(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);eI[e]=t}return t}})();function Uz(i,e){return Dx||(Dx=Si(1,1)),i!=Fz&&(Dx.font=i,Fz=Dx.font),Dx.measureText(e)}function kz(i,e){return Uz(i,e).width}function tI(i,e,t){if(e in t)return t[e];let n=e.split(`5-`).reduce((r,s)=>Math.max(r,kz(i,s)),0);return t[e]=n,n}function Gz(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`6-`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let p=e[c+1]||i.font,x=kz(p,f);t.push(x),o+=x;let v=Woe(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function zz(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),joe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function joe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var nI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Vr(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return $n()}getImage(e){return $n()}getHitDetectionImage(){return $n()}getPixelRatio(e){return 1}getImageState(){return $n()}getImageSize(){return $n()}getOrigin(){return $n()}getSize(){return $n()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Vr(e)}listenImageChange(e){$n()}load(){$n()}unlistenImageChange(e){$n()}ready(){return Promise.resolve()}},$w=nI;var iI=class i extends $w{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Mn.LOADING:Mn.LOADED,this.imageState_===Mn.LOADING&&this.ready().then(()=>this.imageState_=Mn.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=No.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Si(o,o);this.draw_(s,a,e),r=a.canvas;let l=new Lz(r,void 0,null,Mn.LOADED,null);No.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),p=f/l;if(e==="miter"&&p<=n)return p*t;let x=t/2/p,v=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+v*v)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),P=Math.sqrt(r*r-T*T),R=s-P,L=Math.sqrt(T*T+R*R)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Eu,t=Mu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=ka(this.stroke_.getColor()??Lo),a=this.stroke_.getWidth()??rf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Mu,e=this.stroke_.getLineCap()??Eu,n=this.stroke_.getMiterLimit()??tf);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=Ds),t.fillStyle=ka(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Wl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Si(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Ds,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},Yw=iI;var rI=class i extends Yw{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},Kw=rI;var sI=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=vd(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Mn.IDLE&&t.load(),t.getImageState()===Mn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Nn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Wl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},qr=sI;function Vz(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var oI=class i extends $w{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;zn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Nn(o)),zn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),zn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Mn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Mn.LOADED:Mn.IDLE:l=Mn.LOADING:l=Mn.LOADED),this.color_=e.color!==void 0?Wl(e.color):null,this.iconImage_=vd(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;let x=this.iconImage_.getSize();this.setScale(Vz(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(Vz(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Wl(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Mn.IDLE:this.iconImage_.getImageState();this.iconImage_=vd(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=vd(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Mn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Jt.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Jt.CHANGE,e)}ready(){return this.iconImage_.ready()}},$0=oI;var aI=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Ys=aI;var Zw=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=qz,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=qz,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function Hz(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(zn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var lI=null;function cI(i,e){if(!lI){let t=new qr({color:"rgba(255,255,255,0.4)"}),n=new Ys({color:"#3399CC",width:1.25});lI=[new Zw({image:new Kw({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return lI}function qz(i){return i.getGeometry()}var Fs=Zw;var Xoe="#333",uI=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Vr(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new qr({color:Xoe}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof qr?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Vr(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},sf=uI;function jl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function Xz(i){let e=i.get("pin");return!e||Xl(e)||e.insideHighlightedZone||Mg(e)?null:hI(e,!1)}function $z(i){let e=i.get("pin");return!e||!k.highlightedZones.size||!e.insideHighlightedZone||Xl(e)||Mg(e)?null:hI(e,!1)}function Yz(i){let e=i.get("pin");return!e||Xl(e)||!k.labelsHeld?null:eV(e)}function Kz(i){let e=i.get("pin");if(!e||Xl(e)||e.insideHighlightedZone||Mg(e)||Bx())return null;if(k.labelsHeld)return Fx(e,!1);let t=k.fitZoom+Math.log2(lV(e.category));return(k.engine.getView().getZoom()||0)<t?null:Fx(e,!1)}function Zz(i){let e=i.get("pin");return!e||Xl(e)||e.insideHighlightedZone||Mg(e)||!Bx()?null:Fx(e,!1)}function Qz(i){let e=i.get("pin");return!e||!k.highlightedZones.size||!e.insideHighlightedZone||Xl(e)||Mg(e)?null:Fx(e,!1)}function Jz(i){let e=i.get("pin");if(!e||Xl(e))return null;if(Tu(e.category)==="text")return Fx(e,e===k.selectedPin);let t=hI(e,e===k.selectedPin);return e===k.hoveredPin||e===k.selectedPin?[t,eV(e)]:t}function hI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(k.styleCache.has(t))return k.styleCache.get(t);let n=W0(i.category),r=e?2e7:i.priority,s=k.markerIcons.get(Ox(i.category)),o;return s?o=new Fs({image:new $0({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Fs({text:new sf({text:Pc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new qr({color:n}),stroke:new Ys({color:H0(),width:e?4:3})}),zIndex:r}),k.styleCache.set(t,o),o}function eV(i){let e=`marker-label:${i.location.id}`;if(k.styleCache.has(e))return k.styleCache.get(e);let t=new Fs({text:new sf({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new qr({color:"#f2ece0"}),stroke:new Ys({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new qr({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return k.styleCache.set(e,t),t}function tV(i){if(!i.iconAsset)return;let e=Ox(i);if(k.markerIcons.has(e))return;k.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=W0(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=H0(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),k.markerIcons.set(e,n.toDataURL("image/png")),$oe(),k.layers.pins.changed(),k.layers.zonePins.changed(),k.layers.priority.changed()},t.onerror=()=>k.markerIcons.set(e,!1),t.src=zP(i.iconAsset)}function $oe(){for(let i of k.styleCache.keys())i.startsWith("marker:")&&k.styleCache.delete(i)}function Ox(i){return`${i.iconAsset||""}:${W0(i)}:${k.map?.iconOutset||"light"}`}function Fx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(k.styleCache.has(t))return k.styleCache.get(t);let r=[new Fs({text:new sf({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new qr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Ys({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new qr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Ys({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return k.styleCache.set(t,r),r}function fI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="leaf",r=t.role==="scope",s=t.role==="neighbor",o=n||r?15:s?10:11,l=`${n||r?900:s?750:800} ${o}px ui-monospace, SFMono-Regular, Menlo, monospace`,c=s?[2,4,2,4]:[3,5,3,5],u=Yoe(t,l,o,c,e);if(t.role==="child"&&(!u||!k.subgridVisible))return null;let f=r&&k.subgridVisible,p=`grid:${t.hash}:${t.role}:${t.contextDistance}:${u?1:0}:${f?1:0}`;if(k.styleCache.has(p))return k.styleCache.get(p);let x=Qm[Math.max(0,Gl.indexOf(t.hash[t.hash.length-1]))%Qm.length],v=new Fs({fill:r?void 0:new qr({color:s?`rgba(5, 8, 16, ${Math.min(.52,.3+t.contextDistance*.06)})`:ef(x,n?.14:.055)}),stroke:new Ys({color:n||r?"#ffffff":ef(x,s?.44:.82),width:n?2.5:r?f?1.8:2.5:s?1:1.4}),text:u&&!f?new sf({text:t.hash,font:l,fill:new qr({color:n||r?"#ffffff":s?ef(x,.72):x}),stroke:new Ys({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new qr({color:s?"rgba(8,11,18,0.88)":"rgba(12,15,22,0.76)"}),padding:c,overflow:!0}):void 0,zIndex:n||r?100:i.get("priority")});return k.styleCache.set(p,v),v}function Yoe(i,e,t,n,r){if(!r)return!0;let s=Koe(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var Wz=document.createElement("canvas").getContext("2d"),jz=new Map;function Koe(i,e){let t=`${e}|${i}`,n=jz.get(t);return n===void 0&&(Wz.font=e,n=Wz.measureText(i).width,jz.set(t,n)),n}var Zoe=new Fs({fill:new qr({color:"rgba(5, 8, 16, 0.62)"})});function nV(){return k.zonesVisible?Zoe:null}function iV(i){if(!k.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=k.highlightedZones.has(e.id),r=aV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(k.styleCache.has(s))return k.styleCache.get(s);let o=i.get("color");if(r){let c=new Fs({stroke:new Ys({color:ef(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return k.styleCache.set(s,c),c}let a=new Fs({fill:new qr({color:ef(o,t?.035:.07)}),stroke:new Ys({color:ef(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return k.styleCache.set(s,a),a;let l=[new Fs({stroke:new Ys({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Fs({fill:new qr({color:ef(o,.22)}),stroke:new Ys({color:o,width:2.6}),zIndex:9001})];return k.styleCache.set(s,l),l}function rV(i){if(!k.zonesVisible||Bx())return null;let e=i.get("child"),t=k.highlightedZones.has(i.get("zone").id),n=k.engine.getView().getZoom()||0;if(!t&&e&&n<k.fitZoom+3)return null;let r=i.get("span")/k.engine.getView().getResolution();return!t&&k.zoneTitleCount>40&&r<52?null:oV(i)}function sV(i){return!k.zonesVisible||!Bx()?null:oV(i)}function oV(i){let e=i.get("child"),t=i.get("zone"),n=k.highlightedZones.has(t.id),r=aV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(k.styleCache.has(s))return k.styleCache.get(s);let o=i.get("color"),a=new Fs({text:new sf({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new qr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Ys({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new qr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Ys({color:n?"#ffffff":ef(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return k.styleCache.set(s,a),a}function aV(i){if(!k.highlightedZones.size||k.highlightedZones.has(i))return!1;for(let e of k.highlightedZones)if(Qoe(i,e))return!1;return!0}function Qoe(i,e){let t=new Set,n=k.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=k.zoneRecords.get(n)?.zone.parentRegionId}return!1}var dI=class i extends xu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Ec(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<cd(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=yc(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return yu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Jh(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){let a=new Jh(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){let o=t[r],a=t[r+1];if(cx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xx(this.flatCoordinates,0,e,this.stride),this.changed()}},cV=dI;function Qw(i,e,t,n){let r=[],s=Er();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=eg(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}var pI=class i extends xu{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let p=0,x=f.length;p<x;++p)f[p]+=u;Ec(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Ec(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(fz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),dz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return xG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return uz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),BP(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,yx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=Qw(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Lw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new cV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;gz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=BP(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Az(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new vu(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,p=l.length;f<p;++f)l[f]-=s;let u=new vu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return vG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=cz(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},uV=pI;function AI(){let i=(k.map.zones||[]).filter(_I);k.renderedShard=k.variant?.shard||0,k.sources.zones.clear(),k.sources.zoneTitles.clear(),k.zoneRecords.clear(),k.highlightedZones.clear(),k.focusedZoneID=null,k.zoneTitleCount=0,Jw(!0),we.zoneIndex.hidden=i.length===0,we.zoneCount.textContent=Ic(i.length);for(let e of i){let t=Er(),n=[],r=!1;for(let l of e.features||[]){let c=tae(l);c&&(r=!0,n.push(c),tw(t,c.getExtent()),k.sources.zones.addFeature(new gd({geometry:c,zone:e,color:Uw(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=Uw(e.id),o=e.center?Cg(e.center.lat,e.center.lng):Oa(t),a=Math.max(t[2]-t[0],t[3]-t[1]);k.sources.zoneTitles.addFeature(new gd({geometry:new Jh(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),k.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}k.zoneTitleCount=k.sources.zoneTitles.getFeatures().length,fV(),Joe()}function fV(){if(k.sources.zoneScrim.clear(),!k.highlightedZones.size)return;let[i,e,t,n]=k.projection.getExtent(),r=[hV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of k.highlightedZones)for(let o of k.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(hV(c.getCoordinates(),u>0))})}k.sources.zoneScrim.addFeature(new gd({geometry:new vu(r)}))}function hV(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function Joe(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of eae()){let n=k.zoneRecords.get(e.id);if(!n)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(e.id),r.style.setProperty("--zone-color",n.color),r.style.setProperty("--zone-depth",String(t)),r.setAttribute("aria-pressed","false"),r.title=`${e.title}: click to jump; right-click to toggle highlight`;let s=document.createElement("span");s.className="zone-index-marker",s.setAttribute("aria-hidden","true");let o=document.createElement("span");o.textContent=e.title,r.append(s,o),i.append(r)}we.zoneList.replaceChildren(i),we.zoneIndex.hidden=k.zoneRecords.size===0}function eae(){let i=[...k.zoneRecords.values()].map(o=>o.zone),e=new Set(i.map(o=>o.id)),t=new Map;for(let o of i){let a=e.has(o.parentRegionId)?o.parentRegionId:null;t.has(a)||t.set(a,[]),t.get(a).push(o)}for(let o of t.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let n=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),n.push({zone:o,depth:a});for(let l of t.get(o.id)||[])s(l,a+1)}};for(let o of t.get(null)||[])s(o,0);for(let o of i)s(o,0);return n}function Jw(i){k.zonesVisible=i,we.zoneToggle.checked=i,k.layers.zoneScrim.setVisible(i),k.layers.zones.setVisible(i),k.layers.zoneTitles.setVisible(i),k.layers.zoneTitleDetail.setVisible(i)}function dV(i){let e=k.zoneRecords.get(i);e&&(k.focusedZoneID=i,AV(),Rc(),k.engine.getView().fit(e.extent,{size:k.engine.getSize(),padding:[54,54,54,54],maxZoom:wu(k.variant),duration:220}),we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"))}function pV(i){k.zoneRecords.has(i)&&(k.highlightedZones.has(i)?k.highlightedZones.delete(i):(k.highlightedZones.add(i),Jw(!0)),k.hoveredPin=null,mI(),gI(),AV(),fV(),k.layers.zones.changed(),k.layers.zoneTitles.changed(),k.layers.zoneTitleDetail.changed())}function AV(){we.zoneIndex.classList.toggle("has-highlights",k.highlightedZones.size>0);for(let i of we.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=k.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",k.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function tae(i){if(!i?.coordinates)return null;let e=([t,n])=>Cg(n,t);return i.type==="Polygon"?new vu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new uV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Cg(i,e){let t=nae(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function nae(){let i=k.game.tileGrid,e=k.map?.grid;return e?{...i,...e}:i}function mV(){k.sources.pins.clear(),k.sources.text.clear(),k.sources.priority.clear(),k.pins=[],k.pinByID.clear();for(let i of k.map.groups)for(let e of i.categories){Tu(e)!=="text"&&tV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Cg(t.lat,t.lng),filteredHidden:!1,priority:oae(e,t),feature:null};n.feature=new gd({geometry:new Jh(n.coordinate),pin:n,priority:n.priority}),k.pins.push(n),k.pinByID.set(t.id,n),Tu(e)==="text"?k.sources.text.addFeature(n.feature):k.sources.pins.addFeature(n.feature)}}Hl()}function Hl(){for(let i of k.pins){let e=k.hiddenCategories.has(i.category.id),t=k.search&&!i.location.title.toLocaleLowerCase().includes(k.search);i.filteredHidden=!!(e||t)}mI(),gI(),k.selectedPin?.filteredHidden&&Rc(),xd(),document.dispatchEvent(new Event("atlas:filters"))}function mI(){if(!k.highlightedZones.size){for(let e of k.pins)e.insideHighlightedZone=!1;return}let i=[...k.highlightedZones].map(e=>k.zoneRecords.get(e)).filter(Boolean);for(let e of k.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>iae(n,e.coordinate)))}function iae(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}function gI(){k.eligibleLocations=k.pins.filter(i=>!Xl(i)).length,bu(),k.layers.pins.changed(),k.layers.zonePins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.zoneText.changed(),k.layers.textDetail.changed(),k.layers.priority.changed(),Y0()}function bu(){k.sources.priority.clear();for(let i of k.pins){if(Xl(i))continue;let e=!!k.search&&i.location.title.toLocaleLowerCase().includes(k.search);(i===k.selectedPin||i===k.hoveredPin||e||bg(i))&&k.sources.priority.addFeature(i.feature)}}function Rg(i){k.hoveredPin!==i&&(k.hoveredPin=i,k.sources&&(bu(),k.layers.pins.changed(),k.layers.priority.changed()))}function eS(i){k.labelsHeld!==i&&(k.labelsHeld=i,we.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",k.layers.pinLabels.changed(),k.layers.text.changed())}function Mg(i){return i===k.selectedPin||i===k.hoveredPin||bg(i)||!!k.search&&i.location.title.toLocaleLowerCase().includes(k.search)}function Xl(i){return i.filteredHidden||rae(i)||sae(i)||!_I(i.location)}function _I(i){let e=k.variant?.shard;return!e||!i.shard||i.shard===e}function rae(i){return!k.highlightedZones.size||i.insideHighlightedZone||i===k.selectedPin?!1:!(k.search&&i.location.title.toLocaleLowerCase().includes(k.search))}function sae(i){return!k.gridEnabled||!k.gridPrefix||bg(i)||i===k.selectedPin?!1:!(k.search&&i.location.title.toLocaleLowerCase().includes(k.search))}function oae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Sz(e.id)%1e3}function lV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function Bx(){return(k.engine?.getView().getZoom()||0)>=(k.variant?.maxZoom||0)-.05}function gV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Tu(s)==="text"?t:r).push(s);r.length&&e.push({key:`group-${n.id}`,title:n.title,categories:r})}return t.length&&e.unshift({key:"text",title:"Text",categories:t}),e}function _V(){let i=document.createDocumentFragment();for(let e of k.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(aae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(lae(s));t.append(r),i.append(t)}we.legend.replaceChildren(i),tS(),yd()}function aae(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=Ic(t),r.append(s,o,a);let l=xV(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function xV(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function lae(i){let e=Tu(i)==="text",t=document.createElement("label");t.className="category-row",wg(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!k.hiddenCategories.has(i.id);let r=document.createElement("span");e?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",Sg(r,i,Pc(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=document.createElement("span");o.className="category-count",o.textContent=Ic(i.locations.length);let a=xV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function xI(i){if(k.collapsedSections.clear(),i)for(let e of we.layers.querySelectorAll("[data-section]"))k.collapsedSections.add(e.dataset.section);tS()}function tS(){for(let i of we.layers.querySelectorAll("[data-section]")){let e=k.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Cc()}function Ux(i){if(k.hiddenCategories.clear(),!i)for(let e of k.map.groups)for(let t of e.categories)k.hiddenCategories.add(t.id);Mx(),Hl(),xd(),yd()}function Mx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!k.hiddenCategories.has(Number(i.dataset.category))}function yV(i){let e=k.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!k.hiddenCategories.has(n.id));for(let n of e.categories)t?k.hiddenCategories.add(n.id):k.hiddenCategories.delete(n.id);Mx(),Hl(),yd()}function vV(i){if(k.map){if(cae(i)){Ux(!0);return}k.hiddenCategories.clear();for(let e of k.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&k.hiddenCategories.add(n.id)}Mx(),Hl(),xd(),yd()}}function cae(i){for(let e of k.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===k.hiddenCategories.has(t.id))return!1;return!0}function uae(){let i=we.soloChip;if(!k.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of k.map.sections){let a=0;for(let l of o.categories)k.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function yd(){if(k.map){for(let i of k.map.sections){let e=we.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!k.hiddenCategories.has(t.id)))}uae(),Cc()}}async function bV(i){let[e,t]=await Promise.all([fetch(`${k.game.base}/maps/${i.slug}.json`),fetch(`${k.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return hae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:gV(n.groups)}}function hae(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==2)throw new Error(`location payload is version ${r}, and this reads 2`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),p=new Uint32Array(i,o+=s*4,s+1),x=new Uint16Array(i,o+=(s+1)*4,s),v=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[x[S]].locations.push({id:a[S],title:w.decode(v.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function Mz(){let i=`${k.game.base}/${k.map.slug}`;return k.textByMap.has(i)||k.textByMap.set(i,fetch(`${k.game.base}/maps/${k.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),k.textByMap.get(i)}var nS=null;function K0(){return nS||(nS=fae().finally(()=>{nS=null})),nS}async function fae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=k.game;if(k.catalog=await i.json(),R0(we.game,k.catalog.games,"title"),yI(),!k.catalog.games.length)return;let t=e&&k.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=xg();await of(n.game||_g()?.game||k.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of k.textByMap.keys())r.startsWith(e.base+"/")&&k.textByMap.delete(r);let n=k.engine?.getView();k.restore={game:t.slug,map:k.map?.slug,variant:k.map?k.map.variants.indexOf(k.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...k.hiddenCategories],collapsed:[...k.collapsedSections],overviewDocked:k.overviewDocked,dockFolded:k.dockFolded,dockDismissed:k.dockDismissed},await of(t.slug,k.map?.slug);return}k.game=t,we.game.value=t.slug}function yI(){let i=!k.catalog?.games?.length;we.emptyState.hidden=!i,k.catalog?.bundlesDir&&(we.emptyPath.textContent=k.catalog.bundlesDir)}async function vI(){for(let i of[we.emptyOpen,we.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await K0();let t=e.imported?.[0];t&&k.catalog.games.some(n=>n.slug===t)&&await of(t)}finally{for(let i of[we.emptyOpen,we.addBundles])i.disabled=!1}}var Ks={ADD:"add",REMOVE:"remove"};var wV={LENGTH:"length"},Pg=class extends Xs{constructor(e,t,n){super(e),this.element=t,this.index=n}},bI=class extends ms{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(wV.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Pg(Ks.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Pg(Ks.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Pg(Ks.REMOVE,r,e)),this.dispatchEvent(new Pg(Ks.ADD,t,e))}updateLength_(){this.set(wV.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},co=bI;var wI=class extends Xs{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Sd=wI;var SI=class extends Sd{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},Cu=SI;var nr={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var kx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var TI=class extends md{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=Un(n,kx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Un(n,kx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,vw?{passive:!1}:!1)}emulateClick_(e){let t=new Cu(nr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Cu(nr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Cu(nr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==nr.POINTERUP||t.type==nr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==nr.POINTERDOWN||t.type==nr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Cu(nr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new Cu(nr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Un(n,nr.POINTERMOVE,this.handlePointerMove_,this),Un(n,nr.POINTERUP,this.handlePointerUp_,this),Un(this.element_,nr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(Un(this.element_.getRootNode(),nr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Cu(nr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Cu(nr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(ii(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ii(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},SV=TI;var Ru={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var uo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Gx=1/0,EI=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,_u(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){zn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=Gx?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==Gx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},TV=EI;var MI=class extends TV{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(Jt.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===rn.LOADED||n===rn.ERROR||n===rn.EMPTY){n!==rn.ERROR&&t.removeEventListener(Jt.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===rn.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},EV=MI;function MV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Gx;if(!i.wantedTiles[t][e.getKey()])return Gx;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var Os={ANIMATING:0,INTERACTING:1};var $l={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function CI(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,p=i[0]+l/2+u,x=i[2]-l/2+u,v=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),v>w&&(v=(w+v)/2,w=v);let S=_i(n[0],p,x),T=_i(n[1],v,w);if(o&&t&&r){let P=30*r;S+=-P*Math.log(1+Math.max(0,p-n[0])/P)+P*Math.log(1+Math.max(0,n[0]-x)/P),T+=-P*Math.log(1+Math.max(0,v-n[1])/P)+P*Math.log(1+Math.max(0,n[1]-w)/P)}return[S,T]})}function CV(i){return i}function RI(i,e,t,n){let r=Wn(e)/t[0],s=gr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function PI(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),_i(n,t/2,e*2)}function RV(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?RI(l,t,o,n):l;if(a)return e?PI(r,u,c):_i(r,c,u);let f=Math.min(u,r),p=Math.floor(hg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function PV(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?RI(e,r,l,s):e;if(c)return n?PI(o,u,t):_i(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,v=Math.min(u,o),w=Math.floor(Math.log(e/v)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return _i(T,t,u)}})}function II(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?RI(i,n,a,r):i;return!t||!l?_i(s,e,c):PI(s,c,e)}})}function Ig(i){if(i!==void 0)return 0}function NI(i){if(i!==void 0)return i}function IV(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function NV(i){let e=i===void 0?vc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var LI=0,FI=class extends ms{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=pw(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&cG(),e.center&&(e.center=Sc(e.center,this.projection_)),e.extent&&(e.extent=Tc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in $l)delete t[a];this.setProperties(t,!0);let n=pae(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=dae(e),s=n.constraint,o=Aae(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=Sc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Sc(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(r===t){n&&iS(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||LG,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let p=gu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}mae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Os.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Os.ANIMATING]>0}getInteracting(){return this.hints_[Os.INTERACTING]>0}cancelAnimations(){this.setHint(Os.ANIMATING,-this.hints_[Os.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&iS(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let p=l.sourceCenter[0],x=l.sourceCenter[1],v=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(v-p),T=x+f*(w-x);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let p=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let x=this.getViewportSize_(this.getRotation()),v=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(v,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=p,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let p=f===1?gu(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let x=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(x,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(Os.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&iS(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],rg(n,e-this.getRotation()),V9(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Ax(e,this.getProjection())}getCenterInternal(){return this.get($l.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return fd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();zn(t,"The view center is not defined");let n=this.getResolution();zn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return zn(r!==void 0,"The view rotation is not defined"),hx(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get($l.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Tc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Wn(e)/t[0],r=gr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get($l.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=DI(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=hg(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=_i(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,_i(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(zn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){zn(!mu(e),"Cannot fit empty extent provided as `geometry`");let r=Tc(e,this.getProjection());n=UP(r)}else if(e.getType()==="Circle"){let r=Tc(e.getExtent(),this.getProjection());n=UP(r),n.rotate(this.getRotation(),Oa(r))}else{let r=U0();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,p=s.length;f<p;f+=o){let x=s[f]*n-s[f+1]*r,v=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,v),c=Math.max(c,x),u=Math.max(u,v)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),p=Oa(a);p[0]+=(r[1]-r[3])/2*l,p[1]+=(r[0]-r[2])/2*l;let x=p[0]*f-p[1]*u,v=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,v],l),S=t.callback?t.callback:Qh;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),iS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Sc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(DI(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=DI(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Ax(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&Sc(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=Sc(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&Sc(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get($l.ROTATION)!==r&&this.set($l.ROTATION,r),this.get($l.RESOLUTION)!==o&&(this.set($l.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get($l.CENTER)||!D0(this.get($l.CENTER),a))&&this.set($l.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!D0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:ql,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Os.INTERACTING,1)}endInteraction(e,t,n){n=n&&Sc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Os.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function iS(i,e){setTimeout(function(){i(e)},0)}function dae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return CI(i.extent,i.constrainOnlyCenter,t)}let e=pw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,CI(t,!1,!1)}return CV}function pae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:LI,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,p=pw(i.projection,"EPSG:3857"),x=p.getExtent(),v=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(v=!1,w=x),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=RV(S,u,!v&&w,f):e=II(t,n,u,!v&&w,f)}else{let T=(x?Math.max(Wn(x),gr(x)):360*$h.degrees/p.getMetersPerUnit())/256/Math.pow(2,LI),P=T/Math.pow(2,28-LI);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=P),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=PV(l,t,n,u,!v&&w,f):e=II(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Aae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?NV():t===!1?NI:typeof t=="number"?IV(t):NI}return Ig}function mae(i){return!(i.sourceCenter&&i.targetCenter&&!D0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function DI(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var ul=FI;var OI=class extends ms{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)ii(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==Qh&&this.listenerKeys.push(Un(e,Ru.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Ng=OI;var BI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+bd+" "+Eg+(this.collapsed_&&this.collapsible_?" "+JP:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>CG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Io(t,this.renderedAttributions_)){FG(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(JP),this.collapsed_?uP(this.collapseLabel_,this.label_):uP(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},LV=BI;var UI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+bd+" "+Eg,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Lx)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:ql}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Lx);!s&&n===0?this.element.classList.add(Lx):s&&n!==0&&this.element.classList.remove(Lx)}this.label_.style.transform=r}this.rotation_=n}},DV=UI;var kI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(Jt.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(Jt.CLICK,this.handleClick_.bind(this,-n),!1);let p=t+" "+bd+" "+Eg,x=this.element;x.className=p,x.appendChild(u),x.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:ql})):n.setZoom(s)}}},FV=kI;function rS(i){i=i||{};let e=new co;return(i.zoom===void 0||i.zoom)&&e.push(new FV(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new DV(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new LV(i.attributionOptions)),e}var GI=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},OV=GI;var zI={ACTIVE:"active"};var VI=class extends ms{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(zI.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(zI.ACTIVE,e)}setMap(e){this.map_=e}};function BV(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:DG,center:i.getConstrainedCenter(r)})}}function Lg(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:ql})}var Pu=VI;var qI=class extends Pu{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==nr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();Lg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},UV=qI;function zx(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var kV=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},gae=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},sS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?gae(i):!0},GV=Kh;var oS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(RG&&sP&&e.ctrlKey)};var aS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var zV=function(i){let e=i.originalEvent;return sP?e.metaKey:e.ctrlKey},VV=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},lS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},cS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var qV=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var HI=class extends Pu{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==nr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==nr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==nr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==nr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function Dg(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var Iu=HI;var WI=class extends Iu{constructor(e){super({stopDown:Zh}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:zx(aS,qV);this.condition_=e.onFocusOnly?zx(sS,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(Dg(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();q9(s,a.getResolution()),rg(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:ql})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},HV=WI;var jI=class extends Iu{constructor(e){e=e||{},super({stopDown:Zh}),this.condition_=e.condition?e.condition:kV,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!cS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Ig)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return cS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return cS(e)&&oS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},WV=jI;var XI=class extends Ad{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new vu([r])}getGeometry(){return this.geometry_}},jV=XI;var Fg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},Z0=class extends Xs{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},$I=class extends Iu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new jV(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??oS,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Z0(Fg.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Z0(t?Fg.BOXEND:Fg.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Z0(Fg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Z0(Fg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Z0(Fg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},XV=$I;var YI=class extends XV{constructor(e){e=e||{};let t=e.condition?e.condition:VV;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:ql})}},$V=YI;var Td={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var KI=class extends Pu{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return aS(t)&&lS(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Td.DOWN||r==Td.LEFT||r==Td.RIGHT||r==Td.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Td.DOWN?c=-a:r==Td.LEFT?l=-a:r==Td.RIGHT?l=a:c=a;let u=[l,c];rg(u,o.getRotation()),BV(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},YV=KI;var ZI=class extends Pu{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!zV(t)&&lS(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN||e.type==Jt.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();Lg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},KV=ZI;var _ae=40,xae=300,yae=3,QI=class extends Pu{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:GV;this.condition_=e.onFocusOnly?zx(sS,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(ii),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(Un(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),Un(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==Jt.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=_ae;break;case WheelEvent.DOM_DELTA_PAGE:o*=xae;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=n.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*yae),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-_i(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Lg(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},ZV=QI;var JI=class extends Iu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Zh),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==Ig&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Dg(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},QV=JI;var e5=class extends Iu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Zh),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Dg(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},JV=e5;function uS(i){i=i||{};let e=new co,t=new OV(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new WV),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new UV({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new HV({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new QV),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new JV({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new YV),e.push(new KV({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new ZV({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new $V({duration:i.zoomDuration})),e}var Ti={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var t5=class extends ms{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ti.OPACITY]=e.opacity!==void 0?e.opacity:1,zn(typeof t[Ti.OPACITY]=="number","Layer opacity must be a number"),t[Ti.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ti.Z_INDEX]=e.zIndex,t[Ti.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ti.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ti.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ti.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=_i(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return $n()}getLayerStatesArray(e){return $n()}getExtent(){return this.get(Ti.EXTENT)}getMaxResolution(){return this.get(Ti.MAX_RESOLUTION)}getMinResolution(){return this.get(Ti.MIN_RESOLUTION)}getMinZoom(){return this.get(Ti.MIN_ZOOM)}getMaxZoom(){return this.get(Ti.MAX_ZOOM)}getOpacity(){return this.get(Ti.OPACITY)}getSourceState(){return $n()}getVisible(){return this.get(Ti.VISIBLE)}getZIndex(){return this.get(Ti.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ti.EXTENT,e)}setMaxResolution(e){this.set(Ti.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ti.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ti.MAX_ZOOM,e)}setMinZoom(e){this.set(Ti.MIN_ZOOM,e)}setOpacity(e){zn(typeof e=="number","Layer opacity must be a number"),this.set(Ti.OPACITY,e)}setVisible(e){this.set(Ti.VISIBLE,e)}setZIndex(e){this.set(Ti.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},hS=t5;var Ed={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Nc=class extends Xs{constructor(e,t){super(e),this.layer=t}},n5={LAYERS:"layers"},i5=class i extends hS{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(n5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new co(n.slice(),{unique:!0}):zn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new co(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ii),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(Un(e,Ks.ADD,this.handleLayersAdd_,this),Un(e,Ks.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ii);_u(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Nc(Ed.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[Un(e,Mc.PROPERTYCHANGE,this.handleLayerChange_,this),Un(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(Un(e,Ed.ADDLAYER,this.handleLayerGroupAdd_,this),Un(e,Ed.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Nn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Nc(Ed.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Nc(Ed.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Nc(Ed.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Nn(t);this.listenerKeys_[n].forEach(ii),delete this.listenerKeys_[n],this.dispatchEvent(new Nc(Ed.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(n5.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Nc(Ed.REMOVELAYER,n[r]))}this.set(n5.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=Au(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Vx=i5;var ho={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var r5=class extends hS{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ti.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ti.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ii(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=Un(e,Jt.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof ul?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return qx(r,t.viewState)&&(!s||_r(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof ul?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ti.MAP,e)}getMapInternal(){return this.get(Ti.MAP)}setMap(e){this.mapPrecomposeKey_&&(ii(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ii(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=Un(e,ho.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Un(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);zn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ti.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function qx(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var Q0=r5;function fS(i,e,t=0,n=i.length-1,r=vae){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),x=Math.max(t,Math.floor(e-c*f/l+p)),v=Math.min(n,Math.floor(e+(l-c)*f/l+p));fS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(Hx(i,t,e),r(i[n],s)>0&&Hx(i,t,n);o<a;){for(Hx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Hx(i,t,a):(a++,Hx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Hx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function vae(i,e){return i<e?-1:i>e?1:0}var J0=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!pS(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;pS(e,l)&&(t.leaf?n.push(a):o5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!pS(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(pS(e,o)){if(t.leaf||o5(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Bg([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=bae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&o5(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=Bg(e.slice(t,n+1)),Og(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Bg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));eq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);eq(e,u,f,l,this.compareMinY);for(let p=u;p<=f;p+=l){let x=Math.min(p+l-1,f);a.children.push(this._build(e,p,x,r-1))}}return Og(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=s5(c),f=Tae(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),jx(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=Bg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Og(n,this.toBBox),Og(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Bg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Og(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=Wx(e,0,a,this.toBBox),c=Wx(e,a,n,this.toBBox),u=Eae(l,c),f=s5(l)+s5(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:wae,s=e.leaf?this.compareMinY:Sae,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=Wx(e,0,t,s),a=Wx(e,n-t,n,s),l=dS(o)+dS(a);for(let c=t;c<n-t;c++){let u=e.children[c];jx(o,e.leaf?s(u):u),l+=dS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];jx(a,e.leaf?s(u):u),l+=dS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)jx(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Og(e[t],this.toBBox)}};function bae(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function Og(i,e){Wx(i,0,i.children.length,e,i)}function Wx(i,e,t,n,r){r||(r=Bg(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];jx(r,i.leaf?n(o):o)}return r}function jx(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function wae(i,e){return i.minX-e.minX}function Sae(i,e){return i.minY-e.minY}function s5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function dS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Tae(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function Eae(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function o5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function pS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Bg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function eq(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;fS(i,o,e,t,r),s.push(e,o,o,t)}}var tA=0,mS=0,Do=1<<tA++,ri=1<<tA++,Fo=1<<tA++,ra=1<<tA++,lf=1<<tA++,eA=1<<tA++,gS=Math.pow(2,tA)-1,l5={[Do]:"boolean",[ri]:"number",[Fo]:"string",[ra]:"color",[lf]:"number[]",[eA]:"size"},Mae=Object.keys(l5).map(Number).sort(Ba);function Cae(i){return i in l5}function af(i){let e=[];for(let t of Mae)Xx(i,t)&&e.push(l5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Xx(i,e){return(i&e)===e}function AS(i,e){return!!(i&e)}function Md(i,e){return i===e}var Cr=class{constructor(e,t){if(!Cae(e))throw new Error(`literal expressions must have a specific type, got ${af(e)}`);this.type=e,this.value=t}},_S=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function xS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Hr(i,e,t){switch(typeof i){case"boolean":{if(Md(e,Fo))return new Cr(Fo,i?"true":"false");if(!Xx(e,Do))throw new Error(`got a boolean, but expected ${af(e)}`);return new Cr(Do,i)}case"number":{if(Md(e,eA))return new Cr(eA,Vr(i));if(Md(e,Do))return new Cr(Do,!!i);if(Md(e,Fo))return new Cr(Fo,i.toString());if(!Xx(e,ri))throw new Error(`got a number, but expected ${af(e)}`);return new Cr(ri,i)}case"string":{if(Md(e,ra))return new Cr(ra,Px(i));if(Md(e,Do))return new Cr(Do,!!i);if(!Xx(e,Fo))throw new Error(`got a string, but expected ${af(e)}`);return new Cr(Fo,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return Gae(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Md(e,eA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Cr(eA,i)}if(Md(e,ra)){if(i.length===3)return new Cr(ra,[...i,1]);if(i.length===4)return new Cr(ra,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Xx(e,lf))throw new Error(`got an array of numbers, but expected ${af(e)}`);return new Cr(lf,i)}var Je={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},Rae={[Je.Get]:Dn(Yn(1,1/0),tq),[Je.Var]:Pae(),[Je.Has]:Dn(Yn(1,1/0),tq),[Je.Id]:Dn(Iae,Ug),[Je.Concat]:Dn(Yn(2,1/0),ki(Fo)),[Je.GeometryType]:Dn(Nae,Ug),[Je.LineMetric]:Dn(Lae,Ug),[Je.Resolution]:Dn(a5,Ug),[Je.Zoom]:Dn(a5,Ug),[Je.Time]:Dn(a5,Ug),[Je.Any]:Dn(Yn(2,1/0),ki(Do)),[Je.All]:Dn(Yn(2,1/0),ki(Do)),[Je.Not]:Dn(Yn(1,1),ki(Do)),[Je.Equal]:Dn(Yn(2,2),iq()),[Je.NotEqual]:Dn(Yn(2,2),iq()),[Je.GreaterThan]:Dn(Yn(2,2),ki(ri)),[Je.GreaterThanOrEqualTo]:Dn(Yn(2,2),ki(ri)),[Je.LessThan]:Dn(Yn(2,2),ki(ri)),[Je.LessThanOrEqualTo]:Dn(Yn(2,2),ki(ri)),[Je.Multiply]:Dn(Yn(2,1/0),nq),[Je.Coalesce]:Dn(Yn(2,1/0),nq),[Je.Divide]:Dn(Yn(2,2),ki(ri)),[Je.Add]:Dn(Yn(2,1/0),ki(ri)),[Je.Subtract]:Dn(Yn(2,2),ki(ri)),[Je.Clamp]:Dn(Yn(3,3),ki(ri)),[Je.Mod]:Dn(Yn(2,2),ki(ri)),[Je.Pow]:Dn(Yn(2,2),ki(ri)),[Je.Abs]:Dn(Yn(1,1),ki(ri)),[Je.Floor]:Dn(Yn(1,1),ki(ri)),[Je.Ceil]:Dn(Yn(1,1),ki(ri)),[Je.Round]:Dn(Yn(1,1),ki(ri)),[Je.Sin]:Dn(Yn(1,1),ki(ri)),[Je.Cos]:Dn(Yn(1,1),ki(ri)),[Je.Atan]:Dn(Yn(1,2),ki(ri)),[Je.Sqrt]:Dn(Yn(1,1),ki(ri)),[Je.Match]:Dn(Yn(4,1/0),rq,Fae),[Je.Between]:Dn(Yn(3,3),ki(ri)),[Je.Interpolate]:Dn(Yn(6,1/0),rq,Oae),[Je.Case]:Dn(Yn(3,1/0),Dae,Bae),[Je.In]:Dn(Yn(2,2),Uae),[Je.Number]:Dn(Yn(1,1/0),ki(gS)),[Je.String]:Dn(Yn(1,1/0),ki(gS)),[Je.Array]:Dn(Yn(1,1/0),ki(ri)),[Je.Color]:Dn(Yn(1,4),ki(ri)),[Je.Band]:Dn(Yn(1,3),ki(ri)),[Je.Palette]:Dn(Yn(2,2),kae),[Je.ToString]:Dn(Yn(1,1),ki(Do|ri|Fo|ra))};function tq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new Cr(ri,o);break}case"string":{r[s]=new Cr(Fo,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function Pae(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=Hr(s,gS,t);if(!(o instanceof Cr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&AS(r,ra)&&!AS(r,Fo)?a=ra:Array.isArray(s)&&s.length===2&&AS(r,eA)&&!AS(r,lf)&&(a=eA),r&=a,r===mS)throw new Error(`the type expected from the var operator (${af(e)}) did not have any overlap with the type of the corresponding style variables (${af(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===mS)throw new Error(`a new type expected from the var operator (${af(e)}) did not have any overlap with the previous type expected for it (${af(o)}), variable name: ${n}`)}return t.variables.set(n,r),new _S(r,"var",new Cr(Fo,n))}}function Iae(i,e,t){t.featureId=!0}function Nae(i,e,t){t.geometryType=!0}function Lae(i,e,t){t.mCoordinate=!0}function a5(i,e,t){t.mapState=!0}function Ug(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Yn(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function nq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Hr(i[s+1],e,t);r[s]=o}return r}function ki(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Hr(e[o+1],i,n);s[o]=a}return s}}function iq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=gS;for(let a=0;a<r;++a){let l=Hr(i[a+1],o,t);o&=l.type}if(o===mS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Hr(i[a+1],o,t);s[a]=l}return s}}function Dae(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function rq(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function Fae(i,e,t){let n=i.length-1,r=Hr(i[i.length-1],e,t),s=Fo|ri|Do,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Hr(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===mS)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=Hr(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=Hr(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[Hr(i[1],s,t),...o,r]}function Oae(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new Cr(ri,r),o;try{o=Hr(i[2],ri,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=Hr(i[l+3],ri,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=Hr(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function Bae(i,e,t){let n=Hr(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=Hr(i[s+1],Do,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Hr(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function Uae(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=Fo:r=ri;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Hr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Hr(i[1],r,t),...s]}function kae(i,e,t){let n;try{n=Hr(i[1],ri,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=Hr(r[o],ra,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Cr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Dn(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new _S(t,r,...s)}}function Gae(i,e,t){let n=i[0],r=Rae[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function yS(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return yS(i.getGeometries()[0]);default:return""}}function c5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Dc(i,e,t){let n=Hr(i,e,t);return Lc(n,t)}function Lc(i,e){if(i instanceof Cr){if(i.type===ra&&typeof i.value=="string"){let n=Px(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case Je.Number:case Je.String:case Je.Coalesce:return zae(i,e);case Je.Get:case Je.Var:case Je.Has:return Vae(i,e);case Je.Id:return n=>n.featureId;case Je.GeometryType:return n=>n.geometryType;case Je.Concat:{let n=i.args.map(r=>Lc(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case Je.Resolution:return n=>n.resolution;case Je.Any:case Je.All:case Je.Between:case Je.In:case Je.Not:return Hae(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return qae(i,e);case Je.Multiply:case Je.Divide:case Je.Add:case Je.Subtract:case Je.Clamp:case Je.Mod:case Je.Pow:case Je.Abs:case Je.Floor:case Je.Ceil:case Je.Round:case Je.Sin:case Je.Cos:case Je.Atan:case Je.Sqrt:return Wae(i,e);case Je.Case:return jae(i,e);case Je.Match:return Xae(i,e);case Je.Interpolate:return $ae(i,e);case Je.ToString:return Yae(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function zae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case Je.Number:case Je.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function Vae(i,e){let n=i.args[0].value;switch(i.operator){case Je.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case Je.Var:return r=>r.variables[n];case Je.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function qae(i,e){let t=i.operator,n=Lc(i.args[0],e),r=Lc(i.args[1],e);switch(t){case Je.Equal:return s=>n(s)===r(s);case Je.NotEqual:return s=>n(s)!==r(s);case Je.LessThan:return s=>n(s)<r(s);case Je.LessThanOrEqualTo:return s=>n(s)<=r(s);case Je.GreaterThan:return s=>n(s)>r(s);case Je.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function Hae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case Je.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case Je.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case Je.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case Je.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function Wae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case Je.Divide:return s=>r[0](s)/r[1](s);case Je.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case Je.Subtract:return s=>r[0](s)-r[1](s);case Je.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case Je.Mod:return s=>r[0](s)%r[1](s);case Je.Pow:return s=>Math.pow(r[0](s),r[1](s));case Je.Abs:return s=>Math.abs(r[0](s));case Je.Floor:return s=>Math.floor(r[0](s));case Je.Ceil:return s=>Math.ceil(r[0](s));case Je.Round:return s=>Math.round(r[0](s));case Je.Sin:return s=>Math.sin(r[0](s));case Je.Cos:return s=>Math.cos(r[0](s));case Je.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case Je.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function jae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function Xae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function $ae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),p=Array.isArray(f);if(p&&(f=Iz(f)),u>=o)return c===2?f:p?Kae(s,o,a,l,u,f):$x(s,o,a,l,u,f);a=u,l=f}return l}}function Yae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===ra?Ix(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function $x(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function Kae(i,e,t,n,r,s){if(r-t===0)return n;let a=KP(n),l=KP(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[$x(i,e,t,a[0],r,l[0]),$x(i,e,t,a[1],r,l[1]),a[2]+$x(i,e,t,0,r,c),$x(i,e,t,n[3],r,s[3])];return Nz(u)}function Zae(i){return!0}function Qae(i,e){e=e??xS();let t=Jae(i,e),n=c5();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=yS(r.getGeometry())),t(n)}}function sq(i,e){e=e??xS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=u5(i[o],e);let r=c5(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=yS(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function cq(i,e){if(e=e??xS(),!Array.isArray(i))return sq([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return Qae(s,e)}return sq(i,e)}function Jae(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Dc(s.filter,Do,e):Zae,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=u5(s.style[c],e)}else a=[u5(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function u5(i,e){let t=Yx(i,"",e),n=Kx(i,"",e),r=ele(i,e),s=tle(i,e),o=fo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!bc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Fs;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function Yx(i,e,t){let n;if(e+"fill-pattern-src"in i)n=sle(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=bS(i,e+"fill-color",t)}if(!n)return null;let r=new qr;return function(s){let o=n(s);return o===qw?null:(r.setColor(o),r)}}function Kx(i,e,t){let n=fo(i,e+"stroke-width",t),r=bS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=cf(i,e+"stroke-line-cap",t),o=cf(i,e+"stroke-line-join",t),a=uq(i,e+"stroke-line-dash",t),l=fo(i,e+"stroke-line-dash-offset",t),c=fo(i,e+"stroke-miter-limit",t),u=fo(i,e+"stroke-offset",t),f=new Ys;return function(p){if(r){let x=r(p);if(x===qw)return null;f.setColor(x)}if(n&&f.setWidth(n(p)),s){let x=s(p);if(x!=="butt"&&x!=="round"&&x!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(x)}if(o){let x=o(p);if(x!=="bevel"&&x!=="round"&&x!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(x)}return a&&f.setLineDash(a(p)),l&&f.setLineDashOffset(l(p)),c&&f.setMiterLimit(c(p)),u&&f.setOffset(u(p)),f}}function ele(i,e){let t="text-",n=cf(i,t+"value",e);if(!n)return null;let r=Yx(i,t,e),s=Yx(i,t+"background-",e),o=Kx(i,t,e),a=Kx(i,t+"background-",e),l=cf(i,t+"font",e),c=fo(i,t+"max-angle",e),u=fo(i,t+"offset-x",e),f=fo(i,t+"offset-y",e),p=kg(i,t+"overflow",e),x=cf(i,t+"placement",e),v=fo(i,t+"repeat",e),w=wS(i,t+"scale",e),S=kg(i,t+"rotate-with-view",e),T=fo(i,t+"rotation",e),P=cf(i,t+"align",e),R=cf(i,t+"justify",e),C=cf(i,t+"baseline",e),L=kg(i,t+"keep-upright",e),D=uq(i,t+"padding",e),F=SS(i,t+"declutter-mode"),N=new sf({declutterMode:F});return function(B){if(N.setText(n(B)),r&&N.setFill(r(B)),s&&N.setBackgroundFill(s(B)),o&&N.setStroke(o(B)),a&&N.setBackgroundStroke(a(B)),l&&N.setFont(l(B)),c&&N.setMaxAngle(c(B)),u&&N.setOffsetX(u(B)),f&&N.setOffsetY(f(B)),p&&N.setOverflow(p(B)),x){let z=x(B);if(z!=="point"&&z!=="line")throw new Error("Expected point or line for text-placement");N.setPlacement(z)}if(v&&N.setRepeat(v(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),P){let z=P(B);if(z!=="left"&&z!=="center"&&z!=="right"&&z!=="end"&&z!=="start")throw new Error("Expected left, right, center, start, or end for text-align");N.setTextAlign(z)}if(R){let z=R(B);if(z!=="left"&&z!=="right"&&z!=="center")throw new Error("Expected left, right, or center for text-justify");N.setJustify(z)}if(C){let z=C(B);if(z!=="bottom"&&z!=="top"&&z!=="middle"&&z!=="alphabetic"&&z!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");N.setTextBaseline(z)}return D&&N.setPadding(D(B)),L&&N.setKeepUpright(L(B)),N}}function tle(i,e){return"icon-src"in i?nle(i,e):"shape-points"in i?ile(i,e):"circle-radius"in i?rle(i,e):null}function nle(i,e){let t="icon-",n=t+"src",r=hq(i[n],n),s=vS(i,t+"anchor",e),o=wS(i,t+"scale",e),a=fo(i,t+"opacity",e),l=vS(i,t+"displacement",e),c=fo(i,t+"rotation",e),u=kg(i,t+"rotate-with-view",e),f=aq(i,t+"anchor-origin"),p=lq(i,t+"anchor-x-units"),x=lq(i,t+"anchor-y-units"),v=uf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=bS(i,t+"color",e):w=fq(v,t+"color"));let T=ale(i,t+"cross-origin"),P=lle(i,t+"offset"),R=aq(i,t+"offset-origin"),C=h5(i,t+"width"),L=h5(i,t+"height"),D=ole(i,t+"size"),F=SS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:P,offsetOrigin:R,height:L,width:C,size:D,declutterMode:F},B=null;return function(z){if(B)S&&B.setColor(S(z));else{let V=S?S(z):w;B=new $0(V!==void 0?Object.assign({},N,{color:V}):Object.assign({},N))}return a&&B.setOpacity(a(z)),l&&B.setDisplacement(l(z)),c&&B.setRotation(c(z)),u&&B.setRotateWithView(u(z)),o&&B.setScale(o(z)),s&&B.setAnchor(s(z)),B}}function ile(i,e){let t="shape-",n=t+"points",r=t+"radius",s=f5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=fo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=fo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=Yx(i,t,e),p=Kx(i,t,e),x=wS(i,t+"scale",e),v=vS(i,t+"displacement",e),w=fo(i,t+"rotation",e),S=kg(i,t+"rotate-with-view",e),T=h5(i,t+"angle"),P=SS(i,t+"declutter-mode"),R=new Yw({points:s,radius:a,radius2:u,angle:T,declutterMode:P});return function(C){return o&&R.setRadius(o(C)),c&&R.setRadius2(c(C)),f&&R.setFill(f(C)),p&&R.setStroke(p(C)),v&&R.setDisplacement(v(C)),w&&R.setRotation(w(C)),S&&R.setRotateWithView(S(C)),x&&R.setScale(x(C)),R}}function rle(i,e){let t="circle-",n=Yx(i,t,e),r=Kx(i,t,e),s=fo(i,t+"radius",e),o=wS(i,t+"scale",e),a=vS(i,t+"displacement",e),l=fo(i,t+"rotation",e),c=kg(i,t+"rotate-with-view",e),u=SS(i,t+"declutter-mode"),f=new Kw({radius:5,declutterMode:u});return function(p){return s&&f.setRadius(s(p)),n&&f.setFill(n(p)),r&&f.setStroke(r(p)),a&&f.setDisplacement(a(p)),l&&f.setRotation(l(p)),c&&f.setRotateWithView(c(p)),o&&f.setScale(o(p)),f}}function uf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function fo(i,e,t){let n=uf(i,e);if(n===void 0)return;let r=Dc(n,ri,t);return function(s){return f5(r(s),e)}}function cf(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,Fo,t);return function(s){return hq(r(s),e)}}function sle(i,e,t){let n=cf(i,e+"pattern-src",t),r=oq(i,e+"pattern-offset",t),s=oq(i,e+"pattern-size",t),o=bS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function kg(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,Do,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function bS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,ra,t);return function(s){return fq(r(s),e)}}function uq(i,e,t){let n=uf(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Dc(o,ri,t);return function(c){return f5(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Dc(n,lf,t);return function(s){return Zx(r(s),e)}}function vS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf,t);return function(s){let o=Zx(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function oq(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf,t);return function(s){return dq(r(s),e)}}function wS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf|ri,t);return function(s){return cle(r(s),e)}}function h5(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function ole(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return Vr(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function ale(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function aq(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function lq(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function lle(i,e){let t=i[e];if(t!==void 0)return Zx(t,e)}function SS(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function Zx(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function hq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function f5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function fq(i,e){if(typeof i=="string")return i;let t=Zx(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function dq(i,e){let t=Zx(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function cle(i,e){return typeof i=="number"?i:dq(i,e)}var pq={RENDER_ORDER:"renderOrder"},d5=class extends Q0{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(pq.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new J0(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(pq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?cI:e;let t=ule(e);this.styleFunction_=e===null?void 0:Hz(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function ule(i){if(i===void 0)return cI;if(!i)return null;if(typeof i=="function"||i instanceof Fs)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Fs){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Fs))throw new Error("Expected a list of style instances");n[r]=s}return n}return cq(i)}var TS=d5;var p5=class extends Xs{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},ES=p5;var A5=class extends Ad{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){$n()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;lo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Tw(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(C,L,D,F){return s.call(o,L,C?D:null,F)}let p=u.projection,x=aw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=Wn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],P=[];for(let C=0;C<v.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&qx(D,u)&&a.call(l,F)){let N=F.getRenderer(),B=F.getSource();if(N&&B){let z=B.getWrapX()?x:e,V=f.bind(null,D.managed);P[0]=z[0]+v[C][0],P[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(P,t,n,V,T)}if(c)return c}}if(T.length===0)return;let R=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*R),T.sort((C,L)=>C.distanceSq-L.distanceSq),T.some(C=>c=C.callback(C.feature,C.layer,C.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Kh,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){$n()}scheduleExpireIconCache(e){No.canExpireCache()&&e.postRenderFunctions.push(hle)}};function hle(i,e){No.expire()}var Aq=A5;var m5=class extends Aq{constructor(e){super(e),this.fontChangeListenerKey_=Un(j0,Mc.PROPERTYCHANGE,e.redrawText,e),this.element_=Ls?bw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=bd+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new ES(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ii(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(ho.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof TS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;ll(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let p=t[u];e.layerIndex=u;let x=p.layer,v=x.getSourceState();if(!qx(p,r)||v!="ready"&&v!="undefined"){x.unrender();continue}let w=x.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(p))}this.declutter(e,l),OG(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!ll(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!ll(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let v=f.style.transform;if(v)a.transform(...Sw(v));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(ho.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},mq=m5;function gq(i){if(i instanceof Q0){i.setMapInternal(null);return}i instanceof Vx&&i.getLayers().forEach(gq)}function _q(i,e){if(i instanceof Q0){i.setMapInternal(e);return}if(i instanceof Vx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)_q(t[n],e)}}var g5=class extends ms{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=fle(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:PG,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=$s(),this.pixelToCoordinateTransform_=$s(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Ls||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Ls||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Ls?new co:rS()),this.interactions=t.interactions||(Ls?new co:uS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new EV(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(uo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(uo.VIEW,this.handleViewChanged_),this.addChangeListener(uo.SIZE,this.handleSizeChanged_),this.addChangeListener(uo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof ul)&&e.view.then(function(r){n.setView(new ul(r))}),this.controls.addEventListener(Ks.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Ks.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Ks.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Ks.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Ks.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Ks.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){_q(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Kh,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof Vx?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:Kh,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(uo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Ax(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Mr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(uo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof co){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=Sc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Mr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(uo.SIZE)}getView(){return this.get(uo.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return MV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Cu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===kx.POINTERDOWN||n===Jt.WHEEL||n===Jt.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[Os.ANIMATING]||o[Os.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(ho.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(ho.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Sd(Ru.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Sd(Ru.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)ii(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ll(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(ll(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new mq(this)),!ll(t)){this.mapBrowserEventHandler_=new SV(this,this.moveTolerance_);for(let r in nr)this.mapBrowserEventHandler_.addEventListener(nr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,vw?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[Un(n,Jt.KEYDOWN,this.handleBrowserEvent,this),Un(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!ll(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(ii(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ii(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=Un(e,Mc.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Un(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ii),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Nc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[Un(e,Mc.PROPERTYCHANGE,this.render,this),Un(e,Jt.CHANGE,this.render,this),Un(e,"addlayer",this.handleLayerAdd_,this),Un(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){gq(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&Q4(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:hx(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Nn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=hx(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!mu(this.previousExtent_)&&!I0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Sd(Ru.MOVESTART,this,r)),this.previousExtent_=P0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Os.ANIMATING]&&!s.viewHints[Os.INTERACTING]&&!I0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Sd(Ru.MOVEEND,this,s)),Jb(s.extent,this.previousExtent_))),this.dispatchEvent(new Sd(Ru.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Ru.LOADSTART)||this.hasListener(Ru.LOADEND)||this.hasListener(ho.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Nc("removelayer",t)),this.set(uo.LAYERGROUP,e)}setSize(e){this.set(uo.SIZE,e)}setTarget(e){this.set(uo.TARGET,e)}setView(e){if(!e||e instanceof ul){this.set(uo.VIEW,e);return}this.set(uo.VIEW,new ul);let t=this;e.then(function(n){t.setView(new ul(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(ll(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!Q4(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&rw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Io(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function fle(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new Vx({layers:i.layers});t[uo.LAYERGROUP]=n,t[uo.TARGET]=i.target,t[uo.VIEW]=i.view instanceof ul?i.view:new ul;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new co(i.controls.slice()):(zn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new co(i.interactions.slice()):(zn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new co(i.overlays.slice()):(zn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new co,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var xq=g5;function MS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var dle=new Error("disposed");var ple=[256,256],_5=class extends mg{constructor(e){let t=rn.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=MS(this.data_);return e?[e.width,e.height]:ple}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==rn.IDLE&&this.state!==rn.ERROR)return;this.state=rn.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=rn.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=rn.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(dle),this.controller_=null),super.disposeInternal()}},x5=_5;var y5=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Ad&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return zn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return zn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){zn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},v5=y5;var b5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(_x(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},CS=b5;var Ale=5,w5=class extends Mw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Ale,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return $n()}getData(e){return null}prepareFrame(e){return $n()}renderFrame(e,t){return $n()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mn.LOADED||t.getState()===Mn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mn.LOADED&&t!=Mn.ERROR&&e.addEventListener(Jt.CHANGE,this.boundHandleImageChange_),t==Mn.IDLE&&(e.load(),t=e.getState()),t==Mn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},yq=w5;var T5=[],Gg=null;function mle(){Gg=Si(1,1,void 0,{willReadFrequently:!0})}var S5=class extends yq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=$s(),this.pixelTransform=$s(),this.inversePixelTransform=$s(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Gg||mle(),Gg.clearRect(0,0,1,1);let r;try{Gg.drawImage(e,t,n,1,1,0,0,1,1),r=Gg.getImageData(0,0,1,1).data}catch{return Gg=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(ll(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&Io(Wl(e.style.backgroundColor),Wl(n)))){let c=e.firstElementChild;ll(c)&&(l=c.getContext("2d"))}if(l&&qG(l.canvas.style.transform,t)?(this.container=e,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=Ls?bw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Si();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=zl(n),s=ig(n),o=ng(n),a=tg(n);Mr(t.coordinateToPixelTransform,r),Mr(t.coordinateToPixelTransform,s),Mr(t.coordinateToPixelTransform,o),Mr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Mr(l,r),Mr(l,s),Mr(l,o),Mr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Wn(n)/r*o),l=Math.round(gr(n)/r*o);lo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Tw(this.inversePixelTransform,this.pixelTransform);let c=VG(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new ES(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(ho.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(ho.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new CS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(ho.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(ho.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,p=-e[0]+a,x=-e[1];return lo(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},RS=S5;function E5(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function gle(i,e,t){let n=i[t];return n?n.delete(e):!1}function vq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Au(e,Tc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=Au(e,r))}return e}var M5=class extends RS{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Er(),this.tempTileRange_=new mw(0,0,0,0),this.tempTileCoord_=fg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new v5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new v5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=dg(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||cg(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=Mr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!xc(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),p=this.getTile(u,f[1],f[2],t);if(!p||p.getState()!==rn.LOADED)continue;let x=l.getOrigin(u),v=Vr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof ww||p instanceof Ew)S=p.getImage();else if(p instanceof x5){if(S=MS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),P=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),R=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+R,P+R)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Nn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],p=a.getMapInternal(),x=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),p?p.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),v=o.rotation,w=v?B4(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),P=c.getResolution(S);for(let R=T.minX;R<=T.maxX;++R)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,R,C],w))continue;let L=this.getTile(S,R,C,e);if(!L||!E5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=fg(S,R,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),P])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=dg(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===rn.LOADED)return u.endTransition(Nn(this)),E5(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let p=dg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(E5(r,v,n),x=!0)}x||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),p=f.getZForResolution(o,u.zDirection),x=f.getResolution(p);this.updateStaleKeys(u.getKey());let v=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?Tc(n.extent,s):null,this.layerExtent&&(v=Au(v,this.layerExtent));let P=x*S/2/w,R=x*T/2/w,C=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let Z=f.getZForResolution(r.nextResolution,u.zDirection),ee=vq(e,e.nextExtent);this.enqueueTiles(e,ee,Z,L,D)}let F=vq(e,v);if(this.enqueueTiles(e,F,p,L,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,F,p-1,L,D-1)},0),!(p in L))return this.container;let N=Nn(this),B=e.time;for(let Z of L[p]){let ee=Z.getState();if(ee===rn.EMPTY)continue;let ae=Z.tileCoord;if(ee===rn.LOADED&&Z.getAlpha(N,B)===1){Z.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){gle(L,Z,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let ve=f.getMinZoom();for(let Ie=p-1;Ie>=ve&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);lo(this.tempTransform,S/2,T/2,z,z,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(V,e,this.layerExtent),u.getInterpolate()||(V.imageSmoothingEnabled=!1),this.preRender(V,e);let H=Object.keys(L).map(Number);H.sort(Ba);let K=[],J=[],j=[];for(let Z=H.length-1;Z>=0;--Z){let ee=H[Z],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,ve=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(zl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Mr(this.tempTransform,[w*(Ue[0]-C[0])/x,w*(C[3]-Ue[3])/x]),Me=w*u.getGutterForProjection(s);for(let ze of L[ee]){if(ze.getState()!==rn.LOADED)continue;let $e=ze.tileCoord,Et=Qe[1]-$e[1],Tt=Math.round(mt[0]-(Et-1)*ve),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*ve),Xe=Math.round(mt[1]-Ct*Ie),st=Tt-Gt,tt=un-Xe,vt=ee===p;if(vt&&ze.inTransition(N)){j.push({tile:ze,x:Gt,y:Xe,w:st,h:tt,gutter:Me}),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze);continue}let yt=[Gt,Xe,Gt+st,Xe+tt],ln=[];for(let Qt=0,xn=K.length;Qt<xn;++Qt)ee<J[Qt]&&_r(yt,K[Qt])&&ln.push(K[Qt]);let Zt;ln.length>0&&(Zt=U9(yt,ln)),K.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Zt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let Z=0,ee=j.length;Z<ee;++Z){let{tile:ae,x:ce,y:de,w:ve,h:Ie,gutter:Qe}=j[Z];this.drawTile(ae,e,ce,de,ve,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!I0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let Z=(ee,ae)=>{let ce=Nn(u),de=ae.wantedTiles[ce],ve=de?Object.keys(de).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(Z)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof x5){if(u=MS(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),p=Nn(this),x=t.layerStatesArray[t.layerIndex],v=x.opacity*(l?e.getAlpha(p,t.time):1),w=v!==f.globalAlpha;w&&(f.save(),f.globalAlpha=v);let S=u.width-2*a,T=u.height-2*a;if(c){let P=S/s,R=T/o;for(let C=0,L=c.length;C<L;++C){let D=c[C],F=D[0],N=D[1],B=D[2]-D[0],z=D[3]-D[1];f.drawImage(u,a+(F-n)*P,a+(N-r)*R,B*P,z*R,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),v!==x.opacity?t.animate=!0:l&&e.endTransition(p)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Nn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},bq=M5;var Qx={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var C5=class extends Q0{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Qx.PRELOAD)}setPreload(e){this.set(Qx.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Qx.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Qx.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},wq=C5;var R5=class extends wq{constructor(e){super(e)}createRenderer(){return new bq(this,{cacheSize:this.getCacheSize()})}},P5=R5;var I5=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},PS=I5;var Jx={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},ey=[Jx.FILL],Nu=[Jx.STROKE],hf=[Jx.BEGIN_PATH],N5=[Jx.CLOSE_PATH],An=Jx;var L5=class extends PS{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],xc(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],p=this.tmpCoordinate_,x=!0,v,w,S;for(v=t+r;v<n;v+=r)p[0]=e[v],p[1]=e[v+1],S=Qb(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===ps.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||v===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,p,x;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),p=[];let v=e.getEndss();x=0;for(let w=0,S=v.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,v[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,yx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,yx,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),x=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([An.CUSTOM,l,f,e,n,yg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,yg,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([An.CUSTOM,l,u,e,n,yu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,yu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,yu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,yu,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([An.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[An.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[An.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==An.END_GEOMETRY?o=t:s==An.BEGIN_GEOMETRY&&(r[2]=t,mG(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=ka(n||Ds)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=ka(n||Lo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Eu;let s=e.getLineDash();t.lineDash=s?s.slice():Ga;let o=e.getLineDashOffset();t.lineDashOffset=o||za;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Mu;let l=e.getWidth();t.lineWidth=l!==void 0?l:rf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:tf;let u=e.getOffset();t.strokeOffset=u??Oz,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[An.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[An.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!Io(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[An.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Jb(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;Jm(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Lu=L5;var D5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!xc(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([An.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([An.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||xc(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([An.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([An.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Sq=D5;var F5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([An.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Lo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za],hf);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Nu),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Lo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za],hf);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinates_(c,f,l[p],u,a);this.hitDetectionInstructions.push(Nu),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Nu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Nu),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(hf)}},Tq=F5;var O5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(hf),this.hitDetectionInstructions.push(hf);for(let u=0;u<c;++u){let f=n[u],p=this.coordinates.length,x=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([An.MOVE_TO_LINE_TO,p,x,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,p,x,s,!0]),l&&(this.instructions.push(N5),this.hitDetectionInstructions.push(N5)),t=f}return a&&(this.instructions.push(ey),this.hitDetectionInstructions.push(ey)),l&&(this.instructions.push(Nu),this.hitDetectionInstructions.push(Nu)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Lo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[An.CIRCLE,u,a];this.instructions.push(hf,f),this.hitDetectionInstructions.push(hf,f),r.fillStyle!==void 0&&(this.instructions.push(ey),this.hitDetectionInstructions.push(ey)),r.strokeStyle!==void 0&&(this.instructions.push(Nu),this.hitDetectionInstructions.push(Nu)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Lo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Lo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Ga,za]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinatess_(c,f,l[p],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=_d(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},B5=O5;var U5=0,k5=1;function _le(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let p=(i-r)/l,x=(t-r)/l;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let p=(e-s)/c,x=(n-s)/c;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return U5=u,k5=f,!0}function Eq(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,p,x=0;for(let v=0,w=e.length;v<w;++v){let S=e[v],T=i[x],P=i[x+1],R=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if(_le(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+U5*F,z=P+U5*N,V=T+k5*F,H=P+k5*N;u&&R&&B===f&&z===p?l.push(V,H):(u&&c.push(l.length),l.push(B,z,V,H),u=!0),f=V,p=H,R=!0}T=L,P=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function Mq(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],p=e[o+r+1],x=Math.sqrt((f-c)*(f-c)+(p-u)*(p-u));if(a+=x,a>=i){let v=(i-a+x)/x,w=Po(c,f,v),S=Po(u,p,v);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let v=x-a,w=Po(c,f,v/x),S=Po(u,p,v/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function Cq(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,P,R;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(P=C-v,R=L-w,x=Math.sqrt(P*P+R*R),S!==void 0&&(l+=p,u=Math.acos((S*P+T*R)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=P,T=R),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var ty={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},G5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Ds]={fillStyle:Ds},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let p=e.getExtent();if(!_r(this.maxExtent,p))return;let x;if(u=e.getFlatCoordinates(),c=="LineString")x=[u.length];else if(c=="MultiLineString")x=e.getEnds();else if(c=="Polygon")x=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();x=[];for(let P=0,R=T.length;P<R;++P)x.push(T[P][0])}if((c=="LineString"||c=="MultiLineString")&&!pu(this.getBufferedMaxExtent(),p)){let T=Eq(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let v=o.repeat,w=v?void 0:o.textAlign,S=0;for(let T=0,P=x.length;T<P;++T){let R;v?R=Mq(v*this.resolution,u,S,x[T],f):R=[u.slice(S,x[T])];for(let C=0,L=R.length;C<L;++C){let D=R[C],F=0,N=D.length;if(w==null){let z=Cq(o.maxAngle,D,0,D.length,2);F=z[0],N=z[1]}for(let z=F;z<N;z+=f)a.push(D[z],D[z+1]);let B=a.length;S=x[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let p=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||p.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let C=e.getFlatInteriorPoints();u=[];for(let L=0,D=C.length;L<D;L+=3)o.overflow||p.push(C[L+2]/this.resolution),u.push(C[L],C[L+1]);if(u.length===0)return;f=2;break;default:}let x=this.appendFlatPointCoordinates(u,f);if(x===l)return;if(p&&(x-l)/2!==u.length/f){let C=l/2;p=p.filter((L,D)=>{let F=a[(C+D)*2]===u[D*f]&&a[(C+D)*2+1]===u[D*f+1];return F||--C,F})}this.saveTextStates_();let v=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=nf&&(o.scale[0]<0||o.scale[1]<0)){let C=o.padding[0],L=o.padding[1],D=o.padding[2],F=o.padding[3];o.scale[0]<0&&(L=-L,F=-F),o.scale[1]<0&&(C=-C,D=-D),S=[C,L,D,F]}let T=this.pixelRatio;this.instructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==nf?nf:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let P=1/T,R=v?v.slice(0):null;R&&(R[1]=Ds),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[P,P],NaN,this.declutterMode_,this.declutterImageWithText_,S,R,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Ds:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||wd,justify:t.justify,textBaseline:t.textBaseline||X0,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=ty[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,p=this.text_,x=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,x*l,p,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a&&Ds,r.maxAngle,l,f,s,x*l,p,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=ka(o.getColor()||Ds)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),P=a.getMiterLimit();s.lineCap=a.getLineCap()||Eu,s.lineDash=w?w.slice():Ga,s.lineDashOffset=S===void 0?za:S,s.lineJoin=a.getLineJoin()||Mu,s.lineWidth=T===void 0?rf:T,s.miterLimit=P===void 0?tf:P,s.strokeStyle=ka(a.getColor()||Lo)}n=this.textState_;let l=e.getFont()||Xw;Bz(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||X0,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||nf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),v=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=p===void 0?!1:p,this.textKeepUpright_=x===void 0?!0:x,this.textRotation_=v===void 0?0:v,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Nn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Nn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Rq=G5;var xle={Circle:B5,Default:Lu,Image:Sq,LineString:Tq,Polygon:B5,Text:Rq},z5=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=xle[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},Pq=z5;function Iq(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}function IS(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],p,x,v,w,S,T,P,R,C=0;for(let L=e;L<t;L+=n){v=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(v=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[P,R]=yle(p,x,v,w,S,T,r),o[C++]=P,o[C++]=R;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function yle(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let p=W9([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),v=Math.sin(p/2),w=v*a+x*l,S=-x*a+v*l,T=w*(1/v),P=S*(1/v);return[i+T*o,e+P*o]}function NS(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],p=i[o+1],x=i[o+e],v=i[o+e+1],w=(v-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(v-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let P=a+S*(c-a),R=l+S*(u-l);i[n+e]=P,i[n+e+1]=R,i.splice(n+2*e,o-n-e);break}}}return i}var V5;function vle(){return V5||(V5=new Intl.Segmenter(void 0,{granularity:"grapheme"})),V5}function Nq(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],v=i[e+1],w=0,S=0,T=0,P=0;function R(){w=x,S=v,e+=n,x=i[e],v=i[e+1],P+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do R();while(e<t-n&&P+T<s);let C=T===0?0:(s-P)/T,L=Po(w,x,C),D=Po(S,v,C),F=e-n,N=P,B=s+a*l(c,r,u);for(;e<t-n&&P+T<B;)R();C=T===0?0:(B-P)/T;let z=Po(w,x,C),V=Po(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Nw(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let K=Math.PI,J=[],j=F+n===e;e=F,T=0,P=N,x=i[e],v=i[e+1];let Z;if(j){R(),Z=Math.atan2(v-S,x-w),H&&(Z+=Z>0?-K:K);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,Z,r],J}r=r.replace(/\n/g," ");let ee=Array.from(vle().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){R();let de=Math.atan2(v-S,x-w);if(H&&(de+=de>0?-K:K),Z!==void 0){let Me=de-Z;if(Me+=Me>K?-2*K:Me<-K?2*K:0,Math.abs(Me)>o)return null}Z=de;let ve=ae,Ie=0;for(;ae<ce;++ae){let Me=H?ce-ae-1:ae,ze=a*l(c,ee[Me],u);if(e+n<t&&P+T<s+Ie+ze/2)break;Ie+=ze}if(ae===ve)continue;let Qe=(H?ee.slice(ce-ae,ce-ve):ee.slice(ve,ae)).join("");C=T===0?0:(s+Ie/2-P)/T;let Ue=Po(w,x,C),mt=Po(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var zg=Er(),Cd=[],ff=[],df=[],Rd=[];function Lq(i){return i[3].declutterBox}var Dq=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function q5(i,e){return e==="start"?e=Dq.test(i)?"right":"left":e==="end"&&(e=Dq.test(i)?"left":"right"),ty[e]}function ble(i,e,t){return t>0&&i.push(`7-`,""),i.push(e,""),i}function wle(i,e,t){return t%2===0&&(i+=e),i}var H5=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=$s(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new CS:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let s=e+t+n+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,u=[l.scale[0]*c,l.scale[1]*c],f=l.justify?ty[l.justify]:q5(Array.isArray(e)?e[0]:e,l.textAlign||wd),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8-`).reduce(ble,[]),{width:v,height:w,widths:S,heights:T,lineWidths:P}=Gz(l,x),R=v+p,C=[],L=(R+2)*u[0],D=(w+p)*u[1],F={width:L<0?Math.floor(L):Math.ceil(L),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:C};(u[0]!=1||u[1]!=1)&&C.push("scale",u),r&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",p),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),n&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");let N=.5-f,B=f*R+N*p,z=[],V=[],H=0,K=0,J=0,j=0,Z;for(let ee=0,ae=x.length;ee<ae;ee+=2){let ce=x[ee];if(ce===`9-`){K+=H,H=0,B=f*R+N*p,++j;continue}let de=x[ee+1]||l.font;de!==Z&&(r&&z.push("font",de),n&&V.push("font",de),Z=de),H=Math.max(H,T[J]);let ve=[ce,B+N*S[J]+f*(S[J]-P[j]),.5*(p+H)+K];B+=S[J],r&&z.push("strokeText",ve),n&&V.push("fillText",ve),++J}return Array.prototype.push.apply(C,z),Array.prototype.push.apply(C,V),this.labels_[s]=F,F}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){a*=p[0],l*=p[1];let T=n-a,P=r-l,R=s+c>e?e-c:s,C=o+u>t?t-u:o,L=v[3]+R*p[0]+v[1],D=v[0]+C*p[1]+v[2],F=T-v[3],N=P-v[0];(w||f!==0)&&(Cd[0]=F,Rd[0]=F,Cd[1]=N,ff[1]=N,ff[0]=F+L,df[0]=ff[0],df[1]=N+D,Rd[1]=df[1]);let B;return f!==0?(B=lo($s(),n,r,1,1,f,-n,-r),Mr(B,Cd),Mr(B,ff),Mr(B,df),Mr(B,Rd),al(Math.min(Cd[0],ff[0],df[0],Rd[0]),Math.min(Cd[1],ff[1],df[1],Rd[1]),Math.max(Cd[0],ff[0],df[0],Rd[0]),Math.max(Cd[1],ff[1],df[1],Rd[1]),zg)):al(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),zg),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:zg[0],minY:zg[1],maxX:zg[2],maxY:zg[3],value:S},canvasTransform:B,scale:p}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Cd,ff,df,Rd,o,a),zz(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=Mr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=q5(Array.isArray(e)?e[0]:e,s.textAlign||wd),u=ty[s.textBaseline||X0],f=a&&a.lineWidth?a.lineWidth:0,p=o.width/l-2*s.scale[0],x=c*p+2*(.5-c)*f,v=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:x,anchorY:v}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&Io(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=Ua(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),zG(this.renderedTransform_,n));let f=0,p=r.length,x=0,v,w=[],S,T,P,R,C,L,D,F,N,B,z,V,H,K=0,J=0,j=this.coordinateCache_,Z=this.viewRotation_,ee=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,ae={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Z},ce=this.instructions!=r||this.overlaps?0:200,de,ve,Ie,Qe;for(;f<p;){let Ue=r[f];switch(Ue[0]){case An.BEGIN_GEOMETRY:de=Ue[1],Qe=Ue[3],de.getGeometry()?a!==void 0&&!_r(a,Qe.getExtent())?f=Ue[2]+1:++f:f=Ue[2],c&&(c.zIndex=Ue[4]);break;case An.BEGIN_PATH:K>ce&&(this.fill_(e),K=0),J>ce&&(e.stroke(),J=0),!K&&!J&&(e.beginPath(),C=NaN,L=NaN),++f;break;case An.CIRCLE:x=Ue[1],P=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-P,Et=u[x+3]-P,Tt=$e-Me,Ct=Et-ze,un=Math.sqrt(Tt*Tt+Ct*Ct);e.moveTo(Me+un,ze),e.arc(Me,ze,un,0,2*Math.PI,!0),++f;break;case An.CLOSE_PATH:e.closePath(),++f;break;case An.CUSTOM:x=Ue[1],v=Ue[2];let Gt=Ue[3],Xe=Ue[4],st=Ue[5];ae.geometry=Gt,ae.feature=de,f in j||(j[f]=[]);let tt=j[f];st?st(u,x,v,2,tt):(tt[0]=u[x],tt[1]=u[x+1],tt.length=2),c&&(c.zIndex=Ue[6]),Xe(tt,ae),++f;break;case An.DRAW_IMAGE:x=Ue[1],v=Ue[2],N=Ue[3],S=Ue[4],T=Ue[5];let vt=Ue[6],yt=Ue[7],ln=Ue[8],Zt=Ue[9],Qt=Ue[10],xn=Ue[11],ge=Ue[12],di=Ue[13];R=Ue[14]||"declutter";let On=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let In=this.drawLabelWithPointPlacement_(B,z,V,H);N=In.label,Ue[3]=N;let Ur=Ue[23];S=(In.anchorX-Ur)*this.pixelRatio,Ue[4]=S;let mr=Ue[24];T=(In.anchorY-mr)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,di=N.width,Ue[13]=di}let le;Ue.length>25&&(le=Ue[25]);let X,Te,Pe;Ue.length>17?(X=Ue[16],Te=Ue[17],Pe=Ue[18]):(X=nf,Te=null,Pe=null),Qt&&ee?xn+=Z:!Qt&&!ee&&(xn-=Z);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<di/this.pixelRatio)continue;let In=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],di,vt,S,T,ln,Zt,xn,ge,s,X,!!Te||!!Pe,de),Ur=[e,t,N,In,yt,Te,Pe];if(l){let mr,nl,ea;if(On){let sr=v-x;if(!On[sr]){On[sr]={args:Ur,declutterMode:R};continue}let Rs=On[sr];mr=Rs.args,nl=Rs.declutterMode,delete On[sr],ea=Lq(mr)}let il,Pa;if(mr&&(nl!=="declutter"||!l.collides(ea))&&(il=!0),(R!=="declutter"||!l.collides(In.declutterBox))&&(Pa=!0),nl==="declutter"&&R==="declutter"){let sr=il&&Pa;il=sr,Pa=sr}il&&(nl!=="none"&&l.insert(ea),this.replayImageOrLabel_.apply(this,mr)),Pa&&(R!=="none"&&l.insert(In.declutterBox),this.replayImageOrLabel_.apply(this,Ur))}else this.replayImageOrLabel_.apply(this,Ur)}++f;break;case An.DRAW_CHARS:let gt=Ue[1],St=Ue[2],qe=Ue[3],Ze=Ue[4];H=Ue[5];let Rt=Ue[6],en=Ue[7],Pt=Ue[8];V=Ue[9];let Mt=Ue[10];B=Ue[11],Array.isArray(B)&&(B=B.reduce(wle,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Rn=Ue[16],xe=this.textStates[z],bt=xe.font,Ye=[xe.scale[0]*en,xe.scale[1]*en],wt;bt in this.widths_?wt=this.widths_[bt]:(wt={},this.widths_[bt]=wt);let Dt=Iq(u,gt,St,2),ct=Math.abs(Ye[0])*tI(bt,B,wt);if(Ze||ct<=Dt){let In=this.textStates[z].textAlign,Ur=(Dt-ct)*q5(B,In),mr=Nq(u,gt,St,2,B,Ur,Rt,Math.abs(Ye[0]),tI,bt,wt,ee?0:this.viewRotation_,yn);e:if(mr){let nl=[],ea,il,Pa,sr,Rs;if(V)for(ea=0,il=mr.length;ea<il;++ea){Rs=mr[ea],Pa=Rs[4],sr=this.createLabel(Pa,z,"",V),S=Rs[2]+(Ye[0]<0?-Mt:Mt)-Rn,T=qe*sr.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let rl=this.calculateImageOrLabelDimensions_(sr.width,sr.height,Rs[0],Rs[1],sr.width,sr.height,S,T,0,0,Rs[3],cn,!1,nf,!1,de);if(l&&R==="declutter"&&l.collides(rl.declutterBox))break e;nl.push([e,t,sr,rl,1,null,null])}if(H)for(ea=0,il=mr.length;ea<il;++ea){Rs=mr[ea],Pa=Rs[4],sr=this.createLabel(Pa,z,H,""),S=Rs[2]-Rn,T=qe*sr.height-Pt;let rl=this.calculateImageOrLabelDimensions_(sr.width,sr.height,Rs[0],Rs[1],sr.width,sr.height,S,T,0,0,Rs[3],cn,!1,nf,!1,de);if(l&&R==="declutter"&&l.collides(rl.declutterBox))break e;nl.push([e,t,sr,rl,1,null,null])}l&&R!=="none"&&l.load(nl.map(Lq));for(let rl=0,hu=nl.length;rl<hu;++rl)this.replayImageOrLabel_.apply(this,nl[rl])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let In=o(de,Qe,R);if(In)return In}++f;break;case An.FILL:ce?K++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],v=Ue[2],P=Ue[3];let Ce,jt,qi;if(P){let Ur=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;IS(u,x,v,2,P,Ur,w),NS(w,2,Ur),Ce=w,jt=0,qi=Ce.length}else Ce=u,jt=x,qi=v;ve=Ce[jt],Ie=Ce[jt+1],e.moveTo(ve,Ie),C=ve+.5|0,L=Ie+.5|0;for(let In=jt+2;In<qi;In+=2)ve=Ce[In],Ie=Ce[In+1],D=ve+.5|0,F=Ie+.5|0,(In==qi-2||D!==C||F!==L)&&(e.lineTo(ve,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],K?(this.fill_(e),K=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:K&&Ue[1]&&(this.fill_(e),K=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}K&&this.fill_(e),J&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},Fq=H5;var Pd=["Polygon","Circle","LineString","Image","Text","Default"],X5=["Image","Text"],Oq=Pd.filter(i=>!X5.includes(i)),Bq=!1,Uq=!1;function Sle(){let i=0,e=n=>{let r=Si(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};Bq={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],Uq=!0}var j5=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=$s(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new Fq(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){Uq===!1&&Sle(),r=Math.round(r);let a=r*2+1,l=lo(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Si(a,a,null,{willReadFrequently:Bq}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=Er(),N0(f,e),Jm(f,t*(this.renderBuffer_+r),f));let p=Tle(r),x;function v(L,D,F){let N=u.getImageData(0,0,a,a).data;for(let B=0,z=p.length;B<z;B++)if(N[p[B]]>0){if(!o||F==="none"||x!=="Image"&&x!=="Text"||o.includes(L)){let V=(p[B]-3)/4,H=r-V%a,K=r-(V/a|0),J=s(L,D,H*H+K*K);if(J)return J}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(Ba);let S,T,P,R,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(P=this.executorsByZIndex_[L],T=Pd.length-1;T>=0;--T)if(x=Pd[T],R=P[x],R!==void 0&&(C=R.executeHitDetection(u,l,n,v,f),C))return C}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return Ua(a,0,8,2,e,a),a}isEmpty(){return bc(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?AG:Ba),o=o||Pd;let c=Pd.length;for(let u=0,f=l.length;u<f;++u){let p=l[u].toString(),x=this.executorsByZIndex_[p];for(let v=0,w=o.length;v<w;++v){let S=o[v],T=x[S];if(T!==void 0){let P=a===null?void 0:T.getZIndexContext(),R=P?P.getContext():e,C=this.maxExtent_&&S!=="Image"&&S!=="Text";if(C&&(R.save(),this.clip(R,n)),!P||S==="Text"||S==="Image"?T.execute(R,t,n,r,s,a):P.pushFunction(L=>T.execute(L,t,n,r,s,a)),C&&R.restore(),P){P.offset();let L=l[u]*c+Pd.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(P)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Ba);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}},W5={};function Tle(i){if(W5[i]!==void 0)return W5[i];let e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){let a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}let r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return W5[i]=r,r}var kq=j5;var $5=class extends PS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?L0(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=$s()}drawImages_(e,t,n,r){if(!this.image_)return;let s=Ua(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let p=s[u]-this.imageAnchorX_,x=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let v=p+this.imageAnchorX_,w=x+this.imageAnchorY_;lo(a,v,w,1,1,c,-v,-w),o.save(),o.transform.apply(o,a),o.translate(v,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,p,x,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=Ua(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){let l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s,o){let a=this.context_,l=Ua(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=IS(l,0,u,2,o,f,l),NS(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=az(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(_r(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),Io(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:wd;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:ka(n||Ds)}}if(!t)this.strokeState_=null;else{let n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),u=s||Ga,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Eu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||za)*this.pixelRatio_,lineJoin:a!==void 0?a:Mu,lineWidth:(l!==void 0?l:rf)*this.pixelRatio_,miterLimit:c!==void 0?c:tf,strokeStyle:ka(n||Lo),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let x=t.getColor();this.textFillState_={fillStyle:ka(x||Ds)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let x=n.getColor(),v=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),P=n.getWidth(),R=n.getMiterLimit();this.textStrokeState_={lineCap:v!==void 0?v:Eu,lineDash:w||Ga,lineDashOffset:S||za,lineJoin:T!==void 0?T:Mu,lineWidth:P!==void 0?P:rf,miterLimit:R!==void 0?R:tf,strokeStyle:ka(x||Lo)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),p=e.getTextBaseline();this.textState_={font:r!==void 0?r:Xw,textAlign:f!==void 0?f:wd,textBaseline:p!==void 0?p:X0},this.text_=u!==void 0?Array.isArray(u)?u.reduce((x,v,w)=>x+=w%2?" ":v,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},Gq=$5;var Fc=.5;function zq(i,e,t,n,r,s,o,a,l){let c=l?fd(r,l):r,u=i[0]*Fc,f=i[1]*Fc,p=Si(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new Gq(p,Fc,r,null,o,a,l?O0(U0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let R=1;R<=w;++R){let C=t[R-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(R*S).toString(16).padStart(7,"#00000");for(let B=0,z=D.length;B<z;++B){let V=D[B],H=V.getGeometryFunction()(C);if(!H||!_r(c,H.getExtent()))continue;let K=V.clone(),J=K.getFill();J&&J.setColor(N);let j=K.getStroke();j&&(j.setColor(N),j.setLineDash(null)),K.setText(void 0);let Z=V.getImage();if(Z){let de=Z.getImageSize();if(!de)continue;let ve=Si(de[0],de[1],void 0,{alpha:!1}),Ie=ve.canvas;ve.fillStyle=N,ve.fillRect(0,0,Ie.width,Ie.height),K.setImage(new $0({img:Ie,anchor:Z.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:Z.getOrigin(),opacity:1,size:Z.getSize(),scale:Z.getScale(),rotation:Z.getRotation(),rotateWithView:Z.getRotateWithView()}))}let ee=K.getZIndex()||0,ae=T[ee];ae||(ae={},T[ee]=ae,ae.Polygon=[],ae.Circle=[],ae.LineString=[],ae.Point=[]);let ce=H.getType();if(ce==="GeometryCollection"){let de=H.getGeometriesArrayRecursive();for(let ve=0,Ie=de.length;ve<Ie;++ve){let Qe=de[ve];ae[Qe.getType().replace("Multi","")].push(Qe,K)}}else ae[ce.replace("Multi","")].push(H,K)}}let P=Object.keys(T).map(Number).sort(Ba);for(let R=0,C=P.length;R<C;++R){let L=T[P[R]];for(let D in L){let F=L[D];for(let N=0,B=F.length;N<B;N+=2){v.setStyle(F[N+1]);for(let z=0,V=e.length;z<V;++z)v.setTransform(e[z]),v.drawGeometry(F[N])}}}return p.getImageData(0,0,x.width,x.height)}function Vq(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Fc),s=Math.floor(Math.round(i[1])*Fc),o=(_i(r,0,t.width-1)+_i(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Ele=.5,qq={Point:Lle,LineString:Ple,Polygon:Fle,MultiPoint:Dle,MultiLineString:Ile,MultiPolygon:Nle,GeometryCollection:Rle,Circle:Mle};function Hq(i,e){return parseInt(Nn(i),10)-parseInt(Nn(e),10)}function Y5(i,e){let t=K5(i,e);return t*t}function K5(i,e){return Ele*i/e}function Mle(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Z5(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let p=!0,x=c.getImageState();x==Mn.LOADED||x==Mn.ERROR?p=!1:x==Mn.IDLE&&c.load(),p&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Cle(i,e,t,n,s,o,a),f}function Cle(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())Wq(i,l,t,e,o);else{let u=qq[l.getType()];u(i,l,t,e,o,s)}}function Wq(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)Wq(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Rle(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=qq[o[a].getType()];c(i,o[a],t,n,r,s)}}function Ple(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Ile(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Nle(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(o||s){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Lle(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Mn.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function Dle(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Mn.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function Fle(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}var Q5=class extends RS{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Er(),this.wrappedRenderedExtent_=Er(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),p=this.getLayer().getDeclutter(),x=t.pixelRatio,v=t.viewHints,w=!(v[Os.ANIMATING]||v[Os.INTERACTING]),S=this.context,T=Math.round(Wn(r)/a*x),P=Math.round(gr(r)/a*x),R=f.getWrapX()&&l.canWrapX(),C=R?Wn(u):null,L=R?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=R?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,P,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?Pd:n?X5:Oq,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Si(this.context.canvas.width,this.context.canvas.height,T5))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,z0(this.context),T5.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(ho.PRERENDER)||this.getLayer().hasListener(ho.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=Tc(n.extent,l);a=_r(u,e.extent),a&&!pu(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Fc,p=n[1]*Fc;u.push(this.getRenderTransform(r,s,o,Fc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!pu(v,l)){let S=l[0],T=Wn(v),P=0,R;for(;S<v[0];)--P,R=T*P,u.push(this.getRenderTransform(r,s,o,Fc,f,p,R).slice()),S+=T;for(P=0,S=l[2];S>v[2];)++P,R=T*P,u.push(this.getRenderTransform(r,s,o,Fc,f,p,R).slice()),S-=T}let w=U0();this.hitDetectionImageData_=zq(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,Y5(s,this.renderedPixelRatio_),w?a:null)}t(Vq(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(p,x,v){let w=Nn(p),S=c[w];if(S){if(S!==!0&&v<S.distanceSq){if(v===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(p,l,x);S.geometry=x,S.distanceSq=v}}else{if(v===0)return c[w]=!0,r(p,l,x);s.push(c[w]={feature:p,layer:l,geometry:x,distanceSq:v,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(p=>p.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[Os.ANIMATING],s=e.viewHints[Os.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,p=e.pixelRatio,x=t.getRevision(),v=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=Hq);let S=c.center.slice(),T=Jm(l,v*f),P=T.slice(),R=[T.slice()],C=u.getExtent(),L=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,L){let Z=n.getExtent();Z&&!mu(Z)&&(this.extendX_=Z[0]<C[0]||Z[2]>C[2])}if(L&&(!pu(C,e.extent)||this.extendX_)){let Z=Wn(C),ee=Math.max(Wn(T)/2,Z),ae=C[0],ce=C[2];this.extendX_&&(ae-=Z,ce+=Z),T[0]=ae-ee,T[2]=ce+ee,aw(S,u);let de=k4(R[0],u);de[0]<C[0]&&de[2]<C[2]?R.push([de[0]+Z,de[1],de[2]+Z,de[3]]):de[0]>C[0]&&de[2]>C[2]&&R.push([de[0]-Z,de[1],de[2]-Z,de[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===p&&this.renderedRevision_==x&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&pu(this.wrappedRenderedExtent_,T))return Io(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new Pq(K5(f,p),T,f,p),F=U0(),N;if(F){for(let Z=0,ee=R.length;Z<ee;++Z){let ae=R[Z],ce=fd(ae,u);n.loadFeatures(ce,fG(f,u),F)}N=O0(F,u)}else for(let Z=0,ee=R.length;Z<ee;++Z)n.loadFeatures(R[Z],f,u);let B=Y5(f,p),z=!0,V=(Z,ee)=>{let ae,ce=Z.getStyleFunction()||t.getStyleFunction();if(ce&&(ae=ce(Z,f)),ae){let de=this.renderFeature(Z,B,ae,D,N,this.getLayer().getDeclutter(),ee);z=z&&!de}},H=fd(T,u),K=n.getFeaturesInExtent(H);w&&K.sort(w);for(let Z=0,ee=K.length;Z<ee;++Z)V(K[Z],Z);this.renderedFeatures_=K,this.ready=z;let J=D.finish(),j=new kq(T,f,p,n.getOverlaps(),J,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=x,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=P,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=p,this.replayGroup_=j,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=Z5(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=Z5(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},jq=Q5;var J5=class extends TS{constructor(e){super(e)}createRenderer(){return new jq(this)}},Xq=J5;var Ole=!1;function Ble(i,e,t,n,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Ole,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=e.getType();try{let u;c=="text"||c=="json"?u=a.responseText:c=="xml"?u=a.responseXML||a.responseText:c=="arraybuffer"&&(u=a.response),u?s(e.readFeatures(u,{extent:t,featureProjection:r}),e.readProjection(u)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function eN(i,e){return function(t,n,r,s,o){Ble(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function $q(i,e){return[[-1/0,-1/0,1/0,1/0]]}function tN(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],p=0,x=[0];for(let S=e+n;S<t;S+=n){let T=i[S],P=i[S+1];p+=Math.sqrt((T-u)*(T-u)+(P-f)*(P-f)),x.push(p),u=T,f=P}let v=r*p,w=pG(x,v);w<0?(l=(v-x[-w-2])/(x[-w-1]-x[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Po(i[a+u],i[a+n+u],l);return s}var Yq=$s(),ny=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?ew(this.flatCoordinates_):eg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Oa(this.getExtent());this.flatInteriorPoints_=wx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=_z(this.flatCoordinates_,this.ends_),t=Qw(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Lw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=tN(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,s=n.length;r<s;++r){let o=n[r],a=tN(e,t,o,this.stride_,.5);Ec(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=As(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=gr(n)/gr(t);lo(Yq,n[0],n[3],r,-r,0,0,0),Ua(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Yq,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new i(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=yw((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let n=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":n.length=vx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=pz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=bx(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break;default:}return r&&(this.simplifiedGeometry_=new i(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};ny.prototype.getFlatCoordinates=ny.prototype.getOrientedFlatCoordinates;var nA=ny;var nN=class{constructor(e){this.rbush_=new J0(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Nn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Nn(a)]=l}this.rbush_.load(n)}remove(e){let t=Nn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Nn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];I0(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return bc(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return al(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},iN=nN;var hl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Du=class extends Xs{constructor(e,t,n){super(e),this.feature=t,this.features=n}},rN=class extends Rw{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=Qh,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(zn(this.format_,"`format` must be set when `url` is set"),this.loader_=eN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:$q;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new iN:null,this.loadedExtentsRtree_=new iN,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new co(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Nn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Du(hl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof nA||(this.featureChangeKeys_[e]=[Un(t,Jt.CHANGE,this.handleFeatureChange_,this),Un(t,Mc.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof nA){let s=this.idIndex_[r];s instanceof nA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(zn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Nn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Nn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(hl.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Du(hl.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(hl.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(hl.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Ks.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Ks.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(ii);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Du(hl.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){let s=r.getGeometry();if(s instanceof nA||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof nA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),bc(this.nullGeometryFeatures_)||Ec(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=iw(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return t=t||Kh,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof nA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let p=Math.sqrt(a);l[0]=n-p,l[1]=r-p,l[2]=n+p,l[3]=r+p}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Nn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Du(hl.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Nn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&bc(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return pu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Du(hl.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Du(hl.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Du(hl.FEATURESLOADERROR))},p=!1,x=this.loader_.call(this,l,t,n,v=>p||u(v),()=>p||f());x instanceof Promise?(p=!0,x.then(v=>{this.addFeatures(v),u(v)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=U4(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Nn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(ii),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(hl.REMOVEFEATURE)&&this.dispatchEvent(new Du(hl.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){zn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(eN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},pf=rN;var Aa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Qd={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},UT=0,Ky=1,kT=2;var jN=0,Jd=1,GT=2,Zl=3,Ao=0,ui=1,ir=2,Xr=0,rs=1,zu=2,Vu=3,qu=4,If=5,Zy=6,Bs=100,Qy=101,Jy=102,zT=103,VT=104,qc=200,e2=201,t2=202,n2=203,Ud=204,kd=205,i2=206,r2=207,s2=208,o2=209,a2=210,UH=211,kH=212,GH=213,zH=214,aA=0,lA=1,cA=2,Bu=3,uA=4,hA=5,fA=6,dA=7,RA=0,qT=1,HT=2,ks=0,l2=1,c2=2,u2=3,h2=4,XN=5,f2=6,d2=7;var p2=300,gl=301,Ql=302,ep=303,tp=304,Hu=306,Sf=1e3,Uo=1001,Tf=1002,xi=1003,A2=1004;var Jl=1005;var vi=1006,np=1007;var go=1008,$N=1008,Gi=1009,Wu=1010,ju=1011,Ha=1012,Ir=1013,pi=1014,Yi=1015,Li=1016,PA=1017,IA=1018,Go=1020,NA=35902,LA=35899,S_=1021,Nf=1022,xr=1023,xs=1026,Qs=1027,Lf=1028,Xu=1029,ws=1030,$u=1031,m2=1032,ip=1033,Yu=33776,Ku=33777,Zu=33778,Qu=33779,DA=35840,FA=35841,OA=35842,BA=35843,rp=36196,sp=37492,op=37496,ap=37488,lp=37489,Ju=37490,cp=37491,up=37808,hp=37809,fp=37810,dp=37811,pp=37812,Ap=37813,mp=37814,gp=37815,_p=37816,xp=37817,yp=37818,vp=37819,bp=37820,wp=37821,Sp=36492,Tp=36494,Ep=36495,Mp=36283,Cp=36284,eh=36285,Rp=36286;var my=2300,fT=2301,uT=2302,LN=2303,DN=2400,FN=2401,ON=2402;var YN=0,KN=1,WT=2,VH=3200;var _l=0,jT=1,zo="",Wr="srgb",Gd="srgb-linear",zd="linear",Bt="srgb",g2="",XT="rg",ZN="ga",QN=0,yf=7680,JN=7681,eL=7682,tL=7683,nL=34055,iL=34056,rL=5386,sL=512,oL=513,aL=514,lL=515,cL=516,uL=517,hL=518,gy=519,_2=512,T_=513,x2=514,th=515,UA=516,y2=517,Hc=518,v2=519,Vd=35044,kA=35048;var fL="300 es",po=2e3,Va=2001,ec={COMPUTE:"compute",RENDER:"render"};var Df={TEXTURE_COMPARE:"depthTextureCompare"};function Ule(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function E_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function l_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function $T(){let i=l_("canvas");return i.style.display="block",i}var Kq={},c_=null;function pA(...i){let e="THREE."+i.shift();c_?c_("log",e,...i):console.log(e,...i)}function qH(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function je(...i){i=qH(i);let e="THREE."+i.shift();if(c_)c_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=qH(i);let e="THREE."+i.shift();if(c_)c_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Kn(...i){let e=i.join(" ");e in Kq||(Kq[e]=!0,je(...i))}function dL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function HH(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var b2={[aA]:lA,[cA]:fA,[uA]:dA,[Bu]:hA,[lA]:aA,[fA]:cA,[dA]:uA,[hA]:Bu},ko=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},Oo=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Zq=1234567,fy=Math.PI/180,Ef=180/Math.PI;function Ou(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Oo[i&255]+Oo[i>>8&255]+Oo[i>>16&255]+Oo[i>>24&255]+"-"+Oo[e&255]+Oo[e>>8&255]+"-"+Oo[e>>16&15|64]+Oo[e>>24&255]+"-"+Oo[t&63|128]+Oo[t>>8&255]+"-"+Oo[t>>16&255]+Oo[t>>24&255]+Oo[n&255]+Oo[n>>8&255]+Oo[n>>16&255]+Oo[n>>24&255]).toLowerCase()}function Pn(i,e,t){return Math.max(e,Math.min(t,i))}function pL(i,e){return(i%e+e)%e}function kle(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Gle(i,e,t){return i!==e?(t-i)/(e-i):0}function dy(i,e,t){return(1-t)*i+t*e}function zle(i,e,t,n){return dy(i,e,1-Math.exp(-t*n))}function Vle(i,e=1){return e-Math.abs(pL(i,e*2)-e)}function qle(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Hle(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Wle(i,e){return i+Math.floor(Math.random()*(e-i+1))}function jle(i,e){return i+Math.random()*(e-i)}function Xle(i){return i*(.5-Math.random())}function $le(i){i!==void 0&&(Zq=i);let e=Zq+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Yle(i){return i*fy}function Kle(i){return i*Ef}function Zle(i){return(i&i-1)===0&&i!==0}function Qle(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Jle(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function ece(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),p=o((e-n)/2),x=s((n-e)/2),v=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*p,a*c);break;case"YZY":i.set(l*p,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*p,a*u,a*c);break;case"XZX":i.set(a*u,l*v,l*x,a*c);break;case"YXY":i.set(l*x,a*u,l*v,a*c);break;case"ZYZ":i.set(l*v,l*x,a*u,a*c);break;default:je("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function aa(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function qn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Wc={DEG2RAD:fy,RAD2DEG:Ef,generateUUID:Ou,clamp:Pn,euclideanModulo:pL,mapLinear:kle,inverseLerp:Gle,lerp:dy,damp:zle,pingpong:Vle,smoothstep:qle,smootherstep:Hle,randInt:Wle,randFloat:jle,randFloatSpread:Xle,seededRandom:$le,degToRad:Yle,radToDeg:Kle,isPowerOfTwo:Zle,ceilPowerOfTwo:Qle,floorPowerOfTwo:Jle,setQuaternionFromProperEuler:ece,normalize:qn,denormalize:aa},xL=class xL{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};xL.prototype.isVector2=!0;var Oe=xL,ys=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],p=s[o+0],x=s[o+1],v=s[o+2],w=s[o+3];if(f!==w||l!==p||c!==x||u!==v){let S=l*p+c*x+u*v+f*w;S<0&&(p=-p,x=-x,v=-v,w=-w,S=-S);let T=1-a;if(S<.9995){let P=Math.acos(S),R=Math.sin(P);T=Math.sin(T*P)/R,a=Math.sin(a*P)/R,l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a}else{l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a;let P=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=P,c*=P,u*=P,f*=P}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],p=s[o+1],x=s[o+2],v=s[o+3];return e[t]=a*v+u*f+l*x-c*p,e[t+1]=l*v+u*p+c*f-a*x,e[t+2]=c*v+u*x+a*p-l*f,e[t+3]=u*v-a*f-l*p-c*x,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),p=l(n/2),x=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"YXZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"ZXY":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"ZYX":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"YZX":this._x=p*u*f+c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f-p*x*v;break;case"XZY":this._x=p*u*f-c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f+p*x*v;break;default:je("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+a+f;if(p>0){let x=.5/Math.sqrt(p+1);this._w=.25/x,this._x=(u-l)*x,this._y=(s-c)*x,this._z=(o-r)*x}else if(n>a&&n>f){let x=2*Math.sqrt(1+n-a-f);this._w=(u-l)/x,this._x=.25*x,this._y=(r+o)/x,this._z=(s+c)/x}else if(a>f){let x=2*Math.sqrt(1+a-n-f);this._w=(s-c)/x,this._x=(r+o)/x,this._y=.25*x,this._z=(l+u)/x}else{let x=2*Math.sqrt(1+f-n-a);this._w=(o-r)/x,this._x=(s+c)/x,this._y=(l+u)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Pn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},yL=class yL{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Qq.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qq.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return sN.copy(this).projectOnVector(e),this.sub(sN)}reflect(e){return this.sub(sN.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};yL.prototype.isVector3=!0;var ie=yL,sN=new ie,Qq=new ys,vL=class vL{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],x=n[5],v=n[8],w=r[0],S=r[3],T=r[6],P=r[1],R=r[4],C=r[7],L=r[2],D=r[5],F=r[8];return s[0]=o*w+a*P+l*L,s[3]=o*S+a*R+l*D,s[6]=o*T+a*C+l*F,s[1]=c*w+u*P+f*L,s[4]=c*S+u*R+f*D,s[7]=c*T+u*C+f*F,s[2]=p*w+x*P+v*L,s[5]=p*S+x*R+v*D,s[8]=p*T+x*C+v*F,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,p=a*l-u*s,x=c*s-o*l,v=t*f+n*p+r*x;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/v;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=p*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=x*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return Kn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(oN.makeScale(e,t)),this}rotate(e){return Kn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(oN.makeRotation(-e)),this}translate(e,t){return Kn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(oN.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};vL.prototype.isMatrix3=!0;var Sn=vL,oN=new Sn,Jq=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),eH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function tce(){let i={enabled:!0,workingColorSpace:Gd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=wf(r.r),r.g=wf(r.g),r.b=wf(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Bt&&(r.r=a_(r.r),r.g=a_(r.g),r.b=a_(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===zo?zd:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Kn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Kn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Gd]:{primaries:e,whitePoint:n,transfer:zd,toXYZ:Jq,fromXYZ:eH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Wr},outputColorSpaceConfig:{drawingBufferColorSpace:Wr}},[Wr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:Jq,fromXYZ:eH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Wr}}}),i}var sn=tce();function wf(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function a_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Vg,dT=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Vg===void 0&&(Vg=l_("canvas")),Vg.width=e.width,Vg.height=e.height;let r=Vg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Vg}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=l_("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=wf(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(wf(t[n]/255)*255):t[n]=wf(t[n]);return{data:t,width:e.width,height:e.height}}else return je("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},nce=0,u_=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:nce++}),this.uuid=Ou(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(aN(r[o].image)):s.push(aN(r[o]))}else s=aN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function aN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?dT.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(je("Texture: Unable to serialize Texture."),{})}var ice=0,lN=new ie,vs=class i extends ko{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=Uo,r=Uo,s=vi,o=go,a=xr,l=Gi,c=i.DEFAULT_ANISOTROPY,u=zo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ice++}),this.uuid=Ou(),this.name="",this.source=new u_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Sn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(lN).x}get height(){return this.source.getSize(lN).y}get depth(){return this.source.getSize(lN).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){je(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==p2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Sf:e.x=e.x-Math.floor(e.x);break;case Uo:e.x=e.x<0?0:1;break;case Tf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Sf:e.y=e.y-Math.floor(e.y);break;case Uo:e.y=e.y<0?0:1;break;case Tf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};vs.DEFAULT_IMAGE=null;vs.DEFAULT_MAPPING=p2;vs.DEFAULT_ANISOTROPY=1;var bL=class bL{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],x=l[5],v=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-w)<.01&&Math.abs(v-S)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+w)<.1&&Math.abs(v+S)<.1&&Math.abs(c+x+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let R=(c+1)/2,C=(x+1)/2,L=(T+1)/2,D=(u+p)/4,F=(f+w)/4,N=(v+S)/4;return R>C&&R>L?R<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(R),r=D/n,s=F/n):C>L?C<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(C),n=D/r,s=N/r):L<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),n=F/s,r=N/s),this.set(n,r,s,t),this}let P=Math.sqrt((S-v)*(S-v)+(f-w)*(f-w)+(p-u)*(p-u));return Math.abs(P)<.001&&(P=1),this.x=(S-v)/P,this.y=(f-w)/P,this.z=(p-u)/P,this.w=Math.acos((c+x+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this.w=Pn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this.w=Pn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};bL.prototype.isVector4=!0;var gn=bL,la=class extends ko{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new vs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:vi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new u_(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},ca=class extends la{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},AA=class extends vs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xi,this.minFilter=xi,this.wrapR=Uo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var pT=class extends vs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xi,this.minFilter=xi,this.wrapR=Uo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var BT=class BT{constructor(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=p,T[3]=x,T[7]=v,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new BT().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/qg.setFromMatrixColumn(e,0).length(),s=1/qg.setFromMatrixColumn(e,1).length(),o=1/qg.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=x+v*c,t[5]=p-w*c,t[9]=-a*l,t[2]=w-p*c,t[6]=v+x*c,t[10]=o*l}else if(e.order==="YXZ"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p+w*a,t[4]=v*a-x,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=x*a-v,t[6]=w+p*a,t[10]=o*l}else if(e.order==="ZXY"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p-w*a,t[4]=-o*f,t[8]=v+x*a,t[1]=x+v*a,t[5]=o*u,t[9]=w-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=v*c-x,t[8]=p*c+w,t[1]=l*f,t[5]=w*c+p,t[9]=x*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=w-p*f,t[8]=v*f+x,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=x*f+v,t[10]=p-w*f}else if(e.order==="XZY"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+w,t[5]=o*u,t[9]=x*f-v,t[2]=v*f-x,t[6]=a*u,t[10]=w*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rce,e,sce)}lookAt(e,t,n){let r=this.elements;return fl.subVectors(e,t),fl.lengthSq()===0&&(fl.z=1),fl.normalize(),Id.crossVectors(n,fl),Id.lengthSq()===0&&(Math.abs(n.z)===1?fl.x+=1e-4:fl.z+=1e-4,fl.normalize(),Id.crossVectors(n,fl)),Id.normalize(),LS.crossVectors(fl,Id),r[0]=Id.x,r[4]=LS.x,r[8]=fl.x,r[1]=Id.y,r[5]=LS.y,r[9]=fl.y,r[2]=Id.z,r[6]=LS.z,r[10]=fl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],x=n[13],v=n[2],w=n[6],S=n[10],T=n[14],P=n[3],R=n[7],C=n[11],L=n[15],D=r[0],F=r[4],N=r[8],B=r[12],z=r[1],V=r[5],H=r[9],K=r[13],J=r[2],j=r[6],Z=r[10],ee=r[14],ae=r[3],ce=r[7],de=r[11],ve=r[15];return s[0]=o*D+a*z+l*J+c*ae,s[4]=o*F+a*V+l*j+c*ce,s[8]=o*N+a*H+l*Z+c*de,s[12]=o*B+a*K+l*ee+c*ve,s[1]=u*D+f*z+p*J+x*ae,s[5]=u*F+f*V+p*j+x*ce,s[9]=u*N+f*H+p*Z+x*de,s[13]=u*B+f*K+p*ee+x*ve,s[2]=v*D+w*z+S*J+T*ae,s[6]=v*F+w*V+S*j+T*ce,s[10]=v*N+w*H+S*Z+T*de,s[14]=v*B+w*K+S*ee+T*ve,s[3]=P*D+R*z+C*J+L*ae,s[7]=P*F+R*V+C*j+L*ce,s[11]=P*N+R*H+C*Z+L*de,s[15]=P*B+R*K+C*ee+L*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],x=e[14],v=e[3],w=e[7],S=e[11],T=e[15],P=l*x-c*p,R=a*x-c*f,C=a*p-l*f,L=o*x-c*u,D=o*p-l*u,F=o*f-a*u;return t*(w*P-S*R+T*C)-n*(v*P-S*L+T*D)+r*(v*R-w*L+T*F)-s*(v*C-w*D+S*F)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],x=e[11],v=e[12],w=e[13],S=e[14],T=e[15],P=t*a-n*o,R=t*l-r*o,C=t*c-s*o,L=n*l-r*a,D=n*c-s*a,F=r*c-s*l,N=u*w-f*v,B=u*S-p*v,z=u*T-x*v,V=f*S-p*w,H=f*T-x*w,K=p*T-x*S,J=P*K-R*H+C*V+L*z-D*B+F*N;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let j=1/J;return e[0]=(a*K-l*H+c*V)*j,e[1]=(r*H-n*K-s*V)*j,e[2]=(w*F-S*D+T*L)*j,e[3]=(p*D-f*F-x*L)*j,e[4]=(l*z-o*K-c*B)*j,e[5]=(t*K-r*z+s*B)*j,e[6]=(S*C-v*F-T*R)*j,e[7]=(u*F-p*C+x*R)*j,e[8]=(o*H-a*z+c*N)*j,e[9]=(n*z-t*H-s*N)*j,e[10]=(v*D-w*C+T*P)*j,e[11]=(f*C-u*D-x*P)*j,e[12]=(a*B-o*V-l*N)*j,e[13]=(t*V-n*B+r*N)*j,e[14]=(w*R-v*L-S*P)*j,e[15]=(u*L-f*R+p*P)*j,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,p=s*c,x=s*u,v=s*f,w=o*u,S=o*f,T=a*f,P=l*c,R=l*u,C=l*f,L=n.x,D=n.y,F=n.z;return r[0]=(1-(w+T))*L,r[1]=(x+C)*L,r[2]=(v-R)*L,r[3]=0,r[4]=(x-C)*D,r[5]=(1-(p+T))*D,r[6]=(S+P)*D,r[7]=0,r[8]=(v+R)*F,r[9]=(S-P)*F,r[10]=(1-(p+w))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=qg.set(r[0],r[1],r[2]).length(),a=qg.set(r[4],r[5],r[6]).length(),l=qg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Oc.copy(this);let c=1/o,u=1/a,f=1/l;return Oc.elements[0]*=c,Oc.elements[1]*=c,Oc.elements[2]*=c,Oc.elements[4]*=u,Oc.elements[5]*=u,Oc.elements[6]*=u,Oc.elements[8]*=f,Oc.elements[9]*=f,Oc.elements[10]*=f,t.setFromRotationMatrix(Oc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=po,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),p=(t+e)/(t-e),x=(n+r)/(n-r),v,w;if(l)v=s/(o-s),w=o*s/(o-s);else if(a===po)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===Va)v=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=x,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=po,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),p=-(t+e)/(t-e),x=-(n+r)/(n-r),v,w;if(l)v=1/(o-s),w=o/(o-s);else if(a===po)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===Va)v=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=x,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};BT.prototype.isMatrix4=!0;var on=BT,qg=new ie,Oc=new on,rce=new ie(0,0,0),sce=new ie(1,1,1),Id=new ie,LS=new ie,fl=new ie,tH=new on,nH=new ys,ua=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(Pn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Pn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Pn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Pn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Pn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-Pn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,x),this._y=0);break;default:je("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return tH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(tH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return nH.setFromEuler(this),this.setFromQuaternion(nH,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ua.DEFAULT_ORDER="XYZ";var h_=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},oce=0,iH=new ie,Hg=new ys,Af=new on,DS=new ie,iy=new ie,ace=new ie,lce=new ys,rH=new ie(1,0,0),sH=new ie(0,1,0),oH=new ie(0,0,1),aH={type:"added"},cce={type:"removed"},Wg={type:"childadded",child:null},cN={type:"childremoved",child:null},$i=class i extends ko{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:oce++}),this.uuid=Ou(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new ua,n=new ys,r=new ie(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new on},normalMatrix:{value:new Sn}}),this.matrix=new on,this.matrixWorld=new on,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new h_,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Hg.setFromAxisAngle(e,t),this.quaternion.multiply(Hg),this}rotateOnWorldAxis(e,t){return Hg.setFromAxisAngle(e,t),this.quaternion.premultiply(Hg),this}rotateX(e){return this.rotateOnAxis(rH,e)}rotateY(e){return this.rotateOnAxis(sH,e)}rotateZ(e){return this.rotateOnAxis(oH,e)}translateOnAxis(e,t){return iH.copy(e).applyQuaternion(this.quaternion),this.position.add(iH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(rH,e)}translateY(e){return this.translateOnAxis(sH,e)}translateZ(e){return this.translateOnAxis(oH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Af.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?DS.copy(e):DS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),iy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Af.lookAt(iy,DS,this.up):Af.lookAt(DS,iy,this.up),this.quaternion.setFromRotationMatrix(Af),r&&(Af.extractRotation(r.matrixWorld),Hg.setFromRotationMatrix(Af),this.quaternion.premultiply(Hg.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(aH),Wg.child=e,this.dispatchEvent(Wg),Wg.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(cce),cN.child=e,this.dispatchEvent(cN),cN.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Af.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Af.multiply(e.parent.matrixWorld)),e.applyMatrix4(Af),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(aH),Wg.child=e,this.dispatchEvent(Wg),Wg.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iy,e,ace),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iy,lce,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),p=o(e.skeletons),x=o(e.animations),v=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),x.length>0&&(n.animations=x),v.length>0&&(n.nodes=v)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};$i.DEFAULT_UP=new ie(0,1,0);$i.DEFAULT_MATRIX_AUTO_UPDATE=!0;$i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var _s=class extends $i{constructor(){super(),this.isGroup=!0,this.type="Group"}},uce={type:"move"},qd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new _s,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new _s,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ie,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ie),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new _s,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ie,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ie,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),x=.02,v=.005;c.inputState.pinching&&p>x+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=x-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(uce)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new _s;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},WH={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Nd={h:0,s:0,l:0},FS={h:0,s:0,l:0};function uN(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var Ut=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Wr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,sn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=sn.workingColorSpace){return this.r=e,this.g=t,this.b=n,sn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=sn.workingColorSpace){if(e=pL(e,1),t=Pn(t,0,1),n=Pn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=uN(o,s,e+1/3),this.g=uN(o,s,e),this.b=uN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=Wr){function n(s){s!==void 0&&parseFloat(s)<1&&je("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:je("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);je("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Wr){let n=WH[e.toLowerCase()];return n!==void 0?this.setHex(n,t):je("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=wf(e.r),this.g=wf(e.g),this.b=wf(e.b),this}copyLinearToSRGB(e){return this.r=a_(e.r),this.g=a_(e.g),this.b=a_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Wr){return sn.workingToColorSpace(Bo.copy(this),e),Math.round(Pn(Bo.r*255,0,255))*65536+Math.round(Pn(Bo.g*255,0,255))*256+Math.round(Pn(Bo.b*255,0,255))}getHexString(e=Wr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(Bo.copy(this),t);let n=Bo.r,r=Bo.g,s=Bo.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=sn.workingColorSpace){return sn.workingToColorSpace(Bo.copy(this),t),e.r=Bo.r,e.g=Bo.g,e.b=Bo.b,e}getStyle(e=Wr){sn.workingToColorSpace(Bo.copy(this),e);let t=Bo.r,n=Bo.g,r=Bo.b;return e!==Wr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Nd),this.setHSL(Nd.h+e,Nd.s+t,Nd.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Nd),e.getHSL(FS);let n=dy(Nd.h,FS.h,t),r=dy(Nd.s,FS.s,t),s=dy(Nd.l,FS.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Bo=new Ut;Ut.NAMES=WH;var Hd=class extends $i{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ua,this.environmentIntensity=1,this.environmentRotation=new ua,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Bc=new ie,mf=new ie,hN=new ie,gf=new ie,jg=new ie,Xg=new ie,lH=new ie,fN=new ie,dN=new ie,pN=new ie,AN=new gn,mN=new gn,gN=new gn,vf=class i{constructor(e=new ie,t=new ie,n=new ie){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Bc.subVectors(e,t),r.cross(Bc);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Bc.subVectors(r,t),mf.subVectors(n,t),hN.subVectors(e,t);let o=Bc.dot(Bc),a=Bc.dot(mf),l=Bc.dot(hN),c=mf.dot(mf),u=mf.dot(hN),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let p=1/f,x=(c*l-a*u)*p,v=(o*u-a*l)*p;return s.set(1-x-v,v,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,gf)===null?!1:gf.x>=0&&gf.y>=0&&gf.x+gf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,gf)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,gf.x),l.addScaledVector(o,gf.y),l.addScaledVector(a,gf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return AN.setScalar(0),mN.setScalar(0),gN.setScalar(0),AN.fromBufferAttribute(e,t),mN.fromBufferAttribute(e,n),gN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(AN,s.x),o.addScaledVector(mN,s.y),o.addScaledVector(gN,s.z),o}static isFrontFacing(e,t,n,r){return Bc.subVectors(n,t),mf.subVectors(e,t),Bc.cross(mf).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Bc.subVectors(this.c,this.b),mf.subVectors(this.a,this.b),Bc.cross(mf).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;jg.subVectors(r,n),Xg.subVectors(s,n),fN.subVectors(e,n);let l=jg.dot(fN),c=Xg.dot(fN);if(l<=0&&c<=0)return t.copy(n);dN.subVectors(e,r);let u=jg.dot(dN),f=Xg.dot(dN);if(u>=0&&f<=u)return t.copy(r);let p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(jg,o);pN.subVectors(e,s);let x=jg.dot(pN),v=Xg.dot(pN);if(v>=0&&x<=v)return t.copy(s);let w=x*c-l*v;if(w<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(n).addScaledVector(Xg,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return lH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(lH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(jg,o).addScaledVector(Xg,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ha=class{constructor(e=new ie(1/0,1/0,1/0),t=new ie(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Uc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Uc.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Uc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Uc):Uc.fromBufferAttribute(s,o),Uc.applyMatrix4(e.matrixWorld),this.expandByPoint(Uc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),OS.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),OS.copy(n.boundingBox)),OS.applyMatrix4(e.matrixWorld),this.union(OS)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Uc),Uc.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ry),BS.subVectors(this.max,ry),$g.subVectors(e.a,ry),Yg.subVectors(e.b,ry),Kg.subVectors(e.c,ry),Ld.subVectors(Yg,$g),Dd.subVectors(Kg,Yg),iA.subVectors($g,Kg);let t=[0,-Ld.z,Ld.y,0,-Dd.z,Dd.y,0,-iA.z,iA.y,Ld.z,0,-Ld.x,Dd.z,0,-Dd.x,iA.z,0,-iA.x,-Ld.y,Ld.x,0,-Dd.y,Dd.x,0,-iA.y,iA.x,0];return!_N(t,$g,Yg,Kg,BS)||(t=[1,0,0,0,1,0,0,0,1],!_N(t,$g,Yg,Kg,BS))?!1:(US.crossVectors(Ld,Dd),t=[US.x,US.y,US.z],_N(t,$g,Yg,Kg,BS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Uc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Uc).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_f[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_f[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_f[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_f[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_f[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_f[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_f[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_f[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_f),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},_f=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],Uc=new ie,OS=new ha,$g=new ie,Yg=new ie,Kg=new ie,Ld=new ie,Dd=new ie,iA=new ie,ry=new ie,BS=new ie,US=new ie,rA=new ie;function _N(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){rA.fromArray(i,s);let a=r.x*Math.abs(rA.x)+r.y*Math.abs(rA.y)+r.z*Math.abs(rA.z),l=e.dot(rA),c=t.dot(rA),u=n.dot(rA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var bf=hce();function hce(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function dl(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=Pn(i,-65504,65504),bf.floatView[0]=i;let e=bf.uint32View[0],t=e>>23&511;return bf.baseTable[t]+((e&8388607)>>bf.shiftTable[t])}function kS(i){let e=i>>10;return bf.uint32View[0]=bf.mantissaTable[bf.offsetTable[e]+(i&1023)]+bf.exponentTable[e],bf.floatView[0]}var gs=new ie,GS=new Oe,fce=0,Ni=class extends ko{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:fce++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Vd,this.updateRanges=[],this.gpuType=Yi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)GS.fromBufferAttribute(this,t),GS.applyMatrix3(e),this.setXY(t,GS.x,GS.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyMatrix3(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyMatrix4(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.applyNormalMatrix(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)gs.fromBufferAttribute(this,t),gs.transformDirection(e),this.setXYZ(t,gs.x,gs.y,gs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=aa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=qn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=aa(t,this.array)),t}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=aa(t,this.array)),t}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=aa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=aa(t,this.array)),t}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Vd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var mA=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var gA=class extends Ni{constructor(e,t,n){super(new Uint32Array(e),t,n)}},f_=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=kS(this.array[e*this.itemSize]);return this.normalized&&(t=aa(t,this.array)),t}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize]=dl(t),this}getY(e){let t=kS(this.array[e*this.itemSize+1]);return this.normalized&&(t=aa(t,this.array)),t}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+1]=dl(t),this}getZ(e){let t=kS(this.array[e*this.itemSize+2]);return this.normalized&&(t=aa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+2]=dl(t),this}getW(e){let t=kS(this.array[e*this.itemSize+3]);return this.normalized&&(t=aa(t,this.array)),t}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+3]=dl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this.array[e+2]=dl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this.array[e+2]=dl(r),this.array[e+3]=dl(s),this}},kn=class extends Ni{constructor(e,t,n){super(new Float32Array(e),t,n)}},dce=new ha,sy=new ie,xN=new ie,qa=class{constructor(e=new ie,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):dce.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;sy.subVectors(e,this.center);let t=sy.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(sy,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(xN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(sy.copy(e.center).add(xN)),this.expandByPoint(sy.copy(e.center).sub(xN))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},pce=0,Yl=new on,yN=new $i,Zg=new ie,pl=new ha,oy=new ha,Zs=new ie,Zn=class i extends ko{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:pce++}),this.uuid=Ou(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ule(e)?gA:mA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Sn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Yl.makeRotationFromQuaternion(e),this.applyMatrix4(Yl),this}rotateX(e){return Yl.makeRotationX(e),this.applyMatrix4(Yl),this}rotateY(e){return Yl.makeRotationY(e),this.applyMatrix4(Yl),this}rotateZ(e){return Yl.makeRotationZ(e),this.applyMatrix4(Yl),this}translate(e,t,n){return Yl.makeTranslation(e,t,n),this.applyMatrix4(Yl),this}scale(e,t,n){return Yl.makeScale(e,t,n),this.applyMatrix4(Yl),this}lookAt(e){return yN.lookAt(e),yN.updateMatrix(),this.applyMatrix4(yN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zg).negate(),this.translate(Zg.x,Zg.y,Zg.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new kn(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&je("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ha);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ie(-1/0,-1/0,-1/0),new ie(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];pl.setFromBufferAttribute(s),this.morphTargetsRelative?(Zs.addVectors(this.boundingBox.min,pl.min),this.boundingBox.expandByPoint(Zs),Zs.addVectors(this.boundingBox.max,pl.max),this.boundingBox.expandByPoint(Zs)):(this.boundingBox.expandByPoint(pl.min),this.boundingBox.expandByPoint(pl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new qa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ie,1/0);return}if(e){let n=this.boundingSphere.center;if(pl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];oy.setFromBufferAttribute(a),this.morphTargetsRelative?(Zs.addVectors(pl.min,oy.min),pl.expandByPoint(Zs),Zs.addVectors(pl.max,oy.max),pl.expandByPoint(Zs)):(pl.expandByPoint(oy.min),pl.expandByPoint(oy.max))}pl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Zs.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Zs));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Zs.fromBufferAttribute(a,c),l&&(Zg.fromBufferAttribute(e,c),Zs.add(Zg)),r=Math.max(r,n.distanceToSquared(Zs))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Ni(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let N=0;N<n.count;N++)a[N]=new ie,l[N]=new ie;let c=new ie,u=new ie,f=new ie,p=new Oe,x=new Oe,v=new Oe,w=new ie,S=new ie;function T(N,B,z){c.fromBufferAttribute(n,N),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,z),p.fromBufferAttribute(s,N),x.fromBufferAttribute(s,B),v.fromBufferAttribute(s,z),u.sub(c),f.sub(c),x.sub(p),v.sub(p);let V=1/(x.x*v.y-v.x*x.y);isFinite(V)&&(w.copy(u).multiplyScalar(v.y).addScaledVector(f,-x.y).multiplyScalar(V),S.copy(f).multiplyScalar(x.x).addScaledVector(u,-v.x).multiplyScalar(V),a[N].add(w),a[B].add(w),a[z].add(w),l[N].add(S),l[B].add(S),l[z].add(S))}let P=this.groups;P.length===0&&(P=[{start:0,count:e.count}]);for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let K=V,J=V+H;K<J;K+=3)T(e.getX(K+0),e.getX(K+1),e.getX(K+2))}let R=new ie,C=new ie,L=new ie,D=new ie;function F(N){L.fromBufferAttribute(r,N),D.copy(L);let B=a[N];R.copy(B),R.sub(L.multiplyScalar(L.dot(B))).normalize(),C.crossVectors(D,B);let V=C.dot(l[N])<0?-1:1;o.setXYZW(N,R.x,R.y,R.z,V)}for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let K=V,J=V+H;K<J;K+=3)F(e.getX(K+0)),F(e.getX(K+1)),F(e.getX(K+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Ni(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,x=n.count;p<x;p++)n.setXYZ(p,0,0,0);let r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie,u=new ie,f=new ie;if(e)for(let p=0,x=e.count;p<x;p+=3){let v=e.getX(p+0),w=e.getX(p+1),S=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,v),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(v,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let p=0,x=t.count;p<x;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(p+0,u.x,u.y,u.z),n.setXYZ(p+1,u.x,u.y,u.z),n.setXYZ(p+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Zs.fromBufferAttribute(e,t),Zs.normalize(),e.setXYZ(t,Zs.x,Zs.y,Zs.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,p=new c.constructor(l.length*u),x=0,v=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?x=l[w]*a.data.stride+a.offset:x=l[w]*u;for(let T=0;T<u;T++)p[v++]=c[x++]}return new Ni(p,u,f)}if(this.index===null)return je("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let p=c[u],x=e(p,n);l.push(x)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f<p;f++){let x=c[f];u.push(x.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let p=0,x=f.length;p<x;p++)u.push(f[p].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Mf=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Vd,this.updateRanges=[],this.version=0,this.uuid=Ou()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ou()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ou()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},sa=new ie,mo=class i{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)sa.fromBufferAttribute(this,t),sa.applyMatrix4(e),this.setXYZ(t,sa.x,sa.y,sa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)sa.fromBufferAttribute(this,t),sa.applyNormalMatrix(e),this.setXYZ(t,sa.x,sa.y,sa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)sa.fromBufferAttribute(this,t),sa.transformDirection(e),this.setXYZ(t,sa.x,sa.y,sa.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=aa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=qn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=aa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=aa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=aa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=aa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){pA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Ni(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){pA("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Ace=0,bs=class extends ko{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ace++}),this.uuid=Ou(),this.name="",this.type="Material",this.blending=rs,this.side=Ao,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ud,this.blendDst=kd,this.blendEquation=Bs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=Bu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=gy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yf,this.stencilZFail=yf,this.stencilZPass=yf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){je(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==rs&&(n.blending=this.blending),this.side!==Ao&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Ud&&(n.blendSrc=this.blendSrc),this.blendDst!==kd&&(n.blendDst=this.blendDst),this.blendEquation!==Bs&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Bu&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==gy&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==yf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==yf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ut().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Wd=class extends bs{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Qg,ay=new ie,Jg=new ie,e_=new ie,t_=new Oe,ly=new Oe,jH=new on,zS=new ie,cy=new ie,VS=new ie,cH=new Oe,vN=new Oe,uH=new Oe,_y=class extends $i{constructor(e=new Wd){if(super(),this.isSprite=!0,this.type="Sprite",Qg===void 0){Qg=new Zn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);Qg.setIndex([0,1,2,0,2,3]),Qg.setAttribute("position",new mo(n,3,0,!1)),Qg.setAttribute("uv",new mo(n,2,3,!1))}this.geometry=Qg,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jg.setFromMatrixScale(this.matrixWorld),jH.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),e_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jg.multiplyScalar(-e_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;qS(zS.set(-.5,-.5,0),e_,o,Jg,r,s),qS(cy.set(.5,-.5,0),e_,o,Jg,r,s),qS(VS.set(.5,.5,0),e_,o,Jg,r,s),cH.set(0,0),vN.set(1,0),uH.set(1,1);let a=e.ray.intersectTriangle(zS,cy,VS,!1,ay);if(a===null&&(qS(cy.set(-.5,.5,0),e_,o,Jg,r,s),vN.set(0,1),a=e.ray.intersectTriangle(zS,VS,cy,!1,ay),a===null))return;let l=e.ray.origin.distanceTo(ay);l<e.near||l>e.far||t.push({distance:l,point:ay.clone(),uv:vf.getInterpolation(ay,zS,cy,VS,cH,vN,uH,new Oe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function qS(i,e,t,n,r,s){t_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(ly.x=s*t_.x-r*t_.y,ly.y=r*t_.x+s*t_.y):ly.copy(t_),i.copy(e),i.x+=ly.x,i.y+=ly.y,i.applyMatrix4(jH)}var xf=new ie,bN=new ie,HS=new ie,Fd=new ie,wN=new ie,WS=new ie,SN=new ie,Cf=class{constructor(e=new ie,t=new ie(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,xf)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=xf.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xf.copy(this.origin).addScaledVector(this.direction,t),xf.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){bN.copy(e).add(t).multiplyScalar(.5),HS.copy(t).sub(e).normalize(),Fd.copy(this.origin).sub(bN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(HS),a=Fd.dot(this.direction),l=-Fd.dot(HS),c=Fd.lengthSq(),u=Math.abs(1-o*o),f,p,x,v;if(u>0)if(f=o*l-a,p=o*a-l,v=s*u,f>=0)if(p>=-v)if(p<=v){let w=1/u;f*=w,p*=w,x=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p<=-v?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c):p<=v?(f=0,p=Math.min(Math.max(-s,-l),s),x=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(bN).addScaledVector(HS,p),x}intersectSphere(e,t){xf.subVectors(e.center,this.origin);let n=xf.dot(this.direction),r=xf.dot(xf)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,xf)!==null}intersectTriangle(e,t,n,r,s){wN.subVectors(t,e),WS.subVectors(n,e),SN.crossVectors(wN,WS);let o=this.direction.dot(SN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Fd.subVectors(this.origin,e);let l=a*this.direction.dot(WS.crossVectors(Fd,WS));if(l<0)return null;let c=a*this.direction.dot(wN.cross(Fd));if(c<0||l+c>o)return null;let u=-a*Fd.dot(SN);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Us=class extends bs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ua,this.combine=RA,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},hH=new on,sA=new Cf,jS=new qa,fH=new ie,XS=new ie,$S=new ie,YS=new ie,TN=new ie,KS=new ie,dH=new ie,ZS=new ie,Hn=class extends $i{constructor(e=new Zn,t=new Us){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){KS.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(TN.fromBufferAttribute(f,e),o?KS.addScaledVector(TN,u):KS.addScaledVector(TN.sub(t),u))}t.add(KS)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),jS.copy(n.boundingSphere),jS.applyMatrix4(s),sA.copy(e.ray).recast(e.near),!(jS.containsPoint(sA.origin)===!1&&(sA.intersectSphere(jS,fH)===null||sA.origin.distanceToSquared(fH)>(e.far-e.near)**2))&&(hH.copy(s).invert(),sA.copy(e.ray).applyMatrix4(hH),!(n.boundingBox!==null&&sA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,sA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,p=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=a.getX(C),F=a.getX(C+1),N=a.getX(C+2);r=QS(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(a.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=a.getX(S),R=a.getX(S+1),C=a.getX(S+2);r=QS(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=C,F=C+1,N=C+2;r=QS(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(l.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=S,R=S+1,C=S+2;r=QS(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function mce(i,e,t,n,r,s,o,a){let l;if(e.side===ui?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===Ao,a),l===null)return null;ZS.copy(a),ZS.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(ZS);return c<t.near||c>t.far?null:{distance:c,point:ZS.clone(),object:i}}function QS(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,XS),i.getVertexPosition(l,$S),i.getVertexPosition(c,YS);let u=mce(i,e,t,n,XS,$S,YS,dH);if(u){let f=new ie;vf.getBarycoord(dH,XS,$S,YS,f),r&&(u.uv=vf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=vf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=vf.getInterpolatedAttribute(o,a,l,c,f,new ie),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let p={a,b:l,c,normal:new ie,materialIndex:0};vf.getNormal(XS,$S,YS,p.normal),u.face=p,u.barycoord=f}return u}var _A=class extends vs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=xi,u=xi,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Al=class extends Ni{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var EN=new ie,gce=new ie,_ce=new Sn,oa=class{constructor(e=new ie(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=EN.subVectors(n,t).cross(gce.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(EN),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||_ce.getNormalMatrix(e),r=this.coplanarPoint(EN).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},oA=new qa,xce=new Oe(.5,.5),JS=new ie,Kl=class{constructor(e=new oa,t=new oa,n=new oa,r=new oa,s=new oa,o=new oa){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=po,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],p=s[6],x=s[7],v=s[8],w=s[9],S=s[10],T=s[11],P=s[12],R=s[13],C=s[14],L=s[15];if(r[0].setComponents(c-o,x-u,T-v,L-P).normalize(),r[1].setComponents(c+o,x+u,T+v,L+P).normalize(),r[2].setComponents(c+a,x+f,T+w,L+R).normalize(),r[3].setComponents(c-a,x-f,T-w,L-R).normalize(),n)r[4].setComponents(l,p,S,C).normalize(),r[5].setComponents(c-l,x-p,T-S,L-C).normalize();else if(r[4].setComponents(c-l,x-p,T-S,L-C).normalize(),t===po)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===Va)r[5].setComponents(l,p,S,C).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),oA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),oA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(oA)}intersectsSprite(e){oA.center.set(0,0,0);let t=xce.distanceTo(e.center);return oA.radius=.7071067811865476+t,oA.applyMatrix4(e.matrixWorld),this.intersectsSphere(oA)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(JS.x=r.normal.x>0?e.max.x:e.min.x,JS.y=r.normal.y>0?e.max.y:e.min.y,JS.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(JS)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},pH=new on,xy=class i{constructor(){this.coordinateSystem=po,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){let s=t[r];pH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Kl),n[r].setFromProjectionMatrix(pH,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Kl),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var kc=class extends bs{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},AT=new ie,mT=new ie,AH=new on,uy=new Cf,eT=new qa,MN=new ie,mH=new ie,jd=class extends $i{constructor(e=new Zn,t=new kc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)AT.fromBufferAttribute(t,r-1),mT.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=AT.distanceTo(mT);e.setAttribute("lineDistance",new kn(n,1))}else je("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),eT.copy(n.boundingSphere),eT.applyMatrix4(r),eT.radius+=s,e.ray.intersectsSphere(eT)===!1)return;AH.copy(r).invert(),uy.copy(e.ray).applyMatrix4(AH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,p=n.attributes.position;if(u!==null){let x=Math.max(0,o.start),v=Math.min(u.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=u.getX(w),P=u.getX(w+1),R=tT(this,e,uy,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=tT(this,e,uy,l,w,S,v-1);T&&t.push(T)}}else{let x=Math.max(0,o.start),v=Math.min(p.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=tT(this,e,uy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=tT(this,e,uy,l,v-1,x,v-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function tT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(AT.fromBufferAttribute(a,r),mT.fromBufferAttribute(a,s),t.distanceSqToSegment(AT,mT,MN,mH)>n)return;MN.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(MN);if(!(c<e.near||c>e.far))return{distance:c,point:mH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var gH=new ie,_H=new ie,d_=class extends jd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)gH.fromBufferAttribute(t,r),_H.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+gH.distanceTo(_H);e.setAttribute("lineDistance",new kn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var Xd=class extends bs{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},xH=new on,BN=new Cf,nT=new qa,iT=new ie,yy=class extends $i{constructor(e=new Zn,t=new Xd){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),nT.copy(n.boundingSphere),nT.applyMatrix4(r),nT.radius+=s,e.ray.intersectsSphere(nT)===!1)return;xH.copy(r).invert(),BN.copy(e.ray).applyMatrix4(xH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let p=Math.max(0,o.start),x=Math.min(c.count,o.start+o.count);for(let v=p,w=x;v<w;v++){let S=c.getX(v);iT.fromBufferAttribute(f,S),yH(iT,S,l,r,e,t,this)}}else{let p=Math.max(0,o.start),x=Math.min(f.count,o.start+o.count);for(let v=p,w=x;v<w;v++)iT.fromBufferAttribute(f,v),yH(iT,v,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function yH(i,e,t,n,r,s,o){let a=BN.distanceSqToPoint(i);if(a<t){let l=new ie;BN.closestPointToPoint(i,l),l.applyMatrix4(n);let c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var xA=class extends vs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xi,this.minFilter=xi,this.generateMipmaps=!1,this.needsUpdate=!0}};var Uu=class extends vs{constructor(e=[],t=gl,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var ss=class extends vs{constructor(e,t,n=pi,r,s,o,a=xi,l=xi,c,u=xs,f=1){if(u!==xs&&u!==Qs)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let p={width:e,height:t,depth:f};super(p,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new u_(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},p_=class extends ss{constructor(e,t=pi,n=gl,r,s,o=xi,a=xi,l,c=xs){let u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},vy=class extends vs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Gc=class i extends Zn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],p=0,x=0;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,r,o,2),v("x","z","y",1,-1,e,n,-t,r,o,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new kn(c,3)),this.setAttribute("normal",new kn(u,3)),this.setAttribute("uv",new kn(f,2));function v(w,S,T,P,R,C,L,D,F,N,B){let z=C/F,V=L/N,H=C/2,K=L/2,J=D/2,j=F+1,Z=N+1,ee=0,ae=0,ce=new ie;for(let de=0;de<Z;de++){let ve=de*V-K;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*P,ce[S]=ve*R,ce[T]=J,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Ie/F),f.push(1-de/N),ee+=1}}for(let de=0;de<N;de++)for(let ve=0;ve<F;ve++){let Ie=p+ve+j*de,Qe=p+ve+j*(de+1),Ue=p+(ve+1)+j*(de+1),mt=p+(ve+1)+j*de;l.push(Ie,Qe,mt),l.push(Qe,Ue,mt),ae+=6}a.addGroup(x,ae,B),x+=ae,p+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var A_=class i extends Zn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new ie,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=t;f++,p+=3){let x=n+f/t*r;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[p]/e+1)/2,u.y=(o[p+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new kn(o,3)),this.setAttribute("normal",new kn(a,3)),this.setAttribute("uv",new kn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},yA=class i extends Zn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],p=[],x=[],v=0,w=[],S=n/2,T=0;P(),o===!1&&(e>0&&R(!0),t>0&&R(!1)),this.setIndex(u),this.setAttribute("position",new kn(f,3)),this.setAttribute("normal",new kn(p,3)),this.setAttribute("uv",new kn(x,2));function P(){let C=new ie,L=new ie,D=0,F=(t-e)/n;for(let N=0;N<=s;N++){let B=[],z=N/s,V=z*(t-e)+e;for(let H=0;H<=r;H++){let K=H/r,J=K*l+a,j=Math.sin(J),Z=Math.cos(J);L.x=V*j,L.y=-z*n+S,L.z=V*Z,f.push(L.x,L.y,L.z),C.set(j,F,Z).normalize(),p.push(C.x,C.y,C.z),x.push(K,1-z),B.push(v++)}w.push(B)}for(let N=0;N<r;N++)for(let B=0;B<s;B++){let z=w[B][N],V=w[B+1][N],H=w[B+1][N+1],K=w[B][N+1];(e>0||B!==0)&&(u.push(z,V,K),D+=3),(t>0||B!==s-1)&&(u.push(V,H,K),D+=3)}c.addGroup(T,D,0),T+=D}function R(C){let L=v,D=new Oe,F=new ie,N=0,B=C===!0?e:t,z=C===!0?1:-1;for(let H=1;H<=r;H++)f.push(0,S*z,0),p.push(0,z,0),x.push(.5,.5),v++;let V=v;for(let H=0;H<=r;H++){let J=H/r*l+a,j=Math.cos(J),Z=Math.sin(J);F.x=B*Z,F.y=S*z,F.z=B*j,f.push(F.x,F.y,F.z),p.push(0,z,0),D.x=j*.5+.5,D.y=Z*.5*z+.5,x.push(D.x,D.y),v++}for(let H=0;H<r;H++){let K=L+H,J=V+H;C===!0?u.push(J,J+1,K):u.push(J+1,J,K),N+=3}c.addGroup(T,N,C===!0?1:2),T+=N}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var fa=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){je("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],p=n[r+1]-u,x=(o-u)/p;return(r+x)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new ie);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new ie,r=[],s=[],o=[],a=new ie,l=new on;for(let x=0;x<=e;x++){let v=x/e;r[x]=this.getTangentAt(v,new ie)}s[0]=new ie,o[0]=new ie;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),p=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),p<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(r[x-1],r[x]),a.length()>Number.EPSILON){a.normalize();let v=Math.acos(Pn(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,v))}o[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(Pn(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],x*v)),o[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},m_=class extends fa{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,x=c-this.aY;l=p*u-x*f+this.aX,c=p*f+x*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},gT=class extends m_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function AL(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let p=(o-s)/c-(a-s)/(c+u)+(a-o)/u,x=(a-o)/u-(l-o)/(u+f)+(l-a)/f;p*=u,x*=u,r(o,a,p,x)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var vH=new ie,bH=new ie,CN=new AL,RN=new AL,PN=new AL,_T=class extends fa{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new ie){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(bH.subVectors(r[0],r[1]).add(r[0]),c=bH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(vH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=vH),this.curveType==="centripetal"||this.curveType==="chordal"){let x=this.curveType==="chordal"?.5:.25,v=Math.pow(c.distanceToSquared(f),x),w=Math.pow(f.distanceToSquared(p),x),S=Math.pow(p.distanceToSquared(u),x);w<1e-4&&(w=1),v<1e-4&&(v=w),S<1e-4&&(S=w),CN.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),RN.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),PN.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(CN.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),RN.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),PN.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(CN.calc(l),RN.calc(l),PN.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new ie().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function wH(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function yce(i,e){let t=1-i;return t*t*e}function vce(i,e){return 2*(1-i)*i*e}function bce(i,e){return i*i*e}function py(i,e,t,n){return yce(i,e)+vce(i,t)+bce(i,n)}function wce(i,e){let t=1-i;return t*t*t*e}function Sce(i,e){let t=1-i;return 3*t*t*i*e}function Tce(i,e){return 3*(1-i)*i*i*e}function Ece(i,e){return i*i*i*e}function Ay(i,e,t,n,r){return wce(i,e)+Sce(i,t)+Tce(i,n)+Ece(i,r)}var by=class extends fa{constructor(e=new Oe,t=new Oe,n=new Oe,r=new Oe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Ay(e,r.x,s.x,o.x,a.x),Ay(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},g_=class extends fa{constructor(e=new ie,t=new ie,n=new ie,r=new ie){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Ay(e,r.x,s.x,o.x,a.x),Ay(e,r.y,s.y,o.y,a.y),Ay(e,r.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},wy=class extends fa{constructor(e=new Oe,t=new Oe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Oe){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Oe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},xT=class extends fa{constructor(e=new ie,t=new ie){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ie){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ie){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Sy=class extends fa{constructor(e=new Oe,t=new Oe,n=new Oe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(py(e,r.x,s.x,o.x),py(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ty=class extends fa{constructor(e=new ie,t=new ie,n=new ie){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(py(e,r.x,s.x,o.x),py(e,r.y,s.y,o.y),py(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ey=class extends fa{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Oe){let n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return n.set(wH(a,l.x,c.x,u.x,f.x),wH(a,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new Oe().fromArray(r))}return this}},yT=Object.freeze({__proto__:null,ArcCurve:gT,CatmullRomCurve3:_T,CubicBezierCurve:by,CubicBezierCurve3:g_,EllipseCurve:m_,LineCurve:wy,LineCurve3:xT,QuadraticBezierCurve:Sy,QuadraticBezierCurve3:Ty,SplineCurve:Ey}),vT=class extends fa{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new yT[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=n){let o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(new yT[r.type]().fromJSON(r))}return this}},vA=class extends vT{constructor(e){super(),this.type="Path",this.currentPoint=new Oe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new wy(this.currentPoint.clone(),new Oe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let s=new Sy(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){let a=new by(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r),new Oe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new Ey(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new m_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},My=class extends vA{constructor(e){super(e),this.uuid=Ou(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(new vA().fromJSON(r))}return this}};function Mce(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=XH(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=Nce(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return Cy(s,o,t,a,l,c,0),o}function XH(i,e,t,n,r){let s;if(r===qce(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=SH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=SH(o/n|0,i[o],i[o+1],s);return s&&__(s,s.next)&&(Py(s),s=s.next),s}function bA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(__(t,t.next)||Pr(t.prev,t,t.next)===0)){if(Py(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Cy(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Bce(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?Rce(i,n,r,s):Cce(i)){e.push(l.i,i.i,c.i),Py(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=Pce(bA(i),e),Cy(i,e,t,n,r,s,2)):o===2&&Ice(i,e,t,n,r,s):Cy(bA(i),e,t,n,r,s,1);break}}}function Cce(i){let e=i.prev,t=i,n=i.next;if(Pr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&hy(r,a,s,l,o,c,v.x,v.y)&&Pr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Rce(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Pr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=UN(x,v,e,t,n),P=UN(w,S,e,t,n),R=i.prevZ,C=i.nextZ;for(;R&&R.z>=T&&C&&C.z<=P;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&hy(a,u,l,f,c,p,R.x,R.y)&&Pr(R.prev,R,R.next)>=0||(R=R.prevZ,C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&hy(a,u,l,f,c,p,C.x,C.y)&&Pr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&hy(a,u,l,f,c,p,R.x,R.y)&&Pr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&hy(a,u,l,f,c,p,C.x,C.y)&&Pr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Pce(i,e){let t=i;do{let n=t.prev,r=t.next.next;!__(n,r)&&YH(n,t,t.next,r)&&Ry(n,r)&&Ry(r,n)&&(e.push(n.i,t.i,r.i),Py(t),Py(t.next),t=i=r),t=t.next}while(t!==i);return bA(t)}function Ice(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Gce(o,a)){let l=KH(o,a);o=bA(o,o.next),l=bA(l,l.next),Cy(o,e,t,n,r,s,0),Cy(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Nce(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=XH(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(kce(c))}r.sort(Lce);for(let s=0;s<r.length;s++)t=Dce(r[s],t);return t}function Lce(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Dce(i,e){let t=Fce(i,e);if(!t)return e;let n=KH(t,i);return bA(n,n.next),bA(t,t.next)}function Fce(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(__(i,t))return t;do{if(__(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&$H(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){let f=Math.abs(r-t.y)/(n-t.x);Ry(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&Oce(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function Oce(i,e){return Pr(i.prev,i,e.prev)<0&&Pr(e.next,i,i.next)<0}function Bce(i,e,t,n){let r=i;do r.z===0&&(r.z=UN(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,Uce(r)}function Uce(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function UN(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function kce(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function $H(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function hy(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&$H(i,e,t,n,r,s,o,a)}function Gce(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!zce(i,e)&&(Ry(i,e)&&Ry(e,i)&&Vce(i,e)&&(Pr(i.prev,i,e.prev)||Pr(i,e.prev,e))||__(i,e)&&Pr(i.prev,i,i.next)>0&&Pr(e.prev,e,e.next)>0)}function Pr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function __(i,e){return i.x===e.x&&i.y===e.y}function YH(i,e,t,n){let r=sT(Pr(i,e,t)),s=sT(Pr(i,e,n)),o=sT(Pr(t,n,i)),a=sT(Pr(t,n,e));return!!(r!==s&&o!==a||r===0&&rT(i,t,e)||s===0&&rT(i,n,e)||o===0&&rT(t,i,n)||a===0&&rT(t,e,n))}function rT(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function sT(i){return i>0?1:i<0?-1:0}function zce(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&YH(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Ry(i,e){return Pr(i.prev,i,i.next)<0?Pr(i,e,i.next)>=0&&Pr(i,i.prev,e)>=0:Pr(i,e,i.prev)<0||Pr(i,i.next,e)<0}function Vce(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function KH(i,e){let t=kN(i.i,i.x,i.y),n=kN(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function SH(i,e,t,n){let r=kN(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Py(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function kN(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function qce(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}var GN=class{static triangulate(e,t,n=2){return Mce(e,t,n)}},Bd=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];TH(e),EH(n,e);let o=e.length;t.forEach(TH);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,EH(n,t[l]);let a=GN.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function TH(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function EH(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Iy=class i extends Zn{constructor(e=new My([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new kn(r,3)),this.setAttribute("uv",new kn(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:x-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,P=t.UVGenerator!==void 0?t.UVGenerator:Hce,R,C=!1,L,D,F,N;if(T){R=T.getSpacedPoints(u),C=!0,p=!1;let Xe=T.isCatmullRomCurve3?T.closed:!1;L=T.computeFrenetFrames(u,Xe),D=new ie,F=new ie,N=new ie}p||(S=0,x=0,v=0,w=0);let B=a.extractPoints(c),z=B.shape,V=B.holes;if(!Bd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];Bd.isClockWise(tt)&&(V[Xe]=tt.reverse())}}function K(Xe){let tt=10000000000000001e-36,vt=Xe[0];for(let yt=1;yt<=Xe.length;yt++){let ln=yt%Xe.length,Zt=Xe[ln],Qt=Zt.x-vt.x,xn=Zt.y-vt.y,ge=Qt*Qt+xn*xn,di=Math.max(Math.abs(Zt.x),Math.abs(Zt.y),Math.abs(vt.x),Math.abs(vt.y)),On=tt*di*di;if(ge<=On){Xe.splice(ln,1),yt--;continue}vt=Zt}}K(z),V.forEach(K);let J=V.length,j=z;for(let Xe=0;Xe<J;Xe++){let st=V[Xe];z=z.concat(st)}function Z(Xe,st,tt){return st||Ge("ExtrudeGeometry: vec does not exist"),Xe.clone().addScaledVector(st,tt)}let ee=z.length;function ae(Xe,st,tt){let vt,yt,ln,Zt=Xe.x-st.x,Qt=Xe.y-st.y,xn=tt.x-Xe.x,ge=tt.y-Xe.y,di=Zt*Zt+Qt*Qt,On=Zt*ge-Qt*xn;if(Math.abs(On)>Number.EPSILON){let le=Math.sqrt(di),X=Math.sqrt(xn*xn+ge*ge),Te=st.x-Qt/le,Pe=st.y+Zt/le,Ve=tt.x-ge/X,gt=tt.y+xn/X,St=((Ve-Te)*ge-(gt-Pe)*xn)/(Zt*ge-Qt*xn);vt=Te+Zt*St-Xe.x,yt=Pe+Qt*St-Xe.y;let qe=vt*vt+yt*yt;if(qe<=2)return new Oe(vt,yt);ln=Math.sqrt(qe/2)}else{let le=!1;Zt>Number.EPSILON?xn>Number.EPSILON&&(le=!0):Zt<-Number.EPSILON?xn<-Number.EPSILON&&(le=!0):Math.sign(Qt)===Math.sign(ge)&&(le=!0),le?(vt=-Qt,yt=Zt,ln=Math.sqrt(di)):(vt=Zt,yt=Qt,ln=Math.sqrt(di/2))}return new Oe(vt/ln,yt/ln)}let ce=[];for(let Xe=0,st=j.length,tt=st-1,vt=Xe+1;Xe<st;Xe++,tt++,vt++)tt===st&&(tt=0),vt===st&&(vt=0),ce[Xe]=ae(j[Xe],j[tt],j[vt]);let de=[],ve,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];ve=[];for(let vt=0,yt=tt.length,ln=yt-1,Zt=vt+1;vt<yt;vt++,ln++,Zt++)ln===yt&&(ln=0),Zt===yt&&(Zt=0),ve[vt]=ae(tt[vt],tt[ln],tt[Zt]);de.push(ve),Ie=Ie.concat(ve)}let Qe;if(S===0)Qe=Bd.triangulateShape(j,V);else{let Xe=[],st=[];for(let tt=0;tt<S;tt++){let vt=tt/S,yt=x*Math.cos(vt*Math.PI/2),ln=v*Math.sin(vt*Math.PI/2)+w;for(let Zt=0,Qt=j.length;Zt<Qt;Zt++){let xn=Z(j[Zt],ce[Zt],ln);Et(xn.x,xn.y,-yt),vt===0&&Xe.push(xn)}for(let Zt=0,Qt=J;Zt<Qt;Zt++){let xn=V[Zt];ve=de[Zt];let ge=[];for(let di=0,On=xn.length;di<On;di++){let le=Z(xn[di],ve[di],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=Bd.triangulateShape(Xe,st)}let Ue=Qe.length,mt=v+w;for(let Xe=0;Xe<ee;Xe++){let st=p?Z(z[Xe],Ie[Xe],mt):z[Xe];C?(F.copy(L.normals[0]).multiplyScalar(st.x),D.copy(L.binormals[0]).multiplyScalar(st.y),N.copy(R[0]).add(F).add(D),Et(N.x,N.y,N.z)):Et(st.x,st.y,0)}for(let Xe=1;Xe<=u;Xe++)for(let st=0;st<ee;st++){let tt=p?Z(z[st],Ie[st],mt):z[st];C?(F.copy(L.normals[Xe]).multiplyScalar(tt.x),D.copy(L.binormals[Xe]).multiplyScalar(tt.y),N.copy(R[Xe]).add(F).add(D),Et(N.x,N.y,N.z)):Et(tt.x,tt.y,f/u*Xe)}for(let Xe=S-1;Xe>=0;Xe--){let st=Xe/S,tt=x*Math.cos(st*Math.PI/2),vt=v*Math.sin(st*Math.PI/2)+w;for(let yt=0,ln=j.length;yt<ln;yt++){let Zt=Z(j[yt],ce[yt],vt);Et(Zt.x,Zt.y,f+tt)}for(let yt=0,ln=V.length;yt<ln;yt++){let Zt=V[yt];ve=de[yt];for(let Qt=0,xn=Zt.length;Qt<xn;Qt++){let ge=Z(Zt[Qt],ve[Qt],vt);C?Et(ge.x,ge.y+R[u-1].y,R[u-1].x+tt):Et(ge.x,ge.y,f+tt)}}}Me(),ze();function Me(){let Xe=r.length/3;if(p){let st=0,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[2]+tt,yt[1]+tt,yt[0]+tt)}st=u+S*2,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[0]+tt,yt[1]+tt,yt[2]+tt)}}else{for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[2],tt[1],tt[0])}for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[0]+ee*u,tt[1]+ee*u,tt[2]+ee*u)}}n.addGroup(Xe,r.length/3-Xe,0)}function ze(){let Xe=r.length/3,st=0;$e(j,st),st+=j.length;for(let tt=0,vt=V.length;tt<vt;tt++){let yt=V[tt];$e(yt,st),st+=yt.length}n.addGroup(Xe,r.length/3-Xe,1)}function $e(Xe,st){let tt=Xe.length;for(;--tt>=0;){let vt=tt,yt=tt-1;yt<0&&(yt=Xe.length-1);for(let ln=0,Zt=u+S*2;ln<Zt;ln++){let Qt=ee*ln,xn=ee*(ln+1),ge=st+vt+Qt,di=st+yt+Qt,On=st+yt+xn,le=st+vt+xn;Ct(ge,di,On,le)}}}function Et(Xe,st,tt){l.push(Xe),l.push(st),l.push(tt)}function Tt(Xe,st,tt){un(Xe),un(st),un(tt);let vt=r.length/3,yt=P.generateTopUV(n,r,vt-3,vt-2,vt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Ct(Xe,st,tt,vt){un(Xe),un(st),un(vt),un(st),un(tt),un(vt);let yt=r.length/3,ln=P.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(ln[0]),Gt(ln[1]),Gt(ln[3]),Gt(ln[1]),Gt(ln[2]),Gt(ln[3])}function un(Xe){r.push(l[Xe*3+0]),r.push(l[Xe*3+1]),r.push(l[Xe*3+2])}function Gt(Xe){s.push(Xe.x),s.push(Xe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Wce(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new yT[r.type]().fromJSON(r)),new i(n,e.options)}},Hce={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],p=e[r*3],x=e[r*3+1],v=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(p,1-v),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(x,1-v),new Oe(S,1-T)]}};function Wce(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){let s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var wA=class i extends Zn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,p=t/l,x=[],v=[],w=[],S=[];for(let T=0;T<u;T++){let P=T*p-o;for(let R=0;R<c;R++){let C=R*f-s;v.push(C,-P,0),w.push(0,0,1),S.push(R/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let P=0;P<a;P++){let R=P+c*T,C=P+c*(T+1),L=P+1+c*(T+1),D=P+1+c*T;x.push(R,C,D),x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new kn(v,3)),this.setAttribute("normal",new kn(w,3)),this.setAttribute("uv",new kn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var da=class i extends Zn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new ie,p=new ie,x=[],v=[],w=[],S=[];for(let T=0;T<=n;T++){let P=[],R=T/n,C=o+R*a,L=e*Math.cos(C),D=Math.sqrt(e*e-L*L),F=0;T===0&&o===0?F=.5/t:T===n&&l===Math.PI&&(F=-.5/t);for(let N=0;N<=t;N++){let B=N/t,z=r+B*s;f.x=-D*Math.cos(z),f.y=L,f.z=D*Math.sin(z),v.push(f.x,f.y,f.z),p.copy(f).normalize(),w.push(p.x,p.y,p.z),S.push(B+F,1-R),P.push(c++)}u.push(P)}for(let T=0;T<n;T++)for(let P=0;P<t;P++){let R=u[T][P+1],C=u[T][P],L=u[T+1][P],D=u[T+1][P+1];(T!==0||o>0)&&x.push(R,C,D),(T!==n-1||l<Math.PI)&&x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new kn(v,3)),this.setAttribute("normal",new kn(w,3)),this.setAttribute("uv",new kn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Ny=class i extends Zn{constructor(e=new Ty(new ie(-1,-1,0),new ie(-1,1,0),new ie(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new ie,l=new ie,c=new Oe,u=new ie,f=[],p=[],x=[],v=[];w(),this.setIndex(v),this.setAttribute("position",new kn(f,3)),this.setAttribute("normal",new kn(p,3)),this.setAttribute("uv",new kn(x,2));function w(){for(let R=0;R<t;R++)S(R);S(s===!1?t:0),P(),T()}function S(R){u=e.getPointAt(R/t,u);let C=o.normals[R],L=o.binormals[R];for(let D=0;D<=r;D++){let F=D/r*Math.PI*2,N=Math.sin(F),B=-Math.cos(F);l.x=B*C.x+N*L.x,l.y=B*C.y+N*L.y,l.z=B*C.z+N*L.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let R=1;R<=t;R++)for(let C=1;C<=r;C++){let L=(r+1)*(R-1)+(C-1),D=(r+1)*R+(C-1),F=(r+1)*R+C,N=(r+1)*(R-1)+C;v.push(L,D,N),v.push(D,F,N)}}function P(){for(let R=0;R<=t;R++)for(let C=0;C<=r;C++)c.x=R/t,c.y=C/r,x.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new yT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},Ly=class extends Zn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new ie,s=new ie;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],p=f.start,x=f.count;for(let v=p,w=p+x;v<w;v+=3)for(let S=0;S<3;S++){let T=a.getX(v+S),P=a.getX(v+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,P),MH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,f=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,f),MH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new kn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function MH(i,e,t){let n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var Dy=class extends bs{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ut(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function GA(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(CH(r))r.isRenderTargetTexture?(je("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(CH(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function Vo(i){let e={};for(let t=0;t<i.length;t++){let n=GA(i[t]);for(let r in n)e[r]=n[r]}return e}function CH(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function jce(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function mL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var zA={clone:GA,merge:Vo},Xce=`void main() {1+(()=>{var gse=Object.create;var I4=Object.defineProperty;var _se=Object.getOwnPropertyDescriptor;var xse=Object.getOwnPropertyNames;var yse=Object.getPrototypeOf,vse=Object.prototype.hasOwnProperty;var bse=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},wse=(i,e)=>{for(var t in e)I4(i,t,{get:e[t],enumerable:!0})},Sse=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of xse(e))!vse.call(i,r)&&r!==t&&I4(i,r,{get:()=>e[r],enumerable:!(n=_se(e,r))||n.enumerable});return i};var Tse=(i,e,t)=>(t=i!=null?gse(yse(i)):{},Sse(e||!i||!i.__esModule?I4(t,"default",{value:i,enumerable:!0}):t,i));var g$=bse((uv,g6)=>{(function(i,e){typeof uv=="object"&&typeof g6=="object"?g6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof uv=="object"?uv.FrameTicker=e():i.FrameTicker=e()})(uv,function(){return(function(i){function e(n){if(t[n])return t[n].exports;var r=t[n]={exports:{},id:n,loaded:!1};return i[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var t={};return e.m=i,e.c=t,e.p="",e(0)})([function(i,e,t){"use strict";var n=t(1),r=(function(){function s(o,a,l){o===void 0&&(o=NaN),a===void 0&&(a=NaN),l===void 0&&(l=!1),this._minFPS=a,this._maxFPS=o,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,l||this.resume()}return s.prototype.updateOnce=function(o){o(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},s.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},s.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(s.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"timeScale",{get:function(){return this._timeScale},set:function(o){this._timeScale!==o&&(this._timeScale=o)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),s.prototype.animateOnce=function(){var o=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return o.onFrame()})},s.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},s.prototype.update=function(o,a){a===void 0&&(a=!0),this._currentTick++,this._currentTime+=o,this._tickDeltaTime=o,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),a&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.getTimer=function(){return Date.now()},s})();Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(i,e,t){(function(n,r){i.exports=r()})(this,function(){return(function(n){function r(o){if(s[o])return s[o].exports;var a=s[o]={exports:{},id:o,loaded:!1};return n[o].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var s={};return r.m=n,r.c=s,r.p="",r(0)})([function(n,r){"use strict";var s=(function(){function o(){this.functions=[]}return o.prototype.add=function(a){return this.functions.indexOf(a)===-1&&(this.functions.push(a),!0)},o.prototype.remove=function(a){var l=this.functions.indexOf(a);return l>-1&&(this.functions.splice(l,1),!0)},o.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},o.prototype.dispatch=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c=this.functions.concat();c.forEach(function(u){u.apply(void 0,a)})},Object.defineProperty(o.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),o})();Object.defineProperty(r,"__esModule",{value:!0}),r.default=s}])})}])})});var L9=i=>new Promise(e=>setTimeout(e,i)),rs=i=>document.querySelector(i);async function Ese(){for(let i=0;i<300&&!(window.__atlasDebug&&!rs("#map-loading")?.checkVisibility?.());i+=1)await L9(100)}async function Mse(){let i="";for(let e=0;e<100;e+=1){await L9(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let t=window.__atlasDebug.snapshot(),n=JSON.stringify([t.zoom,t.center,t.resolution,t.tileStats]);if(n===i)return;i=n}}function ld(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Cse(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Rse(i){rs("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function C0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function N4(i,e){let t=rs(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function L4(i,e=!1){let t=rs("#parity-badge");t||(t=document.createElement("div"),t.id="parity-badge",t.style.cssText="position:fixed;top:8px;right:8px;z-index:9999;padding:6px 12px;font:700 13px monospace;border-radius:6px;color:#fff;pointer-events:none;",document.body.append(t)),t.style.background=e?"#b3261e":"#1a7f37",t.textContent=i}async function Pse(){let i=[],e=async p=>{await Mse(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await Ese(),localStorage.clear();let t=rs("#game-select"),n=t.options[0].value;C0(t,n),await e("initial"),N4("#pin-search","a"),await e("search-a");let r=rs(".search-result");r&&(r.click(),await e("search-select-first"),rs("#close-detail").click(),await e("detail-closed")),N4("#pin-search",""),await e("search-cleared");let s=rs(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=rs(".only-button");if(o){o.click(),await e("solo-first");let p=rs("#solo-chip");p&&!p.hidden&&p.click(),await e("solo-cleared")}let a=rs("#legend .layer-title");a&&(a.click(),await e("section-folded"),rs("#expand-all").click(),await e("sections-unfolded")),rs("#hide-all").click(),await e("all-hidden"),rs("#show-all").click(),await e("all-shown");let l=rs(".zone-index-item");l&&(l.click(),await e("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-unhighlighted")),ld("g"),await e("grid-open"),N4("#grid-input","m"),await e("grid-descended"),ld(" "),await e("subgrid-hidden"),ld(" "),ld("Escape"),await e("grid-ascended"),ld("Escape"),await e("grid-closed"),ld("z"),await e("labels-on"),Cse("z"),await e("labels-off"),ld("b",{metaKey:!0}),await e("sidebar-collapsed"),ld("b",{metaKey:!0}),await e("sidebar-restored"),rs("#zoom-in").click(),await e("zoomed-in");let c=rs("#overview-dock");c&&!rs("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),rs("#zoom-out").click(),await e("zoomed-out"),Rse("Escape"),await e("viewport-escape");let u=rs("#variant-select");u.options.length>1&&(C0(u,u.options[1].value),await e("variant-second"),C0(u,u.options[0].value),await e("variant-first"));let f=rs("#map-select");return f.options.length>1&&(C0(f,f.options[1].value),await e("map-second"),C0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(C0(t,t.options[1].value),await e("game-second"),C0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var D4=!1;async function D9(){if(!D4){D4=!0,L4("parity tour running\u2026");try{let i=await Pse(),e=await fetch("/parity/result",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i,null,2)}),t=(await e.text()).trim();if(!e.ok)throw new Error(`saving failed: ${e.status} ${t}`);L4(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){L4(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{D4=!1}}}window.__atlasTour=D9;window.addEventListener("keydown",i=>{i.key==="F9"&&D9()});var nn=i=>document.querySelector(i),we={game:nn("#game-select"),map:nn("#map-select"),variant:nn("#variant-select"),variantField:nn("#variant-field"),legend:nn("#legend"),search:nn("#pin-search"),searchResults:nn("#dock-results"),dock:nn("#dock"),dockCount:nn("#dock-count"),dockFlag:nn("#dock-flag"),dockFold:nn("#dock-fold"),dockRailName:nn("#dock-rail-name"),visibleCount:nn("#visible-count"),viewport:nn("#map"),globe:nn("#globe"),globeToggle:nn("#globe-toggle"),layers:nn("#layers"),zoneToggle:nn("#zone-toggle"),zoneCount:nn("#zone-count"),zoneIndex:nn("#zone-index"),zoneList:nn("#zone-list"),loading:nn("#map-loading"),labelsHint:nn("#labels-hint"),gridHint:nn("#grid-hint"),soloChip:nn("#solo-chip"),overview:nn("#overview"),overviewShelf:nn("#overview-shelf"),overviewDock:nn("#overview-dock"),overviewCanvas:nn("#overview-canvas"),overviewViewport:nn("#overview-viewport"),gridNavigator:nn("#grid-navigator"),gridInput:nn("#grid-input"),gridBack:nn("#grid-back"),subgridToggle:nn("#subgrid-toggle"),detail:nn("#pin-detail"),detailTitle:nn("#detail-title"),detailCategory:nn("#detail-category"),detailDescription:nn("#detail-description"),detailID:nn("#detail-id"),detailCoordinates:nn("#detail-coordinates"),detailCell:nn("#detail-cell"),detailCellField:nn("#detail-cell-field"),detailSource:nn("#detail-source"),detailSourceField:nn("#detail-source-field"),detailLinks:nn("#detail-links"),detailDot:nn("#detail-dot"),sidebar:nn("#sidebar"),mobileLegend:nn("#mobile-legend"),fatal:nn("#fatal-error"),fatalMessage:nn("#fatal-message"),emptyState:nn("#empty-state"),emptyPath:nn("#empty-path"),emptyOpen:nn("#empty-open"),addBundles:nn("#add-bundles")};function R0(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var k={catalog:null,game:null,map:null,variant:null,engine:null,projection:null,layers:null,sources:null,hiddenCategories:new Set,collapsedSections:new Set,pins:[],pinByID:new Map,selectedPin:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,globeActive:!1,subgridVisible:!0,gridPrefix:"",zonesVisible:!0,zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,mapRun:0,textByMap:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Jm=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Gl="0123456789bcdefghjkmnpqrstuvwxyz";var F4="atlas.session";var F9={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"};var As={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function O4(i){let e=Er();for(let t=0,n=i.length;t<n;++t)N0(e,i[t]);return e}function Ise(i,e,t){let n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return ll(n,r,s,o,t)}function eg(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function Jb(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function cd(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function xc(i,e){return cx(i,e[0],e[1])}function pu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function cx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function Qb(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=As.UNKNOWN;return o<t?l=l|As.LEFT:o>r&&(l=l|As.RIGHT),a<n?l=l|As.BELOW:a>s&&(l=l|As.ABOVE),l===As.UNKNOWN&&(l=As.INTERSECTING),l}function Er(){return[1/0,1/0,-1/0,-1/0]}function ll(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function P0(i){return ll(1/0,1/0,-1/0,-1/0,i)}function ew(i,e){let t=i[0],n=i[1];return ll(t,n,t,n,e)}function tg(i,e,t,n,r){let s=P0(r);return B4(s,i,e,t,n)}function I0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function tw(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function N0(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function B4(i,e,t,n,r){for(;t<n;t+=r)Nse(i,e[t],e[t+1]);return i}function Nse(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function nw(i,e){let t;return t=e(ng(i)),t||(t=e(ig(i)),t)||(t=e(rg(i)),t)||(t=e(zl(i)),t)?t:!1}function ux(i){let e=0;return mu(i)||(e=Wn(i)*gr(i)),e}function ng(i){return[i[0],i[1]]}function ig(i){return[i[2],i[1]]}function Ba(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function O9(i,e){let t;if(e==="bottom-left")t=ng(i);else if(e==="bottom-right")t=ig(i);else if(e==="top-left")t=zl(i);else if(e==="top-right")t=rg(i);else throw new Error("Invalid corner");return t}function hx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=U4(i,e,t,n);return ll(Math.min(s,a,c,f),Math.min(o,l,u,p),Math.max(s,a,c,f),Math.max(o,l,u,p),r)}function U4(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,p=i[0],x=i[1];return[p-l+f,x-c-u,p-l-f,x-c+u,p+l-f,x+c+u,p+l+f,x+c-u,p-l+f,x-c-u]}function gr(i){return i[3]-i[1]}function Au(i,e,t){let n=t||Er();return _r(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):P0(n),n}function k4(i,e){if(!_r(i,e))return[i.slice()];if(pu(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function zl(i){return[i[0],i[3]]}function rg(i){return[i[2],i[3]]}function Wn(i){return i[2]-i[0]}function _r(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function mu(i){return i[2]<i[0]||i[3]<i[1]}function B9(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function U9(i,e,t){let n=!1,r=Qb(i,e),s=Qb(i,t);if(r===As.INTERSECTING||s===As.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],p=t[0],x=t[1],v=(x-f)/(p-u),w,S;s&As.ABOVE&&!(r&As.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&As.RIGHT&&!(r&As.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&As.BELOW&&!(r&As.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&As.LEFT&&!(r&As.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function k9(i,e,t,n){if(mu(i))return P0(t);let r=[];if(n>1){let a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return Ise(s,o,t)}function G4(i,e){let t=e.getExtent(),n=Ba(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Wn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function iw(i,e,t){if(e.canWrapX()){let n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];G4(i,e);let r=Wn(n);if(Wn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function G9(i,e){let t=[i];for(let n=0,r=e.length;n<r&&t.length>0;++n){let s=[];for(let o=0,a=t.length;o<a;++o)s.push(...k4(t[o],e[n]));t=s}return t}var z9={info:1,warn:2,error:3,none:4},Lse=z9.info;function rw(...i){Lse>z9.warn||console.warn(...i)}function _i(i,e,t){return Math.min(Math.max(i,e),t)}function V9(i,e,t,n,r,s){let o=r-t,a=s-n;if(o!==0||a!==0){let l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return yc(i,e,t,n)}function yc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function q9(i){let e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){let l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;let o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){let l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}let t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function sw(i){return i*180/Math.PI}function vc(i){return i*Math.PI/180}function gu(i,e){let t=i%e;return t*e<0?t+e:t}function Po(i,e,t){return i+t*(e-i)}function L0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function fx(i,e){return Math.floor(L0(i,e))}function dx(i,e){return Math.ceil(L0(i,e))}function ow(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function H9(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function D0(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function sg(i,e){let t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function W9(i,e){return i[0]*=e,i[1]*=e,i}function aw(i,e){if(e.canWrapX()){let t=Wn(e.getExtent()),n=j9(i,e,t);n&&(i[0]-=n*t)}return i}function j9(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Wn(n),r=Math.floor((i[0]-n[0])/t)),r}function X9(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(_i(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var $h={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var z4=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||$h[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},ud=z4;var px=6378137,og=Math.PI*px,Dse=[-og,-og,og,og],Fse=[-180,-85,180,85],lw=px*Math.log(Math.tan(Math.PI/2)),hd=class extends ud{constructor(e){super({code:e,units:"m",extent:Dse,global:!0,worldExtent:Fse,getPointResolution:function(t,n){return t/Math.cosh(n[1]/px)}})}},V4=[new hd("EPSG:3857"),new hd("EPSG:102100"),new hd("EPSG:102113"),new hd("EPSG:900913"),new hd("http://www.opengis.net/def/crs/EPSG/0/3857"),new hd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function $9(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=og*i[s]/180;let o=px*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>lw?o=lw:o<-lw&&(o=-lw),e[s+1]=o}return e}function Y9(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/og,e[s+1]=360*Math.atan(Math.exp(i[s+1]/px))/Math.PI-90;return e}var Ose=6378137,Z9=[-180,-90,180,90],Bse=Math.PI*Ose/180,Yh=class extends ud{constructor(e,t){super({code:e,units:"degrees",extent:Z9,axisOrientation:t,global:!0,metersPerUnit:Bse,worldExtent:Z9})}},q4=[new Yh("CRS:84"),new Yh("EPSG:4326","neu"),new Yh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Yh("urn:ogc:def:crs:OGC:2:84"),new Yh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Yh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Yh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var H4={};function K9(i){return H4[i]||H4[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Q9(i,e){H4[i]=e}function _u(i){for(let e in i)delete i[e]}function bc(i){let e;for(e in i)return!1;return!e}var ag={};function lg(i,e,t){let n=i.getCode(),r=e.getCode();n in ag||(ag[n]={}),ag[n][r]=t}function cw(i,e){return i in ag&&e in ag[i]?ag[i][e]:null}var uw=.9996,Vl=.00669438,fw=Vl*Vl,dw=fw*Vl,F0=Vl/(1-Vl),J9=Math.sqrt(1-Vl),cg=(1-J9)/(1+J9),iG=cg*cg,W4=iG*cg,j4=W4*cg,rG=j4*cg,sG=1-Vl/4-3*fw/64-5*dw/256,Use=3*Vl/8+3*fw/32+45*dw/1024,kse=15*fw/256+45*dw/1024,Gse=35*dw/3072,zse=3/2*cg-27/32*W4+269/512*rG,Vse=21/16*iG-55/32*j4,qse=151/96*W4-417/128*rG,Hse=1097/512*j4,hw=6378137;function Wse(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/uw/(hw*sG),a=o+zse*Math.sin(2*o)+Vse*Math.sin(4*o)+qse*Math.sin(6*o)+Hse*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,p=f*f,x=p*p,v=1-Vl*c,w=Math.sqrt(1-Vl*c),S=hw/w,T=(1-Vl)/v,P=F0*u**2,R=P*P,C=n/(S*uw),L=C*C,D=L*C,F=D*C,N=F*C,B=N*C,z=a-f/T*(L/2-F/24*(5+3*p+10*P-4*R-9*F0))+B/720*(61+90*p+298*P+45*x-252*F0-3*R),V=(C-D/6*(1+2*p+P)+N/120*(5-2*P+28*p-3*R+8*F0+24*x))/u;return V=ow(V+vc(oG(t.number)),-Math.PI,Math.PI),[sw(V),sw(z)]}var eG=-80,tG=84,jse=-180,Xse=180;function $se(i,e,t){i=ow(i,jse,Xse),e<eG?e=eG:e>tG&&(e=tG);let n=vc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=vc(i),u=oG(t.number),f=vc(u),p=hw/Math.sqrt(1-Vl*r**2),x=F0*s**2,v=s*ow(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,P=T*v,R=P*v,C=hw*(sG*n-Use*Math.sin(2*n)+kse*Math.sin(4*n)-Gse*Math.sin(6*n)),L=uw*p*(v+S/6*(1-a+x)+P/120*(5-18*a+l+72*x-58*F0))+5e5,D=uw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+R/720*(61-58*a+l+600*x-330*F0)));return t.north||(D+=1e7),[L,D]}function oG(i){return(i-1)*6-180+3}var Yse=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function aG(i){let e=0;for(let r of Yse){let s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function nG(i,e){return function(t,n,r,s){let o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){let l=t[a],c=t[a+1],u=i(l,c,e);n[a]=u[0],n[a+1]=u[1]}return n}}function lG(i){return aG(i)?new ud({code:i,units:"m"}):null}function cG(i){let e=aG(i.getCode());return e?{forward:nG($se,e),inverse:nG(Wse,e)}:null}var Zse=63710088e-1;function X4(i,e,t){t=t||Zse;let n=vc(i[1]),r=vc(e[1]),s=(r-n)/2,o=vc(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var Kse=[cG],Qse=[lG];var Y4=!0;function hG(i){Y4=!(i===void 0?!0:i)}function K4(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function Z4(i){Q9(i.getCode(),i),lg(i,i,K4)}function Jse(i){i.forEach(Z4)}function ms(i){if(typeof i!="string")return i;let e=K9(i);if(e)return e;for(let t of Qse){let n=t(i);if(n)return n}return null}function Q4(i,e,t,n){i=ms(i);let r,s=i.getPointResolutionFunc();if(s){if(r=s(e,t),n&&n!==i.getUnits()){let o=i.getMetersPerUnit();o&&(r=r*o/$h[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=O0(i,ms("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);let u=X4(c.slice(0,2),c.slice(2,4)),f=X4(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?$h[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function uG(i){Jse(i),i.forEach(function(e){i.forEach(function(t){e!==t&&lg(e,t,K4)})})}function eoe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){lg(r,s,t),lg(s,r,n)})})}function pw(i,e){return i?typeof i=="string"?ms(i):i:ms(e)}function fG(i){return(function(e,t,n,r){let s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){let a=i(e.slice(o,o+n)),l=a.length;for(let c=0,u=r;c<u;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t})}function ug(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||O0(i,e)===K4)&&t}function O0(i,e){let t=i.getCode(),n=e.getCode(),r=cw(t,n);if(r)return r;let s=null,o=null;for(let l of Kse)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=$4(s.inverse,o.forward);else{let l=cw(t,a);l&&(r=$4(l,o.forward))}else{let l=cw(a,n);l&&(r=$4(s.inverse,l))}return r&&(Z4(i),Z4(e),lg(i,e,r)),r}function $4(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function B0(i,e){let t=ms(i),n=ms(e);return O0(t,n)}function hg(i,e,t){let n=B0(e,t);if(!n){let r=ms(e).getCode(),s=ms(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function dG(i,e,t,n){let r=B0(e,t);return k9(i,r,void 0,n)}var wc=null;function U0(){return wc}function Ax(i,e){return wc?hg(i,e,wc):i}function Sc(i,e){return wc?hg(i,wc,e):(Y4&&!D0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(Y4=!1,rw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function fd(i,e){return wc?dG(i,e,wc):i}function Tc(i,e){return wc?dG(i,wc,e):i}function pG(i,e){if(!wc)return i;let t=ms(e).getMetersPerUnit(),n=wc.getMetersPerUnit();return t&&n?i*t/n:i}function toe(){uG(V4),uG(q4),eoe(q4,V4,$9,Y9)}toe();function J4(i){return i[0]>0&&i[1]>0}function AG(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function Vr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var Aw=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function k0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new Aw(i,e,t,n)}var mw=Aw;function mG(i,e,t){let n,r;t=t||Ua;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function Ua(i,e){return i>e?1:i<e?-1:0}function gG(i,e){return i<e?1:i>e?-1:0}function fg(i,e,t){if(i[0]<=e)return 0;let n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){let s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function _G(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Ec(i,e){let t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function Io(i,e){let t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function xG(i,e,t){let n=e||Ua;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function zn(i,e){if(!i)throw new Error(e)}function yG(i,e,t,n,r){return!nw(r,function(o){return!dd(i,e,t,n,o[0],o[1])})}function dd(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){let c=i[e],u=i[e+1];l<=s?u>s&&(c-a)*(s-l)-(r-a)*(u-l)>0&&o++:u<=s&&(c-a)*(s-l)-(r-a)*(u-l)<0&&o--,a=c,l=u}return o!==0}function mx(i,e,t,n,r,s){if(t.length===0||!dd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(dd(i,t[o-1],t[o],n,r,s))return!1;return!0}function vG(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){let l=t[o];if(mx(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function bG(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function gw(i,e,t,n,r,s){return s=s??B4(Er(),i,e,t,n),_r(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:bG(i,e,t,n,function(o,a){return U9(r,o,a)}):!1}function eP(i,e,t,n,r){return!!(gw(i,e,t,n,r)||dd(i,e,t,n,r[0],r[1])||dd(i,e,t,n,r[0],r[3])||dd(i,e,t,n,r[2],r[1])||dd(i,e,t,n,r[2],r[3]))}function tP(i,e,t,n,r){if(!eP(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(yG(i,t[s-1],t[s],n,r)&&!gw(i,t[s-1],t[s],n,r))return!1;return!0}function wG(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(tP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function $n(){throw new Error("Unimplemented abstract method.")}var noe=0;function Nn(i){return i.ol_uid||(i.ol_uid=String(++noe))}function dg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function ioe(i,e,t){return i+"/"+e+"/"+t}function pg(i,e,t,n,r){return`${Nn(i)},${e},${ioe(t,n,r)}`}function SG(i){return roe(i[0],i[1],i[2])}function roe(i,e,t){return(e<<i)+t}function TG(i,e){let t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;let s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}var Ag=[0,0,0],pd=5,nP=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,zn(xG(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,zn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=zl(s)),zn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,zn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,zn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new mw(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=k0(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let s=e[1]*2,o=e[2]*2;return k0(s,s+1,o,o+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],s=e[1],o=e[2];if(t===r)return k0(s,o,s,o,n);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),u=Math.floor(o*l);if(t<r)return k0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return k0(c,f,u,p,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Ag);let r=Ag[1],s=Ag[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Ag);let o=Ag[1],a=Ag[2];return k0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Vr(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=Vr(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return ll(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){let o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),c=Vr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=dx(u,pd)-1,f=dx(f,pd)-1):(u=fx(u,pd),f=fx(f,pd)),dg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=Vr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=dx(c,pd)-1,u=dx(u,pd)-1):(c=fx(c,pd),u=fx(u,pd)),dg(n,c,u,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){let n=fg(this.resolutions_,e,t||0);return _i(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return eP(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}},gx=nP;function _w(i){let e=i.getDefaultTileGrid();return e||(e=ooe(i),i.setDefaultTileGrid(e)),e}function MG(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=xw(t);if(!xc(s,r)){let o=Wn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function soe(i,e,t,n){n=n!==void 0?n:"top-left";let r=RG(i,e,t);return new gx({extent:i,origin:O9(i,n),resolutions:r,tileSize:t})}function CG(i){let e=i||{},t=e.extent||ms("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:RG(t,e.maxZoom,e.tileSize,e.maxResolution)};return new gx(n)}function RG(i,e,t,n){e=e!==void 0?e:42,t=Vr(t!==void 0?t:256);let r=gr(i),s=Wn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function ooe(i,e,t,n){let r=xw(i);return soe(r,e,t,n)}function xw(i){i=ms(i);let e=i.getExtent();if(!e){let t=180*$h.degrees/i.getMetersPerUnit();e=ll(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Un(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function mg(i,e,t,n){return Un(i,e,t,n,!0)}function ii(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),_u(i))}var Jt={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var iP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ad=iP;function Zh(){return!0}function Kh(){return!1}function Qh(){}function yw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Io(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function PG(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}var rP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Xs=rP;var sP=class extends Ad{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let s=t?new Xs(e):e;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let c=0,u=r.length;c<u;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,Qh);delete o[n]}return l}disposeInternal(){this.listeners_&&_u(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=Qh,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},md=sP;var G0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",aoe=G0.includes("safari")&&!G0.includes("chrom"),EIe=aoe&&(G0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(G0)),IG=G0.includes("webkit")&&!G0.includes("edge"),oP=G0.includes("macintosh"),NG=typeof devicePixelRatio<"u"?devicePixelRatio:1,Ls=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,aP=typeof Image<"u"&&Image.prototype.decode;var vw=(function(){let i=!1;try{let e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})();function LG(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[mg(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&aP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(mg(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ii)}}function loe(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s),e&&(i.src=e)})}function DG(i,e){return e&&(i.src=e),i.src&&aP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):loe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function lP(i){return Math.pow(i,3)}function ql(i){return 1-lP(1-i)}function FG(i){return 3*i*i-2*i*i*i}function OG(i){return i}var cP=class extends md{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(Jt.CHANGE)}release(){this.setState(rn.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==rn.EMPTY){if(this.state!==rn.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){$n()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:lP(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},gg=cP;function Si(i,e,t,n){let r;return t&&t.length?r=t.shift():Ls?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}var uP;function _x(){return uP||(uP=Si(1,1)),uP}function z0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function hP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function BG(i){for(;i.lastChild;)i.lastChild.remove()}function UG(i,e){let t=i.childNodes;for(let n=0;;++n){let r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function bw(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function cl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var fP=class extends gg{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,Ls?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=rn.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=rn.ERROR,this.unlistenImage_(),this.image_=coe(),this.changed()}handleImageLoad_(){if(Ls)this.state=rn.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=rn.LOADED:this.state=rn.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==rn.ERROR&&(this.state=rn.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==rn.IDLE&&(this.state=rn.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=LG(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function coe(){let i=Si(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var ww=fP;var dP,V0=[];function kG(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function pP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function uoe(){if(dP===void 0){let i=Si(6,6,V0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",kG(i,4,5,4,0),kG(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;dP=pP(e,0)||pP(e,4)||pP(e,8),z0(i),V0.push(i.canvas)}return dP}function GG(i,e,t,n){let r=hg(t,e,i),s=Q4(e,n,t),o=e.getMetersPerUnit();o!==void 0&&(s*=o);let a=i.getMetersPerUnit();a!==void 0&&(s/=a);let l=i.getExtent();if(!l||xc(l,r)){let c=Q4(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function zG(i,e,t,n){let r=Ba(t),s=GG(i,e,r,n);return(!isFinite(s)||s<=0)&&nw(t,function(o){return s=GG(i,e,o,n),isFinite(s)&&s>0}),s}function VG(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Si(Math.round(t*i),Math.round(t*e),V0);if(f||(v.imageSmoothingEnabled=!1),l.length===0)return v.canvas;v.scale(t,t);function w(L){return Math.round(L*t)/t}v.globalCompositeOperation="lighter";let S=Er();l.forEach(function(L,D,F){tw(S,L.extent)});let T,P=t/n,R=(f?1:1+Math.pow(2,-24))/P;if(!p||l.length!==1||c!==0){if(T=Si(Math.round(Wn(S)*P),Math.round(gr(S)*P),V0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*P,D=-(r[3]-S[3])*P,F=Wn(r)*P,N=gr(r)*P;T.rect(L,D,F,N),T.clip()}l.forEach(function(L,D,F){if(L.image.width>0&&L.image.height>0){if(L.clipExtent){T.save();let H=(L.clipExtent[0]-S[0])*P,Z=-(L.clipExtent[3]-S[3])*P,J=Wn(L.clipExtent)*P,j=gr(L.clipExtent)*P;T.rect(f?H:Math.round(H),f?Z:Math.round(Z),f?J:Math.round(H+J)-Math.round(H),f?j:Math.round(Z+j)-Math.round(Z)),T.clip()}let N=(L.extent[0]-S[0])*P,B=-(L.extent[3]-S[3])*P,z=Wn(L.extent)*P,V=gr(L.extent)*P;T.drawImage(L.image,c,c,L.image.width-2*c,L.image.height-2*c,f?N:Math.round(N),f?B:Math.round(B),f?z:Math.round(N+z)-Math.round(N),f?V:Math.round(B+V)-Math.round(B)),L.clipExtent&&T.restore()}})}let C=zl(o);return a.getTriangles().forEach(function(L,D,F){let N=L.source,B=L.target,z=N[0][0],V=N[0][1],H=N[1][0],Z=N[1][1],J=N[2][0],j=N[2][1],K=w((B[0][0]-C[0])/s),ee=w(-(B[0][1]-C[1])/s),ae=w((B[1][0]-C[0])/s),ce=w(-(B[1][1]-C[1])/s),de=w((B[2][0]-C[0])/s),ve=w(-(B[2][1]-C[1])/s),Ie=z,Qe=V;z=0,V=0,H-=Ie,Z-=Qe,J-=Ie,j-=Qe;let Ue=[[H,Z,0,0,ae-K],[J,j,0,0,de-K],[0,0,H,Z,ce-ee],[0,0,J,j,ve-ee]],mt=q9(Ue);if(!mt)return;if(v.save(),v.beginPath(),uoe()||!f){v.moveTo(ae,ce);let ze=4,$e=K-ae,Et=ee-ce;for(let Tt=0;Tt<ze;Tt++)v.lineTo(ae+w((Tt+1)*$e/ze),ce+w(Tt*Et/(ze-1))),Tt!=ze-1&&v.lineTo(ae+w((Tt+1)*$e/ze),ce+w((Tt+1)*Et/(ze-1)));v.lineTo(de,ve)}else v.moveTo(ae,ce),v.lineTo(K,ee),v.lineTo(de,ve);v.clip(),v.transform(mt[0],mt[2],mt[1],mt[3],K,ee),v.translate(S[0]-Ie,S[3]-Qe);let Me;if(T)Me=T.canvas,v.scale(R,-R);else{let ze=l[0],$e=ze.extent;Me=ze.image,v.scale(Wn($e)/Me.width,-gr($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&(z0(T),V0.push(T.canvas)),u&&(v.save(),v.globalCompositeOperation="source-over",v.strokeStyle="black",v.lineWidth=1,a.getTriangles().forEach(function(L,D,F){let N=L.target,B=(N[0][0]-C[0])/s,z=-(N[0][1]-C[1])/s,V=(N[1][0]-C[0])/s,H=-(N[1][1]-C[1])/s,Z=(N[2][0]-C[0])/s,J=-(N[2][1]-C[1])/s;v.beginPath(),v.moveTo(V,H),v.lineTo(B,z),v.lineTo(Z,J),v.closePath(),v.stroke()}),v.restore()),v.canvas}var hoe=[1,0,0,1,0,0],n5e=new Array(6);function $s(){return hoe.slice(0)}function qG(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function Mr(i,e){let t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function lo(i,e,t,n,r,s,o,a){let l=Math.sin(s),c=Math.cos(s);return i[0]=n*c,i[1]=r*l,i[2]=-n*l,i[3]=r*c,i[4]=o*n*c-a*n*l+e,i[5]=o*r*l+a*r*c+t,i}function Tw(i,e){let t=foe(e);zn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function foe(i){return i[0]*i[3]-i[1]*i[2]}var doe=[1e5,1e5,1e5,1e5,2,2];function HG(i){return"matrix("+i.join(", ")+")"}function Sw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function WG(i,e){let t=Sw(i),n=Sw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*doe[r])!==0)return!1;return!0}var poe=10,jG=.25,AP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?fG(R=>Mr(a,hg(R,this.targetProj_,this.sourceProj_))):B0(this.targetProj_,this.sourceProj_);this.transformInv_=function(R){let C=R[0]+"/"+R[1];return l[C]||(l[C]=c(R)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Wn(r)>=Wn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Wn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Wn(this.targetProj_.getExtent()):null;let u=zl(n),f=rg(n),p=ig(n),x=ng(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),P=poe+(o?Math.max(0,Math.ceil(Math.log2(ux(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,p,x,v,w,S,T,P),this.wrapsXInSource_){let R=1/0;this.triangles_.forEach(function(C,L,D){R=Math.min(R,C.source[0][0],C.source[1][0],C.source[2][0])}),this.triangles_.forEach(C=>{if(Math.max(C.source[0][0],C.source[1][0],C.source[2][0])-R>this.sourceWorldWidth_/2){let L=[[C.source[0][0],C.source[0][1]],[C.source[1][0],C.source[1][1]],[C.source[2][0],C.source[2][1]]];L[0][0]-R>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-R>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-R>this.sourceWorldWidth_/2&&(L[2][0]-=this.sourceWorldWidth_);let D=Math.min(L[0][0],L[1][0],L[2][0]);Math.max(L[0][0],L[1][0],L[2][0])-D<this.sourceWorldWidth_/2&&(C.source=L)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=O4([s,o,a,l]),f=this.sourceWorldWidth_?Wn(u)/this.sourceWorldWidth_:null,p=this.sourceWorldWidth_,x=this.sourceProj_.canWrapX()&&f>.5&&f<1,v=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=O4([e,t,n,r]);v=Wn(S)/this.targetWorldWidth_>jG||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>jG||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!_r(u,this.maxSourceExtent_))return;let w=0;if(!v&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)v=!0;else if(w=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!v){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),P;x?P=(gu(s[0],p)+gu(a[0],p))/2-gu(T[0],p):P=(s[0]+a[0])/2-T[0];let R=(s[1]+a[1])/2-T[1];v=P*P+R*R>this.errorThresholdSquared_}if(v){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),P=[(r[0]+e[0])/2,(r[1]+e[1])/2],R=this.transformInv_(P);this.addQuad_(e,t,S,P,s,o,T,R,c-1),this.addQuad_(P,S,n,r,R,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),P=[(n[0]+r[0])/2,(n[1]+r[1])/2],R=this.transformInv_(P);this.addQuad_(e,S,P,r,s,T,R,l,c-1),this.addQuad_(S,t,n,P,T,o,a,R,c-1)}return}}if(x){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=Er();return this.triangles_.forEach(function(t,n,r){let s=t.source;N0(e,s[0]),N0(e,s[1]),N0(e,s[2])}),e}getTriangles(){return this.triangles_}},XG=AP;var mP=class extends gg{constructor(e,t,n,r,s,o,a,l,c,u,f,p){super(s,rn.IDLE,p),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let x=r.getTileCoordExtent(this.wrappedTileCoord_),v=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=v?Au(x,v):x;if(ux(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=Au(w,T):w=T);let P=r.getResolution(this.wrappedTileCoord_[0]),R=zG(e,n,S,P);if(!isFinite(R)||R<=0){this.state=rn.EMPTY;return}let C=u!==void 0?u:.5;if(this.triangulation_=new XG(e,n,S,w,R*C,P),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(R);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=_i(L[1],w[1],w[3]),L[3]=_i(L[3],w[1],w[3])):L=Au(L,w)),!ux(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=Wn(T),F=Math.floor((L[0]-T[0])/D)),iw(L.slice(),e,!0).forEach(B=>{let z=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let V=z.minX;V<=z.maxX;V++)for(let H=z.minY;H<=z.maxY;H++){let Z=F*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,V,H,a),offset:Z})}++F}),this.sourceTiles_.length===0&&(this.state=rn.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==rn.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=rn.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=VG(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=rn.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==rn.IDLE){this.state=rn.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==rn.IDLE||n==rn.LOADING){e++;let r=Un(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ii(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==rn.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(ii),this.sourcesListenerKeys_=null}release(){this.canvas_&&(z0(this.canvas_.getContext("2d")),V0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Ew=mP;var Aoe=/\{z\}/g,moe=/\{x\}/g,goe=/\{y\}/g,_oe=/\{-y\}/g;function $G(i,e,t,n,r){return i.replace(Aoe,e.toString()).replace(moe,t.toString()).replace(goe,n.toString()).replace(_oe,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function YG(i){let e=[],t=/\{([a-z])-([a-z])\}/.exec(i);if(t){let n=t[1].charCodeAt(0),r=t[2].charCodeAt(0),s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){let n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function xoe(i,e){return(function(t,n,r){if(!t)return;let s,o=t[0];if(e){let a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return $G(i,o,t[1],t[2],s)})}function ZG(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=xoe(i[r],e);return yoe(n)}function yoe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=SG(e),s=gu(r,i.length);return i[s](e,t,n)})}var Mc={PROPERTYCHANGE:"propertychange"};var _g=class extends md{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Jt.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Un(this,e[s],t);return r}return Un(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=mg(this,e[s],t)}else n=mg(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)voe(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}};_g.prototype.on;_g.prototype.once;_g.prototype.un;function voe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ii(i[e]);else ii(i)}var Mw=_g;var Cw=class extends Xs{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},gP=class extends Mw{constructor(e){super(),this.on,this.once,this.un,Nn(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new Cw(n,e,t)),n=Mc.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Cw(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||(this.values_={});if(n)r[e]=t;else{let s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],bc(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},gs=gP;var _P=class extends gs{constructor(e){super(),this.projection=ms(e.projection),this.attributions_=KG(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e==="ready"?Promise.resolve():e==="error"?Promise.reject(new Error("Source failed to load")):new Promise((t,n)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),t()):s==="error"&&(this.un("change",r),n(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=KG(e),this.changed()}setState(e){this.state_=e,this.changed()}};function KG(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Rw=_P;var xP=class extends Rw{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;let t=[256,256];this.tileGrid&&Vr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Nn(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return $n()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:_w(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=Vr(r.getTileSize(e),this.tmpSize);return s==1?o:AG(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=MG(r,e,n)),TG(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Pw=class extends Xs{constructor(e,t){super(e),this.tile=t}},QG=xP;var Iw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var yP=class i extends QG{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Nn(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=Iw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?Iw.TILELOADERROR:r==rn.LOADED?Iw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Pw(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){let t=YG(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2+`);this.generateTileUrlFunction_?this.setTileUrlFunction(ZG(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},JG=yP;var vP=class extends JG{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:boe,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:ww,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!ug(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||ug(t,e)))return this.tileGrid;let n=Nn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=_w(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?rn.IDLE:rn.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(Jt.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||ug(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),p=this.getTileCoordForTileUrlFunction(l,s),x=new Ew(a,u,s,f,l,p,this.getTilePixelRatio(r),this.getGutter(),(v,w,S,T)=>this.getTileInternal(v,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return x.key=c,x}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=pg(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);let c=this.createTile_(e,t,n,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=ms(e);if(n){let r=Nn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function boe(i,e){if(Ls){let t=i.getCrossOrigin(),n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include");let s={mode:n,credentials:r,referrerPolicy:i.getReferrerPolicy()};fetch(e,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=i.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}var ez=vP;var bP=class extends ez{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:CG({extent:xw(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}},tz=bP;function Cc(){if(!k.map||!k.variant||k.settling)return;let i=k.engine?.getView();try{let e=nz();e.last=k.game.slug,e.games[k.game.slug]={game:k.game.slug,map:k.map.slug,variant:k.map.variants.indexOf(k.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...k.hiddenCategories],collapsed:[...k.collapsedSections],overviewDocked:k.overviewDocked,dockFolded:k.dockFolded,dockDismissed:k.dockDismissed},localStorage.setItem(F4,JSON.stringify(e))}catch{}}function nz(){try{let i=JSON.parse(localStorage.getItem(F4)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function xg(i){let e=nz(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function yg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function iz(){if(!k.game||!k.map)return;let i=`#${k.game.slug}/${k.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var wP=class i extends gs{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(ii(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=Un(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?woe(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function woe(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(zn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var gd=wP;function ka(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){let c=i[l],u=i[l+1];s[a++]=r[0]*c+r[2]*u+r[4],s[a++]=r[1]*c+r[3]*u+r[5];for(let f=2;f<o;f++)s[a++]=i[l+f]}return s&&s.length!=a&&(s.length=a),s}function Nw(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let p=e;p<t;p+=n){let x=i[p]-c,v=i[p+1]-u;o[f++]=c+x*a-v*l,o[f++]=u+x*l+v*a;for(let w=p+2;w<p+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function rz(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let p=i[f]-l,x=i[f+1]-c;a[u++]=l+r*p,a[u++]=c+s*x;for(let v=f+2;v<f+n;++v)a[u++]=i[v]}return a&&a.length!=u&&(a.length=u),a}function sz(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let c=l+2;c<l+n;++c)o[a++]=i[c]}return o&&o.length!=a&&(o.length=a),o}var oz=$s(),Soe=[NaN,NaN],SP=class extends gs{constructor(){super(),this.extent_=Er(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=yw((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return $n()}closestPointXY(e,t,n,r){return $n()}containsXY(e,t){return this.closestPointXY(e,t,Soe,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return $n()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&P0(t),this.extentRevision_=this.getRevision()}return B9(this.extent_,e)}rotate(e,t){$n()}scale(e,t,n){$n()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return $n()}getType(){return $n()}applyTransform(e){$n()}intersectsExtent(e){return $n()}translate(e,t){$n()}transform(e,t){let n=ms(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=gr(c)/gr(l);lo(oz,c[0],c[3],u,-u,0,0,0);let f=ka(s,0,s.length,a,oz,o),p=B0(n,t);return p?p(f,f,a):f}:B0(n,t);return this.applyTransform(r),this}},az=SP;var TP=class extends az{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return tg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return $n()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=lz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){$n()}setLayout(e,t,n){let r;if(e)r=lz(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=Toe(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Nw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=Ba(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();rz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();sz(n,0,n.length,r,e,t,n),this.changed()}}};function Toe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function lz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function cz(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return ka(n,0,n.length,r,e,t)}var xu=TP;function uz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function xx(i,e,t,n){for(let r=0,s=t.length;r<s;++r){let o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function EP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=xx(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function hz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=EP(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}var MP=class i extends xu{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=yc(e,t,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return ew(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return cx(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uz(this.flatCoordinates,0,e,this.stride),this.changed()}},Jh=MP;function CP(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1],a=0,l=0;for(;e<t;e+=n){let c=i[e]-s,u=i[e+1]-o;r+=l*c-a*u,a=c,l=u}return r/2}function RP(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=CP(i,e,a,n),e=a}return r}function fz(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=RP(i,e,a,n),e=a[a.length-1]}return r}function dz(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let p=((r-a)*c+(s-l)*u)/(c*c+u*u);if(p>1)f=t;else if(p>0){for(let x=0;x<n;++x)o[x]=Po(i[e+x],i[t+x],p);o.length=n;return}else f=e}for(let p=0;p<n;++p)o[p]=i[f+p];o.length=n}function PP(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=yc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function IP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=PP(i,e,a,n,r),e=a}return r}function pz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=IP(i,e,a,n,r),e=a[a.length-1]}return r}function NP(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=yc(o,a,i[e],i[e+1]),p<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,p}return c}u=u||[NaN,NaN];let x=e+n;for(;x<t;)if(dz(i,x-n,x,n,o,a,u),p=yc(o,a,u[0],u[1]),p<c){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n,x+=n}else x+=n*Math.max((Math.sqrt(p)-Math.sqrt(c))/r|0,1);if(s&&(dz(i,t-n,e,n,o,a,u),p=yc(o,a,u[0],u[1]),p<c)){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function LP(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=NP(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function Az(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=LP(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function yu(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function vg(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=yu(i,e,l,n,r[s]),e=l}return r.length=s,r}function yx(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=l.length===1&&l[0]===e?[]:vg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function vx(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),p=c.pop(),x=0,v=i[p],w=i[p+1],S=i[f],T=i[f+1];for(let P=p+n;P<f;P+=n){let R=i[P],C=i[P+1],L=V9(R,C,v,w,S,T);L>x&&(u=P,x=L)}x>r&&(l[(u-e)/n]=1,p+n<u&&c.push(p,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function mz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=vx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function _d(i,e){return e*Math.round(i/e)}function Eoe(i,e,t,n,r,s,o){if(e==t)return o;let a=_d(i[e],r),l=_d(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=_d(i[e],r),u=_d(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=_d(i[e],r),p=_d(i[e+1],r);if(e+=n,f==c&&p==u)continue;let x=c-a,v=u-l,w=f-a,S=p-l;if(x*S==v*w&&(x<0&&w<x||x==w||x>0&&w>x)&&(v<0&&S<v||v==S||v>0&&S>v)){c=f,u=p;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=p}return s[o++]=c,s[o++]=u,o}function bx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Eoe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function gz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=bx(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var DP=class i extends xu{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(PP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),NP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return CP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return yu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=vx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return gw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xx(this.flatCoordinates,0,e,this.stride),this.changed()}},FP=DP;function wx(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v=r[s+1],w=[];for(let P=0,R=t.length;P<R;++P){let C=t[P];for(u=i[C-n],p=i[C-n+1],a=e;a<C;a+=n)f=i[a],x=i[a+1],(v<=p&&x<=v||p<=v&&v<=x)&&(c=(v-p)/(x-p)*(f-u)+u,w.push(c)),u=f,p=x}let S=NaN,T=-1/0;for(w.sort(Ua),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let P=Math.abs(f-u);P>T&&(c=(u+f)/2,mx(i,e,t,n,c,v)&&(S=c,T=P)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,v,T),o):[S,v,T]}function Lw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=wx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function _z(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){let s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function OP(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){let a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function BP(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=OP(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function xz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!BP(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Dw(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=OP(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&_z(i,e,a,n),e=a}return e}function UP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Dw(i,e,t[s],n,r);return e}function yz(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=OP(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}var Fw=class i extends xu{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Ec(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(IP(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),LP(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return mx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return RP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Dw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,vg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Ba(this.getExtent());this.flatInteriorPoint_=wx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Jh(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new FP(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o],c=new FP(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;BP(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Dw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=bx(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return tP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=EP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},vu=Fw;function kP(i){if(mu(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new Fw(s,"XY",[s.length])}function vz(){let i=k.variant?.surface;return i?[i.x,-(i.y+i.height),i.x+i.width,-i.y]:Su()}function bz(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),wz(),k.gridEnabled?(we.gridInput.focus(),we.gridInput.select()):we.viewport.focus({preventScroll:!0}),!0):i.key===" "&&k.gridEnabled&&i.target!==we.subgridToggle?(i.preventDefault(),Sx(!k.subgridVisible),!0):i.key==="Escape"&&k.gridEnabled?(i.preventDefault(),GP(),!0):!1}function wz(i=!k.gridEnabled){k.gridEnabled=i,i&&Sx(!0),Bw(),bu(),k.layers.pins.changed(),k.layers.text.changed(),k.layers.priority.changed()}function Sx(i){k.subgridVisible=i,k.layers.grid.changed(),k.layers.gridContext.changed(),we.subgridToggle.setAttribute("aria-pressed",String(i)),we.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),Sz()}function Sz(){if(!k.gridEnabled){we.gridHint.textContent="G \xB7 grid off";return}we.gridHint.textContent=`G-${k.gridPrefix||"root"}`+(k.subgridVisible?"":" no subgrid")}function Tx(i){let e=q0(),t=[...i.toLocaleLowerCase()].filter(r=>Gl.includes(r)).slice(0,e).join(""),n=t!==k.gridPrefix;k.gridPrefix=t,k.gridEnabled||(k.gridEnabled=!0),Bw(),bu(),k.layers.pins.changed(),k.layers.text.changed(),k.layers.priority.changed(),n&&(Rc(),k.engine.getView().fit(bg(),{size:k.engine.getSize(),padding:[52,52,52,52],maxZoom:wu(k.variant),duration:180}))}function GP(){if(k.gridEnabled){if(!k.gridPrefix){wz(!1);return}Tx(k.gridPrefix.slice(0,-1))}}function Bw(){if(!k.sources||(k.sources.grid.clear(),k.sources.gridContext.clear(),we.gridNavigator.hidden=!k.gridEnabled,Sz(),!k.gridEnabled||!k.variant))return;let i=q0();if(we.gridInput.maxLength=i,we.gridInput.value=k.gridPrefix,we.gridBack.title=k.gridPrefix?"Back one geohash level":"Close geohash grid",Coe(),k.gridPrefix.length>=i){Ow(k.gridPrefix,bg(),"leaf");return}k.gridPrefix&&Ow(k.gridPrefix,bg(),"scope");for(let e of Gl){let t=k.gridPrefix+e;Ow(t,zP(t),"child")}}function Coe(){for(let i=0;i<k.gridPrefix.length;i++){let e=k.gridPrefix.slice(0,i),t=k.gridPrefix.slice(0,i+1);for(let n of Gl){let r=e+n;r!==t&&Ow(r,zP(r),"neighbor",k.gridPrefix.length-i)}}}function Ow(i,e,t,n=0){let[r,s,o,a]=e,l=k.pins.filter(f=>{if(f.filteredHidden)return!1;let[p,x]=f.coordinate;return p>=r&&p<=o&&x>=s&&x<=a}).length,c=new gd({geometry:new vu([[[r,s],[r,a],[o,a],[o,s],[r,s]]]),gridCell:{hash:i,extent:e,role:t,count:l,contextDistance:n},priority:t==="neighbor"?-n*100+Gl.indexOf(i[i.length-1]):Gl.indexOf(i[i.length-1])});(t==="neighbor"?k.sources.gridContext:k.sources.grid).addFeature(c)}function bg(){return zP(k.gridPrefix)}function zP(i){let e=[...vz()],t=!0;for(let n of i){let r=Gl.indexOf(n);if(!(r<0))for(let s of[16,8,4,2,1]){if(t){let o=(e[0]+e[2])/2;r&s?e[0]=o:e[2]=o}else{let o=(e[1]+e[3])/2;r&s?e[1]=o:e[3]=o}t=!t}}return e}function q0(){return 3}function Tz(i,e=q0()){let t=[...vz()],[n,r]=i;if(n<t[0]||n>t[2]||r<t[1]||r>t[3])return"";let s=!0,o="";for(let a=0;a<e;a++){let l=0;for(let c of[16,8,4,2,1]){if(s){let u=(t[0]+t[2])/2;n>=u?(l|=c,t[0]=u):t[2]=u}else{let u=(t[1]+t[3])/2;r>=u?(l|=c,t[1]=u):t[3]=u}s=!s}o+=Gl[l]}return o}function wg(i){if(!k.gridEnabled||!k.gridPrefix)return!1;let e=bg(),[t,n]=i.coordinate;return t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]}function H0(){return F9[k.map?.iconOutset==="dark"?"dark":"light"]}function Roe(i){let e=k.map?.iconOutset==="dark",t=Ioe(i);return(e?t>.3:t<.88)?i:Poe(i,e?.74:.42)}function Poe(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(R=>parseInt(t.slice(R,R+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let p=(1-Math.abs(2*e-1))*f,x=p*(1-Math.abs(c/60%2-1)),v=e-p/2,[w,S,T]=c<60?[p,x,0]:c<120?[x,p,0]:c<180?[0,p,x]:c<240?[0,x,p]:c<300?[x,0,p]:[p,0,x],P=R=>Math.round((R+v)*255).toString(16).padStart(2,"0");return`#${P(w)}${P(S)}${P(T)}`}function Ioe(i){let e=String(i).replace("#","");if(e.length!==6)return .5;let t=n=>parseInt(e.slice(n,n+2),16)/255;return .2126*t(0)+.7152*t(2)+.0722*t(4)}function Uw(i){let e=Math.abs(Number(i)||0);return Jm[(Math.imul(e,2654435761)>>>0)%Jm.length]}function ef(i,e){let t=String(i||"#ffffff").replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.slice(0,6).padEnd(6,"f"),r=Number.parseInt(n,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${e})`}function Sg(i,e){i.style.setProperty("--pin-color",W0(e))}function W0(i){return Roe(i.color||Uw(i.id))}function Tg(i,e,t){if(i.classList.remove("has-source-icon"),i.style.removeProperty("--pin-icon"),i.textContent="",!e.iconAsset){i.textContent=t;return}i.style.setProperty("--pin-icon",`url("${VP(e.iconAsset)}")`),i.classList.add("has-source-icon")}function VP(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${k.game.base}/icons/${e}`}function Pc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Ez(i){return Math.imul(Number(i)||0,2654435761)>>>0}function Mz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3+4+`).trim()}function Ic(i){return new Intl.NumberFormat().format(i)}function No(i,e,t){return Math.min(t,Math.max(e,i))}function kw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var Noe=100;function xd(){if(!we.searchResults)return;let i=k.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,Noe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=k.search?"No visible locations match.":"Nothing is enabled. Show a category to list its locations.",t.append(n)}for(let n of e){let r=document.createElement("button");r.type="button",r.className="search-result",k.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),Sg(r,n.category);let s=document.createElement("span");s.className="result-dot",Tg(s,n.category,Pc(n.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=n.location.title;let l=document.createElement("small");l.textContent=`${n.category.title} \xB7 ${n.group.title}`,o.append(a,l),r.append(s,o),t.append(r)}if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${Ic(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}we.searchResults.replaceChildren(t),Doe(i.length),Loe()}var Cz=28;function Loe(){let i=k.selectedPin?.location.title||"",e=i.length>Cz?`${i.slice(0,Cz-1).trimEnd()}\u2026`:i;we.dockRailName.textContent=e?` \xB7 ${e}`:"",we.dockRailName.hidden=!e}function Doe(i){we.dockCount.textContent=`${Ic(i)} ${i===1?"location":"locations"}`,k.search?(we.dockFlag.textContent=`\u201C${k.search}\u201D`,we.dockFlag.hidden=!1):k.hiddenCategories.size>0?(we.dockFlag.textContent="filtered",we.dockFlag.hidden=!1):we.dockFlag.hidden=!0}function Gw(){!k.dockFolded||k.dockDismissed||zw(!1)}function qP(i){k.dockDismissed=i,zw(i)}function zw(i,e=!0){k.dockFolded=i,we.dock.classList.toggle("is-folded",i),we.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";we.dockFold.setAttribute("aria-label",t),we.dockFold.setAttribute("title",t),e&&Cc()}function HP(i){k.hiddenCategories.delete(i.category.id),Mx(),Hl(),yd(),Ex(i,!0)}function Ex(i,e=!1){k.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),bu(),k.layers.pins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.textDetail.changed(),k.layers.priority.changed(),we.detailTitle.textContent=i.location.title,we.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,we.detailDescription.textContent="",we.detailLinks.hidden=!0,Ooe(i),we.detailID.textContent=String(i.location.id),we.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Tz(i.coordinate);we.detailCell.textContent=t,we.detailCellField.hidden=!t;let n=Foe(i);if(we.detailSource.textContent=n,we.detailSourceField.hidden=!n,Sg(we.detailDot,i.category),Tg(we.detailDot,i.category,Pc(i.category.title)),we.detail.hidden=!1,Gw(),xd(),e){let r=k.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(wu(k.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function Foe(i){let e=k.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(k.pinSourceIndex?.map!==k.map){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}k.pinSourceIndex={map:k.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return k.pinSourceIndex.byID.get(i.location.id)||t}async function Ooe(i){let e=await Rz();if(k.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],we.detailDescription.textContent=Mz(t.d)||"No description is included in the archive.",Boe(i)}function Boe(i){let e=(i.location.links||[]).filter(n=>k.pinByID.has(n.locationId));if(we.detailLinks.hidden=e.length===0,!e.length){we.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}we.detailLinks.replaceChildren(t)}function Rc(){let i=k.selectedPin!==null;k.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),k.sources&&(bu(),k.layers.pins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.textDetail.changed(),k.layers.priority.changed()),we.detail.hidden=!0,i&&xd()}function Tu(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function Pz(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function j0(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(p,x){return[c-(x-s)/a*(c-f),l+(p-r)/o*(u-l)]},toWorld(p,x){return[r+(x-l)/(u-l)*o,s+(c-p)/(c-f)*a]}}}var qw=[NaN,NaN,NaN,0],WP;function Uoe(){return WP||(WP=Si(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),WP}var koe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Goe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,zoe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Voe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Vw(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Rx(i){throw new Error('failed to parse "'+i+'" as color')}function Iz(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Goe)||i.match(koe)||i.match(zoe);if(s){let o=s[4],a=100/255;return[_i(Vw(s[1],a)+.5|0,0,255),_i(Vw(s[2],a)+.5|0,0,255),_i(Vw(s[3],a)+.5|0,0,255),o!==void 0?_i(Vw(o,100),0,1):1]}Rx(i)}if(i.startsWith("#")){if(Voe.test(i)){let s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let u=parseInt(s.substring(l,l+o),16);o===1&&(u+=u<<4),a[l/o]=u}return a[3]=a[3]/255,a}Rx(i)}let e=Uoe();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&Rx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Iz(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=L0(r[3]/255,3),r}function Nz(i){return typeof i=="string"?i:Ix(i)}var qoe=1024,Cx={},jP=0;function Lz(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function XP(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function $P(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function YP(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function ZP(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function KP(i){let e=YP(i[0]),t=YP(i[1]),n=YP(i[2]),r=ZP(e*.222488403+t*.716873169+n*.06060791),s=500*(ZP(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-ZP(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function Dz(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=$P(e),s=$P(e+t/500*Math.cos(n)),o=$P(e-t/200*Math.sin(n)),a=XP(s*3.021973625-r*1.617392459-o*.404875592),l=XP(s*-.943766287+r*1.916279586+o*.027607165),c=XP(s*.069407491-r*.22898585+o*1.159737864);return[_i(a+.5|0,0,255),_i(l+.5|0,0,255),_i(c+.5|0,0,255),i[3]]}function Px(i){if(i==="none")return qw;if(Cx.hasOwnProperty(i))return Cx[i];if(jP>=qoe){let t=0;for(let n in Cx)(t++&3)===0&&(delete Cx[n],--jP)}let e=Iz(i);e.length!==4&&Rx(i);for(let t of e)isNaN(t)&&Rx(i);return Cx[i]=e,++jP,e}function Wl(i){return Array.isArray(i)?i:Px(i)}function Ix(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);let r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}var JP=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=QP(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=QP(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=QP(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Mn.IDLE&&n.load(),n.getImageState()===Mn.LOADING?n.ready().then(()=>{this.patternCache_[s]=_x().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=_x().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function QP(i,e){let t=e?Wl(e):"null";return i+":"+t}var Lo=new JP;var Nx=null,Hw=class extends md{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Mn.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mn.LOADED){Nx||(Nx=Si(1,1,void 0,{willReadFrequently:!0})),Nx.drawImage(this.image_,0,0);try{Nx.getImageData(0,0,1,1),this.tainted_=!1}catch{Nx=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Jt.CHANGE)}handleImageError_(){this.imageState_=Mn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Si(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&DG(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mn.LOADED)return;let t=this.image_,n=Si(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Nz(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)e();else{let t=()=>{(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)&&(this.removeEventListener(Jt.CHANGE,t),e())};this.addEventListener(Jt.CHANGE,t)}})),this.ready_}};function vd(i,e,t,n,r,s){let o=e===void 0?void 0:Lo.get(e,r);return o||(o=new Hw(i,i&&"src"in i?i.src||void 0:e,t,n,r),Lo.set(e,r,o,s)),s&&o&&!Lo.getPattern(e,r)&&Lo.set(e,r,o,s),o}var Fz=Hw;function Ga(i){return i?Array.isArray(i)?Ix(i):typeof i=="object"&&"src"in i?Hoe(i):i:null}function Hoe(i){if(!i.offset||!i.size)return Lo.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Lo.getPattern(e,i.color);if(t)return t;let n=Lo.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Si(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),vd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Lo.getPattern(e,i.color)}var Lx="ol-hidden";var bd="ol-unselectable";var Eg="ol-control",eI="ol-collapsed",Woe=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),Oz=["style","variant","weight","size","lineHeight","family"],Ww={normal:400,bold:700},jw=function(i){let e=i.match(Woe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=Oz.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[Oz[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in Ww&&(t.weight=Ww[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var Xw="10px sans-serif",Ds="#000",Eu="round",za=[],Va=0,Mu="round",tf=10,Uz=0,Do="#000",wd="center",$0="middle",nf=[0,0,0,0],rf=1,X0=new gs,Dx=null,Bz,tI={},joe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Xoe(i,e,t){return`${i} ${e} 16px "${t}"`}var kz=(function(){let e,t;async function n(s){await t.ready;let o=jw(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=Ww[f.weight]||f.weight;p===a&&f.style===o.style&&x==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=X0.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(_u(tI),X0.set(c,100)):(u+=10,X0.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Ls?self.fonts:document.fonts);let o=jw(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(joe.has(c))continue;let u=Xoe(o.style,o.weight,c);X0.get(u)===void 0&&(X0.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),$oe=(function(){let i;return function(e){let t=tI[e];if(t==null){if(Ls){let n=jw(e),r=Gz(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);tI[e]=t}return t}})();function Gz(i,e){return Dx||(Dx=Si(1,1)),i!=Bz&&(Dx.font=i,Bz=Dx.font),Dx.measureText(e)}function zz(i,e){return Gz(i,e).width}function nI(i,e,t){if(e in t)return t[e];let n=e.split(`5+`).reduce((r,s)=>Math.max(r,zz(i,s)),0);return t[e]=n,n}function Vz(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`6+`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let p=e[c+1]||i.font,x=zz(p,f);t.push(x),o+=x;let v=$oe(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function qz(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),Yoe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function Yoe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var iI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Vr(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return $n()}getImage(e){return $n()}getHitDetectionImage(){return $n()}getPixelRatio(e){return 1}getImageState(){return $n()}getImageSize(){return $n()}getOrigin(){return $n()}getSize(){return $n()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Vr(e)}listenImageChange(e){$n()}load(){$n()}unlistenImageChange(e){$n()}ready(){return Promise.resolve()}},$w=iI;var rI=class i extends $w{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Mn.LOADING:Mn.LOADED,this.imageState_===Mn.LOADING&&this.ready().then(()=>this.imageState_=Mn.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=Lo.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Si(o,o);this.draw_(s,a,e),r=a.canvas;let l=new Fz(r,void 0,null,Mn.LOADED,null);Lo.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),p=f/l;if(e==="miter"&&p<=n)return p*t;let x=t/2/p,v=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+v*v)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),P=Math.sqrt(r*r-T*T),R=s-P,L=Math.sqrt(T*T+R*R)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Eu,t=Mu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Ga(this.stroke_.getColor()??Do),a=this.stroke_.getWidth()??rf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Mu,e=this.stroke_.getLineCap()??Eu,n=this.stroke_.getMiterLimit()??tf);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=Ds),t.fillStyle=Ga(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Wl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Si(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Ds,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},Yw=rI;var sI=class i extends Yw{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},Zw=sI;var oI=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=vd(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Mn.IDLE&&t.load(),t.getImageState()===Mn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Nn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Wl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},qr=oI;function Hz(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var aI=class i extends $w{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;zn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Nn(o)),zn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),zn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Mn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Mn.LOADED:Mn.IDLE:l=Mn.LOADING:l=Mn.LOADED),this.color_=e.color!==void 0?Wl(e.color):null,this.iconImage_=vd(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;let x=this.iconImage_.getSize();this.setScale(Hz(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(Hz(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Wl(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Mn.IDLE:this.iconImage_.getImageState();this.iconImage_=vd(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=vd(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Mn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Jt.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Jt.CHANGE,e)}ready(){return this.iconImage_.ready()}},Y0=aI;var lI=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Ys=lI;var Kw=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=Wz,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=Wz,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function jz(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(zn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var cI=null;function uI(i,e){if(!cI){let t=new qr({color:"rgba(255,255,255,0.4)"}),n=new Ys({color:"#3399CC",width:1.25});cI=[new Kw({image:new Zw({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return cI}function Wz(i){return i.getGeometry()}var Fs=Kw;var Zoe="#333",hI=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Vr(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new qr({color:Zoe}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof qr?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Vr(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},sf=hI;function jl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function Yz(i){let e=i.get("pin");return!e||Xl(e)||e.insideHighlightedZone||Mg(e)?null:fI(e,!1)}function Zz(i){let e=i.get("pin");return!e||!k.highlightedZones.size||!e.insideHighlightedZone||Xl(e)||Mg(e)?null:fI(e,!1)}function Kz(i){let e=i.get("pin");return!e||Xl(e)||!k.labelsHeld?null:nV(e)}function Qz(i){let e=i.get("pin");if(!e||Xl(e)||e.insideHighlightedZone||Mg(e)||Bx())return null;if(k.labelsHeld)return Fx(e,!1);let t=k.fitZoom+Math.log2(uV(e.category));return(k.engine.getView().getZoom()||0)<t?null:Fx(e,!1)}function Jz(i){let e=i.get("pin");return!e||Xl(e)||e.insideHighlightedZone||Mg(e)||!Bx()?null:Fx(e,!1)}function eV(i){let e=i.get("pin");return!e||!k.highlightedZones.size||!e.insideHighlightedZone||Xl(e)||Mg(e)?null:Fx(e,!1)}function tV(i){let e=i.get("pin");if(!e||Xl(e))return null;if(Tu(e.category)==="text")return Fx(e,e===k.selectedPin);let t=fI(e,e===k.selectedPin);return e===k.hoveredPin||e===k.selectedPin?[t,nV(e)]:t}function fI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(k.styleCache.has(t))return k.styleCache.get(t);let n=W0(i.category),r=e?2e7:i.priority,s=k.markerIcons.get(Ox(i.category)),o;return s?o=new Fs({image:new Y0({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Fs({text:new sf({text:Pc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new qr({color:n}),stroke:new Ys({color:H0(),width:e?4:3})}),zIndex:r}),k.styleCache.set(t,o),o}function nV(i){let e=`marker-label:${i.location.id}`;if(k.styleCache.has(e))return k.styleCache.get(e);let t=new Fs({text:new sf({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new qr({color:"#f2ece0"}),stroke:new Ys({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new qr({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return k.styleCache.set(e,t),t}function iV(i){if(!i.iconAsset)return;let e=Ox(i);if(k.markerIcons.has(e))return;k.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=W0(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=H0(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),k.markerIcons.set(e,n.toDataURL("image/png")),Koe(),k.layers.pins.changed(),k.layers.zonePins.changed(),k.layers.priority.changed()},t.onerror=()=>k.markerIcons.set(e,!1),t.src=VP(i.iconAsset)}function Koe(){for(let i of k.styleCache.keys())i.startsWith("marker:")&&k.styleCache.delete(i)}function Ox(i){return`${i.iconAsset||""}:${W0(i)}:${k.map?.iconOutset||"light"}`}function Fx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(k.styleCache.has(t))return k.styleCache.get(t);let r=[new Fs({text:new sf({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new qr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Ys({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new qr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Ys({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return k.styleCache.set(t,r),r}function dI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="leaf",r=t.role==="scope",s=t.role==="neighbor",o=n||r?15:s?10:11,l=`${n||r?900:s?750:800} ${o}px ui-monospace, SFMono-Regular, Menlo, monospace`,c=s?[2,4,2,4]:[3,5,3,5],u=Qoe(t,l,o,c,e);if(t.role==="child"&&(!u||!k.subgridVisible))return null;let f=r&&k.subgridVisible,p=`grid:${t.hash}:${t.role}:${t.contextDistance}:${u?1:0}:${f?1:0}`;if(k.styleCache.has(p))return k.styleCache.get(p);let x=Jm[Math.max(0,Gl.indexOf(t.hash[t.hash.length-1]))%Jm.length],v=new Fs({fill:r?void 0:new qr({color:s?`rgba(5, 8, 16, ${Math.min(.52,.3+t.contextDistance*.06)})`:ef(x,n?.14:.055)}),stroke:new Ys({color:n||r?"#ffffff":ef(x,s?.44:.82),width:n?2.5:r?f?1.8:2.5:s?1:1.4}),text:u&&!f?new sf({text:t.hash,font:l,fill:new qr({color:n||r?"#ffffff":s?ef(x,.72):x}),stroke:new Ys({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new qr({color:s?"rgba(8,11,18,0.88)":"rgba(12,15,22,0.76)"}),padding:c,overflow:!0}):void 0,zIndex:n||r?100:i.get("priority")});return k.styleCache.set(p,v),v}function Qoe(i,e,t,n,r){if(!r)return!0;let s=Joe(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var Xz=document.createElement("canvas").getContext("2d"),$z=new Map;function Joe(i,e){let t=`${e}|${i}`,n=$z.get(t);return n===void 0&&(Xz.font=e,n=Xz.measureText(i).width,$z.set(t,n)),n}var eae=new Fs({fill:new qr({color:"rgba(5, 8, 16, 0.62)"})});function rV(){return k.zonesVisible?eae:null}function sV(i){if(!k.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=k.highlightedZones.has(e.id),r=cV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(k.styleCache.has(s))return k.styleCache.get(s);let o=i.get("color");if(r){let c=new Fs({stroke:new Ys({color:ef(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return k.styleCache.set(s,c),c}let a=new Fs({fill:new qr({color:ef(o,t?.035:.07)}),stroke:new Ys({color:ef(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return k.styleCache.set(s,a),a;let l=[new Fs({stroke:new Ys({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Fs({fill:new qr({color:ef(o,.22)}),stroke:new Ys({color:o,width:2.6}),zIndex:9001})];return k.styleCache.set(s,l),l}function oV(i){if(!k.zonesVisible||Bx())return null;let e=i.get("child"),t=k.highlightedZones.has(i.get("zone").id),n=k.engine.getView().getZoom()||0;if(!t&&e&&n<k.fitZoom+3)return null;let r=i.get("span")/k.engine.getView().getResolution();return!t&&k.zoneTitleCount>40&&r<52?null:lV(i)}function aV(i){return!k.zonesVisible||!Bx()?null:lV(i)}function lV(i){let e=i.get("child"),t=i.get("zone"),n=k.highlightedZones.has(t.id),r=cV(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(k.styleCache.has(s))return k.styleCache.get(s);let o=i.get("color"),a=new Fs({text:new sf({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new qr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Ys({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new qr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Ys({color:n?"#ffffff":ef(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return k.styleCache.set(s,a),a}function cV(i){if(!k.highlightedZones.size||k.highlightedZones.has(i))return!1;for(let e of k.highlightedZones)if(tae(i,e))return!1;return!0}function tae(i,e){let t=new Set,n=k.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=k.zoneRecords.get(n)?.zone.parentRegionId}return!1}var pI=class i extends xu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Ec(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<cd(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=yc(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return yu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Jh(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){let a=new Jh(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){let o=t[r],a=t[r+1];if(cx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xx(this.flatCoordinates,0,e,this.stride),this.changed()}},hV=pI;function Qw(i,e,t,n){let r=[],s=Er();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=tg(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}var AI=class i extends xu{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let p=0,x=f.length;p<x;++p)f[p]+=u;Ec(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Ec(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(pz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Az(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return vG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return fz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),UP(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,yx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=Qw(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Lw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new hV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;xz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=UP(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=gz(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new vu(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,p=l.length;f<p;++f)l[f]-=s;let u=new vu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return wG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=hz(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},fV=AI;function mI(){let i=(k.map.zones||[]).filter(xI);k.renderedShard=k.variant?.shard||0,k.sources.zones.clear(),k.sources.zoneTitles.clear(),k.zoneRecords.clear(),k.highlightedZones.clear(),k.focusedZoneID=null,k.zoneTitleCount=0,Jw(!0),we.zoneIndex.hidden=i.length===0,we.zoneCount.textContent=Ic(i.length);for(let e of i){let t=Er(),n=[],r=!1;for(let l of e.features||[]){let c=rae(l);c&&(r=!0,n.push(c),tw(t,c.getExtent()),k.sources.zones.addFeature(new gd({geometry:c,zone:e,color:Uw(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=Uw(e.id),o=e.center?Cg(e.center.lat,e.center.lng):Ba(t),a=Math.max(t[2]-t[0],t[3]-t[1]);k.sources.zoneTitles.addFeature(new gd({geometry:new Jh(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),k.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}k.zoneTitleCount=k.sources.zoneTitles.getFeatures().length,pV(),nae()}function pV(){if(k.sources.zoneScrim.clear(),!k.highlightedZones.size)return;let[i,e,t,n]=k.projection.getExtent(),r=[dV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of k.highlightedZones)for(let o of k.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(dV(c.getCoordinates(),u>0))})}k.sources.zoneScrim.addFeature(new gd({geometry:new vu(r)}))}function dV(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function nae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of iae()){let n=k.zoneRecords.get(e.id);if(!n)continue;let r=document.createElement("button");r.type="button",r.className="zone-index-item",r.dataset.zone=String(e.id),r.style.setProperty("--zone-color",n.color),r.style.setProperty("--zone-depth",String(t)),r.setAttribute("aria-pressed","false"),r.title=`${e.title}: click to jump; right-click to toggle highlight`;let s=document.createElement("span");s.className="zone-index-marker",s.setAttribute("aria-hidden","true");let o=document.createElement("span");o.textContent=e.title,r.append(s,o),i.append(r)}we.zoneList.replaceChildren(i),we.zoneIndex.hidden=k.zoneRecords.size===0}function iae(){let i=[...k.zoneRecords.values()].map(o=>o.zone),e=new Set(i.map(o=>o.id)),t=new Map;for(let o of i){let a=e.has(o.parentRegionId)?o.parentRegionId:null;t.has(a)||t.set(a,[]),t.get(a).push(o)}for(let o of t.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let n=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),n.push({zone:o,depth:a});for(let l of t.get(o.id)||[])s(l,a+1)}};for(let o of t.get(null)||[])s(o,0);for(let o of i)s(o,0);return n}function Jw(i){k.zonesVisible=i,we.zoneToggle.checked=i,k.layers.zoneScrim.setVisible(i),k.layers.zones.setVisible(i),k.layers.zoneTitles.setVisible(i),k.layers.zoneTitleDetail.setVisible(i)}function AV(i){let e=k.zoneRecords.get(i);e&&(k.focusedZoneID=i,gV(),Rc(),k.engine.getView().fit(e.extent,{size:k.engine.getSize(),padding:[54,54,54,54],maxZoom:wu(k.variant),duration:220}),we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"))}function mV(i){k.zoneRecords.has(i)&&(k.highlightedZones.has(i)?k.highlightedZones.delete(i):(k.highlightedZones.add(i),Jw(!0)),k.hoveredPin=null,gI(),_I(),gV(),pV(),k.layers.zones.changed(),k.layers.zoneTitles.changed(),k.layers.zoneTitleDetail.changed())}function gV(){we.zoneIndex.classList.toggle("has-highlights",k.highlightedZones.size>0);for(let i of we.zoneList.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=k.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",k.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function rae(i){if(!i?.coordinates)return null;let e=([t,n])=>Cg(n,t);return i.type==="Polygon"?new vu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new fV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Cg(i,e){let t=sae(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function sae(){let i=k.game.tileGrid,e=k.map?.grid;return e?{...i,...e}:i}function _V(){k.sources.pins.clear(),k.sources.text.clear(),k.sources.priority.clear(),k.pins=[],k.pinByID.clear();for(let i of k.map.groups)for(let e of i.categories){Tu(e)!=="text"&&iV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Cg(t.lat,t.lng),filteredHidden:!1,priority:cae(e,t),feature:null};n.feature=new gd({geometry:new Jh(n.coordinate),pin:n,priority:n.priority}),k.pins.push(n),k.pinByID.set(t.id,n),Tu(e)==="text"?k.sources.text.addFeature(n.feature):k.sources.pins.addFeature(n.feature)}}Hl()}function Hl(){for(let i of k.pins){let e=k.hiddenCategories.has(i.category.id),t=k.search&&!i.location.title.toLocaleLowerCase().includes(k.search);i.filteredHidden=!!(e||t)}gI(),_I(),k.selectedPin?.filteredHidden&&Rc(),xd(),document.dispatchEvent(new Event("atlas:filters"))}function gI(){if(!k.highlightedZones.size){for(let e of k.pins)e.insideHighlightedZone=!1;return}let i=[...k.highlightedZones].map(e=>k.zoneRecords.get(e)).filter(Boolean);for(let e of k.pins)e.insideHighlightedZone=i.some(t=>t.geometries.some(n=>oae(n,e.coordinate)))}function oae(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}function _I(){k.eligibleLocations=k.pins.filter(i=>!Xl(i)).length,bu(),k.layers.pins.changed(),k.layers.zonePins.changed(),k.layers.pinLabels.changed(),k.layers.text.changed(),k.layers.zoneText.changed(),k.layers.textDetail.changed(),k.layers.priority.changed(),Z0()}function bu(){k.sources.priority.clear();for(let i of k.pins){if(Xl(i))continue;let e=!!k.search&&i.location.title.toLocaleLowerCase().includes(k.search);(i===k.selectedPin||i===k.hoveredPin||e||wg(i))&&k.sources.priority.addFeature(i.feature)}}function Rg(i){k.hoveredPin!==i&&(k.hoveredPin=i,k.sources&&(bu(),k.layers.pins.changed(),k.layers.priority.changed()))}function eS(i){k.labelsHeld!==i&&(k.labelsHeld=i,we.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",k.layers.pinLabels.changed(),k.layers.text.changed())}function Mg(i){return i===k.selectedPin||i===k.hoveredPin||wg(i)||!!k.search&&i.location.title.toLocaleLowerCase().includes(k.search)}function Xl(i){return i.filteredHidden||aae(i)||lae(i)||!xI(i.location)}function xI(i){let e=k.variant?.shard;return!e||!i.shard||i.shard===e}function aae(i){return!k.highlightedZones.size||i.insideHighlightedZone||i===k.selectedPin?!1:!(k.search&&i.location.title.toLocaleLowerCase().includes(k.search))}function lae(i){return!k.gridEnabled||!k.gridPrefix||wg(i)||i===k.selectedPin?!1:!(k.search&&i.location.title.toLocaleLowerCase().includes(k.search))}function cae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Ez(e.id)%1e3}function uV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function Bx(){return(k.engine?.getView().getZoom()||0)>=(k.variant?.maxZoom||0)-.05}function xV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Tu(s)==="text"?t:r).push(s);r.length&&e.push({key:`group-${n.id}`,title:n.title,categories:r})}return t.length&&e.unshift({key:"text",title:"Text",categories:t}),e}function yV(){let i=document.createDocumentFragment();for(let e of k.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(uae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(hae(s));t.append(r),i.append(t)}we.legend.replaceChildren(i),tS(),yd()}function uae(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=Ic(t),r.append(s,o,a);let l=vV(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function vV(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function hae(i){let e=Tu(i)==="text",t=document.createElement("label");t.className="category-row",Sg(t,i);let n=document.createElement("input");n.type="checkbox",n.dataset.category=String(i.id),n.checked=!k.hiddenCategories.has(i.id);let r=document.createElement("span");e?(r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label"):(r.className="category-icon",Tg(r,i,Pc(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=document.createElement("span");o.className="category-count",o.textContent=Ic(i.locations.length);let a=vV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function yI(i){if(k.collapsedSections.clear(),i)for(let e of we.layers.querySelectorAll("[data-section]"))k.collapsedSections.add(e.dataset.section);tS()}function tS(){for(let i of we.layers.querySelectorAll("[data-section]")){let e=k.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Cc()}function Ux(i){if(k.hiddenCategories.clear(),!i)for(let e of k.map.groups)for(let t of e.categories)k.hiddenCategories.add(t.id);Mx(),Hl(),xd(),yd()}function Mx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!k.hiddenCategories.has(Number(i.dataset.category))}function bV(i){let e=k.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!k.hiddenCategories.has(n.id));for(let n of e.categories)t?k.hiddenCategories.add(n.id):k.hiddenCategories.delete(n.id);Mx(),Hl(),yd()}function wV(i){if(k.map){if(fae(i)){Ux(!0);return}k.hiddenCategories.clear();for(let e of k.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&k.hiddenCategories.add(n.id)}Mx(),Hl(),xd(),yd()}}function fae(i){for(let e of k.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===k.hiddenCategories.has(t.id))return!1;return!0}function dae(){let i=we.soloChip;if(!k.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of k.map.sections){let a=0;for(let l of o.categories)k.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function yd(){if(k.map){for(let i of k.map.sections){let e=we.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!k.hiddenCategories.has(t.id)))}dae(),Cc()}}async function SV(i){let[e,t]=await Promise.all([fetch(`${k.game.base}/maps/${i.slug}.json`),fetch(`${k.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return pae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:xV(n.groups)}}function pae(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==2)throw new Error(`location payload is version ${r}, and this reads 2`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),p=new Uint32Array(i,o+=s*4,s+1),x=new Uint16Array(i,o+=(s+1)*4,s),v=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[x[S]].locations.push({id:a[S],title:w.decode(v.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function Rz(){let i=`${k.game.base}/${k.map.slug}`;return k.textByMap.has(i)||k.textByMap.set(i,fetch(`${k.game.base}/maps/${k.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),k.textByMap.get(i)}var nS=null;function K0(){return nS||(nS=Aae().finally(()=>{nS=null})),nS}async function Aae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=k.game;if(k.catalog=await i.json(),R0(we.game,k.catalog.games,"title"),vI(),!k.catalog.games.length)return;let t=e&&k.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=yg();await of(n.game||xg()?.game||k.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of k.textByMap.keys())r.startsWith(e.base+"/")&&k.textByMap.delete(r);let n=k.engine?.getView();k.restore={game:t.slug,map:k.map?.slug,variant:k.map?k.map.variants.indexOf(k.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...k.hiddenCategories],collapsed:[...k.collapsedSections],overviewDocked:k.overviewDocked,dockFolded:k.dockFolded,dockDismissed:k.dockDismissed},await of(t.slug,k.map?.slug);return}k.game=t,we.game.value=t.slug}function vI(){let i=!k.catalog?.games?.length;we.emptyState.hidden=!i,k.catalog?.bundlesDir&&(we.emptyPath.textContent=k.catalog.bundlesDir)}async function bI(){for(let i of[we.emptyOpen,we.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await K0();let t=e.imported?.[0];t&&k.catalog.games.some(n=>n.slug===t)&&await of(t)}finally{for(let i of[we.emptyOpen,we.addBundles])i.disabled=!1}}var Zs={ADD:"add",REMOVE:"remove"};var TV={LENGTH:"length"},Pg=class extends Xs{constructor(e,t,n){super(e),this.element=t,this.index=n}},wI=class extends gs{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(TV.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Pg(Zs.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Pg(Zs.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Pg(Zs.REMOVE,r,e)),this.dispatchEvent(new Pg(Zs.ADD,t,e))}updateLength_(){this.set(TV.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},co=wI;var SI=class extends Xs{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Sd=SI;var TI=class extends Sd{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},Cu=TI;var nr={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var kx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var EI=class extends md{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=Un(n,kx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Un(n,kx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,vw?{passive:!1}:!1)}emulateClick_(e){let t=new Cu(nr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Cu(nr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Cu(nr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==nr.POINTERUP||t.type==nr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==nr.POINTERDOWN||t.type==nr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Cu(nr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new Cu(nr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Un(n,nr.POINTERMOVE,this.handlePointerMove_,this),Un(n,nr.POINTERUP,this.handlePointerUp_,this),Un(this.element_,nr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(Un(this.element_.getRootNode(),nr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Cu(nr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Cu(nr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(ii(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ii(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},EV=EI;var Ru={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var uo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Gx=1/0,MI=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,_u(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){zn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=Gx?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==Gx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},MV=MI;var CI=class extends MV{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(Jt.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===rn.LOADED||n===rn.ERROR||n===rn.EMPTY){n!==rn.ERROR&&t.removeEventListener(Jt.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===rn.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},CV=CI;function RV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Gx;if(!i.wantedTiles[t][e.getKey()])return Gx;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var Os={ANIMATING:0,INTERACTING:1};var $l={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function RI(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,p=i[0]+l/2+u,x=i[2]-l/2+u,v=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),v>w&&(v=(w+v)/2,w=v);let S=_i(n[0],p,x),T=_i(n[1],v,w);if(o&&t&&r){let P=30*r;S+=-P*Math.log(1+Math.max(0,p-n[0])/P)+P*Math.log(1+Math.max(0,n[0]-x)/P),T+=-P*Math.log(1+Math.max(0,v-n[1])/P)+P*Math.log(1+Math.max(0,n[1]-w)/P)}return[S,T]})}function PV(i){return i}function PI(i,e,t,n){let r=Wn(e)/t[0],s=gr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function II(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),_i(n,t/2,e*2)}function IV(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?PI(l,t,o,n):l;if(a)return e?II(r,u,c):_i(r,c,u);let f=Math.min(u,r),p=Math.floor(fg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function NV(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?PI(e,r,l,s):e;if(c)return n?II(o,u,t):_i(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,v=Math.min(u,o),w=Math.floor(Math.log(e/v)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return _i(T,t,u)}})}function NI(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?PI(i,n,a,r):i;return!t||!l?_i(s,e,c):II(s,c,e)}})}function Ig(i){if(i!==void 0)return 0}function LI(i){if(i!==void 0)return i}function LV(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function DV(i){let e=i===void 0?vc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var DI=0,OI=class extends gs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=pw(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&hG(),e.center&&(e.center=Sc(e.center,this.projection_)),e.extent&&(e.extent=Tc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in $l)delete t[a];this.setProperties(t,!0);let n=gae(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=mae(e),s=n.constraint,o=_ae(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=Sc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Sc(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(r===t){n&&iS(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||FG,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let p=gu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}xae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Os.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Os.ANIMATING]>0}getInteracting(){return this.hints_[Os.INTERACTING]>0}cancelAnimations(){this.setHint(Os.ANIMATING,-this.hints_[Os.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&iS(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let p=l.sourceCenter[0],x=l.sourceCenter[1],v=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(v-p),T=x+f*(w-x);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let p=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let x=this.getViewportSize_(this.getRotation()),v=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(v,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=p,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let p=f===1?gu(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let x=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(x,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(Os.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&iS(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],sg(n,e-this.getRotation()),H9(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Ax(e,this.getProjection())}getCenterInternal(){return this.get($l.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return fd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();zn(t,"The view center is not defined");let n=this.getResolution();zn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return zn(r!==void 0,"The view rotation is not defined"),hx(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get($l.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Tc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Wn(e)/t[0],r=gr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get($l.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=FI(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=fg(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=_i(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,_i(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(zn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){zn(!mu(e),"Cannot fit empty extent provided as `geometry`");let r=Tc(e,this.getProjection());n=kP(r)}else if(e.getType()==="Circle"){let r=Tc(e.getExtent(),this.getProjection());n=kP(r),n.rotate(this.getRotation(),Ba(r))}else{let r=U0();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,p=s.length;f<p;f+=o){let x=s[f]*n-s[f+1]*r,v=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,v),c=Math.max(c,x),u=Math.max(u,v)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),p=Ba(a);p[0]+=(r[1]-r[3])/2*l,p[1]+=(r[0]-r[2])/2*l;let x=p[0]*f-p[1]*u,v=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,v],l),S=t.callback?t.callback:Qh;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),iS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Sc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(FI(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=FI(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Ax(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&Sc(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=Sc(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&Sc(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get($l.ROTATION)!==r&&this.set($l.ROTATION,r),this.get($l.RESOLUTION)!==o&&(this.set($l.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get($l.CENTER)||!D0(this.get($l.CENTER),a))&&this.set($l.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!D0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:ql,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Os.INTERACTING,1)}endInteraction(e,t,n){n=n&&Sc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Os.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function iS(i,e){setTimeout(function(){i(e)},0)}function mae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return RI(i.extent,i.constrainOnlyCenter,t)}let e=pw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,RI(t,!1,!1)}return PV}function gae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:DI,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,p=pw(i.projection,"EPSG:3857"),x=p.getExtent(),v=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(v=!1,w=x),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=IV(S,u,!v&&w,f):e=NI(t,n,u,!v&&w,f)}else{let T=(x?Math.max(Wn(x),gr(x)):360*$h.degrees/p.getMetersPerUnit())/256/Math.pow(2,DI),P=T/Math.pow(2,28-DI);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=P),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=NV(l,t,n,u,!v&&w,f):e=NI(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function _ae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?DV():t===!1?LI:typeof t=="number"?LV(t):LI}return Ig}function xae(i){return!(i.sourceCenter&&i.targetCenter&&!D0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function FI(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var ul=OI;var BI=class extends gs{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)ii(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==Qh&&this.listenerKeys.push(Un(e,Ru.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Ng=BI;var UI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+bd+" "+Eg+(this.collapsed_&&this.collapsible_?" "+eI:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>PG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Io(t,this.renderedAttributions_)){BG(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(eI),this.collapsed_?hP(this.collapseLabel_,this.label_):hP(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},FV=UI;var kI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+bd+" "+Eg,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Lx)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:ql}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Lx);!s&&n===0?this.element.classList.add(Lx):s&&n!==0&&this.element.classList.remove(Lx)}this.label_.style.transform=r}this.rotation_=n}},OV=kI;var GI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(Jt.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(Jt.CLICK,this.handleClick_.bind(this,-n),!1);let p=t+" "+bd+" "+Eg,x=this.element;x.className=p,x.appendChild(u),x.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:ql})):n.setZoom(s)}}},BV=GI;function rS(i){i=i||{};let e=new co;return(i.zoom===void 0||i.zoom)&&e.push(new BV(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new OV(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new FV(i.attributionOptions)),e}var zI=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},UV=zI;var VI={ACTIVE:"active"};var qI=class extends gs{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(VI.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(VI.ACTIVE,e)}setMap(e){this.map_=e}};function kV(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:OG,center:i.getConstrainedCenter(r)})}}function Lg(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:ql})}var Pu=qI;var HI=class extends Pu{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==nr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();Lg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},GV=HI;function zx(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var zV=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},yae=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},sS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?yae(i):!0},VV=Zh;var oS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(IG&&oP&&e.ctrlKey)};var aS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var qV=function(i){let e=i.originalEvent;return oP?e.metaKey:e.ctrlKey},HV=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},lS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},cS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var WV=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var WI=class extends Pu{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==nr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==nr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==nr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==nr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function Dg(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var Iu=WI;var jI=class extends Iu{constructor(e){super({stopDown:Kh}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:zx(aS,WV);this.condition_=e.onFocusOnly?zx(sS,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(Dg(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();W9(s,a.getResolution()),sg(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:ql})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},jV=jI;var XI=class extends Iu{constructor(e){e=e||{},super({stopDown:Kh}),this.condition_=e.condition?e.condition:zV,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!cS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Ig)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return cS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return cS(e)&&oS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},XV=XI;var $I=class extends Ad{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new vu([r])}getGeometry(){return this.geometry_}},$V=$I;var Fg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},Q0=class extends Xs{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},YI=class extends Iu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new $V(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??oS,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Q0(Fg.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Q0(t?Fg.BOXEND:Fg.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Q0(Fg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Q0(Fg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Q0(Fg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},YV=YI;var ZI=class extends YV{constructor(e){e=e||{};let t=e.condition?e.condition:HV;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:ql})}},ZV=ZI;var Td={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var KI=class extends Pu{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return aS(t)&&lS(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Td.DOWN||r==Td.LEFT||r==Td.RIGHT||r==Td.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Td.DOWN?c=-a:r==Td.LEFT?l=-a:r==Td.RIGHT?l=a:c=a;let u=[l,c];sg(u,o.getRotation()),kV(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},KV=KI;var QI=class extends Pu{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!qV(t)&&lS(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN||e.type==Jt.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();Lg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},QV=QI;var vae=40,bae=300,wae=3,JI=class extends Pu{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:VV;this.condition_=e.onFocusOnly?zx(sS,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(ii),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(Un(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),Un(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==Jt.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=vae;break;case WheelEvent.DOM_DELTA_PAGE:o*=bae;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=n.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*wae),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-_i(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Lg(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},JV=JI;var e5=class extends Iu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Kh),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==Ig&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Dg(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},eq=e5;var t5=class extends Iu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Kh),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Dg(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},tq=t5;function uS(i){i=i||{};let e=new co,t=new UV(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new XV),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new GV({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new jV({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new eq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new tq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new KV),e.push(new QV({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new JV({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new ZV({duration:i.zoomDuration})),e}var Ti={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var n5=class extends gs{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ti.OPACITY]=e.opacity!==void 0?e.opacity:1,zn(typeof t[Ti.OPACITY]=="number","Layer opacity must be a number"),t[Ti.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ti.Z_INDEX]=e.zIndex,t[Ti.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ti.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ti.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ti.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=_i(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return $n()}getLayerStatesArray(e){return $n()}getExtent(){return this.get(Ti.EXTENT)}getMaxResolution(){return this.get(Ti.MAX_RESOLUTION)}getMinResolution(){return this.get(Ti.MIN_RESOLUTION)}getMinZoom(){return this.get(Ti.MIN_ZOOM)}getMaxZoom(){return this.get(Ti.MAX_ZOOM)}getOpacity(){return this.get(Ti.OPACITY)}getSourceState(){return $n()}getVisible(){return this.get(Ti.VISIBLE)}getZIndex(){return this.get(Ti.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ti.EXTENT,e)}setMaxResolution(e){this.set(Ti.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ti.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ti.MAX_ZOOM,e)}setMinZoom(e){this.set(Ti.MIN_ZOOM,e)}setOpacity(e){zn(typeof e=="number","Layer opacity must be a number"),this.set(Ti.OPACITY,e)}setVisible(e){this.set(Ti.VISIBLE,e)}setZIndex(e){this.set(Ti.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},hS=n5;var Ed={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Nc=class extends Xs{constructor(e,t){super(e),this.layer=t}},i5={LAYERS:"layers"},r5=class i extends hS{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(i5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new co(n.slice(),{unique:!0}):zn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new co(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ii),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(Un(e,Zs.ADD,this.handleLayersAdd_,this),Un(e,Zs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ii);_u(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Nc(Ed.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[Un(e,Mc.PROPERTYCHANGE,this.handleLayerChange_,this),Un(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(Un(e,Ed.ADDLAYER,this.handleLayerGroupAdd_,this),Un(e,Ed.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Nn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Nc(Ed.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Nc(Ed.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Nc(Ed.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Nn(t);this.listenerKeys_[n].forEach(ii),delete this.listenerKeys_[n],this.dispatchEvent(new Nc(Ed.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(i5.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Nc(Ed.REMOVELAYER,n[r]))}this.set(i5.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=Au(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Vx=r5;var ho={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var s5=class extends hS{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ti.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ti.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ii(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=Un(e,Jt.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof ul?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return qx(r,t.viewState)&&(!s||_r(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof ul?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ti.MAP,e)}getMapInternal(){return this.get(Ti.MAP)}setMap(e){this.mapPrecomposeKey_&&(ii(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ii(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=Un(e,ho.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Un(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);zn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ti.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function qx(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var J0=s5;function fS(i,e,t=0,n=i.length-1,r=Sae){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),x=Math.max(t,Math.floor(e-c*f/l+p)),v=Math.min(n,Math.floor(e+(l-c)*f/l+p));fS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(Hx(i,t,e),r(i[n],s)>0&&Hx(i,t,n);o<a;){for(Hx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Hx(i,t,a):(a++,Hx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Hx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Sae(i,e){return i<e?-1:i>e?1:0}var eA=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!pS(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;pS(e,l)&&(t.leaf?n.push(a):a5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!pS(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(pS(e,o)){if(t.leaf||a5(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Bg([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=Tae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&a5(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=Bg(e.slice(t,n+1)),Og(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Bg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));nq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);nq(e,u,f,l,this.compareMinY);for(let p=u;p<=f;p+=l){let x=Math.min(p+l-1,f);a.children.push(this._build(e,p,x,r-1))}}return Og(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=o5(c),f=Cae(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),jx(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=Bg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Og(n,this.toBBox),Og(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Bg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Og(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=Wx(e,0,a,this.toBBox),c=Wx(e,a,n,this.toBBox),u=Rae(l,c),f=o5(l)+o5(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:Eae,s=e.leaf?this.compareMinY:Mae,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=Wx(e,0,t,s),a=Wx(e,n-t,n,s),l=dS(o)+dS(a);for(let c=t;c<n-t;c++){let u=e.children[c];jx(o,e.leaf?s(u):u),l+=dS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];jx(a,e.leaf?s(u):u),l+=dS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)jx(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Og(e[t],this.toBBox)}};function Tae(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function Og(i,e){Wx(i,0,i.children.length,e,i)}function Wx(i,e,t,n,r){r||(r=Bg(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];jx(r,i.leaf?n(o):o)}return r}function jx(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function Eae(i,e){return i.minX-e.minX}function Mae(i,e){return i.minY-e.minY}function o5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function dS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Cae(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function Rae(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function a5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function pS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Bg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function nq(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;fS(i,o,e,t,r),s.push(e,o,o,t)}}var nA=0,mS=0,Fo=1<<nA++,ri=1<<nA++,Oo=1<<nA++,sa=1<<nA++,lf=1<<nA++,tA=1<<nA++,gS=Math.pow(2,nA)-1,c5={[Fo]:"boolean",[ri]:"number",[Oo]:"string",[sa]:"color",[lf]:"number[]",[tA]:"size"},Pae=Object.keys(c5).map(Number).sort(Ua);function Iae(i){return i in c5}function af(i){let e=[];for(let t of Pae)Xx(i,t)&&e.push(c5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Xx(i,e){return(i&e)===e}function AS(i,e){return!!(i&e)}function Md(i,e){return i===e}var Cr=class{constructor(e,t){if(!Iae(e))throw new Error(`literal expressions must have a specific type, got ${af(e)}`);this.type=e,this.value=t}},_S=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function xS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Hr(i,e,t){switch(typeof i){case"boolean":{if(Md(e,Oo))return new Cr(Oo,i?"true":"false");if(!Xx(e,Fo))throw new Error(`got a boolean, but expected ${af(e)}`);return new Cr(Fo,i)}case"number":{if(Md(e,tA))return new Cr(tA,Vr(i));if(Md(e,Fo))return new Cr(Fo,!!i);if(Md(e,Oo))return new Cr(Oo,i.toString());if(!Xx(e,ri))throw new Error(`got a number, but expected ${af(e)}`);return new Cr(ri,i)}case"string":{if(Md(e,sa))return new Cr(sa,Px(i));if(Md(e,Fo))return new Cr(Fo,!!i);if(!Xx(e,Oo))throw new Error(`got a string, but expected ${af(e)}`);return new Cr(Oo,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return qae(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Md(e,tA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Cr(tA,i)}if(Md(e,sa)){if(i.length===3)return new Cr(sa,[...i,1]);if(i.length===4)return new Cr(sa,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Xx(e,lf))throw new Error(`got an array of numbers, but expected ${af(e)}`);return new Cr(lf,i)}var Je={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},Nae={[Je.Get]:Dn(Yn(1,1/0),iq),[Je.Var]:Lae(),[Je.Has]:Dn(Yn(1,1/0),iq),[Je.Id]:Dn(Dae,Ug),[Je.Concat]:Dn(Yn(2,1/0),ki(Oo)),[Je.GeometryType]:Dn(Fae,Ug),[Je.LineMetric]:Dn(Oae,Ug),[Je.Resolution]:Dn(l5,Ug),[Je.Zoom]:Dn(l5,Ug),[Je.Time]:Dn(l5,Ug),[Je.Any]:Dn(Yn(2,1/0),ki(Fo)),[Je.All]:Dn(Yn(2,1/0),ki(Fo)),[Je.Not]:Dn(Yn(1,1),ki(Fo)),[Je.Equal]:Dn(Yn(2,2),sq()),[Je.NotEqual]:Dn(Yn(2,2),sq()),[Je.GreaterThan]:Dn(Yn(2,2),ki(ri)),[Je.GreaterThanOrEqualTo]:Dn(Yn(2,2),ki(ri)),[Je.LessThan]:Dn(Yn(2,2),ki(ri)),[Je.LessThanOrEqualTo]:Dn(Yn(2,2),ki(ri)),[Je.Multiply]:Dn(Yn(2,1/0),rq),[Je.Coalesce]:Dn(Yn(2,1/0),rq),[Je.Divide]:Dn(Yn(2,2),ki(ri)),[Je.Add]:Dn(Yn(2,1/0),ki(ri)),[Je.Subtract]:Dn(Yn(2,2),ki(ri)),[Je.Clamp]:Dn(Yn(3,3),ki(ri)),[Je.Mod]:Dn(Yn(2,2),ki(ri)),[Je.Pow]:Dn(Yn(2,2),ki(ri)),[Je.Abs]:Dn(Yn(1,1),ki(ri)),[Je.Floor]:Dn(Yn(1,1),ki(ri)),[Je.Ceil]:Dn(Yn(1,1),ki(ri)),[Je.Round]:Dn(Yn(1,1),ki(ri)),[Je.Sin]:Dn(Yn(1,1),ki(ri)),[Je.Cos]:Dn(Yn(1,1),ki(ri)),[Je.Atan]:Dn(Yn(1,2),ki(ri)),[Je.Sqrt]:Dn(Yn(1,1),ki(ri)),[Je.Match]:Dn(Yn(4,1/0),oq,Uae),[Je.Between]:Dn(Yn(3,3),ki(ri)),[Je.Interpolate]:Dn(Yn(6,1/0),oq,kae),[Je.Case]:Dn(Yn(3,1/0),Bae,Gae),[Je.In]:Dn(Yn(2,2),zae),[Je.Number]:Dn(Yn(1,1/0),ki(gS)),[Je.String]:Dn(Yn(1,1/0),ki(gS)),[Je.Array]:Dn(Yn(1,1/0),ki(ri)),[Je.Color]:Dn(Yn(1,4),ki(ri)),[Je.Band]:Dn(Yn(1,3),ki(ri)),[Je.Palette]:Dn(Yn(2,2),Vae),[Je.ToString]:Dn(Yn(1,1),ki(Fo|ri|Oo|sa))};function iq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new Cr(ri,o);break}case"string":{r[s]=new Cr(Oo,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function Lae(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=Hr(s,gS,t);if(!(o instanceof Cr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&AS(r,sa)&&!AS(r,Oo)?a=sa:Array.isArray(s)&&s.length===2&&AS(r,tA)&&!AS(r,lf)&&(a=tA),r&=a,r===mS)throw new Error(`the type expected from the var operator (${af(e)}) did not have any overlap with the type of the corresponding style variables (${af(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===mS)throw new Error(`a new type expected from the var operator (${af(e)}) did not have any overlap with the previous type expected for it (${af(o)}), variable name: ${n}`)}return t.variables.set(n,r),new _S(r,"var",new Cr(Oo,n))}}function Dae(i,e,t){t.featureId=!0}function Fae(i,e,t){t.geometryType=!0}function Oae(i,e,t){t.mCoordinate=!0}function l5(i,e,t){t.mapState=!0}function Ug(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Yn(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function rq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Hr(i[s+1],e,t);r[s]=o}return r}function ki(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Hr(e[o+1],i,n);s[o]=a}return s}}function sq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=gS;for(let a=0;a<r;++a){let l=Hr(i[a+1],o,t);o&=l.type}if(o===mS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Hr(i[a+1],o,t);s[a]=l}return s}}function Bae(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function oq(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function Uae(i,e,t){let n=i.length-1,r=Hr(i[i.length-1],e,t),s=Oo|ri|Fo,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Hr(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===mS)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=Hr(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=Hr(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[Hr(i[1],s,t),...o,r]}function kae(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new Cr(ri,r),o;try{o=Hr(i[2],ri,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=Hr(i[l+3],ri,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=Hr(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function Gae(i,e,t){let n=Hr(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=Hr(i[s+1],Fo,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Hr(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function zae(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=Oo:r=ri;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Hr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Hr(i[1],r,t),...s]}function Vae(i,e,t){let n;try{n=Hr(i[1],ri,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=Hr(r[o],sa,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Cr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Dn(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new _S(t,r,...s)}}function qae(i,e,t){let n=i[0],r=Nae[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function yS(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return yS(i.getGeometries()[0]);default:return""}}function u5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Dc(i,e,t){let n=Hr(i,e,t);return Lc(n,t)}function Lc(i,e){if(i instanceof Cr){if(i.type===sa&&typeof i.value=="string"){let n=Px(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case Je.Number:case Je.String:case Je.Coalesce:return Hae(i,e);case Je.Get:case Je.Var:case Je.Has:return Wae(i,e);case Je.Id:return n=>n.featureId;case Je.GeometryType:return n=>n.geometryType;case Je.Concat:{let n=i.args.map(r=>Lc(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case Je.Resolution:return n=>n.resolution;case Je.Any:case Je.All:case Je.Between:case Je.In:case Je.Not:return Xae(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return jae(i,e);case Je.Multiply:case Je.Divide:case Je.Add:case Je.Subtract:case Je.Clamp:case Je.Mod:case Je.Pow:case Je.Abs:case Je.Floor:case Je.Ceil:case Je.Round:case Je.Sin:case Je.Cos:case Je.Atan:case Je.Sqrt:return $ae(i,e);case Je.Case:return Yae(i,e);case Je.Match:return Zae(i,e);case Je.Interpolate:return Kae(i,e);case Je.ToString:return Qae(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function Hae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case Je.Number:case Je.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function Wae(i,e){let n=i.args[0].value;switch(i.operator){case Je.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case Je.Var:return r=>r.variables[n];case Je.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function jae(i,e){let t=i.operator,n=Lc(i.args[0],e),r=Lc(i.args[1],e);switch(t){case Je.Equal:return s=>n(s)===r(s);case Je.NotEqual:return s=>n(s)!==r(s);case Je.LessThan:return s=>n(s)<r(s);case Je.LessThanOrEqualTo:return s=>n(s)<=r(s);case Je.GreaterThan:return s=>n(s)>r(s);case Je.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function Xae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case Je.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case Je.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case Je.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case Je.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function $ae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case Je.Divide:return s=>r[0](s)/r[1](s);case Je.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case Je.Subtract:return s=>r[0](s)-r[1](s);case Je.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case Je.Mod:return s=>r[0](s)%r[1](s);case Je.Pow:return s=>Math.pow(r[0](s),r[1](s));case Je.Abs:return s=>Math.abs(r[0](s));case Je.Floor:return s=>Math.floor(r[0](s));case Je.Ceil:return s=>Math.ceil(r[0](s));case Je.Round:return s=>Math.round(r[0](s));case Je.Sin:return s=>Math.sin(r[0](s));case Je.Cos:return s=>Math.cos(r[0](s));case Je.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case Je.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function Yae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function Zae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function Kae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),p=Array.isArray(f);if(p&&(f=Lz(f)),u>=o)return c===2?f:p?Jae(s,o,a,l,u,f):$x(s,o,a,l,u,f);a=u,l=f}return l}}function Qae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===sa?Ix(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function $x(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function Jae(i,e,t,n,r,s){if(r-t===0)return n;let a=KP(n),l=KP(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[$x(i,e,t,a[0],r,l[0]),$x(i,e,t,a[1],r,l[1]),a[2]+$x(i,e,t,0,r,c),$x(i,e,t,n[3],r,s[3])];return Dz(u)}function ele(i){return!0}function tle(i,e){e=e??xS();let t=nle(i,e),n=u5();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=yS(r.getGeometry())),t(n)}}function aq(i,e){e=e??xS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=h5(i[o],e);let r=u5(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=yS(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function hq(i,e){if(e=e??xS(),!Array.isArray(i))return aq([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return tle(s,e)}return aq(i,e)}function nle(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Dc(s.filter,Fo,e):ele,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=h5(s.style[c],e)}else a=[h5(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function h5(i,e){let t=Yx(i,"",e),n=Zx(i,"",e),r=ile(i,e),s=rle(i,e),o=fo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!bc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Fs;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function Yx(i,e,t){let n;if(e+"fill-pattern-src"in i)n=lle(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=bS(i,e+"fill-color",t)}if(!n)return null;let r=new qr;return function(s){let o=n(s);return o===qw?null:(r.setColor(o),r)}}function Zx(i,e,t){let n=fo(i,e+"stroke-width",t),r=bS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=cf(i,e+"stroke-line-cap",t),o=cf(i,e+"stroke-line-join",t),a=fq(i,e+"stroke-line-dash",t),l=fo(i,e+"stroke-line-dash-offset",t),c=fo(i,e+"stroke-miter-limit",t),u=fo(i,e+"stroke-offset",t),f=new Ys;return function(p){if(r){let x=r(p);if(x===qw)return null;f.setColor(x)}if(n&&f.setWidth(n(p)),s){let x=s(p);if(x!=="butt"&&x!=="round"&&x!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(x)}if(o){let x=o(p);if(x!=="bevel"&&x!=="round"&&x!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(x)}return a&&f.setLineDash(a(p)),l&&f.setLineDashOffset(l(p)),c&&f.setMiterLimit(c(p)),u&&f.setOffset(u(p)),f}}function ile(i,e){let t="text-",n=cf(i,t+"value",e);if(!n)return null;let r=Yx(i,t,e),s=Yx(i,t+"background-",e),o=Zx(i,t,e),a=Zx(i,t+"background-",e),l=cf(i,t+"font",e),c=fo(i,t+"max-angle",e),u=fo(i,t+"offset-x",e),f=fo(i,t+"offset-y",e),p=kg(i,t+"overflow",e),x=cf(i,t+"placement",e),v=fo(i,t+"repeat",e),w=wS(i,t+"scale",e),S=kg(i,t+"rotate-with-view",e),T=fo(i,t+"rotation",e),P=cf(i,t+"align",e),R=cf(i,t+"justify",e),C=cf(i,t+"baseline",e),L=kg(i,t+"keep-upright",e),D=fq(i,t+"padding",e),F=SS(i,t+"declutter-mode"),N=new sf({declutterMode:F});return function(B){if(N.setText(n(B)),r&&N.setFill(r(B)),s&&N.setBackgroundFill(s(B)),o&&N.setStroke(o(B)),a&&N.setBackgroundStroke(a(B)),l&&N.setFont(l(B)),c&&N.setMaxAngle(c(B)),u&&N.setOffsetX(u(B)),f&&N.setOffsetY(f(B)),p&&N.setOverflow(p(B)),x){let z=x(B);if(z!=="point"&&z!=="line")throw new Error("Expected point or line for text-placement");N.setPlacement(z)}if(v&&N.setRepeat(v(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),P){let z=P(B);if(z!=="left"&&z!=="center"&&z!=="right"&&z!=="end"&&z!=="start")throw new Error("Expected left, right, center, start, or end for text-align");N.setTextAlign(z)}if(R){let z=R(B);if(z!=="left"&&z!=="right"&&z!=="center")throw new Error("Expected left, right, or center for text-justify");N.setJustify(z)}if(C){let z=C(B);if(z!=="bottom"&&z!=="top"&&z!=="middle"&&z!=="alphabetic"&&z!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");N.setTextBaseline(z)}return D&&N.setPadding(D(B)),L&&N.setKeepUpright(L(B)),N}}function rle(i,e){return"icon-src"in i?sle(i,e):"shape-points"in i?ole(i,e):"circle-radius"in i?ale(i,e):null}function sle(i,e){let t="icon-",n=t+"src",r=dq(i[n],n),s=vS(i,t+"anchor",e),o=wS(i,t+"scale",e),a=fo(i,t+"opacity",e),l=vS(i,t+"displacement",e),c=fo(i,t+"rotation",e),u=kg(i,t+"rotate-with-view",e),f=cq(i,t+"anchor-origin"),p=uq(i,t+"anchor-x-units"),x=uq(i,t+"anchor-y-units"),v=uf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=bS(i,t+"color",e):w=pq(v,t+"color"));let T=ule(i,t+"cross-origin"),P=hle(i,t+"offset"),R=cq(i,t+"offset-origin"),C=f5(i,t+"width"),L=f5(i,t+"height"),D=cle(i,t+"size"),F=SS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:P,offsetOrigin:R,height:L,width:C,size:D,declutterMode:F},B=null;return function(z){if(B)S&&B.setColor(S(z));else{let V=S?S(z):w;B=new Y0(V!==void 0?Object.assign({},N,{color:V}):Object.assign({},N))}return a&&B.setOpacity(a(z)),l&&B.setDisplacement(l(z)),c&&B.setRotation(c(z)),u&&B.setRotateWithView(u(z)),o&&B.setScale(o(z)),s&&B.setAnchor(s(z)),B}}function ole(i,e){let t="shape-",n=t+"points",r=t+"radius",s=d5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=fo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=fo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=Yx(i,t,e),p=Zx(i,t,e),x=wS(i,t+"scale",e),v=vS(i,t+"displacement",e),w=fo(i,t+"rotation",e),S=kg(i,t+"rotate-with-view",e),T=f5(i,t+"angle"),P=SS(i,t+"declutter-mode"),R=new Yw({points:s,radius:a,radius2:u,angle:T,declutterMode:P});return function(C){return o&&R.setRadius(o(C)),c&&R.setRadius2(c(C)),f&&R.setFill(f(C)),p&&R.setStroke(p(C)),v&&R.setDisplacement(v(C)),w&&R.setRotation(w(C)),S&&R.setRotateWithView(S(C)),x&&R.setScale(x(C)),R}}function ale(i,e){let t="circle-",n=Yx(i,t,e),r=Zx(i,t,e),s=fo(i,t+"radius",e),o=wS(i,t+"scale",e),a=vS(i,t+"displacement",e),l=fo(i,t+"rotation",e),c=kg(i,t+"rotate-with-view",e),u=SS(i,t+"declutter-mode"),f=new Zw({radius:5,declutterMode:u});return function(p){return s&&f.setRadius(s(p)),n&&f.setFill(n(p)),r&&f.setStroke(r(p)),a&&f.setDisplacement(a(p)),l&&f.setRotation(l(p)),c&&f.setRotateWithView(c(p)),o&&f.setScale(o(p)),f}}function uf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function fo(i,e,t){let n=uf(i,e);if(n===void 0)return;let r=Dc(n,ri,t);return function(s){return d5(r(s),e)}}function cf(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,Oo,t);return function(s){return dq(r(s),e)}}function lle(i,e,t){let n=cf(i,e+"pattern-src",t),r=lq(i,e+"pattern-offset",t),s=lq(i,e+"pattern-size",t),o=bS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function kg(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,Fo,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function bS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,sa,t);return function(s){return pq(r(s),e)}}function fq(i,e,t){let n=uf(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Dc(o,ri,t);return function(c){return d5(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Dc(n,lf,t);return function(s){return Kx(r(s),e)}}function vS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf,t);return function(s){let o=Kx(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function lq(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf,t);return function(s){return Aq(r(s),e)}}function wS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf|ri,t);return function(s){return fle(r(s),e)}}function f5(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function cle(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return Vr(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function ule(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function cq(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function uq(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function hle(i,e){let t=i[e];if(t!==void 0)return Kx(t,e)}function SS(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function Kx(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function dq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function d5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function pq(i,e){if(typeof i=="string")return i;let t=Kx(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function Aq(i,e){let t=Kx(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function fle(i,e){return typeof i=="number"?i:Aq(i,e)}var mq={RENDER_ORDER:"renderOrder"},p5=class extends J0{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(mq.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new eA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(mq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?uI:e;let t=dle(e);this.styleFunction_=e===null?void 0:jz(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function dle(i){if(i===void 0)return uI;if(!i)return null;if(typeof i=="function"||i instanceof Fs)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Fs){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Fs))throw new Error("Expected a list of style instances");n[r]=s}return n}return hq(i)}var TS=p5;var A5=class extends Xs{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},ES=A5;var m5=class extends Ad{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){$n()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;lo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Tw(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(C,L,D,F){return s.call(o,L,C?D:null,F)}let p=u.projection,x=aw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=Wn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],P=[];for(let C=0;C<v.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&qx(D,u)&&a.call(l,F)){let N=F.getRenderer(),B=F.getSource();if(N&&B){let z=B.getWrapX()?x:e,V=f.bind(null,D.managed);P[0]=z[0]+v[C][0],P[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(P,t,n,V,T)}if(c)return c}}if(T.length===0)return;let R=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*R),T.sort((C,L)=>C.distanceSq-L.distanceSq),T.some(C=>c=C.callback(C.feature,C.layer,C.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Zh,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){$n()}scheduleExpireIconCache(e){Lo.canExpireCache()&&e.postRenderFunctions.push(ple)}};function ple(i,e){Lo.expire()}var gq=m5;var g5=class extends gq{constructor(e){super(e),this.fontChangeListenerKey_=Un(X0,Mc.PROPERTYCHANGE,e.redrawText,e),this.element_=Ls?bw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=bd+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new ES(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ii(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(ho.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof TS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;cl(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let p=t[u];e.layerIndex=u;let x=p.layer,v=x.getSourceState();if(!qx(p,r)||v!="ready"&&v!="undefined"){x.unrender();continue}let w=x.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(p))}this.declutter(e,l),UG(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!cl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!cl(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let v=f.style.transform;if(v)a.transform(...Sw(v));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(ho.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},_q=g5;function xq(i){if(i instanceof J0){i.setMapInternal(null);return}i instanceof Vx&&i.getLayers().forEach(xq)}function yq(i,e){if(i instanceof J0){i.setMapInternal(e);return}if(i instanceof Vx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)yq(t[n],e)}}var _5=class extends gs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=Ale(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:NG,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=$s(),this.pixelToCoordinateTransform_=$s(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Ls||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,Ls||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Ls?new co:rS()),this.interactions=t.interactions||(Ls?new co:uS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new CV(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(uo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(uo.VIEW,this.handleViewChanged_),this.addChangeListener(uo.SIZE,this.handleSizeChanged_),this.addChangeListener(uo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof ul)&&e.view.then(function(r){n.setView(new ul(r))}),this.controls.addEventListener(Zs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Zs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Zs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Zs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Zs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Zs.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){yq(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Zh,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof Vx?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:Zh,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(uo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Ax(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Mr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(uo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof co){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=Sc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Mr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(uo.SIZE)}getView(){return this.get(uo.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return RV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Cu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===kx.POINTERDOWN||n===Jt.WHEEL||n===Jt.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[Os.ANIMATING]||o[Os.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(ho.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(ho.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Sd(Ru.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Sd(Ru.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)ii(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!cl(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(cl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new _q(this)),!cl(t)){this.mapBrowserEventHandler_=new EV(this,this.moveTolerance_);for(let r in nr)this.mapBrowserEventHandler_.addEventListener(nr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,vw?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[Un(n,Jt.KEYDOWN,this.handleBrowserEvent,this),Un(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!cl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(ii(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ii(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=Un(e,Mc.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Un(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ii),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Nc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[Un(e,Mc.PROPERTYCHANGE,this.render,this),Un(e,Jt.CHANGE,this.render,this),Un(e,"addlayer",this.handleLayerAdd_,this),Un(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){xq(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&J4(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:hx(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Nn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=hx(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!mu(this.previousExtent_)&&!I0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Sd(Ru.MOVESTART,this,r)),this.previousExtent_=P0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Os.ANIMATING]&&!s.viewHints[Os.INTERACTING]&&!I0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Sd(Ru.MOVEEND,this,s)),Jb(s.extent,this.previousExtent_))),this.dispatchEvent(new Sd(Ru.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Ru.LOADSTART)||this.hasListener(Ru.LOADEND)||this.hasListener(ho.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Nc("removelayer",t)),this.set(uo.LAYERGROUP,e)}setSize(e){this.set(uo.SIZE,e)}setTarget(e){this.set(uo.TARGET,e)}setView(e){if(!e||e instanceof ul){this.set(uo.VIEW,e);return}this.set(uo.VIEW,new ul);let t=this;e.then(function(n){t.setView(new ul(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(cl(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!J4(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&rw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Io(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function Ale(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new Vx({layers:i.layers});t[uo.LAYERGROUP]=n,t[uo.TARGET]=i.target,t[uo.VIEW]=i.view instanceof ul?i.view:new ul;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new co(i.controls.slice()):(zn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new co(i.interactions.slice()):(zn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new co(i.overlays.slice()):(zn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new co,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var vq=_5;function MS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var mle=new Error("disposed");var gle=[256,256],x5=class extends gg{constructor(e){let t=rn.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=MS(this.data_);return e?[e.width,e.height]:gle}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==rn.IDLE&&this.state!==rn.ERROR)return;this.state=rn.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=rn.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=rn.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(mle),this.controller_=null),super.disposeInternal()}},y5=x5;var v5=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Ad&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return zn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return zn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){zn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},b5=v5;var w5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(_x(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},CS=w5;var _le=5,S5=class extends Mw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=_le,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return $n()}getData(e){return null}prepareFrame(e){return $n()}renderFrame(e,t){return $n()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mn.LOADED||t.getState()===Mn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mn.LOADED&&t!=Mn.ERROR&&e.addEventListener(Jt.CHANGE,this.boundHandleImageChange_),t==Mn.IDLE&&(e.load(),t=e.getState()),t==Mn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},bq=S5;var E5=[],Gg=null;function xle(){Gg=Si(1,1,void 0,{willReadFrequently:!0})}var T5=class extends bq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=$s(),this.pixelTransform=$s(),this.inversePixelTransform=$s(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Gg||xle(),Gg.clearRect(0,0,1,1);let r;try{Gg.drawImage(e,t,n,1,1,0,0,1,1),r=Gg.getImageData(0,0,1,1).data}catch{return Gg=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(cl(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&Io(Wl(e.style.backgroundColor),Wl(n)))){let c=e.firstElementChild;cl(c)&&(l=c.getContext("2d"))}if(l&&WG(l.canvas.style.transform,t)?(this.container=e,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=Ls?bw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Si();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=zl(n),s=rg(n),o=ig(n),a=ng(n);Mr(t.coordinateToPixelTransform,r),Mr(t.coordinateToPixelTransform,s),Mr(t.coordinateToPixelTransform,o),Mr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Mr(l,r),Mr(l,s),Mr(l,o),Mr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Wn(n)/r*o),l=Math.round(gr(n)/r*o);lo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Tw(this.inversePixelTransform,this.pixelTransform);let c=HG(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new ES(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(ho.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(ho.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new CS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(ho.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(ho.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,p=-e[0]+a,x=-e[1];return lo(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},RS=T5;function M5(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function yle(i,e,t){let n=i[t];return n?n.delete(e):!1}function wq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Au(e,Tc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=Au(e,r))}return e}var C5=class extends RS{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Er(),this.tempTileRange_=new mw(0,0,0,0),this.tempTileCoord_=dg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new b5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new b5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=pg(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||ug(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=Mr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!xc(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),p=this.getTile(u,f[1],f[2],t);if(!p||p.getState()!==rn.LOADED)continue;let x=l.getOrigin(u),v=Vr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof ww||p instanceof Ew)S=p.getImage();else if(p instanceof y5){if(S=MS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),P=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),R=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+R,P+R)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Nn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],p=a.getMapInternal(),x=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),p?p.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),v=o.rotation,w=v?U4(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),P=c.getResolution(S);for(let R=T.minX;R<=T.maxX;++R)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,R,C],w))continue;let L=this.getTile(S,R,C,e);if(!L||!M5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=dg(S,R,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),P])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=pg(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===rn.LOADED)return u.endTransition(Nn(this)),M5(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let p=pg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(M5(r,v,n),x=!0)}x||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),p=f.getZForResolution(o,u.zDirection),x=f.getResolution(p);this.updateStaleKeys(u.getKey());let v=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?Tc(n.extent,s):null,this.layerExtent&&(v=Au(v,this.layerExtent));let P=x*S/2/w,R=x*T/2/w,C=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let K=f.getZForResolution(r.nextResolution,u.zDirection),ee=wq(e,e.nextExtent);this.enqueueTiles(e,ee,K,L,D)}let F=wq(e,v);if(this.enqueueTiles(e,F,p,L,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,F,p-1,L,D-1)},0),!(p in L))return this.container;let N=Nn(this),B=e.time;for(let K of L[p]){let ee=K.getState();if(ee===rn.EMPTY)continue;let ae=K.tileCoord;if(ee===rn.LOADED&&K.getAlpha(N,B)===1){K.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){yle(L,K,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let ve=f.getMinZoom();for(let Ie=p-1;Ie>=ve&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);lo(this.tempTransform,S/2,T/2,z,z,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(V,e,this.layerExtent),u.getInterpolate()||(V.imageSmoothingEnabled=!1),this.preRender(V,e);let H=Object.keys(L).map(Number);H.sort(Ua);let Z=[],J=[],j=[];for(let K=H.length-1;K>=0;--K){let ee=H[K],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,ve=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(zl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Mr(this.tempTransform,[w*(Ue[0]-C[0])/x,w*(C[3]-Ue[3])/x]),Me=w*u.getGutterForProjection(s);for(let ze of L[ee]){if(ze.getState()!==rn.LOADED)continue;let $e=ze.tileCoord,Et=Qe[1]-$e[1],Tt=Math.round(mt[0]-(Et-1)*ve),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*ve),Xe=Math.round(mt[1]-Ct*Ie),st=Tt-Gt,tt=un-Xe,vt=ee===p;if(vt&&ze.inTransition(N)){j.push({tile:ze,x:Gt,y:Xe,w:st,h:tt,gutter:Me}),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze);continue}let yt=[Gt,Xe,Gt+st,Xe+tt],ln=[];for(let Qt=0,xn=Z.length;Qt<xn;++Qt)ee<J[Qt]&&_r(yt,Z[Qt])&&ln.push(Z[Qt]);let Kt;ln.length>0&&(Kt=G9(yt,ln)),Z.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Kt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let K=0,ee=j.length;K<ee;++K){let{tile:ae,x:ce,y:de,w:ve,h:Ie,gutter:Qe}=j[K];this.drawTile(ae,e,ce,de,ve,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!I0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let K=(ee,ae)=>{let ce=Nn(u),de=ae.wantedTiles[ce],ve=de?Object.keys(de).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(K)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof y5){if(u=MS(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),p=Nn(this),x=t.layerStatesArray[t.layerIndex],v=x.opacity*(l?e.getAlpha(p,t.time):1),w=v!==f.globalAlpha;w&&(f.save(),f.globalAlpha=v);let S=u.width-2*a,T=u.height-2*a;if(c){let P=S/s,R=T/o;for(let C=0,L=c.length;C<L;++C){let D=c[C],F=D[0],N=D[1],B=D[2]-D[0],z=D[3]-D[1];f.drawImage(u,a+(F-n)*P,a+(N-r)*R,B*P,z*R,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),v!==x.opacity?t.animate=!0:l&&e.endTransition(p)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Nn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Sq=C5;var Qx={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var R5=class extends J0{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Qx.PRELOAD)}setPreload(e){this.set(Qx.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Qx.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Qx.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},Tq=R5;var P5=class extends Tq{constructor(e){super(e)}createRenderer(){return new Sq(this,{cacheSize:this.getCacheSize()})}},I5=P5;var N5=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},PS=N5;var Jx={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},ey=[Jx.FILL],Nu=[Jx.STROKE],hf=[Jx.BEGIN_PATH],L5=[Jx.CLOSE_PATH],An=Jx;var D5=class extends PS{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],xc(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],p=this.tmpCoordinate_,x=!0,v,w,S;for(v=t+r;v<n;v+=r)p[0]=e[v],p[1]=e[v+1],S=Qb(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===As.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||v===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,p,x;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),p=[];let v=e.getEndss();x=0;for(let w=0,S=v.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,v[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,yx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,yx,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),x=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([An.CUSTOM,l,f,e,n,vg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,vg,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([An.CUSTOM,l,u,e,n,yu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,yu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,yu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,yu,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([An.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[An.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[An.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==An.END_GEOMETRY?o=t:s==An.BEGIN_GEOMETRY&&(r[2]=t,_G(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=Ga(n||Ds)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=Ga(n||Do);let r=e.getLineCap();t.lineCap=r!==void 0?r:Eu;let s=e.getLineDash();t.lineDash=s?s.slice():za;let o=e.getLineDashOffset();t.lineDashOffset=o||Va;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Mu;let l=e.getWidth();t.lineWidth=l!==void 0?l:rf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:tf;let u=e.getOffset();t.strokeOffset=u??Uz,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[An.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[An.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!Io(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[An.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Jb(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;eg(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Lu=D5;var F5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!xc(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([An.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([An.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||xc(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([An.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([An.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Eq=F5;var O5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([An.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va],hf);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Nu),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va],hf);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinates_(c,f,l[p],u,a);this.hitDetectionInstructions.push(Nu),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Nu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Nu),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(hf)}},Mq=O5;var B5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(hf),this.hitDetectionInstructions.push(hf);for(let u=0;u<c;++u){let f=n[u],p=this.coordinates.length,x=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([An.MOVE_TO_LINE_TO,p,x,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,p,x,s,!0]),l&&(this.instructions.push(L5),this.hitDetectionInstructions.push(L5)),t=f}return a&&(this.instructions.push(ey),this.hitDetectionInstructions.push(ey)),l&&(this.instructions.push(Nu),this.hitDetectionInstructions.push(Nu)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[An.CIRCLE,u,a];this.instructions.push(hf,f),this.hitDetectionInstructions.push(hf,f),r.fillStyle!==void 0&&(this.instructions.push(ey),this.hitDetectionInstructions.push(ey)),r.strokeStyle!==void 0&&(this.instructions.push(Nu),this.hitDetectionInstructions.push(Nu)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinatess_(c,f,l[p],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=_d(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},U5=B5;var k5=0,G5=1;function vle(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let p=(i-r)/l,x=(t-r)/l;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let p=(e-s)/c,x=(n-s)/c;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return k5=u,G5=f,!0}function Cq(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,p,x=0;for(let v=0,w=e.length;v<w;++v){let S=e[v],T=i[x],P=i[x+1],R=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if(vle(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+k5*F,z=P+k5*N,V=T+G5*F,H=P+G5*N;u&&R&&B===f&&z===p?l.push(V,H):(u&&c.push(l.length),l.push(B,z,V,H),u=!0),f=V,p=H,R=!0}T=L,P=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function Rq(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],p=e[o+r+1],x=Math.sqrt((f-c)*(f-c)+(p-u)*(p-u));if(a+=x,a>=i){let v=(i-a+x)/x,w=Po(c,f,v),S=Po(u,p,v);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let v=x-a,w=Po(c,f,v/x),S=Po(u,p,v/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function Pq(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,P,R;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(P=C-v,R=L-w,x=Math.sqrt(P*P+R*R),S!==void 0&&(l+=p,u=Math.acos((S*P+T*R)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=P,T=R),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var ty={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},z5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Ds]={fillStyle:Ds},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let p=e.getExtent();if(!_r(this.maxExtent,p))return;let x;if(u=e.getFlatCoordinates(),c=="LineString")x=[u.length];else if(c=="MultiLineString")x=e.getEnds();else if(c=="Polygon")x=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();x=[];for(let P=0,R=T.length;P<R;++P)x.push(T[P][0])}if((c=="LineString"||c=="MultiLineString")&&!pu(this.getBufferedMaxExtent(),p)){let T=Cq(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let v=o.repeat,w=v?void 0:o.textAlign,S=0;for(let T=0,P=x.length;T<P;++T){let R;v?R=Rq(v*this.resolution,u,S,x[T],f):R=[u.slice(S,x[T])];for(let C=0,L=R.length;C<L;++C){let D=R[C],F=0,N=D.length;if(w==null){let z=Pq(o.maxAngle,D,0,D.length,2);F=z[0],N=z[1]}for(let z=F;z<N;z+=f)a.push(D[z],D[z+1]);let B=a.length;S=x[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let p=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||p.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let C=e.getFlatInteriorPoints();u=[];for(let L=0,D=C.length;L<D;L+=3)o.overflow||p.push(C[L+2]/this.resolution),u.push(C[L],C[L+1]);if(u.length===0)return;f=2;break;default:}let x=this.appendFlatPointCoordinates(u,f);if(x===l)return;if(p&&(x-l)/2!==u.length/f){let C=l/2;p=p.filter((L,D)=>{let F=a[(C+D)*2]===u[D*f]&&a[(C+D)*2+1]===u[D*f+1];return F||--C,F})}this.saveTextStates_();let v=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=nf&&(o.scale[0]<0||o.scale[1]<0)){let C=o.padding[0],L=o.padding[1],D=o.padding[2],F=o.padding[3];o.scale[0]<0&&(L=-L,F=-F),o.scale[1]<0&&(C=-C,D=-D),S=[C,L,D,F]}let T=this.pixelRatio;this.instructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==nf?nf:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let P=1/T,R=v?v.slice(0):null;R&&(R[1]=Ds),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[P,P],NaN,this.declutterMode_,this.declutterImageWithText_,S,R,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Ds:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||wd,justify:t.justify,textBaseline:t.textBaseline||$0,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=ty[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,p=this.text_,x=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,x*l,p,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a&&Ds,r.maxAngle,l,f,s,x*l,p,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Ga(o.getColor()||Ds)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),P=a.getMiterLimit();s.lineCap=a.getLineCap()||Eu,s.lineDash=w?w.slice():za,s.lineDashOffset=S===void 0?Va:S,s.lineJoin=a.getLineJoin()||Mu,s.lineWidth=T===void 0?rf:T,s.miterLimit=P===void 0?tf:P,s.strokeStyle=Ga(a.getColor()||Do)}n=this.textState_;let l=e.getFont()||Xw;kz(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||$0,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||nf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),v=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=p===void 0?!1:p,this.textKeepUpright_=x===void 0?!0:x,this.textRotation_=v===void 0?0:v,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Nn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Nn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Iq=z5;var ble={Circle:U5,Default:Lu,Image:Eq,LineString:Mq,Polygon:U5,Text:Iq},V5=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=ble[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},Nq=V5;function Lq(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}function IS(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],p,x,v,w,S,T,P,R,C=0;for(let L=e;L<t;L+=n){v=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(v=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[P,R]=wle(p,x,v,w,S,T,r),o[C++]=P,o[C++]=R;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function wle(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let p=X9([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),v=Math.sin(p/2),w=v*a+x*l,S=-x*a+v*l,T=w*(1/v),P=S*(1/v);return[i+T*o,e+P*o]}function NS(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],p=i[o+1],x=i[o+e],v=i[o+e+1],w=(v-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(v-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let P=a+S*(c-a),R=l+S*(u-l);i[n+e]=P,i[n+e+1]=R,i.splice(n+2*e,o-n-e);break}}}return i}var q5;function Sle(){return q5||(q5=new Intl.Segmenter(void 0,{granularity:"grapheme"})),q5}function Dq(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],v=i[e+1],w=0,S=0,T=0,P=0;function R(){w=x,S=v,e+=n,x=i[e],v=i[e+1],P+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do R();while(e<t-n&&P+T<s);let C=T===0?0:(s-P)/T,L=Po(w,x,C),D=Po(S,v,C),F=e-n,N=P,B=s+a*l(c,r,u);for(;e<t-n&&P+T<B;)R();C=T===0?0:(B-P)/T;let z=Po(w,x,C),V=Po(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Nw(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let Z=Math.PI,J=[],j=F+n===e;e=F,T=0,P=N,x=i[e],v=i[e+1];let K;if(j){R(),K=Math.atan2(v-S,x-w),H&&(K+=K>0?-Z:Z);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,K,r],J}r=r.replace(/\n/g," ");let ee=Array.from(Sle().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){R();let de=Math.atan2(v-S,x-w);if(H&&(de+=de>0?-Z:Z),K!==void 0){let Me=de-K;if(Me+=Me>Z?-2*Z:Me<-Z?2*Z:0,Math.abs(Me)>o)return null}K=de;let ve=ae,Ie=0;for(;ae<ce;++ae){let Me=H?ce-ae-1:ae,ze=a*l(c,ee[Me],u);if(e+n<t&&P+T<s+Ie+ze/2)break;Ie+=ze}if(ae===ve)continue;let Qe=(H?ee.slice(ce-ae,ce-ve):ee.slice(ve,ae)).join("");C=T===0?0:(s+Ie/2-P)/T;let Ue=Po(w,x,C),mt=Po(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var zg=Er(),Cd=[],ff=[],df=[],Rd=[];function Fq(i){return i[3].declutterBox}var Oq=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function H5(i,e){return e==="start"?e=Oq.test(i)?"right":"left":e==="end"&&(e=Oq.test(i)?"left":"right"),ty[e]}function Tle(i,e,t){return t>0&&i.push(`7+`,""),i.push(e,""),i}function Ele(i,e,t){return t%2===0&&(i+=e),i}var W5=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=$s(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new CS:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let s=e+t+n+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,u=[l.scale[0]*c,l.scale[1]*c],f=l.justify?ty[l.justify]:H5(Array.isArray(e)?e[0]:e,l.textAlign||wd),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8+`).reduce(Tle,[]),{width:v,height:w,widths:S,heights:T,lineWidths:P}=Vz(l,x),R=v+p,C=[],L=(R+2)*u[0],D=(w+p)*u[1],F={width:L<0?Math.floor(L):Math.ceil(L),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:C};(u[0]!=1||u[1]!=1)&&C.push("scale",u),r&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",p),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),n&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");let N=.5-f,B=f*R+N*p,z=[],V=[],H=0,Z=0,J=0,j=0,K;for(let ee=0,ae=x.length;ee<ae;ee+=2){let ce=x[ee];if(ce===`9+`){Z+=H,H=0,B=f*R+N*p,++j;continue}let de=x[ee+1]||l.font;de!==K&&(r&&z.push("font",de),n&&V.push("font",de),K=de),H=Math.max(H,T[J]);let ve=[ce,B+N*S[J]+f*(S[J]-P[j]),.5*(p+H)+Z];B+=S[J],r&&z.push("strokeText",ve),n&&V.push("fillText",ve),++J}return Array.prototype.push.apply(C,z),Array.prototype.push.apply(C,V),this.labels_[s]=F,F}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){a*=p[0],l*=p[1];let T=n-a,P=r-l,R=s+c>e?e-c:s,C=o+u>t?t-u:o,L=v[3]+R*p[0]+v[1],D=v[0]+C*p[1]+v[2],F=T-v[3],N=P-v[0];(w||f!==0)&&(Cd[0]=F,Rd[0]=F,Cd[1]=N,ff[1]=N,ff[0]=F+L,df[0]=ff[0],df[1]=N+D,Rd[1]=df[1]);let B;return f!==0?(B=lo($s(),n,r,1,1,f,-n,-r),Mr(B,Cd),Mr(B,ff),Mr(B,df),Mr(B,Rd),ll(Math.min(Cd[0],ff[0],df[0],Rd[0]),Math.min(Cd[1],ff[1],df[1],Rd[1]),Math.max(Cd[0],ff[0],df[0],Rd[0]),Math.max(Cd[1],ff[1],df[1],Rd[1]),zg)):ll(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),zg),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:zg[0],minY:zg[1],maxX:zg[2],maxY:zg[3],value:S},canvasTransform:B,scale:p}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Cd,ff,df,Rd,o,a),qz(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=Mr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=H5(Array.isArray(e)?e[0]:e,s.textAlign||wd),u=ty[s.textBaseline||$0],f=a&&a.lineWidth?a.lineWidth:0,p=o.width/l-2*s.scale[0],x=c*p+2*(.5-c)*f,v=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:x,anchorY:v}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&Io(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=ka(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),qG(this.renderedTransform_,n));let f=0,p=r.length,x=0,v,w=[],S,T,P,R,C,L,D,F,N,B,z,V,H,Z=0,J=0,j=this.coordinateCache_,K=this.viewRotation_,ee=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,ae={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:K},ce=this.instructions!=r||this.overlaps?0:200,de,ve,Ie,Qe;for(;f<p;){let Ue=r[f];switch(Ue[0]){case An.BEGIN_GEOMETRY:de=Ue[1],Qe=Ue[3],de.getGeometry()?a!==void 0&&!_r(a,Qe.getExtent())?f=Ue[2]+1:++f:f=Ue[2],c&&(c.zIndex=Ue[4]);break;case An.BEGIN_PATH:Z>ce&&(this.fill_(e),Z=0),J>ce&&(e.stroke(),J=0),!Z&&!J&&(e.beginPath(),C=NaN,L=NaN),++f;break;case An.CIRCLE:x=Ue[1],P=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-P,Et=u[x+3]-P,Tt=$e-Me,Ct=Et-ze,un=Math.sqrt(Tt*Tt+Ct*Ct);e.moveTo(Me+un,ze),e.arc(Me,ze,un,0,2*Math.PI,!0),++f;break;case An.CLOSE_PATH:e.closePath(),++f;break;case An.CUSTOM:x=Ue[1],v=Ue[2];let Gt=Ue[3],Xe=Ue[4],st=Ue[5];ae.geometry=Gt,ae.feature=de,f in j||(j[f]=[]);let tt=j[f];st?st(u,x,v,2,tt):(tt[0]=u[x],tt[1]=u[x+1],tt.length=2),c&&(c.zIndex=Ue[6]),Xe(tt,ae),++f;break;case An.DRAW_IMAGE:x=Ue[1],v=Ue[2],N=Ue[3],S=Ue[4],T=Ue[5];let vt=Ue[6],yt=Ue[7],ln=Ue[8],Kt=Ue[9],Qt=Ue[10],xn=Ue[11],ge=Ue[12],di=Ue[13];R=Ue[14]||"declutter";let On=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let In=this.drawLabelWithPointPlacement_(B,z,V,H);N=In.label,Ue[3]=N;let Ur=Ue[23];S=(In.anchorX-Ur)*this.pixelRatio,Ue[4]=S;let mr=Ue[24];T=(In.anchorY-mr)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,di=N.width,Ue[13]=di}let le;Ue.length>25&&(le=Ue[25]);let X,Te,Pe;Ue.length>17?(X=Ue[16],Te=Ue[17],Pe=Ue[18]):(X=nf,Te=null,Pe=null),Qt&&ee?xn+=K:!Qt&&!ee&&(xn-=K);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<di/this.pixelRatio)continue;let In=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],di,vt,S,T,ln,Kt,xn,ge,s,X,!!Te||!!Pe,de),Ur=[e,t,N,In,yt,Te,Pe];if(l){let mr,il,ta;if(On){let sr=v-x;if(!On[sr]){On[sr]={args:Ur,declutterMode:R};continue}let Rs=On[sr];mr=Rs.args,il=Rs.declutterMode,delete On[sr],ta=Fq(mr)}let rl,Ia;if(mr&&(il!=="declutter"||!l.collides(ta))&&(rl=!0),(R!=="declutter"||!l.collides(In.declutterBox))&&(Ia=!0),il==="declutter"&&R==="declutter"){let sr=rl&&Ia;rl=sr,Ia=sr}rl&&(il!=="none"&&l.insert(ta),this.replayImageOrLabel_.apply(this,mr)),Ia&&(R!=="none"&&l.insert(In.declutterBox),this.replayImageOrLabel_.apply(this,Ur))}else this.replayImageOrLabel_.apply(this,Ur)}++f;break;case An.DRAW_CHARS:let gt=Ue[1],St=Ue[2],qe=Ue[3],Ke=Ue[4];H=Ue[5];let Rt=Ue[6],en=Ue[7],Pt=Ue[8];V=Ue[9];let Mt=Ue[10];B=Ue[11],Array.isArray(B)&&(B=B.reduce(Ele,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Rn=Ue[16],xe=this.textStates[z],bt=xe.font,Ye=[xe.scale[0]*en,xe.scale[1]*en],wt;bt in this.widths_?wt=this.widths_[bt]:(wt={},this.widths_[bt]=wt);let Dt=Lq(u,gt,St,2),ct=Math.abs(Ye[0])*nI(bt,B,wt);if(Ke||ct<=Dt){let In=this.textStates[z].textAlign,Ur=(Dt-ct)*H5(B,In),mr=Dq(u,gt,St,2,B,Ur,Rt,Math.abs(Ye[0]),nI,bt,wt,ee?0:this.viewRotation_,yn);e:if(mr){let il=[],ta,rl,Ia,sr,Rs;if(V)for(ta=0,rl=mr.length;ta<rl;++ta){Rs=mr[ta],Ia=Rs[4],sr=this.createLabel(Ia,z,"",V),S=Rs[2]+(Ye[0]<0?-Mt:Mt)-Rn,T=qe*sr.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let sl=this.calculateImageOrLabelDimensions_(sr.width,sr.height,Rs[0],Rs[1],sr.width,sr.height,S,T,0,0,Rs[3],cn,!1,nf,!1,de);if(l&&R==="declutter"&&l.collides(sl.declutterBox))break e;il.push([e,t,sr,sl,1,null,null])}if(H)for(ta=0,rl=mr.length;ta<rl;++ta){Rs=mr[ta],Ia=Rs[4],sr=this.createLabel(Ia,z,H,""),S=Rs[2]-Rn,T=qe*sr.height-Pt;let sl=this.calculateImageOrLabelDimensions_(sr.width,sr.height,Rs[0],Rs[1],sr.width,sr.height,S,T,0,0,Rs[3],cn,!1,nf,!1,de);if(l&&R==="declutter"&&l.collides(sl.declutterBox))break e;il.push([e,t,sr,sl,1,null,null])}l&&R!=="none"&&l.load(il.map(Fq));for(let sl=0,hu=il.length;sl<hu;++sl)this.replayImageOrLabel_.apply(this,il[sl])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let In=o(de,Qe,R);if(In)return In}++f;break;case An.FILL:ce?Z++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],v=Ue[2],P=Ue[3];let Ce,jt,qi;if(P){let Ur=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;IS(u,x,v,2,P,Ur,w),NS(w,2,Ur),Ce=w,jt=0,qi=Ce.length}else Ce=u,jt=x,qi=v;ve=Ce[jt],Ie=Ce[jt+1],e.moveTo(ve,Ie),C=ve+.5|0,L=Ie+.5|0;for(let In=jt+2;In<qi;In+=2)ve=Ce[In],Ie=Ce[In+1],D=ve+.5|0,F=Ie+.5|0,(In==qi-2||D!==C||F!==L)&&(e.lineTo(ve,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],Z?(this.fill_(e),Z=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:Z&&Ue[1]&&(this.fill_(e),Z=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}Z&&this.fill_(e),J&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},Bq=W5;var Pd=["Polygon","Circle","LineString","Image","Text","Default"],$5=["Image","Text"],Uq=Pd.filter(i=>!$5.includes(i)),kq=!1,Gq=!1;function Mle(){let i=0,e=n=>{let r=Si(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};kq={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],Gq=!0}var X5=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=$s(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new Bq(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){Gq===!1&&Mle(),r=Math.round(r);let a=r*2+1,l=lo(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Si(a,a,null,{willReadFrequently:kq}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=Er(),N0(f,e),eg(f,t*(this.renderBuffer_+r),f));let p=Cle(r),x;function v(L,D,F){let N=u.getImageData(0,0,a,a).data;for(let B=0,z=p.length;B<z;B++)if(N[p[B]]>0){if(!o||F==="none"||x!=="Image"&&x!=="Text"||o.includes(L)){let V=(p[B]-3)/4,H=r-V%a,Z=r-(V/a|0),J=s(L,D,H*H+Z*Z);if(J)return J}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(Ua);let S,T,P,R,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(P=this.executorsByZIndex_[L],T=Pd.length-1;T>=0;--T)if(x=Pd[T],R=P[x],R!==void 0&&(C=R.executeHitDetection(u,l,n,v,f),C))return C}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return ka(a,0,8,2,e,a),a}isEmpty(){return bc(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?gG:Ua),o=o||Pd;let c=Pd.length;for(let u=0,f=l.length;u<f;++u){let p=l[u].toString(),x=this.executorsByZIndex_[p];for(let v=0,w=o.length;v<w;++v){let S=o[v],T=x[S];if(T!==void 0){let P=a===null?void 0:T.getZIndexContext(),R=P?P.getContext():e,C=this.maxExtent_&&S!=="Image"&&S!=="Text";if(C&&(R.save(),this.clip(R,n)),!P||S==="Text"||S==="Image"?T.execute(R,t,n,r,s,a):P.pushFunction(L=>T.execute(L,t,n,r,s,a)),C&&R.restore(),P){P.offset();let L=l[u]*c+Pd.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(P)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Ua);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}},j5={};function Cle(i){if(j5[i]!==void 0)return j5[i];let e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){let a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}let r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return j5[i]=r,r}var zq=X5;var Y5=class extends PS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?L0(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=$s()}drawImages_(e,t,n,r){if(!this.image_)return;let s=ka(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let p=s[u]-this.imageAnchorX_,x=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let v=p+this.imageAnchorX_,w=x+this.imageAnchorY_;lo(a,v,w,1,1,c,-v,-w),o.save(),o.transform.apply(o,a),o.translate(v,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,p,x,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=ka(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){let l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s,o){let a=this.context_,l=ka(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=IS(l,0,u,2,o,f,l),NS(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=cz(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(_r(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),Io(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:wd;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:Ga(n||Ds)}}if(!t)this.strokeState_=null;else{let n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),u=s||za,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Eu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||Va)*this.pixelRatio_,lineJoin:a!==void 0?a:Mu,lineWidth:(l!==void 0?l:rf)*this.pixelRatio_,miterLimit:c!==void 0?c:tf,strokeStyle:Ga(n||Do),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let x=t.getColor();this.textFillState_={fillStyle:Ga(x||Ds)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let x=n.getColor(),v=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),P=n.getWidth(),R=n.getMiterLimit();this.textStrokeState_={lineCap:v!==void 0?v:Eu,lineDash:w||za,lineDashOffset:S||Va,lineJoin:T!==void 0?T:Mu,lineWidth:P!==void 0?P:rf,miterLimit:R!==void 0?R:tf,strokeStyle:Ga(x||Do)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),p=e.getTextBaseline();this.textState_={font:r!==void 0?r:Xw,textAlign:f!==void 0?f:wd,textBaseline:p!==void 0?p:$0},this.text_=u!==void 0?Array.isArray(u)?u.reduce((x,v,w)=>x+=w%2?" ":v,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},Vq=Y5;var Fc=.5;function qq(i,e,t,n,r,s,o,a,l){let c=l?fd(r,l):r,u=i[0]*Fc,f=i[1]*Fc,p=Si(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new Vq(p,Fc,r,null,o,a,l?O0(U0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let R=1;R<=w;++R){let C=t[R-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(R*S).toString(16).padStart(7,"#00000");for(let B=0,z=D.length;B<z;++B){let V=D[B],H=V.getGeometryFunction()(C);if(!H||!_r(c,H.getExtent()))continue;let Z=V.clone(),J=Z.getFill();J&&J.setColor(N);let j=Z.getStroke();j&&(j.setColor(N),j.setLineDash(null)),Z.setText(void 0);let K=V.getImage();if(K){let de=K.getImageSize();if(!de)continue;let ve=Si(de[0],de[1],void 0,{alpha:!1}),Ie=ve.canvas;ve.fillStyle=N,ve.fillRect(0,0,Ie.width,Ie.height),Z.setImage(new Y0({img:Ie,anchor:K.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:K.getOrigin(),opacity:1,size:K.getSize(),scale:K.getScale(),rotation:K.getRotation(),rotateWithView:K.getRotateWithView()}))}let ee=Z.getZIndex()||0,ae=T[ee];ae||(ae={},T[ee]=ae,ae.Polygon=[],ae.Circle=[],ae.LineString=[],ae.Point=[]);let ce=H.getType();if(ce==="GeometryCollection"){let de=H.getGeometriesArrayRecursive();for(let ve=0,Ie=de.length;ve<Ie;++ve){let Qe=de[ve];ae[Qe.getType().replace("Multi","")].push(Qe,Z)}}else ae[ce.replace("Multi","")].push(H,Z)}}let P=Object.keys(T).map(Number).sort(Ua);for(let R=0,C=P.length;R<C;++R){let L=T[P[R]];for(let D in L){let F=L[D];for(let N=0,B=F.length;N<B;N+=2){v.setStyle(F[N+1]);for(let z=0,V=e.length;z<V;++z)v.setTransform(e[z]),v.drawGeometry(F[N])}}}return p.getImageData(0,0,x.width,x.height)}function Hq(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Fc),s=Math.floor(Math.round(i[1])*Fc),o=(_i(r,0,t.width-1)+_i(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Rle=.5,Wq={Point:Ole,LineString:Lle,Polygon:Ule,MultiPoint:Ble,MultiLineString:Dle,MultiPolygon:Fle,GeometryCollection:Nle,Circle:Ple};function jq(i,e){return parseInt(Nn(i),10)-parseInt(Nn(e),10)}function Z5(i,e){let t=K5(i,e);return t*t}function K5(i,e){return Rle*i/e}function Ple(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Q5(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let p=!0,x=c.getImageState();x==Mn.LOADED||x==Mn.ERROR?p=!1:x==Mn.IDLE&&c.load(),p&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Ile(i,e,t,n,s,o,a),f}function Ile(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())Xq(i,l,t,e,o);else{let u=Wq[l.getType()];u(i,l,t,e,o,s)}}function Xq(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)Xq(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Nle(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=Wq[o[a].getType()];c(i,o[a],t,n,r,s)}}function Lle(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Dle(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Fle(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(o||s){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Ole(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Mn.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function Ble(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Mn.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function Ule(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}var J5=class extends RS{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Er(),this.wrappedRenderedExtent_=Er(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),p=this.getLayer().getDeclutter(),x=t.pixelRatio,v=t.viewHints,w=!(v[Os.ANIMATING]||v[Os.INTERACTING]),S=this.context,T=Math.round(Wn(r)/a*x),P=Math.round(gr(r)/a*x),R=f.getWrapX()&&l.canWrapX(),C=R?Wn(u):null,L=R?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=R?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,P,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?Pd:n?$5:Uq,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Si(this.context.canvas.width,this.context.canvas.height,E5))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,z0(this.context),E5.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(ho.PRERENDER)||this.getLayer().hasListener(ho.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=Tc(n.extent,l);a=_r(u,e.extent),a&&!pu(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Fc,p=n[1]*Fc;u.push(this.getRenderTransform(r,s,o,Fc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!pu(v,l)){let S=l[0],T=Wn(v),P=0,R;for(;S<v[0];)--P,R=T*P,u.push(this.getRenderTransform(r,s,o,Fc,f,p,R).slice()),S+=T;for(P=0,S=l[2];S>v[2];)++P,R=T*P,u.push(this.getRenderTransform(r,s,o,Fc,f,p,R).slice()),S-=T}let w=U0();this.hitDetectionImageData_=qq(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,Z5(s,this.renderedPixelRatio_),w?a:null)}t(Hq(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(p,x,v){let w=Nn(p),S=c[w];if(S){if(S!==!0&&v<S.distanceSq){if(v===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(p,l,x);S.geometry=x,S.distanceSq=v}}else{if(v===0)return c[w]=!0,r(p,l,x);s.push(c[w]={feature:p,layer:l,geometry:x,distanceSq:v,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(p=>p.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[Os.ANIMATING],s=e.viewHints[Os.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,p=e.pixelRatio,x=t.getRevision(),v=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=jq);let S=c.center.slice(),T=eg(l,v*f),P=T.slice(),R=[T.slice()],C=u.getExtent(),L=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,L){let K=n.getExtent();K&&!mu(K)&&(this.extendX_=K[0]<C[0]||K[2]>C[2])}if(L&&(!pu(C,e.extent)||this.extendX_)){let K=Wn(C),ee=Math.max(Wn(T)/2,K),ae=C[0],ce=C[2];this.extendX_&&(ae-=K,ce+=K),T[0]=ae-ee,T[2]=ce+ee,aw(S,u);let de=G4(R[0],u);de[0]<C[0]&&de[2]<C[2]?R.push([de[0]+K,de[1],de[2]+K,de[3]]):de[0]>C[0]&&de[2]>C[2]&&R.push([de[0]-K,de[1],de[2]-K,de[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===p&&this.renderedRevision_==x&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&pu(this.wrappedRenderedExtent_,T))return Io(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new Nq(K5(f,p),T,f,p),F=U0(),N;if(F){for(let K=0,ee=R.length;K<ee;++K){let ae=R[K],ce=fd(ae,u);n.loadFeatures(ce,pG(f,u),F)}N=O0(F,u)}else for(let K=0,ee=R.length;K<ee;++K)n.loadFeatures(R[K],f,u);let B=Z5(f,p),z=!0,V=(K,ee)=>{let ae,ce=K.getStyleFunction()||t.getStyleFunction();if(ce&&(ae=ce(K,f)),ae){let de=this.renderFeature(K,B,ae,D,N,this.getLayer().getDeclutter(),ee);z=z&&!de}},H=fd(T,u),Z=n.getFeaturesInExtent(H);w&&Z.sort(w);for(let K=0,ee=Z.length;K<ee;++K)V(Z[K],K);this.renderedFeatures_=Z,this.ready=z;let J=D.finish(),j=new zq(T,f,p,n.getOverlaps(),J,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=x,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=P,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=p,this.replayGroup_=j,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=Q5(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=Q5(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},$q=J5;var eN=class extends TS{constructor(e){super(e)}createRenderer(){return new $q(this)}},Yq=eN;var kle=!1;function Gle(i,e,t,n,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=kle,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=e.getType();try{let u;c=="text"||c=="json"?u=a.responseText:c=="xml"?u=a.responseXML||a.responseText:c=="arraybuffer"&&(u=a.response),u?s(e.readFeatures(u,{extent:t,featureProjection:r}),e.readProjection(u)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function tN(i,e){return function(t,n,r,s,o){Gle(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function Zq(i,e){return[[-1/0,-1/0,1/0,1/0]]}function nN(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],p=0,x=[0];for(let S=e+n;S<t;S+=n){let T=i[S],P=i[S+1];p+=Math.sqrt((T-u)*(T-u)+(P-f)*(P-f)),x.push(p),u=T,f=P}let v=r*p,w=mG(x,v);w<0?(l=(v-x[-w-2])/(x[-w-1]-x[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Po(i[a+u],i[a+n+u],l);return s}var Kq=$s(),ny=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?ew(this.flatCoordinates_):tg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Ba(this.getExtent());this.flatInteriorPoints_=wx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=yz(this.flatCoordinates_,this.ends_),t=Qw(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Lw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=nN(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,s=n.length;r<s;++r){let o=n[r],a=nN(e,t,o,this.stride_,.5);Ec(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=ms(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=gr(n)/gr(t);lo(Kq,n[0],n[3],r,-r,0,0,0),ka(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Kq,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new i(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=yw((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let n=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":n.length=vx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=mz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=bx(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break;default:}return r&&(this.simplifiedGeometry_=new i(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};ny.prototype.getFlatCoordinates=ny.prototype.getOrientedFlatCoordinates;var iA=ny;var iN=class{constructor(e){this.rbush_=new eA(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Nn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Nn(a)]=l}this.rbush_.load(n)}remove(e){let t=Nn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Nn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];I0(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return bc(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ll(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},rN=iN;var hl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Du=class extends Xs{constructor(e,t,n){super(e),this.feature=t,this.features=n}},sN=class extends Rw{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=Qh,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(zn(this.format_,"`format` must be set when `url` is set"),this.loader_=tN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Zq;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new rN:null,this.loadedExtentsRtree_=new rN,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new co(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Nn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Du(hl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof iA||(this.featureChangeKeys_[e]=[Un(t,Jt.CHANGE,this.handleFeatureChange_,this),Un(t,Mc.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof iA){let s=this.idIndex_[r];s instanceof iA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(zn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Nn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Nn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(hl.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Du(hl.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(hl.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(hl.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Zs.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Zs.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(ii);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Du(hl.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){let s=r.getGeometry();if(s instanceof iA||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof iA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),bc(this.nullGeometryFeatures_)||Ec(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=iw(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return t=t||Zh,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof iA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let p=Math.sqrt(a);l[0]=n-p,l[1]=r-p,l[2]=n+p,l[3]=r+p}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Nn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Du(hl.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Nn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&bc(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return pu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Du(hl.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Du(hl.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Du(hl.FEATURESLOADERROR))},p=!1,x=this.loader_.call(this,l,t,n,v=>p||u(v),()=>p||f());x instanceof Promise?(p=!0,x.then(v=>{this.addFeatures(v),u(v)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=k4(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Nn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(ii),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(hl.REMOVEFEATURE)&&this.dispatchEvent(new Du(hl.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){zn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(tN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},pf=sN;var ma={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Qd={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},UT=0,Zy=1,kT=2;var XN=0,Jd=1,GT=2,Kl=3,Ao=0,ui=1,ir=2,Xr=0,ss=1,zu=2,Vu=3,qu=4,If=5,Ky=6,Bs=100,Qy=101,Jy=102,zT=103,VT=104,qc=200,e2=201,t2=202,n2=203,Ud=204,kd=205,i2=206,r2=207,s2=208,o2=209,a2=210,GH=211,zH=212,VH=213,qH=214,lA=0,cA=1,uA=2,Bu=3,hA=4,fA=5,dA=6,pA=7,PA=0,qT=1,HT=2,ks=0,l2=1,c2=2,u2=3,h2=4,$N=5,f2=6,d2=7;var p2=300,gl=301,Ql=302,ep=303,tp=304,Hu=306,Sf=1e3,ko=1001,Tf=1002,xi=1003,A2=1004;var Jl=1005;var vi=1006,np=1007;var go=1008,YN=1008,Gi=1009,Wu=1010,ju=1011,Wa=1012,Ir=1013,pi=1014,Yi=1015,Li=1016,IA=1017,NA=1018,zo=1020,LA=35902,DA=35899,S_=1021,Nf=1022,xr=1023,ys=1026,Qs=1027,Lf=1028,Xu=1029,Ss=1030,$u=1031,m2=1032,ip=1033,Yu=33776,Zu=33777,Ku=33778,Qu=33779,FA=35840,OA=35841,BA=35842,UA=35843,rp=36196,sp=37492,op=37496,ap=37488,lp=37489,Ju=37490,cp=37491,up=37808,hp=37809,fp=37810,dp=37811,pp=37812,Ap=37813,mp=37814,gp=37815,_p=37816,xp=37817,yp=37818,vp=37819,bp=37820,wp=37821,Sp=36492,Tp=36494,Ep=36495,Mp=36283,Cp=36284,eh=36285,Rp=36286;var my=2300,fT=2301,uT=2302,DN=2303,FN=2400,ON=2401,BN=2402;var ZN=0,KN=1,WT=2,HH=3200;var _l=0,jT=1,Vo="",Wr="srgb",Gd="srgb-linear",zd="linear",Bt="srgb",g2="",XT="rg",QN="ga",JN=0,yf=7680,eL=7681,tL=7682,nL=7683,iL=34055,rL=34056,sL=5386,oL=512,aL=513,lL=514,cL=515,uL=516,hL=517,fL=518,gy=519,_2=512,T_=513,x2=514,th=515,kA=516,y2=517,Hc=518,v2=519,Vd=35044,GA=35048;var dL="300 es",po=2e3,qa=2001,ec={COMPUTE:"compute",RENDER:"render"};var Df={TEXTURE_COMPARE:"depthTextureCompare"};function zle(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function E_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function l_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function $T(){let i=l_("canvas");return i.style.display="block",i}var Qq={},c_=null;function AA(...i){let e="THREE."+i.shift();c_?c_("log",e,...i):console.log(e,...i)}function WH(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function je(...i){i=WH(i);let e="THREE."+i.shift();if(c_)c_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=WH(i);let e="THREE."+i.shift();if(c_)c_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Zn(...i){let e=i.join(" ");e in Qq||(Qq[e]=!0,je(...i))}function pL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function jH(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var b2={[lA]:cA,[uA]:dA,[hA]:pA,[Bu]:fA,[cA]:lA,[dA]:uA,[pA]:hA,[fA]:Bu},Go=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},Bo=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Jq=1234567,fy=Math.PI/180,Ef=180/Math.PI;function Ou(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Bo[i&255]+Bo[i>>8&255]+Bo[i>>16&255]+Bo[i>>24&255]+"-"+Bo[e&255]+Bo[e>>8&255]+"-"+Bo[e>>16&15|64]+Bo[e>>24&255]+"-"+Bo[t&63|128]+Bo[t>>8&255]+"-"+Bo[t>>16&255]+Bo[t>>24&255]+Bo[n&255]+Bo[n>>8&255]+Bo[n>>16&255]+Bo[n>>24&255]).toLowerCase()}function Pn(i,e,t){return Math.max(e,Math.min(t,i))}function AL(i,e){return(i%e+e)%e}function Vle(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function qle(i,e,t){return i!==e?(t-i)/(e-i):0}function dy(i,e,t){return(1-t)*i+t*e}function Hle(i,e,t,n){return dy(i,e,1-Math.exp(-t*n))}function Wle(i,e=1){return e-Math.abs(AL(i,e*2)-e)}function jle(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Xle(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function $le(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Yle(i,e){return i+Math.random()*(e-i)}function Zle(i){return i*(.5-Math.random())}function Kle(i){i!==void 0&&(Jq=i);let e=Jq+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Qle(i){return i*fy}function Jle(i){return i*Ef}function ece(i){return(i&i-1)===0&&i!==0}function tce(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function nce(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function ice(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),p=o((e-n)/2),x=s((n-e)/2),v=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*p,a*c);break;case"YZY":i.set(l*p,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*p,a*u,a*c);break;case"XZX":i.set(a*u,l*v,l*x,a*c);break;case"YXY":i.set(l*x,a*u,l*v,a*c);break;case"ZYZ":i.set(l*v,l*x,a*u,a*c);break;default:je("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function la(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function qn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Wc={DEG2RAD:fy,RAD2DEG:Ef,generateUUID:Ou,clamp:Pn,euclideanModulo:AL,mapLinear:Vle,inverseLerp:qle,lerp:dy,damp:Hle,pingpong:Wle,smoothstep:jle,smootherstep:Xle,randInt:$le,randFloat:Yle,randFloatSpread:Zle,seededRandom:Kle,degToRad:Qle,radToDeg:Jle,isPowerOfTwo:ece,ceilPowerOfTwo:tce,floorPowerOfTwo:nce,setQuaternionFromProperEuler:ice,normalize:qn,denormalize:la},yL=class yL{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};yL.prototype.isVector2=!0;var Oe=yL,vs=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],p=s[o+0],x=s[o+1],v=s[o+2],w=s[o+3];if(f!==w||l!==p||c!==x||u!==v){let S=l*p+c*x+u*v+f*w;S<0&&(p=-p,x=-x,v=-v,w=-w,S=-S);let T=1-a;if(S<.9995){let P=Math.acos(S),R=Math.sin(P);T=Math.sin(T*P)/R,a=Math.sin(a*P)/R,l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a}else{l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a;let P=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=P,c*=P,u*=P,f*=P}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],p=s[o+1],x=s[o+2],v=s[o+3];return e[t]=a*v+u*f+l*x-c*p,e[t+1]=l*v+u*p+c*f-a*x,e[t+2]=c*v+u*x+a*p-l*f,e[t+3]=u*v-a*f-l*p-c*x,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),p=l(n/2),x=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"YXZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"ZXY":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"ZYX":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"YZX":this._x=p*u*f+c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f-p*x*v;break;case"XZY":this._x=p*u*f-c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f+p*x*v;break;default:je("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+a+f;if(p>0){let x=.5/Math.sqrt(p+1);this._w=.25/x,this._x=(u-l)*x,this._y=(s-c)*x,this._z=(o-r)*x}else if(n>a&&n>f){let x=2*Math.sqrt(1+n-a-f);this._w=(u-l)/x,this._x=.25*x,this._y=(r+o)/x,this._z=(s+c)/x}else if(a>f){let x=2*Math.sqrt(1+a-n-f);this._w=(s-c)/x,this._x=(r+o)/x,this._y=.25*x,this._z=(l+u)/x}else{let x=2*Math.sqrt(1+f-n-a);this._w=(o-r)/x,this._x=(s+c)/x,this._y=(l+u)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Pn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},vL=class vL{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(eH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(eH.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return oN.copy(this).projectOnVector(e),this.sub(oN)}reflect(e){return this.sub(oN.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};vL.prototype.isVector3=!0;var ie=vL,oN=new ie,eH=new vs,bL=class bL{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],x=n[5],v=n[8],w=r[0],S=r[3],T=r[6],P=r[1],R=r[4],C=r[7],L=r[2],D=r[5],F=r[8];return s[0]=o*w+a*P+l*L,s[3]=o*S+a*R+l*D,s[6]=o*T+a*C+l*F,s[1]=c*w+u*P+f*L,s[4]=c*S+u*R+f*D,s[7]=c*T+u*C+f*F,s[2]=p*w+x*P+v*L,s[5]=p*S+x*R+v*D,s[8]=p*T+x*C+v*F,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,p=a*l-u*s,x=c*s-o*l,v=t*f+n*p+r*x;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/v;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=p*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=x*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return Zn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(aN.makeScale(e,t)),this}rotate(e){return Zn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(aN.makeRotation(-e)),this}translate(e,t){return Zn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(aN.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};bL.prototype.isMatrix3=!0;var Sn=bL,aN=new Sn,tH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),nH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function rce(){let i={enabled:!0,workingColorSpace:Gd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=wf(r.r),r.g=wf(r.g),r.b=wf(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Bt&&(r.r=a_(r.r),r.g=a_(r.g),r.b=a_(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Vo?zd:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Zn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Zn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Gd]:{primaries:e,whitePoint:n,transfer:zd,toXYZ:tH,fromXYZ:nH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Wr},outputColorSpaceConfig:{drawingBufferColorSpace:Wr}},[Wr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:tH,fromXYZ:nH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Wr}}}),i}var sn=rce();function wf(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function a_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Vg,dT=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Vg===void 0&&(Vg=l_("canvas")),Vg.width=e.width,Vg.height=e.height;let r=Vg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Vg}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=l_("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=wf(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(wf(t[n]/255)*255):t[n]=wf(t[n]);return{data:t,width:e.width,height:e.height}}else return je("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},sce=0,u_=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:sce++}),this.uuid=Ou(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(lN(r[o].image)):s.push(lN(r[o]))}else s=lN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function lN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?dT.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(je("Texture: Unable to serialize Texture."),{})}var oce=0,cN=new ie,bs=class i extends Go{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=ko,r=ko,s=vi,o=go,a=xr,l=Gi,c=i.DEFAULT_ANISOTROPY,u=Vo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:oce++}),this.uuid=Ou(),this.name="",this.source=new u_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Sn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(cN).x}get height(){return this.source.getSize(cN).y}get depth(){return this.source.getSize(cN).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){je(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==p2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Sf:e.x=e.x-Math.floor(e.x);break;case ko:e.x=e.x<0?0:1;break;case Tf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Sf:e.y=e.y-Math.floor(e.y);break;case ko:e.y=e.y<0?0:1;break;case Tf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};bs.DEFAULT_IMAGE=null;bs.DEFAULT_MAPPING=p2;bs.DEFAULT_ANISOTROPY=1;var wL=class wL{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],x=l[5],v=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-w)<.01&&Math.abs(v-S)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+w)<.1&&Math.abs(v+S)<.1&&Math.abs(c+x+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let R=(c+1)/2,C=(x+1)/2,L=(T+1)/2,D=(u+p)/4,F=(f+w)/4,N=(v+S)/4;return R>C&&R>L?R<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(R),r=D/n,s=F/n):C>L?C<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(C),n=D/r,s=N/r):L<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),n=F/s,r=N/s),this.set(n,r,s,t),this}let P=Math.sqrt((S-v)*(S-v)+(f-w)*(f-w)+(p-u)*(p-u));return Math.abs(P)<.001&&(P=1),this.x=(S-v)/P,this.y=(f-w)/P,this.z=(p-u)/P,this.w=Math.acos((c+x+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this.w=Pn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this.w=Pn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};wL.prototype.isVector4=!0;var gn=wL,ca=class extends Go{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new bs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:vi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new u_(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},ua=class extends ca{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},mA=class extends bs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xi,this.minFilter=xi,this.wrapR=ko,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var pT=class extends bs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xi,this.minFilter=xi,this.wrapR=ko,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var BT=class BT{constructor(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=p,T[3]=x,T[7]=v,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new BT().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/qg.setFromMatrixColumn(e,0).length(),s=1/qg.setFromMatrixColumn(e,1).length(),o=1/qg.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=x+v*c,t[5]=p-w*c,t[9]=-a*l,t[2]=w-p*c,t[6]=v+x*c,t[10]=o*l}else if(e.order==="YXZ"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p+w*a,t[4]=v*a-x,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=x*a-v,t[6]=w+p*a,t[10]=o*l}else if(e.order==="ZXY"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p-w*a,t[4]=-o*f,t[8]=v+x*a,t[1]=x+v*a,t[5]=o*u,t[9]=w-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=v*c-x,t[8]=p*c+w,t[1]=l*f,t[5]=w*c+p,t[9]=x*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=w-p*f,t[8]=v*f+x,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=x*f+v,t[10]=p-w*f}else if(e.order==="XZY"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+w,t[5]=o*u,t[9]=x*f-v,t[2]=v*f-x,t[6]=a*u,t[10]=w*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ace,e,lce)}lookAt(e,t,n){let r=this.elements;return fl.subVectors(e,t),fl.lengthSq()===0&&(fl.z=1),fl.normalize(),Id.crossVectors(n,fl),Id.lengthSq()===0&&(Math.abs(n.z)===1?fl.x+=1e-4:fl.z+=1e-4,fl.normalize(),Id.crossVectors(n,fl)),Id.normalize(),LS.crossVectors(fl,Id),r[0]=Id.x,r[4]=LS.x,r[8]=fl.x,r[1]=Id.y,r[5]=LS.y,r[9]=fl.y,r[2]=Id.z,r[6]=LS.z,r[10]=fl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],x=n[13],v=n[2],w=n[6],S=n[10],T=n[14],P=n[3],R=n[7],C=n[11],L=n[15],D=r[0],F=r[4],N=r[8],B=r[12],z=r[1],V=r[5],H=r[9],Z=r[13],J=r[2],j=r[6],K=r[10],ee=r[14],ae=r[3],ce=r[7],de=r[11],ve=r[15];return s[0]=o*D+a*z+l*J+c*ae,s[4]=o*F+a*V+l*j+c*ce,s[8]=o*N+a*H+l*K+c*de,s[12]=o*B+a*Z+l*ee+c*ve,s[1]=u*D+f*z+p*J+x*ae,s[5]=u*F+f*V+p*j+x*ce,s[9]=u*N+f*H+p*K+x*de,s[13]=u*B+f*Z+p*ee+x*ve,s[2]=v*D+w*z+S*J+T*ae,s[6]=v*F+w*V+S*j+T*ce,s[10]=v*N+w*H+S*K+T*de,s[14]=v*B+w*Z+S*ee+T*ve,s[3]=P*D+R*z+C*J+L*ae,s[7]=P*F+R*V+C*j+L*ce,s[11]=P*N+R*H+C*K+L*de,s[15]=P*B+R*Z+C*ee+L*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],x=e[14],v=e[3],w=e[7],S=e[11],T=e[15],P=l*x-c*p,R=a*x-c*f,C=a*p-l*f,L=o*x-c*u,D=o*p-l*u,F=o*f-a*u;return t*(w*P-S*R+T*C)-n*(v*P-S*L+T*D)+r*(v*R-w*L+T*F)-s*(v*C-w*D+S*F)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],x=e[11],v=e[12],w=e[13],S=e[14],T=e[15],P=t*a-n*o,R=t*l-r*o,C=t*c-s*o,L=n*l-r*a,D=n*c-s*a,F=r*c-s*l,N=u*w-f*v,B=u*S-p*v,z=u*T-x*v,V=f*S-p*w,H=f*T-x*w,Z=p*T-x*S,J=P*Z-R*H+C*V+L*z-D*B+F*N;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let j=1/J;return e[0]=(a*Z-l*H+c*V)*j,e[1]=(r*H-n*Z-s*V)*j,e[2]=(w*F-S*D+T*L)*j,e[3]=(p*D-f*F-x*L)*j,e[4]=(l*z-o*Z-c*B)*j,e[5]=(t*Z-r*z+s*B)*j,e[6]=(S*C-v*F-T*R)*j,e[7]=(u*F-p*C+x*R)*j,e[8]=(o*H-a*z+c*N)*j,e[9]=(n*z-t*H-s*N)*j,e[10]=(v*D-w*C+T*P)*j,e[11]=(f*C-u*D-x*P)*j,e[12]=(a*B-o*V-l*N)*j,e[13]=(t*V-n*B+r*N)*j,e[14]=(w*R-v*L-S*P)*j,e[15]=(u*L-f*R+p*P)*j,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,p=s*c,x=s*u,v=s*f,w=o*u,S=o*f,T=a*f,P=l*c,R=l*u,C=l*f,L=n.x,D=n.y,F=n.z;return r[0]=(1-(w+T))*L,r[1]=(x+C)*L,r[2]=(v-R)*L,r[3]=0,r[4]=(x-C)*D,r[5]=(1-(p+T))*D,r[6]=(S+P)*D,r[7]=0,r[8]=(v+R)*F,r[9]=(S-P)*F,r[10]=(1-(p+w))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=qg.set(r[0],r[1],r[2]).length(),a=qg.set(r[4],r[5],r[6]).length(),l=qg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Oc.copy(this);let c=1/o,u=1/a,f=1/l;return Oc.elements[0]*=c,Oc.elements[1]*=c,Oc.elements[2]*=c,Oc.elements[4]*=u,Oc.elements[5]*=u,Oc.elements[6]*=u,Oc.elements[8]*=f,Oc.elements[9]*=f,Oc.elements[10]*=f,t.setFromRotationMatrix(Oc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=po,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),p=(t+e)/(t-e),x=(n+r)/(n-r),v,w;if(l)v=s/(o-s),w=o*s/(o-s);else if(a===po)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===qa)v=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=x,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=po,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),p=-(t+e)/(t-e),x=-(n+r)/(n-r),v,w;if(l)v=1/(o-s),w=o/(o-s);else if(a===po)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===qa)v=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=x,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};BT.prototype.isMatrix4=!0;var on=BT,qg=new ie,Oc=new on,ace=new ie(0,0,0),lce=new ie(1,1,1),Id=new ie,LS=new ie,fl=new ie,iH=new on,rH=new vs,ha=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(Pn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Pn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Pn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Pn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Pn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-Pn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,x),this._y=0);break;default:je("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return iH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(iH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return rH.setFromEuler(this),this.setFromQuaternion(rH,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ha.DEFAULT_ORDER="XYZ";var h_=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},cce=0,sH=new ie,Hg=new vs,Af=new on,DS=new ie,iy=new ie,uce=new ie,hce=new vs,oH=new ie(1,0,0),aH=new ie(0,1,0),lH=new ie(0,0,1),cH={type:"added"},fce={type:"removed"},Wg={type:"childadded",child:null},uN={type:"childremoved",child:null},$i=class i extends Go{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:cce++}),this.uuid=Ou(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new ha,n=new vs,r=new ie(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new on},normalMatrix:{value:new Sn}}),this.matrix=new on,this.matrixWorld=new on,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new h_,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Hg.setFromAxisAngle(e,t),this.quaternion.multiply(Hg),this}rotateOnWorldAxis(e,t){return Hg.setFromAxisAngle(e,t),this.quaternion.premultiply(Hg),this}rotateX(e){return this.rotateOnAxis(oH,e)}rotateY(e){return this.rotateOnAxis(aH,e)}rotateZ(e){return this.rotateOnAxis(lH,e)}translateOnAxis(e,t){return sH.copy(e).applyQuaternion(this.quaternion),this.position.add(sH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(oH,e)}translateY(e){return this.translateOnAxis(aH,e)}translateZ(e){return this.translateOnAxis(lH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Af.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?DS.copy(e):DS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),iy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Af.lookAt(iy,DS,this.up):Af.lookAt(DS,iy,this.up),this.quaternion.setFromRotationMatrix(Af),r&&(Af.extractRotation(r.matrixWorld),Hg.setFromRotationMatrix(Af),this.quaternion.premultiply(Hg.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(cH),Wg.child=e,this.dispatchEvent(Wg),Wg.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(fce),uN.child=e,this.dispatchEvent(uN),uN.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Af.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Af.multiply(e.parent.matrixWorld)),e.applyMatrix4(Af),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(cH),Wg.child=e,this.dispatchEvent(Wg),Wg.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iy,e,uce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iy,hce,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),p=o(e.skeletons),x=o(e.animations),v=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),x.length>0&&(n.animations=x),v.length>0&&(n.nodes=v)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};$i.DEFAULT_UP=new ie(0,1,0);$i.DEFAULT_MATRIX_AUTO_UPDATE=!0;$i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var xs=class extends $i{constructor(){super(),this.isGroup=!0,this.type="Group"}},dce={type:"move"},qd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new xs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ie,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ie),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ie,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ie,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),x=.02,v=.005;c.inputState.pinching&&p>x+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=x-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(dce)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new xs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},XH={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Nd={h:0,s:0,l:0},FS={h:0,s:0,l:0};function hN(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var Ut=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Wr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,sn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=sn.workingColorSpace){return this.r=e,this.g=t,this.b=n,sn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=sn.workingColorSpace){if(e=AL(e,1),t=Pn(t,0,1),n=Pn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=hN(o,s,e+1/3),this.g=hN(o,s,e),this.b=hN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=Wr){function n(s){s!==void 0&&parseFloat(s)<1&&je("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:je("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);je("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Wr){let n=XH[e.toLowerCase()];return n!==void 0?this.setHex(n,t):je("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=wf(e.r),this.g=wf(e.g),this.b=wf(e.b),this}copyLinearToSRGB(e){return this.r=a_(e.r),this.g=a_(e.g),this.b=a_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Wr){return sn.workingToColorSpace(Uo.copy(this),e),Math.round(Pn(Uo.r*255,0,255))*65536+Math.round(Pn(Uo.g*255,0,255))*256+Math.round(Pn(Uo.b*255,0,255))}getHexString(e=Wr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(Uo.copy(this),t);let n=Uo.r,r=Uo.g,s=Uo.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=sn.workingColorSpace){return sn.workingToColorSpace(Uo.copy(this),t),e.r=Uo.r,e.g=Uo.g,e.b=Uo.b,e}getStyle(e=Wr){sn.workingToColorSpace(Uo.copy(this),e);let t=Uo.r,n=Uo.g,r=Uo.b;return e!==Wr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Nd),this.setHSL(Nd.h+e,Nd.s+t,Nd.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Nd),e.getHSL(FS);let n=dy(Nd.h,FS.h,t),r=dy(Nd.s,FS.s,t),s=dy(Nd.l,FS.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Uo=new Ut;Ut.NAMES=XH;var Hd=class extends $i{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ha,this.environmentIntensity=1,this.environmentRotation=new ha,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Bc=new ie,mf=new ie,fN=new ie,gf=new ie,jg=new ie,Xg=new ie,uH=new ie,dN=new ie,pN=new ie,AN=new ie,mN=new gn,gN=new gn,_N=new gn,vf=class i{constructor(e=new ie,t=new ie,n=new ie){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Bc.subVectors(e,t),r.cross(Bc);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Bc.subVectors(r,t),mf.subVectors(n,t),fN.subVectors(e,t);let o=Bc.dot(Bc),a=Bc.dot(mf),l=Bc.dot(fN),c=mf.dot(mf),u=mf.dot(fN),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let p=1/f,x=(c*l-a*u)*p,v=(o*u-a*l)*p;return s.set(1-x-v,v,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,gf)===null?!1:gf.x>=0&&gf.y>=0&&gf.x+gf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,gf)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,gf.x),l.addScaledVector(o,gf.y),l.addScaledVector(a,gf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return mN.setScalar(0),gN.setScalar(0),_N.setScalar(0),mN.fromBufferAttribute(e,t),gN.fromBufferAttribute(e,n),_N.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(mN,s.x),o.addScaledVector(gN,s.y),o.addScaledVector(_N,s.z),o}static isFrontFacing(e,t,n,r){return Bc.subVectors(n,t),mf.subVectors(e,t),Bc.cross(mf).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Bc.subVectors(this.c,this.b),mf.subVectors(this.a,this.b),Bc.cross(mf).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;jg.subVectors(r,n),Xg.subVectors(s,n),dN.subVectors(e,n);let l=jg.dot(dN),c=Xg.dot(dN);if(l<=0&&c<=0)return t.copy(n);pN.subVectors(e,r);let u=jg.dot(pN),f=Xg.dot(pN);if(u>=0&&f<=u)return t.copy(r);let p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(jg,o);AN.subVectors(e,s);let x=jg.dot(AN),v=Xg.dot(AN);if(v>=0&&x<=v)return t.copy(s);let w=x*c-l*v;if(w<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(n).addScaledVector(Xg,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return uH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(uH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(jg,o).addScaledVector(Xg,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},fa=class{constructor(e=new ie(1/0,1/0,1/0),t=new ie(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Uc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Uc.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Uc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Uc):Uc.fromBufferAttribute(s,o),Uc.applyMatrix4(e.matrixWorld),this.expandByPoint(Uc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),OS.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),OS.copy(n.boundingBox)),OS.applyMatrix4(e.matrixWorld),this.union(OS)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Uc),Uc.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ry),BS.subVectors(this.max,ry),$g.subVectors(e.a,ry),Yg.subVectors(e.b,ry),Zg.subVectors(e.c,ry),Ld.subVectors(Yg,$g),Dd.subVectors(Zg,Yg),rA.subVectors($g,Zg);let t=[0,-Ld.z,Ld.y,0,-Dd.z,Dd.y,0,-rA.z,rA.y,Ld.z,0,-Ld.x,Dd.z,0,-Dd.x,rA.z,0,-rA.x,-Ld.y,Ld.x,0,-Dd.y,Dd.x,0,-rA.y,rA.x,0];return!xN(t,$g,Yg,Zg,BS)||(t=[1,0,0,0,1,0,0,0,1],!xN(t,$g,Yg,Zg,BS))?!1:(US.crossVectors(Ld,Dd),t=[US.x,US.y,US.z],xN(t,$g,Yg,Zg,BS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Uc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Uc).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_f[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_f[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_f[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_f[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_f[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_f[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_f[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_f[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_f),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},_f=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],Uc=new ie,OS=new fa,$g=new ie,Yg=new ie,Zg=new ie,Ld=new ie,Dd=new ie,rA=new ie,ry=new ie,BS=new ie,US=new ie,sA=new ie;function xN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){sA.fromArray(i,s);let a=r.x*Math.abs(sA.x)+r.y*Math.abs(sA.y)+r.z*Math.abs(sA.z),l=e.dot(sA),c=t.dot(sA),u=n.dot(sA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var bf=pce();function pce(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function dl(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=Pn(i,-65504,65504),bf.floatView[0]=i;let e=bf.uint32View[0],t=e>>23&511;return bf.baseTable[t]+((e&8388607)>>bf.shiftTable[t])}function kS(i){let e=i>>10;return bf.uint32View[0]=bf.mantissaTable[bf.offsetTable[e]+(i&1023)]+bf.exponentTable[e],bf.floatView[0]}var _s=new ie,GS=new Oe,Ace=0,Ni=class extends Go{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Ace++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Vd,this.updateRanges=[],this.gpuType=Yi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)GS.fromBufferAttribute(this,t),GS.applyMatrix3(e),this.setXY(t,GS.x,GS.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)_s.fromBufferAttribute(this,t),_s.applyMatrix3(e),this.setXYZ(t,_s.x,_s.y,_s.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)_s.fromBufferAttribute(this,t),_s.applyMatrix4(e),this.setXYZ(t,_s.x,_s.y,_s.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)_s.fromBufferAttribute(this,t),_s.applyNormalMatrix(e),this.setXYZ(t,_s.x,_s.y,_s.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)_s.fromBufferAttribute(this,t),_s.transformDirection(e),this.setXYZ(t,_s.x,_s.y,_s.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=la(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=qn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=la(t,this.array)),t}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=la(t,this.array)),t}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=la(t,this.array)),t}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=la(t,this.array)),t}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Vd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var gA=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var _A=class extends Ni{constructor(e,t,n){super(new Uint32Array(e),t,n)}},f_=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=kS(this.array[e*this.itemSize]);return this.normalized&&(t=la(t,this.array)),t}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize]=dl(t),this}getY(e){let t=kS(this.array[e*this.itemSize+1]);return this.normalized&&(t=la(t,this.array)),t}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+1]=dl(t),this}getZ(e){let t=kS(this.array[e*this.itemSize+2]);return this.normalized&&(t=la(t,this.array)),t}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+2]=dl(t),this}getW(e){let t=kS(this.array[e*this.itemSize+3]);return this.normalized&&(t=la(t,this.array)),t}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+3]=dl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this.array[e+2]=dl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this.array[e+2]=dl(r),this.array[e+3]=dl(s),this}},kn=class extends Ni{constructor(e,t,n){super(new Float32Array(e),t,n)}},mce=new fa,sy=new ie,yN=new ie,Ha=class{constructor(e=new ie,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):mce.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;sy.subVectors(e,this.center);let t=sy.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(sy,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(yN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(sy.copy(e.center).add(yN)),this.expandByPoint(sy.copy(e.center).sub(yN))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},gce=0,Yl=new on,vN=new $i,Kg=new ie,pl=new fa,oy=new fa,Ks=new ie,Kn=class i extends Go{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:gce++}),this.uuid=Ou(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(zle(e)?_A:gA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Sn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Yl.makeRotationFromQuaternion(e),this.applyMatrix4(Yl),this}rotateX(e){return Yl.makeRotationX(e),this.applyMatrix4(Yl),this}rotateY(e){return Yl.makeRotationY(e),this.applyMatrix4(Yl),this}rotateZ(e){return Yl.makeRotationZ(e),this.applyMatrix4(Yl),this}translate(e,t,n){return Yl.makeTranslation(e,t,n),this.applyMatrix4(Yl),this}scale(e,t,n){return Yl.makeScale(e,t,n),this.applyMatrix4(Yl),this}lookAt(e){return vN.lookAt(e),vN.updateMatrix(),this.applyMatrix4(vN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Kg).negate(),this.translate(Kg.x,Kg.y,Kg.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new kn(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&je("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new fa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ie(-1/0,-1/0,-1/0),new ie(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];pl.setFromBufferAttribute(s),this.morphTargetsRelative?(Ks.addVectors(this.boundingBox.min,pl.min),this.boundingBox.expandByPoint(Ks),Ks.addVectors(this.boundingBox.max,pl.max),this.boundingBox.expandByPoint(Ks)):(this.boundingBox.expandByPoint(pl.min),this.boundingBox.expandByPoint(pl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ha);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ie,1/0);return}if(e){let n=this.boundingSphere.center;if(pl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];oy.setFromBufferAttribute(a),this.morphTargetsRelative?(Ks.addVectors(pl.min,oy.min),pl.expandByPoint(Ks),Ks.addVectors(pl.max,oy.max),pl.expandByPoint(Ks)):(pl.expandByPoint(oy.min),pl.expandByPoint(oy.max))}pl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Ks.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Ks));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Ks.fromBufferAttribute(a,c),l&&(Kg.fromBufferAttribute(e,c),Ks.add(Kg)),r=Math.max(r,n.distanceToSquared(Ks))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Ni(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let N=0;N<n.count;N++)a[N]=new ie,l[N]=new ie;let c=new ie,u=new ie,f=new ie,p=new Oe,x=new Oe,v=new Oe,w=new ie,S=new ie;function T(N,B,z){c.fromBufferAttribute(n,N),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,z),p.fromBufferAttribute(s,N),x.fromBufferAttribute(s,B),v.fromBufferAttribute(s,z),u.sub(c),f.sub(c),x.sub(p),v.sub(p);let V=1/(x.x*v.y-v.x*x.y);isFinite(V)&&(w.copy(u).multiplyScalar(v.y).addScaledVector(f,-x.y).multiplyScalar(V),S.copy(f).multiplyScalar(x.x).addScaledVector(u,-v.x).multiplyScalar(V),a[N].add(w),a[B].add(w),a[z].add(w),l[N].add(S),l[B].add(S),l[z].add(S))}let P=this.groups;P.length===0&&(P=[{start:0,count:e.count}]);for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)T(e.getX(Z+0),e.getX(Z+1),e.getX(Z+2))}let R=new ie,C=new ie,L=new ie,D=new ie;function F(N){L.fromBufferAttribute(r,N),D.copy(L);let B=a[N];R.copy(B),R.sub(L.multiplyScalar(L.dot(B))).normalize(),C.crossVectors(D,B);let V=C.dot(l[N])<0?-1:1;o.setXYZW(N,R.x,R.y,R.z,V)}for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)F(e.getX(Z+0)),F(e.getX(Z+1)),F(e.getX(Z+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Ni(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,x=n.count;p<x;p++)n.setXYZ(p,0,0,0);let r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie,u=new ie,f=new ie;if(e)for(let p=0,x=e.count;p<x;p+=3){let v=e.getX(p+0),w=e.getX(p+1),S=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,v),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(v,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let p=0,x=t.count;p<x;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(p+0,u.x,u.y,u.z),n.setXYZ(p+1,u.x,u.y,u.z),n.setXYZ(p+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ks.fromBufferAttribute(e,t),Ks.normalize(),e.setXYZ(t,Ks.x,Ks.y,Ks.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,p=new c.constructor(l.length*u),x=0,v=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?x=l[w]*a.data.stride+a.offset:x=l[w]*u;for(let T=0;T<u;T++)p[v++]=c[x++]}return new Ni(p,u,f)}if(this.index===null)return je("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let p=c[u],x=e(p,n);l.push(x)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f<p;f++){let x=c[f];u.push(x.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let p=0,x=f.length;p<x;p++)u.push(f[p].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Mf=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Vd,this.updateRanges=[],this.version=0,this.uuid=Ou()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ou()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ou()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},oa=new ie,mo=class i{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)oa.fromBufferAttribute(this,t),oa.applyMatrix4(e),this.setXYZ(t,oa.x,oa.y,oa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)oa.fromBufferAttribute(this,t),oa.applyNormalMatrix(e),this.setXYZ(t,oa.x,oa.y,oa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)oa.fromBufferAttribute(this,t),oa.transformDirection(e),this.setXYZ(t,oa.x,oa.y,oa.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=la(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=qn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=la(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=la(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=la(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=la(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){AA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Ni(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){AA("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},_ce=0,ws=class extends Go{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:_ce++}),this.uuid=Ou(),this.name="",this.type="Material",this.blending=ss,this.side=Ao,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ud,this.blendDst=kd,this.blendEquation=Bs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=Bu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=gy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yf,this.stencilZFail=yf,this.stencilZPass=yf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){je(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ss&&(n.blending=this.blending),this.side!==Ao&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Ud&&(n.blendSrc=this.blendSrc),this.blendDst!==kd&&(n.blendDst=this.blendDst),this.blendEquation!==Bs&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Bu&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==gy&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==yf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==yf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ut().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Wd=class extends ws{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Qg,ay=new ie,Jg=new ie,e_=new ie,t_=new Oe,ly=new Oe,$H=new on,zS=new ie,cy=new ie,VS=new ie,hH=new Oe,bN=new Oe,fH=new Oe,_y=class extends $i{constructor(e=new Wd){if(super(),this.isSprite=!0,this.type="Sprite",Qg===void 0){Qg=new Kn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);Qg.setIndex([0,1,2,0,2,3]),Qg.setAttribute("position",new mo(n,3,0,!1)),Qg.setAttribute("uv",new mo(n,2,3,!1))}this.geometry=Qg,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jg.setFromMatrixScale(this.matrixWorld),$H.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),e_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jg.multiplyScalar(-e_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;qS(zS.set(-.5,-.5,0),e_,o,Jg,r,s),qS(cy.set(.5,-.5,0),e_,o,Jg,r,s),qS(VS.set(.5,.5,0),e_,o,Jg,r,s),hH.set(0,0),bN.set(1,0),fH.set(1,1);let a=e.ray.intersectTriangle(zS,cy,VS,!1,ay);if(a===null&&(qS(cy.set(-.5,.5,0),e_,o,Jg,r,s),bN.set(0,1),a=e.ray.intersectTriangle(zS,VS,cy,!1,ay),a===null))return;let l=e.ray.origin.distanceTo(ay);l<e.near||l>e.far||t.push({distance:l,point:ay.clone(),uv:vf.getInterpolation(ay,zS,cy,VS,hH,bN,fH,new Oe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function qS(i,e,t,n,r,s){t_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(ly.x=s*t_.x-r*t_.y,ly.y=r*t_.x+s*t_.y):ly.copy(t_),i.copy(e),i.x+=ly.x,i.y+=ly.y,i.applyMatrix4($H)}var xf=new ie,wN=new ie,HS=new ie,Fd=new ie,SN=new ie,WS=new ie,TN=new ie,Cf=class{constructor(e=new ie,t=new ie(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,xf)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=xf.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xf.copy(this.origin).addScaledVector(this.direction,t),xf.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){wN.copy(e).add(t).multiplyScalar(.5),HS.copy(t).sub(e).normalize(),Fd.copy(this.origin).sub(wN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(HS),a=Fd.dot(this.direction),l=-Fd.dot(HS),c=Fd.lengthSq(),u=Math.abs(1-o*o),f,p,x,v;if(u>0)if(f=o*l-a,p=o*a-l,v=s*u,f>=0)if(p>=-v)if(p<=v){let w=1/u;f*=w,p*=w,x=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p<=-v?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c):p<=v?(f=0,p=Math.min(Math.max(-s,-l),s),x=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(wN).addScaledVector(HS,p),x}intersectSphere(e,t){xf.subVectors(e.center,this.origin);let n=xf.dot(this.direction),r=xf.dot(xf)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,xf)!==null}intersectTriangle(e,t,n,r,s){SN.subVectors(t,e),WS.subVectors(n,e),TN.crossVectors(SN,WS);let o=this.direction.dot(TN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Fd.subVectors(this.origin,e);let l=a*this.direction.dot(WS.crossVectors(Fd,WS));if(l<0)return null;let c=a*this.direction.dot(SN.cross(Fd));if(c<0||l+c>o)return null;let u=-a*Fd.dot(TN);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Us=class extends ws{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ha,this.combine=PA,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},dH=new on,oA=new Cf,jS=new Ha,pH=new ie,XS=new ie,$S=new ie,YS=new ie,EN=new ie,ZS=new ie,AH=new ie,KS=new ie,Hn=class extends $i{constructor(e=new Kn,t=new Us){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){ZS.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(EN.fromBufferAttribute(f,e),o?ZS.addScaledVector(EN,u):ZS.addScaledVector(EN.sub(t),u))}t.add(ZS)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),jS.copy(n.boundingSphere),jS.applyMatrix4(s),oA.copy(e.ray).recast(e.near),!(jS.containsPoint(oA.origin)===!1&&(oA.intersectSphere(jS,pH)===null||oA.origin.distanceToSquared(pH)>(e.far-e.near)**2))&&(dH.copy(s).invert(),oA.copy(e.ray).applyMatrix4(dH),!(n.boundingBox!==null&&oA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,oA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,p=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=a.getX(C),F=a.getX(C+1),N=a.getX(C+2);r=QS(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(a.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=a.getX(S),R=a.getX(S+1),C=a.getX(S+2);r=QS(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=C,F=C+1,N=C+2;r=QS(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(l.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=S,R=S+1,C=S+2;r=QS(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function xce(i,e,t,n,r,s,o,a){let l;if(e.side===ui?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===Ao,a),l===null)return null;KS.copy(a),KS.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(KS);return c<t.near||c>t.far?null:{distance:c,point:KS.clone(),object:i}}function QS(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,XS),i.getVertexPosition(l,$S),i.getVertexPosition(c,YS);let u=xce(i,e,t,n,XS,$S,YS,AH);if(u){let f=new ie;vf.getBarycoord(AH,XS,$S,YS,f),r&&(u.uv=vf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=vf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=vf.getInterpolatedAttribute(o,a,l,c,f,new ie),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let p={a,b:l,c,normal:new ie,materialIndex:0};vf.getNormal(XS,$S,YS,p.normal),u.face=p,u.barycoord=f}return u}var xA=class extends bs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=xi,u=xi,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Al=class extends Ni{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var MN=new ie,yce=new ie,vce=new Sn,aa=class{constructor(e=new ie(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=MN.subVectors(n,t).cross(yce.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(MN),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||vce.getNormalMatrix(e),r=this.coplanarPoint(MN).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},aA=new Ha,bce=new Oe(.5,.5),JS=new ie,Zl=class{constructor(e=new aa,t=new aa,n=new aa,r=new aa,s=new aa,o=new aa){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=po,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],p=s[6],x=s[7],v=s[8],w=s[9],S=s[10],T=s[11],P=s[12],R=s[13],C=s[14],L=s[15];if(r[0].setComponents(c-o,x-u,T-v,L-P).normalize(),r[1].setComponents(c+o,x+u,T+v,L+P).normalize(),r[2].setComponents(c+a,x+f,T+w,L+R).normalize(),r[3].setComponents(c-a,x-f,T-w,L-R).normalize(),n)r[4].setComponents(l,p,S,C).normalize(),r[5].setComponents(c-l,x-p,T-S,L-C).normalize();else if(r[4].setComponents(c-l,x-p,T-S,L-C).normalize(),t===po)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===qa)r[5].setComponents(l,p,S,C).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),aA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),aA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(aA)}intersectsSprite(e){aA.center.set(0,0,0);let t=bce.distanceTo(e.center);return aA.radius=.7071067811865476+t,aA.applyMatrix4(e.matrixWorld),this.intersectsSphere(aA)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(JS.x=r.normal.x>0?e.max.x:e.min.x,JS.y=r.normal.y>0?e.max.y:e.min.y,JS.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(JS)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},mH=new on,xy=class i{constructor(){this.coordinateSystem=po,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){let s=t[r];mH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Zl),n[r].setFromProjectionMatrix(mH,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Zl),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var kc=class extends ws{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},AT=new ie,mT=new ie,gH=new on,uy=new Cf,eT=new Ha,CN=new ie,_H=new ie,jd=class extends $i{constructor(e=new Kn,t=new kc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)AT.fromBufferAttribute(t,r-1),mT.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=AT.distanceTo(mT);e.setAttribute("lineDistance",new kn(n,1))}else je("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),eT.copy(n.boundingSphere),eT.applyMatrix4(r),eT.radius+=s,e.ray.intersectsSphere(eT)===!1)return;gH.copy(r).invert(),uy.copy(e.ray).applyMatrix4(gH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,p=n.attributes.position;if(u!==null){let x=Math.max(0,o.start),v=Math.min(u.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=u.getX(w),P=u.getX(w+1),R=tT(this,e,uy,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=tT(this,e,uy,l,w,S,v-1);T&&t.push(T)}}else{let x=Math.max(0,o.start),v=Math.min(p.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=tT(this,e,uy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=tT(this,e,uy,l,v-1,x,v-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function tT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(AT.fromBufferAttribute(a,r),mT.fromBufferAttribute(a,s),t.distanceSqToSegment(AT,mT,CN,_H)>n)return;CN.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(CN);if(!(c<e.near||c>e.far))return{distance:c,point:_H.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var xH=new ie,yH=new ie,d_=class extends jd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)xH.fromBufferAttribute(t,r),yH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+xH.distanceTo(yH);e.setAttribute("lineDistance",new kn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var Xd=class extends ws{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},vH=new on,UN=new Cf,nT=new Ha,iT=new ie,yy=class extends $i{constructor(e=new Kn,t=new Xd){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),nT.copy(n.boundingSphere),nT.applyMatrix4(r),nT.radius+=s,e.ray.intersectsSphere(nT)===!1)return;vH.copy(r).invert(),UN.copy(e.ray).applyMatrix4(vH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let p=Math.max(0,o.start),x=Math.min(c.count,o.start+o.count);for(let v=p,w=x;v<w;v++){let S=c.getX(v);iT.fromBufferAttribute(f,S),bH(iT,S,l,r,e,t,this)}}else{let p=Math.max(0,o.start),x=Math.min(f.count,o.start+o.count);for(let v=p,w=x;v<w;v++)iT.fromBufferAttribute(f,v),bH(iT,v,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function bH(i,e,t,n,r,s,o){let a=UN.distanceSqToPoint(i);if(a<t){let l=new ie;UN.closestPointToPoint(i,l),l.applyMatrix4(n);let c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var yA=class extends bs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xi,this.minFilter=xi,this.generateMipmaps=!1,this.needsUpdate=!0}};var Uu=class extends bs{constructor(e=[],t=gl,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var os=class extends bs{constructor(e,t,n=pi,r,s,o,a=xi,l=xi,c,u=ys,f=1){if(u!==ys&&u!==Qs)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let p={width:e,height:t,depth:f};super(p,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new u_(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},p_=class extends os{constructor(e,t=pi,n=gl,r,s,o=xi,a=xi,l,c=ys){let u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},vy=class extends bs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Gc=class i extends Kn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],p=0,x=0;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,r,o,2),v("x","z","y",1,-1,e,n,-t,r,o,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new kn(c,3)),this.setAttribute("normal",new kn(u,3)),this.setAttribute("uv",new kn(f,2));function v(w,S,T,P,R,C,L,D,F,N,B){let z=C/F,V=L/N,H=C/2,Z=L/2,J=D/2,j=F+1,K=N+1,ee=0,ae=0,ce=new ie;for(let de=0;de<K;de++){let ve=de*V-Z;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*P,ce[S]=ve*R,ce[T]=J,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Ie/F),f.push(1-de/N),ee+=1}}for(let de=0;de<N;de++)for(let ve=0;ve<F;ve++){let Ie=p+ve+j*de,Qe=p+ve+j*(de+1),Ue=p+(ve+1)+j*(de+1),mt=p+(ve+1)+j*de;l.push(Ie,Qe,mt),l.push(Qe,Ue,mt),ae+=6}a.addGroup(x,ae,B),x+=ae,p+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var A_=class i extends Kn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new ie,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=t;f++,p+=3){let x=n+f/t*r;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[p]/e+1)/2,u.y=(o[p+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new kn(o,3)),this.setAttribute("normal",new kn(a,3)),this.setAttribute("uv",new kn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},vA=class i extends Kn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],p=[],x=[],v=0,w=[],S=n/2,T=0;P(),o===!1&&(e>0&&R(!0),t>0&&R(!1)),this.setIndex(u),this.setAttribute("position",new kn(f,3)),this.setAttribute("normal",new kn(p,3)),this.setAttribute("uv",new kn(x,2));function P(){let C=new ie,L=new ie,D=0,F=(t-e)/n;for(let N=0;N<=s;N++){let B=[],z=N/s,V=z*(t-e)+e;for(let H=0;H<=r;H++){let Z=H/r,J=Z*l+a,j=Math.sin(J),K=Math.cos(J);L.x=V*j,L.y=-z*n+S,L.z=V*K,f.push(L.x,L.y,L.z),C.set(j,F,K).normalize(),p.push(C.x,C.y,C.z),x.push(Z,1-z),B.push(v++)}w.push(B)}for(let N=0;N<r;N++)for(let B=0;B<s;B++){let z=w[B][N],V=w[B+1][N],H=w[B+1][N+1],Z=w[B][N+1];(e>0||B!==0)&&(u.push(z,V,Z),D+=3),(t>0||B!==s-1)&&(u.push(V,H,Z),D+=3)}c.addGroup(T,D,0),T+=D}function R(C){let L=v,D=new Oe,F=new ie,N=0,B=C===!0?e:t,z=C===!0?1:-1;for(let H=1;H<=r;H++)f.push(0,S*z,0),p.push(0,z,0),x.push(.5,.5),v++;let V=v;for(let H=0;H<=r;H++){let J=H/r*l+a,j=Math.cos(J),K=Math.sin(J);F.x=B*K,F.y=S*z,F.z=B*j,f.push(F.x,F.y,F.z),p.push(0,z,0),D.x=j*.5+.5,D.y=K*.5*z+.5,x.push(D.x,D.y),v++}for(let H=0;H<r;H++){let Z=L+H,J=V+H;C===!0?u.push(J,J+1,Z):u.push(J+1,J,Z),N+=3}c.addGroup(T,N,C===!0?1:2),T+=N}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var da=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){je("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],p=n[r+1]-u,x=(o-u)/p;return(r+x)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new ie);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new ie,r=[],s=[],o=[],a=new ie,l=new on;for(let x=0;x<=e;x++){let v=x/e;r[x]=this.getTangentAt(v,new ie)}s[0]=new ie,o[0]=new ie;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),p=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),p<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(r[x-1],r[x]),a.length()>Number.EPSILON){a.normalize();let v=Math.acos(Pn(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,v))}o[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(Pn(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],x*v)),o[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},m_=class extends da{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,x=c-this.aY;l=p*u-x*f+this.aX,c=p*f+x*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},gT=class extends m_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function mL(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let p=(o-s)/c-(a-s)/(c+u)+(a-o)/u,x=(a-o)/u-(l-o)/(u+f)+(l-a)/f;p*=u,x*=u,r(o,a,p,x)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var wH=new ie,SH=new ie,RN=new mL,PN=new mL,IN=new mL,_T=class extends da{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new ie){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(SH.subVectors(r[0],r[1]).add(r[0]),c=SH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(wH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=wH),this.curveType==="centripetal"||this.curveType==="chordal"){let x=this.curveType==="chordal"?.5:.25,v=Math.pow(c.distanceToSquared(f),x),w=Math.pow(f.distanceToSquared(p),x),S=Math.pow(p.distanceToSquared(u),x);w<1e-4&&(w=1),v<1e-4&&(v=w),S<1e-4&&(S=w),RN.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),PN.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),IN.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(RN.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),PN.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),IN.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(RN.calc(l),PN.calc(l),IN.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new ie().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function TH(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function wce(i,e){let t=1-i;return t*t*e}function Sce(i,e){return 2*(1-i)*i*e}function Tce(i,e){return i*i*e}function py(i,e,t,n){return wce(i,e)+Sce(i,t)+Tce(i,n)}function Ece(i,e){let t=1-i;return t*t*t*e}function Mce(i,e){let t=1-i;return 3*t*t*i*e}function Cce(i,e){return 3*(1-i)*i*i*e}function Rce(i,e){return i*i*i*e}function Ay(i,e,t,n,r){return Ece(i,e)+Mce(i,t)+Cce(i,n)+Rce(i,r)}var by=class extends da{constructor(e=new Oe,t=new Oe,n=new Oe,r=new Oe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Ay(e,r.x,s.x,o.x,a.x),Ay(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},g_=class extends da{constructor(e=new ie,t=new ie,n=new ie,r=new ie){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(Ay(e,r.x,s.x,o.x,a.x),Ay(e,r.y,s.y,o.y,a.y),Ay(e,r.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},wy=class extends da{constructor(e=new Oe,t=new Oe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Oe){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Oe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},xT=class extends da{constructor(e=new ie,t=new ie){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ie){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ie){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Sy=class extends da{constructor(e=new Oe,t=new Oe,n=new Oe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(py(e,r.x,s.x,o.x),py(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ty=class extends da{constructor(e=new ie,t=new ie,n=new ie){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(py(e,r.x,s.x,o.x),py(e,r.y,s.y,o.y),py(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ey=class extends da{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Oe){let n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return n.set(TH(a,l.x,c.x,u.x,f.x),TH(a,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new Oe().fromArray(r))}return this}},yT=Object.freeze({__proto__:null,ArcCurve:gT,CatmullRomCurve3:_T,CubicBezierCurve:by,CubicBezierCurve3:g_,EllipseCurve:m_,LineCurve:wy,LineCurve3:xT,QuadraticBezierCurve:Sy,QuadraticBezierCurve3:Ty,SplineCurve:Ey}),vT=class extends da{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new yT[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=n){let o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(new yT[r.type]().fromJSON(r))}return this}},bA=class extends vT{constructor(e){super(),this.type="Path",this.currentPoint=new Oe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new wy(this.currentPoint.clone(),new Oe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let s=new Sy(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){let a=new by(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r),new Oe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new Ey(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new m_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},My=class extends bA{constructor(e){super(e),this.uuid=Ou(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(new bA().fromJSON(r))}return this}};function Pce(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=YH(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=Fce(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return Cy(s,o,t,a,l,c,0),o}function YH(i,e,t,n,r){let s;if(r===jce(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=EH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=EH(o/n|0,i[o],i[o+1],s);return s&&__(s,s.next)&&(Py(s),s=s.next),s}function wA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(__(t,t.next)||Pr(t.prev,t,t.next)===0)){if(Py(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Cy(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Gce(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?Nce(i,n,r,s):Ice(i)){e.push(l.i,i.i,c.i),Py(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=Lce(wA(i),e),Cy(i,e,t,n,r,s,2)):o===2&&Dce(i,e,t,n,r,s):Cy(wA(i),e,t,n,r,s,1);break}}}function Ice(i){let e=i.prev,t=i,n=i.next;if(Pr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&hy(r,a,s,l,o,c,v.x,v.y)&&Pr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Nce(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Pr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=kN(x,v,e,t,n),P=kN(w,S,e,t,n),R=i.prevZ,C=i.nextZ;for(;R&&R.z>=T&&C&&C.z<=P;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&hy(a,u,l,f,c,p,R.x,R.y)&&Pr(R.prev,R,R.next)>=0||(R=R.prevZ,C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&hy(a,u,l,f,c,p,C.x,C.y)&&Pr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&hy(a,u,l,f,c,p,R.x,R.y)&&Pr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&hy(a,u,l,f,c,p,C.x,C.y)&&Pr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Lce(i,e){let t=i;do{let n=t.prev,r=t.next.next;!__(n,r)&&KH(n,t,t.next,r)&&Ry(n,r)&&Ry(r,n)&&(e.push(n.i,t.i,r.i),Py(t),Py(t.next),t=i=r),t=t.next}while(t!==i);return wA(t)}function Dce(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&qce(o,a)){let l=QH(o,a);o=wA(o,o.next),l=wA(l,l.next),Cy(o,e,t,n,r,s,0),Cy(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Fce(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=YH(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Vce(c))}r.sort(Oce);for(let s=0;s<r.length;s++)t=Bce(r[s],t);return t}function Oce(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Bce(i,e){let t=Uce(i,e);if(!t)return e;let n=QH(t,i);return wA(n,n.next),wA(t,t.next)}function Uce(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(__(i,t))return t;do{if(__(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&ZH(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){let f=Math.abs(r-t.y)/(n-t.x);Ry(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&kce(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function kce(i,e){return Pr(i.prev,i,e.prev)<0&&Pr(e.next,i,i.next)<0}function Gce(i,e,t,n){let r=i;do r.z===0&&(r.z=kN(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,zce(r)}function zce(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function kN(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Vce(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function ZH(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function hy(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&ZH(i,e,t,n,r,s,o,a)}function qce(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Hce(i,e)&&(Ry(i,e)&&Ry(e,i)&&Wce(i,e)&&(Pr(i.prev,i,e.prev)||Pr(i,e.prev,e))||__(i,e)&&Pr(i.prev,i,i.next)>0&&Pr(e.prev,e,e.next)>0)}function Pr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function __(i,e){return i.x===e.x&&i.y===e.y}function KH(i,e,t,n){let r=sT(Pr(i,e,t)),s=sT(Pr(i,e,n)),o=sT(Pr(t,n,i)),a=sT(Pr(t,n,e));return!!(r!==s&&o!==a||r===0&&rT(i,t,e)||s===0&&rT(i,n,e)||o===0&&rT(t,i,n)||a===0&&rT(t,e,n))}function rT(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function sT(i){return i>0?1:i<0?-1:0}function Hce(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&KH(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Ry(i,e){return Pr(i.prev,i,i.next)<0?Pr(i,e,i.next)>=0&&Pr(i,i.prev,e)>=0:Pr(i,e,i.prev)<0||Pr(i,i.next,e)<0}function Wce(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function QH(i,e){let t=GN(i.i,i.x,i.y),n=GN(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function EH(i,e,t,n){let r=GN(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Py(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function GN(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function jce(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}var zN=class{static triangulate(e,t,n=2){return Pce(e,t,n)}},Bd=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];MH(e),CH(n,e);let o=e.length;t.forEach(MH);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,CH(n,t[l]);let a=zN.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function MH(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function CH(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Iy=class i extends Kn{constructor(e=new My([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new kn(r,3)),this.setAttribute("uv",new kn(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:x-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,P=t.UVGenerator!==void 0?t.UVGenerator:Xce,R,C=!1,L,D,F,N;if(T){R=T.getSpacedPoints(u),C=!0,p=!1;let Xe=T.isCatmullRomCurve3?T.closed:!1;L=T.computeFrenetFrames(u,Xe),D=new ie,F=new ie,N=new ie}p||(S=0,x=0,v=0,w=0);let B=a.extractPoints(c),z=B.shape,V=B.holes;if(!Bd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];Bd.isClockWise(tt)&&(V[Xe]=tt.reverse())}}function Z(Xe){let tt=10000000000000001e-36,vt=Xe[0];for(let yt=1;yt<=Xe.length;yt++){let ln=yt%Xe.length,Kt=Xe[ln],Qt=Kt.x-vt.x,xn=Kt.y-vt.y,ge=Qt*Qt+xn*xn,di=Math.max(Math.abs(Kt.x),Math.abs(Kt.y),Math.abs(vt.x),Math.abs(vt.y)),On=tt*di*di;if(ge<=On){Xe.splice(ln,1),yt--;continue}vt=Kt}}Z(z),V.forEach(Z);let J=V.length,j=z;for(let Xe=0;Xe<J;Xe++){let st=V[Xe];z=z.concat(st)}function K(Xe,st,tt){return st||Ge("ExtrudeGeometry: vec does not exist"),Xe.clone().addScaledVector(st,tt)}let ee=z.length;function ae(Xe,st,tt){let vt,yt,ln,Kt=Xe.x-st.x,Qt=Xe.y-st.y,xn=tt.x-Xe.x,ge=tt.y-Xe.y,di=Kt*Kt+Qt*Qt,On=Kt*ge-Qt*xn;if(Math.abs(On)>Number.EPSILON){let le=Math.sqrt(di),X=Math.sqrt(xn*xn+ge*ge),Te=st.x-Qt/le,Pe=st.y+Kt/le,Ve=tt.x-ge/X,gt=tt.y+xn/X,St=((Ve-Te)*ge-(gt-Pe)*xn)/(Kt*ge-Qt*xn);vt=Te+Kt*St-Xe.x,yt=Pe+Qt*St-Xe.y;let qe=vt*vt+yt*yt;if(qe<=2)return new Oe(vt,yt);ln=Math.sqrt(qe/2)}else{let le=!1;Kt>Number.EPSILON?xn>Number.EPSILON&&(le=!0):Kt<-Number.EPSILON?xn<-Number.EPSILON&&(le=!0):Math.sign(Qt)===Math.sign(ge)&&(le=!0),le?(vt=-Qt,yt=Kt,ln=Math.sqrt(di)):(vt=Kt,yt=Qt,ln=Math.sqrt(di/2))}return new Oe(vt/ln,yt/ln)}let ce=[];for(let Xe=0,st=j.length,tt=st-1,vt=Xe+1;Xe<st;Xe++,tt++,vt++)tt===st&&(tt=0),vt===st&&(vt=0),ce[Xe]=ae(j[Xe],j[tt],j[vt]);let de=[],ve,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];ve=[];for(let vt=0,yt=tt.length,ln=yt-1,Kt=vt+1;vt<yt;vt++,ln++,Kt++)ln===yt&&(ln=0),Kt===yt&&(Kt=0),ve[vt]=ae(tt[vt],tt[ln],tt[Kt]);de.push(ve),Ie=Ie.concat(ve)}let Qe;if(S===0)Qe=Bd.triangulateShape(j,V);else{let Xe=[],st=[];for(let tt=0;tt<S;tt++){let vt=tt/S,yt=x*Math.cos(vt*Math.PI/2),ln=v*Math.sin(vt*Math.PI/2)+w;for(let Kt=0,Qt=j.length;Kt<Qt;Kt++){let xn=K(j[Kt],ce[Kt],ln);Et(xn.x,xn.y,-yt),vt===0&&Xe.push(xn)}for(let Kt=0,Qt=J;Kt<Qt;Kt++){let xn=V[Kt];ve=de[Kt];let ge=[];for(let di=0,On=xn.length;di<On;di++){let le=K(xn[di],ve[di],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=Bd.triangulateShape(Xe,st)}let Ue=Qe.length,mt=v+w;for(let Xe=0;Xe<ee;Xe++){let st=p?K(z[Xe],Ie[Xe],mt):z[Xe];C?(F.copy(L.normals[0]).multiplyScalar(st.x),D.copy(L.binormals[0]).multiplyScalar(st.y),N.copy(R[0]).add(F).add(D),Et(N.x,N.y,N.z)):Et(st.x,st.y,0)}for(let Xe=1;Xe<=u;Xe++)for(let st=0;st<ee;st++){let tt=p?K(z[st],Ie[st],mt):z[st];C?(F.copy(L.normals[Xe]).multiplyScalar(tt.x),D.copy(L.binormals[Xe]).multiplyScalar(tt.y),N.copy(R[Xe]).add(F).add(D),Et(N.x,N.y,N.z)):Et(tt.x,tt.y,f/u*Xe)}for(let Xe=S-1;Xe>=0;Xe--){let st=Xe/S,tt=x*Math.cos(st*Math.PI/2),vt=v*Math.sin(st*Math.PI/2)+w;for(let yt=0,ln=j.length;yt<ln;yt++){let Kt=K(j[yt],ce[yt],vt);Et(Kt.x,Kt.y,f+tt)}for(let yt=0,ln=V.length;yt<ln;yt++){let Kt=V[yt];ve=de[yt];for(let Qt=0,xn=Kt.length;Qt<xn;Qt++){let ge=K(Kt[Qt],ve[Qt],vt);C?Et(ge.x,ge.y+R[u-1].y,R[u-1].x+tt):Et(ge.x,ge.y,f+tt)}}}Me(),ze();function Me(){let Xe=r.length/3;if(p){let st=0,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[2]+tt,yt[1]+tt,yt[0]+tt)}st=u+S*2,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[0]+tt,yt[1]+tt,yt[2]+tt)}}else{for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[2],tt[1],tt[0])}for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[0]+ee*u,tt[1]+ee*u,tt[2]+ee*u)}}n.addGroup(Xe,r.length/3-Xe,0)}function ze(){let Xe=r.length/3,st=0;$e(j,st),st+=j.length;for(let tt=0,vt=V.length;tt<vt;tt++){let yt=V[tt];$e(yt,st),st+=yt.length}n.addGroup(Xe,r.length/3-Xe,1)}function $e(Xe,st){let tt=Xe.length;for(;--tt>=0;){let vt=tt,yt=tt-1;yt<0&&(yt=Xe.length-1);for(let ln=0,Kt=u+S*2;ln<Kt;ln++){let Qt=ee*ln,xn=ee*(ln+1),ge=st+vt+Qt,di=st+yt+Qt,On=st+yt+xn,le=st+vt+xn;Ct(ge,di,On,le)}}}function Et(Xe,st,tt){l.push(Xe),l.push(st),l.push(tt)}function Tt(Xe,st,tt){un(Xe),un(st),un(tt);let vt=r.length/3,yt=P.generateTopUV(n,r,vt-3,vt-2,vt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Ct(Xe,st,tt,vt){un(Xe),un(st),un(vt),un(st),un(tt),un(vt);let yt=r.length/3,ln=P.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(ln[0]),Gt(ln[1]),Gt(ln[3]),Gt(ln[1]),Gt(ln[2]),Gt(ln[3])}function un(Xe){r.push(l[Xe*3+0]),r.push(l[Xe*3+1]),r.push(l[Xe*3+2])}function Gt(Xe){s.push(Xe.x),s.push(Xe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return $ce(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new yT[r.type]().fromJSON(r)),new i(n,e.options)}},Xce={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],p=e[r*3],x=e[r*3+1],v=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(p,1-v),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(x,1-v),new Oe(S,1-T)]}};function $ce(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){let s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var SA=class i extends Kn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,p=t/l,x=[],v=[],w=[],S=[];for(let T=0;T<u;T++){let P=T*p-o;for(let R=0;R<c;R++){let C=R*f-s;v.push(C,-P,0),w.push(0,0,1),S.push(R/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let P=0;P<a;P++){let R=P+c*T,C=P+c*(T+1),L=P+1+c*(T+1),D=P+1+c*T;x.push(R,C,D),x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new kn(v,3)),this.setAttribute("normal",new kn(w,3)),this.setAttribute("uv",new kn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var pa=class i extends Kn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new ie,p=new ie,x=[],v=[],w=[],S=[];for(let T=0;T<=n;T++){let P=[],R=T/n,C=o+R*a,L=e*Math.cos(C),D=Math.sqrt(e*e-L*L),F=0;T===0&&o===0?F=.5/t:T===n&&l===Math.PI&&(F=-.5/t);for(let N=0;N<=t;N++){let B=N/t,z=r+B*s;f.x=-D*Math.cos(z),f.y=L,f.z=D*Math.sin(z),v.push(f.x,f.y,f.z),p.copy(f).normalize(),w.push(p.x,p.y,p.z),S.push(B+F,1-R),P.push(c++)}u.push(P)}for(let T=0;T<n;T++)for(let P=0;P<t;P++){let R=u[T][P+1],C=u[T][P],L=u[T+1][P],D=u[T+1][P+1];(T!==0||o>0)&&x.push(R,C,D),(T!==n-1||l<Math.PI)&&x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new kn(v,3)),this.setAttribute("normal",new kn(w,3)),this.setAttribute("uv",new kn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Ny=class i extends Kn{constructor(e=new Ty(new ie(-1,-1,0),new ie(-1,1,0),new ie(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new ie,l=new ie,c=new Oe,u=new ie,f=[],p=[],x=[],v=[];w(),this.setIndex(v),this.setAttribute("position",new kn(f,3)),this.setAttribute("normal",new kn(p,3)),this.setAttribute("uv",new kn(x,2));function w(){for(let R=0;R<t;R++)S(R);S(s===!1?t:0),P(),T()}function S(R){u=e.getPointAt(R/t,u);let C=o.normals[R],L=o.binormals[R];for(let D=0;D<=r;D++){let F=D/r*Math.PI*2,N=Math.sin(F),B=-Math.cos(F);l.x=B*C.x+N*L.x,l.y=B*C.y+N*L.y,l.z=B*C.z+N*L.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let R=1;R<=t;R++)for(let C=1;C<=r;C++){let L=(r+1)*(R-1)+(C-1),D=(r+1)*R+(C-1),F=(r+1)*R+C,N=(r+1)*(R-1)+C;v.push(L,D,N),v.push(D,F,N)}}function P(){for(let R=0;R<=t;R++)for(let C=0;C<=r;C++)c.x=R/t,c.y=C/r,x.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new yT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},Ly=class extends Kn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new ie,s=new ie;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],p=f.start,x=f.count;for(let v=p,w=p+x;v<w;v+=3)for(let S=0;S<3;S++){let T=a.getX(v+S),P=a.getX(v+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,P),RH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,f=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,f),RH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new kn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function RH(i,e,t){let n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var Dy=class extends ws{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ut(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function zA(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(PH(r))r.isRenderTargetTexture?(je("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(PH(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function qo(i){let e={};for(let t=0;t<i.length;t++){let n=zA(i[t]);for(let r in n)e[r]=n[r]}return e}function PH(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Yce(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function gL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var VA={clone:zA,merge:qo},Zce=`void main() {1010 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );11-}`,$ce=`void main() {11+}`,Kce=`void main() {1212 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );13-}`,jr=class extends bs{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Xce,this.fragmentShader=$ce,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=GA(e.uniforms),this.uniformsGroups=jce(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Ut().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new ie().fromArray(r.value);break;case"v4":this.uniforms[n].value=new gn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Sn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new on().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},bT=class extends jr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},x_=class extends bs{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ut(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ua,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Fy=class extends x_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Pn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},SA=class extends bs{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ut(16777215),this.specular=new Ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ua,this.combine=RA,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Oy=class extends bs{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},By=class extends bs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},pa=class extends bs{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ua,this.combine=RA,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},wT=class extends bs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=VH,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},ST=class extends bs{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},Uy=class extends bs{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},ky=class extends kc{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function oT(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var $d=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},TT=class extends $d{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:DN,endingEnd:DN}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case FN:s=e,a=2*t-n;break;case ON:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case FN:o=e,l=2*n-t;break;case ON:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,p=this._weightPrev,x=this._weightNext,v=(n-t)/(r-t),w=v*v,S=w*v,T=-p*S+2*p*w-p*v,P=(1+p)*S+(-1.5-2*p)*w+(-.5+p)*v+1,R=(-1-x)*S+(1.5+x)*w+.5*v,C=x*S-x*w;for(let L=0;L!==a;++L)s[L]=T*o[u+L]+P*o[c+L]+R*o[l+L]+C*o[f+L];return s}},ET=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let p=0;p!==a;++p)s[p]=o[c+p]*f+o[l+p]*u;return s}},MT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},CT=class extends $d{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let v=(n-t)/(r-t),w=1-v;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*v;return s}let p=a*2,x=e-1;for(let v=0;v!==a;++v){let w=o[c+v],S=o[l+v],T=x*p+v*2,P=f[T],R=f[T+1],C=e*p+v*2,L=u[C],D=u[C+1],F=(n-t)/(r-t),N,B,z,V,H;for(let K=0;K<8;K++){N=F*F,B=N*F,z=1-F,V=z*z,H=V*z;let j=H*t+3*V*F*P+3*z*N*L+B*r-n;if(Math.abs(j)<1e-10)break;let Z=3*V*(P-t)+6*z*F*(L-P)+3*N*(r-L);if(Math.abs(Z)<1e-10)break;F=F-j/Z,F=Math.max(0,Math.min(1,F))}s[v]=H*w+3*V*F*R+3*z*N*D+B*S}return s}},ml=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=oT(t,this.TimeBufferType),this.values=oT(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:oT(e.times,Array),values:oT(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new MT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ET(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new TT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new CT(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case my:t=this.InterpolantFactoryMethodDiscrete;break;case fT:t=this.InterpolantFactoryMethodLinear;break;case uT:t=this.InterpolantFactoryMethodSmooth;break;case LN:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return je("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return my;case this.InterpolantFactoryMethodLinear:return fT;case this.InterpolantFactoryMethodSmooth:return uT;case this.InterpolantFactoryMethodBezier:return LN}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){Ge("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Ge("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&E_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){Ge("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===uT,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,p=f-n,x=f+n;for(let v=0;v!==n;++v){let w=t[f+v];if(w!==t[p+v]||w!==t[x+v]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,p=o*n;for(let x=0;x!==n;++x)t[p+x]=t[f+x]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};ml.prototype.ValueTypeName="";ml.prototype.TimeBufferType=Float32Array;ml.prototype.ValueBufferType=Float32Array;ml.prototype.DefaultInterpolation=fT;var Yd=class extends ml{constructor(e,t,n){super(e,t,n)}};Yd.prototype.ValueTypeName="bool";Yd.prototype.ValueBufferType=Array;Yd.prototype.DefaultInterpolation=my;Yd.prototype.InterpolantFactoryMethodLinear=void 0;Yd.prototype.InterpolantFactoryMethodSmooth=void 0;var RT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};RT.prototype.ValueTypeName="color";var PT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};PT.prototype.ValueTypeName="number";var IT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)ys.slerpFlat(s,0,o,c-a,o,c,l);return s}},Gy=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new IT(this.times,this.values,this.getValueSize(),e)}};Gy.prototype.ValueTypeName="quaternion";Gy.prototype.InterpolantFactoryMethodSmooth=void 0;var Kd=class extends ml{constructor(e,t,n){super(e,t,n)}};Kd.prototype.ValueTypeName="string";Kd.prototype.ValueBufferType=Array;Kd.prototype.DefaultInterpolation=my;Kd.prototype.InterpolantFactoryMethodLinear=void 0;Kd.prototype.InterpolantFactoryMethodSmooth=void 0;var NT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};NT.prototype.ValueTypeName="vector";var hT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(RH(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!RH(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function RH(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var LT=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,p=c.length;f<p;f+=2){let x=c[f],v=c[f+1];if(x.global&&(x.lastIndex=0),x.test(u))return v}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},ZH=new LT,Zd=class{constructor(e){this.manager=e!==void 0?e:ZH,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Zd.DEFAULT_MATERIAL_NAME="__DEFAULT";var n_=new WeakMap,DT=class extends Zd{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=hT.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=n_.get(o);f===void 0&&(f=[],n_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=l_("img");function l(){u(),t&&t(this);let f=n_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}n_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),hT.remove(`image:${e}`);let p=n_.get(this)||[];for(let x=0;x<p.length;x++){let v=p[x];v.onError&&v.onError(f)}n_.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),hT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var zc=class extends Zd{constructor(e){super(e)}load(e,t,n,r){let s=new vs,o=new DT(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},ku=class extends $i{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},zy=class extends ku{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ut(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},IN=new on,PH=new ie,IH=new ie,Vy=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Gi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Kl,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new gn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;PH.setFromMatrixPosition(e.matrixWorld),t.position.copy(PH),IH.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(IH),t.updateMatrixWorld(),IN.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(IN,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Va||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(IN)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},aT=new ie,lT=new ys,Fu=new ie,Rf=class extends $i{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=po,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(aT,lT,Fu),Fu.x===1&&Fu.y===1&&Fu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aT,lT,Fu.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(aT,lT,Fu),Fu.x===1&&Fu.y===1&&Fu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aT,lT,Fu.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Od=new ie,NH=new Oe,LH=new Oe,Rr=class extends Rf{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Ef*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(fy*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ef*2*Math.atan(Math.tan(fy*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Od.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Od.x,Od.y).multiplyScalar(-e/Od.z),Od.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Od.x,Od.y).multiplyScalar(-e/Od.z)}getViewSize(e,t){return this.getViewBounds(e,NH,LH),t.subVectors(LH,NH)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(fy*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},zN=class extends Vy{constructor(){super(new Rr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ef*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},TA=class extends ku{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new zN}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},VN=class extends Vy{constructor(){super(new Rr(90,1,.5,500)),this.isPointLightShadow=!0}},qy=class extends ku{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new VN}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Vc=class extends Rf{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},qN=class extends Vy{constructor(){super(new Vc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},EA=class extends ku{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.shadow=new qN}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},MA=class extends ku{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},Hy=class extends ku{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},FT=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ie)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},Wy=class extends ku{constructor(e=new FT,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var jy=class extends Zn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var i_=-90,r_=1,y_=class extends $i{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Rr(i_,r_,e,t);r.layers=this.layers,this.add(r);let s=new Rr(i_,r_,e,t);s.layers=this.layers,this.add(s);let o=new Rr(i_,r_,e,t);o.layers=this.layers,this.add(o);let a=new Rr(i_,r_,e,t);a.layers=this.layers,this.add(a);let l=new Rr(i_,r_,e,t);l.layers=this.layers,this.add(l);let c=new Rr(i_,r_,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===po)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Va)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,p,x),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}},v_=class extends Rr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},CA=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Yce.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function Yce(){this._document.hidden===!1&&this.reset()}var gL="\\[\\]\\.:\\/",Kce=new RegExp("["+gL+"]","g"),_L="[^"+gL+"]",Zce="[^"+gL.replace("\\.","")+"]",Qce=/((?:WC+[\/:])*)/.source.replace("WC",_L),Jce=/(WCOD+)?/.source.replace("WCOD",Zce),eue=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_L),tue=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_L),nue=new RegExp("^"+Qce+Jce+eue+tue+"$"),iue=["material","materials","bones","map"],HN=class{constructor(e,t,n){let r=n||cr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},cr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Kce,"")}static parseTrackName(e){let t=nue.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);iue.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){je("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ge("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};cr.Composite=HN;cr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};cr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};cr.prototype.GetterByBindingType=[cr.prototype._getValue_direct,cr.prototype._getValue_array,cr.prototype._getValue_arrayElement,cr.prototype._getValue_toArray];cr.prototype.SetterByBindingTypeAndVersioning=[[cr.prototype._setValue_direct,cr.prototype._setValue_direct_setNeedsUpdate,cr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_array,cr.prototype._setValue_array_setNeedsUpdate,cr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_arrayElement,cr.prototype._setValue_arrayElement_setNeedsUpdate,cr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_fromArray,cr.prototype._setValue_fromArray_setNeedsUpdate,cr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var xze=new Float32Array(1);var Gu=class extends Mf{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var DH=new on,Xy=class{constructor(e,t,n=0,r=1/0){this.ray=new Cf(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new h_,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return DH.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(DH),this}intersectObject(e,t=!0,n=[]){return WN(e,this,n,t),n.sort(FH),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)WN(e[r],this,n,t);return n.sort(FH),n}};function FH(i,e){return i.distance-e.distance}function WN(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)WN(s[o],e,t,!0)}}var b_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Pn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Pn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var wL=class wL{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};wL.prototype.isMatrix2=!0;var w_=wL,OH=new Oe,OT=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=OH.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,OH).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},BH=new ie,cT=new ie,s_=new ie,o_=new ie,NN=new ie,rue=new ie,sue=new ie,$y=class{constructor(e=new ie,t=new ie){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){BH.subVectors(e,this.start),cT.subVectors(this.end,this.start);let n=cT.dot(cT);if(n===0)return 0;let s=cT.dot(BH)/n;return t&&(s=Pn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=rue,n=sue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;s_.subVectors(c,a),o_.subVectors(u,l),NN.subVectors(a,l);let f=s_.dot(s_),p=o_.dot(o_),x=o_.dot(NN);if(f<=r&&p<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=x/p,o=Pn(o,0,1);else{let v=s_.dot(NN);if(p<=r)o=0,s=Pn(-v/f,0,1);else{let w=s_.dot(o_),S=f*p-w*w;S!==0?s=Pn((w*x-v*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=Pn(-v/f,0,1)):o>1&&(o=1,s=Pn((w-v)/f,0,1))}}return t.copy(a).addScaledVector(s_,s),n.copy(l).addScaledVector(o_,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var Yy=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new vA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let p=0,x=f-1;p<f;x=p++){let v=c[p],w=c[x];v.y>l.y!=w.y>l.y&&l.x<(w.x-v.x)*(l.y-v.y)/(w.y-v.y)+v.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,p=[],x=l.length;for(let v=0;v<x;v++){let w=l[v],S=l[(v+1)%x];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);p.push(T)}}return p.length>1&&(p.sort((v,w)=>v-w),u.x=(p[0]+p[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(je('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Bd.area(c);if(u===0)continue;let f=new OT;for(let p=0;p<c.length;p++)f.expandByPoint(c[p]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let p=s[f];if(p.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,p.points)){c.container=p.exclude?p.container:p,u=p.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new My;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new vA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Pf=class extends ko{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){je("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function w2(i,e,t,n){let r=oue(n);switch(t){case S_:return i*e;case Lf:return i*e/r.components*r.byteLength;case Xu:return i*e/r.components*r.byteLength;case ws:return i*e*2/r.components*r.byteLength;case $u:return i*e*2/r.components*r.byteLength;case Nf:return i*e*3/r.components*r.byteLength;case xr:return i*e*4/r.components*r.byteLength;case ip:return i*e*4/r.components*r.byteLength;case Yu:case Ku:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Zu:case Qu:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case FA:case BA:return Math.max(i,16)*Math.max(e,8)/4;case DA:case OA:return Math.max(i,8)*Math.max(e,8)/2;case rp:case sp:case ap:case lp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case op:case Ju:case cp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case up:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case hp:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case fp:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case dp:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case pp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Ap:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case mp:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case gp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case _p:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case xp:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case yp:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case vp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case bp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case wp:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Sp:case Tp:case Ep:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Mp:case Cp:return Math.ceil(i/4)*Math.ceil(e/4)*8;case eh:case Rp:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function oue(i){switch(i){case Gi:case Wu:return{byteLength:1,components:1};case Ha:case ju:case Li:return{byteLength:2,components:1};case PA:case IA:return{byteLength:2,components:4};case pi:case Ir:case Yi:return{byteLength:4,components:1};case NA:case LA:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?je("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function vW(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function cue(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,u),a.onUploadCallback();let x;if(c instanceof Float32Array)x=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)x=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?x=i.HALF_FLOAT:x=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)x=i.SHORT;else if(c instanceof Uint32Array)x=i.UNSIGNED_INT;else if(c instanceof Int32Array)x=i.INT;else if(c instanceof Int8Array)x=i.BYTE;else if(c instanceof Uint8Array)x=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)x=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:x,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((x,v)=>x.start-v.start);let p=0;for(let x=1;x<f.length;x++){let v=f[p],w=f[x];w.start<=v.start+v.count+1?v.count=Math.max(v.count,w.start+w.count-v.start):(++p,f[p]=w)}f.length=p+1;for(let x=0,v=f.length;x<v;x++){let w=f[x];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var uue=`#ifdef USE_ALPHAHASH13+}`,jr=class extends ws{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Zce,this.fragmentShader=Kce,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=zA(e.uniforms),this.uniformsGroups=Yce(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Ut().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new ie().fromArray(r.value);break;case"v4":this.uniforms[n].value=new gn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Sn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new on().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},bT=class extends jr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},x_=class extends ws{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ut(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ha,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Fy=class extends x_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Pn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},TA=class extends ws{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ut(16777215),this.specular=new Ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ha,this.combine=PA,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Oy=class extends ws{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},By=class extends ws{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},Aa=class extends ws{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ha,this.combine=PA,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},wT=class extends ws{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=HH,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},ST=class extends ws{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},Uy=class extends ws{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},ky=class extends kc{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function oT(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var $d=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},TT=class extends $d{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:FN,endingEnd:FN}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case ON:s=e,a=2*t-n;break;case BN:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case ON:o=e,l=2*n-t;break;case BN:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,p=this._weightPrev,x=this._weightNext,v=(n-t)/(r-t),w=v*v,S=w*v,T=-p*S+2*p*w-p*v,P=(1+p)*S+(-1.5-2*p)*w+(-.5+p)*v+1,R=(-1-x)*S+(1.5+x)*w+.5*v,C=x*S-x*w;for(let L=0;L!==a;++L)s[L]=T*o[u+L]+P*o[c+L]+R*o[l+L]+C*o[f+L];return s}},ET=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let p=0;p!==a;++p)s[p]=o[c+p]*f+o[l+p]*u;return s}},MT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},CT=class extends $d{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let v=(n-t)/(r-t),w=1-v;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*v;return s}let p=a*2,x=e-1;for(let v=0;v!==a;++v){let w=o[c+v],S=o[l+v],T=x*p+v*2,P=f[T],R=f[T+1],C=e*p+v*2,L=u[C],D=u[C+1],F=(n-t)/(r-t),N,B,z,V,H;for(let Z=0;Z<8;Z++){N=F*F,B=N*F,z=1-F,V=z*z,H=V*z;let j=H*t+3*V*F*P+3*z*N*L+B*r-n;if(Math.abs(j)<1e-10)break;let K=3*V*(P-t)+6*z*F*(L-P)+3*N*(r-L);if(Math.abs(K)<1e-10)break;F=F-j/K,F=Math.max(0,Math.min(1,F))}s[v]=H*w+3*V*F*R+3*z*N*D+B*S}return s}},ml=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=oT(t,this.TimeBufferType),this.values=oT(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:oT(e.times,Array),values:oT(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new MT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ET(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new TT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new CT(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case my:t=this.InterpolantFactoryMethodDiscrete;break;case fT:t=this.InterpolantFactoryMethodLinear;break;case uT:t=this.InterpolantFactoryMethodSmooth;break;case DN:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return je("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return my;case this.InterpolantFactoryMethodLinear:return fT;case this.InterpolantFactoryMethodSmooth:return uT;case this.InterpolantFactoryMethodBezier:return DN}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){Ge("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Ge("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&E_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){Ge("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===uT,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,p=f-n,x=f+n;for(let v=0;v!==n;++v){let w=t[f+v];if(w!==t[p+v]||w!==t[x+v]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,p=o*n;for(let x=0;x!==n;++x)t[p+x]=t[f+x]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};ml.prototype.ValueTypeName="";ml.prototype.TimeBufferType=Float32Array;ml.prototype.ValueBufferType=Float32Array;ml.prototype.DefaultInterpolation=fT;var Yd=class extends ml{constructor(e,t,n){super(e,t,n)}};Yd.prototype.ValueTypeName="bool";Yd.prototype.ValueBufferType=Array;Yd.prototype.DefaultInterpolation=my;Yd.prototype.InterpolantFactoryMethodLinear=void 0;Yd.prototype.InterpolantFactoryMethodSmooth=void 0;var RT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};RT.prototype.ValueTypeName="color";var PT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};PT.prototype.ValueTypeName="number";var IT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)vs.slerpFlat(s,0,o,c-a,o,c,l);return s}},Gy=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new IT(this.times,this.values,this.getValueSize(),e)}};Gy.prototype.ValueTypeName="quaternion";Gy.prototype.InterpolantFactoryMethodSmooth=void 0;var Zd=class extends ml{constructor(e,t,n){super(e,t,n)}};Zd.prototype.ValueTypeName="string";Zd.prototype.ValueBufferType=Array;Zd.prototype.DefaultInterpolation=my;Zd.prototype.InterpolantFactoryMethodLinear=void 0;Zd.prototype.InterpolantFactoryMethodSmooth=void 0;var NT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};NT.prototype.ValueTypeName="vector";var hT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(IH(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!IH(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function IH(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var LT=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,p=c.length;f<p;f+=2){let x=c[f],v=c[f+1];if(x.global&&(x.lastIndex=0),x.test(u))return v}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},JH=new LT,Kd=class{constructor(e){this.manager=e!==void 0?e:JH,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Kd.DEFAULT_MATERIAL_NAME="__DEFAULT";var n_=new WeakMap,DT=class extends Kd{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=hT.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=n_.get(o);f===void 0&&(f=[],n_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=l_("img");function l(){u(),t&&t(this);let f=n_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}n_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),hT.remove(`image:${e}`);let p=n_.get(this)||[];for(let x=0;x<p.length;x++){let v=p[x];v.onError&&v.onError(f)}n_.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),hT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var zc=class extends Kd{constructor(e){super(e)}load(e,t,n,r){let s=new bs,o=new DT(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},ku=class extends $i{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},zy=class extends ku{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ut(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},NN=new on,NH=new ie,LH=new ie,Vy=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Gi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Zl,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new gn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;NH.setFromMatrixPosition(e.matrixWorld),t.position.copy(NH),LH.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(LH),t.updateMatrixWorld(),NN.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(NN,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===qa||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(NN)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},aT=new ie,lT=new vs,Fu=new ie,Rf=class extends $i{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=po,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(aT,lT,Fu),Fu.x===1&&Fu.y===1&&Fu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aT,lT,Fu.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(aT,lT,Fu),Fu.x===1&&Fu.y===1&&Fu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aT,lT,Fu.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Od=new ie,DH=new Oe,FH=new Oe,Rr=class extends Rf{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Ef*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(fy*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ef*2*Math.atan(Math.tan(fy*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Od.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Od.x,Od.y).multiplyScalar(-e/Od.z),Od.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Od.x,Od.y).multiplyScalar(-e/Od.z)}getViewSize(e,t){return this.getViewBounds(e,DH,FH),t.subVectors(FH,DH)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(fy*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},VN=class extends Vy{constructor(){super(new Rr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ef*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},EA=class extends ku{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new VN}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},qN=class extends Vy{constructor(){super(new Rr(90,1,.5,500)),this.isPointLightShadow=!0}},qy=class extends ku{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new qN}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Vc=class extends Rf{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},HN=class extends Vy{constructor(){super(new Vc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},MA=class extends ku{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.shadow=new HN}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},CA=class extends ku{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},Hy=class extends ku{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},FT=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ie)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},Wy=class extends ku{constructor(e=new FT,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var jy=class extends Kn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var i_=-90,r_=1,y_=class extends $i{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Rr(i_,r_,e,t);r.layers=this.layers,this.add(r);let s=new Rr(i_,r_,e,t);s.layers=this.layers,this.add(s);let o=new Rr(i_,r_,e,t);o.layers=this.layers,this.add(o);let a=new Rr(i_,r_,e,t);a.layers=this.layers,this.add(a);let l=new Rr(i_,r_,e,t);l.layers=this.layers,this.add(l);let c=new Rr(i_,r_,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===po)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===qa)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,p,x),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}},v_=class extends Rr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},RA=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Qce.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function Qce(){this._document.hidden===!1&&this.reset()}var _L="\\[\\]\\.:\\/",Jce=new RegExp("["+_L+"]","g"),xL="[^"+_L+"]",eue="[^"+_L.replace("\\.","")+"]",tue=/((?:WC+[\/:])*)/.source.replace("WC",xL),nue=/(WCOD+)?/.source.replace("WCOD",eue),iue=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xL),rue=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xL),sue=new RegExp("^"+tue+nue+iue+rue+"$"),oue=["material","materials","bones","map"],WN=class{constructor(e,t,n){let r=n||cr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},cr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Jce,"")}static parseTrackName(e){let t=sue.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);oue.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){je("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ge("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};cr.Composite=WN;cr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};cr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};cr.prototype.GetterByBindingType=[cr.prototype._getValue_direct,cr.prototype._getValue_array,cr.prototype._getValue_arrayElement,cr.prototype._getValue_toArray];cr.prototype.SetterByBindingTypeAndVersioning=[[cr.prototype._setValue_direct,cr.prototype._setValue_direct_setNeedsUpdate,cr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_array,cr.prototype._setValue_array_setNeedsUpdate,cr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_arrayElement,cr.prototype._setValue_arrayElement_setNeedsUpdate,cr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_fromArray,cr.prototype._setValue_fromArray_setNeedsUpdate,cr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var wze=new Float32Array(1);var Gu=class extends Mf{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var OH=new on,Xy=class{constructor(e,t,n=0,r=1/0){this.ray=new Cf(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new h_,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return OH.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(OH),this}intersectObject(e,t=!0,n=[]){return jN(e,this,n,t),n.sort(BH),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)jN(e[r],this,n,t);return n.sort(BH),n}};function BH(i,e){return i.distance-e.distance}function jN(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)jN(s[o],e,t,!0)}}var b_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Pn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Pn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var SL=class SL{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};SL.prototype.isMatrix2=!0;var w_=SL,UH=new Oe,OT=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=UH.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,UH).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},kH=new ie,cT=new ie,s_=new ie,o_=new ie,LN=new ie,aue=new ie,lue=new ie,$y=class{constructor(e=new ie,t=new ie){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){kH.subVectors(e,this.start),cT.subVectors(this.end,this.start);let n=cT.dot(cT);if(n===0)return 0;let s=cT.dot(kH)/n;return t&&(s=Pn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=aue,n=lue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;s_.subVectors(c,a),o_.subVectors(u,l),LN.subVectors(a,l);let f=s_.dot(s_),p=o_.dot(o_),x=o_.dot(LN);if(f<=r&&p<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=x/p,o=Pn(o,0,1);else{let v=s_.dot(LN);if(p<=r)o=0,s=Pn(-v/f,0,1);else{let w=s_.dot(o_),S=f*p-w*w;S!==0?s=Pn((w*x-v*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=Pn(-v/f,0,1)):o>1&&(o=1,s=Pn((w-v)/f,0,1))}}return t.copy(a).addScaledVector(s_,s),n.copy(l).addScaledVector(o_,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var Yy=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new bA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let p=0,x=f-1;p<f;x=p++){let v=c[p],w=c[x];v.y>l.y!=w.y>l.y&&l.x<(w.x-v.x)*(l.y-v.y)/(w.y-v.y)+v.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,p=[],x=l.length;for(let v=0;v<x;v++){let w=l[v],S=l[(v+1)%x];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);p.push(T)}}return p.length>1&&(p.sort((v,w)=>v-w),u.x=(p[0]+p[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(je('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Bd.area(c);if(u===0)continue;let f=new OT;for(let p=0;p<c.length;p++)f.expandByPoint(c[p]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let p=s[f];if(p.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,p.points)){c.container=p.exclude?p.container:p,u=p.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new My;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new bA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Pf=class extends Go{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){je("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function w2(i,e,t,n){let r=cue(n);switch(t){case S_:return i*e;case Lf:return i*e/r.components*r.byteLength;case Xu:return i*e/r.components*r.byteLength;case Ss:return i*e*2/r.components*r.byteLength;case $u:return i*e*2/r.components*r.byteLength;case Nf:return i*e*3/r.components*r.byteLength;case xr:return i*e*4/r.components*r.byteLength;case ip:return i*e*4/r.components*r.byteLength;case Yu:case Zu:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ku:case Qu:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case OA:case UA:return Math.max(i,16)*Math.max(e,8)/4;case FA:case BA:return Math.max(i,8)*Math.max(e,8)/2;case rp:case sp:case ap:case lp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case op:case Ju:case cp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case up:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case hp:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case fp:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case dp:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case pp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Ap:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case mp:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case gp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case _p:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case xp:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case yp:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case vp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case bp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case wp:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Sp:case Tp:case Ep:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Mp:case Cp:return Math.ceil(i/4)*Math.ceil(e/4)*8;case eh:case Rp:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function cue(i){switch(i){case Gi:case Wu:return{byteLength:1,components:1};case Wa:case ju:case Li:return{byteLength:2,components:1};case IA:case NA:return{byteLength:2,components:4};case pi:case Ir:case Yi:return{byteLength:4,components:1};case LA:case DA:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?je("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function wW(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function fue(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,u),a.onUploadCallback();let x;if(c instanceof Float32Array)x=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)x=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?x=i.HALF_FLOAT:x=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)x=i.SHORT;else if(c instanceof Uint32Array)x=i.UNSIGNED_INT;else if(c instanceof Int32Array)x=i.INT;else if(c instanceof Int8Array)x=i.BYTE;else if(c instanceof Uint8Array)x=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)x=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:x,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((x,v)=>x.start-v.start);let p=0;for(let x=1;x<f.length;x++){let v=f[p],w=f[x];w.start<=v.start+v.count+1?v.count=Math.max(v.count,w.start+w.count-v.start):(++p,f[p]=w)}f.length=p+1;for(let x=0,v=f.length;x<v;x++){let w=f[x];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var due=`#ifdef USE_ALPHAHASH1414 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;15-#endif`,hue=`#ifdef USE_ALPHAHASH15+#endif`,pue=`#ifdef USE_ALPHAHASH1616 const float ALPHA_HASH_SCALE = 0.05;1717 float hash2D( vec2 value ) {1818 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -47,20 +47,20 @@
4747 : cases.z;4848 return clamp( threshold , 1.0e-6, 1.0 );4949 }50-#endif`,fue=`#ifdef USE_ALPHAMAP50+#endif`,Aue=`#ifdef USE_ALPHAMAP5151 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;52-#endif`,due=`#ifdef USE_ALPHAMAP52+#endif`,mue=`#ifdef USE_ALPHAMAP5353 uniform sampler2D alphaMap;54-#endif`,pue=`#ifdef USE_ALPHATEST54+#endif`,gue=`#ifdef USE_ALPHATEST5555 #ifdef ALPHA_TO_COVERAGE5656 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );5757 if ( diffuseColor.a == 0.0 ) discard;5858 #else5959 if ( diffuseColor.a < alphaTest ) discard;6060 #endif61-#endif`,Aue=`#ifdef USE_ALPHATEST61+#endif`,_ue=`#ifdef USE_ALPHATEST6262 uniform float alphaTest;63-#endif`,mue=`#ifdef USE_AOMAP63+#endif`,xue=`#ifdef USE_AOMAP6464 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;6565 reflectedLight.indirectDiffuse *= ambientOcclusion;6666 #if defined( USE_CLEARCOAT )
@@ -73,10 +73,10 @@
7373 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );7474 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );7575 #endif76-#endif`,gue=`#ifdef USE_AOMAP76+#endif`,yue=`#ifdef USE_AOMAP7777 uniform sampler2D aoMap;7878 uniform float aoMapIntensity;79-#endif`,_ue=`#ifdef USE_BATCHING79+#endif`,vue=`#ifdef USE_BATCHING8080 #if ! defined( GL_ANGLE_multi_draw )8181 #define gl_DrawID _gl_DrawID8282 uniform int _gl_DrawID;
@@ -110,15 +110,15 @@
110110 int y = j / size;111111 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );112112 }113-#endif`,xue=`#ifdef USE_BATCHING113+#endif`,bue=`#ifdef USE_BATCHING114114 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );115-#endif`,yue=`vec3 transformed = vec3( position );115+#endif`,wue=`vec3 transformed = vec3( position );116116 #ifdef USE_ALPHAHASH117117 vPosition = vec3( position );118-#endif`,vue=`vec3 objectNormal = vec3( normal );118+#endif`,Sue=`vec3 objectNormal = vec3( normal );119119 #ifdef USE_TANGENT120120 vec3 objectTangent = vec3( tangent.xyz );121-#endif`,bue=`float G_BlinnPhong_Implicit( ) {121+#endif`,Tue=`float G_BlinnPhong_Implicit( ) {122122 return 0.25;123123 }124124 float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -132,7 +132,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
132132 float G = G_BlinnPhong_Implicit( );133133 float D = D_BlinnPhong( shininess, dotNH );134134 return F * ( G * D );135-} // validated`,wue=`#ifdef USE_IRIDESCENCE135+} // validated`,Eue=`#ifdef USE_IRIDESCENCE136136 const mat3 XYZ_TO_REC709 = mat3(137137 3.2404542, -0.9692660, 0.0556434,138138 -1.5371385, 1.8760108, -0.2040259,
@@ -195,7 +195,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
195195 }196196 return max( I, vec3( 0.0 ) );197197 }198-#endif`,Sue=`#ifdef USE_BUMPMAP198+#endif`,Mue=`#ifdef USE_BUMPMAP199199 uniform sampler2D bumpMap;200200 uniform float bumpScale;201201 vec2 dHdxy_fwd() {
@@ -216,7 +216,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
216216 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );217217 return normalize( abs( fDet ) * surf_norm - vGrad );218218 }219-#endif`,Tue=`#if NUM_CLIPPING_PLANES > 0219+#endif`,Cue=`#if NUM_CLIPPING_PLANES > 0220220 vec4 plane;221221 #ifdef ALPHA_TO_COVERAGE222222 float distanceToPlane, distanceGradient;
@@ -262,20 +262,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
262262 if ( clipped ) discard;263263 #endif264264 #endif265-#endif`,Eue=`#if NUM_CLIPPING_PLANES > 0265+#endif`,Rue=`#if NUM_CLIPPING_PLANES > 0266266 varying vec3 vClipPosition;267267 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];268-#endif`,Mue=`#if NUM_CLIPPING_PLANES > 0268+#endif`,Pue=`#if NUM_CLIPPING_PLANES > 0269269 varying vec3 vClipPosition;270-#endif`,Cue=`#if NUM_CLIPPING_PLANES > 0270+#endif`,Iue=`#if NUM_CLIPPING_PLANES > 0271271 vClipPosition = - mvPosition.xyz;272-#endif`,Rue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )272+#endif`,Nue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )273273 diffuseColor *= vColor;274-#endif`,Pue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )274+#endif`,Lue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )275275 varying vec4 vColor;276-#endif`,Iue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )276+#endif`,Due=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )277277 varying vec4 vColor;278-#endif`,Nue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )278+#endif`,Fue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )279279 vColor = vec4( 1.0 );280280 #endif281281 #ifdef USE_COLOR_ALPHA
@@ -288,7 +288,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
288288 #endif289289 #ifdef USE_BATCHING_COLOR290290 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );291-#endif`,Lue=`#define PI 3.141592653589793291+#endif`,Oue=`#define PI 3.141592653589793292292 #define PI2 6.283185307179586293293 #define PI_HALF 1.5707963267948966294294 #define RECIPROCAL_PI 0.3183098861837907
@@ -359,7 +359,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
359359 float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {360360 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );361361 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );362-} // validated`,Due=`#ifdef ENVMAP_TYPE_CUBE_UV362+} // validated`,Bue=`#ifdef ENVMAP_TYPE_CUBE_UV363363 #define cubeUV_minMipLevel 4.0364364 #define cubeUV_minTileSize 16.0365365 float getFace( vec3 direction ) {
@@ -452,7 +452,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
452452 return vec4( mix( color0, color1, mipF ), 1.0 );453453 }454454 }455-#endif`,Fue=`vec3 transformedNormal = objectNormal;455+#endif`,Uue=`vec3 transformedNormal = objectNormal;456456 #ifdef USE_TANGENT457457 vec3 transformedTangent = objectTangent;458458 #endif
@@ -478,21 +478,21 @@ transformedNormal = normalMatrix * transformedNormal;
478478 #endif479479 #ifdef USE_TANGENT480480 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;481-#endif`,Oue=`#ifdef USE_DISPLACEMENTMAP481+#endif`,kue=`#ifdef USE_DISPLACEMENTMAP482482 uniform sampler2D displacementMap;483483 uniform float displacementScale;484484 uniform float displacementBias;485-#endif`,Bue=`#ifdef USE_DISPLACEMENTMAP485+#endif`,Gue=`#ifdef USE_DISPLACEMENTMAP486486 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );487-#endif`,Uue=`#ifdef USE_EMISSIVEMAP487+#endif`,zue=`#ifdef USE_EMISSIVEMAP488488 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );489489 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE490490 emissiveColor = sRGBTransferEOTF( emissiveColor );491491 #endif492492 totalEmissiveRadiance *= emissiveColor.rgb;493-#endif`,kue=`#ifdef USE_EMISSIVEMAP493+#endif`,Vue=`#ifdef USE_EMISSIVEMAP494494 uniform sampler2D emissiveMap;495-#endif`,Gue="gl_FragColor = linearToOutputTexel( gl_FragColor );",zue=`vec4 LinearTransferOETF( in vec4 value ) {495+#endif`,que="gl_FragColor = linearToOutputTexel( gl_FragColor );",Hue=`vec4 LinearTransferOETF( in vec4 value ) {496496 return value;497497 }498498 vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -500,7 +500,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
500500 }501501 vec4 sRGBTransferOETF( in vec4 value ) {502502 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );503-}`,Vue=`#ifdef USE_ENVMAP503+}`,Wue=`#ifdef USE_ENVMAP504504 #ifdef ENV_WORLDPOS505505 vec3 cameraToFrag;506506 if ( isOrthographic ) {
@@ -527,7 +527,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
527527 outgoingLight += envColor.xyz * specularStrength * reflectivity;528528 #endif529529 #endif530-#endif`,que=`#ifdef USE_ENVMAP530+#endif`,jue=`#ifdef USE_ENVMAP531531 uniform float envMapIntensity;532532 uniform mat3 envMapRotation;533533 #ifdef ENVMAP_TYPE_CUBE
@@ -535,7 +535,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
535535 #else536536 uniform sampler2D envMap;537537 #endif538-#endif`,Hue=`#ifdef USE_ENVMAP538+#endif`,Xue=`#ifdef USE_ENVMAP539539 uniform float reflectivity;540540 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )541541 #define ENV_WORLDPOS
@@ -546,7 +546,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
546546 #else547547 varying vec3 vReflect;548548 #endif549-#endif`,Wue=`#ifdef USE_ENVMAP549+#endif`,$ue=`#ifdef USE_ENVMAP550550 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )551551 #define ENV_WORLDPOS552552 #endif
@@ -557,7 +557,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
557557 varying vec3 vReflect;558558 uniform float refractionRatio;559559 #endif560-#endif`,jue=`#ifdef USE_ENVMAP560+#endif`,Yue=`#ifdef USE_ENVMAP561561 #ifdef ENV_WORLDPOS562562 vWorldPosition = worldPosition.xyz;563563 #else
@@ -574,18 +574,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
574574 vReflect = refract( cameraToVertex, worldNormal, refractionRatio );575575 #endif576576 #endif577-#endif`,Xue=`#ifdef USE_FOG577+#endif`,Zue=`#ifdef USE_FOG578578 vFogDepth = - mvPosition.z;579-#endif`,$ue=`#ifdef USE_FOG579+#endif`,Kue=`#ifdef USE_FOG580580 varying float vFogDepth;581-#endif`,Yue=`#ifdef USE_FOG581+#endif`,Que=`#ifdef USE_FOG582582 #ifdef FOG_EXP2583583 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );584584 #else585585 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );586586 #endif587587 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );588-#endif`,Kue=`#ifdef USE_FOG588+#endif`,Jue=`#ifdef USE_FOG589589 uniform vec3 fogColor;590590 varying float vFogDepth;591591 #ifdef FOG_EXP2
@@ -594,7 +594,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
594594 uniform float fogNear;595595 uniform float fogFar;596596 #endif597-#endif`,Zue=`#ifdef USE_GRADIENTMAP597+#endif`,ehe=`#ifdef USE_GRADIENTMAP598598 uniform sampler2D gradientMap;599599 #endif600600 vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -606,12 +606,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
606606 vec2 fw = fwidth( coord ) * 0.5;607607 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );608608 #endif609-}`,Que=`#ifdef USE_LIGHTMAP609+}`,the=`#ifdef USE_LIGHTMAP610610 uniform sampler2D lightMap;611611 uniform float lightMapIntensity;612-#endif`,Jue=`LambertMaterial material;612+#endif`,nhe=`LambertMaterial material;613613 material.diffuseColor = diffuseColor.rgb;614-material.specularStrength = specularStrength;`,ehe=`varying vec3 vViewPosition;614+material.specularStrength = specularStrength;`,ihe=`varying vec3 vViewPosition;615615 struct LambertMaterial {616616 vec3 diffuseColor;617617 float specularStrength;
@@ -625,7 +625,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
625625 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );626626 }627627 #define RE_Direct RE_Direct_Lambert628-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,the=`uniform bool receiveShadow;628+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,rhe=`uniform bool receiveShadow;629629 uniform vec3 ambientLightColor;630630 #if defined( USE_LIGHT_PROBES )631631 uniform vec3 lightProbe[ 9 ];
@@ -742,7 +742,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
742742 return irradiance;743743 }744744 #endif745-#include <lightprobes_pars_fragment>`,nhe=`#ifdef USE_ENVMAP745+#include <lightprobes_pars_fragment>`,she=`#ifdef USE_ENVMAP746746 vec3 getIBLIrradiance( const in vec3 normal ) {747747 #ifdef ENVMAP_TYPE_CUBE_UV748748 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
@@ -775,8 +775,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
775775 #endif776776 }777777 #endif778-#endif`,ihe=`ToonMaterial material;779-material.diffuseColor = diffuseColor.rgb;`,rhe=`varying vec3 vViewPosition;778+#endif`,ohe=`ToonMaterial material;779+material.diffuseColor = diffuseColor.rgb;`,ahe=`varying vec3 vViewPosition;780780 struct ToonMaterial {781781 vec3 diffuseColor;782782 };
@@ -788,11 +788,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
788788 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );789789 }790790 #define RE_Direct RE_Direct_Toon791-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,she=`BlinnPhongMaterial material;791+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lhe=`BlinnPhongMaterial material;792792 material.diffuseColor = diffuseColor.rgb;793793 material.specularColor = specular;794794 material.specularShininess = shininess;795-material.specularStrength = specularStrength;`,ohe=`varying vec3 vViewPosition;795+material.specularStrength = specularStrength;`,che=`varying vec3 vViewPosition;796796 struct BlinnPhongMaterial {797797 vec3 diffuseColor;798798 vec3 specularColor;
@@ -809,7 +809,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
809809 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );810810 }811811 #define RE_Direct RE_Direct_BlinnPhong812-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ahe=`PhysicalMaterial material;812+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,uhe=`PhysicalMaterial material;813813 material.diffuseColor = diffuseColor.rgb;814814 material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );815815 material.metalness = metalnessFactor;
@@ -899,7 +899,7 @@ material.roughness = min( material.roughness, 1.0 );
899899 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );900900 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;901901 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;902-#endif`,lhe=`uniform sampler2D dfgLUT;902+#endif`,hhe=`uniform sampler2D dfgLUT;903903 struct PhysicalMaterial {904904 vec3 diffuseColor;905905 vec3 diffuseContribution;
@@ -1259,7 +1259,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
12591259 #define RE_IndirectSpecular RE_IndirectSpecular_Physical12601260 float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {12611261 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );1262-}`,che=`1262+}`,fhe=`12631263 vec3 geometryPosition = - vViewPosition;12641264 vec3 geometryNormal = normal;12651265 vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1381,7 +1381,7 @@ IncidentLight directLight;
13811381 #if defined( RE_IndirectSpecular )13821382 vec3 radiance = vec3( 0.0 );13831383 vec3 clearcoatRadiance = vec3( 0.0 );1384-#endif`,uhe=`#if defined( RE_IndirectDiffuse )1384+#endif`,dhe=`#if defined( RE_IndirectDiffuse )13851385 #ifdef USE_LIGHTMAP13861386 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );13871387 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1402,7 +1402,7 @@ IncidentLight directLight;
14021402 #ifdef USE_CLEARCOAT14031403 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );14041404 #endif1405-#endif`,hhe=`#if defined( RE_IndirectDiffuse )1405+#endif`,phe=`#if defined( RE_IndirectDiffuse )14061406 #if defined( LAMBERT ) || defined( PHONG )14071407 irradiance += iblIrradiance;14081408 #endif
@@ -1410,7 +1410,7 @@ IncidentLight directLight;
14101410 #endif14111411 #if defined( RE_IndirectSpecular )14121412 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1413-#endif`,fhe=`#ifdef USE_LIGHT_PROBES_GRID1413+#endif`,Ahe=`#ifdef USE_LIGHT_PROBES_GRID14141414 uniform highp sampler3D probesSH;14151415 uniform vec3 probesMin;14161416 uniform vec3 probesMax;
@@ -1455,27 +1455,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14551455 result += c8 * 0.429043 * ( x * x - y * y );14561456 return max( result, vec3( 0.0 ) );14571457 }1458-#endif`,dhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1458+#endif`,mhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14591459 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1460-#endif`,phe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1460+#endif`,ghe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14611461 uniform float logDepthBufFC;14621462 varying float vFragDepth;14631463 varying float vIsPerspective;1464-#endif`,Ahe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1464+#endif`,_he=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14651465 varying float vFragDepth;14661466 varying float vIsPerspective;1467-#endif`,mhe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1467+#endif`,xhe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14681468 vFragDepth = 1.0 + gl_Position.w;14691469 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1470-#endif`,ghe=`#ifdef USE_MAP1470+#endif`,yhe=`#ifdef USE_MAP14711471 vec4 sampledDiffuseColor = texture2D( map, vMapUv );14721472 #ifdef DECODE_VIDEO_TEXTURE14731473 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );14741474 #endif14751475 diffuseColor *= sampledDiffuseColor;1476-#endif`,_he=`#ifdef USE_MAP1476+#endif`,vhe=`#ifdef USE_MAP14771477 uniform sampler2D map;1478-#endif`,xhe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1478+#endif`,bhe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )14791479 #if defined( USE_POINTS_UV )14801480 vec2 uv = vUv;14811481 #else
@@ -1487,7 +1487,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14871487 #endif14881488 #ifdef USE_ALPHAMAP14891489 diffuseColor.a *= texture2D( alphaMap, uv ).g;1490-#endif`,yhe=`#if defined( USE_POINTS_UV )1490+#endif`,whe=`#if defined( USE_POINTS_UV )14911491 varying vec2 vUv;14921492 #else14931493 #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1499,19 +1499,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14991499 #endif15001500 #ifdef USE_ALPHAMAP15011501 uniform sampler2D alphaMap;1502-#endif`,vhe=`float metalnessFactor = metalness;1502+#endif`,She=`float metalnessFactor = metalness;15031503 #ifdef USE_METALNESSMAP15041504 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );15051505 metalnessFactor *= texelMetalness.b;1506-#endif`,bhe=`#ifdef USE_METALNESSMAP1506+#endif`,The=`#ifdef USE_METALNESSMAP15071507 uniform sampler2D metalnessMap;1508-#endif`,whe=`#ifdef USE_INSTANCING_MORPH1508+#endif`,Ehe=`#ifdef USE_INSTANCING_MORPH15091509 float morphTargetInfluences[ MORPHTARGETS_COUNT ];15101510 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;15111511 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15121512 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;15131513 }1514-#endif`,She=`#if defined( USE_MORPHCOLORS )1514+#endif`,Mhe=`#if defined( USE_MORPHCOLORS )15151515 vColor *= morphTargetBaseInfluence;15161516 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15171517 #if defined( USE_COLOR_ALPHA )
@@ -1520,12 +1520,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15201520 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];15211521 #endif15221522 }1523-#endif`,The=`#ifdef USE_MORPHNORMALS1523+#endif`,Che=`#ifdef USE_MORPHNORMALS15241524 objectNormal *= morphTargetBaseInfluence;15251525 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15261526 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];15271527 }1528-#endif`,Ehe=`#ifdef USE_MORPHTARGETS1528+#endif`,Rhe=`#ifdef USE_MORPHTARGETS15291529 #ifndef USE_INSTANCING_MORPH15301530 uniform float morphTargetBaseInfluence;15311531 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1539,12 +1539,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15391539 ivec3 morphUV = ivec3( x, y, morphTargetIndex );15401540 return texelFetch( morphTargetsTexture, morphUV, 0 );15411541 }1542-#endif`,Mhe=`#ifdef USE_MORPHTARGETS1542+#endif`,Phe=`#ifdef USE_MORPHTARGETS15431543 transformed *= morphTargetBaseInfluence;15441544 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15451545 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];15461546 }1547-#endif`,Che=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1547+#endif`,Ihe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;15481548 #ifdef FLAT_SHADED15491549 vec3 fdx = dFdx( vViewPosition );15501550 vec3 fdy = dFdy( vViewPosition );
@@ -1585,7 +1585,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15851585 tbn2[1] *= faceDirection;15861586 #endif15871587 #endif1588-vec3 nonPerturbedNormal = normal;`,Rhe=`#ifdef USE_NORMALMAP_OBJECTSPACE1588+vec3 nonPerturbedNormal = normal;`,Nhe=`#ifdef USE_NORMALMAP_OBJECTSPACE15891589 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;15901590 #ifdef FLIP_SIDED15911591 normal = - normal;
@@ -1603,19 +1603,19 @@ vec3 nonPerturbedNormal = normal;`,Rhe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16031603 normal = normalize( tbn * mapN );16041604 #elif defined( USE_BUMPMAP )16051605 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1606-#endif`,Phe=`#ifndef FLAT_SHADED1606+#endif`,Lhe=`#ifndef FLAT_SHADED16071607 varying vec3 vNormal;16081608 #ifdef USE_TANGENT16091609 varying vec3 vTangent;16101610 varying vec3 vBitangent;16111611 #endif1612-#endif`,Ihe=`#ifndef FLAT_SHADED1612+#endif`,Dhe=`#ifndef FLAT_SHADED16131613 varying vec3 vNormal;16141614 #ifdef USE_TANGENT16151615 varying vec3 vTangent;16161616 varying vec3 vBitangent;16171617 #endif1618-#endif`,Nhe=`#ifndef FLAT_SHADED1618+#endif`,Fhe=`#ifndef FLAT_SHADED16191619 vNormal = normalize( transformedNormal );16201620 #ifdef USE_TANGENT16211621 vTangent = normalize( transformedTangent );
@@ -1624,7 +1624,7 @@ vec3 nonPerturbedNormal = normal;`,Rhe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16241624 vBitangent = - vBitangent;16251625 #endif16261626 #endif1627-#endif`,Lhe=`#ifdef USE_NORMALMAP1627+#endif`,Ohe=`#ifdef USE_NORMALMAP16281628 uniform sampler2D normalMap;16291629 uniform vec2 normalScale;16301630 #endif
@@ -1646,13 +1646,13 @@ vec3 nonPerturbedNormal = normal;`,Rhe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16461646 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );16471647 return mat3( T * scale, B * scale, N );16481648 }1649-#endif`,Dhe=`#ifdef USE_CLEARCOAT1649+#endif`,Bhe=`#ifdef USE_CLEARCOAT16501650 vec3 clearcoatNormal = nonPerturbedNormal;1651-#endif`,Fhe=`#ifdef USE_CLEARCOAT_NORMALMAP1651+#endif`,Uhe=`#ifdef USE_CLEARCOAT_NORMALMAP16521652 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;16531653 clearcoatMapN.xy *= clearcoatNormalScale;16541654 clearcoatNormal = normalize( tbn2 * clearcoatMapN );1655-#endif`,Ohe=`#ifdef USE_CLEARCOATMAP1655+#endif`,khe=`#ifdef USE_CLEARCOATMAP16561656 uniform sampler2D clearcoatMap;16571657 #endif16581658 #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1661,18 +1661,18 @@ vec3 nonPerturbedNormal = normal;`,Rhe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16611661 #endif16621662 #ifdef USE_CLEARCOAT_ROUGHNESSMAP16631663 uniform sampler2D clearcoatRoughnessMap;1664-#endif`,Bhe=`#ifdef USE_IRIDESCENCEMAP1664+#endif`,Ghe=`#ifdef USE_IRIDESCENCEMAP16651665 uniform sampler2D iridescenceMap;16661666 #endif16671667 #ifdef USE_IRIDESCENCE_THICKNESSMAP16681668 uniform sampler2D iridescenceThicknessMap;1669-#endif`,Uhe=`#ifdef OPAQUE1669+#endif`,zhe=`#ifdef OPAQUE16701670 diffuseColor.a = 1.0;16711671 #endif16721672 #ifdef USE_TRANSMISSION16731673 diffuseColor.a *= material.transmissionAlpha;16741674 #endif1675-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,khe=`vec3 packNormalToRGB( const in vec3 normal ) {1675+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Vhe=`vec3 packNormalToRGB( const in vec3 normal ) {16761676 return normalize( normal ) * 0.5 + 0.5;16771677 }16781678 vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1751,9 +1751,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17511751 #else17521752 return ( near * far ) / ( ( far - near ) * depth - far );17531753 #endif1754-}`,Ghe=`#ifdef PREMULTIPLIED_ALPHA1754+}`,qhe=`#ifdef PREMULTIPLIED_ALPHA17551755 gl_FragColor.rgb *= gl_FragColor.a;1756-#endif`,zhe=`vec4 mvPosition = vec4( transformed, 1.0 );1756+#endif`,Hhe=`vec4 mvPosition = vec4( transformed, 1.0 );17571757 #ifdef USE_BATCHING17581758 mvPosition = batchingMatrix * mvPosition;17591759 #endif
@@ -1761,22 +1761,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17611761 mvPosition = instanceMatrix * mvPosition;17621762 #endif17631763 mvPosition = modelViewMatrix * mvPosition;1764-gl_Position = projectionMatrix * mvPosition;`,Vhe=`#ifdef DITHERING1764+gl_Position = projectionMatrix * mvPosition;`,Whe=`#ifdef DITHERING17651765 gl_FragColor.rgb = dithering( gl_FragColor.rgb );1766-#endif`,qhe=`#ifdef DITHERING1766+#endif`,jhe=`#ifdef DITHERING17671767 vec3 dithering( vec3 color ) {17681768 float grid_position = rand( gl_FragCoord.xy );17691769 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );17701770 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );17711771 return color + dither_shift_RGB;17721772 }1773-#endif`,Hhe=`float roughnessFactor = roughness;1773+#endif`,Xhe=`float roughnessFactor = roughness;17741774 #ifdef USE_ROUGHNESSMAP17751775 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );17761776 roughnessFactor *= texelRoughness.g;1777-#endif`,Whe=`#ifdef USE_ROUGHNESSMAP1777+#endif`,$he=`#ifdef USE_ROUGHNESSMAP17781778 uniform sampler2D roughnessMap;1779-#endif`,jhe=`#if NUM_SPOT_LIGHT_COORDS > 01779+#endif`,Yhe=`#if NUM_SPOT_LIGHT_COORDS > 017801780 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];17811781 #endif17821782 #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1976,7 +1976,7 @@ gl_Position = projectionMatrix * mvPosition;`,Vhe=`#ifdef DITHERING
19761976 }19771977 #endif19781978 #endif1979-#endif`,Xhe=`#if NUM_SPOT_LIGHT_COORDS > 01979+#endif`,Zhe=`#if NUM_SPOT_LIGHT_COORDS > 019801980 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];19811981 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];19821982 #endif
@@ -2017,7 +2017,7 @@ gl_Position = projectionMatrix * mvPosition;`,Vhe=`#ifdef DITHERING
20172017 };20182018 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];20192019 #endif2020-#endif`,$he=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2020+#endif`,Khe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )20212021 #ifdef HAS_NORMAL20222022 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );20232023 #else
@@ -2053,7 +2053,7 @@ gl_Position = projectionMatrix * mvPosition;`,Vhe=`#ifdef DITHERING
20532053 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;20542054 }20552055 #pragma unroll_loop_end2056-#endif`,Yhe=`float getShadowMask() {2056+#endif`,Qhe=`float getShadowMask() {20572057 float shadow = 1.0;20582058 #ifdef USE_SHADOWMAP20592059 #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2085,12 +2085,12 @@ gl_Position = projectionMatrix * mvPosition;`,Vhe=`#ifdef DITHERING
20852085 #endif20862086 #endif20872087 return shadow;2088-}`,Khe=`#ifdef USE_SKINNING2088+}`,Jhe=`#ifdef USE_SKINNING20892089 mat4 boneMatX = getBoneMatrix( skinIndex.x );20902090 mat4 boneMatY = getBoneMatrix( skinIndex.y );20912091 mat4 boneMatZ = getBoneMatrix( skinIndex.z );20922092 mat4 boneMatW = getBoneMatrix( skinIndex.w );2093-#endif`,Zhe=`#ifdef USE_SKINNING2093+#endif`,efe=`#ifdef USE_SKINNING20942094 uniform mat4 bindMatrix;20952095 uniform mat4 bindMatrixInverse;20962096 uniform highp sampler2D boneTexture;
@@ -2105,7 +2105,7 @@ gl_Position = projectionMatrix * mvPosition;`,Vhe=`#ifdef DITHERING
21052105 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );21062106 return mat4( v1, v2, v3, v4 );21072107 }2108-#endif`,Qhe=`#ifdef USE_SKINNING2108+#endif`,tfe=`#ifdef USE_SKINNING21092109 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );21102110 vec4 skinned = vec4( 0.0 );21112111 skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2113,7 +2113,7 @@ gl_Position = projectionMatrix * mvPosition;`,Vhe=`#ifdef DITHERING
21132113 skinned += boneMatZ * skinVertex * skinWeight.z;21142114 skinned += boneMatW * skinVertex * skinWeight.w;21152115 transformed = ( bindMatrixInverse * skinned ).xyz;2116-#endif`,Jhe=`#ifdef USE_SKINNING2116+#endif`,nfe=`#ifdef USE_SKINNING21172117 mat4 skinMatrix = mat4( 0.0 );21182118 skinMatrix += skinWeight.x * boneMatX;21192119 skinMatrix += skinWeight.y * boneMatY;
@@ -2124,17 +2124,17 @@ gl_Position = projectionMatrix * mvPosition;`,Vhe=`#ifdef DITHERING
21242124 #ifdef USE_TANGENT21252125 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;21262126 #endif2127-#endif`,efe=`float specularStrength;2127+#endif`,ife=`float specularStrength;21282128 #ifdef USE_SPECULARMAP21292129 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );21302130 specularStrength = texelSpecular.r;21312131 #else21322132 specularStrength = 1.0;2133-#endif`,tfe=`#ifdef USE_SPECULARMAP2133+#endif`,rfe=`#ifdef USE_SPECULARMAP21342134 uniform sampler2D specularMap;2135-#endif`,nfe=`#if defined( TONE_MAPPING )2135+#endif`,sfe=`#if defined( TONE_MAPPING )21362136 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2137-#endif`,ife=`#ifndef saturate2137+#endif`,ofe=`#ifndef saturate21382138 #define saturate( a ) clamp( a, 0.0, 1.0 )21392139 #endif21402140 uniform float toneMappingExposure;
@@ -2231,7 +2231,7 @@ vec3 NeutralToneMapping( vec3 color ) {
22312231 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );22322232 return mix( color, vec3( newPeak ), g );22332233 }2234-vec3 CustomToneMapping( vec3 color ) { return color; }`,rfe=`#ifdef USE_TRANSMISSION2234+vec3 CustomToneMapping( vec3 color ) { return color; }`,afe=`#ifdef USE_TRANSMISSION22352235 material.transmission = transmission;22362236 material.transmissionAlpha = 1.0;22372237 material.thickness = thickness;
@@ -2252,7 +2252,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,rfe=`#ifdef USE_TRANSMIS
22522252 material.attenuationColor, material.attenuationDistance );22532253 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );22542254 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );2255-#endif`,sfe=`#ifdef USE_TRANSMISSION2255+#endif`,lfe=`#ifdef USE_TRANSMISSION22562256 uniform float transmission;22572257 uniform float thickness;22582258 uniform float attenuationDistance;
@@ -2378,7 +2378,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,rfe=`#ifdef USE_TRANSMIS
23782378 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;23792379 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );23802380 }2381-#endif`,ofe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2381+#endif`,cfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )23822382 varying vec2 vUv;23832383 #endif23842384 #ifdef USE_MAP
@@ -2448,7 +2448,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,rfe=`#ifdef USE_TRANSMIS
24482448 #ifdef USE_THICKNESSMAP24492449 uniform mat3 thicknessMapTransform;24502450 varying vec2 vThicknessMapUv;2451-#endif`,afe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2451+#endif`,ufe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )24522452 varying vec2 vUv;24532453 #endif24542454 #ifdef USE_MAP
@@ -2542,7 +2542,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,rfe=`#ifdef USE_TRANSMIS
25422542 #ifdef USE_THICKNESSMAP25432543 uniform mat3 thicknessMapTransform;25442544 varying vec2 vThicknessMapUv;2545-#endif`,lfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2545+#endif`,hfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )25462546 vUv = vec3( uv, 1 ).xy;25472547 #endif25482548 #ifdef USE_MAP
@@ -2613,7 +2613,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,rfe=`#ifdef USE_TRANSMIS
26132613 #endif26142614 #ifdef USE_THICKNESSMAP26152615 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2616-#endif`,cfe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02616+#endif`,ffe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 026172617 vec4 worldPosition = vec4( transformed, 1.0 );26182618 #ifdef USE_BATCHING26192619 worldPosition = batchingMatrix * worldPosition;
@@ -2622,12 +2622,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,rfe=`#ifdef USE_TRANSMIS
26222622 worldPosition = instanceMatrix * worldPosition;26232623 #endif26242624 worldPosition = modelMatrix * worldPosition;2625-#endif`,ufe=`varying vec2 vUv;2625+#endif`,dfe=`varying vec2 vUv;26262626 uniform mat3 uvTransform;26272627 void main() {26282628 vUv = ( uvTransform * vec3( uv, 1 ) ).xy;26292629 gl_Position = vec4( position.xy, 1.0, 1.0 );2630-}`,hfe=`uniform sampler2D t2D;2630+}`,pfe=`uniform sampler2D t2D;26312631 uniform float backgroundIntensity;26322632 varying vec2 vUv;26332633 void main() {
@@ -2639,14 +2639,14 @@ void main() {
26392639 gl_FragColor = texColor;26402640 #include <tonemapping_fragment>26412641 #include <colorspace_fragment>2642-}`,ffe=`varying vec3 vWorldDirection;2642+}`,Afe=`varying vec3 vWorldDirection;26432643 #include <common>26442644 void main() {26452645 vWorldDirection = transformDirection( position, modelMatrix );26462646 #include <begin_vertex>26472647 #include <project_vertex>26482648 gl_Position.z = gl_Position.w;2649-}`,dfe=`#ifdef ENVMAP_TYPE_CUBE2649+}`,mfe=`#ifdef ENVMAP_TYPE_CUBE26502650 uniform samplerCube envMap;26512651 #elif defined( ENVMAP_TYPE_CUBE_UV )26522652 uniform sampler2D envMap;
@@ -2668,14 +2668,14 @@ void main() {
26682668 gl_FragColor = texColor;26692669 #include <tonemapping_fragment>26702670 #include <colorspace_fragment>2671-}`,pfe=`varying vec3 vWorldDirection;2671+}`,gfe=`varying vec3 vWorldDirection;26722672 #include <common>26732673 void main() {26742674 vWorldDirection = transformDirection( position, modelMatrix );26752675 #include <begin_vertex>26762676 #include <project_vertex>26772677 gl_Position.z = gl_Position.w;2678-}`,Afe=`uniform samplerCube tCube;2678+}`,_fe=`uniform samplerCube tCube;26792679 uniform float tFlip;26802680 uniform float opacity;26812681 varying vec3 vWorldDirection;
@@ -2685,7 +2685,7 @@ void main() {
26852685 gl_FragColor.a *= opacity;26862686 #include <tonemapping_fragment>26872687 #include <colorspace_fragment>2688-}`,mfe=`#include <common>2688+}`,xfe=`#include <common>26892689 #include <batching_pars_vertex>26902690 #include <uv_pars_vertex>26912691 #include <displacementmap_pars_vertex>
@@ -2712,7 +2712,7 @@ void main() {
27122712 #include <logdepthbuf_vertex>27132713 #include <clipping_planes_vertex>27142714 vHighPrecisionZW = gl_Position.zw;2715-}`,gfe=`#if DEPTH_PACKING == 32002715+}`,yfe=`#if DEPTH_PACKING == 320027162716 uniform float opacity;27172717 #endif27182718 #include <common>
@@ -2750,7 +2750,7 @@ void main() {
27502750 #elif DEPTH_PACKING == 320327512751 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );27522752 #endif2753-}`,_fe=`#define DISTANCE2753+}`,vfe=`#define DISTANCE27542754 varying vec3 vWorldPosition;27552755 #include <common>27562756 #include <batching_pars_vertex>
@@ -2777,7 +2777,7 @@ void main() {
27772777 #include <worldpos_vertex>27782778 #include <clipping_planes_vertex>27792779 vWorldPosition = worldPosition.xyz;2780-}`,xfe=`#define DISTANCE2780+}`,bfe=`#define DISTANCE27812781 uniform vec3 referencePosition;27822782 uniform float nearDistance;27832783 uniform float farDistance;
@@ -2800,13 +2800,13 @@ void main() {
28002800 dist = ( dist - nearDistance ) / ( farDistance - nearDistance );28012801 dist = saturate( dist );28022802 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );2803-}`,yfe=`varying vec3 vWorldDirection;2803+}`,wfe=`varying vec3 vWorldDirection;28042804 #include <common>28052805 void main() {28062806 vWorldDirection = transformDirection( position, modelMatrix );28072807 #include <begin_vertex>28082808 #include <project_vertex>2809-}`,vfe=`uniform sampler2D tEquirect;2809+}`,Sfe=`uniform sampler2D tEquirect;28102810 varying vec3 vWorldDirection;28112811 #include <common>28122812 void main() {
@@ -2815,7 +2815,7 @@ void main() {
28152815 gl_FragColor = texture2D( tEquirect, sampleUV );28162816 #include <tonemapping_fragment>28172817 #include <colorspace_fragment>2818-}`,bfe=`uniform float scale;2818+}`,Tfe=`uniform float scale;28192819 attribute float lineDistance;28202820 varying float vLineDistance;28212821 #include <common>
@@ -2837,7 +2837,7 @@ void main() {
28372837 #include <logdepthbuf_vertex>28382838 #include <clipping_planes_vertex>28392839 #include <fog_vertex>2840-}`,wfe=`uniform vec3 diffuse;2840+}`,Efe=`uniform vec3 diffuse;28412841 uniform float opacity;28422842 uniform float dashSize;28432843 uniform float totalSize;
@@ -2865,7 +2865,7 @@ void main() {
28652865 #include <colorspace_fragment>28662866 #include <fog_fragment>28672867 #include <premultiplied_alpha_fragment>2868-}`,Sfe=`#include <common>2868+}`,Mfe=`#include <common>28692869 #include <batching_pars_vertex>28702870 #include <uv_pars_vertex>28712871 #include <envmap_pars_vertex>
@@ -2897,7 +2897,7 @@ void main() {
28972897 #include <worldpos_vertex>28982898 #include <envmap_vertex>28992899 #include <fog_vertex>2900-}`,Tfe=`uniform vec3 diffuse;2900+}`,Cfe=`uniform vec3 diffuse;29012901 uniform float opacity;29022902 #ifndef FLAT_SHADED29032903 varying vec3 vNormal;
@@ -2945,7 +2945,7 @@ void main() {
29452945 #include <fog_fragment>29462946 #include <premultiplied_alpha_fragment>29472947 #include <dithering_fragment>2948-}`,Efe=`#define LAMBERT2948+}`,Rfe=`#define LAMBERT29492949 varying vec3 vViewPosition;29502950 #include <common>29512951 #include <batching_pars_vertex>
@@ -2984,7 +2984,7 @@ void main() {
29842984 #include <envmap_vertex>29852985 #include <shadowmap_vertex>29862986 #include <fog_vertex>2987-}`,Mfe=`#define LAMBERT2987+}`,Pfe=`#define LAMBERT29882988 uniform vec3 diffuse;29892989 uniform vec3 emissive;29902990 uniform float opacity;
@@ -3042,7 +3042,7 @@ void main() {
30423042 #include <fog_fragment>30433043 #include <premultiplied_alpha_fragment>30443044 #include <dithering_fragment>3045-}`,Cfe=`#define MATCAP3045+}`,Ife=`#define MATCAP30463046 varying vec3 vViewPosition;30473047 #include <common>30483048 #include <batching_pars_vertex>
@@ -3076,7 +3076,7 @@ void main() {
30763076 #include <clipping_planes_vertex>30773077 #include <fog_vertex>30783078 vViewPosition = - mvPosition.xyz;3079-}`,Rfe=`#define MATCAP3079+}`,Nfe=`#define MATCAP30803080 uniform vec3 diffuse;30813081 uniform float opacity;30823082 uniform sampler2D matcap;
@@ -3122,7 +3122,7 @@ void main() {
31223122 #include <fog_fragment>31233123 #include <premultiplied_alpha_fragment>31243124 #include <dithering_fragment>3125-}`,Pfe=`#define NORMAL3125+}`,Lfe=`#define NORMAL31263126 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31273127 varying vec3 vViewPosition;31283128 #endif
@@ -3155,7 +3155,7 @@ void main() {
31553155 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31563156 vViewPosition = - mvPosition.xyz;31573157 #endif3158-}`,Ife=`#define NORMAL3158+}`,Dfe=`#define NORMAL31593159 uniform float opacity;31603160 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31613161 varying vec3 vViewPosition;
@@ -3176,7 +3176,7 @@ void main() {
31763176 #ifdef OPAQUE31773177 gl_FragColor.a = 1.0;31783178 #endif3179-}`,Nfe=`#define PHONG3179+}`,Ffe=`#define PHONG31803180 varying vec3 vViewPosition;31813181 #include <common>31823182 #include <batching_pars_vertex>
@@ -3215,7 +3215,7 @@ void main() {
32153215 #include <envmap_vertex>32163216 #include <shadowmap_vertex>32173217 #include <fog_vertex>3218-}`,Lfe=`#define PHONG3218+}`,Ofe=`#define PHONG32193219 uniform vec3 diffuse;32203220 uniform vec3 emissive;32213221 uniform vec3 specular;
@@ -3275,7 +3275,7 @@ void main() {
32753275 #include <fog_fragment>32763276 #include <premultiplied_alpha_fragment>32773277 #include <dithering_fragment>3278-}`,Dfe=`#define STANDARD3278+}`,Bfe=`#define STANDARD32793279 varying vec3 vViewPosition;32803280 #ifdef USE_TRANSMISSION32813281 varying vec3 vWorldPosition;
@@ -3318,7 +3318,7 @@ void main() {
33183318 #ifdef USE_TRANSMISSION33193319 vWorldPosition = worldPosition.xyz;33203320 #endif3321-}`,Ffe=`#define STANDARD3321+}`,Ufe=`#define STANDARD33223322 #ifdef PHYSICAL33233323 #define IOR33243324 #define USE_SPECULAR
@@ -3443,7 +3443,7 @@ void main() {
34433443 #include <fog_fragment>34443444 #include <premultiplied_alpha_fragment>34453445 #include <dithering_fragment>3446-}`,Ofe=`#define TOON3446+}`,kfe=`#define TOON34473447 varying vec3 vViewPosition;34483448 #include <common>34493449 #include <batching_pars_vertex>
@@ -3480,7 +3480,7 @@ void main() {
34803480 #include <worldpos_vertex>34813481 #include <shadowmap_vertex>34823482 #include <fog_vertex>3483-}`,Bfe=`#define TOON3483+}`,Gfe=`#define TOON34843484 uniform vec3 diffuse;34853485 uniform vec3 emissive;34863486 uniform float opacity;
@@ -3532,7 +3532,7 @@ void main() {
35323532 #include <fog_fragment>35333533 #include <premultiplied_alpha_fragment>35343534 #include <dithering_fragment>3535-}`,Ufe=`uniform float size;3535+}`,zfe=`uniform float size;35363536 uniform float scale;35373537 #include <common>35383538 #include <color_pars_vertex>
@@ -3563,7 +3563,7 @@ void main() {
35633563 #include <clipping_planes_vertex>35643564 #include <worldpos_vertex>35653565 #include <fog_vertex>3566-}`,kfe=`uniform vec3 diffuse;3566+}`,Vfe=`uniform vec3 diffuse;35673567 uniform float opacity;35683568 #include <common>35693569 #include <color_pars_fragment>
@@ -3588,7 +3588,7 @@ void main() {
35883588 #include <colorspace_fragment>35893589 #include <fog_fragment>35903590 #include <premultiplied_alpha_fragment>3591-}`,Gfe=`#include <common>3591+}`,qfe=`#include <common>35923592 #include <batching_pars_vertex>35933593 #include <fog_pars_vertex>35943594 #include <morphtarget_pars_vertex>
@@ -3611,7 +3611,7 @@ void main() {
36113611 #include <worldpos_vertex>36123612 #include <shadowmap_vertex>36133613 #include <fog_vertex>3614-}`,zfe=`uniform vec3 color;3614+}`,Hfe=`uniform vec3 color;36153615 uniform float opacity;36163616 #include <common>36173617 #include <fog_pars_fragment>
@@ -3627,7 +3627,7 @@ void main() {
36273627 #include <colorspace_fragment>36283628 #include <fog_fragment>36293629 #include <premultiplied_alpha_fragment>3630-}`,Vfe=`uniform float rotation;3630+}`,Wfe=`uniform float rotation;36313631 uniform vec2 center;36323632 #include <common>36333633 #include <uv_pars_vertex>
@@ -3651,7 +3651,7 @@ void main() {
36513651 #include <logdepthbuf_vertex>36523652 #include <clipping_planes_vertex>36533653 #include <fog_vertex>3654-}`,qfe=`uniform vec3 diffuse;3654+}`,jfe=`uniform vec3 diffuse;36553655 uniform float opacity;36563656 #include <common>36573657 #include <uv_pars_fragment>
@@ -3676,7 +3676,7 @@ void main() {
36763676 #include <tonemapping_fragment>36773677 #include <colorspace_fragment>36783678 #include <fog_fragment>3679-}`,Fn={alphahash_fragment:uue,alphahash_pars_fragment:hue,alphamap_fragment:fue,alphamap_pars_fragment:due,alphatest_fragment:pue,alphatest_pars_fragment:Aue,aomap_fragment:mue,aomap_pars_fragment:gue,batching_pars_vertex:_ue,batching_vertex:xue,begin_vertex:yue,beginnormal_vertex:vue,bsdfs:bue,iridescence_fragment:wue,bumpmap_pars_fragment:Sue,clipping_planes_fragment:Tue,clipping_planes_pars_fragment:Eue,clipping_planes_pars_vertex:Mue,clipping_planes_vertex:Cue,color_fragment:Rue,color_pars_fragment:Pue,color_pars_vertex:Iue,color_vertex:Nue,common:Lue,cube_uv_reflection_fragment:Due,defaultnormal_vertex:Fue,displacementmap_pars_vertex:Oue,displacementmap_vertex:Bue,emissivemap_fragment:Uue,emissivemap_pars_fragment:kue,colorspace_fragment:Gue,colorspace_pars_fragment:zue,envmap_fragment:Vue,envmap_common_pars_fragment:que,envmap_pars_fragment:Hue,envmap_pars_vertex:Wue,envmap_physical_pars_fragment:nhe,envmap_vertex:jue,fog_vertex:Xue,fog_pars_vertex:$ue,fog_fragment:Yue,fog_pars_fragment:Kue,gradientmap_pars_fragment:Zue,lightmap_pars_fragment:Que,lights_lambert_fragment:Jue,lights_lambert_pars_fragment:ehe,lights_pars_begin:the,lights_toon_fragment:ihe,lights_toon_pars_fragment:rhe,lights_phong_fragment:she,lights_phong_pars_fragment:ohe,lights_physical_fragment:ahe,lights_physical_pars_fragment:lhe,lights_fragment_begin:che,lights_fragment_maps:uhe,lights_fragment_end:hhe,lightprobes_pars_fragment:fhe,logdepthbuf_fragment:dhe,logdepthbuf_pars_fragment:phe,logdepthbuf_pars_vertex:Ahe,logdepthbuf_vertex:mhe,map_fragment:ghe,map_pars_fragment:_he,map_particle_fragment:xhe,map_particle_pars_fragment:yhe,metalnessmap_fragment:vhe,metalnessmap_pars_fragment:bhe,morphinstance_vertex:whe,morphcolor_vertex:She,morphnormal_vertex:The,morphtarget_pars_vertex:Ehe,morphtarget_vertex:Mhe,normal_fragment_begin:Che,normal_fragment_maps:Rhe,normal_pars_fragment:Phe,normal_pars_vertex:Ihe,normal_vertex:Nhe,normalmap_pars_fragment:Lhe,clearcoat_normal_fragment_begin:Dhe,clearcoat_normal_fragment_maps:Fhe,clearcoat_pars_fragment:Ohe,iridescence_pars_fragment:Bhe,opaque_fragment:Uhe,packing:khe,premultiplied_alpha_fragment:Ghe,project_vertex:zhe,dithering_fragment:Vhe,dithering_pars_fragment:qhe,roughnessmap_fragment:Hhe,roughnessmap_pars_fragment:Whe,shadowmap_pars_fragment:jhe,shadowmap_pars_vertex:Xhe,shadowmap_vertex:$he,shadowmask_pars_fragment:Yhe,skinbase_vertex:Khe,skinning_pars_vertex:Zhe,skinning_vertex:Qhe,skinnormal_vertex:Jhe,specularmap_fragment:efe,specularmap_pars_fragment:tfe,tonemapping_fragment:nfe,tonemapping_pars_fragment:ife,transmission_fragment:rfe,transmission_pars_fragment:sfe,uv_pars_fragment:ofe,uv_pars_vertex:afe,uv_vertex:lfe,worldpos_vertex:cfe,background_vert:ufe,background_frag:hfe,backgroundCube_vert:ffe,backgroundCube_frag:dfe,cube_vert:pfe,cube_frag:Afe,depth_vert:mfe,depth_frag:gfe,distance_vert:_fe,distance_frag:xfe,equirect_vert:yfe,equirect_frag:vfe,linedashed_vert:bfe,linedashed_frag:wfe,meshbasic_vert:Sfe,meshbasic_frag:Tfe,meshlambert_vert:Efe,meshlambert_frag:Mfe,meshmatcap_vert:Cfe,meshmatcap_frag:Rfe,meshnormal_vert:Pfe,meshnormal_frag:Ife,meshphong_vert:Nfe,meshphong_frag:Lfe,meshphysical_vert:Dfe,meshphysical_frag:Ffe,meshtoon_vert:Ofe,meshtoon_frag:Bfe,points_vert:Ufe,points_frag:kfe,shadow_vert:Gfe,shadow_frag:zfe,sprite_vert:Vfe,sprite_frag:qfe},Nt={common:{diffuse:{value:new Ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Sn},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Sn}},envmap:{envMap:{value:null},envMapRotation:{value:new Sn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Sn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Sn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Sn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Sn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Sn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Sn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Sn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Sn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ut(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new ie},probesMax:{value:new ie},probesResolution:{value:new ie}},points:{diffuse:{value:new Ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0},uvTransform:{value:new Sn}},sprite:{diffuse:{value:new Ut(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Sn},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0}}},ma={basic:{uniforms:Vo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:Fn.meshbasic_vert,fragmentShader:Fn.meshbasic_frag},lambert:{uniforms:Vo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)},envMapIntensity:{value:1}}]),vertexShader:Fn.meshlambert_vert,fragmentShader:Fn.meshlambert_frag},phong:{uniforms:Vo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)},specular:{value:new Ut(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Fn.meshphong_vert,fragmentShader:Fn.meshphong_frag},standard:{uniforms:Vo([Nt.common,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.roughnessmap,Nt.metalnessmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Fn.meshphysical_vert,fragmentShader:Fn.meshphysical_frag},toon:{uniforms:Vo([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)}}]),vertexShader:Fn.meshtoon_vert,fragmentShader:Fn.meshtoon_frag},matcap:{uniforms:Vo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:Fn.meshmatcap_vert,fragmentShader:Fn.meshmatcap_frag},points:{uniforms:Vo([Nt.points,Nt.fog]),vertexShader:Fn.points_vert,fragmentShader:Fn.points_frag},dashed:{uniforms:Vo([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fn.linedashed_vert,fragmentShader:Fn.linedashed_frag},depth:{uniforms:Vo([Nt.common,Nt.displacementmap]),vertexShader:Fn.depth_vert,fragmentShader:Fn.depth_frag},normal:{uniforms:Vo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:Fn.meshnormal_vert,fragmentShader:Fn.meshnormal_frag},sprite:{uniforms:Vo([Nt.sprite,Nt.fog]),vertexShader:Fn.sprite_vert,fragmentShader:Fn.sprite_frag},background:{uniforms:{uvTransform:{value:new Sn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Fn.background_vert,fragmentShader:Fn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sn}},vertexShader:Fn.backgroundCube_vert,fragmentShader:Fn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fn.cube_vert,fragmentShader:Fn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fn.equirect_vert,fragmentShader:Fn.equirect_frag},distance:{uniforms:Vo([Nt.common,Nt.displacementmap,{referencePosition:{value:new ie},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fn.distance_vert,fragmentShader:Fn.distance_frag},shadow:{uniforms:Vo([Nt.lights,Nt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:Fn.shadow_vert,fragmentShader:Fn.shadow_frag}};ma.physical={uniforms:Vo([ma.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Sn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Sn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Sn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Sn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Sn},sheen:{value:0},sheenColor:{value:new Ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Sn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Sn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Sn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Sn},attenuationDistance:{value:0},attenuationColor:{value:new Ut(0)},specularColor:{value:new Ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Sn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Sn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Sn}}]),vertexShader:Fn.meshphysical_vert,fragmentShader:Fn.meshphysical_frag};var YT={r:0,b:0,g:0},Hfe=new on,bW=new Sn;bW.set(-1,0,0,0,1,0,0,0,1);function Wfe(i,e,t,n,r,s){let o=new Ut(0),a=r===!0?0:1,l,c,u=null,f=0,p=null;function x(P){let R=P.isScene===!0?P.background:null;if(R&&R.isTexture){let C=P.backgroundBlurriness>0;R=e.get(R,C)}return R}function v(P){let R=!1,C=x(P);C===null?S(o,a):C&&C.isColor&&(S(C,1),R=!0);let L=i.xr.getEnvironmentBlendMode();L==="additive"?t.buffers.color.setClear(0,0,0,1,s):L==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||R)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(P,R){let C=x(R);C&&(C.isCubeTexture||C.mapping===Hu)?(c===void 0&&(c=new Hn(new Gc(1,1,1),new jr({name:"BackgroundCubeMaterial",uniforms:GA(ma.backgroundCube.uniforms),vertexShader:ma.backgroundCube.vertexShader,fragmentShader:ma.backgroundCube.fragmentShader,side:ui,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(L,D,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=C,c.material.uniforms.backgroundBlurriness.value=R.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Hfe.makeRotationFromEuler(R.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(bW),c.material.toneMapped=sn.getTransfer(C.colorSpace)!==Bt,(u!==C||f!==C.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,u=C,f=C.version,p=i.toneMapping),c.layers.enableAll(),P.unshift(c,c.geometry,c.material,0,0,null)):C&&C.isTexture&&(l===void 0&&(l=new Hn(new wA(2,2),new jr({name:"BackgroundMaterial",uniforms:GA(ma.background.uniforms),vertexShader:ma.background.vertexShader,fragmentShader:ma.background.fragmentShader,side:Ao,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=C,l.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,l.material.toneMapped=sn.getTransfer(C.colorSpace)!==Bt,C.matrixAutoUpdate===!0&&C.updateMatrix(),l.material.uniforms.uvTransform.value.copy(C.matrix),(u!==C||f!==C.version||p!==i.toneMapping)&&(l.material.needsUpdate=!0,u=C,f=C.version,p=i.toneMapping),l.layers.enableAll(),P.unshift(l,l.geometry,l.material,0,0,null))}function S(P,R){P.getRGB(YT,mL(i)),t.buffers.color.setClear(YT.r,YT.g,YT.b,R,s)}function T(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(P,R=1){o.set(P),a=R,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(P){a=P,S(o,a)},render:v,addToRenderList:w,dispose:T}}function jfe(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null),s=r,o=!1;function a(V,H,K,J,j){let Z=!1,ee=f(V,J,K,H);s!==ee&&(s=ee,c(s.object)),Z=x(V,J,K,j),Z&&v(V,J,K,j),j!==null&&e.update(j,i.ELEMENT_ARRAY_BUFFER),(Z||o)&&(o=!1,C(V,H,K,J),j!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return i.createVertexArray()}function c(V){return i.bindVertexArray(V)}function u(V){return i.deleteVertexArray(V)}function f(V,H,K,J){let j=J.wireframe===!0,Z=n[H.id];Z===void 0&&(Z={},n[H.id]=Z);let ee=V.isInstancedMesh===!0?V.id:0,ae=Z[ee];ae===void 0&&(ae={},Z[ee]=ae);let ce=ae[K.id];ce===void 0&&(ce={},ae[K.id]=ce);let de=ce[j];return de===void 0&&(de=p(l()),ce[j]=de),de}function p(V){let H=[],K=[],J=[];for(let j=0;j<t;j++)H[j]=0,K[j]=0,J[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:K,attributeDivisors:J,object:V,attributes:{},index:null}}function x(V,H,K,J){let j=s.attributes,Z=H.attributes,ee=0,ae=K.getAttributes();for(let ce in ae)if(ae[ce].location>=0){let ve=j[ce],Ie=Z[ce];if(Ie===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(Ie=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(Ie=V.instanceColor)),ve===void 0||ve.attribute!==Ie||Ie&&ve.data!==Ie.data)return!0;ee++}return s.attributesNum!==ee||s.index!==J}function v(V,H,K,J){let j={},Z=H.attributes,ee=0,ae=K.getAttributes();for(let ce in ae)if(ae[ce].location>=0){let ve=Z[ce];ve===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(ve=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(ve=V.instanceColor));let Ie={};Ie.attribute=ve,ve&&ve.data&&(Ie.data=ve.data),j[ce]=Ie,ee++}s.attributes=j,s.attributesNum=ee,s.index=J}function w(){let V=s.newAttributes;for(let H=0,K=V.length;H<K;H++)V[H]=0}function S(V){T(V,0)}function T(V,H){let K=s.newAttributes,J=s.enabledAttributes,j=s.attributeDivisors;K[V]=1,J[V]===0&&(i.enableVertexAttribArray(V),J[V]=1),j[V]!==H&&(i.vertexAttribDivisor(V,H),j[V]=H)}function P(){let V=s.newAttributes,H=s.enabledAttributes;for(let K=0,J=H.length;K<J;K++)H[K]!==V[K]&&(i.disableVertexAttribArray(K),H[K]=0)}function R(V,H,K,J,j,Z,ee){ee===!0?i.vertexAttribIPointer(V,H,K,j,Z):i.vertexAttribPointer(V,H,K,J,j,Z)}function C(V,H,K,J){w();let j=J.attributes,Z=K.getAttributes(),ee=H.defaultAttributeValues;for(let ae in Z){let ce=Z[ae];if(ce.location>=0){let de=j[ae];if(de===void 0&&(ae==="instanceMatrix"&&V.instanceMatrix&&(de=V.instanceMatrix),ae==="instanceColor"&&V.instanceColor&&(de=V.instanceColor)),de!==void 0){let ve=de.normalized,Ie=de.itemSize,Qe=e.get(de);if(Qe===void 0)continue;let Ue=Qe.buffer,mt=Qe.type,Me=Qe.bytesPerElement,ze=mt===i.INT||mt===i.UNSIGNED_INT||de.gpuType===Ir;if(de.isInterleavedBufferAttribute){let $e=de.data,Et=$e.stride,Tt=de.offset;if($e.isInstancedInterleavedBuffer){for(let Ct=0;Ct<ce.locationSize;Ct++)T(ce.location+Ct,$e.meshPerAttribute);V.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=$e.meshPerAttribute*$e.count)}else for(let Ct=0;Ct<ce.locationSize;Ct++)S(ce.location+Ct);i.bindBuffer(i.ARRAY_BUFFER,Ue);for(let Ct=0;Ct<ce.locationSize;Ct++)R(ce.location+Ct,Ie/ce.locationSize,mt,ve,Et*Me,(Tt+Ie/ce.locationSize*Ct)*Me,ze)}else{if(de.isInstancedBufferAttribute){for(let $e=0;$e<ce.locationSize;$e++)T(ce.location+$e,de.meshPerAttribute);V.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let $e=0;$e<ce.locationSize;$e++)S(ce.location+$e);i.bindBuffer(i.ARRAY_BUFFER,Ue);for(let $e=0;$e<ce.locationSize;$e++)R(ce.location+$e,Ie/ce.locationSize,mt,ve,Ie*Me,Ie/ce.locationSize*$e*Me,ze)}}else if(ee!==void 0){let ve=ee[ae];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ce.location,ve);break;case 3:i.vertexAttrib3fv(ce.location,ve);break;case 4:i.vertexAttrib4fv(ce.location,ve);break;default:i.vertexAttrib1fv(ce.location,ve)}}}}P()}function L(){B();for(let V in n){let H=n[V];for(let K in H){let J=H[K];for(let j in J){let Z=J[j];for(let ee in Z)u(Z[ee].object),delete Z[ee];delete J[j]}}delete n[V]}}function D(V){if(n[V.id]===void 0)return;let H=n[V.id];for(let K in H){let J=H[K];for(let j in J){let Z=J[j];for(let ee in Z)u(Z[ee].object),delete Z[ee];delete J[j]}}delete n[V.id]}function F(V){for(let H in n){let K=n[H];for(let J in K){let j=K[J];if(j[V.id]===void 0)continue;let Z=j[V.id];for(let ee in Z)u(Z[ee].object),delete Z[ee];delete j[V.id]}}}function N(V){for(let H in n){let K=n[H],J=V.isInstancedMesh===!0?V.id:0,j=K[J];if(j!==void 0){for(let Z in j){let ee=j[Z];for(let ae in ee)u(ee[ae].object),delete ee[ae];delete j[Z]}delete K[J],Object.keys(K).length===0&&delete n[H]}}}function B(){z(),o=!0,s!==r&&(s=r,c(s.object))}function z(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:z,dispose:L,releaseStatesOfGeometry:D,releaseStatesOfObject:N,releaseStatesOfProgram:F,initAttributes:w,enableAttribute:S,disableUnusedAttributes:P}}function Xfe(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function a(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let p=0;for(let x=0;x<u;x++)p+=c[x];t.update(p,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function $fe(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let F=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(F){return!(F!==xr&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(F){let N=F===Li&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==Gi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Yi&&!N)}function l(F){if(F==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(je("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,p=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&p===!1&&je("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let x=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),T=i.getParameter(i.MAX_VERTEX_ATTRIBS),P=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),R=i.getParameter(i.MAX_VARYING_VECTORS),C=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),L=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:p,maxTextures:x,maxVertexTextures:v,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:P,maxVaryings:R,maxFragmentUniforms:C,maxSamples:L,samples:D}}function Yfe(i){let e=this,t=null,n=0,r=!1,s=!1,o=new oa,a=new Sn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){let x=f.length!==0||p||n!==0||r;return r=p,n=f.length,x},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=u(f,p,0)},this.setState=function(f,p,x){let v=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||v===null||v.length===0||s&&!S)s?u(null):c();else{let P=s?0:n,R=P*4,C=T.clippingState||null;l.value=C,C=u(v,p,R,x);for(let L=0;L!==R;++L)C[L]=t[L];T.clippingState=C,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=P}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,p,x,v){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,v!==!0||S===null){let T=x+w*4,P=p.matrixWorldInverse;a.getNormalMatrix(P),(S===null||S.length<T)&&(S=new Float32Array(T));for(let R=0,C=x;R!==w;++R,C+=4)o.copy(f[R]).applyMatrix4(P,a),o.normal.toArray(S,C),S[C+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var Pp=4,QH=[.125,.215,.35,.446,.526,.582],VA=20,Kfe=256,S2=new Vc,JH=new Ut,SL=null,TL=0,EL=0,ML=!1,Zfe=new ie,ZT=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=Zfe}=s;SL=this._renderer.getRenderTarget(),TL=this._renderer.getActiveCubeFace(),EL=this._renderer.getActiveMipmapLevel(),ML=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=nW(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=tW(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(SL,TL,EL),this._renderer.xr.enabled=ML,e.scissorTest=!1,M_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===gl||e.mapping===Ql?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),SL=this._renderer.getRenderTarget(),TL=this._renderer.getActiveCubeFace(),EL=this._renderer.getActiveMipmapLevel(),ML=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:vi,minFilter:vi,generateMipmaps:!1,type:Li,format:xr,colorSpace:Gd,depthBuffer:!1},r=eW(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=eW(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Qfe(s)),this._blurMaterial=ede(s,e,t),this._ggxMaterial=Jfe(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Zn,e);this._renderer.compile(t,S2)}_sceneToCubeUV(e,t,n,r,s){let l=new Rr(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,x=f.toneMapping;f.getClearColor(JH),f.toneMapping=ks,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Gc,new Us({name:"PMREM.Background",side:ui,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,P=e.background;P?P.isColor&&(S.color.copy(P),e.background=null,T=!0):(S.color.copy(JH),T=!0);for(let R=0;R<6;R++){let C=R%3;C===0?(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[R],s.y,s.z)):C===1?(l.up.set(0,0,c[R]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[R],s.z)):(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[R]));let L=this._cubeSize;M_(r,C*L,R>2?L:0,L,L),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=x,f.autoClear=p,e.background=P}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===gl||e.mapping===Ql;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=nW()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=tW());let s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;let a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;M_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,S2)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),p=0+c*1.25,x=f*p,{_lodMax:v}=this,w=this._sizeLods[n],S=3*w*(n>v-Pp?n-v+Pp:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,M_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,S2),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,M_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,S2)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Ge("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let p=c.uniforms,x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*VA-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):VA;S>VA&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${VA}`);let T=[],P=0;for(let F=0;F<VA;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?P+=B:F<S&&(P+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/P;p.envMap.value=e.texture,p.samples.value=S,p.weights.value=T,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);let{_lodMax:R}=this;p.dTheta.value=v,p.mipInt.value=R-n;let C=this._sizeLods[r],L=3*C*(r>R-Pp?r-R+Pp:0),D=4*(this._cubeSize-C);M_(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,S2)}};function Qfe(i){let e=[],t=[],n=[],r=i,s=i-Pp+1+QH.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Pp?l=QH[o-i+Pp-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],x=6,v=6,w=3,S=2,T=1,P=new Float32Array(w*v*x),R=new Float32Array(S*v*x),C=new Float32Array(T*v*x);for(let D=0;D<x;D++){let F=D%3*2/3-1,N=D>2?0:-1,B=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0];P.set(B,w*v*D),R.set(p,S*v*D);let z=[D,D,D,D,D,D];C.set(z,T*v*D)}let L=new Zn;L.setAttribute("position",new Ni(P,w)),L.setAttribute("uv",new Ni(R,S)),L.setAttribute("faceIndex",new Ni(C,T)),n.push(new Hn(L,null)),r>Pp&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function eW(i,e,t){let n=new ca(i,e,t);return n.texture.mapping=Hu,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function M_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Jfe(i,e,t){return new jr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Kfe,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:e3(),fragmentShader:`3679+}`,Fn={alphahash_fragment:due,alphahash_pars_fragment:pue,alphamap_fragment:Aue,alphamap_pars_fragment:mue,alphatest_fragment:gue,alphatest_pars_fragment:_ue,aomap_fragment:xue,aomap_pars_fragment:yue,batching_pars_vertex:vue,batching_vertex:bue,begin_vertex:wue,beginnormal_vertex:Sue,bsdfs:Tue,iridescence_fragment:Eue,bumpmap_pars_fragment:Mue,clipping_planes_fragment:Cue,clipping_planes_pars_fragment:Rue,clipping_planes_pars_vertex:Pue,clipping_planes_vertex:Iue,color_fragment:Nue,color_pars_fragment:Lue,color_pars_vertex:Due,color_vertex:Fue,common:Oue,cube_uv_reflection_fragment:Bue,defaultnormal_vertex:Uue,displacementmap_pars_vertex:kue,displacementmap_vertex:Gue,emissivemap_fragment:zue,emissivemap_pars_fragment:Vue,colorspace_fragment:que,colorspace_pars_fragment:Hue,envmap_fragment:Wue,envmap_common_pars_fragment:jue,envmap_pars_fragment:Xue,envmap_pars_vertex:$ue,envmap_physical_pars_fragment:she,envmap_vertex:Yue,fog_vertex:Zue,fog_pars_vertex:Kue,fog_fragment:Que,fog_pars_fragment:Jue,gradientmap_pars_fragment:ehe,lightmap_pars_fragment:the,lights_lambert_fragment:nhe,lights_lambert_pars_fragment:ihe,lights_pars_begin:rhe,lights_toon_fragment:ohe,lights_toon_pars_fragment:ahe,lights_phong_fragment:lhe,lights_phong_pars_fragment:che,lights_physical_fragment:uhe,lights_physical_pars_fragment:hhe,lights_fragment_begin:fhe,lights_fragment_maps:dhe,lights_fragment_end:phe,lightprobes_pars_fragment:Ahe,logdepthbuf_fragment:mhe,logdepthbuf_pars_fragment:ghe,logdepthbuf_pars_vertex:_he,logdepthbuf_vertex:xhe,map_fragment:yhe,map_pars_fragment:vhe,map_particle_fragment:bhe,map_particle_pars_fragment:whe,metalnessmap_fragment:She,metalnessmap_pars_fragment:The,morphinstance_vertex:Ehe,morphcolor_vertex:Mhe,morphnormal_vertex:Che,morphtarget_pars_vertex:Rhe,morphtarget_vertex:Phe,normal_fragment_begin:Ihe,normal_fragment_maps:Nhe,normal_pars_fragment:Lhe,normal_pars_vertex:Dhe,normal_vertex:Fhe,normalmap_pars_fragment:Ohe,clearcoat_normal_fragment_begin:Bhe,clearcoat_normal_fragment_maps:Uhe,clearcoat_pars_fragment:khe,iridescence_pars_fragment:Ghe,opaque_fragment:zhe,packing:Vhe,premultiplied_alpha_fragment:qhe,project_vertex:Hhe,dithering_fragment:Whe,dithering_pars_fragment:jhe,roughnessmap_fragment:Xhe,roughnessmap_pars_fragment:$he,shadowmap_pars_fragment:Yhe,shadowmap_pars_vertex:Zhe,shadowmap_vertex:Khe,shadowmask_pars_fragment:Qhe,skinbase_vertex:Jhe,skinning_pars_vertex:efe,skinning_vertex:tfe,skinnormal_vertex:nfe,specularmap_fragment:ife,specularmap_pars_fragment:rfe,tonemapping_fragment:sfe,tonemapping_pars_fragment:ofe,transmission_fragment:afe,transmission_pars_fragment:lfe,uv_pars_fragment:cfe,uv_pars_vertex:ufe,uv_vertex:hfe,worldpos_vertex:ffe,background_vert:dfe,background_frag:pfe,backgroundCube_vert:Afe,backgroundCube_frag:mfe,cube_vert:gfe,cube_frag:_fe,depth_vert:xfe,depth_frag:yfe,distance_vert:vfe,distance_frag:bfe,equirect_vert:wfe,equirect_frag:Sfe,linedashed_vert:Tfe,linedashed_frag:Efe,meshbasic_vert:Mfe,meshbasic_frag:Cfe,meshlambert_vert:Rfe,meshlambert_frag:Pfe,meshmatcap_vert:Ife,meshmatcap_frag:Nfe,meshnormal_vert:Lfe,meshnormal_frag:Dfe,meshphong_vert:Ffe,meshphong_frag:Ofe,meshphysical_vert:Bfe,meshphysical_frag:Ufe,meshtoon_vert:kfe,meshtoon_frag:Gfe,points_vert:zfe,points_frag:Vfe,shadow_vert:qfe,shadow_frag:Hfe,sprite_vert:Wfe,sprite_frag:jfe},Nt={common:{diffuse:{value:new Ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Sn},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Sn}},envmap:{envMap:{value:null},envMapRotation:{value:new Sn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Sn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Sn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Sn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Sn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Sn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Sn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Sn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Sn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ut(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new ie},probesMax:{value:new ie},probesResolution:{value:new ie}},points:{diffuse:{value:new Ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0},uvTransform:{value:new Sn}},sprite:{diffuse:{value:new Ut(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Sn},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0}}},ga={basic:{uniforms:qo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:Fn.meshbasic_vert,fragmentShader:Fn.meshbasic_frag},lambert:{uniforms:qo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)},envMapIntensity:{value:1}}]),vertexShader:Fn.meshlambert_vert,fragmentShader:Fn.meshlambert_frag},phong:{uniforms:qo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)},specular:{value:new Ut(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Fn.meshphong_vert,fragmentShader:Fn.meshphong_frag},standard:{uniforms:qo([Nt.common,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.roughnessmap,Nt.metalnessmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Fn.meshphysical_vert,fragmentShader:Fn.meshphysical_frag},toon:{uniforms:qo([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)}}]),vertexShader:Fn.meshtoon_vert,fragmentShader:Fn.meshtoon_frag},matcap:{uniforms:qo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:Fn.meshmatcap_vert,fragmentShader:Fn.meshmatcap_frag},points:{uniforms:qo([Nt.points,Nt.fog]),vertexShader:Fn.points_vert,fragmentShader:Fn.points_frag},dashed:{uniforms:qo([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fn.linedashed_vert,fragmentShader:Fn.linedashed_frag},depth:{uniforms:qo([Nt.common,Nt.displacementmap]),vertexShader:Fn.depth_vert,fragmentShader:Fn.depth_frag},normal:{uniforms:qo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:Fn.meshnormal_vert,fragmentShader:Fn.meshnormal_frag},sprite:{uniforms:qo([Nt.sprite,Nt.fog]),vertexShader:Fn.sprite_vert,fragmentShader:Fn.sprite_frag},background:{uniforms:{uvTransform:{value:new Sn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Fn.background_vert,fragmentShader:Fn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sn}},vertexShader:Fn.backgroundCube_vert,fragmentShader:Fn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fn.cube_vert,fragmentShader:Fn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fn.equirect_vert,fragmentShader:Fn.equirect_frag},distance:{uniforms:qo([Nt.common,Nt.displacementmap,{referencePosition:{value:new ie},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fn.distance_vert,fragmentShader:Fn.distance_frag},shadow:{uniforms:qo([Nt.lights,Nt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:Fn.shadow_vert,fragmentShader:Fn.shadow_frag}};ga.physical={uniforms:qo([ga.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Sn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Sn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Sn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Sn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Sn},sheen:{value:0},sheenColor:{value:new Ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Sn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Sn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Sn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Sn},attenuationDistance:{value:0},attenuationColor:{value:new Ut(0)},specularColor:{value:new Ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Sn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Sn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Sn}}]),vertexShader:Fn.meshphysical_vert,fragmentShader:Fn.meshphysical_frag};var YT={r:0,b:0,g:0},Xfe=new on,SW=new Sn;SW.set(-1,0,0,0,1,0,0,0,1);function $fe(i,e,t,n,r,s){let o=new Ut(0),a=r===!0?0:1,l,c,u=null,f=0,p=null;function x(P){let R=P.isScene===!0?P.background:null;if(R&&R.isTexture){let C=P.backgroundBlurriness>0;R=e.get(R,C)}return R}function v(P){let R=!1,C=x(P);C===null?S(o,a):C&&C.isColor&&(S(C,1),R=!0);let L=i.xr.getEnvironmentBlendMode();L==="additive"?t.buffers.color.setClear(0,0,0,1,s):L==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||R)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(P,R){let C=x(R);C&&(C.isCubeTexture||C.mapping===Hu)?(c===void 0&&(c=new Hn(new Gc(1,1,1),new jr({name:"BackgroundCubeMaterial",uniforms:zA(ga.backgroundCube.uniforms),vertexShader:ga.backgroundCube.vertexShader,fragmentShader:ga.backgroundCube.fragmentShader,side:ui,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(L,D,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=C,c.material.uniforms.backgroundBlurriness.value=R.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Xfe.makeRotationFromEuler(R.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(SW),c.material.toneMapped=sn.getTransfer(C.colorSpace)!==Bt,(u!==C||f!==C.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,u=C,f=C.version,p=i.toneMapping),c.layers.enableAll(),P.unshift(c,c.geometry,c.material,0,0,null)):C&&C.isTexture&&(l===void 0&&(l=new Hn(new SA(2,2),new jr({name:"BackgroundMaterial",uniforms:zA(ga.background.uniforms),vertexShader:ga.background.vertexShader,fragmentShader:ga.background.fragmentShader,side:Ao,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=C,l.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,l.material.toneMapped=sn.getTransfer(C.colorSpace)!==Bt,C.matrixAutoUpdate===!0&&C.updateMatrix(),l.material.uniforms.uvTransform.value.copy(C.matrix),(u!==C||f!==C.version||p!==i.toneMapping)&&(l.material.needsUpdate=!0,u=C,f=C.version,p=i.toneMapping),l.layers.enableAll(),P.unshift(l,l.geometry,l.material,0,0,null))}function S(P,R){P.getRGB(YT,gL(i)),t.buffers.color.setClear(YT.r,YT.g,YT.b,R,s)}function T(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(P,R=1){o.set(P),a=R,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(P){a=P,S(o,a)},render:v,addToRenderList:w,dispose:T}}function Yfe(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null),s=r,o=!1;function a(V,H,Z,J,j){let K=!1,ee=f(V,J,Z,H);s!==ee&&(s=ee,c(s.object)),K=x(V,J,Z,j),K&&v(V,J,Z,j),j!==null&&e.update(j,i.ELEMENT_ARRAY_BUFFER),(K||o)&&(o=!1,C(V,H,Z,J),j!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return i.createVertexArray()}function c(V){return i.bindVertexArray(V)}function u(V){return i.deleteVertexArray(V)}function f(V,H,Z,J){let j=J.wireframe===!0,K=n[H.id];K===void 0&&(K={},n[H.id]=K);let ee=V.isInstancedMesh===!0?V.id:0,ae=K[ee];ae===void 0&&(ae={},K[ee]=ae);let ce=ae[Z.id];ce===void 0&&(ce={},ae[Z.id]=ce);let de=ce[j];return de===void 0&&(de=p(l()),ce[j]=de),de}function p(V){let H=[],Z=[],J=[];for(let j=0;j<t;j++)H[j]=0,Z[j]=0,J[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:Z,attributeDivisors:J,object:V,attributes:{},index:null}}function x(V,H,Z,J){let j=s.attributes,K=H.attributes,ee=0,ae=Z.getAttributes();for(let ce in ae)if(ae[ce].location>=0){let ve=j[ce],Ie=K[ce];if(Ie===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(Ie=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(Ie=V.instanceColor)),ve===void 0||ve.attribute!==Ie||Ie&&ve.data!==Ie.data)return!0;ee++}return s.attributesNum!==ee||s.index!==J}function v(V,H,Z,J){let j={},K=H.attributes,ee=0,ae=Z.getAttributes();for(let ce in ae)if(ae[ce].location>=0){let ve=K[ce];ve===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(ve=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(ve=V.instanceColor));let Ie={};Ie.attribute=ve,ve&&ve.data&&(Ie.data=ve.data),j[ce]=Ie,ee++}s.attributes=j,s.attributesNum=ee,s.index=J}function w(){let V=s.newAttributes;for(let H=0,Z=V.length;H<Z;H++)V[H]=0}function S(V){T(V,0)}function T(V,H){let Z=s.newAttributes,J=s.enabledAttributes,j=s.attributeDivisors;Z[V]=1,J[V]===0&&(i.enableVertexAttribArray(V),J[V]=1),j[V]!==H&&(i.vertexAttribDivisor(V,H),j[V]=H)}function P(){let V=s.newAttributes,H=s.enabledAttributes;for(let Z=0,J=H.length;Z<J;Z++)H[Z]!==V[Z]&&(i.disableVertexAttribArray(Z),H[Z]=0)}function R(V,H,Z,J,j,K,ee){ee===!0?i.vertexAttribIPointer(V,H,Z,j,K):i.vertexAttribPointer(V,H,Z,J,j,K)}function C(V,H,Z,J){w();let j=J.attributes,K=Z.getAttributes(),ee=H.defaultAttributeValues;for(let ae in K){let ce=K[ae];if(ce.location>=0){let de=j[ae];if(de===void 0&&(ae==="instanceMatrix"&&V.instanceMatrix&&(de=V.instanceMatrix),ae==="instanceColor"&&V.instanceColor&&(de=V.instanceColor)),de!==void 0){let ve=de.normalized,Ie=de.itemSize,Qe=e.get(de);if(Qe===void 0)continue;let Ue=Qe.buffer,mt=Qe.type,Me=Qe.bytesPerElement,ze=mt===i.INT||mt===i.UNSIGNED_INT||de.gpuType===Ir;if(de.isInterleavedBufferAttribute){let $e=de.data,Et=$e.stride,Tt=de.offset;if($e.isInstancedInterleavedBuffer){for(let Ct=0;Ct<ce.locationSize;Ct++)T(ce.location+Ct,$e.meshPerAttribute);V.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=$e.meshPerAttribute*$e.count)}else for(let Ct=0;Ct<ce.locationSize;Ct++)S(ce.location+Ct);i.bindBuffer(i.ARRAY_BUFFER,Ue);for(let Ct=0;Ct<ce.locationSize;Ct++)R(ce.location+Ct,Ie/ce.locationSize,mt,ve,Et*Me,(Tt+Ie/ce.locationSize*Ct)*Me,ze)}else{if(de.isInstancedBufferAttribute){for(let $e=0;$e<ce.locationSize;$e++)T(ce.location+$e,de.meshPerAttribute);V.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let $e=0;$e<ce.locationSize;$e++)S(ce.location+$e);i.bindBuffer(i.ARRAY_BUFFER,Ue);for(let $e=0;$e<ce.locationSize;$e++)R(ce.location+$e,Ie/ce.locationSize,mt,ve,Ie*Me,Ie/ce.locationSize*$e*Me,ze)}}else if(ee!==void 0){let ve=ee[ae];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ce.location,ve);break;case 3:i.vertexAttrib3fv(ce.location,ve);break;case 4:i.vertexAttrib4fv(ce.location,ve);break;default:i.vertexAttrib1fv(ce.location,ve)}}}}P()}function L(){B();for(let V in n){let H=n[V];for(let Z in H){let J=H[Z];for(let j in J){let K=J[j];for(let ee in K)u(K[ee].object),delete K[ee];delete J[j]}}delete n[V]}}function D(V){if(n[V.id]===void 0)return;let H=n[V.id];for(let Z in H){let J=H[Z];for(let j in J){let K=J[j];for(let ee in K)u(K[ee].object),delete K[ee];delete J[j]}}delete n[V.id]}function F(V){for(let H in n){let Z=n[H];for(let J in Z){let j=Z[J];if(j[V.id]===void 0)continue;let K=j[V.id];for(let ee in K)u(K[ee].object),delete K[ee];delete j[V.id]}}}function N(V){for(let H in n){let Z=n[H],J=V.isInstancedMesh===!0?V.id:0,j=Z[J];if(j!==void 0){for(let K in j){let ee=j[K];for(let ae in ee)u(ee[ae].object),delete ee[ae];delete j[K]}delete Z[J],Object.keys(Z).length===0&&delete n[H]}}}function B(){z(),o=!0,s!==r&&(s=r,c(s.object))}function z(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:z,dispose:L,releaseStatesOfGeometry:D,releaseStatesOfObject:N,releaseStatesOfProgram:F,initAttributes:w,enableAttribute:S,disableUnusedAttributes:P}}function Zfe(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function a(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let p=0;for(let x=0;x<u;x++)p+=c[x];t.update(p,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function Kfe(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let F=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(F){return!(F!==xr&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(F){let N=F===Li&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==Gi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Yi&&!N)}function l(F){if(F==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(je("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,p=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&p===!1&&je("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let x=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),v=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),T=i.getParameter(i.MAX_VERTEX_ATTRIBS),P=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),R=i.getParameter(i.MAX_VARYING_VECTORS),C=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),L=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:p,maxTextures:x,maxVertexTextures:v,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:P,maxVaryings:R,maxFragmentUniforms:C,maxSamples:L,samples:D}}function Qfe(i){let e=this,t=null,n=0,r=!1,s=!1,o=new aa,a=new Sn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){let x=f.length!==0||p||n!==0||r;return r=p,n=f.length,x},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=u(f,p,0)},this.setState=function(f,p,x){let v=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||v===null||v.length===0||s&&!S)s?u(null):c();else{let P=s?0:n,R=P*4,C=T.clippingState||null;l.value=C,C=u(v,p,R,x);for(let L=0;L!==R;++L)C[L]=t[L];T.clippingState=C,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=P}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,p,x,v){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,v!==!0||S===null){let T=x+w*4,P=p.matrixWorldInverse;a.getNormalMatrix(P),(S===null||S.length<T)&&(S=new Float32Array(T));for(let R=0,C=x;R!==w;++R,C+=4)o.copy(f[R]).applyMatrix4(P,a),o.normal.toArray(S,C),S[C+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var Pp=4,eW=[.125,.215,.35,.446,.526,.582],qA=20,Jfe=256,S2=new Vc,tW=new Ut,TL=null,EL=0,ML=0,CL=!1,ede=new ie,KT=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=ede}=s;TL=this._renderer.getRenderTarget(),EL=this._renderer.getActiveCubeFace(),ML=this._renderer.getActiveMipmapLevel(),CL=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=rW(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=iW(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(TL,EL,ML),this._renderer.xr.enabled=CL,e.scissorTest=!1,M_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===gl||e.mapping===Ql?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),TL=this._renderer.getRenderTarget(),EL=this._renderer.getActiveCubeFace(),ML=this._renderer.getActiveMipmapLevel(),CL=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:vi,minFilter:vi,generateMipmaps:!1,type:Li,format:xr,colorSpace:Gd,depthBuffer:!1},r=nW(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=nW(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=tde(s)),this._blurMaterial=ide(s,e,t),this._ggxMaterial=nde(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Kn,e);this._renderer.compile(t,S2)}_sceneToCubeUV(e,t,n,r,s){let l=new Rr(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,x=f.toneMapping;f.getClearColor(tW),f.toneMapping=ks,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Gc,new Us({name:"PMREM.Background",side:ui,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,P=e.background;P?P.isColor&&(S.color.copy(P),e.background=null,T=!0):(S.color.copy(tW),T=!0);for(let R=0;R<6;R++){let C=R%3;C===0?(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[R],s.y,s.z)):C===1?(l.up.set(0,0,c[R]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[R],s.z)):(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[R]));let L=this._cubeSize;M_(r,C*L,R>2?L:0,L,L),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=x,f.autoClear=p,e.background=P}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===gl||e.mapping===Ql;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=rW()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=iW());let s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;let a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;M_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,S2)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),p=0+c*1.25,x=f*p,{_lodMax:v}=this,w=this._sizeLods[n],S=3*w*(n>v-Pp?n-v+Pp:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,M_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,S2),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,M_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,S2)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Ge("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let p=c.uniforms,x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*qA-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):qA;S>qA&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${qA}`);let T=[],P=0;for(let F=0;F<qA;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?P+=B:F<S&&(P+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/P;p.envMap.value=e.texture,p.samples.value=S,p.weights.value=T,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);let{_lodMax:R}=this;p.dTheta.value=v,p.mipInt.value=R-n;let C=this._sizeLods[r],L=3*C*(r>R-Pp?r-R+Pp:0),D=4*(this._cubeSize-C);M_(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,S2)}};function tde(i){let e=[],t=[],n=[],r=i,s=i-Pp+1+eW.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Pp?l=eW[o-i+Pp-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],x=6,v=6,w=3,S=2,T=1,P=new Float32Array(w*v*x),R=new Float32Array(S*v*x),C=new Float32Array(T*v*x);for(let D=0;D<x;D++){let F=D%3*2/3-1,N=D>2?0:-1,B=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0];P.set(B,w*v*D),R.set(p,S*v*D);let z=[D,D,D,D,D,D];C.set(z,T*v*D)}let L=new Kn;L.setAttribute("position",new Ni(P,w)),L.setAttribute("uv",new Ni(R,S)),L.setAttribute("faceIndex",new Ni(C,T)),n.push(new Hn(L,null)),r>Pp&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function nW(i,e,t){let n=new ua(i,e,t);return n.texture.mapping=Hu,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function M_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function nde(i,e,t){return new jr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Jfe,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:e3(),fragmentShader:`36803680 36813681 precision highp float;36823682 precision highp int;
@@ -3780,7 +3780,7 @@ void main() {
37803780 37813781 gl_FragColor = vec4(prefilteredColor, 1.0);37823782 }3783- `,blending:Xr,depthTest:!1,depthWrite:!1})}function ede(i,e,t){let n=new Float32Array(VA),r=new ie(0,1,0);return new jr({name:"SphericalGaussianBlur",defines:{n:VA,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:e3(),fragmentShader:`3783+ `,blending:Xr,depthTest:!1,depthWrite:!1})}function ide(i,e,t){let n=new Float32Array(qA),r=new ie(0,1,0);return new jr({name:"SphericalGaussianBlur",defines:{n:qA,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:e3(),fragmentShader:`37843784 37853785 precision mediump float;37863786 precision mediump int;
@@ -3840,7 +3840,7 @@ void main() {
38403840 }38413841 38423842 }3843- `,blending:Xr,depthTest:!1,depthWrite:!1})}function tW(){return new jr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:e3(),fragmentShader:`3843+ `,blending:Xr,depthTest:!1,depthWrite:!1})}function iW(){return new jr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:e3(),fragmentShader:`38443844 38453845 precision mediump float;38463846 precision mediump int;
@@ -3859,7 +3859,7 @@ void main() {
38593859 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );38603860 38613861 }3862- `,blending:Xr,depthTest:!1,depthWrite:!1})}function nW(){return new jr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:e3(),fragmentShader:`3862+ `,blending:Xr,depthTest:!1,depthWrite:!1})}function rW(){return new jr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:e3(),fragmentShader:`38633863 38643864 precision mediump float;38653865 precision mediump int;
@@ -3930,7 +3930,7 @@ void main() {
39303930 gl_Position = vec4( position, 1.0 );39313931 39323932 }3933- `}var QT=class extends ca{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Uu(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`3933+ `}var QT=class extends ua{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Uu(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`39343934 39353935 varying vec3 vWorldDirection;39363936
@@ -3965,7 +3965,7 @@ void main() {
39653965 gl_FragColor = texture2D( tEquirect, sampleUV );39663966 39673967 }3968- `},r=new Gc(5,5,5),s=new jr({name:"CubemapFromEquirect",uniforms:GA(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ui,blending:Xr});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===go&&(t.minFilter=vi),new y_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}};function tde(i){let e=new WeakMap,t=new WeakMap,n=null;function r(p,x=!1){return p==null?null:x?o(p):s(p)}function s(p){if(p&&p.isTexture){let x=p.mapping;if(x===ep||x===tp)if(e.has(p)){let v=e.get(p).texture;return a(v,p.mapping)}else{let v=p.image;if(v&&v.height>0){let w=new QT(v.height);return w.fromEquirectangularTexture(i,p),e.set(p,w),p.addEventListener("dispose",c),a(w.texture,p.mapping)}else return null}}return p}function o(p){if(p&&p.isTexture){let x=p.mapping,v=x===ep||x===tp,w=x===gl||x===Ql;if(v||w){let S=t.get(p),T=S!==void 0?S.texture.pmremVersion:0;if(p.isRenderTargetTexture&&p.pmremVersion!==T)return n===null&&(n=new ZT(i)),S=v?n.fromEquirectangular(p,S):n.fromCubemap(p,S),S.texture.pmremVersion=p.pmremVersion,t.set(p,S),S.texture;if(S!==void 0)return S.texture;{let P=p.image;return v&&P&&P.height>0||w&&P&&l(P)?(n===null&&(n=new ZT(i)),S=v?n.fromEquirectangular(p):n.fromCubemap(p),S.texture.pmremVersion=p.pmremVersion,t.set(p,S),p.addEventListener("dispose",u),S.texture):null}}}return p}function a(p,x){return x===ep?p.mapping=gl:x===tp&&(p.mapping=Ql),p}function l(p){let x=0,v=6;for(let w=0;w<v;w++)p[w]!==void 0&&x++;return x===v}function c(p){let x=p.target;x.removeEventListener("dispose",c);let v=e.get(x);v!==void 0&&(e.delete(x),v.dispose())}function u(p){let x=p.target;x.removeEventListener("dispose",u);let v=t.get(x);v!==void 0&&(t.delete(x),v.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function nde(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&Kn("WebGLRenderer: "+n+" extension not supported."),r}}}function ide(i,e,t,n){let r={},s=new WeakMap;function o(f){let p=f.target;p.index!==null&&e.remove(p.index);for(let v in p.attributes)e.remove(p.attributes[v]);p.removeEventListener("dispose",o),delete r[p.id];let x=s.get(p);x&&(e.remove(x),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(f,p){return r[p.id]===!0||(p.addEventListener("dispose",o),r[p.id]=!0,t.memory.geometries++),p}function l(f){let p=f.attributes;for(let x in p)e.update(p[x],i.ARRAY_BUFFER)}function c(f){let p=[],x=f.index,v=f.attributes.position,w=0;if(v===void 0)return;if(x!==null){let P=x.array;w=x.version;for(let R=0,C=P.length;R<C;R+=3){let L=P[R+0],D=P[R+1],F=P[R+2];p.push(L,D,D,F,F,L)}}else{let P=v.array;w=v.version;for(let R=0,C=P.length/3-1;R<C;R+=3){let L=R+0,D=R+1,F=R+2;p.push(L,D,D,F,F,L)}}let S=new(v.count>=65535?gA:mA)(p,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let p=s.get(f);if(p){let x=f.index;x!==null&&p.version<x.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function rde(i,e,t){let n;function r(f){n=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,p){i.drawElements(n,p,s,f*o),t.update(p,n,1)}function c(f,p,x){x!==0&&(i.drawElementsInstanced(n,p,s,f*o,x),t.update(p,n,x))}function u(f,p,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,f,0,x);let w=0;for(let S=0;S<x;S++)w+=p[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function sde(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:Ge("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function ode(i,e,t){let n=new WeakMap,r=new gn;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,p=n.get(a);if(p===void 0||p.count!==f){let B=function(){F.dispose(),n.delete(a),a.removeEventListener("dispose",B)};p!==void 0&&p.texture.dispose();let x=a.morphAttributes.position!==void 0,v=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],P=a.morphAttributes.color||[],R=0;x===!0&&(R=1),v===!0&&(R=2),w===!0&&(R=3);let C=a.attributes.position.count*R,L=1;C>e.maxTextureSize&&(L=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);let D=new Float32Array(C*L*4*f),F=new AA(D,C,L,f);F.type=Yi,F.needsUpdate=!0;let N=R*4;for(let z=0;z<f;z++){let V=S[z],H=T[z],K=P[z],J=C*L*4*z;for(let j=0;j<V.count;j++){let Z=j*N;x===!0&&(r.fromBufferAttribute(V,j),D[J+Z+0]=r.x,D[J+Z+1]=r.y,D[J+Z+2]=r.z,D[J+Z+3]=0),v===!0&&(r.fromBufferAttribute(H,j),D[J+Z+4]=r.x,D[J+Z+5]=r.y,D[J+Z+6]=r.z,D[J+Z+7]=0),w===!0&&(r.fromBufferAttribute(K,j),D[J+Z+8]=r.x,D[J+Z+9]=r.y,D[J+Z+10]=r.z,D[J+Z+11]=K.itemSize===4?r.w:1)}}p={count:f,texture:F,size:new Oe(C,L)},n.set(a,p),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let x=0;for(let w=0;w<c.length;w++)x+=c[w];let v=a.morphTargetsRelative?1:1-x;l.getUniforms().setValue(i,"morphTargetBaseInfluence",v),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",p.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",p.size)}return{update:s}}function ade(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,p=e.get(c,f);if(s.get(p)!==u&&(e.update(p),s.set(p,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){let x=c.skeleton;s.get(x)!==u&&(x.update(),s.set(x,u))}return p}function a(){s=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:a}}var lde={[l2]:"LINEAR_TONE_MAPPING",[c2]:"REINHARD_TONE_MAPPING",[u2]:"CINEON_TONE_MAPPING",[h2]:"ACES_FILMIC_TONE_MAPPING",[f2]:"AGX_TONE_MAPPING",[d2]:"NEUTRAL_TONE_MAPPING",[XN]:"CUSTOM_TONE_MAPPING"};function cde(i,e,t,n,r,s){let o=new ca(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new ss(e,t):void 0}),a=new ca(e,t,{type:Li,depthBuffer:!1,stencilBuffer:!1}),l=new Zn;l.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new kn([0,2,0,0,2,0],2));let c=new bT({uniforms:{tDiffuse:{value:null}},vertexShader:`3968+ `},r=new Gc(5,5,5),s=new jr({name:"CubemapFromEquirect",uniforms:zA(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ui,blending:Xr});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===go&&(t.minFilter=vi),new y_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}};function rde(i){let e=new WeakMap,t=new WeakMap,n=null;function r(p,x=!1){return p==null?null:x?o(p):s(p)}function s(p){if(p&&p.isTexture){let x=p.mapping;if(x===ep||x===tp)if(e.has(p)){let v=e.get(p).texture;return a(v,p.mapping)}else{let v=p.image;if(v&&v.height>0){let w=new QT(v.height);return w.fromEquirectangularTexture(i,p),e.set(p,w),p.addEventListener("dispose",c),a(w.texture,p.mapping)}else return null}}return p}function o(p){if(p&&p.isTexture){let x=p.mapping,v=x===ep||x===tp,w=x===gl||x===Ql;if(v||w){let S=t.get(p),T=S!==void 0?S.texture.pmremVersion:0;if(p.isRenderTargetTexture&&p.pmremVersion!==T)return n===null&&(n=new KT(i)),S=v?n.fromEquirectangular(p,S):n.fromCubemap(p,S),S.texture.pmremVersion=p.pmremVersion,t.set(p,S),S.texture;if(S!==void 0)return S.texture;{let P=p.image;return v&&P&&P.height>0||w&&P&&l(P)?(n===null&&(n=new KT(i)),S=v?n.fromEquirectangular(p):n.fromCubemap(p),S.texture.pmremVersion=p.pmremVersion,t.set(p,S),p.addEventListener("dispose",u),S.texture):null}}}return p}function a(p,x){return x===ep?p.mapping=gl:x===tp&&(p.mapping=Ql),p}function l(p){let x=0,v=6;for(let w=0;w<v;w++)p[w]!==void 0&&x++;return x===v}function c(p){let x=p.target;x.removeEventListener("dispose",c);let v=e.get(x);v!==void 0&&(e.delete(x),v.dispose())}function u(p){let x=p.target;x.removeEventListener("dispose",u);let v=t.get(x);v!==void 0&&(t.delete(x),v.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function sde(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&Zn("WebGLRenderer: "+n+" extension not supported."),r}}}function ode(i,e,t,n){let r={},s=new WeakMap;function o(f){let p=f.target;p.index!==null&&e.remove(p.index);for(let v in p.attributes)e.remove(p.attributes[v]);p.removeEventListener("dispose",o),delete r[p.id];let x=s.get(p);x&&(e.remove(x),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(f,p){return r[p.id]===!0||(p.addEventListener("dispose",o),r[p.id]=!0,t.memory.geometries++),p}function l(f){let p=f.attributes;for(let x in p)e.update(p[x],i.ARRAY_BUFFER)}function c(f){let p=[],x=f.index,v=f.attributes.position,w=0;if(v===void 0)return;if(x!==null){let P=x.array;w=x.version;for(let R=0,C=P.length;R<C;R+=3){let L=P[R+0],D=P[R+1],F=P[R+2];p.push(L,D,D,F,F,L)}}else{let P=v.array;w=v.version;for(let R=0,C=P.length/3-1;R<C;R+=3){let L=R+0,D=R+1,F=R+2;p.push(L,D,D,F,F,L)}}let S=new(v.count>=65535?_A:gA)(p,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let p=s.get(f);if(p){let x=f.index;x!==null&&p.version<x.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function ade(i,e,t){let n;function r(f){n=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,p){i.drawElements(n,p,s,f*o),t.update(p,n,1)}function c(f,p,x){x!==0&&(i.drawElementsInstanced(n,p,s,f*o,x),t.update(p,n,x))}function u(f,p,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,f,0,x);let w=0;for(let S=0;S<x;S++)w+=p[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function lde(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:Ge("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function cde(i,e,t){let n=new WeakMap,r=new gn;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,p=n.get(a);if(p===void 0||p.count!==f){let B=function(){F.dispose(),n.delete(a),a.removeEventListener("dispose",B)};p!==void 0&&p.texture.dispose();let x=a.morphAttributes.position!==void 0,v=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],P=a.morphAttributes.color||[],R=0;x===!0&&(R=1),v===!0&&(R=2),w===!0&&(R=3);let C=a.attributes.position.count*R,L=1;C>e.maxTextureSize&&(L=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);let D=new Float32Array(C*L*4*f),F=new mA(D,C,L,f);F.type=Yi,F.needsUpdate=!0;let N=R*4;for(let z=0;z<f;z++){let V=S[z],H=T[z],Z=P[z],J=C*L*4*z;for(let j=0;j<V.count;j++){let K=j*N;x===!0&&(r.fromBufferAttribute(V,j),D[J+K+0]=r.x,D[J+K+1]=r.y,D[J+K+2]=r.z,D[J+K+3]=0),v===!0&&(r.fromBufferAttribute(H,j),D[J+K+4]=r.x,D[J+K+5]=r.y,D[J+K+6]=r.z,D[J+K+7]=0),w===!0&&(r.fromBufferAttribute(Z,j),D[J+K+8]=r.x,D[J+K+9]=r.y,D[J+K+10]=r.z,D[J+K+11]=Z.itemSize===4?r.w:1)}}p={count:f,texture:F,size:new Oe(C,L)},n.set(a,p),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let x=0;for(let w=0;w<c.length;w++)x+=c[w];let v=a.morphTargetsRelative?1:1-x;l.getUniforms().setValue(i,"morphTargetBaseInfluence",v),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",p.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",p.size)}return{update:s}}function ude(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,p=e.get(c,f);if(s.get(p)!==u&&(e.update(p),s.set(p,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){let x=c.skeleton;s.get(x)!==u&&(x.update(),s.set(x,u))}return p}function a(){s=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:a}}var hde={[l2]:"LINEAR_TONE_MAPPING",[c2]:"REINHARD_TONE_MAPPING",[u2]:"CINEON_TONE_MAPPING",[h2]:"ACES_FILMIC_TONE_MAPPING",[f2]:"AGX_TONE_MAPPING",[d2]:"NEUTRAL_TONE_MAPPING",[$N]:"CUSTOM_TONE_MAPPING"};function fde(i,e,t,n,r,s){let o=new ua(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new os(e,t):void 0}),a=new ua(e,t,{type:Li,depthBuffer:!1,stencilBuffer:!1}),l=new Kn;l.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new kn([0,2,0,0,2,0],2));let c=new bT({uniforms:{tDiffuse:{value:null}},vertexShader:`39693969 precision highp float;39703970 39713971 uniform mat4 modelViewMatrix;
@@ -4011,17 +4011,17 @@ void main() {
40114011 #ifdef SRGB_TRANSFER40124012 gl_FragColor = sRGBTransferOETF( gl_FragColor );40134013 #endif4014- }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Vc(-1,1,1,-1,0,1),p=null,x=null,v=!1,w,S=null,T=[],P=!1;this.setSize=function(R,C){o.setSize(R,C),a.setSize(R,C);for(let L=0;L<T.length;L++){let D=T[L];D.setSize&&D.setSize(R,C)}},this.setEffects=function(R){T=R,P=T.length>0&&T[0].isRenderPass===!0;let C=o.width,L=o.height;for(let D=0;D<T.length;D++){let F=T[D];F.setSize&&F.setSize(C,L)}},this.begin=function(R,C){if(v||R.toneMapping===ks&&T.length===0)return!1;if(S=C,C!==null){let L=C.width,D=C.height;(o.width!==L||o.height!==D)&&this.setSize(L,D)}return P===!1&&R.setRenderTarget(o),w=R.toneMapping,R.toneMapping=ks,!0},this.hasRenderPass=function(){return P},this.end=function(R,C){R.toneMapping=w,v=!0;let L=o,D=a;for(let F=0;F<T.length;F++){let N=T[F];if(N.enabled!==!1&&(N.render(R,D,L,C),N.needsSwap!==!1)){let B=L;L=D,D=B}}if(p!==R.outputColorSpace||x!==R.toneMapping){p=R.outputColorSpace,x=R.toneMapping,c.defines={},sn.getTransfer(p)===Bt&&(c.defines.SRGB_TRANSFER="");let F=lde[x];F&&(c.defines[F]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=L.texture,R.setRenderTarget(S),R.render(u,f),S=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var wW=new vs,PL=new ss(1,1),SW=new AA,TW=new pT,EW=new Uu,iW=[],rW=[],sW=new Float32Array(16),oW=new Float32Array(9),aW=new Float32Array(4);function R_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=iW[r];if(s===void 0&&(s=new Float32Array(r),iW[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function Gs(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function zs(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function t3(i,e){let t=rW[e];t===void 0&&(t=new Int32Array(e),rW[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function ude(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function hde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Gs(t,e))return;i.uniform2fv(this.addr,e),zs(t,e)}}function fde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Gs(t,e))return;i.uniform3fv(this.addr,e),zs(t,e)}}function dde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Gs(t,e))return;i.uniform4fv(this.addr,e),zs(t,e)}}function pde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;aW.set(n),i.uniformMatrix2fv(this.addr,!1,aW),zs(t,n)}}function Ade(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;oW.set(n),i.uniformMatrix3fv(this.addr,!1,oW),zs(t,n)}}function mde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;sW.set(n),i.uniformMatrix4fv(this.addr,!1,sW),zs(t,n)}}function gde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function _de(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Gs(t,e))return;i.uniform2iv(this.addr,e),zs(t,e)}}function xde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Gs(t,e))return;i.uniform3iv(this.addr,e),zs(t,e)}}function yde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Gs(t,e))return;i.uniform4iv(this.addr,e),zs(t,e)}}function vde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function bde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Gs(t,e))return;i.uniform2uiv(this.addr,e),zs(t,e)}}function wde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Gs(t,e))return;i.uniform3uiv(this.addr,e),zs(t,e)}}function Sde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Gs(t,e))return;i.uniform4uiv(this.addr,e),zs(t,e)}}function Tde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(PL.compareFunction=t.isReversedDepthBuffer()?Hc:th,s=PL):s=wW,t.setTexture2D(e||s,r)}function Ede(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||TW,r)}function Mde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||EW,r)}function Cde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||SW,r)}function Rde(i){switch(i){case 5126:return ude;case 35664:return hde;case 35665:return fde;case 35666:return dde;case 35674:return pde;case 35675:return Ade;case 35676:return mde;case 5124:case 35670:return gde;case 35667:case 35671:return _de;case 35668:case 35672:return xde;case 35669:case 35673:return yde;case 5125:return vde;case 36294:return bde;case 36295:return wde;case 36296:return Sde;case 35678:case 36198:case 36298:case 36306:case 35682:return Tde;case 35679:case 36299:case 36307:return Ede;case 35680:case 36300:case 36308:case 36293:return Mde;case 36289:case 36303:case 36311:case 36292:return Cde}}function Pde(i,e){i.uniform1fv(this.addr,e)}function Ide(i,e){let t=R_(e,this.size,2);i.uniform2fv(this.addr,t)}function Nde(i,e){let t=R_(e,this.size,3);i.uniform3fv(this.addr,t)}function Lde(i,e){let t=R_(e,this.size,4);i.uniform4fv(this.addr,t)}function Dde(i,e){let t=R_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Fde(i,e){let t=R_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Ode(i,e){let t=R_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Bde(i,e){i.uniform1iv(this.addr,e)}function Ude(i,e){i.uniform2iv(this.addr,e)}function kde(i,e){i.uniform3iv(this.addr,e)}function Gde(i,e){i.uniform4iv(this.addr,e)}function zde(i,e){i.uniform1uiv(this.addr,e)}function Vde(i,e){i.uniform2uiv(this.addr,e)}function qde(i,e){i.uniform3uiv(this.addr,e)}function Hde(i,e){i.uniform4uiv(this.addr,e)}function Wde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=PL:o=wW;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function jde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||TW,s[o])}function Xde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||EW,s[o])}function $de(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||SW,s[o])}function Yde(i){switch(i){case 5126:return Pde;case 35664:return Ide;case 35665:return Nde;case 35666:return Lde;case 35674:return Dde;case 35675:return Fde;case 35676:return Ode;case 5124:case 35670:return Bde;case 35667:case 35671:return Ude;case 35668:case 35672:return kde;case 35669:case 35673:return Gde;case 5125:return zde;case 36294:return Vde;case 36295:return qde;case 36296:return Hde;case 35678:case 36198:case 36298:case 36306:case 35682:return Wde;case 35679:case 36299:case 36307:return jde;case 35680:case 36300:case 36308:case 36293:return Xde;case 36289:case 36303:case 36311:case 36292:return $de}}var IL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Rde(t.type)}},NL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Yde(t.type)}},LL=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let s=0,o=r.length;s!==o;++s){let a=r[s];a.setValue(e,t[a.id],n)}}},CL=/(\w+)(\])?(\[|\.)?/g;function lW(i,e){i.seq.push(e),i.map[e.id]=e}function Kde(i,e,t){let n=i.name,r=n.length;for(CL.lastIndex=0;;){let s=CL.exec(n),o=CL.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){lW(t,c===void 0?new IL(a,i,e):new NL(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new LL(a),lW(t,f)),t=f}}}var C_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);Kde(a,l,this)}let r=[],s=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function cW(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Zde=37297,Qde=0;function Jde(i,e){let t=i.split(`4014+ }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Vc(-1,1,1,-1,0,1),p=null,x=null,v=!1,w,S=null,T=[],P=!1;this.setSize=function(R,C){o.setSize(R,C),a.setSize(R,C);for(let L=0;L<T.length;L++){let D=T[L];D.setSize&&D.setSize(R,C)}},this.setEffects=function(R){T=R,P=T.length>0&&T[0].isRenderPass===!0;let C=o.width,L=o.height;for(let D=0;D<T.length;D++){let F=T[D];F.setSize&&F.setSize(C,L)}},this.begin=function(R,C){if(v||R.toneMapping===ks&&T.length===0)return!1;if(S=C,C!==null){let L=C.width,D=C.height;(o.width!==L||o.height!==D)&&this.setSize(L,D)}return P===!1&&R.setRenderTarget(o),w=R.toneMapping,R.toneMapping=ks,!0},this.hasRenderPass=function(){return P},this.end=function(R,C){R.toneMapping=w,v=!0;let L=o,D=a;for(let F=0;F<T.length;F++){let N=T[F];if(N.enabled!==!1&&(N.render(R,D,L,C),N.needsSwap!==!1)){let B=L;L=D,D=B}}if(p!==R.outputColorSpace||x!==R.toneMapping){p=R.outputColorSpace,x=R.toneMapping,c.defines={},sn.getTransfer(p)===Bt&&(c.defines.SRGB_TRANSFER="");let F=hde[x];F&&(c.defines[F]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=L.texture,R.setRenderTarget(S),R.render(u,f),S=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var TW=new bs,IL=new os(1,1),EW=new mA,MW=new pT,CW=new Uu,sW=[],oW=[],aW=new Float32Array(16),lW=new Float32Array(9),cW=new Float32Array(4);function R_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=sW[r];if(s===void 0&&(s=new Float32Array(r),sW[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function Gs(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function zs(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function t3(i,e){let t=oW[e];t===void 0&&(t=new Int32Array(e),oW[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function dde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function pde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Gs(t,e))return;i.uniform2fv(this.addr,e),zs(t,e)}}function Ade(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Gs(t,e))return;i.uniform3fv(this.addr,e),zs(t,e)}}function mde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Gs(t,e))return;i.uniform4fv(this.addr,e),zs(t,e)}}function gde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;cW.set(n),i.uniformMatrix2fv(this.addr,!1,cW),zs(t,n)}}function _de(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;lW.set(n),i.uniformMatrix3fv(this.addr,!1,lW),zs(t,n)}}function xde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;aW.set(n),i.uniformMatrix4fv(this.addr,!1,aW),zs(t,n)}}function yde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function vde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Gs(t,e))return;i.uniform2iv(this.addr,e),zs(t,e)}}function bde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Gs(t,e))return;i.uniform3iv(this.addr,e),zs(t,e)}}function wde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Gs(t,e))return;i.uniform4iv(this.addr,e),zs(t,e)}}function Sde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Tde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Gs(t,e))return;i.uniform2uiv(this.addr,e),zs(t,e)}}function Ede(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Gs(t,e))return;i.uniform3uiv(this.addr,e),zs(t,e)}}function Mde(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Gs(t,e))return;i.uniform4uiv(this.addr,e),zs(t,e)}}function Cde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(IL.compareFunction=t.isReversedDepthBuffer()?Hc:th,s=IL):s=TW,t.setTexture2D(e||s,r)}function Rde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||MW,r)}function Pde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||CW,r)}function Ide(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||EW,r)}function Nde(i){switch(i){case 5126:return dde;case 35664:return pde;case 35665:return Ade;case 35666:return mde;case 35674:return gde;case 35675:return _de;case 35676:return xde;case 5124:case 35670:return yde;case 35667:case 35671:return vde;case 35668:case 35672:return bde;case 35669:case 35673:return wde;case 5125:return Sde;case 36294:return Tde;case 36295:return Ede;case 36296:return Mde;case 35678:case 36198:case 36298:case 36306:case 35682:return Cde;case 35679:case 36299:case 36307:return Rde;case 35680:case 36300:case 36308:case 36293:return Pde;case 36289:case 36303:case 36311:case 36292:return Ide}}function Lde(i,e){i.uniform1fv(this.addr,e)}function Dde(i,e){let t=R_(e,this.size,2);i.uniform2fv(this.addr,t)}function Fde(i,e){let t=R_(e,this.size,3);i.uniform3fv(this.addr,t)}function Ode(i,e){let t=R_(e,this.size,4);i.uniform4fv(this.addr,t)}function Bde(i,e){let t=R_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Ude(i,e){let t=R_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function kde(i,e){let t=R_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Gde(i,e){i.uniform1iv(this.addr,e)}function zde(i,e){i.uniform2iv(this.addr,e)}function Vde(i,e){i.uniform3iv(this.addr,e)}function qde(i,e){i.uniform4iv(this.addr,e)}function Hde(i,e){i.uniform1uiv(this.addr,e)}function Wde(i,e){i.uniform2uiv(this.addr,e)}function jde(i,e){i.uniform3uiv(this.addr,e)}function Xde(i,e){i.uniform4uiv(this.addr,e)}function $de(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=IL:o=TW;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function Yde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||MW,s[o])}function Zde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||CW,s[o])}function Kde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||EW,s[o])}function Qde(i){switch(i){case 5126:return Lde;case 35664:return Dde;case 35665:return Fde;case 35666:return Ode;case 35674:return Bde;case 35675:return Ude;case 35676:return kde;case 5124:case 35670:return Gde;case 35667:case 35671:return zde;case 35668:case 35672:return Vde;case 35669:case 35673:return qde;case 5125:return Hde;case 36294:return Wde;case 36295:return jde;case 36296:return Xde;case 35678:case 36198:case 36298:case 36306:case 35682:return $de;case 35679:case 36299:case 36307:return Yde;case 35680:case 36300:case 36308:case 36293:return Zde;case 36289:case 36303:case 36311:case 36292:return Kde}}var NL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Nde(t.type)}},LL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Qde(t.type)}},DL=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let s=0,o=r.length;s!==o;++s){let a=r[s];a.setValue(e,t[a.id],n)}}},RL=/(\w+)(\])?(\[|\.)?/g;function uW(i,e){i.seq.push(e),i.map[e.id]=e}function Jde(i,e,t){let n=i.name,r=n.length;for(RL.lastIndex=0;;){let s=RL.exec(n),o=RL.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){uW(t,c===void 0?new NL(a,i,e):new LL(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new DL(a),uW(t,f)),t=f}}}var C_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);Jde(a,l,this)}let r=[],s=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function hW(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var epe=37297,tpe=0;function npe(i,e){let t=i.split(`40154015 `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){let a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(`4016-`)}var uW=new Sn;function epe(i){sn._getMatrix(uW,sn.workingColorSpace,i);let e=`mat3( ${uW.elements.map(t=>t.toFixed(4))} )`;switch(sn.getTransfer(i)){case zd:return[e,"LinearTransferOETF"];case Bt:return[e,"sRGBTransferOETF"];default:return je("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function hW(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`4016+`)}var fW=new Sn;function ipe(i){sn._getMatrix(fW,sn.workingColorSpace,i);let e=`mat3( ${fW.elements.map(t=>t.toFixed(4))} )`;switch(sn.getTransfer(i)){case zd:return[e,"LinearTransferOETF"];case Bt:return[e,"sRGBTransferOETF"];default:return je("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function dW(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`40174017 40184018 `+s+`40194019 4020-`+Jde(i.getShaderSource(e),a)}else return s}function tpe(i,e){let t=epe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4021-`)}var npe={[l2]:"Linear",[c2]:"Reinhard",[u2]:"Cineon",[h2]:"ACESFilmic",[f2]:"AgX",[d2]:"Neutral",[XN]:"Custom"};function ipe(i,e){let t=npe[e];return t===void 0?(je("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var KT=new ie;function rpe(){sn.getLuminanceCoefficients(KT);let i=KT.x.toFixed(4),e=KT.y.toFixed(4),t=KT.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4022-`)}function spe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(E2).join(`4023-`)}function ope(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4024-`)}function ape(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function E2(i){return i!==""}function fW(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function dW(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var lpe=/^[ \t]*#include +<([\w\d./]+)>/gm;function DL(i){return i.replace(lpe,upe)}var cpe=new Map;function upe(i,e){let t=Fn[e];if(t===void 0){let n=cpe.get(e);if(n!==void 0)t=Fn[n],je('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return DL(t)}var hpe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function pW(i){return i.replace(hpe,fpe)}function fpe(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function AW(i){let e=`precision ${i.precision} float;4020+`+npe(i.getShaderSource(e),a)}else return s}function rpe(i,e){let t=ipe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4021+`)}var spe={[l2]:"Linear",[c2]:"Reinhard",[u2]:"Cineon",[h2]:"ACESFilmic",[f2]:"AgX",[d2]:"Neutral",[$N]:"Custom"};function ope(i,e){let t=spe[e];return t===void 0?(je("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var ZT=new ie;function ape(){sn.getLuminanceCoefficients(ZT);let i=ZT.x.toFixed(4),e=ZT.y.toFixed(4),t=ZT.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4022+`)}function lpe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(E2).join(`4023+`)}function cpe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4024+`)}function upe(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function E2(i){return i!==""}function pW(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function AW(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var hpe=/^[ \t]*#include +<([\w\d./]+)>/gm;function FL(i){return i.replace(hpe,dpe)}var fpe=new Map;function dpe(i,e){let t=Fn[e];if(t===void 0){let n=fpe.get(e);if(n!==void 0)t=Fn[n],je('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return FL(t)}var ppe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function mW(i){return i.replace(ppe,Ape)}function Ape(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function gW(i){let e=`precision ${i.precision} float;40254025 precision ${i.precision} int;40264026 precision ${i.precision} sampler2D;40274027 precision ${i.precision} samplerCube;
@@ -4041,30 +4041,30 @@ void main() {
40414041 `;return i.precision==="highp"?e+=`40424042 #define HIGH_PRECISION`:i.precision==="mediump"?e+=`40434043 #define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`4044-#define LOW_PRECISION`),e}var dpe={[Jd]:"SHADOWMAP_TYPE_PCF",[Zl]:"SHADOWMAP_TYPE_VSM"};function ppe(i){return dpe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Ape={[gl]:"ENVMAP_TYPE_CUBE",[Ql]:"ENVMAP_TYPE_CUBE",[Hu]:"ENVMAP_TYPE_CUBE_UV"};function mpe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Ape[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var gpe={[Ql]:"ENVMAP_MODE_REFRACTION"};function _pe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":gpe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var xpe={[RA]:"ENVMAP_BLENDING_MULTIPLY",[qT]:"ENVMAP_BLENDING_MIX",[HT]:"ENVMAP_BLENDING_ADD"};function ype(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":xpe[i.combine]||"ENVMAP_BLENDING_NONE"}function vpe(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function bpe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=ppe(t),c=mpe(t),u=_pe(t),f=ype(t),p=vpe(t),x=spe(t),v=ope(s),w=r.createProgram(),S,T,P=t.glslVersion?"#version "+t.glslVersion+`4044+#define LOW_PRECISION`),e}var mpe={[Jd]:"SHADOWMAP_TYPE_PCF",[Kl]:"SHADOWMAP_TYPE_VSM"};function gpe(i){return mpe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var _pe={[gl]:"ENVMAP_TYPE_CUBE",[Ql]:"ENVMAP_TYPE_CUBE",[Hu]:"ENVMAP_TYPE_CUBE_UV"};function xpe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":_pe[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var ype={[Ql]:"ENVMAP_MODE_REFRACTION"};function vpe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":ype[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var bpe={[PA]:"ENVMAP_BLENDING_MULTIPLY",[qT]:"ENVMAP_BLENDING_MIX",[HT]:"ENVMAP_BLENDING_ADD"};function wpe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":bpe[i.combine]||"ENVMAP_BLENDING_NONE"}function Spe(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function Tpe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=gpe(t),c=xpe(t),u=vpe(t),f=wpe(t),p=Spe(t),x=lpe(t),v=cpe(s),w=r.createProgram(),S,T,P=t.glslVersion?"#version "+t.glslVersion+`40454045 `:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(E2).join(`40464046 `),S.length>0&&(S+=`40474047 `),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(E2).join(`40484048 `),T.length>0&&(T+=`4049-`)):(S=[AW(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`4049+`)):(S=[gW(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`40504050 `].filter(E2).join(`4051-`),T=[AW(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ks?"#define TONE_MAPPING":"",t.toneMapping!==ks?Fn.tonemapping_pars_fragment:"",t.toneMapping!==ks?ipe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Fn.colorspace_pars_fragment,tpe("linearToOutputTexel",t.outputColorSpace),rpe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4051+`),T=[gW(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ks?"#define TONE_MAPPING":"",t.toneMapping!==ks?Fn.tonemapping_pars_fragment:"",t.toneMapping!==ks?ope("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Fn.colorspace_pars_fragment,rpe("linearToOutputTexel",t.outputColorSpace),ape(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`40524052 `].filter(E2).join(`4053-`)),o=DL(o),o=fW(o,t),o=dW(o,t),a=DL(a),a=fW(a,t),a=dW(a,t),o=pW(o),a=pW(a),t.isRawShaderMaterial!==!0&&(P=`#version 300 es4053+`)),o=FL(o),o=pW(o,t),o=AW(o,t),a=FL(a),a=pW(a,t),a=AW(a,t),o=mW(o),a=mW(a),t.isRawShaderMaterial!==!0&&(P=`#version 300 es40544054 `,S=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(`40554055 `)+`4056-`+S,T=["#define varying in",t.glslVersion===fL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===fL?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`4056+`+S,T=["#define varying in",t.glslVersion===dL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===dL?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`40574057 `)+`4058-`+T);let R=P+S+o,C=P+T+a,L=cW(r,r.VERTEX_SHADER,R),D=cW(r,r.FRAGMENT_SHADER,C);r.attachShader(w,L),r.attachShader(w,D),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function F(V){if(i.debug.checkShaderErrors){let H=r.getProgramInfoLog(w)||"",K=r.getShaderInfoLog(L)||"",J=r.getShaderInfoLog(D)||"",j=H.trim(),Z=K.trim(),ee=J.trim(),ae=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(ae=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,L,D);else{let de=hW(r,L,"vertex"),ve=hW(r,D,"fragment");Ge("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`4058+`+T);let R=P+S+o,C=P+T+a,L=hW(r,r.VERTEX_SHADER,R),D=hW(r,r.FRAGMENT_SHADER,C);r.attachShader(w,L),r.attachShader(w,D),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function F(V){if(i.debug.checkShaderErrors){let H=r.getProgramInfoLog(w)||"",Z=r.getShaderInfoLog(L)||"",J=r.getShaderInfoLog(D)||"",j=H.trim(),K=Z.trim(),ee=J.trim(),ae=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(ae=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,L,D);else{let de=dW(r,L,"vertex"),ve=dW(r,D,"fragment");Ge("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`40594059 40604060 Material Name: `+V.name+`40614061 Material Type: `+V.type+`40624062 40634063 Program Info Log: `+j+`40644064 `+de+`4065-`+ve)}else j!==""?je("WebGLProgram: Program Info Log:",j):(Z===""||ee==="")&&(ce=!1);ce&&(V.diagnostics={runnable:ae,programLog:j,vertexShader:{log:Z,prefix:S},fragmentShader:{log:ee,prefix:T}})}r.deleteShader(L),r.deleteShader(D),N=new C_(r,w),B=ape(r,w)}let N;this.getUniforms=function(){return N===void 0&&F(this),N};let B;this.getAttributes=function(){return B===void 0&&F(this),B};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=r.getProgramParameter(w,Zde)),z},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Qde++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=D,this}var wpe=0,FL=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new OL(e),t.set(e,n)),n}},OL=class{constructor(e){this.id=wpe++,this.code=e,this.usedTimes=0}};function Spe(i){return i===ws||i===Ju||i===eh}function Tpe(i,e,t,n,r,s){let o=new h_,a=new FL,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,p=n.precision,x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(N){return l.add(N),N===0?"uv":`uv${N}`}function w(N,B,z,V,H,K){let J=V.fog,j=H.geometry,Z=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?V.environment:null,ee=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap,ae=e.get(N.envMap||Z,ee),ce=ae&&ae.mapping===Hu?ae.image.height:null,de=x[N.type];N.precision!==null&&(p=n.getMaxPrecision(N.precision),p!==N.precision&&je("WebGLProgram.getParameters:",N.precision,"not supported, using",p,"instead."));let ve=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,Ie=ve!==void 0?ve.length:0,Qe=0;j.morphAttributes.position!==void 0&&(Qe=1),j.morphAttributes.normal!==void 0&&(Qe=2),j.morphAttributes.color!==void 0&&(Qe=3);let Ue,mt,Me,ze;if(de){let jt=ma[de];Ue=jt.vertexShader,mt=jt.fragmentShader}else{Ue=N.vertexShader,mt=N.fragmentShader;let jt=a.getVertexShaderStage(N),qi=a.getFragmentShaderStage(N);a.update(N,jt,qi),Me=jt.id,ze=qi.id}let $e=i.getRenderTarget(),Et=i.state.buffers.depth.getReversed(),Tt=H.isInstancedMesh===!0,Ct=H.isBatchedMesh===!0,un=!!N.map,Gt=!!N.matcap,Xe=!!ae,st=!!N.aoMap,tt=!!N.lightMap,vt=!!N.bumpMap&&N.wireframe===!1,yt=!!N.normalMap,ln=!!N.displacementMap,Zt=!!N.emissiveMap,Qt=!!N.metalnessMap,xn=!!N.roughnessMap,ge=N.anisotropy>0,di=N.clearcoat>0,On=N.dispersion>0,le=N.iridescence>0,X=N.sheen>0,Te=N.transmission>0,Pe=ge&&!!N.anisotropyMap,Ve=di&&!!N.clearcoatMap,gt=di&&!!N.clearcoatNormalMap,St=di&&!!N.clearcoatRoughnessMap,qe=le&&!!N.iridescenceMap,Ze=le&&!!N.iridescenceThicknessMap,Rt=X&&!!N.sheenColorMap,en=X&&!!N.sheenRoughnessMap,Pt=!!N.specularMap,Mt=!!N.specularColorMap,cn=!!N.specularIntensityMap,yn=Te&&!!N.transmissionMap,Rn=Te&&!!N.thicknessMap,xe=!!N.gradientMap,bt=!!N.alphaMap,Ye=N.alphaTest>0,wt=!!N.alphaHash,Dt=!!N.extensions,ct=ks;N.toneMapped&&($e===null||$e.isXRRenderTarget===!0)&&(ct=i.toneMapping);let Ce={shaderID:de,shaderType:N.type,shaderName:N.name,vertexShader:Ue,fragmentShader:mt,defines:N.defines,customVertexShaderID:Me,customFragmentShaderID:ze,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:p,batching:Ct,batchingColor:Ct&&H._colorsTexture!==null,instancing:Tt,instancingColor:Tt&&H.instanceColor!==null,instancingMorph:Tt&&H.morphTexture!==null,outputColorSpace:$e===null?i.outputColorSpace:$e.isXRRenderTarget===!0?$e.texture.colorSpace:sn.workingColorSpace,alphaToCoverage:!!N.alphaToCoverage,map:un,matcap:Gt,envMap:Xe,envMapMode:Xe&&ae.mapping,envMapCubeUVHeight:ce,aoMap:st,lightMap:tt,bumpMap:vt,normalMap:yt,displacementMap:ln,emissiveMap:Zt,normalMapObjectSpace:yt&&N.normalMapType===jT,normalMapTangentSpace:yt&&N.normalMapType===_l,packedNormalMap:yt&&N.normalMapType===_l&&Spe(N.normalMap.format),metalnessMap:Qt,roughnessMap:xn,anisotropy:ge,anisotropyMap:Pe,clearcoat:di,clearcoatMap:Ve,clearcoatNormalMap:gt,clearcoatRoughnessMap:St,dispersion:On,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Ze,sheen:X,sheenColorMap:Rt,sheenRoughnessMap:en,specularMap:Pt,specularColorMap:Mt,specularIntensityMap:cn,transmission:Te,transmissionMap:yn,thicknessMap:Rn,gradientMap:xe,opaque:N.transparent===!1&&N.blending===rs&&N.alphaToCoverage===!1,alphaMap:bt,alphaTest:Ye,alphaHash:wt,combine:N.combine,mapUv:un&&v(N.map.channel),aoMapUv:st&&v(N.aoMap.channel),lightMapUv:tt&&v(N.lightMap.channel),bumpMapUv:vt&&v(N.bumpMap.channel),normalMapUv:yt&&v(N.normalMap.channel),displacementMapUv:ln&&v(N.displacementMap.channel),emissiveMapUv:Zt&&v(N.emissiveMap.channel),metalnessMapUv:Qt&&v(N.metalnessMap.channel),roughnessMapUv:xn&&v(N.roughnessMap.channel),anisotropyMapUv:Pe&&v(N.anisotropyMap.channel),clearcoatMapUv:Ve&&v(N.clearcoatMap.channel),clearcoatNormalMapUv:gt&&v(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:St&&v(N.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&v(N.iridescenceMap.channel),iridescenceThicknessMapUv:Ze&&v(N.iridescenceThicknessMap.channel),sheenColorMapUv:Rt&&v(N.sheenColorMap.channel),sheenRoughnessMapUv:en&&v(N.sheenRoughnessMap.channel),specularMapUv:Pt&&v(N.specularMap.channel),specularColorMapUv:Mt&&v(N.specularColorMap.channel),specularIntensityMapUv:cn&&v(N.specularIntensityMap.channel),transmissionMapUv:yn&&v(N.transmissionMap.channel),thicknessMapUv:Rn&&v(N.thicknessMap.channel),alphaMapUv:bt&&v(N.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(yt||ge),vertexNormals:!!j.attributes.normal,vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!j.attributes.uv&&(un||bt),fog:!!J,useFog:N.fog===!0,fogExp2:!!J&&J.isFogExp2,flatShading:N.wireframe===!1&&(N.flatShading===!0||j.attributes.normal===void 0&&yt===!1&&(N.isMeshLambertMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isMeshPhysicalMaterial)),sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Et,skinning:H.isSkinnedMesh===!0,hasPositionAttribute:j.attributes.position!==void 0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:Ie,morphTextureStride:Qe,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numLightProbes:B.numLightProbes,numLightProbeGrids:K.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:i.shadowMap.enabled&&z.length>0,shadowMapType:i.shadowMap.type,toneMapping:ct,decodeVideoTexture:un&&N.map.isVideoTexture===!0&&sn.getTransfer(N.map.colorSpace)===Bt,decodeVideoTextureEmissive:Zt&&N.emissiveMap.isVideoTexture===!0&&sn.getTransfer(N.emissiveMap.colorSpace)===Bt,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===ir,flipSided:N.side===ui,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionClipCullDistance:Dt&&N.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Dt&&N.extensions.multiDraw===!0||Ct)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:N.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(N){let B=[];if(N.shaderID?B.push(N.shaderID):(B.push(N.customVertexShaderID),B.push(N.customFragmentShaderID)),N.defines!==void 0)for(let z in N.defines)B.push(z),B.push(N.defines[z]);return N.isRawShaderMaterial===!1&&(T(B,N),P(B,N),B.push(i.outputColorSpace)),B.push(N.customProgramCacheKey),B.join()}function T(N,B){N.push(B.precision),N.push(B.outputColorSpace),N.push(B.envMapMode),N.push(B.envMapCubeUVHeight),N.push(B.mapUv),N.push(B.alphaMapUv),N.push(B.lightMapUv),N.push(B.aoMapUv),N.push(B.bumpMapUv),N.push(B.normalMapUv),N.push(B.displacementMapUv),N.push(B.emissiveMapUv),N.push(B.metalnessMapUv),N.push(B.roughnessMapUv),N.push(B.anisotropyMapUv),N.push(B.clearcoatMapUv),N.push(B.clearcoatNormalMapUv),N.push(B.clearcoatRoughnessMapUv),N.push(B.iridescenceMapUv),N.push(B.iridescenceThicknessMapUv),N.push(B.sheenColorMapUv),N.push(B.sheenRoughnessMapUv),N.push(B.specularMapUv),N.push(B.specularColorMapUv),N.push(B.specularIntensityMapUv),N.push(B.transmissionMapUv),N.push(B.thicknessMapUv),N.push(B.combine),N.push(B.fogExp2),N.push(B.sizeAttenuation),N.push(B.morphTargetsCount),N.push(B.morphAttributeCount),N.push(B.numDirLights),N.push(B.numPointLights),N.push(B.numSpotLights),N.push(B.numSpotLightMaps),N.push(B.numHemiLights),N.push(B.numRectAreaLights),N.push(B.numDirLightShadows),N.push(B.numPointLightShadows),N.push(B.numSpotLightShadows),N.push(B.numSpotLightShadowsWithMaps),N.push(B.numLightProbes),N.push(B.shadowMapType),N.push(B.toneMapping),N.push(B.numClippingPlanes),N.push(B.numClipIntersection),N.push(B.depthPacking)}function P(N,B){o.disableAll(),B.instancing&&o.enable(0),B.instancingColor&&o.enable(1),B.instancingMorph&&o.enable(2),B.matcap&&o.enable(3),B.envMap&&o.enable(4),B.normalMapObjectSpace&&o.enable(5),B.normalMapTangentSpace&&o.enable(6),B.clearcoat&&o.enable(7),B.iridescence&&o.enable(8),B.alphaTest&&o.enable(9),B.vertexColors&&o.enable(10),B.vertexAlphas&&o.enable(11),B.vertexUv1s&&o.enable(12),B.vertexUv2s&&o.enable(13),B.vertexUv3s&&o.enable(14),B.vertexTangents&&o.enable(15),B.anisotropy&&o.enable(16),B.alphaHash&&o.enable(17),B.batching&&o.enable(18),B.dispersion&&o.enable(19),B.batchingColor&&o.enable(20),B.gradientMap&&o.enable(21),B.packedNormalMap&&o.enable(22),B.vertexNormals&&o.enable(23),N.push(o.mask),o.disableAll(),B.fog&&o.enable(0),B.useFog&&o.enable(1),B.flatShading&&o.enable(2),B.logarithmicDepthBuffer&&o.enable(3),B.reversedDepthBuffer&&o.enable(4),B.skinning&&o.enable(5),B.morphTargets&&o.enable(6),B.morphNormals&&o.enable(7),B.morphColors&&o.enable(8),B.premultipliedAlpha&&o.enable(9),B.shadowMapEnabled&&o.enable(10),B.doubleSided&&o.enable(11),B.flipSided&&o.enable(12),B.useDepthPacking&&o.enable(13),B.dithering&&o.enable(14),B.transmission&&o.enable(15),B.sheen&&o.enable(16),B.opaque&&o.enable(17),B.pointsUvs&&o.enable(18),B.decodeVideoTexture&&o.enable(19),B.decodeVideoTextureEmissive&&o.enable(20),B.alphaToCoverage&&o.enable(21),B.numLightProbeGrids>0&&o.enable(22),B.hasPositionAttribute&&o.enable(23),N.push(o.mask)}function R(N){let B=x[N.type],z;if(B){let V=ma[B];z=zA.clone(V.uniforms)}else z=N.uniforms;return z}function C(N,B){let z=u.get(B);return z!==void 0?++z.usedTimes:(z=new bpe(i,B,N,r),c.push(z),u.set(B,z)),z}function L(N){if(--N.usedTimes===0){let B=c.indexOf(N);c[B]=c[c.length-1],c.pop(),u.delete(N.cacheKey),N.destroy()}}function D(N){a.remove(N)}function F(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:R,acquireProgram:C,releaseProgram:L,releaseShaderCache:D,programs:c,dispose:F}}function Epe(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Mpe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function mW(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function gW(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(p){let x=0;return p.isInstancedMesh&&(x+=2),p.isSkinnedMesh&&(x+=1),x}function a(p,x,v,w,S,T){let P=i[e];return P===void 0?(P={id:p.id,object:p,geometry:x,material:v,materialVariant:o(p),groupOrder:w,renderOrder:p.renderOrder,z:S,group:T},i[e]=P):(P.id=p.id,P.object=p,P.geometry=x,P.material=v,P.materialVariant=o(p),P.groupOrder=w,P.renderOrder=p.renderOrder,P.z=S,P.group=T),e++,P}function l(p,x,v,w,S,T){let P=a(p,x,v,w,S,T);v.transmission>0?n.push(P):v.transparent===!0?r.push(P):t.push(P)}function c(p,x,v,w,S,T){let P=a(p,x,v,w,S,T);v.transmission>0?n.unshift(P):v.transparent===!0?r.unshift(P):t.unshift(P)}function u(p,x,v){t.length>1&&t.sort(p||Mpe),n.length>1&&n.sort(x||mW),r.length>1&&r.sort(x||mW),v&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let p=e,x=i.length;p<x;p++){let v=i[p];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function Cpe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new gW,i.set(n,[o])):r>=s.length?(o=new gW,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Rpe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ie,color:new Ut};break;case"SpotLight":t={position:new ie,direction:new ie,color:new Ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ie,color:new Ut,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ie,skyColor:new Ut,groundColor:new Ut};break;case"RectAreaLight":t={color:new Ut,position:new ie,halfWidth:new ie,halfHeight:new ie};break}return i[e.id]=t,t}}}function Ppe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var Ipe=0;function Npe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Lpe(i){let e=new Rpe,t=Ppe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new ie);let r=new ie,s=new on,o=new on;function a(c){let u=0,f=0,p=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let x=0,v=0,w=0,S=0,T=0,P=0,R=0,C=0,L=0,D=0,F=0;c.sort(Npe);for(let B=0,z=c.length;B<z;B++){let V=c[B],H=V.color,K=V.intensity,J=V.distance,j=null;if(V.shadow&&V.shadow.map&&(V.shadow.map.texture.format===ws?j=V.shadow.map.texture:j=V.shadow.map.depthTexture||V.shadow.map.texture),V.isAmbientLight)u+=H.r*K,f+=H.g*K,p+=H.b*K;else if(V.isLightProbe){for(let Z=0;Z<9;Z++)n.probe[Z].addScaledVector(V.sh.coefficients[Z],K);F++}else if(V.isDirectionalLight){let Z=e.get(V);if(Z.color.copy(V.color).multiplyScalar(V.intensity),V.castShadow){let ee=V.shadow,ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,n.directionalShadow[x]=ae,n.directionalShadowMap[x]=j,n.directionalShadowMatrix[x]=V.shadow.matrix,P++}n.directional[x]=Z,x++}else if(V.isSpotLight){let Z=e.get(V);Z.position.setFromMatrixPosition(V.matrixWorld),Z.color.copy(H).multiplyScalar(K),Z.distance=J,Z.coneCos=Math.cos(V.angle),Z.penumbraCos=Math.cos(V.angle*(1-V.penumbra)),Z.decay=V.decay,n.spot[w]=Z;let ee=V.shadow;if(V.map&&(n.spotLightMap[L]=V.map,L++,ee.updateMatrices(V),V.castShadow&&D++),n.spotLightMatrix[w]=ee.matrix,V.castShadow){let ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,n.spotShadow[w]=ae,n.spotShadowMap[w]=j,C++}w++}else if(V.isRectAreaLight){let Z=e.get(V);Z.color.copy(H).multiplyScalar(K),Z.halfWidth.set(V.width*.5,0,0),Z.halfHeight.set(0,V.height*.5,0),n.rectArea[S]=Z,S++}else if(V.isPointLight){let Z=e.get(V);if(Z.color.copy(V.color).multiplyScalar(V.intensity),Z.distance=V.distance,Z.decay=V.decay,V.castShadow){let ee=V.shadow,ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,ae.shadowCameraNear=ee.camera.near,ae.shadowCameraFar=ee.camera.far,n.pointShadow[v]=ae,n.pointShadowMap[v]=j,n.pointShadowMatrix[v]=V.shadow.matrix,R++}n.point[v]=Z,v++}else if(V.isHemisphereLight){let Z=e.get(V);Z.skyColor.copy(V.color).multiplyScalar(K),Z.groundColor.copy(V.groundColor).multiplyScalar(K),n.hemi[T]=Z,T++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Nt.LTC_FLOAT_1,n.rectAreaLTC2=Nt.LTC_FLOAT_2):(n.rectAreaLTC1=Nt.LTC_HALF_1,n.rectAreaLTC2=Nt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=p;let N=n.hash;(N.directionalLength!==x||N.pointLength!==v||N.spotLength!==w||N.rectAreaLength!==S||N.hemiLength!==T||N.numDirectionalShadows!==P||N.numPointShadows!==R||N.numSpotShadows!==C||N.numSpotMaps!==L||N.numLightProbes!==F)&&(n.directional.length=x,n.spot.length=w,n.rectArea.length=S,n.point.length=v,n.hemi.length=T,n.directionalShadow.length=P,n.directionalShadowMap.length=P,n.pointShadow.length=R,n.pointShadowMap.length=R,n.spotShadow.length=C,n.spotShadowMap.length=C,n.directionalShadowMatrix.length=P,n.pointShadowMatrix.length=R,n.spotLightMatrix.length=C+L-D,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=F,N.directionalLength=x,N.pointLength=v,N.spotLength=w,N.rectAreaLength=S,N.hemiLength=T,N.numDirectionalShadows=P,N.numPointShadows=R,N.numSpotShadows=C,N.numSpotMaps=L,N.numLightProbes=F,n.version=Ipe++)}function l(c,u){let f=0,p=0,x=0,v=0,w=0,S=u.matrixWorldInverse;for(let T=0,P=c.length;T<P;T++){let R=c[T];if(R.isDirectionalLight){let C=n.directional[f];C.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),f++}else if(R.isSpotLight){let C=n.spot[x];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),C.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),x++}else if(R.isRectAreaLight){let C=n.rectArea[v];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),o.identity(),s.copy(R.matrixWorld),s.premultiply(S),o.extractRotation(s),C.halfWidth.set(R.width*.5,0,0),C.halfHeight.set(0,R.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),v++}else if(R.isPointLight){let C=n.point[p];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),p++}else if(R.isHemisphereLight){let C=n.hemi[w];C.direction.setFromMatrixPosition(R.matrixWorld),C.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function _W(i){let e=new Lpe(i),t=[],n=[],r=[];function s(p){f.camera=p,t.length=0,n.length=0,r.length=0}function o(p){t.push(p)}function a(p){n.push(p)}function l(p){r.push(p)}function c(){e.setup(t)}function u(p){e.setupView(t,p)}let f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function Dpe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new _W(i),e.set(r,[a])):s>=o.length?(a=new _W(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Fpe=`void main() {4065+`+ve)}else j!==""?je("WebGLProgram: Program Info Log:",j):(K===""||ee==="")&&(ce=!1);ce&&(V.diagnostics={runnable:ae,programLog:j,vertexShader:{log:K,prefix:S},fragmentShader:{log:ee,prefix:T}})}r.deleteShader(L),r.deleteShader(D),N=new C_(r,w),B=upe(r,w)}let N;this.getUniforms=function(){return N===void 0&&F(this),N};let B;this.getAttributes=function(){return B===void 0&&F(this),B};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=r.getProgramParameter(w,epe)),z},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=tpe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=D,this}var Epe=0,OL=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new BL(e),t.set(e,n)),n}},BL=class{constructor(e){this.id=Epe++,this.code=e,this.usedTimes=0}};function Mpe(i){return i===Ss||i===Ju||i===eh}function Cpe(i,e,t,n,r,s){let o=new h_,a=new OL,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,p=n.precision,x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(N){return l.add(N),N===0?"uv":`uv${N}`}function w(N,B,z,V,H,Z){let J=V.fog,j=H.geometry,K=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?V.environment:null,ee=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap,ae=e.get(N.envMap||K,ee),ce=ae&&ae.mapping===Hu?ae.image.height:null,de=x[N.type];N.precision!==null&&(p=n.getMaxPrecision(N.precision),p!==N.precision&&je("WebGLProgram.getParameters:",N.precision,"not supported, using",p,"instead."));let ve=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,Ie=ve!==void 0?ve.length:0,Qe=0;j.morphAttributes.position!==void 0&&(Qe=1),j.morphAttributes.normal!==void 0&&(Qe=2),j.morphAttributes.color!==void 0&&(Qe=3);let Ue,mt,Me,ze;if(de){let jt=ga[de];Ue=jt.vertexShader,mt=jt.fragmentShader}else{Ue=N.vertexShader,mt=N.fragmentShader;let jt=a.getVertexShaderStage(N),qi=a.getFragmentShaderStage(N);a.update(N,jt,qi),Me=jt.id,ze=qi.id}let $e=i.getRenderTarget(),Et=i.state.buffers.depth.getReversed(),Tt=H.isInstancedMesh===!0,Ct=H.isBatchedMesh===!0,un=!!N.map,Gt=!!N.matcap,Xe=!!ae,st=!!N.aoMap,tt=!!N.lightMap,vt=!!N.bumpMap&&N.wireframe===!1,yt=!!N.normalMap,ln=!!N.displacementMap,Kt=!!N.emissiveMap,Qt=!!N.metalnessMap,xn=!!N.roughnessMap,ge=N.anisotropy>0,di=N.clearcoat>0,On=N.dispersion>0,le=N.iridescence>0,X=N.sheen>0,Te=N.transmission>0,Pe=ge&&!!N.anisotropyMap,Ve=di&&!!N.clearcoatMap,gt=di&&!!N.clearcoatNormalMap,St=di&&!!N.clearcoatRoughnessMap,qe=le&&!!N.iridescenceMap,Ke=le&&!!N.iridescenceThicknessMap,Rt=X&&!!N.sheenColorMap,en=X&&!!N.sheenRoughnessMap,Pt=!!N.specularMap,Mt=!!N.specularColorMap,cn=!!N.specularIntensityMap,yn=Te&&!!N.transmissionMap,Rn=Te&&!!N.thicknessMap,xe=!!N.gradientMap,bt=!!N.alphaMap,Ye=N.alphaTest>0,wt=!!N.alphaHash,Dt=!!N.extensions,ct=ks;N.toneMapped&&($e===null||$e.isXRRenderTarget===!0)&&(ct=i.toneMapping);let Ce={shaderID:de,shaderType:N.type,shaderName:N.name,vertexShader:Ue,fragmentShader:mt,defines:N.defines,customVertexShaderID:Me,customFragmentShaderID:ze,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:p,batching:Ct,batchingColor:Ct&&H._colorsTexture!==null,instancing:Tt,instancingColor:Tt&&H.instanceColor!==null,instancingMorph:Tt&&H.morphTexture!==null,outputColorSpace:$e===null?i.outputColorSpace:$e.isXRRenderTarget===!0?$e.texture.colorSpace:sn.workingColorSpace,alphaToCoverage:!!N.alphaToCoverage,map:un,matcap:Gt,envMap:Xe,envMapMode:Xe&&ae.mapping,envMapCubeUVHeight:ce,aoMap:st,lightMap:tt,bumpMap:vt,normalMap:yt,displacementMap:ln,emissiveMap:Kt,normalMapObjectSpace:yt&&N.normalMapType===jT,normalMapTangentSpace:yt&&N.normalMapType===_l,packedNormalMap:yt&&N.normalMapType===_l&&Mpe(N.normalMap.format),metalnessMap:Qt,roughnessMap:xn,anisotropy:ge,anisotropyMap:Pe,clearcoat:di,clearcoatMap:Ve,clearcoatNormalMap:gt,clearcoatRoughnessMap:St,dispersion:On,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Ke,sheen:X,sheenColorMap:Rt,sheenRoughnessMap:en,specularMap:Pt,specularColorMap:Mt,specularIntensityMap:cn,transmission:Te,transmissionMap:yn,thicknessMap:Rn,gradientMap:xe,opaque:N.transparent===!1&&N.blending===ss&&N.alphaToCoverage===!1,alphaMap:bt,alphaTest:Ye,alphaHash:wt,combine:N.combine,mapUv:un&&v(N.map.channel),aoMapUv:st&&v(N.aoMap.channel),lightMapUv:tt&&v(N.lightMap.channel),bumpMapUv:vt&&v(N.bumpMap.channel),normalMapUv:yt&&v(N.normalMap.channel),displacementMapUv:ln&&v(N.displacementMap.channel),emissiveMapUv:Kt&&v(N.emissiveMap.channel),metalnessMapUv:Qt&&v(N.metalnessMap.channel),roughnessMapUv:xn&&v(N.roughnessMap.channel),anisotropyMapUv:Pe&&v(N.anisotropyMap.channel),clearcoatMapUv:Ve&&v(N.clearcoatMap.channel),clearcoatNormalMapUv:gt&&v(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:St&&v(N.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&v(N.iridescenceMap.channel),iridescenceThicknessMapUv:Ke&&v(N.iridescenceThicknessMap.channel),sheenColorMapUv:Rt&&v(N.sheenColorMap.channel),sheenRoughnessMapUv:en&&v(N.sheenRoughnessMap.channel),specularMapUv:Pt&&v(N.specularMap.channel),specularColorMapUv:Mt&&v(N.specularColorMap.channel),specularIntensityMapUv:cn&&v(N.specularIntensityMap.channel),transmissionMapUv:yn&&v(N.transmissionMap.channel),thicknessMapUv:Rn&&v(N.thicknessMap.channel),alphaMapUv:bt&&v(N.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(yt||ge),vertexNormals:!!j.attributes.normal,vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!j.attributes.uv&&(un||bt),fog:!!J,useFog:N.fog===!0,fogExp2:!!J&&J.isFogExp2,flatShading:N.wireframe===!1&&(N.flatShading===!0||j.attributes.normal===void 0&&yt===!1&&(N.isMeshLambertMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isMeshPhysicalMaterial)),sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Et,skinning:H.isSkinnedMesh===!0,hasPositionAttribute:j.attributes.position!==void 0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:Ie,morphTextureStride:Qe,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numLightProbes:B.numLightProbes,numLightProbeGrids:Z.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:i.shadowMap.enabled&&z.length>0,shadowMapType:i.shadowMap.type,toneMapping:ct,decodeVideoTexture:un&&N.map.isVideoTexture===!0&&sn.getTransfer(N.map.colorSpace)===Bt,decodeVideoTextureEmissive:Kt&&N.emissiveMap.isVideoTexture===!0&&sn.getTransfer(N.emissiveMap.colorSpace)===Bt,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===ir,flipSided:N.side===ui,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionClipCullDistance:Dt&&N.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Dt&&N.extensions.multiDraw===!0||Ct)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:N.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(N){let B=[];if(N.shaderID?B.push(N.shaderID):(B.push(N.customVertexShaderID),B.push(N.customFragmentShaderID)),N.defines!==void 0)for(let z in N.defines)B.push(z),B.push(N.defines[z]);return N.isRawShaderMaterial===!1&&(T(B,N),P(B,N),B.push(i.outputColorSpace)),B.push(N.customProgramCacheKey),B.join()}function T(N,B){N.push(B.precision),N.push(B.outputColorSpace),N.push(B.envMapMode),N.push(B.envMapCubeUVHeight),N.push(B.mapUv),N.push(B.alphaMapUv),N.push(B.lightMapUv),N.push(B.aoMapUv),N.push(B.bumpMapUv),N.push(B.normalMapUv),N.push(B.displacementMapUv),N.push(B.emissiveMapUv),N.push(B.metalnessMapUv),N.push(B.roughnessMapUv),N.push(B.anisotropyMapUv),N.push(B.clearcoatMapUv),N.push(B.clearcoatNormalMapUv),N.push(B.clearcoatRoughnessMapUv),N.push(B.iridescenceMapUv),N.push(B.iridescenceThicknessMapUv),N.push(B.sheenColorMapUv),N.push(B.sheenRoughnessMapUv),N.push(B.specularMapUv),N.push(B.specularColorMapUv),N.push(B.specularIntensityMapUv),N.push(B.transmissionMapUv),N.push(B.thicknessMapUv),N.push(B.combine),N.push(B.fogExp2),N.push(B.sizeAttenuation),N.push(B.morphTargetsCount),N.push(B.morphAttributeCount),N.push(B.numDirLights),N.push(B.numPointLights),N.push(B.numSpotLights),N.push(B.numSpotLightMaps),N.push(B.numHemiLights),N.push(B.numRectAreaLights),N.push(B.numDirLightShadows),N.push(B.numPointLightShadows),N.push(B.numSpotLightShadows),N.push(B.numSpotLightShadowsWithMaps),N.push(B.numLightProbes),N.push(B.shadowMapType),N.push(B.toneMapping),N.push(B.numClippingPlanes),N.push(B.numClipIntersection),N.push(B.depthPacking)}function P(N,B){o.disableAll(),B.instancing&&o.enable(0),B.instancingColor&&o.enable(1),B.instancingMorph&&o.enable(2),B.matcap&&o.enable(3),B.envMap&&o.enable(4),B.normalMapObjectSpace&&o.enable(5),B.normalMapTangentSpace&&o.enable(6),B.clearcoat&&o.enable(7),B.iridescence&&o.enable(8),B.alphaTest&&o.enable(9),B.vertexColors&&o.enable(10),B.vertexAlphas&&o.enable(11),B.vertexUv1s&&o.enable(12),B.vertexUv2s&&o.enable(13),B.vertexUv3s&&o.enable(14),B.vertexTangents&&o.enable(15),B.anisotropy&&o.enable(16),B.alphaHash&&o.enable(17),B.batching&&o.enable(18),B.dispersion&&o.enable(19),B.batchingColor&&o.enable(20),B.gradientMap&&o.enable(21),B.packedNormalMap&&o.enable(22),B.vertexNormals&&o.enable(23),N.push(o.mask),o.disableAll(),B.fog&&o.enable(0),B.useFog&&o.enable(1),B.flatShading&&o.enable(2),B.logarithmicDepthBuffer&&o.enable(3),B.reversedDepthBuffer&&o.enable(4),B.skinning&&o.enable(5),B.morphTargets&&o.enable(6),B.morphNormals&&o.enable(7),B.morphColors&&o.enable(8),B.premultipliedAlpha&&o.enable(9),B.shadowMapEnabled&&o.enable(10),B.doubleSided&&o.enable(11),B.flipSided&&o.enable(12),B.useDepthPacking&&o.enable(13),B.dithering&&o.enable(14),B.transmission&&o.enable(15),B.sheen&&o.enable(16),B.opaque&&o.enable(17),B.pointsUvs&&o.enable(18),B.decodeVideoTexture&&o.enable(19),B.decodeVideoTextureEmissive&&o.enable(20),B.alphaToCoverage&&o.enable(21),B.numLightProbeGrids>0&&o.enable(22),B.hasPositionAttribute&&o.enable(23),N.push(o.mask)}function R(N){let B=x[N.type],z;if(B){let V=ga[B];z=VA.clone(V.uniforms)}else z=N.uniforms;return z}function C(N,B){let z=u.get(B);return z!==void 0?++z.usedTimes:(z=new Tpe(i,B,N,r),c.push(z),u.set(B,z)),z}function L(N){if(--N.usedTimes===0){let B=c.indexOf(N);c[B]=c[c.length-1],c.pop(),u.delete(N.cacheKey),N.destroy()}}function D(N){a.remove(N)}function F(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:R,acquireProgram:C,releaseProgram:L,releaseShaderCache:D,programs:c,dispose:F}}function Rpe(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Ppe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function _W(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function xW(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(p){let x=0;return p.isInstancedMesh&&(x+=2),p.isSkinnedMesh&&(x+=1),x}function a(p,x,v,w,S,T){let P=i[e];return P===void 0?(P={id:p.id,object:p,geometry:x,material:v,materialVariant:o(p),groupOrder:w,renderOrder:p.renderOrder,z:S,group:T},i[e]=P):(P.id=p.id,P.object=p,P.geometry=x,P.material=v,P.materialVariant=o(p),P.groupOrder=w,P.renderOrder=p.renderOrder,P.z=S,P.group=T),e++,P}function l(p,x,v,w,S,T){let P=a(p,x,v,w,S,T);v.transmission>0?n.push(P):v.transparent===!0?r.push(P):t.push(P)}function c(p,x,v,w,S,T){let P=a(p,x,v,w,S,T);v.transmission>0?n.unshift(P):v.transparent===!0?r.unshift(P):t.unshift(P)}function u(p,x,v){t.length>1&&t.sort(p||Ppe),n.length>1&&n.sort(x||_W),r.length>1&&r.sort(x||_W),v&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let p=e,x=i.length;p<x;p++){let v=i[p];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function Ipe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new xW,i.set(n,[o])):r>=s.length?(o=new xW,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Npe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new ie,color:new Ut};break;case"SpotLight":t={position:new ie,direction:new ie,color:new Ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ie,color:new Ut,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ie,skyColor:new Ut,groundColor:new Ut};break;case"RectAreaLight":t={color:new Ut,position:new ie,halfWidth:new ie,halfHeight:new ie};break}return i[e.id]=t,t}}}function Lpe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var Dpe=0;function Fpe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Ope(i){let e=new Npe,t=Lpe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new ie);let r=new ie,s=new on,o=new on;function a(c){let u=0,f=0,p=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let x=0,v=0,w=0,S=0,T=0,P=0,R=0,C=0,L=0,D=0,F=0;c.sort(Fpe);for(let B=0,z=c.length;B<z;B++){let V=c[B],H=V.color,Z=V.intensity,J=V.distance,j=null;if(V.shadow&&V.shadow.map&&(V.shadow.map.texture.format===Ss?j=V.shadow.map.texture:j=V.shadow.map.depthTexture||V.shadow.map.texture),V.isAmbientLight)u+=H.r*Z,f+=H.g*Z,p+=H.b*Z;else if(V.isLightProbe){for(let K=0;K<9;K++)n.probe[K].addScaledVector(V.sh.coefficients[K],Z);F++}else if(V.isDirectionalLight){let K=e.get(V);if(K.color.copy(V.color).multiplyScalar(V.intensity),V.castShadow){let ee=V.shadow,ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,n.directionalShadow[x]=ae,n.directionalShadowMap[x]=j,n.directionalShadowMatrix[x]=V.shadow.matrix,P++}n.directional[x]=K,x++}else if(V.isSpotLight){let K=e.get(V);K.position.setFromMatrixPosition(V.matrixWorld),K.color.copy(H).multiplyScalar(Z),K.distance=J,K.coneCos=Math.cos(V.angle),K.penumbraCos=Math.cos(V.angle*(1-V.penumbra)),K.decay=V.decay,n.spot[w]=K;let ee=V.shadow;if(V.map&&(n.spotLightMap[L]=V.map,L++,ee.updateMatrices(V),V.castShadow&&D++),n.spotLightMatrix[w]=ee.matrix,V.castShadow){let ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,n.spotShadow[w]=ae,n.spotShadowMap[w]=j,C++}w++}else if(V.isRectAreaLight){let K=e.get(V);K.color.copy(H).multiplyScalar(Z),K.halfWidth.set(V.width*.5,0,0),K.halfHeight.set(0,V.height*.5,0),n.rectArea[S]=K,S++}else if(V.isPointLight){let K=e.get(V);if(K.color.copy(V.color).multiplyScalar(V.intensity),K.distance=V.distance,K.decay=V.decay,V.castShadow){let ee=V.shadow,ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,ae.shadowCameraNear=ee.camera.near,ae.shadowCameraFar=ee.camera.far,n.pointShadow[v]=ae,n.pointShadowMap[v]=j,n.pointShadowMatrix[v]=V.shadow.matrix,R++}n.point[v]=K,v++}else if(V.isHemisphereLight){let K=e.get(V);K.skyColor.copy(V.color).multiplyScalar(Z),K.groundColor.copy(V.groundColor).multiplyScalar(Z),n.hemi[T]=K,T++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Nt.LTC_FLOAT_1,n.rectAreaLTC2=Nt.LTC_FLOAT_2):(n.rectAreaLTC1=Nt.LTC_HALF_1,n.rectAreaLTC2=Nt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=p;let N=n.hash;(N.directionalLength!==x||N.pointLength!==v||N.spotLength!==w||N.rectAreaLength!==S||N.hemiLength!==T||N.numDirectionalShadows!==P||N.numPointShadows!==R||N.numSpotShadows!==C||N.numSpotMaps!==L||N.numLightProbes!==F)&&(n.directional.length=x,n.spot.length=w,n.rectArea.length=S,n.point.length=v,n.hemi.length=T,n.directionalShadow.length=P,n.directionalShadowMap.length=P,n.pointShadow.length=R,n.pointShadowMap.length=R,n.spotShadow.length=C,n.spotShadowMap.length=C,n.directionalShadowMatrix.length=P,n.pointShadowMatrix.length=R,n.spotLightMatrix.length=C+L-D,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=F,N.directionalLength=x,N.pointLength=v,N.spotLength=w,N.rectAreaLength=S,N.hemiLength=T,N.numDirectionalShadows=P,N.numPointShadows=R,N.numSpotShadows=C,N.numSpotMaps=L,N.numLightProbes=F,n.version=Dpe++)}function l(c,u){let f=0,p=0,x=0,v=0,w=0,S=u.matrixWorldInverse;for(let T=0,P=c.length;T<P;T++){let R=c[T];if(R.isDirectionalLight){let C=n.directional[f];C.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),f++}else if(R.isSpotLight){let C=n.spot[x];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),C.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),x++}else if(R.isRectAreaLight){let C=n.rectArea[v];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),o.identity(),s.copy(R.matrixWorld),s.premultiply(S),o.extractRotation(s),C.halfWidth.set(R.width*.5,0,0),C.halfHeight.set(0,R.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),v++}else if(R.isPointLight){let C=n.point[p];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),p++}else if(R.isHemisphereLight){let C=n.hemi[w];C.direction.setFromMatrixPosition(R.matrixWorld),C.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function yW(i){let e=new Ope(i),t=[],n=[],r=[];function s(p){f.camera=p,t.length=0,n.length=0,r.length=0}function o(p){t.push(p)}function a(p){n.push(p)}function l(p){r.push(p)}function c(){e.setup(t)}function u(p){e.setupView(t,p)}let f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function Bpe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new yW(i),e.set(r,[a])):s>=o.length?(a=new yW(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Upe=`void main() {40664066 gl_Position = vec4( position, 1.0 );4067-}`,Ope=`uniform sampler2D shadow_pass;4067+}`,kpe=`uniform sampler2D shadow_pass;40684068 uniform vec2 resolution;40694069 uniform float radius;40704070 void main() {
@@ -4089,12 +4089,12 @@ void main() {
40894089 squared_mean = squared_mean / samples;40904090 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );40914091 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );4092-}`,Bpe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1)],Upe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1),new ie(0,-1,0),new ie(0,-1,0)],xW=new on,T2=new ie,RL=new ie;function kpe(i,e,t){let n=new Kl,r=new Oe,s=new Oe,o=new gn,a=new wT,l=new ST,c={},u=t.maxTextureSize,f={[Ao]:ui,[ui]:Ao,[ir]:ir},p=new jr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Fpe,fragmentShader:Ope}),x=p.clone();x.defines.HORIZONTAL_PASS=1;let v=new Zn;v.setAttribute("position",new Ni(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(v,p),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Jd;let T=this.type;this.render=function(D,F,N){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===GT&&(je("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Jd);let B=i.getRenderTarget(),z=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),H=i.state;H.setBlending(Xr),H.buffers.depth.getReversed()===!0?H.buffers.color.setClear(0,0,0,0):H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);let K=T!==this.type;K&&F.traverse(function(J){J.material&&(Array.isArray(J.material)?J.material.forEach(j=>j.needsUpdate=!0):J.material.needsUpdate=!0)});for(let J=0,j=D.length;J<j;J++){let Z=D[J],ee=Z.shadow;if(ee===void 0){je("WebGLShadowMap:",Z,"has no shadow.");continue}if(ee.autoUpdate===!1&&ee.needsUpdate===!1)continue;r.copy(ee.mapSize);let ae=ee.getFrameExtents();r.multiply(ae),s.copy(ee.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ae.x),r.x=s.x*ae.x,ee.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ae.y),r.y=s.y*ae.y,ee.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(ee.camera._reversedDepth=ce,ee.map===null||K===!0){if(ee.map!==null&&(ee.map.depthTexture!==null&&(ee.map.depthTexture.dispose(),ee.map.depthTexture=null),ee.map.dispose()),this.type===Zl){if(Z.isPointLight){je("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ee.map=new ca(r.x,r.y,{format:ws,type:Li,minFilter:vi,magFilter:vi,generateMipmaps:!1}),ee.map.texture.name=Z.name+".shadowMap",ee.map.depthTexture=new ss(r.x,r.y,Yi),ee.map.depthTexture.name=Z.name+".shadowMapDepth",ee.map.depthTexture.format=xs,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=xi,ee.map.depthTexture.magFilter=xi}else Z.isPointLight?(ee.map=new QT(r.x),ee.map.depthTexture=new p_(r.x,pi)):(ee.map=new ca(r.x,r.y),ee.map.depthTexture=new ss(r.x,r.y,pi)),ee.map.depthTexture.name=Z.name+".shadowMap",ee.map.depthTexture.format=xs,this.type===Jd?(ee.map.depthTexture.compareFunction=ce?Hc:th,ee.map.depthTexture.minFilter=vi,ee.map.depthTexture.magFilter=vi):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=xi,ee.map.depthTexture.magFilter=xi);ee.camera.updateProjectionMatrix()}let de=ee.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<de;ve++){if(ee.map.isWebGLCubeRenderTarget)i.setRenderTarget(ee.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(ee.map),i.clear());let Ie=ee.getViewport(ve);o.set(s.x*Ie.x,s.y*Ie.y,s.x*Ie.z,s.y*Ie.w),H.viewport(o)}if(Z.isPointLight){let Ie=ee.camera,Qe=ee.matrix,Ue=Z.distance||Ie.far;Ue!==Ie.far&&(Ie.far=Ue,Ie.updateProjectionMatrix()),T2.setFromMatrixPosition(Z.matrixWorld),Ie.position.copy(T2),RL.copy(Ie.position),RL.add(Bpe[ve]),Ie.up.copy(Upe[ve]),Ie.lookAt(RL),Ie.updateMatrixWorld(),Qe.makeTranslation(-T2.x,-T2.y,-T2.z),xW.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),ee._frustum.setFromProjectionMatrix(xW,Ie.coordinateSystem,Ie.reversedDepth)}else ee.updateMatrices(Z);n=ee.getFrustum(),C(F,N,ee.camera,Z,this.type)}ee.isPointLightShadow!==!0&&this.type===Zl&&P(ee,N),ee.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,z,V)};function P(D,F){let N=e.update(w);p.defines.VSM_SAMPLES!==D.blurSamples&&(p.defines.VSM_SAMPLES=D.blurSamples,x.defines.VSM_SAMPLES=D.blurSamples,p.needsUpdate=!0,x.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new ca(r.x,r.y,{format:ws,type:Li})),p.uniforms.shadow_pass.value=D.map.depthTexture,p.uniforms.resolution.value=D.mapSize,p.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(F,null,N,p,w,null),x.uniforms.shadow_pass.value=D.mapPass.texture,x.uniforms.resolution.value=D.mapSize,x.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(F,null,N,x,w,null)}function R(D,F,N,B){let z=null,V=N.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(V!==void 0)z=V;else if(z=N.isPointLight===!0?l:a,i.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0||F.alphaToCoverage===!0){let H=z.uuid,K=F.uuid,J=c[H];J===void 0&&(J={},c[H]=J);let j=J[K];j===void 0&&(j=z.clone(),J[K]=j,F.addEventListener("dispose",L)),z=j}if(z.visible=F.visible,z.wireframe=F.wireframe,B===Zl?z.side=F.shadowSide!==null?F.shadowSide:F.side:z.side=F.shadowSide!==null?F.shadowSide:f[F.side],z.alphaMap=F.alphaMap,z.alphaTest=F.alphaToCoverage===!0?.5:F.alphaTest,z.map=F.map,z.clipShadows=F.clipShadows,z.clippingPlanes=F.clippingPlanes,z.clipIntersection=F.clipIntersection,z.displacementMap=F.displacementMap,z.displacementScale=F.displacementScale,z.displacementBias=F.displacementBias,z.wireframeLinewidth=F.wireframeLinewidth,z.linewidth=F.linewidth,N.isPointLight===!0&&z.isMeshDistanceMaterial===!0){let H=i.properties.get(z);H.light=N}return z}function C(D,F,N,B,z){if(D.visible===!1)return;if(D.layers.test(F.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&z===Zl)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,D.matrixWorld);let K=e.update(D),J=D.material;if(Array.isArray(J)){let j=K.groups;for(let Z=0,ee=j.length;Z<ee;Z++){let ae=j[Z],ce=J[ae.materialIndex];if(ce&&ce.visible){let de=R(D,ce,B,z);D.onBeforeShadow(i,D,F,N,K,de,ae),i.renderBufferDirect(N,null,K,de,D,ae),D.onAfterShadow(i,D,F,N,K,de,ae)}}}else if(J.visible){let j=R(D,J,B,z);D.onBeforeShadow(i,D,F,N,K,j,null),i.renderBufferDirect(N,null,K,j,D,null),D.onAfterShadow(i,D,F,N,K,j,null)}}let H=D.children;for(let K=0,J=H.length;K<J;K++)C(H[K],F,N,B,z)}function L(D){D.target.removeEventListener("dispose",L);for(let N in c){let B=c[N],z=D.target.uuid;z in B&&(B[z].dispose(),delete B[z])}}}function Gpe(i,e){function t(){let xe=!1,bt=new gn,Ye=null,wt=new gn(0,0,0,0);return{setMask:function(Dt){Ye!==Dt&&!xe&&(i.colorMask(Dt,Dt,Dt,Dt),Ye=Dt)},setLocked:function(Dt){xe=Dt},setClear:function(Dt,ct,Ce,jt,qi){qi===!0&&(Dt*=jt,ct*=jt,Ce*=jt),bt.set(Dt,ct,Ce,jt),wt.equals(bt)===!1&&(i.clearColor(Dt,ct,Ce,jt),wt.copy(bt))},reset:function(){xe=!1,Ye=null,wt.set(-1,0,0,0)}}}function n(){let xe=!1,bt=!1,Ye=null,wt=null,Dt=null;return{setReversed:function(ct){if(bt!==ct){let Ce=e.get("EXT_clip_control");ct?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),bt=ct;let jt=Dt;Dt=null,this.setClear(jt)}},getReversed:function(){return bt},setTest:function(ct){ct?$e(i.DEPTH_TEST):Et(i.DEPTH_TEST)},setMask:function(ct){Ye!==ct&&!xe&&(i.depthMask(ct),Ye=ct)},setFunc:function(ct){if(bt&&(ct=b2[ct]),wt!==ct){switch(ct){case aA:i.depthFunc(i.NEVER);break;case lA:i.depthFunc(i.ALWAYS);break;case cA:i.depthFunc(i.LESS);break;case Bu:i.depthFunc(i.LEQUAL);break;case uA:i.depthFunc(i.EQUAL);break;case hA:i.depthFunc(i.GEQUAL);break;case fA:i.depthFunc(i.GREATER);break;case dA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}wt=ct}},setLocked:function(ct){xe=ct},setClear:function(ct){Dt!==ct&&(Dt=ct,bt&&(ct=1-ct),i.clearDepth(ct))},reset:function(){xe=!1,Ye=null,wt=null,Dt=null,bt=!1}}}function r(){let xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,qi=null;return{setTest:function(In){xe||(In?$e(i.STENCIL_TEST):Et(i.STENCIL_TEST))},setMask:function(In){bt!==In&&!xe&&(i.stencilMask(In),bt=In)},setFunc:function(In,Ur,mr){(Ye!==In||wt!==Ur||Dt!==mr)&&(i.stencilFunc(In,Ur,mr),Ye=In,wt=Ur,Dt=mr)},setOp:function(In,Ur,mr){(ct!==In||Ce!==Ur||jt!==mr)&&(i.stencilOp(In,Ur,mr),ct=In,Ce=Ur,jt=mr)},setLocked:function(In){xe=In},setClear:function(In){qi!==In&&(i.clearStencil(In),qi=In)},reset:function(){xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,qi=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,P=null,R=null,C=null,L=null,D=null,F=null,N=new Ut(0,0,0),B=0,z=!1,V=null,H=null,K=null,J=null,j=null,Z=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ee=!1,ae=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(ce)[1]),ee=ae>=1):ce.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),ee=ae>=2);let de=null,ve={},Ie=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Ue=new gn().fromArray(Ie),mt=new gn().fromArray(Qe);function Me(xe,bt,Ye,wt){let Dt=new Uint8Array(4),ct=i.createTexture();i.bindTexture(xe,ct),i.texParameteri(xe,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(xe,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ye;Ce++)xe===i.TEXTURE_3D||xe===i.TEXTURE_2D_ARRAY?i.texImage3D(bt,0,i.RGBA,1,1,wt,0,i.RGBA,i.UNSIGNED_BYTE,Dt):i.texImage2D(bt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Dt);return ct}let ze={};ze[i.TEXTURE_2D]=Me(i.TEXTURE_2D,i.TEXTURE_2D,1),ze[i.TEXTURE_CUBE_MAP]=Me(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ze[i.TEXTURE_2D_ARRAY]=Me(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ze[i.TEXTURE_3D]=Me(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),$e(i.DEPTH_TEST),o.setFunc(Bu),vt(!1),yt(Ky),$e(i.CULL_FACE),st(Xr);function $e(xe){u[xe]!==!0&&(i.enable(xe),u[xe]=!0)}function Et(xe){u[xe]!==!1&&(i.disable(xe),u[xe]=!1)}function Tt(xe,bt){return p[xe]!==bt?(i.bindFramebuffer(xe,bt),p[xe]=bt,xe===i.DRAW_FRAMEBUFFER&&(p[i.FRAMEBUFFER]=bt),xe===i.FRAMEBUFFER&&(p[i.DRAW_FRAMEBUFFER]=bt),!0):!1}function Ct(xe,bt){let Ye=v,wt=!1;if(xe){Ye=x.get(bt),Ye===void 0&&(Ye=[],x.set(bt,Ye));let Dt=xe.textures;if(Ye.length!==Dt.length||Ye[0]!==i.COLOR_ATTACHMENT0){for(let ct=0,Ce=Dt.length;ct<Ce;ct++)Ye[ct]=i.COLOR_ATTACHMENT0+ct;Ye.length=Dt.length,wt=!0}}else Ye[0]!==i.BACK&&(Ye[0]=i.BACK,wt=!0);wt&&i.drawBuffers(Ye)}function un(xe){return w!==xe?(i.useProgram(xe),w=xe,!0):!1}let Gt={[Bs]:i.FUNC_ADD,[Qy]:i.FUNC_SUBTRACT,[Jy]:i.FUNC_REVERSE_SUBTRACT};Gt[zT]=i.MIN,Gt[VT]=i.MAX;let Xe={[qc]:i.ZERO,[e2]:i.ONE,[t2]:i.SRC_COLOR,[Ud]:i.SRC_ALPHA,[a2]:i.SRC_ALPHA_SATURATE,[s2]:i.DST_COLOR,[i2]:i.DST_ALPHA,[n2]:i.ONE_MINUS_SRC_COLOR,[kd]:i.ONE_MINUS_SRC_ALPHA,[o2]:i.ONE_MINUS_DST_COLOR,[r2]:i.ONE_MINUS_DST_ALPHA,[UH]:i.CONSTANT_COLOR,[kH]:i.ONE_MINUS_CONSTANT_COLOR,[GH]:i.CONSTANT_ALPHA,[zH]:i.ONE_MINUS_CONSTANT_ALPHA};function st(xe,bt,Ye,wt,Dt,ct,Ce,jt,qi,In){if(xe===Xr){S===!0&&(Et(i.BLEND),S=!1);return}if(S===!1&&($e(i.BLEND),S=!0),xe!==If){if(xe!==T||In!==z){if((P!==Bs||L!==Bs)&&(i.blendEquation(i.FUNC_ADD),P=Bs,L=Bs),In)switch(xe){case rs:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case zu:i.blendFunc(i.ONE,i.ONE);break;case Vu:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case qu:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ge("WebGLState: Invalid blending: ",xe);break}else switch(xe){case rs:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case zu:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Vu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case qu:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",xe);break}R=null,C=null,D=null,F=null,N.set(0,0,0),B=0,T=xe,z=In}return}Dt=Dt||bt,ct=ct||Ye,Ce=Ce||wt,(bt!==P||Dt!==L)&&(i.blendEquationSeparate(Gt[bt],Gt[Dt]),P=bt,L=Dt),(Ye!==R||wt!==C||ct!==D||Ce!==F)&&(i.blendFuncSeparate(Xe[Ye],Xe[wt],Xe[ct],Xe[Ce]),R=Ye,C=wt,D=ct,F=Ce),(jt.equals(N)===!1||qi!==B)&&(i.blendColor(jt.r,jt.g,jt.b,qi),N.copy(jt),B=qi),T=xe,z=!1}function tt(xe,bt){xe.side===ir?Et(i.CULL_FACE):$e(i.CULL_FACE);let Ye=xe.side===ui;bt&&(Ye=!Ye),vt(Ye),xe.blending===rs&&xe.transparent===!1?st(Xr):st(xe.blending,xe.blendEquation,xe.blendSrc,xe.blendDst,xe.blendEquationAlpha,xe.blendSrcAlpha,xe.blendDstAlpha,xe.blendColor,xe.blendAlpha,xe.premultipliedAlpha),o.setFunc(xe.depthFunc),o.setTest(xe.depthTest),o.setMask(xe.depthWrite),s.setMask(xe.colorWrite);let wt=xe.stencilWrite;a.setTest(wt),wt&&(a.setMask(xe.stencilWriteMask),a.setFunc(xe.stencilFunc,xe.stencilRef,xe.stencilFuncMask),a.setOp(xe.stencilFail,xe.stencilZFail,xe.stencilZPass)),Zt(xe.polygonOffset,xe.polygonOffsetFactor,xe.polygonOffsetUnits),xe.alphaToCoverage===!0?$e(i.SAMPLE_ALPHA_TO_COVERAGE):Et(i.SAMPLE_ALPHA_TO_COVERAGE)}function vt(xe){V!==xe&&(xe?i.frontFace(i.CW):i.frontFace(i.CCW),V=xe)}function yt(xe){xe!==UT?($e(i.CULL_FACE),xe!==H&&(xe===Ky?i.cullFace(i.BACK):xe===kT?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Et(i.CULL_FACE),H=xe}function ln(xe){xe!==K&&(ee&&i.lineWidth(xe),K=xe)}function Zt(xe,bt,Ye){xe?($e(i.POLYGON_OFFSET_FILL),(J!==bt||j!==Ye)&&(J=bt,j=Ye,o.getReversed()&&(bt=-bt),i.polygonOffset(bt,Ye))):Et(i.POLYGON_OFFSET_FILL)}function Qt(xe){xe?$e(i.SCISSOR_TEST):Et(i.SCISSOR_TEST)}function xn(xe){xe===void 0&&(xe=i.TEXTURE0+Z-1),de!==xe&&(i.activeTexture(xe),de=xe)}function ge(xe,bt,Ye){Ye===void 0&&(de===null?Ye=i.TEXTURE0+Z-1:Ye=de);let wt=ve[Ye];wt===void 0&&(wt={type:void 0,texture:void 0},ve[Ye]=wt),(wt.type!==xe||wt.texture!==bt)&&(de!==Ye&&(i.activeTexture(Ye),de=Ye),i.bindTexture(xe,bt||ze[xe]),wt.type=xe,wt.texture=bt)}function di(){let xe=ve[de];xe!==void 0&&xe.type!==void 0&&(i.bindTexture(xe.type,null),xe.type=void 0,xe.texture=void 0)}function On(){try{i.compressedTexImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function X(){try{i.texSubImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Te(){try{i.texSubImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Pe(){try{i.compressedTexSubImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Ve(){try{i.compressedTexSubImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function gt(){try{i.texStorage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function St(){try{i.texStorage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function qe(){try{i.texImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Ze(){try{i.texImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Rt(xe){return f[xe]!==void 0?f[xe]:i.getParameter(xe)}function en(xe,bt){f[xe]!==bt&&(i.pixelStorei(xe,bt),f[xe]=bt)}function Pt(xe){Ue.equals(xe)===!1&&(i.scissor(xe.x,xe.y,xe.z,xe.w),Ue.copy(xe))}function Mt(xe){mt.equals(xe)===!1&&(i.viewport(xe.x,xe.y,xe.z,xe.w),mt.copy(xe))}function cn(xe,bt){let Ye=c.get(bt);Ye===void 0&&(Ye=new WeakMap,c.set(bt,Ye));let wt=Ye.get(xe);wt===void 0&&(wt=i.getUniformBlockIndex(bt,xe.name),Ye.set(xe,wt))}function yn(xe,bt){let wt=c.get(bt).get(xe);l.get(bt)!==wt&&(i.uniformBlockBinding(bt,wt,xe.__bindingPointIndex),l.set(bt,wt))}function Rn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},de=null,ve={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,P=null,R=null,C=null,L=null,D=null,F=null,N=new Ut(0,0,0),B=0,z=!1,V=null,H=null,K=null,J=null,j=null,Ue.set(0,0,i.canvas.width,i.canvas.height),mt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:$e,disable:Et,bindFramebuffer:Tt,drawBuffers:Ct,useProgram:un,setBlending:st,setMaterial:tt,setFlipSided:vt,setCullFace:yt,setLineWidth:ln,setPolygonOffset:Zt,setScissorTest:Qt,activeTexture:xn,bindTexture:ge,unbindTexture:di,compressedTexImage2D:On,compressedTexImage3D:le,texImage2D:qe,texImage3D:Ze,pixelStorei:en,getParameter:Rt,updateUBOMapping:cn,uniformBlockBinding:yn,texStorage2D:gt,texStorage3D:St,texSubImage2D:X,texSubImage3D:Te,compressedTexSubImage2D:Pe,compressedTexSubImage3D:Ve,scissor:Pt,viewport:Mt,reset:Rn}}function zpe(i,e,t,n,r,s,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Oe,u=new WeakMap,f=new Set,p,x=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,X){return v?new OffscreenCanvas(le,X):l_("canvas")}function S(le,X,Te){let Pe=1,Ve=On(le);if((Ve.width>Te||Ve.height>Te)&&(Pe=Te/Math.max(Ve.width,Ve.height)),Pe<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){let gt=Math.floor(Pe*Ve.width),St=Math.floor(Pe*Ve.height);p===void 0&&(p=w(gt,St));let qe=X?w(gt,St):p;return qe.width=gt,qe.height=St,qe.getContext("2d").drawImage(le,0,0,gt,St),je("WebGLRenderer: Texture has been resized from ("+Ve.width+"x"+Ve.height+") to ("+gt+"x"+St+")."),qe}else return"data"in le&&je("WebGLRenderer: Image in DataTexture is too big ("+Ve.width+"x"+Ve.height+")."),le;return le}function T(le){return le.generateMipmaps}function P(le){i.generateMipmap(le)}function R(le){return le.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?i.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function C(le,X,Te,Pe,Ve,gt=!1){if(le!==null){if(i[le]!==void 0)return i[le];je("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let St;Pe&&(St=e.get("EXT_texture_norm16"),St||je("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=X;if(X===i.RED&&(Te===i.FLOAT&&(qe=i.R32F),Te===i.HALF_FLOAT&&(qe=i.R16F),Te===i.UNSIGNED_BYTE&&(qe=i.R8),Te===i.UNSIGNED_SHORT&&St&&(qe=St.R16_EXT),Te===i.SHORT&&St&&(qe=St.R16_SNORM_EXT)),X===i.RED_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.R8UI),Te===i.UNSIGNED_SHORT&&(qe=i.R16UI),Te===i.UNSIGNED_INT&&(qe=i.R32UI),Te===i.BYTE&&(qe=i.R8I),Te===i.SHORT&&(qe=i.R16I),Te===i.INT&&(qe=i.R32I)),X===i.RG&&(Te===i.FLOAT&&(qe=i.RG32F),Te===i.HALF_FLOAT&&(qe=i.RG16F),Te===i.UNSIGNED_BYTE&&(qe=i.RG8),Te===i.UNSIGNED_SHORT&&St&&(qe=St.RG16_EXT),Te===i.SHORT&&St&&(qe=St.RG16_SNORM_EXT)),X===i.RG_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RG8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RG16UI),Te===i.UNSIGNED_INT&&(qe=i.RG32UI),Te===i.BYTE&&(qe=i.RG8I),Te===i.SHORT&&(qe=i.RG16I),Te===i.INT&&(qe=i.RG32I)),X===i.RGB_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGB8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGB16UI),Te===i.UNSIGNED_INT&&(qe=i.RGB32UI),Te===i.BYTE&&(qe=i.RGB8I),Te===i.SHORT&&(qe=i.RGB16I),Te===i.INT&&(qe=i.RGB32I)),X===i.RGBA_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGBA8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGBA16UI),Te===i.UNSIGNED_INT&&(qe=i.RGBA32UI),Te===i.BYTE&&(qe=i.RGBA8I),Te===i.SHORT&&(qe=i.RGBA16I),Te===i.INT&&(qe=i.RGBA32I)),X===i.RGB&&(Te===i.UNSIGNED_SHORT&&St&&(qe=St.RGB16_EXT),Te===i.SHORT&&St&&(qe=St.RGB16_SNORM_EXT),Te===i.UNSIGNED_INT_5_9_9_9_REV&&(qe=i.RGB9_E5),Te===i.UNSIGNED_INT_10F_11F_11F_REV&&(qe=i.R11F_G11F_B10F)),X===i.RGBA){let Ze=gt?zd:sn.getTransfer(Ve);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Ze===Bt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&St&&(qe=St.RGBA16_EXT),Te===i.SHORT&&St&&(qe=St.RGBA16_SNORM_EXT),Te===i.UNSIGNED_SHORT_4_4_4_4&&(qe=i.RGBA4),Te===i.UNSIGNED_SHORT_5_5_5_1&&(qe=i.RGB5_A1)}return(qe===i.R16F||qe===i.R32F||qe===i.RG16F||qe===i.RG32F||qe===i.RGBA16F||qe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),qe}function L(le,X){let Te;return le?X===null||X===pi||X===Go?Te=i.DEPTH24_STENCIL8:X===Yi?Te=i.DEPTH32F_STENCIL8:X===Ha&&(Te=i.DEPTH24_STENCIL8,je("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):X===null||X===pi||X===Go?Te=i.DEPTH_COMPONENT24:X===Yi?Te=i.DEPTH_COMPONENT32F:X===Ha&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,X){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==xi&&le.minFilter!==vi?Math.log2(Math.max(X.width,X.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?X.mipmaps.length:1}function F(le){let X=le.target;X.removeEventListener("dispose",F),B(X),X.isVideoTexture&&u.delete(X),X.isHTMLTexture&&f.delete(X)}function N(le){let X=le.target;X.removeEventListener("dispose",N),V(X)}function B(le){let X=n.get(le);if(X.__webglInit===void 0)return;let Te=le.source,Pe=x.get(Te);if(Pe){let Ve=Pe[X.__cacheKey];Ve.usedTimes--,Ve.usedTimes===0&&z(le),Object.keys(Pe).length===0&&x.delete(Te)}n.remove(le)}function z(le){let X=n.get(le);i.deleteTexture(X.__webglTexture);let Te=le.source,Pe=x.get(Te);delete Pe[X.__cacheKey],o.memory.textures--}function V(le){let X=n.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),n.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let Pe=0;Pe<6;Pe++){if(Array.isArray(X.__webglFramebuffer[Pe]))for(let Ve=0;Ve<X.__webglFramebuffer[Pe].length;Ve++)i.deleteFramebuffer(X.__webglFramebuffer[Pe][Ve]);else i.deleteFramebuffer(X.__webglFramebuffer[Pe]);X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer[Pe])}else{if(Array.isArray(X.__webglFramebuffer))for(let Pe=0;Pe<X.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(X.__webglFramebuffer[Pe]);else i.deleteFramebuffer(X.__webglFramebuffer);if(X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer),X.__webglMultisampledFramebuffer&&i.deleteFramebuffer(X.__webglMultisampledFramebuffer),X.__webglColorRenderbuffer)for(let Pe=0;Pe<X.__webglColorRenderbuffer.length;Pe++)X.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(X.__webglColorRenderbuffer[Pe]);X.__webglDepthRenderbuffer&&i.deleteRenderbuffer(X.__webglDepthRenderbuffer)}let Te=le.textures;for(let Pe=0,Ve=Te.length;Pe<Ve;Pe++){let gt=n.get(Te[Pe]);gt.__webglTexture&&(i.deleteTexture(gt.__webglTexture),o.memory.textures--),n.remove(Te[Pe])}n.remove(le)}let H=0;function K(){H=0}function J(){return H}function j(le){H=le}function Z(){let le=H;return le>=r.maxTextures&&je("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),H+=1,le}function ee(le){let X=[];return X.push(le.wrapS),X.push(le.wrapT),X.push(le.wrapR||0),X.push(le.magFilter),X.push(le.minFilter),X.push(le.anisotropy),X.push(le.internalFormat),X.push(le.format),X.push(le.type),X.push(le.generateMipmaps),X.push(le.premultiplyAlpha),X.push(le.flipY),X.push(le.unpackAlignment),X.push(le.colorSpace),X.join()}function ae(le,X){let Te=n.get(le);if(le.isVideoTexture&&ge(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Pe=le.image;if(Pe===null)je("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)je("WebGLRenderer: Texture marked for update but image is incomplete");else{Et(Te,le,X);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+X)}function ce(le,X){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Et(Te,le,X);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+X)}function de(le,X){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Et(Te,le,X);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+X)}function ve(le,X){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Tt(Te,le,X);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+X)}let Ie={[Sf]:i.REPEAT,[Uo]:i.CLAMP_TO_EDGE,[Tf]:i.MIRRORED_REPEAT},Qe={[xi]:i.NEAREST,[A2]:i.NEAREST_MIPMAP_NEAREST,[Jl]:i.NEAREST_MIPMAP_LINEAR,[vi]:i.LINEAR,[np]:i.LINEAR_MIPMAP_NEAREST,[go]:i.LINEAR_MIPMAP_LINEAR},Ue={[_2]:i.NEVER,[v2]:i.ALWAYS,[T_]:i.LESS,[th]:i.LEQUAL,[x2]:i.EQUAL,[Hc]:i.GEQUAL,[UA]:i.GREATER,[y2]:i.NOTEQUAL};function mt(le,X){if(X.type===Yi&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===vi||X.magFilter===np||X.magFilter===Jl||X.magFilter===go||X.minFilter===vi||X.minFilter===np||X.minFilter===Jl||X.minFilter===go)&&je("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(le,i.TEXTURE_WRAP_S,Ie[X.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Ie[X.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Ie[X.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[X.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[X.minFilter]),X.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Ue[X.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(X.magFilter===xi||X.minFilter!==Jl&&X.minFilter!==go||X.type===Yi&&e.has("OES_texture_float_linear")===!1)return;if(X.anisotropy>1||n.get(X).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(X.anisotropy,r.getMaxAnisotropy())),n.get(X).__currentAnisotropy=X.anisotropy}}}function Me(le,X){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,X.addEventListener("dispose",F));let Pe=X.source,Ve=x.get(Pe);Ve===void 0&&(Ve={},x.set(Pe,Ve));let gt=ee(X);if(gt!==le.__cacheKey){Ve[gt]===void 0&&(Ve[gt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ve[gt].usedTimes++;let St=Ve[le.__cacheKey];St!==void 0&&(Ve[le.__cacheKey].usedTimes--,St.usedTimes===0&&z(X)),le.__cacheKey=gt,le.__webglTexture=Ve[gt].texture}return Te}function ze(le,X,Te){return Math.floor(Math.floor(le/Te)/X)}function $e(le,X,Te,Pe){let gt=le.updateRanges;if(gt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,X.width,X.height,Te,Pe,X.data);else{gt.sort((en,Pt)=>en.start-Pt.start);let St=0;for(let en=1;en<gt.length;en++){let Pt=gt[St],Mt=gt[en],cn=Pt.start+Pt.count,yn=ze(Mt.start,X.width,4),Rn=ze(Pt.start,X.width,4);Mt.start<=cn+1&&yn===Rn&&ze(Mt.start+Mt.count-1,X.width,4)===yn?Pt.count=Math.max(Pt.count,Mt.start+Mt.count-Pt.start):(++St,gt[St]=Mt)}gt.length=St+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Ze=t.getParameter(i.UNPACK_SKIP_PIXELS),Rt=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,X.width);for(let en=0,Pt=gt.length;en<Pt;en++){let Mt=gt[en],cn=Math.floor(Mt.start/4),yn=Math.ceil(Mt.count/4),Rn=cn%X.width,xe=Math.floor(cn/X.width),bt=yn,Ye=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Rn),t.pixelStorei(i.UNPACK_SKIP_ROWS,xe),t.texSubImage2D(i.TEXTURE_2D,0,Rn,xe,bt,Ye,Te,Pe,X.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Ze),t.pixelStorei(i.UNPACK_SKIP_ROWS,Rt)}}function Et(le,X,Te){let Pe=i.TEXTURE_2D;(X.isDataArrayTexture||X.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),X.isData3DTexture&&(Pe=i.TEXTURE_3D);let Ve=Me(le,X),gt=X.source;t.bindTexture(Pe,le.__webglTexture,i.TEXTURE0+Te);let St=n.get(gt);if(gt.version!==St.__version||Ve===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&X.image instanceof ImageBitmap)===!1){let Ye=sn.getPrimaries(sn.workingColorSpace),wt=X.colorSpace===zo?null:sn.getPrimaries(X.colorSpace),Dt=X.colorSpace===zo||Ye===wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Dt)}t.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment);let Ze=S(X.image,!1,r.maxTextureSize);Ze=di(X,Ze);let Rt=s.convert(X.format,X.colorSpace),en=s.convert(X.type),Pt=C(X.internalFormat,Rt,en,X.normalized,X.colorSpace,X.isVideoTexture);mt(Pe,X);let Mt,cn=X.mipmaps,yn=X.isVideoTexture!==!0,Rn=St.__version===void 0||Ve===!0,xe=gt.dataReady,bt=D(X,Ze);if(X.isDepthTexture)Pt=L(X.format===Qs,X.type),Rn&&(yn?t.texStorage2D(i.TEXTURE_2D,1,Pt,Ze.width,Ze.height):t.texImage2D(i.TEXTURE_2D,0,Pt,Ze.width,Ze.height,0,Rt,en,null));else if(X.isDataTexture)if(cn.length>0){yn&&Rn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,cn[0].width,cn[0].height);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,en,Mt.data):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Rt,en,Mt.data);X.generateMipmaps=!1}else yn?(Rn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ze.width,Ze.height),xe&&$e(X,Ze,Rt,en)):t.texImage2D(i.TEXTURE_2D,0,Pt,Ze.width,Ze.height,0,Rt,en,Ze.data);else if(X.isCompressedTexture)if(X.isCompressedArrayTexture){yn&&Rn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,cn[0].width,cn[0].height,Ze.depth);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)if(Mt=cn[Ye],X.format!==xr)if(Rt!==null)if(yn){if(xe)if(X.layerUpdates.size>0){let Dt=w2(Mt.width,Mt.height,X.format,X.type);for(let ct of X.layerUpdates){let Ce=Mt.data.subarray(ct*Dt/Mt.data.BYTES_PER_ELEMENT,(ct+1)*Dt/Mt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,ct,Mt.width,Mt.height,1,Rt,Ce)}X.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,0,Mt.width,Mt.height,Ze.depth,Rt,Mt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ye,Pt,Mt.width,Mt.height,Ze.depth,0,Mt.data,0,0);else je("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else yn?xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,0,Mt.width,Mt.height,Ze.depth,Rt,en,Mt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ye,Pt,Mt.width,Mt.height,Ze.depth,0,Rt,en,Mt.data)}else{yn&&Rn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,cn[0].width,cn[0].height);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],X.format!==xr?Rt!==null?yn?xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,Mt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Mt.data):je("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,en,Mt.data):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Rt,en,Mt.data)}else if(X.isDataArrayTexture)if(yn){if(Rn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,Ze.width,Ze.height,Ze.depth),xe)if(X.layerUpdates.size>0){let Ye=w2(Ze.width,Ze.height,X.format,X.type);for(let wt of X.layerUpdates){let Dt=Ze.data.subarray(wt*Ye/Ze.data.BYTES_PER_ELEMENT,(wt+1)*Ye/Ze.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,wt,Ze.width,Ze.height,1,Rt,en,Dt)}X.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ze.width,Ze.height,Ze.depth,Rt,en,Ze.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Pt,Ze.width,Ze.height,Ze.depth,0,Rt,en,Ze.data);else if(X.isData3DTexture)yn?(Rn&&t.texStorage3D(i.TEXTURE_3D,bt,Pt,Ze.width,Ze.height,Ze.depth),xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Ze.width,Ze.height,Ze.depth,Rt,en,Ze.data)):t.texImage3D(i.TEXTURE_3D,0,Pt,Ze.width,Ze.height,Ze.depth,0,Rt,en,Ze.data);else if(X.isFramebufferTexture){if(Rn)if(yn)t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ze.width,Ze.height);else{let Ye=Ze.width,wt=Ze.height;for(let Dt=0;Dt<bt;Dt++)t.texImage2D(i.TEXTURE_2D,Dt,Pt,Ye,wt,0,Rt,en,null),Ye>>=1,wt>>=1}}else if(X.isHTMLTexture){if("texElementImage2D"in i){let Ye=i.canvas;if(Ye.hasAttribute("layoutsubtree")||Ye.setAttribute("layoutsubtree","true"),Ze.parentNode!==Ye){Ye.appendChild(Ze),f.add(X),Ye.onpaint=wt=>{let Dt=wt.changedElements;for(let ct of f)Dt.includes(ct.image)&&(ct.needsUpdate=!0)},Ye.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Ze);else{let Dt=i.RGBA,ct=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Dt,ct,Ce,Ze)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(cn.length>0){if(yn&&Rn){let Ye=On(cn[0]);t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ye.width,Ye.height)}for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Rt,en,Mt):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Rt,en,Mt);X.generateMipmaps=!1}else if(yn){if(Rn){let Ye=On(Ze);t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ye.width,Ye.height)}xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Rt,en,Ze)}else t.texImage2D(i.TEXTURE_2D,0,Pt,Rt,en,Ze);T(X)&&P(Pe),St.__version=gt.version,X.onUpdate&&X.onUpdate(X)}le.__version=X.version}function Tt(le,X,Te){if(X.image.length!==6)return;let Pe=Me(le,X),Ve=X.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let gt=n.get(Ve);if(Ve.version!==gt.__version||Pe===!0){t.activeTexture(i.TEXTURE0+Te);let St=sn.getPrimaries(sn.workingColorSpace),qe=X.colorSpace===zo?null:sn.getPrimaries(X.colorSpace),Ze=X.colorSpace===zo||St===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ze);let Rt=X.isCompressedTexture||X.image[0].isCompressedTexture,en=X.image[0]&&X.image[0].isDataTexture,Pt=[];for(let ct=0;ct<6;ct++)!Rt&&!en?Pt[ct]=S(X.image[ct],!0,r.maxCubemapSize):Pt[ct]=en?X.image[ct].image:X.image[ct],Pt[ct]=di(X,Pt[ct]);let Mt=Pt[0],cn=s.convert(X.format,X.colorSpace),yn=s.convert(X.type),Rn=C(X.internalFormat,cn,yn,X.normalized,X.colorSpace),xe=X.isVideoTexture!==!0,bt=gt.__version===void 0||Pe===!0,Ye=Ve.dataReady,wt=D(X,Mt);mt(i.TEXTURE_CUBE_MAP,X);let Dt;if(Rt){xe&&bt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Rn,Mt.width,Mt.height);for(let ct=0;ct<6;ct++){Dt=Pt[ct].mipmaps;for(let Ce=0;Ce<Dt.length;Ce++){let jt=Dt[Ce];X.format!==xr?cn!==null?xe?Ye&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,0,0,jt.width,jt.height,cn,jt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,Rn,jt.width,jt.height,0,jt.data):je("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,0,0,jt.width,jt.height,cn,yn,jt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,Rn,jt.width,jt.height,0,cn,yn,jt.data)}}}else{if(Dt=X.mipmaps,xe&&bt){Dt.length>0&&wt++;let ct=On(Pt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Rn,ct.width,ct.height)}for(let ct=0;ct<6;ct++)if(en){xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,0,0,Pt[ct].width,Pt[ct].height,cn,yn,Pt[ct].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Rn,Pt[ct].width,Pt[ct].height,0,cn,yn,Pt[ct].data);for(let Ce=0;Ce<Dt.length;Ce++){let qi=Dt[Ce].image[ct].image;xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,qi.width,qi.height,cn,yn,qi.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Rn,qi.width,qi.height,0,cn,yn,qi.data)}}else{xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,0,0,cn,yn,Pt[ct]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Rn,cn,yn,Pt[ct]);for(let Ce=0;Ce<Dt.length;Ce++){let jt=Dt[Ce];xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,cn,yn,jt.image[ct]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Rn,cn,yn,jt.image[ct])}}}T(X)&&P(i.TEXTURE_CUBE_MAP),gt.__version=Ve.version,X.onUpdate&&X.onUpdate(X)}le.__version=X.version}function Ct(le,X,Te,Pe,Ve,gt){let St=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Ze=C(Te.internalFormat,St,qe,Te.normalized,Te.colorSpace),Rt=n.get(X),en=n.get(Te);if(en.__renderTarget=X,!Rt.__hasExternalTextures){let Pt=Math.max(1,X.width>>gt),Mt=Math.max(1,X.height>>gt);Ve===i.TEXTURE_3D||Ve===i.TEXTURE_2D_ARRAY?t.texImage3D(Ve,gt,Ze,Pt,Mt,X.depth,0,St,qe,null):t.texImage2D(Ve,gt,Ze,Pt,Mt,0,St,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,Ve,en.__webglTexture,0,Qt(X)):(Ve===i.TEXTURE_2D||Ve>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ve<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,Ve,en.__webglTexture,gt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function un(le,X,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),X.depthBuffer){let Pe=X.depthTexture,Ve=Pe&&Pe.isDepthTexture?Pe.type:null,gt=L(X.stencilBuffer,Ve),St=X.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;xn(X)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Qt(X),gt,X.width,X.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,Qt(X),gt,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,gt,X.width,X.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,St,i.RENDERBUFFER,le)}else{let Pe=X.textures;for(let Ve=0;Ve<Pe.length;Ve++){let gt=Pe[Ve],St=s.convert(gt.format,gt.colorSpace),qe=s.convert(gt.type),Ze=C(gt.internalFormat,St,qe,gt.normalized,gt.colorSpace);xn(X)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Qt(X),Ze,X.width,X.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,Qt(X),Ze,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,Ze,X.width,X.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,X,Te){let Pe=X.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(X.depthTexture&&X.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ve=n.get(X.depthTexture);if(Ve.__renderTarget=X,(!Ve.__webglTexture||X.depthTexture.image.width!==X.width||X.depthTexture.image.height!==X.height)&&(X.depthTexture.image.width=X.width,X.depthTexture.image.height=X.height,X.depthTexture.needsUpdate=!0),Pe){if(Ve.__webglInit===void 0&&(Ve.__webglInit=!0,X.depthTexture.addEventListener("dispose",F)),Ve.__webglTexture===void 0){Ve.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ve.__webglTexture),mt(i.TEXTURE_CUBE_MAP,X.depthTexture);let Rt=s.convert(X.depthTexture.format),en=s.convert(X.depthTexture.type),Pt;X.depthTexture.format===xs?Pt=i.DEPTH_COMPONENT24:X.depthTexture.format===Qs&&(Pt=i.DEPTH24_STENCIL8);for(let Mt=0;Mt<6;Mt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Mt,0,Pt,X.width,X.height,0,Rt,en,null)}}else ae(X.depthTexture,0);let gt=Ve.__webglTexture,St=Qt(X),qe=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Ze=X.depthTexture.format===Qs?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(X.depthTexture.format===xs)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ze,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ze,qe,gt,0);else if(X.depthTexture.format===Qs)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ze,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ze,qe,gt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Xe(le){let X=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(X.__boundDepthTexture!==le.depthTexture){let Pe=le.depthTexture;if(X.__depthDisposeCallback&&X.__depthDisposeCallback(),Pe){let Ve=()=>{delete X.__boundDepthTexture,delete X.__depthDisposeCallback,Pe.removeEventListener("dispose",Ve)};Pe.addEventListener("dispose",Ve),X.__depthDisposeCallback=Ve}X.__boundDepthTexture=Pe}if(le.depthTexture&&!X.__autoAllocateDepthBuffer)if(Te)for(let Pe=0;Pe<6;Pe++)Gt(X.__webglFramebuffer[Pe],le,Pe);else{let Pe=le.texture.mipmaps;Pe&&Pe.length>0?Gt(X.__webglFramebuffer[0],le,0):Gt(X.__webglFramebuffer,le,0)}else if(Te){X.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[Pe]),X.__webglDepthbuffer[Pe]===void 0)X.__webglDepthbuffer[Pe]=i.createRenderbuffer(),un(X.__webglDepthbuffer[Pe],le,!1);else{let Ve=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=X.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,gt)}}else{let Pe=le.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer),X.__webglDepthbuffer===void 0)X.__webglDepthbuffer=i.createRenderbuffer(),un(X.__webglDepthbuffer,le,!1);else{let Ve=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=X.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,gt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function st(le,X,Te){let Pe=n.get(le);X!==void 0&&Ct(Pe.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&Xe(le)}function tt(le){let X=le.texture,Te=n.get(le),Pe=n.get(X);le.addEventListener("dispose",N);let Ve=le.textures,gt=le.isWebGLCubeRenderTarget===!0,St=Ve.length>1;if(St||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=X.version,o.memory.textures++),gt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(X.mipmaps&&X.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Ze=0;Ze<X.mipmaps.length;Ze++)Te.__webglFramebuffer[qe][Ze]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(X.mipmaps&&X.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<X.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(St)for(let qe=0,Ze=Ve.length;qe<Ze;qe++){let Rt=n.get(Ve[qe]);Rt.__webglTexture===void 0&&(Rt.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&xn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ve.length;qe++){let Ze=Ve[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let Rt=s.convert(Ze.format,Ze.colorSpace),en=s.convert(Ze.type),Pt=C(Ze.internalFormat,Rt,en,Ze.normalized,Ze.colorSpace,le.isXRRenderTarget===!0),Mt=Qt(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Mt,Pt,le.width,le.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+qe,i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe])}i.bindRenderbuffer(i.RENDERBUFFER,null),le.depthBuffer&&(Te.__webglDepthRenderbuffer=i.createRenderbuffer(),un(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(gt){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),mt(i.TEXTURE_CUBE_MAP,X);for(let qe=0;qe<6;qe++)if(X.mipmaps&&X.mipmaps.length>0)for(let Ze=0;Ze<X.mipmaps.length;Ze++)Ct(Te.__webglFramebuffer[qe][Ze],le,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Ze);else Ct(Te.__webglFramebuffer[qe],le,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(X)&&P(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(St){for(let qe=0,Ze=Ve.length;qe<Ze;qe++){let Rt=Ve[qe],en=n.get(Rt),Pt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Pt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Pt,en.__webglTexture),mt(Pt,Rt),Ct(Te.__webglFramebuffer,le,Rt,i.COLOR_ATTACHMENT0+qe,Pt,0),T(Rt)&&P(Pt)}t.unbindTexture()}else{let qe=i.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(qe=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(qe,Pe.__webglTexture),mt(qe,X),X.mipmaps&&X.mipmaps.length>0)for(let Ze=0;Ze<X.mipmaps.length;Ze++)Ct(Te.__webglFramebuffer[Ze],le,X,i.COLOR_ATTACHMENT0,qe,Ze);else Ct(Te.__webglFramebuffer,le,X,i.COLOR_ATTACHMENT0,qe,0);T(X)&&P(qe),t.unbindTexture()}le.depthBuffer&&Xe(le)}function vt(le){let X=le.textures;for(let Te=0,Pe=X.length;Te<Pe;Te++){let Ve=X[Te];if(T(Ve)){let gt=R(le),St=n.get(Ve).__webglTexture;t.bindTexture(gt,St),P(gt),t.unbindTexture()}}}let yt=[],ln=[];function Zt(le){if(le.samples>0){if(xn(le)===!1){let X=le.textures,Te=le.width,Pe=le.height,Ve=i.COLOR_BUFFER_BIT,gt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,St=n.get(le),qe=X.length>1;if(qe)for(let Rt=0;Rt<X.length;Rt++)t.bindFramebuffer(i.FRAMEBUFFER,St.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,St.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,St.__webglMultisampledFramebuffer);let Ze=le.texture.mipmaps;Ze&&Ze.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglFramebuffer);for(let Rt=0;Rt<X.length;Rt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ve|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ve|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,St.__webglColorRenderbuffer[Rt]);let en=n.get(X[Rt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,en,0)}i.blitFramebuffer(0,0,Te,Pe,0,0,Te,Pe,Ve,i.NEAREST),l===!0&&(yt.length=0,ln.length=0,yt.push(i.COLOR_ATTACHMENT0+Rt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(gt),ln.push(gt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ln)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let Rt=0;Rt<X.length;Rt++){t.bindFramebuffer(i.FRAMEBUFFER,St.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.RENDERBUFFER,St.__webglColorRenderbuffer[Rt]);let en=n.get(X[Rt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,St.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.TEXTURE_2D,en,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let X=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[X])}}}function Qt(le){return Math.min(r.maxSamples,le.samples)}function xn(le){let X=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&X.__useRenderToTexture!==!1}function ge(le){let X=o.render.frame;u.get(le)!==X&&(u.set(le,X),le.update())}function di(le,X){let Te=le.colorSpace,Pe=le.format,Ve=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==Gd&&Te!==zo&&(sn.getTransfer(Te)===Bt?(Pe!==xr||Ve!==Gi)&&je("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",Te)),X}function On(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=Z,this.resetTextureUnits=K,this.getTextureUnits=J,this.setTextureUnits=j,this.setTexture2D=ae,this.setTexture2DArray=ce,this.setTexture3D=de,this.setTextureCube=ve,this.rebindTextures=st,this.setupRenderTarget=tt,this.updateRenderTargetMipmap=vt,this.updateMultisampleRenderTarget=Zt,this.setupDepthRenderbuffer=Xe,this.setupFrameBufferTexture=Ct,this.useMultisampledRTT=xn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Vpe(i,e){function t(n,r=zo){let s,o=sn.getTransfer(r);if(n===Gi)return i.UNSIGNED_BYTE;if(n===PA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===IA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===NA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===LA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Wu)return i.BYTE;if(n===ju)return i.SHORT;if(n===Ha)return i.UNSIGNED_SHORT;if(n===Ir)return i.INT;if(n===pi)return i.UNSIGNED_INT;if(n===Yi)return i.FLOAT;if(n===Li)return i.HALF_FLOAT;if(n===S_)return i.ALPHA;if(n===Nf)return i.RGB;if(n===xr)return i.RGBA;if(n===xs)return i.DEPTH_COMPONENT;if(n===Qs)return i.DEPTH_STENCIL;if(n===Lf)return i.RED;if(n===Xu)return i.RED_INTEGER;if(n===ws)return i.RG;if(n===$u)return i.RG_INTEGER;if(n===ip)return i.RGBA_INTEGER;if(n===Yu||n===Ku||n===Zu||n===Qu)if(o===Bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Yu)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ku)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Zu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Yu)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ku)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Zu)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Qu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===DA||n===FA||n===OA||n===BA)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===DA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===FA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===OA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===BA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===rp||n===sp||n===op||n===ap||n===lp||n===Ju||n===cp)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===rp||n===sp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===op)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ap)return s.COMPRESSED_R11_EAC;if(n===lp)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Ju)return s.COMPRESSED_RG11_EAC;if(n===cp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===up||n===hp||n===fp||n===dp||n===pp||n===Ap||n===mp||n===gp||n===_p||n===xp||n===yp||n===vp||n===bp||n===wp)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===up)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===hp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ap)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Sp||n===Tp||n===Ep)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Sp)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Tp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ep)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Mp||n===Cp||n===eh||n===Rp)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Mp)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Cp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===eh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Rp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Go?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var qpe=`4092+}`,Gpe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1)],zpe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1),new ie(0,-1,0),new ie(0,-1,0)],vW=new on,T2=new ie,PL=new ie;function Vpe(i,e,t){let n=new Zl,r=new Oe,s=new Oe,o=new gn,a=new wT,l=new ST,c={},u=t.maxTextureSize,f={[Ao]:ui,[ui]:Ao,[ir]:ir},p=new jr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Upe,fragmentShader:kpe}),x=p.clone();x.defines.HORIZONTAL_PASS=1;let v=new Kn;v.setAttribute("position",new Ni(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(v,p),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Jd;let T=this.type;this.render=function(D,F,N){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===GT&&(je("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Jd);let B=i.getRenderTarget(),z=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),H=i.state;H.setBlending(Xr),H.buffers.depth.getReversed()===!0?H.buffers.color.setClear(0,0,0,0):H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);let Z=T!==this.type;Z&&F.traverse(function(J){J.material&&(Array.isArray(J.material)?J.material.forEach(j=>j.needsUpdate=!0):J.material.needsUpdate=!0)});for(let J=0,j=D.length;J<j;J++){let K=D[J],ee=K.shadow;if(ee===void 0){je("WebGLShadowMap:",K,"has no shadow.");continue}if(ee.autoUpdate===!1&&ee.needsUpdate===!1)continue;r.copy(ee.mapSize);let ae=ee.getFrameExtents();r.multiply(ae),s.copy(ee.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ae.x),r.x=s.x*ae.x,ee.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ae.y),r.y=s.y*ae.y,ee.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(ee.camera._reversedDepth=ce,ee.map===null||Z===!0){if(ee.map!==null&&(ee.map.depthTexture!==null&&(ee.map.depthTexture.dispose(),ee.map.depthTexture=null),ee.map.dispose()),this.type===Kl){if(K.isPointLight){je("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ee.map=new ua(r.x,r.y,{format:Ss,type:Li,minFilter:vi,magFilter:vi,generateMipmaps:!1}),ee.map.texture.name=K.name+".shadowMap",ee.map.depthTexture=new os(r.x,r.y,Yi),ee.map.depthTexture.name=K.name+".shadowMapDepth",ee.map.depthTexture.format=ys,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=xi,ee.map.depthTexture.magFilter=xi}else K.isPointLight?(ee.map=new QT(r.x),ee.map.depthTexture=new p_(r.x,pi)):(ee.map=new ua(r.x,r.y),ee.map.depthTexture=new os(r.x,r.y,pi)),ee.map.depthTexture.name=K.name+".shadowMap",ee.map.depthTexture.format=ys,this.type===Jd?(ee.map.depthTexture.compareFunction=ce?Hc:th,ee.map.depthTexture.minFilter=vi,ee.map.depthTexture.magFilter=vi):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=xi,ee.map.depthTexture.magFilter=xi);ee.camera.updateProjectionMatrix()}let de=ee.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<de;ve++){if(ee.map.isWebGLCubeRenderTarget)i.setRenderTarget(ee.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(ee.map),i.clear());let Ie=ee.getViewport(ve);o.set(s.x*Ie.x,s.y*Ie.y,s.x*Ie.z,s.y*Ie.w),H.viewport(o)}if(K.isPointLight){let Ie=ee.camera,Qe=ee.matrix,Ue=K.distance||Ie.far;Ue!==Ie.far&&(Ie.far=Ue,Ie.updateProjectionMatrix()),T2.setFromMatrixPosition(K.matrixWorld),Ie.position.copy(T2),PL.copy(Ie.position),PL.add(Gpe[ve]),Ie.up.copy(zpe[ve]),Ie.lookAt(PL),Ie.updateMatrixWorld(),Qe.makeTranslation(-T2.x,-T2.y,-T2.z),vW.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),ee._frustum.setFromProjectionMatrix(vW,Ie.coordinateSystem,Ie.reversedDepth)}else ee.updateMatrices(K);n=ee.getFrustum(),C(F,N,ee.camera,K,this.type)}ee.isPointLightShadow!==!0&&this.type===Kl&&P(ee,N),ee.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,z,V)};function P(D,F){let N=e.update(w);p.defines.VSM_SAMPLES!==D.blurSamples&&(p.defines.VSM_SAMPLES=D.blurSamples,x.defines.VSM_SAMPLES=D.blurSamples,p.needsUpdate=!0,x.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new ua(r.x,r.y,{format:Ss,type:Li})),p.uniforms.shadow_pass.value=D.map.depthTexture,p.uniforms.resolution.value=D.mapSize,p.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(F,null,N,p,w,null),x.uniforms.shadow_pass.value=D.mapPass.texture,x.uniforms.resolution.value=D.mapSize,x.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(F,null,N,x,w,null)}function R(D,F,N,B){let z=null,V=N.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(V!==void 0)z=V;else if(z=N.isPointLight===!0?l:a,i.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0||F.alphaToCoverage===!0){let H=z.uuid,Z=F.uuid,J=c[H];J===void 0&&(J={},c[H]=J);let j=J[Z];j===void 0&&(j=z.clone(),J[Z]=j,F.addEventListener("dispose",L)),z=j}if(z.visible=F.visible,z.wireframe=F.wireframe,B===Kl?z.side=F.shadowSide!==null?F.shadowSide:F.side:z.side=F.shadowSide!==null?F.shadowSide:f[F.side],z.alphaMap=F.alphaMap,z.alphaTest=F.alphaToCoverage===!0?.5:F.alphaTest,z.map=F.map,z.clipShadows=F.clipShadows,z.clippingPlanes=F.clippingPlanes,z.clipIntersection=F.clipIntersection,z.displacementMap=F.displacementMap,z.displacementScale=F.displacementScale,z.displacementBias=F.displacementBias,z.wireframeLinewidth=F.wireframeLinewidth,z.linewidth=F.linewidth,N.isPointLight===!0&&z.isMeshDistanceMaterial===!0){let H=i.properties.get(z);H.light=N}return z}function C(D,F,N,B,z){if(D.visible===!1)return;if(D.layers.test(F.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&z===Kl)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,D.matrixWorld);let Z=e.update(D),J=D.material;if(Array.isArray(J)){let j=Z.groups;for(let K=0,ee=j.length;K<ee;K++){let ae=j[K],ce=J[ae.materialIndex];if(ce&&ce.visible){let de=R(D,ce,B,z);D.onBeforeShadow(i,D,F,N,Z,de,ae),i.renderBufferDirect(N,null,Z,de,D,ae),D.onAfterShadow(i,D,F,N,Z,de,ae)}}}else if(J.visible){let j=R(D,J,B,z);D.onBeforeShadow(i,D,F,N,Z,j,null),i.renderBufferDirect(N,null,Z,j,D,null),D.onAfterShadow(i,D,F,N,Z,j,null)}}let H=D.children;for(let Z=0,J=H.length;Z<J;Z++)C(H[Z],F,N,B,z)}function L(D){D.target.removeEventListener("dispose",L);for(let N in c){let B=c[N],z=D.target.uuid;z in B&&(B[z].dispose(),delete B[z])}}}function qpe(i,e){function t(){let xe=!1,bt=new gn,Ye=null,wt=new gn(0,0,0,0);return{setMask:function(Dt){Ye!==Dt&&!xe&&(i.colorMask(Dt,Dt,Dt,Dt),Ye=Dt)},setLocked:function(Dt){xe=Dt},setClear:function(Dt,ct,Ce,jt,qi){qi===!0&&(Dt*=jt,ct*=jt,Ce*=jt),bt.set(Dt,ct,Ce,jt),wt.equals(bt)===!1&&(i.clearColor(Dt,ct,Ce,jt),wt.copy(bt))},reset:function(){xe=!1,Ye=null,wt.set(-1,0,0,0)}}}function n(){let xe=!1,bt=!1,Ye=null,wt=null,Dt=null;return{setReversed:function(ct){if(bt!==ct){let Ce=e.get("EXT_clip_control");ct?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),bt=ct;let jt=Dt;Dt=null,this.setClear(jt)}},getReversed:function(){return bt},setTest:function(ct){ct?$e(i.DEPTH_TEST):Et(i.DEPTH_TEST)},setMask:function(ct){Ye!==ct&&!xe&&(i.depthMask(ct),Ye=ct)},setFunc:function(ct){if(bt&&(ct=b2[ct]),wt!==ct){switch(ct){case lA:i.depthFunc(i.NEVER);break;case cA:i.depthFunc(i.ALWAYS);break;case uA:i.depthFunc(i.LESS);break;case Bu:i.depthFunc(i.LEQUAL);break;case hA:i.depthFunc(i.EQUAL);break;case fA:i.depthFunc(i.GEQUAL);break;case dA:i.depthFunc(i.GREATER);break;case pA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}wt=ct}},setLocked:function(ct){xe=ct},setClear:function(ct){Dt!==ct&&(Dt=ct,bt&&(ct=1-ct),i.clearDepth(ct))},reset:function(){xe=!1,Ye=null,wt=null,Dt=null,bt=!1}}}function r(){let xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,qi=null;return{setTest:function(In){xe||(In?$e(i.STENCIL_TEST):Et(i.STENCIL_TEST))},setMask:function(In){bt!==In&&!xe&&(i.stencilMask(In),bt=In)},setFunc:function(In,Ur,mr){(Ye!==In||wt!==Ur||Dt!==mr)&&(i.stencilFunc(In,Ur,mr),Ye=In,wt=Ur,Dt=mr)},setOp:function(In,Ur,mr){(ct!==In||Ce!==Ur||jt!==mr)&&(i.stencilOp(In,Ur,mr),ct=In,Ce=Ur,jt=mr)},setLocked:function(In){xe=In},setClear:function(In){qi!==In&&(i.clearStencil(In),qi=In)},reset:function(){xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,qi=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,P=null,R=null,C=null,L=null,D=null,F=null,N=new Ut(0,0,0),B=0,z=!1,V=null,H=null,Z=null,J=null,j=null,K=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ee=!1,ae=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(ce)[1]),ee=ae>=1):ce.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),ee=ae>=2);let de=null,ve={},Ie=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Ue=new gn().fromArray(Ie),mt=new gn().fromArray(Qe);function Me(xe,bt,Ye,wt){let Dt=new Uint8Array(4),ct=i.createTexture();i.bindTexture(xe,ct),i.texParameteri(xe,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(xe,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ye;Ce++)xe===i.TEXTURE_3D||xe===i.TEXTURE_2D_ARRAY?i.texImage3D(bt,0,i.RGBA,1,1,wt,0,i.RGBA,i.UNSIGNED_BYTE,Dt):i.texImage2D(bt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Dt);return ct}let ze={};ze[i.TEXTURE_2D]=Me(i.TEXTURE_2D,i.TEXTURE_2D,1),ze[i.TEXTURE_CUBE_MAP]=Me(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ze[i.TEXTURE_2D_ARRAY]=Me(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ze[i.TEXTURE_3D]=Me(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),$e(i.DEPTH_TEST),o.setFunc(Bu),vt(!1),yt(Zy),$e(i.CULL_FACE),st(Xr);function $e(xe){u[xe]!==!0&&(i.enable(xe),u[xe]=!0)}function Et(xe){u[xe]!==!1&&(i.disable(xe),u[xe]=!1)}function Tt(xe,bt){return p[xe]!==bt?(i.bindFramebuffer(xe,bt),p[xe]=bt,xe===i.DRAW_FRAMEBUFFER&&(p[i.FRAMEBUFFER]=bt),xe===i.FRAMEBUFFER&&(p[i.DRAW_FRAMEBUFFER]=bt),!0):!1}function Ct(xe,bt){let Ye=v,wt=!1;if(xe){Ye=x.get(bt),Ye===void 0&&(Ye=[],x.set(bt,Ye));let Dt=xe.textures;if(Ye.length!==Dt.length||Ye[0]!==i.COLOR_ATTACHMENT0){for(let ct=0,Ce=Dt.length;ct<Ce;ct++)Ye[ct]=i.COLOR_ATTACHMENT0+ct;Ye.length=Dt.length,wt=!0}}else Ye[0]!==i.BACK&&(Ye[0]=i.BACK,wt=!0);wt&&i.drawBuffers(Ye)}function un(xe){return w!==xe?(i.useProgram(xe),w=xe,!0):!1}let Gt={[Bs]:i.FUNC_ADD,[Qy]:i.FUNC_SUBTRACT,[Jy]:i.FUNC_REVERSE_SUBTRACT};Gt[zT]=i.MIN,Gt[VT]=i.MAX;let Xe={[qc]:i.ZERO,[e2]:i.ONE,[t2]:i.SRC_COLOR,[Ud]:i.SRC_ALPHA,[a2]:i.SRC_ALPHA_SATURATE,[s2]:i.DST_COLOR,[i2]:i.DST_ALPHA,[n2]:i.ONE_MINUS_SRC_COLOR,[kd]:i.ONE_MINUS_SRC_ALPHA,[o2]:i.ONE_MINUS_DST_COLOR,[r2]:i.ONE_MINUS_DST_ALPHA,[GH]:i.CONSTANT_COLOR,[zH]:i.ONE_MINUS_CONSTANT_COLOR,[VH]:i.CONSTANT_ALPHA,[qH]:i.ONE_MINUS_CONSTANT_ALPHA};function st(xe,bt,Ye,wt,Dt,ct,Ce,jt,qi,In){if(xe===Xr){S===!0&&(Et(i.BLEND),S=!1);return}if(S===!1&&($e(i.BLEND),S=!0),xe!==If){if(xe!==T||In!==z){if((P!==Bs||L!==Bs)&&(i.blendEquation(i.FUNC_ADD),P=Bs,L=Bs),In)switch(xe){case ss:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case zu:i.blendFunc(i.ONE,i.ONE);break;case Vu:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case qu:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ge("WebGLState: Invalid blending: ",xe);break}else switch(xe){case ss:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case zu:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Vu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case qu:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",xe);break}R=null,C=null,D=null,F=null,N.set(0,0,0),B=0,T=xe,z=In}return}Dt=Dt||bt,ct=ct||Ye,Ce=Ce||wt,(bt!==P||Dt!==L)&&(i.blendEquationSeparate(Gt[bt],Gt[Dt]),P=bt,L=Dt),(Ye!==R||wt!==C||ct!==D||Ce!==F)&&(i.blendFuncSeparate(Xe[Ye],Xe[wt],Xe[ct],Xe[Ce]),R=Ye,C=wt,D=ct,F=Ce),(jt.equals(N)===!1||qi!==B)&&(i.blendColor(jt.r,jt.g,jt.b,qi),N.copy(jt),B=qi),T=xe,z=!1}function tt(xe,bt){xe.side===ir?Et(i.CULL_FACE):$e(i.CULL_FACE);let Ye=xe.side===ui;bt&&(Ye=!Ye),vt(Ye),xe.blending===ss&&xe.transparent===!1?st(Xr):st(xe.blending,xe.blendEquation,xe.blendSrc,xe.blendDst,xe.blendEquationAlpha,xe.blendSrcAlpha,xe.blendDstAlpha,xe.blendColor,xe.blendAlpha,xe.premultipliedAlpha),o.setFunc(xe.depthFunc),o.setTest(xe.depthTest),o.setMask(xe.depthWrite),s.setMask(xe.colorWrite);let wt=xe.stencilWrite;a.setTest(wt),wt&&(a.setMask(xe.stencilWriteMask),a.setFunc(xe.stencilFunc,xe.stencilRef,xe.stencilFuncMask),a.setOp(xe.stencilFail,xe.stencilZFail,xe.stencilZPass)),Kt(xe.polygonOffset,xe.polygonOffsetFactor,xe.polygonOffsetUnits),xe.alphaToCoverage===!0?$e(i.SAMPLE_ALPHA_TO_COVERAGE):Et(i.SAMPLE_ALPHA_TO_COVERAGE)}function vt(xe){V!==xe&&(xe?i.frontFace(i.CW):i.frontFace(i.CCW),V=xe)}function yt(xe){xe!==UT?($e(i.CULL_FACE),xe!==H&&(xe===Zy?i.cullFace(i.BACK):xe===kT?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Et(i.CULL_FACE),H=xe}function ln(xe){xe!==Z&&(ee&&i.lineWidth(xe),Z=xe)}function Kt(xe,bt,Ye){xe?($e(i.POLYGON_OFFSET_FILL),(J!==bt||j!==Ye)&&(J=bt,j=Ye,o.getReversed()&&(bt=-bt),i.polygonOffset(bt,Ye))):Et(i.POLYGON_OFFSET_FILL)}function Qt(xe){xe?$e(i.SCISSOR_TEST):Et(i.SCISSOR_TEST)}function xn(xe){xe===void 0&&(xe=i.TEXTURE0+K-1),de!==xe&&(i.activeTexture(xe),de=xe)}function ge(xe,bt,Ye){Ye===void 0&&(de===null?Ye=i.TEXTURE0+K-1:Ye=de);let wt=ve[Ye];wt===void 0&&(wt={type:void 0,texture:void 0},ve[Ye]=wt),(wt.type!==xe||wt.texture!==bt)&&(de!==Ye&&(i.activeTexture(Ye),de=Ye),i.bindTexture(xe,bt||ze[xe]),wt.type=xe,wt.texture=bt)}function di(){let xe=ve[de];xe!==void 0&&xe.type!==void 0&&(i.bindTexture(xe.type,null),xe.type=void 0,xe.texture=void 0)}function On(){try{i.compressedTexImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function X(){try{i.texSubImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Te(){try{i.texSubImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Pe(){try{i.compressedTexSubImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Ve(){try{i.compressedTexSubImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function gt(){try{i.texStorage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function St(){try{i.texStorage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function qe(){try{i.texImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Ke(){try{i.texImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Rt(xe){return f[xe]!==void 0?f[xe]:i.getParameter(xe)}function en(xe,bt){f[xe]!==bt&&(i.pixelStorei(xe,bt),f[xe]=bt)}function Pt(xe){Ue.equals(xe)===!1&&(i.scissor(xe.x,xe.y,xe.z,xe.w),Ue.copy(xe))}function Mt(xe){mt.equals(xe)===!1&&(i.viewport(xe.x,xe.y,xe.z,xe.w),mt.copy(xe))}function cn(xe,bt){let Ye=c.get(bt);Ye===void 0&&(Ye=new WeakMap,c.set(bt,Ye));let wt=Ye.get(xe);wt===void 0&&(wt=i.getUniformBlockIndex(bt,xe.name),Ye.set(xe,wt))}function yn(xe,bt){let wt=c.get(bt).get(xe);l.get(bt)!==wt&&(i.uniformBlockBinding(bt,wt,xe.__bindingPointIndex),l.set(bt,wt))}function Rn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},de=null,ve={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,P=null,R=null,C=null,L=null,D=null,F=null,N=new Ut(0,0,0),B=0,z=!1,V=null,H=null,Z=null,J=null,j=null,Ue.set(0,0,i.canvas.width,i.canvas.height),mt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:$e,disable:Et,bindFramebuffer:Tt,drawBuffers:Ct,useProgram:un,setBlending:st,setMaterial:tt,setFlipSided:vt,setCullFace:yt,setLineWidth:ln,setPolygonOffset:Kt,setScissorTest:Qt,activeTexture:xn,bindTexture:ge,unbindTexture:di,compressedTexImage2D:On,compressedTexImage3D:le,texImage2D:qe,texImage3D:Ke,pixelStorei:en,getParameter:Rt,updateUBOMapping:cn,uniformBlockBinding:yn,texStorage2D:gt,texStorage3D:St,texSubImage2D:X,texSubImage3D:Te,compressedTexSubImage2D:Pe,compressedTexSubImage3D:Ve,scissor:Pt,viewport:Mt,reset:Rn}}function Hpe(i,e,t,n,r,s,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Oe,u=new WeakMap,f=new Set,p,x=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,X){return v?new OffscreenCanvas(le,X):l_("canvas")}function S(le,X,Te){let Pe=1,Ve=On(le);if((Ve.width>Te||Ve.height>Te)&&(Pe=Te/Math.max(Ve.width,Ve.height)),Pe<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){let gt=Math.floor(Pe*Ve.width),St=Math.floor(Pe*Ve.height);p===void 0&&(p=w(gt,St));let qe=X?w(gt,St):p;return qe.width=gt,qe.height=St,qe.getContext("2d").drawImage(le,0,0,gt,St),je("WebGLRenderer: Texture has been resized from ("+Ve.width+"x"+Ve.height+") to ("+gt+"x"+St+")."),qe}else return"data"in le&&je("WebGLRenderer: Image in DataTexture is too big ("+Ve.width+"x"+Ve.height+")."),le;return le}function T(le){return le.generateMipmaps}function P(le){i.generateMipmap(le)}function R(le){return le.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?i.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function C(le,X,Te,Pe,Ve,gt=!1){if(le!==null){if(i[le]!==void 0)return i[le];je("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let St;Pe&&(St=e.get("EXT_texture_norm16"),St||je("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=X;if(X===i.RED&&(Te===i.FLOAT&&(qe=i.R32F),Te===i.HALF_FLOAT&&(qe=i.R16F),Te===i.UNSIGNED_BYTE&&(qe=i.R8),Te===i.UNSIGNED_SHORT&&St&&(qe=St.R16_EXT),Te===i.SHORT&&St&&(qe=St.R16_SNORM_EXT)),X===i.RED_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.R8UI),Te===i.UNSIGNED_SHORT&&(qe=i.R16UI),Te===i.UNSIGNED_INT&&(qe=i.R32UI),Te===i.BYTE&&(qe=i.R8I),Te===i.SHORT&&(qe=i.R16I),Te===i.INT&&(qe=i.R32I)),X===i.RG&&(Te===i.FLOAT&&(qe=i.RG32F),Te===i.HALF_FLOAT&&(qe=i.RG16F),Te===i.UNSIGNED_BYTE&&(qe=i.RG8),Te===i.UNSIGNED_SHORT&&St&&(qe=St.RG16_EXT),Te===i.SHORT&&St&&(qe=St.RG16_SNORM_EXT)),X===i.RG_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RG8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RG16UI),Te===i.UNSIGNED_INT&&(qe=i.RG32UI),Te===i.BYTE&&(qe=i.RG8I),Te===i.SHORT&&(qe=i.RG16I),Te===i.INT&&(qe=i.RG32I)),X===i.RGB_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGB8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGB16UI),Te===i.UNSIGNED_INT&&(qe=i.RGB32UI),Te===i.BYTE&&(qe=i.RGB8I),Te===i.SHORT&&(qe=i.RGB16I),Te===i.INT&&(qe=i.RGB32I)),X===i.RGBA_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGBA8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGBA16UI),Te===i.UNSIGNED_INT&&(qe=i.RGBA32UI),Te===i.BYTE&&(qe=i.RGBA8I),Te===i.SHORT&&(qe=i.RGBA16I),Te===i.INT&&(qe=i.RGBA32I)),X===i.RGB&&(Te===i.UNSIGNED_SHORT&&St&&(qe=St.RGB16_EXT),Te===i.SHORT&&St&&(qe=St.RGB16_SNORM_EXT),Te===i.UNSIGNED_INT_5_9_9_9_REV&&(qe=i.RGB9_E5),Te===i.UNSIGNED_INT_10F_11F_11F_REV&&(qe=i.R11F_G11F_B10F)),X===i.RGBA){let Ke=gt?zd:sn.getTransfer(Ve);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Ke===Bt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&St&&(qe=St.RGBA16_EXT),Te===i.SHORT&&St&&(qe=St.RGBA16_SNORM_EXT),Te===i.UNSIGNED_SHORT_4_4_4_4&&(qe=i.RGBA4),Te===i.UNSIGNED_SHORT_5_5_5_1&&(qe=i.RGB5_A1)}return(qe===i.R16F||qe===i.R32F||qe===i.RG16F||qe===i.RG32F||qe===i.RGBA16F||qe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),qe}function L(le,X){let Te;return le?X===null||X===pi||X===zo?Te=i.DEPTH24_STENCIL8:X===Yi?Te=i.DEPTH32F_STENCIL8:X===Wa&&(Te=i.DEPTH24_STENCIL8,je("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):X===null||X===pi||X===zo?Te=i.DEPTH_COMPONENT24:X===Yi?Te=i.DEPTH_COMPONENT32F:X===Wa&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,X){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==xi&&le.minFilter!==vi?Math.log2(Math.max(X.width,X.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?X.mipmaps.length:1}function F(le){let X=le.target;X.removeEventListener("dispose",F),B(X),X.isVideoTexture&&u.delete(X),X.isHTMLTexture&&f.delete(X)}function N(le){let X=le.target;X.removeEventListener("dispose",N),V(X)}function B(le){let X=n.get(le);if(X.__webglInit===void 0)return;let Te=le.source,Pe=x.get(Te);if(Pe){let Ve=Pe[X.__cacheKey];Ve.usedTimes--,Ve.usedTimes===0&&z(le),Object.keys(Pe).length===0&&x.delete(Te)}n.remove(le)}function z(le){let X=n.get(le);i.deleteTexture(X.__webglTexture);let Te=le.source,Pe=x.get(Te);delete Pe[X.__cacheKey],o.memory.textures--}function V(le){let X=n.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),n.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let Pe=0;Pe<6;Pe++){if(Array.isArray(X.__webglFramebuffer[Pe]))for(let Ve=0;Ve<X.__webglFramebuffer[Pe].length;Ve++)i.deleteFramebuffer(X.__webglFramebuffer[Pe][Ve]);else i.deleteFramebuffer(X.__webglFramebuffer[Pe]);X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer[Pe])}else{if(Array.isArray(X.__webglFramebuffer))for(let Pe=0;Pe<X.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(X.__webglFramebuffer[Pe]);else i.deleteFramebuffer(X.__webglFramebuffer);if(X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer),X.__webglMultisampledFramebuffer&&i.deleteFramebuffer(X.__webglMultisampledFramebuffer),X.__webglColorRenderbuffer)for(let Pe=0;Pe<X.__webglColorRenderbuffer.length;Pe++)X.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(X.__webglColorRenderbuffer[Pe]);X.__webglDepthRenderbuffer&&i.deleteRenderbuffer(X.__webglDepthRenderbuffer)}let Te=le.textures;for(let Pe=0,Ve=Te.length;Pe<Ve;Pe++){let gt=n.get(Te[Pe]);gt.__webglTexture&&(i.deleteTexture(gt.__webglTexture),o.memory.textures--),n.remove(Te[Pe])}n.remove(le)}let H=0;function Z(){H=0}function J(){return H}function j(le){H=le}function K(){let le=H;return le>=r.maxTextures&&je("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),H+=1,le}function ee(le){let X=[];return X.push(le.wrapS),X.push(le.wrapT),X.push(le.wrapR||0),X.push(le.magFilter),X.push(le.minFilter),X.push(le.anisotropy),X.push(le.internalFormat),X.push(le.format),X.push(le.type),X.push(le.generateMipmaps),X.push(le.premultiplyAlpha),X.push(le.flipY),X.push(le.unpackAlignment),X.push(le.colorSpace),X.join()}function ae(le,X){let Te=n.get(le);if(le.isVideoTexture&&ge(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Pe=le.image;if(Pe===null)je("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)je("WebGLRenderer: Texture marked for update but image is incomplete");else{Et(Te,le,X);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+X)}function ce(le,X){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Et(Te,le,X);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+X)}function de(le,X){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Et(Te,le,X);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+X)}function ve(le,X){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Tt(Te,le,X);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+X)}let Ie={[Sf]:i.REPEAT,[ko]:i.CLAMP_TO_EDGE,[Tf]:i.MIRRORED_REPEAT},Qe={[xi]:i.NEAREST,[A2]:i.NEAREST_MIPMAP_NEAREST,[Jl]:i.NEAREST_MIPMAP_LINEAR,[vi]:i.LINEAR,[np]:i.LINEAR_MIPMAP_NEAREST,[go]:i.LINEAR_MIPMAP_LINEAR},Ue={[_2]:i.NEVER,[v2]:i.ALWAYS,[T_]:i.LESS,[th]:i.LEQUAL,[x2]:i.EQUAL,[Hc]:i.GEQUAL,[kA]:i.GREATER,[y2]:i.NOTEQUAL};function mt(le,X){if(X.type===Yi&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===vi||X.magFilter===np||X.magFilter===Jl||X.magFilter===go||X.minFilter===vi||X.minFilter===np||X.minFilter===Jl||X.minFilter===go)&&je("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(le,i.TEXTURE_WRAP_S,Ie[X.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Ie[X.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Ie[X.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[X.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[X.minFilter]),X.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Ue[X.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(X.magFilter===xi||X.minFilter!==Jl&&X.minFilter!==go||X.type===Yi&&e.has("OES_texture_float_linear")===!1)return;if(X.anisotropy>1||n.get(X).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(X.anisotropy,r.getMaxAnisotropy())),n.get(X).__currentAnisotropy=X.anisotropy}}}function Me(le,X){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,X.addEventListener("dispose",F));let Pe=X.source,Ve=x.get(Pe);Ve===void 0&&(Ve={},x.set(Pe,Ve));let gt=ee(X);if(gt!==le.__cacheKey){Ve[gt]===void 0&&(Ve[gt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ve[gt].usedTimes++;let St=Ve[le.__cacheKey];St!==void 0&&(Ve[le.__cacheKey].usedTimes--,St.usedTimes===0&&z(X)),le.__cacheKey=gt,le.__webglTexture=Ve[gt].texture}return Te}function ze(le,X,Te){return Math.floor(Math.floor(le/Te)/X)}function $e(le,X,Te,Pe){let gt=le.updateRanges;if(gt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,X.width,X.height,Te,Pe,X.data);else{gt.sort((en,Pt)=>en.start-Pt.start);let St=0;for(let en=1;en<gt.length;en++){let Pt=gt[St],Mt=gt[en],cn=Pt.start+Pt.count,yn=ze(Mt.start,X.width,4),Rn=ze(Pt.start,X.width,4);Mt.start<=cn+1&&yn===Rn&&ze(Mt.start+Mt.count-1,X.width,4)===yn?Pt.count=Math.max(Pt.count,Mt.start+Mt.count-Pt.start):(++St,gt[St]=Mt)}gt.length=St+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Ke=t.getParameter(i.UNPACK_SKIP_PIXELS),Rt=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,X.width);for(let en=0,Pt=gt.length;en<Pt;en++){let Mt=gt[en],cn=Math.floor(Mt.start/4),yn=Math.ceil(Mt.count/4),Rn=cn%X.width,xe=Math.floor(cn/X.width),bt=yn,Ye=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Rn),t.pixelStorei(i.UNPACK_SKIP_ROWS,xe),t.texSubImage2D(i.TEXTURE_2D,0,Rn,xe,bt,Ye,Te,Pe,X.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(i.UNPACK_SKIP_ROWS,Rt)}}function Et(le,X,Te){let Pe=i.TEXTURE_2D;(X.isDataArrayTexture||X.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),X.isData3DTexture&&(Pe=i.TEXTURE_3D);let Ve=Me(le,X),gt=X.source;t.bindTexture(Pe,le.__webglTexture,i.TEXTURE0+Te);let St=n.get(gt);if(gt.version!==St.__version||Ve===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&X.image instanceof ImageBitmap)===!1){let Ye=sn.getPrimaries(sn.workingColorSpace),wt=X.colorSpace===Vo?null:sn.getPrimaries(X.colorSpace),Dt=X.colorSpace===Vo||Ye===wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Dt)}t.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment);let Ke=S(X.image,!1,r.maxTextureSize);Ke=di(X,Ke);let Rt=s.convert(X.format,X.colorSpace),en=s.convert(X.type),Pt=C(X.internalFormat,Rt,en,X.normalized,X.colorSpace,X.isVideoTexture);mt(Pe,X);let Mt,cn=X.mipmaps,yn=X.isVideoTexture!==!0,Rn=St.__version===void 0||Ve===!0,xe=gt.dataReady,bt=D(X,Ke);if(X.isDepthTexture)Pt=L(X.format===Qs,X.type),Rn&&(yn?t.texStorage2D(i.TEXTURE_2D,1,Pt,Ke.width,Ke.height):t.texImage2D(i.TEXTURE_2D,0,Pt,Ke.width,Ke.height,0,Rt,en,null));else if(X.isDataTexture)if(cn.length>0){yn&&Rn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,cn[0].width,cn[0].height);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,en,Mt.data):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Rt,en,Mt.data);X.generateMipmaps=!1}else yn?(Rn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ke.width,Ke.height),xe&&$e(X,Ke,Rt,en)):t.texImage2D(i.TEXTURE_2D,0,Pt,Ke.width,Ke.height,0,Rt,en,Ke.data);else if(X.isCompressedTexture)if(X.isCompressedArrayTexture){yn&&Rn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,cn[0].width,cn[0].height,Ke.depth);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)if(Mt=cn[Ye],X.format!==xr)if(Rt!==null)if(yn){if(xe)if(X.layerUpdates.size>0){let Dt=w2(Mt.width,Mt.height,X.format,X.type);for(let ct of X.layerUpdates){let Ce=Mt.data.subarray(ct*Dt/Mt.data.BYTES_PER_ELEMENT,(ct+1)*Dt/Mt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,ct,Mt.width,Mt.height,1,Rt,Ce)}X.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,0,Mt.width,Mt.height,Ke.depth,Rt,Mt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ye,Pt,Mt.width,Mt.height,Ke.depth,0,Mt.data,0,0);else je("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else yn?xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,0,Mt.width,Mt.height,Ke.depth,Rt,en,Mt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ye,Pt,Mt.width,Mt.height,Ke.depth,0,Rt,en,Mt.data)}else{yn&&Rn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,cn[0].width,cn[0].height);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],X.format!==xr?Rt!==null?yn?xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,Mt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Mt.data):je("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,en,Mt.data):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Rt,en,Mt.data)}else if(X.isDataArrayTexture)if(yn){if(Rn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,Ke.width,Ke.height,Ke.depth),xe)if(X.layerUpdates.size>0){let Ye=w2(Ke.width,Ke.height,X.format,X.type);for(let wt of X.layerUpdates){let Dt=Ke.data.subarray(wt*Ye/Ke.data.BYTES_PER_ELEMENT,(wt+1)*Ye/Ke.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,wt,Ke.width,Ke.height,1,Rt,en,Dt)}X.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ke.width,Ke.height,Ke.depth,Rt,en,Ke.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Pt,Ke.width,Ke.height,Ke.depth,0,Rt,en,Ke.data);else if(X.isData3DTexture)yn?(Rn&&t.texStorage3D(i.TEXTURE_3D,bt,Pt,Ke.width,Ke.height,Ke.depth),xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Ke.width,Ke.height,Ke.depth,Rt,en,Ke.data)):t.texImage3D(i.TEXTURE_3D,0,Pt,Ke.width,Ke.height,Ke.depth,0,Rt,en,Ke.data);else if(X.isFramebufferTexture){if(Rn)if(yn)t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ke.width,Ke.height);else{let Ye=Ke.width,wt=Ke.height;for(let Dt=0;Dt<bt;Dt++)t.texImage2D(i.TEXTURE_2D,Dt,Pt,Ye,wt,0,Rt,en,null),Ye>>=1,wt>>=1}}else if(X.isHTMLTexture){if("texElementImage2D"in i){let Ye=i.canvas;if(Ye.hasAttribute("layoutsubtree")||Ye.setAttribute("layoutsubtree","true"),Ke.parentNode!==Ye){Ye.appendChild(Ke),f.add(X),Ye.onpaint=wt=>{let Dt=wt.changedElements;for(let ct of f)Dt.includes(ct.image)&&(ct.needsUpdate=!0)},Ye.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Ke);else{let Dt=i.RGBA,ct=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Dt,ct,Ce,Ke)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(cn.length>0){if(yn&&Rn){let Ye=On(cn[0]);t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ye.width,Ye.height)}for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Rt,en,Mt):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Rt,en,Mt);X.generateMipmaps=!1}else if(yn){if(Rn){let Ye=On(Ke);t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ye.width,Ye.height)}xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Rt,en,Ke)}else t.texImage2D(i.TEXTURE_2D,0,Pt,Rt,en,Ke);T(X)&&P(Pe),St.__version=gt.version,X.onUpdate&&X.onUpdate(X)}le.__version=X.version}function Tt(le,X,Te){if(X.image.length!==6)return;let Pe=Me(le,X),Ve=X.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let gt=n.get(Ve);if(Ve.version!==gt.__version||Pe===!0){t.activeTexture(i.TEXTURE0+Te);let St=sn.getPrimaries(sn.workingColorSpace),qe=X.colorSpace===Vo?null:sn.getPrimaries(X.colorSpace),Ke=X.colorSpace===Vo||St===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ke);let Rt=X.isCompressedTexture||X.image[0].isCompressedTexture,en=X.image[0]&&X.image[0].isDataTexture,Pt=[];for(let ct=0;ct<6;ct++)!Rt&&!en?Pt[ct]=S(X.image[ct],!0,r.maxCubemapSize):Pt[ct]=en?X.image[ct].image:X.image[ct],Pt[ct]=di(X,Pt[ct]);let Mt=Pt[0],cn=s.convert(X.format,X.colorSpace),yn=s.convert(X.type),Rn=C(X.internalFormat,cn,yn,X.normalized,X.colorSpace),xe=X.isVideoTexture!==!0,bt=gt.__version===void 0||Pe===!0,Ye=Ve.dataReady,wt=D(X,Mt);mt(i.TEXTURE_CUBE_MAP,X);let Dt;if(Rt){xe&&bt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Rn,Mt.width,Mt.height);for(let ct=0;ct<6;ct++){Dt=Pt[ct].mipmaps;for(let Ce=0;Ce<Dt.length;Ce++){let jt=Dt[Ce];X.format!==xr?cn!==null?xe?Ye&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,0,0,jt.width,jt.height,cn,jt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,Rn,jt.width,jt.height,0,jt.data):je("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,0,0,jt.width,jt.height,cn,yn,jt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,Rn,jt.width,jt.height,0,cn,yn,jt.data)}}}else{if(Dt=X.mipmaps,xe&&bt){Dt.length>0&&wt++;let ct=On(Pt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Rn,ct.width,ct.height)}for(let ct=0;ct<6;ct++)if(en){xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,0,0,Pt[ct].width,Pt[ct].height,cn,yn,Pt[ct].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Rn,Pt[ct].width,Pt[ct].height,0,cn,yn,Pt[ct].data);for(let Ce=0;Ce<Dt.length;Ce++){let qi=Dt[Ce].image[ct].image;xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,qi.width,qi.height,cn,yn,qi.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Rn,qi.width,qi.height,0,cn,yn,qi.data)}}else{xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,0,0,cn,yn,Pt[ct]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Rn,cn,yn,Pt[ct]);for(let Ce=0;Ce<Dt.length;Ce++){let jt=Dt[Ce];xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,cn,yn,jt.image[ct]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Rn,cn,yn,jt.image[ct])}}}T(X)&&P(i.TEXTURE_CUBE_MAP),gt.__version=Ve.version,X.onUpdate&&X.onUpdate(X)}le.__version=X.version}function Ct(le,X,Te,Pe,Ve,gt){let St=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Ke=C(Te.internalFormat,St,qe,Te.normalized,Te.colorSpace),Rt=n.get(X),en=n.get(Te);if(en.__renderTarget=X,!Rt.__hasExternalTextures){let Pt=Math.max(1,X.width>>gt),Mt=Math.max(1,X.height>>gt);Ve===i.TEXTURE_3D||Ve===i.TEXTURE_2D_ARRAY?t.texImage3D(Ve,gt,Ke,Pt,Mt,X.depth,0,St,qe,null):t.texImage2D(Ve,gt,Ke,Pt,Mt,0,St,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,Ve,en.__webglTexture,0,Qt(X)):(Ve===i.TEXTURE_2D||Ve>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ve<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,Ve,en.__webglTexture,gt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function un(le,X,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),X.depthBuffer){let Pe=X.depthTexture,Ve=Pe&&Pe.isDepthTexture?Pe.type:null,gt=L(X.stencilBuffer,Ve),St=X.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;xn(X)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Qt(X),gt,X.width,X.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,Qt(X),gt,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,gt,X.width,X.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,St,i.RENDERBUFFER,le)}else{let Pe=X.textures;for(let Ve=0;Ve<Pe.length;Ve++){let gt=Pe[Ve],St=s.convert(gt.format,gt.colorSpace),qe=s.convert(gt.type),Ke=C(gt.internalFormat,St,qe,gt.normalized,gt.colorSpace);xn(X)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Qt(X),Ke,X.width,X.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,Qt(X),Ke,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,Ke,X.width,X.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,X,Te){let Pe=X.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(X.depthTexture&&X.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ve=n.get(X.depthTexture);if(Ve.__renderTarget=X,(!Ve.__webglTexture||X.depthTexture.image.width!==X.width||X.depthTexture.image.height!==X.height)&&(X.depthTexture.image.width=X.width,X.depthTexture.image.height=X.height,X.depthTexture.needsUpdate=!0),Pe){if(Ve.__webglInit===void 0&&(Ve.__webglInit=!0,X.depthTexture.addEventListener("dispose",F)),Ve.__webglTexture===void 0){Ve.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ve.__webglTexture),mt(i.TEXTURE_CUBE_MAP,X.depthTexture);let Rt=s.convert(X.depthTexture.format),en=s.convert(X.depthTexture.type),Pt;X.depthTexture.format===ys?Pt=i.DEPTH_COMPONENT24:X.depthTexture.format===Qs&&(Pt=i.DEPTH24_STENCIL8);for(let Mt=0;Mt<6;Mt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Mt,0,Pt,X.width,X.height,0,Rt,en,null)}}else ae(X.depthTexture,0);let gt=Ve.__webglTexture,St=Qt(X),qe=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Ke=X.depthTexture.format===Qs?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(X.depthTexture.format===ys)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ke,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ke,qe,gt,0);else if(X.depthTexture.format===Qs)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ke,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ke,qe,gt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Xe(le){let X=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(X.__boundDepthTexture!==le.depthTexture){let Pe=le.depthTexture;if(X.__depthDisposeCallback&&X.__depthDisposeCallback(),Pe){let Ve=()=>{delete X.__boundDepthTexture,delete X.__depthDisposeCallback,Pe.removeEventListener("dispose",Ve)};Pe.addEventListener("dispose",Ve),X.__depthDisposeCallback=Ve}X.__boundDepthTexture=Pe}if(le.depthTexture&&!X.__autoAllocateDepthBuffer)if(Te)for(let Pe=0;Pe<6;Pe++)Gt(X.__webglFramebuffer[Pe],le,Pe);else{let Pe=le.texture.mipmaps;Pe&&Pe.length>0?Gt(X.__webglFramebuffer[0],le,0):Gt(X.__webglFramebuffer,le,0)}else if(Te){X.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[Pe]),X.__webglDepthbuffer[Pe]===void 0)X.__webglDepthbuffer[Pe]=i.createRenderbuffer(),un(X.__webglDepthbuffer[Pe],le,!1);else{let Ve=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=X.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,gt)}}else{let Pe=le.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer),X.__webglDepthbuffer===void 0)X.__webglDepthbuffer=i.createRenderbuffer(),un(X.__webglDepthbuffer,le,!1);else{let Ve=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=X.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,gt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function st(le,X,Te){let Pe=n.get(le);X!==void 0&&Ct(Pe.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&Xe(le)}function tt(le){let X=le.texture,Te=n.get(le),Pe=n.get(X);le.addEventListener("dispose",N);let Ve=le.textures,gt=le.isWebGLCubeRenderTarget===!0,St=Ve.length>1;if(St||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=X.version,o.memory.textures++),gt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(X.mipmaps&&X.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Ke=0;Ke<X.mipmaps.length;Ke++)Te.__webglFramebuffer[qe][Ke]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(X.mipmaps&&X.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<X.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(St)for(let qe=0,Ke=Ve.length;qe<Ke;qe++){let Rt=n.get(Ve[qe]);Rt.__webglTexture===void 0&&(Rt.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&xn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ve.length;qe++){let Ke=Ve[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let Rt=s.convert(Ke.format,Ke.colorSpace),en=s.convert(Ke.type),Pt=C(Ke.internalFormat,Rt,en,Ke.normalized,Ke.colorSpace,le.isXRRenderTarget===!0),Mt=Qt(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Mt,Pt,le.width,le.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+qe,i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe])}i.bindRenderbuffer(i.RENDERBUFFER,null),le.depthBuffer&&(Te.__webglDepthRenderbuffer=i.createRenderbuffer(),un(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(gt){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),mt(i.TEXTURE_CUBE_MAP,X);for(let qe=0;qe<6;qe++)if(X.mipmaps&&X.mipmaps.length>0)for(let Ke=0;Ke<X.mipmaps.length;Ke++)Ct(Te.__webglFramebuffer[qe][Ke],le,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Ke);else Ct(Te.__webglFramebuffer[qe],le,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(X)&&P(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(St){for(let qe=0,Ke=Ve.length;qe<Ke;qe++){let Rt=Ve[qe],en=n.get(Rt),Pt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Pt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Pt,en.__webglTexture),mt(Pt,Rt),Ct(Te.__webglFramebuffer,le,Rt,i.COLOR_ATTACHMENT0+qe,Pt,0),T(Rt)&&P(Pt)}t.unbindTexture()}else{let qe=i.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(qe=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(qe,Pe.__webglTexture),mt(qe,X),X.mipmaps&&X.mipmaps.length>0)for(let Ke=0;Ke<X.mipmaps.length;Ke++)Ct(Te.__webglFramebuffer[Ke],le,X,i.COLOR_ATTACHMENT0,qe,Ke);else Ct(Te.__webglFramebuffer,le,X,i.COLOR_ATTACHMENT0,qe,0);T(X)&&P(qe),t.unbindTexture()}le.depthBuffer&&Xe(le)}function vt(le){let X=le.textures;for(let Te=0,Pe=X.length;Te<Pe;Te++){let Ve=X[Te];if(T(Ve)){let gt=R(le),St=n.get(Ve).__webglTexture;t.bindTexture(gt,St),P(gt),t.unbindTexture()}}}let yt=[],ln=[];function Kt(le){if(le.samples>0){if(xn(le)===!1){let X=le.textures,Te=le.width,Pe=le.height,Ve=i.COLOR_BUFFER_BIT,gt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,St=n.get(le),qe=X.length>1;if(qe)for(let Rt=0;Rt<X.length;Rt++)t.bindFramebuffer(i.FRAMEBUFFER,St.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,St.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,St.__webglMultisampledFramebuffer);let Ke=le.texture.mipmaps;Ke&&Ke.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglFramebuffer);for(let Rt=0;Rt<X.length;Rt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ve|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ve|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,St.__webglColorRenderbuffer[Rt]);let en=n.get(X[Rt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,en,0)}i.blitFramebuffer(0,0,Te,Pe,0,0,Te,Pe,Ve,i.NEAREST),l===!0&&(yt.length=0,ln.length=0,yt.push(i.COLOR_ATTACHMENT0+Rt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(gt),ln.push(gt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ln)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let Rt=0;Rt<X.length;Rt++){t.bindFramebuffer(i.FRAMEBUFFER,St.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.RENDERBUFFER,St.__webglColorRenderbuffer[Rt]);let en=n.get(X[Rt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,St.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.TEXTURE_2D,en,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let X=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[X])}}}function Qt(le){return Math.min(r.maxSamples,le.samples)}function xn(le){let X=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&X.__useRenderToTexture!==!1}function ge(le){let X=o.render.frame;u.get(le)!==X&&(u.set(le,X),le.update())}function di(le,X){let Te=le.colorSpace,Pe=le.format,Ve=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==Gd&&Te!==Vo&&(sn.getTransfer(Te)===Bt?(Pe!==xr||Ve!==Gi)&&je("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",Te)),X}function On(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=K,this.resetTextureUnits=Z,this.getTextureUnits=J,this.setTextureUnits=j,this.setTexture2D=ae,this.setTexture2DArray=ce,this.setTexture3D=de,this.setTextureCube=ve,this.rebindTextures=st,this.setupRenderTarget=tt,this.updateRenderTargetMipmap=vt,this.updateMultisampleRenderTarget=Kt,this.setupDepthRenderbuffer=Xe,this.setupFrameBufferTexture=Ct,this.useMultisampledRTT=xn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Wpe(i,e){function t(n,r=Vo){let s,o=sn.getTransfer(r);if(n===Gi)return i.UNSIGNED_BYTE;if(n===IA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===NA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===LA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===DA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Wu)return i.BYTE;if(n===ju)return i.SHORT;if(n===Wa)return i.UNSIGNED_SHORT;if(n===Ir)return i.INT;if(n===pi)return i.UNSIGNED_INT;if(n===Yi)return i.FLOAT;if(n===Li)return i.HALF_FLOAT;if(n===S_)return i.ALPHA;if(n===Nf)return i.RGB;if(n===xr)return i.RGBA;if(n===ys)return i.DEPTH_COMPONENT;if(n===Qs)return i.DEPTH_STENCIL;if(n===Lf)return i.RED;if(n===Xu)return i.RED_INTEGER;if(n===Ss)return i.RG;if(n===$u)return i.RG_INTEGER;if(n===ip)return i.RGBA_INTEGER;if(n===Yu||n===Zu||n===Ku||n===Qu)if(o===Bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Yu)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Zu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ku)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Yu)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Zu)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ku)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Qu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===FA||n===OA||n===BA||n===UA)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===FA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===OA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===BA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===UA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===rp||n===sp||n===op||n===ap||n===lp||n===Ju||n===cp)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===rp||n===sp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===op)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ap)return s.COMPRESSED_R11_EAC;if(n===lp)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Ju)return s.COMPRESSED_RG11_EAC;if(n===cp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===up||n===hp||n===fp||n===dp||n===pp||n===Ap||n===mp||n===gp||n===_p||n===xp||n===yp||n===vp||n===bp||n===wp)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===up)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===hp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ap)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Sp||n===Tp||n===Ep)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Sp)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Tp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ep)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Mp||n===Cp||n===eh||n===Rp)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Mp)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Cp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===eh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Rp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===zo?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var jpe=`40934093 void main() {40944094 40954095 gl_Position = vec4( position, 1.0 );40964096 4097-}`,Hpe=`4097+}`,Xpe=`40984098 uniform sampler2DArray depthColor;40994099 uniform float depthWidth;41004100 uniform float depthHeight;
@@ -4113,23 +4113,23 @@ void main() {
41134113 41144114 }41154115 4116-}`,BL=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new vy(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new jr({vertexShader:qpe,fragmentShader:Hpe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new wA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},UL=class extends ko{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,p=null,x=null,v=null,w=typeof XRWebGLBinding<"u",S=new BL,T={},P=t.getContextAttributes(),R=null,C=null,L=[],D=[],F=new Oe,N=null,B=new Rr;B.viewport=new gn;let z=new Rr;z.viewport=new gn;let V=[B,z],H=new v_,K=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Me){let ze=L[Me];return ze===void 0&&(ze=new qd,L[Me]=ze),ze.getTargetRaySpace()},this.getControllerGrip=function(Me){let ze=L[Me];return ze===void 0&&(ze=new qd,L[Me]=ze),ze.getGripSpace()},this.getHand=function(Me){let ze=L[Me];return ze===void 0&&(ze=new qd,L[Me]=ze),ze.getHandSpace()};function j(Me){let ze=D.indexOf(Me.inputSource);if(ze===-1)return;let $e=L[ze];$e!==void 0&&($e.update(Me.inputSource,Me.frame,c||o),$e.dispatchEvent({type:Me.type,data:Me.inputSource}))}function Z(){r.removeEventListener("select",j),r.removeEventListener("selectstart",j),r.removeEventListener("selectend",j),r.removeEventListener("squeeze",j),r.removeEventListener("squeezestart",j),r.removeEventListener("squeezeend",j),r.removeEventListener("end",Z),r.removeEventListener("inputsourceschange",ee);for(let Me=0;Me<L.length;Me++){let ze=D[Me];ze!==null&&(D[Me]=null,L[Me].disconnect(ze))}K=null,J=null,S.reset();for(let Me in T)delete T[Me];e.setRenderTarget(R),x=null,p=null,f=null,r=null,C=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(N),e.setSize(F.width,F.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Me){s=Me,n.isPresenting===!0&&je("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Me){a=Me,n.isPresenting===!0&&je("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Me){c=Me},this.getBaseLayer=function(){return p!==null?p:x},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(Me){if(r=Me,r!==null){if(R=e.getRenderTarget(),r.addEventListener("select",j),r.addEventListener("selectstart",j),r.addEventListener("selectend",j),r.addEventListener("squeeze",j),r.addEventListener("squeezestart",j),r.addEventListener("squeezeend",j),r.addEventListener("end",Z),r.addEventListener("inputsourceschange",ee),P.xrCompatible!==!0&&await t.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(F),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let $e=null,Et=null,Tt=null;P.depth&&(Tt=P.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,$e=P.stencil?Qs:xs,Et=P.stencil?Go:pi);let Ct={colorFormat:t.RGBA8,depthFormat:Tt,scaleFactor:s};f=this.getBinding(),p=f.createProjectionLayer(Ct),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),C=new ca(p.textureWidth,p.textureHeight,{format:xr,type:Gi,depthTexture:new ss(p.textureWidth,p.textureHeight,Et,void 0,void 0,void 0,void 0,void 0,void 0,$e),stencilBuffer:P.stencil,colorSpace:e.outputColorSpace,samples:P.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{let $e={antialias:P.antialias,alpha:!0,depth:P.depth,stencil:P.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(r,t,$e),r.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),C=new ca(x.framebufferWidth,x.framebufferHeight,{format:xr,type:Gi,colorSpace:e.outputColorSpace,stencilBuffer:P.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}C.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),mt.setContext(r),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function ee(Me){for(let ze=0;ze<Me.removed.length;ze++){let $e=Me.removed[ze],Et=D.indexOf($e);Et>=0&&(D[Et]=null,L[Et].disconnect($e))}for(let ze=0;ze<Me.added.length;ze++){let $e=Me.added[ze],Et=D.indexOf($e);if(Et===-1){for(let Ct=0;Ct<L.length;Ct++)if(Ct>=D.length){D.push($e),Et=Ct;break}else if(D[Ct]===null){D[Ct]=$e,Et=Ct;break}if(Et===-1)break}let Tt=L[Et];Tt&&Tt.connect($e)}}let ae=new ie,ce=new ie;function de(Me,ze,$e){ae.setFromMatrixPosition(ze.matrixWorld),ce.setFromMatrixPosition($e.matrixWorld);let Et=ae.distanceTo(ce),Tt=ze.projectionMatrix.elements,Ct=$e.projectionMatrix.elements,un=Tt[14]/(Tt[10]-1),Gt=Tt[14]/(Tt[10]+1),Xe=(Tt[9]+1)/Tt[5],st=(Tt[9]-1)/Tt[5],tt=(Tt[8]-1)/Tt[0],vt=(Ct[8]+1)/Ct[0],yt=un*tt,ln=un*vt,Zt=Et/(-tt+vt),Qt=Zt*-tt;if(ze.matrixWorld.decompose(Me.position,Me.quaternion,Me.scale),Me.translateX(Qt),Me.translateZ(Zt),Me.matrixWorld.compose(Me.position,Me.quaternion,Me.scale),Me.matrixWorldInverse.copy(Me.matrixWorld).invert(),Tt[10]===-1)Me.projectionMatrix.copy(ze.projectionMatrix),Me.projectionMatrixInverse.copy(ze.projectionMatrixInverse);else{let xn=un+Zt,ge=Gt+Zt,di=yt-Qt,On=ln+(Et-Qt),le=Xe*Gt/ge*xn,X=st*Gt/ge*xn;Me.projectionMatrix.makePerspective(di,On,le,X,xn,ge),Me.projectionMatrixInverse.copy(Me.projectionMatrix).invert()}}function ve(Me,ze){ze===null?Me.matrixWorld.copy(Me.matrix):Me.matrixWorld.multiplyMatrices(ze.matrixWorld,Me.matrix),Me.matrixWorldInverse.copy(Me.matrixWorld).invert()}this.updateCamera=function(Me){if(r===null)return;let ze=Me.near,$e=Me.far;S.texture!==null&&(S.depthNear>0&&(ze=S.depthNear),S.depthFar>0&&($e=S.depthFar)),H.near=z.near=B.near=ze,H.far=z.far=B.far=$e,(K!==H.near||J!==H.far)&&(r.updateRenderState({depthNear:H.near,depthFar:H.far}),K=H.near,J=H.far),H.layers.mask=Me.layers.mask|6,B.layers.mask=H.layers.mask&-5,z.layers.mask=H.layers.mask&-3;let Et=Me.parent,Tt=H.cameras;ve(H,Et);for(let Ct=0;Ct<Tt.length;Ct++)ve(Tt[Ct],Et);Tt.length===2?de(H,B,z):H.projectionMatrix.copy(B.projectionMatrix),Ie(Me,H,Et)};function Ie(Me,ze,$e){$e===null?Me.matrix.copy(ze.matrixWorld):(Me.matrix.copy($e.matrixWorld),Me.matrix.invert(),Me.matrix.multiply(ze.matrixWorld)),Me.matrix.decompose(Me.position,Me.quaternion,Me.scale),Me.updateMatrixWorld(!0),Me.projectionMatrix.copy(ze.projectionMatrix),Me.projectionMatrixInverse.copy(ze.projectionMatrixInverse),Me.isPerspectiveCamera&&(Me.fov=Ef*2*Math.atan(1/Me.projectionMatrix.elements[5]),Me.zoom=1)}this.getCamera=function(){return H},this.getFoveation=function(){if(!(p===null&&x===null))return l},this.setFoveation=function(Me){l=Me,p!==null&&(p.fixedFoveation=Me),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=Me)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(H)},this.getCameraTexture=function(Me){return T[Me]};let Qe=null;function Ue(Me,ze){if(u=ze.getViewerPose(c||o),v=ze,u!==null){let $e=u.views;x!==null&&(e.setRenderTargetFramebuffer(C,x.framebuffer),e.setRenderTarget(C));let Et=!1;$e.length!==H.cameras.length&&(H.cameras.length=0,Et=!0);for(let Gt=0;Gt<$e.length;Gt++){let Xe=$e[Gt],st=null;if(x!==null)st=x.getViewport(Xe);else{let vt=f.getViewSubImage(p,Xe);st=vt.viewport,Gt===0&&(e.setRenderTargetTextures(C,vt.colorTexture,vt.depthStencilTexture),e.setRenderTarget(C))}let tt=V[Gt];tt===void 0&&(tt=new Rr,tt.layers.enable(Gt),tt.viewport=new gn,V[Gt]=tt),tt.matrix.fromArray(Xe.transform.matrix),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.projectionMatrix.fromArray(Xe.projectionMatrix),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert(),tt.viewport.set(st.x,st.y,st.width,st.height),Gt===0&&(H.matrix.copy(tt.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale)),Et===!0&&H.cameras.push(tt)}let Tt=r.enabledFeatures;if(Tt&&Tt.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation($e[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Tt&&Tt.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<$e.length;Gt++){let Xe=$e[Gt].camera;if(Xe){let st=T[Xe];st||(st=new vy,T[Xe]=st);let tt=f.getCameraImage(Xe);st.sourceTexture=tt}}}}for(let $e=0;$e<L.length;$e++){let Et=D[$e],Tt=L[$e];Et!==null&&Tt!==void 0&&Tt.update(Et,ze,c||o)}Qe&&Qe(Me,ze),ze.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ze}),v=null}let mt=new vW;mt.setAnimationLoop(Ue),this.setAnimationLoop=function(Me){Qe=Me},this.dispose=function(){}}},Wpe=new on,MW=new Sn;MW.set(-1,0,0,0,1,0,0,0,1);function jpe(i,e){function t(S,T){S.matrixAutoUpdate===!0&&S.updateMatrix(),T.value.copy(S.matrix)}function n(S,T){T.color.getRGB(S.fogColor.value,mL(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,P,R,C){T.isNodeMaterial?T.uniformsNeedUpdate=!1:T.isMeshBasicMaterial?s(S,T):T.isMeshLambertMaterial?(s(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshToonMaterial?(s(S,T),f(S,T)):T.isMeshPhongMaterial?(s(S,T),u(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshStandardMaterial?(s(S,T),p(S,T),T.isMeshPhysicalMaterial&&x(S,T,C)):T.isMeshMatcapMaterial?(s(S,T),v(S,T)):T.isMeshDepthMaterial?s(S,T):T.isMeshDistanceMaterial?(s(S,T),w(S,T)):T.isMeshNormalMaterial?s(S,T):T.isLineBasicMaterial?(o(S,T),T.isLineDashedMaterial&&a(S,T)):T.isPointsMaterial?l(S,T,P,R):T.isSpriteMaterial?c(S,T):T.isShadowMaterial?(S.color.value.copy(T.color),S.opacity.value=T.opacity):T.isShaderMaterial&&(T.uniformsNeedUpdate=!1)}function s(S,T){S.opacity.value=T.opacity,T.color&&S.diffuse.value.copy(T.color),T.emissive&&S.emissive.value.copy(T.emissive).multiplyScalar(T.emissiveIntensity),T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.bumpMap&&(S.bumpMap.value=T.bumpMap,t(T.bumpMap,S.bumpMapTransform),S.bumpScale.value=T.bumpScale,T.side===ui&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===ui&&S.normalScale.value.negate()),T.displacementMap&&(S.displacementMap.value=T.displacementMap,t(T.displacementMap,S.displacementMapTransform),S.displacementScale.value=T.displacementScale,S.displacementBias.value=T.displacementBias),T.emissiveMap&&(S.emissiveMap.value=T.emissiveMap,t(T.emissiveMap,S.emissiveMapTransform)),T.specularMap&&(S.specularMap.value=T.specularMap,t(T.specularMap,S.specularMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest);let P=e.get(T),R=P.envMap,C=P.envMapRotation;R&&(S.envMap.value=R,S.envMapRotation.value.setFromMatrix4(Wpe.makeRotationFromEuler(C)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(MW),S.reflectivity.value=T.reflectivity,S.ior.value=T.ior,S.refractionRatio.value=T.refractionRatio),T.lightMap&&(S.lightMap.value=T.lightMap,S.lightMapIntensity.value=T.lightMapIntensity,t(T.lightMap,S.lightMapTransform)),T.aoMap&&(S.aoMap.value=T.aoMap,S.aoMapIntensity.value=T.aoMapIntensity,t(T.aoMap,S.aoMapTransform))}function o(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform))}function a(S,T){S.dashSize.value=T.dashSize,S.totalSize.value=T.dashSize+T.gapSize,S.scale.value=T.scale}function l(S,T,P,R){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*P,S.scale.value=R*.5,T.map&&(S.map.value=T.map,t(T.map,S.uvTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function c(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.rotation.value=T.rotation,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function u(S,T){S.specular.value.copy(T.specular),S.shininess.value=Math.max(T.shininess,1e-4)}function f(S,T){T.gradientMap&&(S.gradientMap.value=T.gradientMap)}function p(S,T){S.metalness.value=T.metalness,T.metalnessMap&&(S.metalnessMap.value=T.metalnessMap,t(T.metalnessMap,S.metalnessMapTransform)),S.roughness.value=T.roughness,T.roughnessMap&&(S.roughnessMap.value=T.roughnessMap,t(T.roughnessMap,S.roughnessMapTransform)),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)}function x(S,T,P){S.ior.value=T.ior,T.sheen>0&&(S.sheenColor.value.copy(T.sheenColor).multiplyScalar(T.sheen),S.sheenRoughness.value=T.sheenRoughness,T.sheenColorMap&&(S.sheenColorMap.value=T.sheenColorMap,t(T.sheenColorMap,S.sheenColorMapTransform)),T.sheenRoughnessMap&&(S.sheenRoughnessMap.value=T.sheenRoughnessMap,t(T.sheenRoughnessMap,S.sheenRoughnessMapTransform))),T.clearcoat>0&&(S.clearcoat.value=T.clearcoat,S.clearcoatRoughness.value=T.clearcoatRoughness,T.clearcoatMap&&(S.clearcoatMap.value=T.clearcoatMap,t(T.clearcoatMap,S.clearcoatMapTransform)),T.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=T.clearcoatRoughnessMap,t(T.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),T.clearcoatNormalMap&&(S.clearcoatNormalMap.value=T.clearcoatNormalMap,t(T.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(T.clearcoatNormalScale),T.side===ui&&S.clearcoatNormalScale.value.negate())),T.dispersion>0&&(S.dispersion.value=T.dispersion),T.iridescence>0&&(S.iridescence.value=T.iridescence,S.iridescenceIOR.value=T.iridescenceIOR,S.iridescenceThicknessMinimum.value=T.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=T.iridescenceThicknessRange[1],T.iridescenceMap&&(S.iridescenceMap.value=T.iridescenceMap,t(T.iridescenceMap,S.iridescenceMapTransform)),T.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=T.iridescenceThicknessMap,t(T.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),T.transmission>0&&(S.transmission.value=T.transmission,S.transmissionSamplerMap.value=P.texture,S.transmissionSamplerSize.value.set(P.width,P.height),T.transmissionMap&&(S.transmissionMap.value=T.transmissionMap,t(T.transmissionMap,S.transmissionMapTransform)),S.thickness.value=T.thickness,T.thicknessMap&&(S.thicknessMap.value=T.thicknessMap,t(T.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=T.attenuationDistance,S.attenuationColor.value.copy(T.attenuationColor)),T.anisotropy>0&&(S.anisotropyVector.value.set(T.anisotropy*Math.cos(T.anisotropyRotation),T.anisotropy*Math.sin(T.anisotropyRotation)),T.anisotropyMap&&(S.anisotropyMap.value=T.anisotropyMap,t(T.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=T.specularIntensity,S.specularColor.value.copy(T.specularColor),T.specularColorMap&&(S.specularColorMap.value=T.specularColorMap,t(T.specularColorMap,S.specularColorMapTransform)),T.specularIntensityMap&&(S.specularIntensityMap.value=T.specularIntensityMap,t(T.specularIntensityMap,S.specularIntensityMapTransform))}function v(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let P=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(P.matrixWorld),S.nearDistance.value=P.shadow.camera.near,S.farDistance.value=P.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Xpe(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(C,L){let D=L.program;n.uniformBlockBinding(C,D)}function c(C,L){let D=r[C.id];D===void 0&&(S(C),D=u(C),r[C.id]=D,C.addEventListener("dispose",P));let F=L.program;n.updateUBOMapping(C,F);let N=e.render.frame;s[C.id]!==N&&(p(C),s[C.id]=N)}function u(C){let L=f();C.__bindingPointIndex=L;let D=i.createBuffer(),F=C.__size,N=C.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,F,N),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,L,D),D}function f(){for(let C=0;C<a;C++)if(o.indexOf(C)===-1)return o.push(C),C;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(C){let L=r[C.id],D=C.uniforms,F=C.__cache;i.bindBuffer(i.UNIFORM_BUFFER,L);for(let N=0,B=D.length;N<B;N++){let z=D[N];if(Array.isArray(z))for(let V=0,H=z.length;V<H;V++)x(z[V],N,V,F);else x(z,N,0,F)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function x(C,L,D,F){if(w(C,L,D,F)===!0){let N=C.__offset,B=C.value;if(Array.isArray(B)){let z=0;for(let V=0;V<B.length;V++){let H=B[V],K=T(H);v(H,C.__data,z),typeof H!="number"&&typeof H!="boolean"&&!H.isMatrix3&&!ArrayBuffer.isView(H)&&(z+=K.storage/Float32Array.BYTES_PER_ELEMENT)}}else v(B,C.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,N,C.__data)}}function v(C,L,D){typeof C=="number"||typeof C=="boolean"?L[0]=C:C.isMatrix3?(L[0]=C.elements[0],L[1]=C.elements[1],L[2]=C.elements[2],L[3]=0,L[4]=C.elements[3],L[5]=C.elements[4],L[6]=C.elements[5],L[7]=0,L[8]=C.elements[6],L[9]=C.elements[7],L[10]=C.elements[8],L[11]=0):ArrayBuffer.isView(C)?L.set(new C.constructor(C.buffer,C.byteOffset,L.length)):C.toArray(L,D)}function w(C,L,D,F){let N=C.value,B=L+"_"+D;if(F[B]===void 0)return typeof N=="number"||typeof N=="boolean"?F[B]=N:ArrayBuffer.isView(N)?F[B]=N.slice():F[B]=N.clone(),!0;{let z=F[B];if(typeof N=="number"||typeof N=="boolean"){if(z!==N)return F[B]=N,!0}else{if(ArrayBuffer.isView(N))return!0;if(z.equals(N)===!1)return z.copy(N),!0}}return!1}function S(C){let L=C.uniforms,D=0,F=16;for(let B=0,z=L.length;B<z;B++){let V=Array.isArray(L[B])?L[B]:[L[B]];for(let H=0,K=V.length;H<K;H++){let J=V[H],j=Array.isArray(J.value)?J.value:[J.value];for(let Z=0,ee=j.length;Z<ee;Z++){let ae=j[Z],ce=T(ae),de=D%F,ve=de%ce.boundary,Ie=de+ve;D+=ve,Ie!==0&&F-Ie<ce.storage&&(D+=F-Ie),J.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=D,D+=ce.storage}}}let N=D%F;return N>0&&(D+=F-N),C.__size=D,C.__cache={},this}function T(C){let L={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(L.boundary=4,L.storage=4):C.isVector2?(L.boundary=8,L.storage=8):C.isVector3||C.isColor?(L.boundary=16,L.storage=12):C.isVector4?(L.boundary=16,L.storage=16):C.isMatrix3?(L.boundary=48,L.storage=48):C.isMatrix4?(L.boundary=64,L.storage=64):C.isTexture?je("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(C)?(L.boundary=16,L.storage=C.byteLength):je("WebGLRenderer: Unsupported uniform value type.",C),L}function P(C){let L=C.target;L.removeEventListener("dispose",P);let D=o.indexOf(L.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function R(){for(let C in r)i.deleteBuffer(r[C]);o=[],r={},s={}}return{bind:l,update:c,dispose:R}}var $pe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),nh=null;function Ype(){return nh===null&&(nh=new _A($pe,16,16,ws,Li),nh.name="DFG_LUT",nh.minFilter=vi,nh.magFilter=vi,nh.wrapS=Uo,nh.wrapT=Uo,nh.generateMipmaps=!1,nh.needsUpdate=!0),nh}var JT=class{constructor(e={}){let{canvas:t=$T(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:p=!1,outputBufferType:x=Gi}=e;this.isWebGLRenderer=!0;let v;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");v=n.getContextAttributes().alpha}else v=o;let w=x,S=new Set([ip,$u,Xu]),T=new Set([Gi,pi,Ha,Go,PA,IA]),P=new Uint32Array(4),R=new Int32Array(4),C=new ie,L=null,D=null,F=[],N=[],B=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ks,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let z=this,V=!1,H=null,K=null,J=null,j=null;this._outputColorSpace=Wr;let Z=0,ee=0,ae=null,ce=-1,de=null,ve=new gn,Ie=new gn,Qe=null,Ue=new Ut(0),mt=0,Me=t.width,ze=t.height,$e=1,Et=null,Tt=null,Ct=new gn(0,0,Me,ze),un=new gn(0,0,Me,ze),Gt=!1,Xe=new Kl,st=!1,tt=!1,vt=new on,yt=new ie,ln=new gn,Zt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Qt=!1;function xn(){return ae===null?$e:1}let ge=n;function di(te,Se){return t.getContext(te,Se)}try{let te={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"185"}`),t.addEventListener("webglcontextlost",qi,!1),t.addEventListener("webglcontextrestored",In,!1),t.addEventListener("webglcontextcreationerror",Ur,!1),ge===null){let Se="webgl2";if(ge=di(Se,te),ge===null)throw di(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(te){throw Ge("WebGLRenderer: "+te.message),te}let On,le,X,Te,Pe,Ve,gt,St,qe,Ze,Rt,en,Pt,Mt,cn,yn,Rn,xe,bt,Ye,wt,Dt,ct;function Ce(){On=new nde(ge),On.init(),wt=new Vpe(ge,On),le=new $fe(ge,On,e,wt),X=new Gpe(ge,On),le.reversedDepthBuffer&&p&&X.buffers.depth.setReversed(!0),K=ge.createFramebuffer(),J=ge.createFramebuffer(),j=ge.createFramebuffer(),Te=new sde(ge),Pe=new Epe,Ve=new zpe(ge,On,X,Pe,le,wt,Te),gt=new tde(z),St=new cue(ge),Dt=new jfe(ge,St),qe=new ide(ge,St,Te,Dt),Ze=new ade(ge,qe,St,Dt,Te),xe=new ode(ge,le,Ve),cn=new Yfe(Pe),Rt=new Tpe(z,gt,On,le,Dt,cn),en=new jpe(z,Pe),Pt=new Cpe,Mt=new Dpe(On),Rn=new Wfe(z,gt,X,Ze,v,l),yn=new kpe(z,Ze,le),ct=new Xpe(ge,Te,le,X),bt=new Xfe(ge,On,Te),Ye=new rde(ge,On,Te),Te.programs=Rt.programs,z.capabilities=le,z.extensions=On,z.properties=Pe,z.renderLists=Pt,z.shadowMap=yn,z.state=X,z.info=Te}Ce(),w!==Gi&&(B=new cde(w,t.width,t.height,a,r,s));let jt=new UL(z,ge);this.xr=jt,this.getContext=function(){return ge},this.getContextAttributes=function(){return ge.getContextAttributes()},this.forceContextLoss=function(){let te=On.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){let te=On.get("WEBGL_lose_context");te&&te.restoreContext()},this.getPixelRatio=function(){return $e},this.setPixelRatio=function(te){te!==void 0&&($e=te,this.setSize(Me,ze,!1))},this.getSize=function(te){return te.set(Me,ze)},this.setSize=function(te,Se,ke=!0){if(jt.isPresenting){je("WebGLRenderer: Can't change size while VR device is presenting.");return}Me=te,ze=Se,t.width=Math.floor(te*$e),t.height=Math.floor(Se*$e),ke===!0&&(t.style.width=te+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,te,Se)},this.getDrawingBufferSize=function(te){return te.set(Me*$e,ze*$e).floor()},this.setDrawingBufferSize=function(te,Se,ke){Me=te,ze=Se,$e=ke,t.width=Math.floor(te*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,te,Se)},this.setEffects=function(te){if(w===Gi){Ge("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(te){for(let Se=0;Se<te.length;Se++)if(te[Se].isOutputPass===!0){je("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(te||[])},this.getCurrentViewport=function(te){return te.copy(ve)},this.getViewport=function(te){return te.copy(Ct)},this.setViewport=function(te,Se,ke,Le){te.isVector4?Ct.set(te.x,te.y,te.z,te.w):Ct.set(te,Se,ke,Le),X.viewport(ve.copy(Ct).multiplyScalar($e).round())},this.getScissor=function(te){return te.copy(un)},this.setScissor=function(te,Se,ke,Le){te.isVector4?un.set(te.x,te.y,te.z,te.w):un.set(te,Se,ke,Le),X.scissor(Ie.copy(un).multiplyScalar($e).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(te){X.setScissorTest(Gt=te)},this.setOpaqueSort=function(te){Et=te},this.setTransparentSort=function(te){Tt=te},this.getClearColor=function(te){return te.copy(Rn.getClearColor())},this.setClearColor=function(){Rn.setClearColor(...arguments)},this.getClearAlpha=function(){return Rn.getClearAlpha()},this.setClearAlpha=function(){Rn.setClearAlpha(...arguments)},this.clear=function(te=!0,Se=!0,ke=!0){let Le=0;if(te){let De=!1;if(ae!==null){let zt=ae.texture.format;De=S.has(zt)}if(De){let zt=ae.texture.type,Yt=T.has(zt),kt=Rn.getClearColor(),tn=Rn.getClearAlpha(),hn=kt.r,Gn=kt.g,Xn=kt.b;Yt?(P[0]=hn,P[1]=Gn,P[2]=Xn,P[3]=tn,ge.clearBufferuiv(ge.COLOR,0,P)):(R[0]=hn,R[1]=Gn,R[2]=Xn,R[3]=tn,ge.clearBufferiv(ge.COLOR,0,R))}else Le|=ge.COLOR_BUFFER_BIT}Se&&(Le|=ge.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(Le|=ge.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Le!==0&&ge.clear(Le)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(te){te.setRenderer(this),H=te},this.dispose=function(){t.removeEventListener("webglcontextlost",qi,!1),t.removeEventListener("webglcontextrestored",In,!1),t.removeEventListener("webglcontextcreationerror",Ur,!1),Rn.dispose(),Pt.dispose(),Mt.dispose(),Pe.dispose(),gt.dispose(),Ze.dispose(),Dt.dispose(),ct.dispose(),Rt.dispose(),jt.dispose(),jt.removeEventListener("sessionstart",Rs),jt.removeEventListener("sessionend",rl),hu.stop()};function qi(te){te.preventDefault(),pA("WebGLRenderer: Context Lost."),V=!0}function In(){pA("WebGLRenderer: Context Restored."),V=!1;let te=Te.autoReset,Se=yn.enabled,ke=yn.autoUpdate,Le=yn.needsUpdate,De=yn.type;Ce(),Te.autoReset=te,yn.enabled=Se,yn.autoUpdate=ke,yn.needsUpdate=Le,yn.type=De}function Ur(te){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function mr(te){let Se=te.target;Se.removeEventListener("dispose",mr),nl(Se)}function nl(te){ea(te),Pe.remove(te)}function ea(te){let Se=Pe.get(te).programs;Se!==void 0&&(Se.forEach(function(ke){Rt.releaseProgram(ke)}),te.isShaderMaterial&&Rt.releaseShaderCache(te))}this.renderBufferDirect=function(te,Se,ke,Le,De,zt){Se===null&&(Se=Zt);let Yt=De.isMesh&&De.matrixWorld.determinantAffine()<0,kt=Bk(te,Se,ke,Le,De);X.setMaterial(Le,Yt);let tn=ke.index,hn=1;if(Le.wireframe===!0){if(tn=qe.getWireframeAttribute(ke),tn===void 0)return;hn=2}let Gn=ke.drawRange,Xn=ke.attributes.position,pn=Gn.start*hn,Bi=(Gn.start+Gn.count)*hn;zt!==null&&(pn=Math.max(pn,zt.start*hn),Bi=Math.min(Bi,(zt.start+zt.count)*hn)),tn!==null?(pn=Math.max(pn,0),Bi=Math.min(Bi,tn.count)):Xn!=null&&(pn=Math.max(pn,0),Bi=Math.min(Bi,Xn.count));let kr=Bi-pn;if(kr<0||kr===1/0)return;Dt.setup(De,Le,kt,ke,tn);let Tr,Hi=bt;if(tn!==null&&(Tr=St.get(tn),Hi=Ye,Hi.setIndex(Tr)),De.isMesh)Le.wireframe===!0?(X.setLineWidth(Le.wireframeLinewidth*xn()),Hi.setMode(ge.LINES)):Hi.setMode(ge.TRIANGLES);else if(De.isLine){let so=Le.linewidth;so===void 0&&(so=1),X.setLineWidth(so*xn()),De.isLineSegments?Hi.setMode(ge.LINES):De.isLineLoop?Hi.setMode(ge.LINE_LOOP):Hi.setMode(ge.LINE_STRIP)}else De.isPoints?Hi.setMode(ge.POINTS):De.isSprite&&Hi.setMode(ge.TRIANGLES);if(De.isBatchedMesh)if(On.get("WEBGL_multi_draw"))Hi.renderMultiDraw(De._multiDrawStarts,De._multiDrawCounts,De._multiDrawCount);else{let so=De._multiDrawStarts,Xt=De._multiDrawCounts,Ia=De._multiDrawCount,Ai=tn?St.get(tn).bytesPerElement:1,sl=Pe.get(Le).currentProgram.getUniforms();for(let gc=0;gc<Ia;gc++)sl.setValue(ge,"_gl_DrawID",gc),Hi.render(so[gc]/Ai,Xt[gc])}else if(De.isInstancedMesh)Hi.renderInstances(pn,kr,De.count);else if(ke.isInstancedBufferGeometry){let so=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Xt=Math.min(ke.instanceCount,so);Hi.renderInstances(pn,kr,Xt)}else Hi.render(pn,kr)};function il(te,Se,ke){te.transparent===!0&&te.side===ir&&te.forceSinglePass===!1?(te.side=ui,te.needsUpdate=!0,Q1(te,Se,ke),te.side=Ao,te.needsUpdate=!0,Q1(te,Se,ke),te.side=ir):Q1(te,Se,ke)}this.compile=function(te,Se,ke=null){ke===null&&(ke=te),D=Mt.get(ke),D.init(Se),N.push(D),ke.traverseVisible(function(De){De.isLight&&De.layers.test(Se.layers)&&(D.pushLight(De),De.castShadow&&D.pushShadow(De))}),te!==ke&&te.traverseVisible(function(De){De.isLight&&De.layers.test(Se.layers)&&(D.pushLight(De),De.castShadow&&D.pushShadow(De))}),D.setupLights();let Le=new Set;return te.traverse(function(De){if(!(De.isMesh||De.isPoints||De.isLine||De.isSprite))return;let zt=De.material;if(zt)if(Array.isArray(zt))for(let Yt=0;Yt<zt.length;Yt++){let kt=zt[Yt];il(kt,ke,De),Le.add(kt)}else il(zt,ke,De),Le.add(zt)}),D=N.pop(),Le},this.compileAsync=function(te,Se,ke=null){let Le=this.compile(te,Se,ke);return new Promise(De=>{function zt(){if(Le.forEach(function(Yt){Pe.get(Yt).currentProgram.isReady()&&Le.delete(Yt)}),Le.size===0){De(te);return}setTimeout(zt,10)}On.get("KHR_parallel_shader_compile")!==null?zt():setTimeout(zt,10)})};let Pa=null;function sr(te){Pa&&Pa(te)}function Rs(){hu.stop()}function rl(){hu.start()}let hu=new vW;hu.setAnimationLoop(sr),typeof self<"u"&&hu.setContext(self),this.setAnimationLoop=function(te){Pa=te,jt.setAnimationLoop(te),te===null?hu.stop():hu.start()},jt.addEventListener("sessionstart",Rs),jt.addEventListener("sessionend",rl),this.render=function(te,Se){if(Se!==void 0&&Se.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;H!==null&&H.renderStart(te,Se);let ke=jt.enabled===!0&&jt.isPresenting===!0,Le=B!==null&&(ae===null||ke)&&B.begin(z,ae);if(te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),jt.enabled===!0&&jt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(jt.cameraAutoUpdate===!0&&jt.updateCamera(Se),Se=jt.getCamera()),te.isScene===!0&&te.onBeforeRender(z,te,Se,ae),D=Mt.get(te,N.length),D.init(Se),D.state.textureUnits=Ve.getTextureUnits(),N.push(D),vt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),Xe.setFromProjectionMatrix(vt,po,Se.reversedDepth),tt=this.localClippingEnabled,st=cn.init(this.clippingPlanes,tt),L=Pt.get(te,F.length),L.init(),F.push(L),jt.enabled===!0&&jt.isPresenting===!0){let Yt=z.xr.getDepthSensingMesh();Yt!==null&&Bb(Yt,Se,-1/0,z.sortObjects)}Bb(te,Se,0,z.sortObjects),L.finish(),z.sortObjects===!0&&L.sort(Et,Tt,Se.reversedDepth),Qt=jt.enabled===!1||jt.isPresenting===!1||jt.hasDepthSensing()===!1,Qt&&Rn.addToRenderList(L,te),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),st===!0&&cn.beginShadows();let De=D.state.shadowsArray;if(yn.render(De,te,Se),st===!0&&cn.endShadows(),(Le&&B.hasRenderPass())===!1){let Yt=L.opaque,kt=L.transmissive;if(D.setupLights(),Se.isArrayCamera){let tn=Se.cameras;if(kt.length>0)for(let hn=0,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn];ZR(Yt,kt,te,Xn)}Qt&&Rn.render(te);for(let hn=0,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn];KR(L,te,Xn,Xn.viewport)}}else kt.length>0&&ZR(Yt,kt,te,Se),Qt&&Rn.render(te),KR(L,te,Se)}ae!==null&&ee===0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),Le&&B.end(z),te.isScene===!0&&te.onAfterRender(z,te,Se),Dt.resetDefaultState(),ce=-1,de=null,N.pop(),N.length>0?(D=N[N.length-1],Ve.setTextureUnits(D.state.textureUnits),st===!0&&cn.setGlobalState(z.clippingPlanes,D.state.camera)):D=null,F.pop(),F.length>0?L=F[F.length-1]:L=null,H!==null&&H.renderEnd()};function Bb(te,Se,ke,Le){if(te.visible===!1)return;if(te.layers.test(Se.layers)){if(te.isGroup)ke=te.renderOrder;else if(te.isLOD)te.autoUpdate===!0&&te.update(Se);else if(te.isLightProbeGrid)D.pushLightProbeGrid(te);else if(te.isLight)D.pushLight(te),te.castShadow&&D.pushShadow(te);else if(te.isSprite){if(!te.frustumCulled||Xe.intersectsSprite(te)){Le&&ln.setFromMatrixPosition(te.matrixWorld).applyMatrix4(vt);let Yt=Ze.update(te),kt=te.material;kt.visible&&L.push(te,Yt,kt,ke,ln.z,null)}}else if((te.isMesh||te.isLine||te.isPoints)&&(!te.frustumCulled||Xe.intersectsObject(te))){let Yt=Ze.update(te),kt=te.material;if(Le&&(te.boundingSphere!==void 0?(te.boundingSphere===null&&te.computeBoundingSphere(),ln.copy(te.boundingSphere.center)):(Yt.boundingSphere===null&&Yt.computeBoundingSphere(),ln.copy(Yt.boundingSphere.center)),ln.applyMatrix4(te.matrixWorld).applyMatrix4(vt)),Array.isArray(kt)){let tn=Yt.groups;for(let hn=0,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn],pn=kt[Xn.materialIndex];pn&&pn.visible&&L.push(te,Yt,pn,ke,ln.z,Xn)}}else kt.visible&&L.push(te,Yt,kt,ke,ln.z,null)}}let zt=te.children;for(let Yt=0,kt=zt.length;Yt<kt;Yt++)Bb(zt[Yt],Se,ke,Le)}function KR(te,Se,ke,Le){let{opaque:De,transmissive:zt,transparent:Yt}=te;D.setupLightsView(ke),st===!0&&cn.setGlobalState(z.clippingPlanes,ke),Le&&X.viewport(ve.copy(Le)),De.length>0&&Z1(De,Se,ke),zt.length>0&&Z1(zt,Se,ke),Yt.length>0&&Z1(Yt,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function ZR(te,Se,ke,Le){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Le.id]===void 0){let pn=On.has("EXT_color_buffer_half_float")||On.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Le.id]=new ca(1,1,{generateMipmaps:!0,type:pn?Li:Gi,minFilter:go,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:sn.workingColorSpace})}let zt=D.state.transmissionRenderTarget[Le.id],Yt=Le.viewport||ve;zt.setSize(Yt.z*z.transmissionResolutionScale,Yt.w*z.transmissionResolutionScale);let kt=z.getRenderTarget(),tn=z.getActiveCubeFace(),hn=z.getActiveMipmapLevel();z.setRenderTarget(zt),z.getClearColor(Ue),mt=z.getClearAlpha(),mt<1&&z.setClearColor(16777215,.5),z.clear(),Qt&&Rn.render(ke);let Gn=z.toneMapping;z.toneMapping=ks;let Xn=Le.viewport;if(Le.viewport!==void 0&&(Le.viewport=void 0),D.setupLightsView(Le),st===!0&&cn.setGlobalState(z.clippingPlanes,Le),Z1(te,ke,Le),Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt),On.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let Bi=0,kr=Se.length;Bi<kr;Bi++){let Tr=Se[Bi],{object:Hi,geometry:so,material:Xt,group:Ia}=Tr;if(Xt.side===ir&&Hi.layers.test(Le.layers)){let Ai=Xt.side;Xt.side=ui,Xt.needsUpdate=!0,QR(Hi,ke,Le,so,Xt,Ia),Xt.side=Ai,Xt.needsUpdate=!0,pn=!0}}pn===!0&&(Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt))}z.setRenderTarget(kt,tn,hn),z.setClearColor(Ue,mt),Xn!==void 0&&(Le.viewport=Xn),z.toneMapping=Gn}function Z1(te,Se,ke){let Le=Se.isScene===!0?Se.overrideMaterial:null;for(let De=0,zt=te.length;De<zt;De++){let Yt=te[De],{object:kt,geometry:tn,group:hn}=Yt,Gn=Yt.material;Gn.allowOverride===!0&&Le!==null&&(Gn=Le),kt.layers.test(ke.layers)&&QR(kt,Se,ke,tn,Gn,hn)}}function QR(te,Se,ke,Le,De,zt){te.onBeforeRender(z,Se,ke,Le,De,zt),te.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,te.matrixWorld),te.normalMatrix.getNormalMatrix(te.modelViewMatrix),De.onBeforeRender(z,Se,ke,Le,te,zt),De.transparent===!0&&De.side===ir&&De.forceSinglePass===!1?(De.side=ui,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=Ao,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=ir):z.renderBufferDirect(ke,Se,Le,De,te,zt),te.onAfterRender(z,Se,ke,Le,De,zt)}function Q1(te,Se,ke){Se.isScene!==!0&&(Se=Zt);let Le=Pe.get(te),De=D.state.lights,zt=D.state.shadowsArray,Yt=De.state.version,kt=Rt.getParameters(te,De.state,zt,Se,ke,D.state.lightProbeGridArray),tn=Rt.getProgramCacheKey(kt),hn=Le.programs;Le.environment=te.isMeshStandardMaterial||te.isMeshLambertMaterial||te.isMeshPhongMaterial?Se.environment:null,Le.fog=Se.fog;let Gn=te.isMeshStandardMaterial||te.isMeshLambertMaterial&&!te.envMap||te.isMeshPhongMaterial&&!te.envMap;Le.envMap=gt.get(te.envMap||Le.environment,Gn),Le.envMapRotation=Le.environment!==null&&te.envMap===null?Se.environmentRotation:te.envMapRotation,hn===void 0&&(te.addEventListener("dispose",mr),hn=new Map,Le.programs=hn);let Xn=hn.get(tn);if(Xn!==void 0){if(Le.currentProgram===Xn&&Le.lightsStateVersion===Yt)return e4(te,kt),Xn}else kt.uniforms=Rt.getUniforms(te),H!==null&&te.isNodeMaterial&&H.build(te,ke,kt),te.onBeforeCompile(kt,z),Xn=Rt.acquireProgram(kt,tn),hn.set(tn,Xn),Le.uniforms=kt.uniforms;let pn=Le.uniforms;return(!te.isShaderMaterial&&!te.isRawShaderMaterial||te.clipping===!0)&&(pn.clippingPlanes=cn.uniform),e4(te,kt),Le.needsLights=kk(te),Le.lightsStateVersion=Yt,Le.needsLights&&(pn.ambientLightColor.value=De.state.ambient,pn.lightProbe.value=De.state.probe,pn.directionalLights.value=De.state.directional,pn.directionalLightShadows.value=De.state.directionalShadow,pn.spotLights.value=De.state.spot,pn.spotLightShadows.value=De.state.spotShadow,pn.rectAreaLights.value=De.state.rectArea,pn.ltc_1.value=De.state.rectAreaLTC1,pn.ltc_2.value=De.state.rectAreaLTC2,pn.pointLights.value=De.state.point,pn.pointLightShadows.value=De.state.pointShadow,pn.hemisphereLights.value=De.state.hemi,pn.directionalShadowMatrix.value=De.state.directionalShadowMatrix,pn.spotLightMatrix.value=De.state.spotLightMatrix,pn.spotLightMap.value=De.state.spotLightMap,pn.pointShadowMatrix.value=De.state.pointShadowMatrix),Le.lightProbeGrid=D.state.lightProbeGridArray.length>0,Le.currentProgram=Xn,Le.uniformsList=null,Xn}function JR(te){if(te.uniformsList===null){let Se=te.currentProgram.getUniforms();te.uniformsList=C_.seqWithValue(Se.seq,te.uniforms)}return te.uniformsList}function e4(te,Se){let ke=Pe.get(te);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function Ok(te,Se){if(te.length===0)return null;if(te.length===1)return te[0].texture!==null?te[0]:null;C.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,Le=te.length;ke<Le;ke++){let De=te[ke];if(De.texture!==null&&De.boundingBox.containsPoint(C))return De}return null}function Bk(te,Se,ke,Le,De){Se.isScene!==!0&&(Se=Zt),Ve.resetTextureUnits();let zt=Se.fog,Yt=Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial?Se.environment:null,kt=ae===null?z.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:sn.workingColorSpace,tn=Le.isMeshStandardMaterial||Le.isMeshLambertMaterial&&!Le.envMap||Le.isMeshPhongMaterial&&!Le.envMap,hn=gt.get(Le.envMap||Yt,tn),Gn=Le.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Xn=!!ke.attributes.tangent&&(!!Le.normalMap||Le.anisotropy>0),pn=!!ke.morphAttributes.position,Bi=!!ke.morphAttributes.normal,kr=!!ke.morphAttributes.color,Tr=ks;Le.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Tr=z.toneMapping);let Hi=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,so=Hi!==void 0?Hi.length:0,Xt=Pe.get(Le),Ia=D.state.lights;if(st===!0&&(tt===!0||te!==de)){let er=te===de&&Le.id===ce;cn.setState(Le,te,er)}let Ai=!1;Le.version===Xt.__version?(Xt.needsLights&&Xt.lightsStateVersion!==Ia.state.version||Xt.outputColorSpace!==kt||De.isBatchedMesh&&Xt.batching===!1||!De.isBatchedMesh&&Xt.batching===!0||De.isBatchedMesh&&Xt.batchingColor===!0&&De.colorTexture===null||De.isBatchedMesh&&Xt.batchingColor===!1&&De.colorTexture!==null||De.isInstancedMesh&&Xt.instancing===!1||!De.isInstancedMesh&&Xt.instancing===!0||De.isSkinnedMesh&&Xt.skinning===!1||!De.isSkinnedMesh&&Xt.skinning===!0||De.isInstancedMesh&&Xt.instancingColor===!0&&De.instanceColor===null||De.isInstancedMesh&&Xt.instancingColor===!1&&De.instanceColor!==null||De.isInstancedMesh&&Xt.instancingMorph===!0&&De.morphTexture===null||De.isInstancedMesh&&Xt.instancingMorph===!1&&De.morphTexture!==null||Xt.envMap!==hn||Le.fog===!0&&Xt.fog!==zt||Xt.numClippingPlanes!==void 0&&(Xt.numClippingPlanes!==cn.numPlanes||Xt.numIntersection!==cn.numIntersection)||Xt.vertexAlphas!==Gn||Xt.vertexTangents!==Xn||Xt.morphTargets!==pn||Xt.morphNormals!==Bi||Xt.morphColors!==kr||Xt.toneMapping!==Tr||Xt.morphTargetsCount!==so||!!Xt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(Ai=!0):(Ai=!0,Xt.__version=Le.version);let sl=Xt.currentProgram;Ai===!0&&(sl=Q1(Le,Se,De),H&&Le.isNodeMaterial&&H.onUpdateProgram(Le,sl,Xt));let gc=!1,qh=!1,b0=!1,Wi=sl.getUniforms(),Gr=Xt.uniforms;if(X.useProgram(sl.program)&&(gc=!0,qh=!0,b0=!0),Le.id!==ce&&(ce=Le.id,qh=!0),Xt.needsLights){let er=Ok(D.state.lightProbeGridArray,De);Xt.lightProbeGrid!==er&&(Xt.lightProbeGrid=er,qh=!0)}if(gc||de!==te){X.buffers.depth.getReversed()&&te.reversedDepth!==!0&&(te._reversedDepth=!0,te.updateProjectionMatrix()),Wi.setValue(ge,"projectionMatrix",te.projectionMatrix),Wi.setValue(ge,"viewMatrix",te.matrixWorldInverse);let Wh=Wi.map.cameraPosition;Wh!==void 0&&Wh.setValue(ge,yt.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&Wi.setValue(ge,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Le.isMeshPhongMaterial||Le.isMeshToonMaterial||Le.isMeshLambertMaterial||Le.isMeshBasicMaterial||Le.isMeshStandardMaterial||Le.isShaderMaterial)&&Wi.setValue(ge,"isOrthographic",te.isOrthographicCamera===!0),de!==te&&(de=te,qh=!0,b0=!0)}if(Xt.needsLights&&(Ia.state.directionalShadowMap.length>0&&Wi.setValue(ge,"directionalShadowMap",Ia.state.directionalShadowMap,Ve),Ia.state.spotShadowMap.length>0&&Wi.setValue(ge,"spotShadowMap",Ia.state.spotShadowMap,Ve),Ia.state.pointShadowMap.length>0&&Wi.setValue(ge,"pointShadowMap",Ia.state.pointShadowMap,Ve)),De.isSkinnedMesh){Wi.setOptional(ge,De,"bindMatrix"),Wi.setOptional(ge,De,"bindMatrixInverse");let er=De.skeleton;er&&(er.boneTexture===null&&er.computeBoneTexture(),Wi.setValue(ge,"boneTexture",er.boneTexture,Ve))}De.isBatchedMesh&&(Wi.setOptional(ge,De,"batchingTexture"),Wi.setValue(ge,"batchingTexture",De._matricesTexture,Ve),Wi.setOptional(ge,De,"batchingIdTexture"),Wi.setValue(ge,"batchingIdTexture",De._indirectTexture,Ve),Wi.setOptional(ge,De,"batchingColorTexture"),De._colorsTexture!==null&&Wi.setValue(ge,"batchingColorTexture",De._colorsTexture,Ve));let Hh=ke.morphAttributes;if((Hh.position!==void 0||Hh.normal!==void 0||Hh.color!==void 0)&&xe.update(De,ke,sl),(qh||Xt.receiveShadow!==De.receiveShadow)&&(Xt.receiveShadow=De.receiveShadow,Wi.setValue(ge,"receiveShadow",De.receiveShadow)),(Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial)&&Le.envMap===null&&Se.environment!==null&&(Gr.envMapIntensity.value=Se.environmentIntensity),Gr.dfgLUT!==void 0&&(Gr.dfgLUT.value=Ype()),qh){if(Wi.setValue(ge,"toneMappingExposure",z.toneMappingExposure),Xt.needsLights&&Uk(Gr,b0),zt&&Le.fog===!0&&en.refreshFogUniforms(Gr,zt),en.refreshMaterialUniforms(Gr,Le,$e,ze,D.state.transmissionRenderTarget[te.id]),Xt.needsLights&&Xt.lightProbeGrid){let er=Xt.lightProbeGrid;Gr.probesSH.value=er.texture,Gr.probesMin.value.copy(er.boundingBox.min),Gr.probesMax.value.copy(er.boundingBox.max),Gr.probesResolution.value.copy(er.resolution)}C_.upload(ge,JR(Xt),Gr,Ve)}if(Le.isShaderMaterial&&Le.uniformsNeedUpdate===!0&&(C_.upload(ge,JR(Xt),Gr,Ve),Le.uniformsNeedUpdate=!1),Le.isSpriteMaterial&&Wi.setValue(ge,"center",De.center),Wi.setValue(ge,"modelViewMatrix",De.modelViewMatrix),Wi.setValue(ge,"normalMatrix",De.normalMatrix),Wi.setValue(ge,"modelMatrix",De.matrixWorld),Le.uniformsGroups!==void 0){let er=Le.uniformsGroups;for(let Wh=0,w0=er.length;Wh<w0;Wh++){let t4=er[Wh];ct.update(t4,sl),ct.bind(t4,sl)}}return sl}function Uk(te,Se){te.ambientLightColor.needsUpdate=Se,te.lightProbe.needsUpdate=Se,te.directionalLights.needsUpdate=Se,te.directionalLightShadows.needsUpdate=Se,te.pointLights.needsUpdate=Se,te.pointLightShadows.needsUpdate=Se,te.spotLights.needsUpdate=Se,te.spotLightShadows.needsUpdate=Se,te.rectAreaLights.needsUpdate=Se,te.hemisphereLights.needsUpdate=Se}function kk(te){return te.isMeshLambertMaterial||te.isMeshToonMaterial||te.isMeshPhongMaterial||te.isMeshStandardMaterial||te.isShadowMaterial||te.isShaderMaterial&&te.lights===!0}this.getActiveCubeFace=function(){return Z},this.getActiveMipmapLevel=function(){return ee},this.getRenderTarget=function(){return ae},this.setRenderTargetTextures=function(te,Se,ke){let Le=Pe.get(te);Le.__autoAllocateDepthBuffer=te.resolveDepthBuffer===!1,Le.__autoAllocateDepthBuffer===!1&&(Le.__useRenderToTexture=!1),Pe.get(te.texture).__webglTexture=Se,Pe.get(te.depthTexture).__webglTexture=Le.__autoAllocateDepthBuffer?void 0:ke,Le.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(te,Se){let ke=Pe.get(te);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(te,Se=0,ke=0){ae=te,Z=Se,ee=ke;let Le=null,De=!1,zt=!1;if(te){let kt=Pe.get(te);if(kt.__useDefaultFramebuffer!==void 0){X.bindFramebuffer(ge.FRAMEBUFFER,kt.__webglFramebuffer),ve.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest,X.viewport(ve),X.scissor(Ie),X.setScissorTest(Qe),ce=-1;return}else if(kt.__webglFramebuffer===void 0)Ve.setupRenderTarget(te);else if(kt.__hasExternalTextures)Ve.rebindTextures(te,Pe.get(te.texture).__webglTexture,Pe.get(te.depthTexture).__webglTexture);else if(te.depthBuffer){let Gn=te.depthTexture;if(kt.__boundDepthTexture!==Gn){if(Gn!==null&&Pe.has(Gn)&&(te.width!==Gn.image.width||te.height!==Gn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ve.setupDepthRenderbuffer(te)}}let tn=te.texture;(tn.isData3DTexture||tn.isDataArrayTexture||tn.isCompressedArrayTexture)&&(zt=!0);let hn=Pe.get(te).__webglFramebuffer;te.isWebGLCubeRenderTarget?(Array.isArray(hn[Se])?Le=hn[Se][ke]:Le=hn[Se],De=!0):te.samples>0&&Ve.useMultisampledRTT(te)===!1?Le=Pe.get(te).__webglMultisampledFramebuffer:Array.isArray(hn)?Le=hn[ke]:Le=hn,ve.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest}else ve.copy(Ct).multiplyScalar($e).floor(),Ie.copy(un).multiplyScalar($e).floor(),Qe=Gt;if(ke!==0&&(Le=K),X.bindFramebuffer(ge.FRAMEBUFFER,Le)&&X.drawBuffers(te,Le),X.viewport(ve),X.scissor(Ie),X.setScissorTest(Qe),De){let kt=Pe.get(te.texture);ge.framebufferTexture2D(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_CUBE_MAP_POSITIVE_X+Se,kt.__webglTexture,ke)}else if(zt){let kt=Se;for(let tn=0;tn<te.textures.length;tn++){let hn=Pe.get(te.textures[tn]);ge.framebufferTextureLayer(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0+tn,hn.__webglTexture,ke,kt)}}else if(te!==null&&ke!==0){let kt=Pe.get(te.texture);ge.framebufferTexture2D(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,kt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(te,Se,ke,Le,De,zt,Yt,kt=0){if(!(te&&te.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let tn=Pe.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Yt!==void 0&&(tn=tn[Yt]),tn){X.bindFramebuffer(ge.FRAMEBUFFER,tn);try{let hn=te.textures[kt],Gn=hn.format,Xn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(Gn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Xn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=te.width-Le&&ke>=0&&ke<=te.height-De&&ge.readPixels(Se,ke,Le,De,wt.convert(Gn),wt.convert(Xn),zt)}finally{let hn=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,hn)}}},this.readRenderTargetPixelsAsync=async function(te,Se,ke,Le,De,zt,Yt,kt=0){if(!(te&&te.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let tn=Pe.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Yt!==void 0&&(tn=tn[Yt]),tn)if(Se>=0&&Se<=te.width-Le&&ke>=0&&ke<=te.height-De){X.bindFramebuffer(ge.FRAMEBUFFER,tn);let hn=te.textures[kt],Gn=hn.format,Xn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(Gn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Xn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let pn=ge.createBuffer();ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.bufferData(ge.PIXEL_PACK_BUFFER,zt.byteLength,ge.STREAM_READ),ge.readPixels(Se,ke,Le,De,wt.convert(Gn),wt.convert(Xn),0);let Bi=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,Bi);let kr=ge.fenceSync(ge.SYNC_GPU_COMMANDS_COMPLETE,0);return ge.flush(),await HH(ge,kr,4),ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.getBufferSubData(ge.PIXEL_PACK_BUFFER,0,zt),ge.deleteBuffer(pn),ge.deleteSync(kr),zt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(te,Se=null,ke=0){let Le=Math.pow(2,-ke),De=Math.floor(te.image.width*Le),zt=Math.floor(te.image.height*Le),Yt=Se!==null?Se.x:0,kt=Se!==null?Se.y:0;Ve.setTexture2D(te,0),ge.copyTexSubImage2D(ge.TEXTURE_2D,ke,0,0,Yt,kt,De,zt),X.unbindTexture()},this.copyTextureToTexture=function(te,Se,ke=null,Le=null,De=0,zt=0){let Yt,kt,tn,hn,Gn,Xn,pn,Bi,kr,Tr=te.isCompressedTexture?te.mipmaps[zt]:te.image;if(ke!==null)Yt=ke.max.x-ke.min.x,kt=ke.max.y-ke.min.y,tn=ke.isBox3?ke.max.z-ke.min.z:1,hn=ke.min.x,Gn=ke.min.y,Xn=ke.isBox3?ke.min.z:0;else{let Gr=Math.pow(2,-De);Yt=Math.floor(Tr.width*Gr),kt=Math.floor(Tr.height*Gr),te.isDataArrayTexture?tn=Tr.depth:te.isData3DTexture?tn=Math.floor(Tr.depth*Gr):tn=1,hn=0,Gn=0,Xn=0}Le!==null?(pn=Le.x,Bi=Le.y,kr=Le.z):(pn=0,Bi=0,kr=0);let Hi=wt.convert(Se.format),so=wt.convert(Se.type),Xt;Se.isData3DTexture?(Ve.setTexture3D(Se,0),Xt=ge.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ve.setTexture2DArray(Se,0),Xt=ge.TEXTURE_2D_ARRAY):(Ve.setTexture2D(Se,0),Xt=ge.TEXTURE_2D),X.activeTexture(ge.TEXTURE0),X.pixelStorei(ge.UNPACK_FLIP_Y_WEBGL,Se.flipY),X.pixelStorei(ge.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),X.pixelStorei(ge.UNPACK_ALIGNMENT,Se.unpackAlignment);let Ia=X.getParameter(ge.UNPACK_ROW_LENGTH),Ai=X.getParameter(ge.UNPACK_IMAGE_HEIGHT),sl=X.getParameter(ge.UNPACK_SKIP_PIXELS),gc=X.getParameter(ge.UNPACK_SKIP_ROWS),qh=X.getParameter(ge.UNPACK_SKIP_IMAGES);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Tr.width),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Tr.height),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hn),X.pixelStorei(ge.UNPACK_SKIP_ROWS,Gn),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Xn);let b0=te.isDataArrayTexture||te.isData3DTexture,Wi=Se.isDataArrayTexture||Se.isData3DTexture;if(te.isDepthTexture){let Gr=Pe.get(te),Hh=Pe.get(Se),er=Pe.get(Gr.__renderTarget),Wh=Pe.get(Hh.__renderTarget);X.bindFramebuffer(ge.READ_FRAMEBUFFER,er.__webglFramebuffer),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,Wh.__webglFramebuffer);for(let w0=0;w0<tn;w0++)b0&&(ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(te).__webglTexture,De,Xn+w0),ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,zt,kr+w0)),ge.blitFramebuffer(hn,Gn,Yt,kt,pn,Bi,Yt,kt,ge.DEPTH_BUFFER_BIT,ge.NEAREST);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else if(De!==0||te.isRenderTargetTexture||Pe.has(te)){let Gr=Pe.get(te),Hh=Pe.get(Se);X.bindFramebuffer(ge.READ_FRAMEBUFFER,J),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,j);for(let er=0;er<tn;er++)b0?ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Gr.__webglTexture,De,Xn+er):ge.framebufferTexture2D(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Gr.__webglTexture,De),Wi?ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Hh.__webglTexture,zt,kr+er):ge.framebufferTexture2D(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Hh.__webglTexture,zt),De!==0?ge.blitFramebuffer(hn,Gn,Yt,kt,pn,Bi,Yt,kt,ge.COLOR_BUFFER_BIT,ge.NEAREST):Wi?ge.copyTexSubImage3D(Xt,zt,pn,Bi,kr+er,hn,Gn,Yt,kt):ge.copyTexSubImage2D(Xt,zt,pn,Bi,hn,Gn,Yt,kt);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else Wi?te.isDataTexture||te.isData3DTexture?ge.texSubImage3D(Xt,zt,pn,Bi,kr,Yt,kt,tn,Hi,so,Tr.data):Se.isCompressedArrayTexture?ge.compressedTexSubImage3D(Xt,zt,pn,Bi,kr,Yt,kt,tn,Hi,Tr.data):ge.texSubImage3D(Xt,zt,pn,Bi,kr,Yt,kt,tn,Hi,so,Tr):te.isDataTexture?ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Yt,kt,Hi,so,Tr.data):te.isCompressedTexture?ge.compressedTexSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Tr.width,Tr.height,Hi,Tr.data):ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Yt,kt,Hi,so,Tr);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Ia),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Ai),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,sl),X.pixelStorei(ge.UNPACK_SKIP_ROWS,gc),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,qh),zt===0&&Se.generateMipmaps&&ge.generateMipmap(Xt),X.unbindTexture()},this.initRenderTarget=function(te){Pe.get(te).__webglFramebuffer===void 0&&Ve.setupRenderTarget(te)},this.initTexture=function(te){te.isCubeTexture?Ve.setTextureCube(te,0):te.isData3DTexture?Ve.setTexture3D(te,0):te.isDataArrayTexture||te.isCompressedArrayTexture?Ve.setTexture2DArray(te,0):Ve.setTexture2D(te,0),X.unbindTexture()},this.resetState=function(){Z=0,ee=0,ae=null,X.reset(),Dt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return po}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=sn._getDrawingBufferColorSpace(e),t.unpackColorSpace=sn._getUnpackColorSpace()}};var n3=class extends $i{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Oe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}},P_=new ie,CW=new on,RW=new on,PW=new ie,IW=new ie,i3=class{constructor(e={}){let t=this,n,r,s,o,a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:n,height:r}},this.render=function(v,w){v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),CW.copy(w.matrixWorldInverse),RW.multiplyMatrices(w.projectionMatrix,CW),u(v,v,w),this.sortObjects&&x(v)},this.setSize=function(v,w){n=v,r=w,s=n/2,o=r/2,l.style.width=v+"px",l.style.height=w+"px"};function c(v){v.isCSS2DObject&&(v.element.style.display="none");for(let w=0,S=v.children.length;w<S;w++)c(v.children[w])}function u(v,w,S){if(v.visible===!1){c(v);return}if(v.isCSS2DObject){P_.setFromMatrixPosition(v.matrixWorld),P_.applyMatrix4(RW);let T=P_.z>=-1&&P_.z<=1&&v.layers.test(S.layers)===!0,P=v.element;P.style.display=T===!0?"":"none",T===!0&&(v.onBeforeRender(t,w,S),P.style.transform="translate("+-100*v.center.x+"%,"+-100*v.center.y+"%)translate("+(P_.x*s+s)+"px,"+(-P_.y*o+o)+"px)",P.parentNode!==l&&l.appendChild(P),v.onAfterRender(t,w,S));let R={distanceToCameraSquared:f(S,v)};a.objects.set(v,R)}for(let T=0,P=v.children.length;T<P;T++)u(v.children[T],w,S)}function f(v,w){return PW.setFromMatrixPosition(v.matrixWorld),IW.setFromMatrixPosition(w.matrixWorld),PW.distanceToSquared(IW)}function p(v){let w=[];return v.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function x(v){let w=p(v).sort(function(T,P){if(T.renderOrder!==P.renderOrder)return P.renderOrder-T.renderOrder;let R=a.objects.get(T).distanceToCameraSquared,C=a.objects.get(P).distanceToCameraSquared;return R-C}),S=w.length;for(let T=0,P=w.length;T<P;T++)w[T].element.style.zIndex=S-T}}};function Kpe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var M2=Kpe;var Zpe=typeof global=="object"&&global&&global.Object===Object&&global,NW=Zpe;var Qpe=typeof self=="object"&&self&&self.Object===Object&&self,Jpe=NW||Qpe||Function("return this")(),r3=Jpe;var e0e=function(){return r3.Date.now()},s3=e0e;var t0e=/\s/;function n0e(i){for(var e=i.length;e--&&t0e.test(i.charAt(e)););return e}var LW=n0e;var i0e=/^\s+/;function r0e(i){return i&&i.slice(0,LW(i)+1).replace(i0e,"")}var DW=r0e;var s0e=r3.Symbol,I_=s0e;var FW=Object.prototype,o0e=FW.hasOwnProperty,a0e=FW.toString,C2=I_?I_.toStringTag:void 0;function l0e(i){var e=o0e.call(i,C2),t=i[C2];try{i[C2]=void 0;var n=!0}catch{}var r=a0e.call(i);return n&&(e?i[C2]=t:delete i[C2]),r}var OW=l0e;var c0e=Object.prototype,u0e=c0e.toString;function h0e(i){return u0e.call(i)}var BW=h0e;var f0e="[object Null]",d0e="[object Undefined]",UW=I_?I_.toStringTag:void 0;function p0e(i){return i==null?i===void 0?d0e:f0e:UW&&UW in Object(i)?OW(i):BW(i)}var kW=p0e;function A0e(i){return i!=null&&typeof i=="object"}var GW=A0e;var m0e="[object Symbol]";function g0e(i){return typeof i=="symbol"||GW(i)&&kW(i)==m0e}var zW=g0e;var VW=NaN,_0e=/^[-+]0x[0-9a-f]+$/i,x0e=/^0b[01]+$/i,y0e=/^0o[0-7]+$/i,v0e=parseInt;function b0e(i){if(typeof i=="number")return i;if(zW(i))return VW;if(M2(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=M2(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=DW(i);var t=x0e.test(i);return t||y0e.test(i)?v0e(i.slice(2),t?2:8):_0e.test(i)?VW:+i}var kL=b0e;var w0e="Expected a function",S0e=Math.max,T0e=Math.min;function E0e(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,p=!0;if(typeof i!="function")throw new TypeError(w0e);e=kL(e)||0,M2(t)&&(u=!!t.leading,f="maxWait"in t,s=f?S0e(kL(t.maxWait)||0,e):s,p="trailing"in t?!!t.trailing:p);function x(D){var F=n,N=r;return n=r=void 0,c=D,o=i.apply(N,F),o}function v(D){return c=D,a=setTimeout(T,e),u?x(D):o}function w(D){var F=D-l,N=D-c,B=e-F;return f?T0e(B,s-N):B}function S(D){var F=D-l,N=D-c;return l===void 0||F>=e||F<0||f&&N>=s}function T(){var D=s3();if(S(D))return P(D);a=setTimeout(T,w(D))}function P(D){return a=void 0,p&&n?x(D):(n=r=void 0,o)}function R(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function C(){return a===void 0?o:P(s3())}function L(){var D=s3(),F=S(D);if(n=arguments,r=this,l=D,F){if(a===void 0)return v(l);if(f)return clearTimeout(a),a=setTimeout(T,e),x(l)}return a===void 0&&(a=setTimeout(T,e)),o}return L.cancel=R,L.flush=C,L}var qW=E0e;function HW(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function M0e(i){if(Array.isArray(i))return i}function C0e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function R0e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function P0e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function I0e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4117-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N0e(i,e){return M0e(i)||P0e(i,e)||L0e(i,e)||I0e()}function L0e(i,e){if(i){if(typeof i=="string")return HW(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?HW(i,e):void 0}}var D0e=R0e(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(c,u){}:a;C0e(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Nr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,c=i.init,u=c===void 0?function(){}:c,f=i.update,p=f===void 0?function(){}:f,x=Object.keys(r).map(function(v){return new D0e(v,r[v])});return function v(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var P=!!(this instanceof v&&this.constructor),R=P?S.shift():void 0,C=S[0],L=C===void 0?{}:C,D=Object.assign({},t instanceof Function?t(L):t,{initialised:!1}),F={};function N(V){return B(V,L),z(),N}var B=function(H,K){u.call(N,H,D,K),D.initialised=!0},z=qW(function(){D.initialised&&(p.call(N,D,F),F={})},1);return x.forEach(function(V){N[V.name]=H(V);function H(K){var J=K.name,j=K.triggerUpdate,Z=j===void 0?!1:j,ee=K.onChange,ae=ee===void 0?function(ve,Ie){}:ee,ce=K.defaultVal,de=ce===void 0?null:ce;return function(ve){var Ie=D[J];if(!arguments.length)return Ie;var Qe=ve===void 0?de:ve;return D[J]=Qe,ae.call(N,Qe,D,Ie),!F.hasOwnProperty(J)&&(F[J]=Ie),Z&&z(),N}}}),Object.keys(o).forEach(function(V){N[V]=function(){for(var H,K=arguments.length,J=new Array(K),j=0;j<K;j++)J[j]=arguments[j];return(H=o[V]).call.apply(H,[N,D].concat(J))}}),Object.entries(l).forEach(function(V){var H=N0e(V,2),K=H[0],J=H[1];return N[K]=N[J]}),N.resetProps=function(){return x.forEach(function(V){N[V.name](V.defaultVal)}),N},N.resetProps(),D._rerender=z,P&&R&&N(R),N}}var Lr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Lr.Bounce.Out(1-i)},Out:function(i){return i<.36363636363636365?7.5625*i*i:i<.7272727272727273?7.5625*(i-=.5454545454545454)*i+.75:i<.9090909090909091?7.5625*(i-=.8181818181818182)*i+.9375:7.5625*(i-=.9545454545454546)*i+.984375},InOut:function(i){return i<.5?Lr.Bounce.In(i*2)*.5:Lr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),R2=function(){return performance.now()},HA=(function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=R2()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i})(),N_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=N_.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=N_.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=N_.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=N_.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:(function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}})(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},WW=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),GL=new HA,Vs=(function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Lr.Linear.None,this._interpolationFunction=N_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=WW.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=GL,GL.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=R2()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(n[o]);if(!(c==="undefined"||c==="function")){if(u){var f=n[o];if(f.length===0)continue;for(var p=[a],x=0,v=f.length;x<v;x+=1){var w=this._handleRelativeValue(a,f[x]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(w)}u&&(n[o]=p)}if((c==="object"||l)&&a&&!u){t[o]=l?[]:{};var S=a;for(var T in S)t[o][T]=S[T];r[o]=l?[]:{};var f=n[o];if(!this._isDynamic){var P={};for(var T in f)P[T]=f[T];n[o]=f=P}this._setupProperties(S,t[o],f,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),u?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=R2()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=R2()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Lr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=N_.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=R2()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,c=function(){if(n._duration===0||o>l)return 1;var w=Math.trunc(o/a),S=o-w*a,T=Math.min(S/n._duration,1);return T===0&&o===n._duration?1:T},u=c(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var x=0,v=this._chainedTweens.length;x<v;x++)this._chainedTweens[x].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i})();var Jqe=WW.nextId,ih=GL,eHe=ih.getAll.bind(ih),tHe=ih.removeAll.bind(ih),nHe=ih.add.bind(ih),iHe=ih.remove.bind(ih),rHe=ih.update.bind(ih);function jW(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return XW(this.cover(e,t,n),e,t,n,i)}function XW(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,c=i._y0,u=i._z0,f=i._x1,p=i._y1,x=i._z1,v,w,S,T,P,R,C,L,D,F,N;if(!o)return i._root=a,i;for(;o.length;)if((C=e>=(v=(l+f)/2))?l=v:f=v,(L=t>=(w=(c+p)/2))?c=w:p=w,(D=n>=(S=(u+x)/2))?u=S:x=S,s=o,!(o=o[F=D<<2|L<<1|C]))return s[F]=a,i;if(T=+i._x.call(null,o.data),P=+i._y.call(null,o.data),R=+i._z.call(null,o.data),e===T&&t===P&&n===R)return a.next=o,s?s[F]=a:i._root=a,i;do s=s?s[F]=new Array(8):i._root=new Array(8),(C=e>=(v=(l+f)/2))?l=v:f=v,(L=t>=(w=(c+p)/2))?c=w:p=w,(D=n>=(S=(u+x)/2))?u=S:x=S;while((F=D<<2|L<<1|C)===(N=(R>=S)<<2|(P>=w)<<1|T>=v));return s[N]=o,s[F]=a,i}function $W(i){Array.isArray(i)||(i=Array.from(i));let e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e),s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let f=0,p,x,v,w;f<e;++f)isNaN(x=+this._x.call(null,p=i[f]))||isNaN(v=+this._y.call(null,p))||isNaN(w=+this._z.call(null,p))||(t[f]=x,n[f]=v,r[f]=w,x<s&&(s=x),x>l&&(l=x),v<o&&(o=v),v>c&&(c=v),w<a&&(a=w),w>u&&(u=w));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let f=0;f<e;++f)XW(this,t[f],n[f],r[f],i[f]);return this}function YW(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=o-n||1,u=this._root,f,p;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(p=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[p]=u,u=f,c*=2,p){case 0:o=n+c,a=r+c,l=s+c;break;case 1:n=o-c,a=r+c,l=s+c;break;case 2:o=n+c,r=a-c,l=s+c;break;case 3:n=o-c,r=a-c,l=s+c;break;case 4:o=n+c,a=r+c,s=l-c;break;case 5:n=o-c,a=r+c,s=l-c;break;case 6:o=n+c,r=a-c,s=l-c;break;case 7:n=o-c,r=a-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function KW(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function ZW(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Di(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function QW(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,p,x,v=this._x1,w=this._y1,S=this._z1,T=[],P=this._root,R,C;for(P&&T.push(new Di(P,s,o,a,v,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,v=i+n,w=e+n,S=t+n,n*=n);R=T.pop();)if(!(!(P=R.node)||(l=R.x0)>v||(c=R.y0)>w||(u=R.z0)>S||(f=R.x1)<s||(p=R.y1)<o||(x=R.z1)<a))if(P.length){var L=(l+f)/2,D=(c+p)/2,F=(u+x)/2;T.push(new Di(P[7],L,D,F,f,p,x),new Di(P[6],l,D,F,L,p,x),new Di(P[5],L,c,F,f,D,x),new Di(P[4],l,c,F,L,D,x),new Di(P[3],L,D,u,f,p,F),new Di(P[2],l,D,u,L,p,F),new Di(P[1],L,c,u,f,D,F),new Di(P[0],l,c,u,L,D,F)),(C=(t>=F)<<2|(e>=D)<<1|i>=L)&&(R=T[T.length-1],T[T.length-1]=T[T.length-1-C],T[T.length-1-C]=R)}else{var N=i-+this._x.call(null,P.data),B=e-+this._y.call(null,P.data),z=t-+this._z.call(null,P.data),V=N*N+B*B+z*z;if(V<n){var H=Math.sqrt(n=V);s=i-H,o=e-H,a=t-H,v=i+H,w=e+H,S=t+H,r=P.data}}return r}var F0e=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function JW(i,e,t,n){let r=[],s=i-n,o=e-n,a=t-n,l=i+n,c=e+n,u=t+n;return this.visit((f,p,x,v,w,S,T)=>{if(!f.length)do{let P=f.data;F0e(i,e,t,this._x(P),this._y(P),this._z(P))<=n&&r.push(P)}while(f=f.next);return p>l||x>c||v>u||w<s||S<o||T<a}),r}function ej(i){if(isNaN(p=+this._x.call(null,i))||isNaN(x=+this._y.call(null,i))||isNaN(v=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,c=this._x1,u=this._y1,f=this._z1,p,x,v,w,S,T,P,R,C,L,D;if(!t)return this;if(t.length)for(;;){if((P=p>=(w=(o+c)/2))?o=w:c=w,(R=x>=(S=(a+u)/2))?a=S:u=S,(C=v>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[L=C<<2|R<<1|P]))return this;if(!t.length)break;(e[L+1&7]||e[L+2&7]||e[L+3&7]||e[L+4&7]||e[L+5&7]||e[L+6&7]||e[L+7&7])&&(n=e,D=L)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[L]=s:delete e[L],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[D]=t:this._root=t),this):(this._root=s,this)}function tj(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function nj(){return this._root}function ij(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function rj(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new Di(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,c=t.y1,u=t.z1)&&n.length){var f=(s+l)/2,p=(o+c)/2,x=(a+u)/2;(r=n[7])&&e.push(new Di(r,f,p,x,l,c,u)),(r=n[6])&&e.push(new Di(r,s,p,x,f,c,u)),(r=n[5])&&e.push(new Di(r,f,o,x,l,p,u)),(r=n[4])&&e.push(new Di(r,s,o,x,f,p,u)),(r=n[3])&&e.push(new Di(r,f,p,a,l,c,x)),(r=n[2])&&e.push(new Di(r,s,p,a,f,c,x)),(r=n[1])&&e.push(new Di(r,f,o,a,l,p,x)),(r=n[0])&&e.push(new Di(r,s,o,a,f,p,x))}return this}function sj(i){var e=[],t=[],n;for(this._root&&e.push(new Di(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,f=n.z1,p=(o+c)/2,x=(a+u)/2,v=(l+f)/2;(s=r[0])&&e.push(new Di(s,o,a,l,p,x,v)),(s=r[1])&&e.push(new Di(s,p,a,l,c,x,v)),(s=r[2])&&e.push(new Di(s,o,x,l,p,u,v)),(s=r[3])&&e.push(new Di(s,p,x,l,c,u,v)),(s=r[4])&&e.push(new Di(s,o,a,v,p,x,f)),(s=r[5])&&e.push(new Di(s,p,a,v,c,x,f)),(s=r[6])&&e.push(new Di(s,o,x,v,p,u,f)),(s=r[7])&&e.push(new Di(s,p,x,v,c,u,f))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function oj(i){return i[0]}function aj(i){return arguments.length?(this._x=i,this):this._x}function lj(i){return i[1]}function cj(i){return arguments.length?(this._y=i,this):this._y}function uj(i){return i[2]}function hj(i){return arguments.length?(this._z=i,this):this._z}function P2(i,e,t,n){var r=new zL(e??oj,t??lj,n??uj,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function zL(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function fj(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var _o=P2.prototype=zL.prototype;_o.copy=function(){var i=new zL(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=fj(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=fj(n));return i};_o.add=jW;_o.addAll=$W;_o.cover=YW;_o.data=KW;_o.extent=ZW;_o.find=QW;_o.findAllWithinRadius=JW;_o.remove=ej;_o.removeAll=tj;_o.root=nj;_o.size=ij;_o.visit=rj;_o.visitAfter=sj;_o.x=aj;_o.y=cj;_o.z=hj;function WA(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function VL(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function o3(i){let e,t,n;i.length!==2?(e=WA,t=(a,l)=>WA(i(a),l),n=(a,l)=>i(a)-l):(e=i===WA||i===VL?i:O0e,t=i,n=i);function r(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){let f=r(a,l,c,u-1);return f>c&&n(a[f-1],l)>-n(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function O0e(){return 0}function qL(i){return i===null?NaN:+i}var dj=o3(WA),pj=dj.right,B0e=dj.left,U0e=o3(qL).center,I2=pj;function Ip(i,e){let t,n;if(e===void 0)for(let r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}var xo=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}};var k0e=Math.sqrt(50),G0e=Math.sqrt(10),z0e=Math.sqrt(2);function a3(i,e,t){let n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=k0e?10:s>=G0e?5:s>=z0e?2:1,a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(i*c),l=Math.round(e*c),a/c<i&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(i/c),l=Math.round(e/c),a*c<i&&++a,l*c>e&&--l),l<a&&.5<=t&&t<2?a3(i,e,t*2):[a,l,c]}function l3(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];let n=e<i,[r,s,o]=n?a3(e,i,t):a3(i,e,t);if(!(s>=r))return[];let a=s-r+1,l=new Array(a);if(n)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}function N2(i,e,t){return e=+e,i=+i,t=+t,a3(i,e,t)[2]}function HL(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?N2(e,i,t):N2(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function c3(i,e){let t;if(e===void 0)for(let n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let r of i)(r=e(r,++n,i))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function u3(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*V0e(i){for(let e of i)yield*e}function rh(i){return Array.from(V0e(i))}function Ff(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function h3(i,e){let t=0;if(e===void 0)for(let n of i)(n=+n)&&(t+=n);else{let n=-1;for(let r of i)(r=+e(r,++n,i))&&(t+=r)}return t}function f3(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function d3(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function WL(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function F2(){}var L2=.7,m3=1/L2,L_="\\s*([+-]?\\d+)\\s*",D2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",sh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",q0e=/^#([0-9a-f]{3,8})$/,H0e=new RegExp(`^rgb\\(${L_},${L_},${L_}\\)$`),W0e=new RegExp(`^rgb\\(${sh},${sh},${sh}\\)$`),j0e=new RegExp(`^rgba\\(${L_},${L_},${L_},${D2}\\)$`),X0e=new RegExp(`^rgba\\(${sh},${sh},${sh},${D2}\\)$`),$0e=new RegExp(`^hsl\\(${D2},${sh},${sh}\\)$`),Y0e=new RegExp(`^hsla\\(${D2},${sh},${sh},${D2}\\)$`),Aj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};d3(F2,Xc,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:mj,formatHex:mj,formatHex8:K0e,formatHsl:Z0e,formatRgb:gj,toString:gj});function mj(){return this.rgb().formatHex()}function K0e(){return this.rgb().formatHex8()}function Z0e(){return wj(this).formatHsl()}function gj(){return this.rgb().formatRgb()}function Xc(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=q0e.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?_j(e):t===3?new Wa(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?p3(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?p3(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=H0e.exec(i))?new Wa(e[1],e[2],e[3],1):(e=W0e.exec(i))?new Wa(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=j0e.exec(i))?p3(e[1],e[2],e[3],e[4]):(e=X0e.exec(i))?p3(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=$0e.exec(i))?vj(e[1],e[2]/100,e[3]/100,1):(e=Y0e.exec(i))?vj(e[1],e[2]/100,e[3]/100,e[4]):Aj.hasOwnProperty(i)?_j(Aj[i]):i==="transparent"?new Wa(NaN,NaN,NaN,0):null}function _j(i){return new Wa(i>>16&255,i>>8&255,i&255,1)}function p3(i,e,t,n){return n<=0&&(i=e=t=NaN),new Wa(i,e,t,n)}function Q0e(i){return i instanceof F2||(i=Xc(i)),i?(i=i.rgb(),new Wa(i.r,i.g,i.b,i.opacity)):new Wa}function D_(i,e,t,n){return arguments.length===1?Q0e(i):new Wa(i,e,t,n??1)}function Wa(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}d3(Wa,D_,WL(F2,{brighter(i){return i=i==null?m3:Math.pow(m3,i),new Wa(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?L2:Math.pow(L2,i),new Wa(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Wa(XA(this.r),XA(this.g),XA(this.b),g3(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:xj,formatHex:xj,formatHex8:J0e,formatRgb:yj,toString:yj}));function xj(){return`#${jA(this.r)}${jA(this.g)}${jA(this.b)}`}function J0e(){return`#${jA(this.r)}${jA(this.g)}${jA(this.b)}${jA((isNaN(this.opacity)?1:this.opacity)*255)}`}function yj(){let i=g3(this.opacity);return`${i===1?"rgb(":"rgba("}${XA(this.r)}, ${XA(this.g)}, ${XA(this.b)}${i===1?")":`, ${i})`}`}function g3(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function XA(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function jA(i){return i=XA(i),(i<16?"0":"")+i.toString(16)}function vj(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new jc(i,e,t,n)}function wj(i){if(i instanceof jc)return new jc(i.h,i.s,i.l,i.opacity);if(i instanceof F2||(i=Xc(i)),!i)return new jc;if(i instanceof jc)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new jc(o,a,l,i.opacity)}function Sj(i,e,t,n){return arguments.length===1?wj(i):new jc(i,e,t,n??1)}function jc(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}d3(jc,Sj,WL(F2,{brighter(i){return i=i==null?m3:Math.pow(m3,i),new jc(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?L2:Math.pow(L2,i),new jc(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new Wa(jL(i>=240?i-240:i+120,r,n),jL(i,r,n),jL(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new jc(bj(this.h),A3(this.s),A3(this.l),g3(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 i=g3(this.opacity);return`${i===1?"hsl(":"hsla("}${bj(this.h)}, ${A3(this.s)*100}%, ${A3(this.l)*100}%${i===1?")":`, ${i})`}`}}));function bj(i){return i=(i||0)%360,i<0?i+360:i}function A3(i){return Math.max(0,Math.min(1,i||0))}function jL(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}function XL(i,e,t,n,r){var s=i*i,o=s*i;return((1-3*i+3*s-o)*e+(4-6*s+3*o)*t+(1+3*i+3*s-3*o)*n+o*r)/6}function Tj(i){var e=i.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,e-1):Math.floor(t*e),r=i[n],s=i[n+1],o=n>0?i[n-1]:2*r-s,a=n<e-1?i[n+2]:2*s-r;return XL((t-n/e)*e,o,r,s,a)}}function Ej(i){var e=i.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*e),r=i[(n+e-1)%e],s=i[n%e],o=i[(n+1)%e],a=i[(n+2)%e];return XL((t-n/e)*e,r,s,o,a)}}var O2=i=>()=>i;function eAe(i,e){return function(t){return i+t*e}}function tAe(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function Mj(i){return(i=+i)==1?_3:function(e,t){return t-e?tAe(e,t,i):O2(isNaN(e)?t:e)}}function _3(i,e){var t=e-i;return t?eAe(i,t):O2(isNaN(i)?e:i)}var $L=(function i(e){var t=Mj(e);function n(r,s){var o=t((r=D_(r)).r,(s=D_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=_3(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return n.gamma=i,n})(1);function Cj(i){return function(e){var t=e.length,n=new Array(t),r=new Array(t),s=new Array(t),o,a;for(o=0;o<t;++o)a=D_(e[o]),n[o]=a.r||0,r[o]=a.g||0,s[o]=a.b||0;return n=i(n),r=i(r),s=i(s),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=s(l),a+""}}}var LWe=Cj(Tj),DWe=Cj(Ej);function x3(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function y3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function YL(i,e){return(y3(e)?x3:KL)(i,e)}function KL(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=$A(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function Rj(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function oh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function Pj(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=$A(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var QL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ZL=new RegExp(QL.source,"g");function nAe(i){return function(){return i}}function iAe(i){return function(e){return i(e)+""}}function Ij(i,e){var t=QL.lastIndex=ZL.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=QL.exec(i))&&(r=ZL.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:oh(n,r)})),t=ZL.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?iAe(l[0].x):nAe(e):(e=l.length,function(c){for(var u=0,f;u<e;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function $A(i,e){var t=typeof e,n;return e==null||t==="boolean"?O2(e):(t==="number"?oh:t==="string"?(n=Xc(e))?(e=n,$L):Ij:e instanceof Xc?$L:e instanceof Date?Rj:y3(e)?x3:Array.isArray(e)?KL:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Pj:oh)(i,e)}function JL(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function eD(i){return function(){return i}}function tD(i){return+i}var Nj=[0,1];function F_(i){return i}function nD(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:eD(isNaN(e)?NaN:.5)}function rAe(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function sAe(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=nD(r,n),s=t(o,s)):(n=nD(n,r),s=t(s,o)),function(a){return s(n(a))}}function oAe(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=nD(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=I2(i,a,1,n)-1;return s[l](r[l](a))}}function Lj(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function aAe(){var i=Nj,e=Nj,t=$A,n,r,s,o=F_,a,l,c;function u(){var p=Math.min(i.length,e.length);return o!==F_&&(o=rAe(i[0],i[p-1])),a=p>2?oAe:sAe,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?s:(l||(l=a(i.map(n),e,t)))(n(o(p)))}return f.invert=function(p){return o(r((c||(c=a(e,i.map(n),oh)))(p)))},f.domain=function(p){return arguments.length?(i=Array.from(p,tD),u()):i.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),u()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),t=JL,u()},f.clamp=function(p){return arguments.length?(o=p?!0:F_,u()):o!==F_},f.interpolate=function(p){return arguments.length?(t=p,u()):t},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,x){return n=p,r=x,u()}}function iD(){return aAe()(F_,F_)}function Dj(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function YA(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function ah(i){return i=YA(Math.abs(i)),i?i[1]:NaN}function Fj(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function Oj(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var lAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Np(i){if(!(e=lAe.exec(i)))throw new Error("invalid format: "+i);var e;return new v3({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Np.prototype=v3.prototype;function v3(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}v3.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Bj(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var B2;function Uj(i,e){var t=YA(i,e);if(!t)return B2=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(B2=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+YA(i,Math.max(0,e+s-1))[0]}function rD(i,e){var t=YA(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}var sD={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:Dj,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>rD(i*100,e),r:rD,s:Uj,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function oD(i){return i}var kj=Array.prototype.map,Gj=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function zj(i){var e=i.grouping===void 0||i.thousands===void 0?oD:Fj(kj.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?oD:Oj(kj.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"\u2212":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(f,p){f=Np(f);var x=f.fill,v=f.align,w=f.sign,S=f.symbol,T=f.zero,P=f.width,R=f.comma,C=f.precision,L=f.trim,D=f.type;D==="n"?(R=!0,D="g"):sD[D]||(C===void 0&&(C=12),L=!0,D="g"),(T||x==="0"&&v==="=")&&(T=!0,x="0",v="=");var F=(p&&p.prefix!==void 0?p.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),N=(S==="$"?n:/[%p]/.test(D)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),B=sD[D],z=/[defgprs%]/.test(D);C=C===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function V(H){var K=F,J=N,j,Z,ee;if(D==="c")J=B(H)+J,H="";else{H=+H;var ae=H<0||1/H<0;if(H=isNaN(H)?l:B(Math.abs(H),C),L&&(H=Bj(H)),ae&&+H==0&&w!=="+"&&(ae=!1),K=(ae?w==="("?w:a:w==="-"||w==="("?"":w)+K,J=(D==="s"&&!isNaN(H)&&B2!==void 0?Gj[8+B2/3]:"")+J+(ae&&w==="("?")":""),z){for(j=-1,Z=H.length;++j<Z;)if(ee=H.charCodeAt(j),48>ee||ee>57){J=(ee===46?r+H.slice(j+1):H.slice(j))+J,H=H.slice(0,j);break}}}R&&!T&&(H=e(H,1/0));var ce=K.length+H.length+J.length,de=ce<P?new Array(P-ce+1).join(x):"";switch(R&&T&&(H=e(de+H,de.length?P-J.length:1/0),de=""),v){case"<":H=K+H+J+de;break;case"=":H=K+de+H+J;break;case"^":H=de.slice(0,ce=de.length>>1)+K+H+J+de.slice(ce);break;default:H=de+K+H+J;break}return s(H)}return V.toString=function(){return f+""},V}function u(f,p){var x=Math.max(-8,Math.min(8,Math.floor(ah(p)/3)))*3,v=Math.pow(10,-x),w=c((f=Np(f),f.type="f",f),{suffix:Gj[8+x/3]});return function(S){return w(v*S)}}return{format:c,formatPrefix:u}}var b3,w3,S3;aD({thousands:",",grouping:[3],currency:["$",""]});function aD(i){return b3=zj(i),w3=b3.format,S3=b3.formatPrefix,b3}function lD(i){return Math.max(0,-ah(Math.abs(i)))}function cD(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ah(e)/3)))*3-ah(Math.abs(i)))}function uD(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,ah(e)-ah(i))+1}function hD(i,e,t,n){var r=HL(i,e,t),s;switch(n=Np(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=cD(r,o))&&(n.precision=s),S3(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=uD(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=lD(r))&&(n.precision=s-(n.type==="%")*2);break}}return w3(n)}function fD(i){var e=i.domain;return i.ticks=function(t){var n=e();return l3(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return hD(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,c,u=10;for(a<o&&(c=o,o=a,a=c,c=r,r=s,s=c);u-- >0;){if(c=N2(o,a,t),c===l)return n[r]=o,n[s]=a,e(n);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return i},i}function ja(){var i=iD();return i.copy=function(){return Lj(i,ja())},f3.apply(i,arguments),fD(i)}function U2(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[I2(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[i,n[0]]:c>=t?[n[t-1],e]:[n[c-1],n[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return U2().domain([i,e]).range(r).unknown(s)},f3.apply(fD(o),arguments)}var Cn=1e-6,KA=1e-12,Jn=Math.PI,Js=Jn/2,O_=Jn/4,eo=Jn*2,Ki=180/Jn,mn=Jn/180,ei=Math.abs,B_=Math.atan,os=Math.atan2,fn=Math.cos,k2=Math.ceil,Vj=Math.exp;var T3=Math.hypot,qj=Math.log;var an=Math.sin,Hj=Math.sign||function(i){return i>0?1:i<0?-1:0},yo=Math.sqrt,Wj=Math.tan;function jj(i){return i>1?0:i<-1?Jn:Math.acos(i)}function qo(i){return i>1?Js:i<-1?-Js:Math.asin(i)}function dD(i){return(i=an(i/2))*i}function $r(){}function E3(i,e){i&&$j.hasOwnProperty(i.type)&&$j[i.type](i,e)}var Xj={Feature:function(i,e){E3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)E3(t[n].geometry,e)}},$j={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){pD(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)pD(t[n],e,0)},Polygon:function(i,e){Yj(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)Yj(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)E3(t[n],e)}};function pD(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function Yj(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)pD(i[t],e,1);e.polygonEnd()}function Lp(i,e){i&&Xj.hasOwnProperty(i.type)?Xj[i.type](i,e):E3(i,e)}var G2=new xo,Kj=new xo,Zj,Qj,AD,mD,gD,lh={point:$r,lineStart:$r,lineEnd:$r,polygonStart:function(){G2=new xo,lh.lineStart=cAe,lh.lineEnd=uAe},polygonEnd:function(){var i=+G2;Kj.add(i<0?eo+i:i),this.lineStart=this.lineEnd=this.point=$r},sphere:function(){Kj.add(eo)}};function cAe(){lh.point=hAe}function uAe(){Jj(Zj,Qj)}function hAe(i,e){lh.point=Jj,Zj=i,Qj=e,i*=mn,e*=mn,AD=i,mD=fn(e=e/2+O_),gD=an(e)}function Jj(i,e){i*=mn,e*=mn,e=e/2+O_;var t=i-AD,n=t>=0?1:-1,r=n*t,s=fn(e),o=an(e),a=gD*o,l=mD*s+a*fn(r),c=a*n*an(r);G2.add(os(c,l)),AD=i,mD=s,gD=o}function ZA(i){return[os(i[1],i[0]),qo(i[2])]}function tc(i){var e=i[0],t=i[1],n=fn(t);return[n*fn(e),n*an(e),an(t)]}function z2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Of(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function M3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function V2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function QA(i){var e=yo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Dr,Xa,Yr,yl,JA,iX,rX,U_,q2,Dp,Uf,Bf={point:_D,lineStart:eX,lineEnd:tX,polygonStart:function(){Bf.point=oX,Bf.lineStart=fAe,Bf.lineEnd=dAe,q2=new xo,lh.polygonStart()},polygonEnd:function(){lh.polygonEnd(),Bf.point=_D,Bf.lineStart=eX,Bf.lineEnd=tX,G2<0?(Dr=-(Yr=180),Xa=-(yl=90)):q2>Cn?yl=90:q2<-Cn&&(Xa=-90),Uf[0]=Dr,Uf[1]=Yr},sphere:function(){Dr=-(Yr=180),Xa=-(yl=90)}};function _D(i,e){Dp.push(Uf=[Dr=i,Yr=i]),e<Xa&&(Xa=e),e>yl&&(yl=e)}function sX(i,e){var t=tc([i*mn,e*mn]);if(U_){var n=Of(U_,t),r=[n[1],-n[0],0],s=Of(r,n);QA(s),s=ZA(s);var o=i-JA,a=o>0?1:-1,l=s[0]*Ki*a,c,u=ei(o)>180;u^(a*JA<l&&l<a*i)?(c=s[1]*Ki,c>yl&&(yl=c)):(l=(l+360)%360-180,u^(a*JA<l&&l<a*i)?(c=-s[1]*Ki,c<Xa&&(Xa=c)):(e<Xa&&(Xa=e),e>yl&&(yl=e))),u?i<JA?xl(Dr,i)>xl(Dr,Yr)&&(Yr=i):xl(i,Yr)>xl(Dr,Yr)&&(Dr=i):Yr>=Dr?(i<Dr&&(Dr=i),i>Yr&&(Yr=i)):i>JA?xl(Dr,i)>xl(Dr,Yr)&&(Yr=i):xl(i,Yr)>xl(Dr,Yr)&&(Dr=i)}else Dp.push(Uf=[Dr=i,Yr=i]);e<Xa&&(Xa=e),e>yl&&(yl=e),U_=t,JA=i}function eX(){Bf.point=sX}function tX(){Uf[0]=Dr,Uf[1]=Yr,Bf.point=_D,U_=null}function oX(i,e){if(U_){var t=i-JA;q2.add(ei(t)>180?t+(t>0?360:-360):t)}else iX=i,rX=e;lh.point(i,e),sX(i,e)}function fAe(){lh.lineStart()}function dAe(){oX(iX,rX),lh.lineEnd(),ei(q2)>Cn&&(Dr=-(Yr=180)),Uf[0]=Dr,Uf[1]=Yr,U_=null}function xl(i,e){return(e-=i)<0?e+360:e}function pAe(i,e){return i[0]-e[0]}function nX(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function C3(i){var e,t,n,r,s,o,a;if(yl=Yr=-(Dr=Xa=1/0),Dp=[],Lp(i,Bf),t=Dp.length){for(Dp.sort(pAe),e=1,n=Dp[0],s=[n];e<t;++e)r=Dp[e],nX(n,r[0])||nX(n,r[1])?(xl(n[0],r[1])>xl(n[0],n[1])&&(n[1]=r[1]),xl(r[0],n[1])>xl(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(o=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(a=xl(n[1],r[0]))>o&&(o=a,Dr=r[0],Yr=n[1])}return Dp=Uf=null,Dr===1/0||Xa===1/0?[[NaN,NaN],[NaN,NaN]]:[[Dr,Xa],[Yr,yl]]}var H2,R3,P3,I3,N3,L3,D3,F3,xD,yD,vD,cX,uX,ga,_a,xa,$c={sphere:$r,point:bD,lineStart:aX,lineEnd:lX,polygonStart:function(){$c.lineStart=gAe,$c.lineEnd=_Ae},polygonEnd:function(){$c.lineStart=aX,$c.lineEnd=lX}};function bD(i,e){i*=mn,e*=mn;var t=fn(e);W2(t*fn(i),t*an(i),an(e))}function W2(i,e,t){++H2,P3+=(i-P3)/H2,I3+=(e-I3)/H2,N3+=(t-N3)/H2}function aX(){$c.point=AAe}function AAe(i,e){i*=mn,e*=mn;var t=fn(e);ga=t*fn(i),_a=t*an(i),xa=an(e),$c.point=mAe,W2(ga,_a,xa)}function mAe(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=os(yo((o=_a*s-xa*r)*o+(o=xa*n-ga*s)*o+(o=ga*r-_a*n)*o),ga*n+_a*r+xa*s);R3+=o,L3+=o*(ga+(ga=n)),D3+=o*(_a+(_a=r)),F3+=o*(xa+(xa=s)),W2(ga,_a,xa)}function lX(){$c.point=bD}function gAe(){$c.point=xAe}function _Ae(){hX(cX,uX),$c.point=bD}function xAe(i,e){cX=i,uX=e,i*=mn,e*=mn,$c.point=hX;var t=fn(e);ga=t*fn(i),_a=t*an(i),xa=an(e),W2(ga,_a,xa)}function hX(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=_a*s-xa*r,a=xa*n-ga*s,l=ga*r-_a*n,c=T3(o,a,l),u=qo(c),f=c&&-u/c;xD.add(f*o),yD.add(f*a),vD.add(f*l),R3+=u,L3+=u*(ga+(ga=n)),D3+=u*(_a+(_a=r)),F3+=u*(xa+(xa=s)),W2(ga,_a,xa)}function O3(i){H2=R3=P3=I3=N3=L3=D3=F3=0,xD=new xo,yD=new xo,vD=new xo,Lp(i,$c);var e=+xD,t=+yD,n=+vD,r=T3(e,t,n);return r<KA&&(e=L3,t=D3,n=F3,R3<Cn&&(e=P3,t=I3,n=N3),r=T3(e,t,n),r<KA)?[NaN,NaN]:[os(t,e)*Ki,qo(n/r)*Ki]}function j2(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function wD(i,e){return ei(i)>Jn&&(i-=Math.round(i/eo)*eo),[i,e]}wD.invert=wD;function SD(i,e,t){return(i%=eo)?e||t?j2(dX(i),pX(e,t)):dX(i):e||t?pX(e,t):wD}function fX(i){return function(e,t){return e+=i,ei(e)>Jn&&(e-=Math.round(e/eo)*eo),[e,t]}}function dX(i){var e=fX(i);return e.invert=fX(-i),e}function pX(i,e){var t=fn(i),n=an(i),r=fn(e),s=an(e);function o(a,l){var c=fn(l),u=fn(a)*c,f=an(a)*c,p=an(l),x=p*t+u*n;return[os(f*r-x*s,u*t-p*n),qo(x*r+f*s)]}return o.invert=function(a,l){var c=fn(l),u=fn(a)*c,f=an(a)*c,p=an(l),x=p*r-f*s;return[os(f*r+p*s,u*t+x*n),qo(x*t-u*n)]},o}function TD(i){i=SD(i[0]*mn,i[1]*mn,i.length>2?i[2]*mn:0);function e(t){return t=i(t[0]*mn,t[1]*mn),t[0]*=Ki,t[1]*=Ki,t}return e.invert=function(t){return t=i.invert(t[0]*mn,t[1]*mn),t[0]*=Ki,t[1]*=Ki,t},e}function mX(i,e,t,n,r,s){if(t){var o=fn(e),a=an(e),l=n*t;r==null?(r=e+n*eo,s=e-l/2):(r=AX(o,r),s=AX(o,s),(n>0?r<s:r>s)&&(r+=n*eo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=ZA([o,-a*fn(u),-a*an(u)]),i.point(c[0],c[1])}}function AX(i,e){e=tc(e),e[0]-=i,QA(e);var t=jj(-e[1]);return((-e[2]<0?-t:t)+eo-Cn)%eo}function B3(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:$r,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function k_(i,e){return ei(i[0]-e[0])<Cn&&ei(i[1]-e[1])<Cn}function U3(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function k3(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(v){if(!((w=v.length-1)<=0)){var w,S=v[0],T=v[w],P;if(k_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=v[a])[0],S[1]);r.lineEnd();return}T[0]+=2*Cn}s.push(P=new U3(S,v,null,!0)),o.push(P.o=new U3(S,null,P,!1)),s.push(P=new U3(T,v,null,!1)),o.push(P.o=new U3(T,null,P,!0))}}),!!s.length){for(o.sort(e),gX(s),gX(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var p=c,x=!0;p.v;)if((p=p.n)===c)return;u=p.z,r.lineStart();do{if(p.v=p.o.v=!0,p.e){if(x)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(p.x,p.n.x,1,r);p=p.n}else{if(x)for(u=p.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(p.x,p.p.x,-1,r);p=p.p}p=p.o,u=p.z,x=!x}while(!p.v);r.lineEnd()}}}function gX(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function ED(i){return ei(i[0])<=Jn?i[0]:Hj(i[0])*((ei(i[0])+Jn)%eo-Jn)}function G3(i,e){var t=ED(e),n=e[1],r=an(n),s=[an(t),-fn(t),0],o=0,a=0,l=new xo;r===1?n=Js+Cn:r===-1&&(n=-Js-Cn);for(var c=0,u=i.length;c<u;++c)if(p=(f=i[c]).length)for(var f,p,x=f[p-1],v=ED(x),w=x[1]/2+O_,S=an(w),T=fn(w),P=0;P<p;++P,v=C,S=D,T=F,x=R){var R=f[P],C=ED(R),L=R[1]/2+O_,D=an(L),F=fn(L),N=C-v,B=N>=0?1:-1,z=B*N,V=z>Jn,H=S*D;if(l.add(os(H*B*an(z),T*F+H*fn(z))),o+=V?N+B*eo:N,V^v>=t^C>=t){var K=Of(tc(x),tc(R));QA(K);var J=Of(s,K);QA(J);var j=(V^N>=0?-1:1)*qo(J[2]);(n>j||n===j&&(K[0]||K[1]))&&(a+=V^N>=0?1:-1)}}return(o<-Cn||o<Cn&&l<-KA)^a&1}function z3(i,e,t,n){return function(r){var s=e(r),o=B3(),a=e(o),l=!1,c,u,f,p={point:x,lineStart:w,lineEnd:S,polygonStart:function(){p.point=T,p.lineStart=P,p.lineEnd=R,u=[],c=[]},polygonEnd:function(){p.point=x,p.lineStart=w,p.lineEnd=S,u=rh(u);var C=G3(c,n);u.length?(l||(r.polygonStart(),l=!0),k3(u,vAe,C,t,r)):C&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),u=c=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function x(C,L){i(C,L)&&r.point(C,L)}function v(C,L){s.point(C,L)}function w(){p.point=v,s.lineStart()}function S(){p.point=x,s.lineEnd()}function T(C,L){f.push([C,L]),a.point(C,L)}function P(){a.lineStart(),f=[]}function R(){T(f[0][0],f[0][1]),a.lineEnd();var C=a.clean(),L=o.result(),D,F=L.length,N,B,z;if(f.pop(),c.push(f),f=null,!!F){if(C&1){if(B=L[0],(N=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<N;++D)r.point((z=B[D])[0],z[1]);r.lineEnd()}return}F>1&&C&2&&L.push(L.pop().concat(L.shift())),u.push(L.filter(yAe))}}return p}}function yAe(i){return i.length>1}function vAe(i,e){return((i=i.x)[0]<0?i[1]-Js-Cn:Js-i[1])-((e=e.x)[0]<0?e[1]-Js-Cn:Js-e[1])}var MD=z3(function(){return!0},bAe,SAe,[-Jn,-Js]);function bAe(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?Jn:-Jn,l=ei(s-e);ei(l-Jn)<Cn?(i.point(e,t=(t+o)/2>0?Js:-Js),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=Jn&&(ei(e-n)<Cn&&(e-=n*Cn),ei(s-a)<Cn&&(s-=a*Cn),t=wAe(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function wAe(i,e,t,n){var r,s,o=an(i-t);return ei(o)>Cn?B_((an(e)*(s=fn(n))*an(t)-an(n)*(r=fn(e))*an(i))/(r*s*o)):(e+n)/2}function SAe(i,e,t,n){var r;if(i==null)r=t*Js,n.point(-Jn,r),n.point(0,r),n.point(Jn,r),n.point(Jn,0),n.point(Jn,-r),n.point(0,-r),n.point(-Jn,-r),n.point(-Jn,0),n.point(-Jn,r);else if(ei(i[0]-e[0])>Cn){var s=i[0]<e[0]?Jn:-Jn;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function _X(i){var e=fn(i),t=2*mn,n=e>0,r=ei(e)>Cn;function s(u,f,p,x){mX(x,i,t,p,u,f)}function o(u,f){return fn(u)*fn(f)>e}function a(u){var f,p,x,v,w;return{lineStart:function(){v=x=!1,w=1},point:function(S,T){var P=[S,T],R,C=o(S,T),L=n?C?0:c(S,T):C?c(S+(S<0?Jn:-Jn),T):0;if(!f&&(v=x=C)&&u.lineStart(),C!==x&&(R=l(f,P),(!R||k_(f,R)||k_(P,R))&&(P[2]=1)),C!==x)w=0,C?(u.lineStart(),R=l(P,f),u.point(R[0],R[1])):(R=l(f,P),u.point(R[0],R[1],2),u.lineEnd()),f=R;else if(r&&f&&n^C){var D;!(L&p)&&(D=l(P,f,!0))&&(w=0,n?(u.lineStart(),u.point(D[0][0],D[0][1]),u.point(D[1][0],D[1][1]),u.lineEnd()):(u.point(D[1][0],D[1][1]),u.lineEnd(),u.lineStart(),u.point(D[0][0],D[0][1],3)))}C&&(!f||!k_(f,P))&&u.point(P[0],P[1]),f=P,x=C,p=L},lineEnd:function(){x&&u.lineEnd(),f=null},clean:function(){return w|(v&&x)<<1}}}function l(u,f,p){var x=tc(u),v=tc(f),w=[1,0,0],S=Of(x,v),T=z2(S,S),P=S[0],R=T-P*P;if(!R)return!p&&u;var C=e*T/R,L=-e*P/R,D=Of(w,S),F=V2(w,C),N=V2(S,L);M3(F,N);var B=D,z=z2(F,B),V=z2(B,B),H=z*z-V*(z2(F,F)-1);if(!(H<0)){var K=yo(H),J=V2(B,(-z-K)/V);if(M3(J,F),J=ZA(J),!p)return J;var j=u[0],Z=f[0],ee=u[1],ae=f[1],ce;Z<j&&(ce=j,j=Z,Z=ce);var de=Z-j,ve=ei(de-Jn)<Cn,Ie=ve||de<Cn;if(!ve&&ae<ee&&(ce=ee,ee=ae,ae=ce),Ie?ve?ee+ae>0^J[1]<(ei(J[0]-j)<Cn?ee:ae):ee<=J[1]&&J[1]<=ae:de>Jn^(j<=J[0]&&J[0]<=Z)){var Qe=V2(B,(-z+K)/V);return M3(Qe,F),[J,ZA(Qe)]}}}function c(u,f){var p=n?i:Jn-i,x=0;return u<-p?x|=1:u>p&&(x|=2),f<-p?x|=4:f>p&&(x|=8),x}return z3(o,a,s,n?[0,-i]:[-Jn,i-Jn])}function xX(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,p=l-o,x=c-a,v;if(v=t-o,!(!p&&v>0)){if(v/=p,p<0){if(v<u)return;v<f&&(f=v)}else if(p>0){if(v>f)return;v>u&&(u=v)}if(v=r-o,!(!p&&v<0)){if(v/=p,p<0){if(v>f)return;v>u&&(u=v)}else if(p>0){if(v<u)return;v<f&&(f=v)}if(v=n-a,!(!x&&v>0)){if(v/=x,x<0){if(v<u)return;v<f&&(f=v)}else if(x>0){if(v>f)return;v>u&&(u=v)}if(v=s-a,!(!x&&v<0)){if(v/=x,x<0){if(v>f)return;v>u&&(u=v)}else if(x>0){if(v<u)return;v<f&&(f=v)}return u>0&&(i[0]=o+u*p,i[1]=a+u*x),f<1&&(e[0]=o+f*p,e[1]=a+f*x),!0}}}}}var X2=1e9,V3=-X2;function CD(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,p){var x=0,v=0;if(c==null||(x=o(c,f))!==(v=o(u,f))||l(c,u)<0^f>0)do p.point(x===0||x===3?i:t,x>1?n:e);while((x=(x+f+4)%4)!==v);else p.point(u[0],u[1])}function o(c,u){return ei(c[0]-i)<Cn?u>0?0:3:ei(c[0]-t)<Cn?u>0?2:1:ei(c[1]-e)<Cn?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),p=o(u,1);return f!==p?f-p:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=B3(),p,x,v,w,S,T,P,R,C,L,D,F={point:N,lineStart:H,lineEnd:K,polygonStart:z,polygonEnd:V};function N(j,Z){r(j,Z)&&u.point(j,Z)}function B(){for(var j=0,Z=0,ee=x.length;Z<ee;++Z)for(var ae=x[Z],ce=1,de=ae.length,ve=ae[0],Ie,Qe,Ue=ve[0],mt=ve[1];ce<de;++ce)Ie=Ue,Qe=mt,ve=ae[ce],Ue=ve[0],mt=ve[1],Qe<=n?mt>n&&(Ue-Ie)*(n-Qe)>(mt-Qe)*(i-Ie)&&++j:mt<=n&&(Ue-Ie)*(n-Qe)<(mt-Qe)*(i-Ie)&&--j;return j}function z(){u=f,p=[],x=[],D=!0}function V(){var j=B(),Z=D&&j,ee=(p=rh(p)).length;(Z||ee)&&(c.polygonStart(),Z&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),ee&&k3(p,a,j,s,c),c.polygonEnd()),u=c,p=x=v=null}function H(){F.point=J,x&&x.push(v=[]),L=!0,C=!1,P=R=NaN}function K(){p&&(J(w,S),T&&C&&f.rejoin(),p.push(f.result())),F.point=N,C&&u.lineEnd()}function J(j,Z){var ee=r(j,Z);if(x&&v.push([j,Z]),L)w=j,S=Z,T=ee,L=!1,ee&&(u.lineStart(),u.point(j,Z));else if(ee&&C)u.point(j,Z);else{var ae=[P=Math.max(V3,Math.min(X2,P)),R=Math.max(V3,Math.min(X2,R))],ce=[j=Math.max(V3,Math.min(X2,j)),Z=Math.max(V3,Math.min(X2,Z))];xX(ae,ce,i,e,t,n)?(C||(u.lineStart(),u.point(ae[0],ae[1])),u.point(ce[0],ce[1]),ee||u.lineEnd(),D=!1):ee&&(u.lineStart(),u.point(j,Z),D=!1)}P=j,R=Z,C=ee}return F}}var RD,PD,q3,H3,G_={sphere:$r,point:$r,lineStart:TAe,lineEnd:$r,polygonStart:$r,polygonEnd:$r};function TAe(){G_.point=MAe,G_.lineEnd=EAe}function EAe(){G_.point=G_.lineEnd=$r}function MAe(i,e){i*=mn,e*=mn,PD=i,q3=an(e),H3=fn(e),G_.point=CAe}function CAe(i,e){i*=mn,e*=mn;var t=an(e),n=fn(e),r=ei(i-PD),s=fn(r),o=an(r),a=n*o,l=H3*t-q3*n*s,c=q3*t+H3*n*s;RD.add(os(yo(a*a+l*l),c)),PD=i,q3=t,H3=n}function yX(i){return RD=new xo,Lp(i,G_),+RD}var ID=[null,null],RAe={type:"LineString",coordinates:ID};function $a(i,e){return ID[0]=i,ID[1]=e,yX(RAe)}var vX={Feature:function(i,e){return W3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(W3(t[n].geometry,e))return!0;return!1}},bX={Sphere:function(){return!0},Point:function(i,e){return wX(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(wX(t[n],e))return!0;return!1},LineString:function(i,e){return SX(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(SX(t[n],e))return!0;return!1},Polygon:function(i,e){return TX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(TX(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(W3(t[n],e))return!0;return!1}};function W3(i,e){return i&&bX.hasOwnProperty(i.type)?bX[i.type](i,e):!1}function wX(i,e){return $a(i,e)===0}function SX(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=$a(i[s],e),n===0||s>0&&(r=$a(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<KA*r))return!0;t=n}return!1}function TX(i,e){return!!G3(i.map(PAe),EX(e))}function PAe(i){return i=i.map(EX),i.pop(),i}function EX(i){return[i[0]*mn,i[1]*mn]}function ND(i,e){return(i&&vX.hasOwnProperty(i.type)?vX[i.type]:W3)(i,e)}function MX(i,e,t){var n=Ff(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function CX(i,e,t){var n=Ff(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function LD(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,p,x,v,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:P()}}function P(){return Ff(k2(n/u)*u,t,u).map(v).concat(Ff(k2(a/f)*f,o,f).map(w)).concat(Ff(k2(e/l)*l,i,l).filter(function(R){return ei(R%u)>Cn}).map(p)).concat(Ff(k2(s/c)*c,r,c).filter(function(R){return ei(R%f)>Cn}).map(x))}return T.lines=function(){return P().map(function(R){return{type:"LineString",coordinates:R}})},T.outline=function(){return{type:"Polygon",coordinates:[v(n).concat(w(o).slice(1),v(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(R){return arguments.length?T.extentMajor(R).extentMinor(R):T.extentMinor()},T.extentMajor=function(R){return arguments.length?(n=+R[0][0],t=+R[1][0],a=+R[0][1],o=+R[1][1],n>t&&(R=n,n=t,t=R),a>o&&(R=a,a=o,o=R),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(R){return arguments.length?(e=+R[0][0],i=+R[1][0],s=+R[0][1],r=+R[1][1],e>i&&(R=e,e=i,i=R),s>r&&(R=s,s=r,r=R),T.precision(S)):[[e,s],[i,r]]},T.step=function(R){return arguments.length?T.stepMajor(R).stepMinor(R):T.stepMinor()},T.stepMajor=function(R){return arguments.length?(u=+R[0],f=+R[1],T):[u,f]},T.stepMinor=function(R){return arguments.length?(l=+R[0],c=+R[1],T):[l,c]},T.precision=function(R){return arguments.length?(S=+R,p=MX(s,r,90),x=CX(e,i,S),v=MX(a,o,90),w=CX(n,t,S),T):S},T.extentMajor([[-180,-90+Cn],[180,90-Cn]]).extentMinor([[-180,-80-Cn],[180,80+Cn]])}function DD(){return LD()()}function em(i,e){var t=i[0]*mn,n=i[1]*mn,r=e[0]*mn,s=e[1]*mn,o=fn(n),a=an(n),l=fn(s),c=an(s),u=o*fn(t),f=o*an(t),p=l*fn(r),x=l*an(r),v=2*qo(yo(dD(s-n)+o*l*dD(r-t))),w=an(v),S=v?function(T){var P=an(T*=v)/w,R=an(v-T)/w,C=R*u+P*p,L=R*f+P*x,D=R*a+P*c;return[os(L,C)*Ki,os(D,yo(C*C+L*L))*Ki]}:function(){return[t*Ki,n*Ki]};return S.distance=v,S}var FD=i=>i;var z_=1/0,j3=z_,$2=-z_,X3=$2,IAe={point:NAe,lineStart:$r,lineEnd:$r,polygonStart:$r,polygonEnd:$r,result:function(){var i=[[z_,j3],[$2,X3]];return $2=X3=-(j3=z_=1/0),i}};function NAe(i,e){i<z_&&(z_=i),i>$2&&($2=i),e<j3&&(j3=e),e>X3&&(X3=e)}var OD=IAe;function Y2(i){return function(e){var t=new BD;for(var n in i)t[n]=i[n];return t.stream=e,t}}function BD(){}BD.prototype={constructor:BD,point:function(i,e){this.stream.point(i,e)},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()}};function UD(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),Lp(t,i.stream(OD)),e(OD.result()),n!=null&&i.clipExtent(n),i}function kD(i,e,t){return UD(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function RX(i,e,t){return kD(i,[[0,0],e],t)}function PX(i,e,t){return UD(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function IX(i,e,t){return UD(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var NX=16,LAe=fn(30*mn);function GD(i,e){return+e?FAe(i,e):DAe(i)}function DAe(i){return Y2({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function FAe(i,e){function t(n,r,s,o,a,l,c,u,f,p,x,v,w,S){var T=c-n,P=u-r,R=T*T+P*P;if(R>4*e&&w--){var C=o+p,L=a+x,D=l+v,F=yo(C*C+L*L+D*D),N=qo(D/=F),B=ei(ei(D)-1)<Cn||ei(s-f)<Cn?(s+f)/2:os(L,C),z=i(B,N),V=z[0],H=z[1],K=V-n,J=H-r,j=P*K-T*J;(j*j/R>e||ei((T*K+P*J)/R-.5)>.3||o*p+a*x+l*v<LAe)&&(t(n,r,s,o,a,l,V,H,B,C/=F,L/=F,D,w,S),S.point(V,H),t(V,H,B,C,L,D,c,u,f,p,x,v,w,S))}}return function(n){var r,s,o,a,l,c,u,f,p,x,v,w,S={point:T,lineStart:P,lineEnd:C,polygonStart:function(){n.polygonStart(),S.lineStart=L},polygonEnd:function(){n.polygonEnd(),S.lineStart=P}};function T(N,B){N=i(N,B),n.point(N[0],N[1])}function P(){f=NaN,S.point=R,n.lineStart()}function R(N,B){var z=tc([N,B]),V=i(N,B);t(f,p,u,x,v,w,f=V[0],p=V[1],u=N,x=z[0],v=z[1],w=z[2],NX,n),n.point(f,p)}function C(){S.point=T,n.lineEnd()}function L(){P(),S.point=D,S.lineEnd=F}function D(N,B){R(r=N,B),s=f,o=p,a=x,l=v,c=w,S.point=R}function F(){t(f,p,u,x,v,w,s,o,r,a,l,c,NX,n),S.lineEnd=C,C()}return S}}var OAe=Y2({point:function(i,e){this.stream.point(i*mn,e*mn)}});function BAe(i){return Y2({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function UAe(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function LX(i,e,t,n,r,s){if(!s)return UAe(i,e,t,n,r);var o=fn(s),a=an(s),l=o*i,c=a*i,u=o/i,f=a/i,p=(a*t-o*e)/i,x=(a*e+o*t)/i;function v(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return v.invert=function(w,S){return[n*(u*w-f*S+p),r*(x-f*w-u*S)]},v}function zD(i){return kAe(function(){return i})()}function kAe(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,p=1,x=1,v=null,w=MD,S=null,T,P,R,C=FD,L=.5,D,F,N,B,z;function V(j){return N(j[0]*mn,j[1]*mn)}function H(j){return j=N.invert(j[0],j[1]),j&&[j[0]*Ki,j[1]*Ki]}V.stream=function(j){return B&&z===j?B:B=OAe(BAe(u)(w(D(C(z=j)))))},V.preclip=function(j){return arguments.length?(w=j,v=void 0,J()):w},V.postclip=function(j){return arguments.length?(C=j,S=T=P=R=null,J()):C},V.clipAngle=function(j){return arguments.length?(w=+j?_X(v=j*mn):(v=null,MD),J()):v*Ki},V.clipExtent=function(j){return arguments.length?(C=j==null?(S=T=P=R=null,FD):CD(S=+j[0][0],T=+j[0][1],P=+j[1][0],R=+j[1][1]),J()):S==null?null:[[S,T],[P,R]]},V.scale=function(j){return arguments.length?(t=+j,K()):t},V.translate=function(j){return arguments.length?(n=+j[0],r=+j[1],K()):[n,r]},V.center=function(j){return arguments.length?(s=j[0]%360*mn,o=j[1]%360*mn,K()):[s*Ki,o*Ki]},V.rotate=function(j){return arguments.length?(a=j[0]%360*mn,l=j[1]%360*mn,c=j.length>2?j[2]%360*mn:0,K()):[a*Ki,l*Ki,c*Ki]},V.angle=function(j){return arguments.length?(f=j%360*mn,K()):f*Ki},V.reflectX=function(j){return arguments.length?(p=j?-1:1,K()):p<0},V.reflectY=function(j){return arguments.length?(x=j?-1:1,K()):x<0},V.precision=function(j){return arguments.length?(D=GD(F,L=j*j),J()):yo(L)},V.fitExtent=function(j,Z){return kD(V,j,Z)},V.fitSize=function(j,Z){return RX(V,j,Z)},V.fitWidth=function(j,Z){return PX(V,j,Z)},V.fitHeight=function(j,Z){return IX(V,j,Z)};function K(){var j=LX(t,0,0,p,x,f).apply(null,e(s,o)),Z=LX(t,n-j[0],r-j[1],p,x,f);return u=SD(a,l,c),F=j2(e,Z),N=j2(u,F),D=GD(F,L),J()}function J(){return B=z=null,V}return function(){return e=i.apply(this,arguments),V.invert=e.invert&&H,K()}}function DX(i){return function(e,t){var n=yo(e*e+t*t),r=i(n),s=an(r),o=fn(r);return[os(e*s,n*o),qo(n&&t*s/n)]}}function K2(i,e){return[i,qj(Wj((Js+e)/2))]}K2.invert=function(i,e){return[i,2*B_(Vj(e))-Js]};function VD(i,e){var t=fn(e),n=1+fn(i)*t;return[t*an(i)/n,an(e)/n]}VD.invert=DX(function(i){return 2*B_(i)});function qD(){return zD(VD).scale(250).clipAngle(142)}function jD(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function GAe(i){if(Array.isArray(i))return i}function zAe(i){if(Array.isArray(i))return jD(i)}function Z2(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function VAe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function qAe(i,e,t){return e=Z3(e),JAe(i,kX()?Reflect.construct(e,[],Z3(i).constructor):e.apply(i,t))}function UX(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function HAe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ti(i,e){return i.get(Z2(i,e))}function Fp(i,e,t){UX(i,e),e.set(i,t)}function Op(i,e,t){return i.set(Z2(i,e),t),t}function WAe(i,e){UX(i,e),e.add(i)}function jAe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,zX(n.key),n)}}function XAe(i,e,t){return e&&jAe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function V_(i,e,t){return(e=zX(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Z3(i){return Z3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Z3(i)}function $Ae(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&XD(i,e)}function kX(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kX=function(){return!!i})()}function YAe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function KAe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function ZAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4118-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QAe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4119-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JAe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return VAe(i)}function XD(i,e){return XD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},XD(i,e)}function K3(i,e){return GAe(i)||KAe(i,e)||VX(i,e)||ZAe()}function GX(i){return zAe(i)||YAe(i)||VX(i)||QAe()}function eme(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function zX(i){var e=eme(i,"string");return typeof e=="symbol"?e:e+""}function VX(i,e){if(i){if(typeof i=="string")return jD(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?jD(i,e):void 0}}var qX=function(e){e instanceof Array?e.forEach(qX):(e.map&&e.map.dispose(),e.dispose())},$D=function(e){e.geometry&&e.geometry.dispose(),e.material&&qX(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach($D)};function HX(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function tme(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function tm(i){return i*Math.PI/180}var WX=function(e){return 1-(K2(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},HD=function(e){return Math.max(0,Math.min(1,WX(e)))},FX=function(e){return .5-K2.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},nme=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=ja().domain([1,0]).range([t,n]).clamp(!0),s=ja().domain([HD(t),HD(n)]).range([1,0]).clamp(!0),o=function(f){return s(HD(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},OX=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,WX(a))));var l=Math.floor(a*s);return[o,l]},YD=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),c=360/l,u=180/l,f=s===void 0?l-1:s,p=o===void 0?l-1:o,x=n,v=Math.min(l-1,f);x<=v;x++)for(var w=r,S=Math.min(l-1,p);w<=S;w++){var T=w,P=u;if(t){T=w===0?w:FX(w/l)*l;var R=w+1===l?w+1:FX((w+1)/l)*l;P=(R-T)*180/l}var C=-180+(x+.5)*c,L=90-(T*180/l+P/2),D=P;a.push({x,y:w,lng:C,lat:L,latLen:D})}return a},ime=6,rme=7,sme=3,ome=90,ch=new WeakMap,Bp=new WeakMap,WD=new WeakMap,$3=new WeakMap,nc=new WeakMap,Q3=new WeakMap,q_=new WeakMap,nm=new WeakMap,Y3=new WeakSet,jX=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,c=l===void 0?17:l,u=r.mercatorProjection,f=u===void 0?!0:u;return HAe(this,e),n=qAe(this,e),WAe(n,Y3),Fp(n,ch,void 0),Fp(n,Bp,void 0),Fp(n,WD,void 0),Fp(n,$3,void 0),Fp(n,nc,{}),Fp(n,Q3,void 0),Fp(n,q_,void 0),Fp(n,nm,void 0),V_(n,"minLevel",void 0),V_(n,"maxLevel",void 0),V_(n,"thresholds",GX(new Array(30)).map(function(p,x){return 8/Math.pow(2,x)})),V_(n,"curvatureResolution",5),V_(n,"tileMargin",0),V_(n,"clearTiles",function(){Object.values(ti(nc,n)).forEach(function(p){p.forEach(function(x){x.obj&&(n.remove(x.obj),$D(x.obj),delete x.obj)})}),Op(nc,n,{})}),Op(ch,n,t),n.tileUrl=s,Op(Bp,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Op(nm,n,new Hn(new da(ti(ch,n)*.99,180,90),new Us({color:0})))),ti(nm,n).visible=!1,ti(nm,n).material.polygonOffset=!0,ti(nm,n).material.polygonOffsetUnits=3,ti(nm,n).material.polygonOffsetFactor=1,n}return $Ae(e,i),XAe(e,[{key:"tileUrl",get:function(){return ti(WD,this)},set:function(n){Op(WD,this,n),this.updatePov(ti(q_,this))}},{key:"level",get:function(){return ti($3,this)},set:function(n){var r,s=this;ti(nc,this)[n]||Z2(Y3,this,ame).call(this,n);var o=ti($3,this);if(Op($3,this,n),!(n===o||o===void 0)){if(ti(nm,this).visible=n>0,ti(nc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=ti(nc,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)ti(nc,this)[a]&&ti(nc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),$D(l.obj),delete l.obj)});Z2(Y3,this,BX).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Rf))){Op(q_,this,n);var s;if(Op(Q3,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),p=u.lng,x=u.lat,v=u.latLen,w=p-f/2,S=p+f/2,T=x-v/2,P=x+v/2;u.hullPnts=[[x,p],[T,w],[P,w],[T,S],[P,S]].map(function(R){var C=K3(R,2),L=C[0],D=C[1];return HX(L,D,ti(ch,r))}).map(function(R){var C=R.x,L=R.y,D=R.z;return new ie(C,L,D)})}return s||(s=new Kl,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new on().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(R){return s.containsPoint(R.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new ie)),l=(a-ti(ch,this))/ti(ch,this),c=this.thresholds.findIndex(function(u){return u&&u<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,c<0?this.thresholds.length:c)),Z2(Y3,this,BX).call(this)}}}}])})(_s);function ame(i){var e=this;if(i>rme){ti(nc,this)[i]=[];return}var t=ti(nc,this)[i]=YD(i,ti(Bp,this));t.forEach(function(n){return n.centroid=HX(n.lat,n.lng,ti(ch,e))}),t.octree=P2().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function BX(){var i=this;if(!(!this.tileUrl||this.level===void 0||!ti(nc,this).hasOwnProperty(this.level))&&!(!ti(Q3,this)&&this.level>ime)){var e=ti(nc,this)[this.level];if(ti(q_,this)){var t=this.worldToLocal(ti(q_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(ti(q_,this).position.clone()),s=(r.length()-ti(ch,this))*sme;e=(n=e.octree).findAllWithinRadius.apply(n,GX(r).concat([s]))}else{var o=tme(t),a=(o.r/ti(ch,this)-1)*ome,l=a/Math.cos(tm(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=OX(this.level,ti(Bp,this),c[0],u[0]),p=K3(f,2),x=p[0],v=p[1],w=OX(this.level,ti(Bp,this),c[1],u[1]),S=K3(w,2),T=S[0],P=S[1];!e.record&&(e.record={});var R=e.record;if(!R.hasOwnProperty("".concat(Math.round((x+T)/2),"_").concat(Math.round((v+P)/2))))e=YD(this.level,ti(Bp,this),x,v,T,P).map(function(N){var B="".concat(N.x,"_").concat(N.y);return R.hasOwnProperty(B)?R[B]:(R[B]=N,e.push(N),N)});else{for(var C=[],L=x;L<=T;L++)for(var D=v;D<=P;D++){var F="".concat(L,"_").concat(D);R.hasOwnProperty(F)||(R[F]=YD(this.level,ti(Bp,this),L,D,L,D)[0],e.push(R[F])),C.push(R[F])}e=C}}}e.filter(function(N){return!N.obj}).filter(ti(Q3,this)||function(){return!0}).forEach(function(N){var B=N.x,z=N.y,V=N.lng,H=N.lat,K=N.latLen,J=360/Math.pow(2,i.level);if(!N.obj){var j=J*(1-i.tileMargin),Z=K*(1-i.tileMargin),ee=tm(V),ae=tm(-H),ce=new Hn(new da(ti(ch,i),Math.ceil(j/i.curvatureResolution),Math.ceil(Z/i.curvatureResolution),tm(90-j/2)+ee,tm(j),tm(90-Z/2)+ae,tm(Z)),new pa);if(ti(Bp,i)){var de=[H+K/2,H-K/2].map(function(Ue){return .5-Ue/180}),ve=K3(de,2),Ie=ve[0],Qe=ve[1];nme(ce.geometry.attributes.uv,Ie,Qe)}N.obj=ce}N.loading||(N.loading=!0,new zc().load(i.tileUrl(B,z,i.level),function(Ue){var mt=N.obj;mt&&(Ue.colorSpace=Wr,mt.material.map=Ue,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),N.loading=!1}))})}}var tv=new Set,KD=!1;function i6(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;tv.size&&tv.clear();let s=KX(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=fme(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return ZD(s,o,a,l,c),o}function KX(i,e,t,n,r){let s=null;if(r===Tme(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=YX(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=YX(o/n|0,i[o],i[o+1],s);return s&&nv(s,s.next)&&(rv(s),s=s.next),s}function rm(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(tv.size===0||!tv.has(n))&&(nv(n,n.next)||Ss(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),KD=!0,rv(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function ZD(i,e,t,n,r){r&&xme(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Ss(a,i,l)<0&&(r?cme(i,t,n,r):lme(i))){e.push(a.i,i.i,l.i),rv(i),i=l,s=l;continue}if(i=l,i===s){if(KD=!1,i=rm(i),KD){s=i;continue}if(!o){i=ume(i,e),s=i,o=!0;continue}hme(i,e,t,n,r);break}}}function lme(i){let e=i.prev,t=i,n=i.next,r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&!(r===v.x&&a===v.y)&&nE(r,a,s,l,o,c,v.x,v.y)&&Ss(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function cme(i,e,t,n){let r=i.prev,s=i,o=i.next,a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=t6(x,v,e,t,n),P=t6(w,S,e,t,n),R=i.prevZ;for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==o&&!(a===R.x&&u===R.y)&&nE(a,u,l,f,c,p,R.x,R.y)&&Ss(R.prev,R,R.next)>=0)return!1;R=R.prevZ}let C=i.nextZ;for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==o&&!(a===C.x&&u===C.y)&&nE(a,u,l,f,c,p,C.x,C.y)&&Ss(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function ume(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;JX(r,t,t.next,s,!1)&&iv(r,s)&&iv(s,r)&&(e.push(r.i,t.i,s.i),rv(t),rv(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?rm(t):t}function hme(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&bme(s,o)){let a=e$(s,o);s=rm(s,s.next),a=rm(a,a.next),ZD(s,e,t,n,r),ZD(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var QD=!1;function fme(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=KX(i,a,l,n,!1);c===c.next&&tv.add(c),r.push(vme(c))}r.sort(dme),Ame(i.length/n,e.length),QX(t,t),QD=!0;for(let s=0;s<r.length;s++)t=pme(r[s],t);return QD=!1,rm(t)}function dme(i,e){return i.x-e.x||i.y-e.y||(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)}function pme(i,e){let t=gme(i,e);if(!t)return e;let n=e$(t,i),r=n.next;return QX(t,r.next),rm(n,n.next),rm(t,t.next)}var ZX=16,Kr=new Float64Array(0),tE=0,JD=[],e6=[];function Ame(i,e){let t=Math.ceil((i+2*e)/ZX)+e+2;Kr.length<t*4&&(Kr=new Float64Array(t*4)),tE=0}function QX(i,e){let t=i;do{let n=tE++;JD[n]=t;let r=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{let u=t.next;t.z=n,t.x<r&&(r=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),u.x<r&&(r=u.x),u.x>o&&(o=u.x),u.y<s&&(s=u.y),u.y>a&&(a=u.y),t=u}while(++l<ZX&&t!==e);e6[n]=t;let c=n*4;Kr[c]=r,Kr[c+1]=s,Kr[c+2]=o,Kr[c+3]=a}while(t!==e)}function mme(i,e){let t=i.z*4;e.x<Kr[t]&&(Kr[t]=e.x),e.y<Kr[t+1]&&(Kr[t+1]=e.y),e.x>Kr[t+2]&&(Kr[t+2]=e.x),e.y>Kr[t+3]&&(Kr[t+3]=e.y)}function XX(i){let e=e6[i];for(;e.prev.next!==e;)e=e.next;return e6[i]=e,e}function $X(i){let e=JD[i];for(;e.prev.next!==e;)e=e.next;return JD[i]=e,e}function gme(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(nv(i,t))return t;for(let p=0,x=0;p<tE;p++,x+=4){if(r<Kr[x+1]||r>Kr[x+3]||Kr[x]>n||Kr[x+2]<=s)continue;let v=XX(p);t=$X(p);do{if(t.prev.next===t){if(nv(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let w=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(w<=n&&w>s&&(s=w,o=t.x<t.next.x?t:t.next,w===n))return o}}t=t.next}while(t!==v)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(r,l),u=Math.max(r,l),f=1/0;for(let p=0,x=0;p<tE;p++,x+=4){if(Kr[x+2]<a||Kr[x]>n||Kr[x+3]<c||Kr[x+1]>u)continue;let v=XX(p);t=$X(p);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&nE(r<l?n:s,r,a,l,r<l?s:n,r,t.x,t.y)){let w=Math.abs(r-t.y)/(n-t.x);(iv(t,i)||t.y===r&&t.next.y===r&&t.next.x>n)&&(w<f||w===f&&(t.x>o.x||t.x===o.x&&_me(o,t)))&&(o=t,f=w)}t=t.next}while(t!==v)}return o}function _me(i,e){return Ss(i.prev,i,e.prev)<0&&Ss(e.next,i,i.next)<0}var ic=[],Q2=[],im=new Uint32Array(0),J2=new Uint32Array(0),ev=new Uint32Array(256);function xme(i,e,t,n){let r=i,s=0;do r.z=t6(r.x,r.y,e,t,n),ic[s++]=r,r=r.next;while(r!==i);yme(s);let o=null;for(let a=0;a<s;a++){let l=ic[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function yme(i){if(i<=32){for(let e=1;e<i;e++){let t=ic[e],n=t.z,r=e-1;for(;r>=0&&ic[r].z>n;)ic[r+1]=ic[r],r--;ic[r+1]=t}return}im.length<i&&(im=new Uint32Array(i),J2=new Uint32Array(i),Q2=new Array(i));for(let e=0;e<i;e++)im[e]=ic[e].z;J3(i,ic,im,Q2,J2,0),J3(i,Q2,J2,ic,im,8),J3(i,ic,im,Q2,J2,16),J3(i,Q2,J2,ic,im,24)}function J3(i,e,t,n,r,s){ev.fill(0);for(let a=0;a<i;a++)ev[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=ev[a];ev[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=ev[l>>>s&255]++;n[c]=e[a],r[c]=l}}function t6(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function vme(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function nE(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function bme(i,e){let t=nv(i,e)&&Ss(i.prev,i,i.next)>0&&Ss(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||iv(i,e)&&iv(e,i)&&(Ss(i.prev,i,e.prev)!==0||Ss(i,e.prev,e)!==0))&&!wme(i,e)&&(t||Sme(i,e))}function Ss(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function nv(i,e){return i.x===e.x&&i.y===e.y}function JX(i,e,t,n,r=!0){let s=Ss(i,e,t),o=Ss(i,e,n),a=Ss(t,n,i),l=Ss(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&eE(i,t,e)||o===0&&eE(i,n,e)||a===0&&eE(t,i,n)||l===0&&eE(t,e,n)):!1}function eE(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function wme(i,e){let t=Math.min(i.x,e.x),n=Math.max(i.x,e.x),r=Math.min(i.y,e.y),s=Math.max(i.y,e.y),o=i;do{let a=o.next;if(o.x>n&&a.x>n||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<r&&a.y<r){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==e.i&&a.i!==e.i&&JX(o,a,i,e))return!0;o=a}while(o!==i);return!1}function iv(i,e){return Ss(i.prev,i,i.next)<0?Ss(i,e,i.next)>=0&&Ss(i,i.prev,e)>=0:Ss(i,e,i.prev)<0||Ss(i,i.next,e)<0}function Sme(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do{let o=t.next;t.y>s!=o.y>s&&r<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(n=!n),t=o}while(t!==i);return n}function e$(i,e){let t=n6(i.i,i.x,i.y),n=n6(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function YX(i,e,t,n){let r=n6(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function rv(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ),QD&&mme(i.prev,i.next)}function n6(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Tme(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}function H_(i){let e=[],t=[],n=i[0][0].length,r=0,s=0;for(let o of i){for(let a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function s6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Eme(i){if(Array.isArray(i))return i}function Mme(i){if(Array.isArray(i))return s6(i)}function Cme(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Rme(i,e,t){return e=iE(e),Ume(i,i$()?Reflect.construct(e,[],iE(i).constructor):e.apply(i,t))}function Pme(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Ime(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Nme(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=l6(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.4120-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function iE(i){return iE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},iE(i)}function Lme(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&o6(i,e)}function i$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(i$=function(){return!!i})()}function Dme(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Fme(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Ome(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4121-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4122-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ume(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cme(i)}function o6(i,e){return o6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},o6(i,e)}function sv(i,e){return Eme(i)||Fme(i,e)||l6(i,e)||Ome()}function kme(i){return Mme(i)||Dme(i)||l6(i)||Bme()}function l6(i,e){if(i){if(typeof i=="string")return s6(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?s6(i,e):void 0}}var t$=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=$a(s,r)*180/Math.PI;if(o>t)for(var a=em(r,s),l=r.length>2||s.length>2?oh(r[2]||0,s[2]||0):null,c=l?function(p){return[].concat(kme(a(p)),[l(p)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},a6=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Zn,Float32BufferAttribute:kn},Gme=new a6.BufferGeometry().setAttribute?"setAttribute":"addAttribute",c6=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;Pme(this,e),n=Rme(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:p,MultiLineString:x,Polygon:v,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;ov({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Gme]("position",new a6.Float32BufferAttribute(l,3));function u(S,T){var P=r6(S[1],S[0],T+(S[2]||0)),R=[];return[{vertices:P,indices:R}]}function f(S,T){var P={vertices:[],indices:[]};return S.map(function(R){return u(R,T)}).forEach(function(R){var C=sv(R,1),L=C[0];ov(P,L)}),[P]}function p(S,T){for(var P=t$(S,s).map(function(N){var B=sv(N,3),z=B[0],V=B[1],H=B[2],K=H===void 0?0:H;return r6(V,z,T+K)}),R=H_([P]),C=R.vertices,L=Math.round(C.length/3),D=[],F=1;F<L;F++)D.push(F-1,F);return[{vertices:C,indices:D}]}function x(S,T){var P={vertices:[],indices:[]};return S.map(function(R){return p(R,T)}).forEach(function(R){var C=sv(R,1),L=C[0];ov(P,L)}),[P]}function v(S,T){for(var P=S.map(function(j){return t$(j,s).map(function(Z){var ee=sv(Z,3),ae=ee[0],ce=ee[1],de=ee[2],ve=de===void 0?0:de;return r6(ce,ae,T+ve)})}),R=H_(P),C=R.vertices,L=R.holes,D=L[0]||1/0,F=C.slice(0,D*3),N=C.slice(D*3),B=new Set(L),z=Math.round(C.length/3),V=[],H=[],K=1;K<z;K++)B.has(K)||(K<D?V.push(K-1,K):H.push(K-1-D,K-D));var J=[{indices:V,vertices:F}];return L.length&&J.push({indices:H,vertices:N}),J}function w(S,T){var P={vertices:[],indices:[]},R={vertices:[],indices:[]};S.map(function(L){return v(L,T)}).forEach(function(L){var D=sv(L,2),F=D[0],N=D[1];ov(P,F),N&&ov(R,N)});var C=[P];return R.vertices.length&&C.push(R),C}return n}return Lme(e,i),Ime(e)})(a6.BufferGeometry);function ov(i,e){var t=Math.round(i.vertices.length/3);n$(i.vertices,e.vertices),n$(i.indices,e.indices.map(function(n){return n+t}))}function n$(i,e){var t=Nme(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function r6(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var av={};yse(av,{computeMikkTSpaceTangents:()=>zme,computeMorphedAttributes:()=>Yme,deepCloneAttribute:()=>qme,deinterleaveAttribute:()=>rE,deinterleaveGeometry:()=>Wme,estimateBytesUsed:()=>jme,interleaveAttributes:()=>Hme,mergeAttributes:()=>u6,mergeGeometries:()=>Vme,mergeGroups:()=>Kme,mergeVertices:()=>Xme,toCreasedNormals:()=>Zme,toTrianglesDrawMode:()=>$me});function zme(i,e,t=!0){if(!e||!e.isReady)throw new Error("THREE.BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('THREE.BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){let a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}let r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Ni(s,4)),i!==r&&i.copy(r),i}function Vme(i,e=!1){let t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Zn,c=0;for(let u=0;u<i.length;++u){let f=i[u],p=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let x in f.attributes){if(!n.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+x+'" attribute exists among all geometries, or in none of them.'),null;s[x]===void 0&&(s[x]=[]),s[x].push(f.attributes[x]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let x in f.morphAttributes){if(!r.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[x]===void 0&&(o[x]=[]),o[x].push(f.morphAttributes[x])}if(e){let x;if(t)x=f.index.count;else if(f.attributes.position!==void 0)x=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,x,u),c+=x}}if(t){let u=0,f=[];for(let p=0;p<i.length;++p){let x=i[p].index;for(let v=0;v<x.count;++v)f.push(x.getX(v)+u);u+=i[p].attributes.position.count}l.setIndex(f)}for(let u in s){let f=u6(s[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,f)}for(let u in o){let f=o[u][0].length;if(f!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let p=0;p<f;++p){let x=[];for(let w=0;w<o[u].length;++w)x.push(o[u][w][p]);let v=u6(x);if(!v)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(v)}}}return l}function u6(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new Ni(o,t,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let f=l/t;for(let p=0,x=u.count;p<x;p++)for(let v=0;v<t;v++){let w=u.getComponent(p,v);a.setComponent(p+f,v,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function qme(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?rE(i):i.isInstancedBufferAttribute?new Al().copy(i):new Ni().copy(i)}function Hme(i){let e,t=0,n=0;for(let c=0,u=i.length;c<u;++c){let f=i[c];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=f.array.length,n+=f.itemSize}let r=new Mf(new e(t),n),s=0,o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=i.length;c<u;c++){let f=i[c],p=f.itemSize,x=f.count,v=new mo(r,p,s,f.normalized);o.push(v),s+=p;for(let w=0;w<x;w++)for(let S=0;S<p;S++)v[l[S]](w,f[a[S]](w))}return o}function rE(i){let e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n),o;i.isInstancedInterleavedBufferAttribute?o=new Al(s,n,r,i.meshPerAttribute):o=new Ni(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function Wme(i){let e=i.attributes,t=i.morphTargets,n=new Map;for(let r in e){let s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,rE(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,rE(s)),t[r]=n.get(s))}}function jme(i){let e=0;for(let n in i.attributes){let r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}let t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function Xme(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],f=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"];for(let P=0,R=a.length;P<R;P++){let C=a[P],L=i.attributes[C];l[C]=new L.constructor(new L.array.constructor(L.count*L.itemSize),L.itemSize,L.normalized);let D=i.morphAttributes[C];D&&(c[C]||(c[C]=[]),D.forEach((F,N)=>{let B=new F.array.constructor(F.count*F.itemSize);c[C][N]=new F.constructor(B,F.itemSize,F.normalized)}))}let x=e*.5,v=Math.log10(1/e),w=Math.pow(10,v),S=x*w;for(let P=0;P<s;P++){let R=n?n.getX(P):P,C="";for(let L=0,D=a.length;L<D;L++){let F=a[L],N=i.getAttribute(F),B=N.itemSize;for(let z=0;z<B;z++)C+=`${~~(N[f[z]](R)*w+S)},`}if(C in t)u.push(t[C]);else{for(let L=0,D=a.length;L<D;L++){let F=a[L],N=i.getAttribute(F),B=i.morphAttributes[F],z=N.itemSize,V=l[F],H=c[F];for(let K=0;K<z;K++){let J=f[K],j=p[K];if(V[j](o,N[J](R)),B)for(let Z=0,ee=B.length;Z<ee;Z++)H[Z][j](o,B[Z][J](R))}}t[C]=o,u.push(o),o++}}let T=i.clone();for(let P in i.attributes){let R=l[P];if(T.setAttribute(P,new R.constructor(R.array.slice(0,o*R.itemSize),R.itemSize,R.normalized)),P in c)for(let C=0;C<c[P].length;C++){let L=c[P][C];T.morphAttributes[P][C]=new L.constructor(L.array.slice(0,o*L.itemSize),L.itemSize,L.normalized)}}return T.setIndex(u),T}function $me(i,e){if(e===YN)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===WT||e===KN){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,r=[];if(e===WT)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function Yme(i){let e=new ie,t=new ie,n=new ie,r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie;function u(ce,de,ve,Ie,Qe,Ue,mt,Me){e.fromBufferAttribute(de,Qe),t.fromBufferAttribute(de,Ue),n.fromBufferAttribute(de,mt);let ze=ce.morphTargetInfluences;if(ve&&ze){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let $e=0,Et=ve.length;$e<Et;$e++){let Tt=ze[$e],Ct=ve[$e];Tt!==0&&(r.fromBufferAttribute(Ct,Qe),s.fromBufferAttribute(Ct,Ue),o.fromBufferAttribute(Ct,mt),Ie?(a.addScaledVector(r,Tt),l.addScaledVector(s,Tt),c.addScaledVector(o,Tt)):(a.addScaledVector(r.sub(e),Tt),l.addScaledVector(s.sub(t),Tt),c.addScaledVector(o.sub(n),Tt)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Ue,t),ce.applyBoneTransform(mt,n)),Me[Qe*3+0]=e.x,Me[Qe*3+1]=e.y,Me[Qe*3+2]=e.z,Me[Ue*3+0]=t.x,Me[Ue*3+1]=t.y,Me[Ue*3+2]=t.z,Me[mt*3+0]=n.x,Me[mt*3+1]=n.y,Me[mt*3+2]=n.z}let f=i.geometry,p=i.material,x,v,w,S=f.index,T=f.attributes.position,P=f.morphAttributes.position,R=f.morphTargetsRelative,C=f.attributes.normal,L=f.morphAttributes.normal,D=f.groups,F=f.drawRange,N,B,z,V,H,K,J,j=new Float32Array(T.count*T.itemSize),Z=new Float32Array(C.count*C.itemSize);if(S!==null)if(Array.isArray(p))for(N=0,z=D.length;N<z;N++)for(H=D[N],K=Math.max(H.start,F.start),J=Math.min(H.start+H.count,F.start+F.count),B=K,V=J;B<V;B+=3)x=S.getX(B),v=S.getX(B+1),w=S.getX(B+2),u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,Z);else for(K=Math.max(0,F.start),J=Math.min(S.count,F.start+F.count),N=K,z=J;N<z;N+=3)x=S.getX(N),v=S.getX(N+1),w=S.getX(N+2),u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,Z);else if(Array.isArray(p))for(N=0,z=D.length;N<z;N++)for(H=D[N],K=Math.max(H.start,F.start),J=Math.min(H.start+H.count,F.start+F.count),B=K,V=J;B<V;B+=3)x=B,v=B+1,w=B+2,u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,Z);else for(K=Math.max(0,F.start),J=Math.min(T.count,F.start+F.count),N=K,z=J;N<z;N+=3)x=N,v=N+1,w=N+2,u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,Z);let ee=new kn(j,3),ae=new kn(Z,3);return{positionAttribute:T,normalAttribute:C,morphedPositionAttribute:ee,morphedNormalAttribute:ae}}function Kme(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){let o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}let t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){let a=e[o],l=a.start,c=l+a.count;for(let u=l;u<c;u++)n.push(t.getX(u))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){let a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){let a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function Zme(i,e=Math.PI/3){let t=i.index?i.toNonIndexed():i,n=t.attributes.position,r=n.count,s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(r*3);for(let C=0;C<r;C++)s[3*C+0]=n.getX(C),s[3*C+1]=n.getY(C),s[3*C+2]=n.getZ(C)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let C=0;C<l;C++){let L=9*C,D=s[L+0],F=s[L+1],N=s[L+2],B=s[L+3],z=s[L+4],V=s[L+5],H=s[L+6],K=s[L+7],J=s[L+8],j=H-B,Z=K-z,ee=J-V,ae=D-B,ce=F-z,de=N-V,ve=Z*de-ee*ce,Ie=ee*ae-j*de,Qe=j*ce-Z*ae,Ue=1/(Math.sqrt(ve*ve+Ie*Ie+Qe*Qe)||1);c[3*C+0]=ve*Ue,c[3*C+1]=Ie*Ue,c[3*C+2]=Qe*Ue}let u=new Int32Array(r),f=new Int32Array(r*3),p=1;for(;p<r*2;)p<<=1;let x=p-1,v=new Int32Array(p),w=0;for(let C=0;C<r;C++){let L=3*C,D=~~(s[L+0]*a),F=~~(s[L+1]*a),N=~~(s[L+2]*a),B=(Math.imul(D,73856093)^Math.imul(F,19349663)^Math.imul(N,83492791))&x;for(;;){let z=v[B];if(z===0){let H=3*w;f[H+0]=D,f[H+1]=F,f[H+2]=N,v[B]=w+1,u[C]=w++;break}let V=3*(z-1);if(f[V+0]===D&&f[V+1]===F&&f[V+2]===N){u[C]=z-1;break}B=B+1&x}}let S=new Int32Array(w+1);for(let C=0;C<r;C++)S[u[C]+1]++;for(let C=0;C<w;C++)S[C+1]+=S[C];let T=new Int32Array(r),P=S.slice(0,w);for(let C=0;C<l;C++){let L=3*C;T[P[u[L+0]]++]=C,T[P[u[L+1]]++]=C,T[P[u[L+2]]++]=C}let R=new Float32Array(r*3);for(let C=0;C<l;C++){let L=3*C,D=c[L+0],F=c[L+1],N=c[L+2];for(let B=0;B<3;B++){let z=L+B,V=u[z],H=0,K=0,J=0;for(let Z=S[V],ee=S[V+1];Z<ee;Z++){let ae=3*T[Z],ce=c[ae+0],de=c[ae+1],ve=c[ae+2];D*ce+F*de+N*ve>o&&(H+=ce,K+=de,J+=ve)}let j=1/(Math.sqrt(H*H+K*K+J*J)||1);R[3*z+0]=H*j,R[3*z+1]=K*j,R[3*z+2]=J*j}}return t.setAttribute("normal",new Ni(R,3,!1)),t}var rt=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function sE(i){"@babel/helpers - typeof";return sE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sE(i)}var Qme=/^\s+/,Jme=/\s+$/;function dn(i,e){if(i=i||"",e=e||{},i instanceof dn)return i;if(!(this instanceof dn))return new dn(i,e);var t=ege(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}dn.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=u$(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=s$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=s$(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=r$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=r$(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return o$(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return rge(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(yr(this._r,255)*100)+"%",g:Math.round(yr(this._g,255)*100)+"%",b:Math.round(yr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(yr(this._r,255)*100)+"%, "+Math.round(yr(this._g,255)*100)+"%, "+Math.round(yr(this._b,255)*100)+"%)":"rgba("+Math.round(yr(this._r,255)*100)+"%, "+Math.round(yr(this._g,255)*100)+"%, "+Math.round(yr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:mge[o$(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+a$(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=dn(e);n="#"+a$(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return dn(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(lge,arguments)},brighten:function(){return this._applyModification(cge,arguments)},darken:function(){return this._applyModification(uge,arguments)},desaturate:function(){return this._applyModification(sge,arguments)},saturate:function(){return this._applyModification(oge,arguments)},greyscale:function(){return this._applyModification(age,arguments)},spin:function(){return this._applyModification(hge,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(pge,arguments)},complement:function(){return this._applyCombination(fge,arguments)},monochromatic:function(){return this._applyCombination(Age,arguments)},splitcomplement:function(){return this._applyCombination(dge,arguments)},triad:function(){return this._applyCombination(l$,[3])},tetrad:function(){return this._applyCombination(l$,[4])}};dn.fromRatio=function(i,e){if(sE(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=lv(i[n]));i=t}return dn(i,e)};function ege(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=yge(i)),sE(i)=="object"&&(kf(i.r)&&kf(i.g)&&kf(i.b)?(e=tge(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):kf(i.h)&&kf(i.s)&&kf(i.v)?(n=lv(i.s),r=lv(i.v),e=ige(i.h,n,r),o=!0,a="hsv"):kf(i.h)&&kf(i.s)&&kf(i.l)&&(n=lv(i.s),s=lv(i.l),e=nge(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=u$(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function tge(i,e,t){return{r:yr(i,255)*255,g:yr(e,255)*255,b:yr(t,255)*255}}function r$(i,e,t){i=yr(i,255),e=yr(e,255),t=yr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function nge(i,e,t){var n,r,s;i=yr(i,360),e=yr(e,100),t=yr(t,100);function o(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function s$(i,e,t){i=yr(i,255),e=yr(e,255),t=yr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function ige(i,e,t){i=yr(i,360)*6,e=yr(e,100),t=yr(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,c=[t,o,s,s,a,t][l],u=[a,t,t,o,s,s][l],f=[s,s,a,t,t,o][l];return{r:c*255,g:u*255,b:f*255}}function o$(i,e,t,n){var r=[Kc(Math.round(i).toString(16)),Kc(Math.round(e).toString(16)),Kc(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function rge(i,e,t,n,r){var s=[Kc(Math.round(i).toString(16)),Kc(Math.round(e).toString(16)),Kc(Math.round(t).toString(16)),Kc(h$(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function a$(i,e,t,n){var r=[Kc(h$(n)),Kc(Math.round(i).toString(16)),Kc(Math.round(e).toString(16)),Kc(Math.round(t).toString(16))];return r.join("")}dn.equals=function(i,e){return!i||!e?!1:dn(i).toRgbString()==dn(e).toRgbString()};dn.random=function(){return dn.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function sge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s-=e/100,t.s=oE(t.s),dn(t)}function oge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s+=e/100,t.s=oE(t.s),dn(t)}function age(i){return dn(i).desaturate(100)}function lge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l+=e/100,t.l=oE(t.l),dn(t)}function cge(i,e){e=e===0?0:e||10;var t=dn(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),dn(t)}function uge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l-=e/100,t.l=oE(t.l),dn(t)}function hge(i,e){var t=dn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,dn(t)}function fge(i){var e=dn(i).toHsl();return e.h=(e.h+180)%360,dn(e)}function l$(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=dn(i).toHsl(),n=[dn(i)],r=360/e,s=1;s<e;s++)n.push(dn({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function dge(i){var e=dn(i).toHsl(),t=e.h;return[dn(i),dn({h:(t+72)%360,s:e.s,l:e.l}),dn({h:(t+216)%360,s:e.s,l:e.l})]}function pge(i,e,t){e=e||6,t=t||30;var n=dn(i).toHsl(),r=360/t,s=[dn(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(dn(n));return s}function Age(i,e){e=e||6;for(var t=dn(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(dn({h:n,s:r,v:s})),s=(s+a)%1;return o}dn.mix=function(i,e,t){t=t===0?0:t||50;var n=dn(i).toRgb(),r=dn(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return dn(o)};dn.readability=function(i,e){var t=dn(i),n=dn(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};dn.isReadable=function(i,e,t){var n=dn.readability(i,e),r,s;switch(s=!1,r=vge(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};dn.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;c<e.length;c++)s=dn.readability(i,e[c]),s>r&&(r=s,n=dn(e[c]));return dn.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,dn.mostReadable(i,["#fff","#000"],t))};var h6=dn.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},mge=dn.hexNames=gge(h6);function gge(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function u$(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function yr(i,e){_ge(i)&&(i="100%");var t=xge(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function oE(i){return Math.min(1,Math.max(0,i))}function vl(i){return parseInt(i,16)}function _ge(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function xge(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Kc(i){return i.length==1?"0"+i:""+i}function lv(i){return i<=1&&(i=i*100+"%"),i}function h$(i){return Math.round(parseFloat(i)*255).toString(16)}function c$(i){return vl(i)/255}var Yc=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function kf(i){return!!Yc.CSS_UNIT.exec(i)}function yge(i){i=i.replace(Qme,"").replace(Jme,"").toLowerCase();var e=!1;if(h6[i])i=h6[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Yc.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Yc.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Yc.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Yc.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Yc.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Yc.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Yc.hex8.exec(i))?{r:vl(t[1]),g:vl(t[2]),b:vl(t[3]),a:c$(t[4]),format:e?"name":"hex8"}:(t=Yc.hex6.exec(i))?{r:vl(t[1]),g:vl(t[2]),b:vl(t[3]),format:e?"name":"hex"}:(t=Yc.hex4.exec(i))?{r:vl(t[1]+""+t[1]),g:vl(t[2]+""+t[2]),b:vl(t[3]+""+t[3]),a:c$(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Yc.hex3.exec(i))?{r:vl(t[1]+""+t[1]),g:vl(t[2]+""+t[2]),b:vl(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function vge(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function A6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function bge(i){if(Array.isArray(i))return i}function wge(i){if(Array.isArray(i))return A6(i)}function f$(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Sge(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Tge(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Ho(i,e){return i.get(f$(i,e))}function W_(i,e,t){Sge(i,e),e.set(i,t)}function aE(i,e,t){return i.set(f$(i,e),t),t}function Ege(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Fge(n.key),n)}}function Mge(i,e,t){return e&&Ege(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Cge(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Rge(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Pge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4123-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ige(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4124-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nge(i,e){return bge(i)||Rge(i,e)||d$(i,e)||Pge()}function Lge(i){return wge(i)||Cge(i)||d$(i)||Ige()}function Dge(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function Fge(i){var e=Dge(i,"string");return typeof e=="symbol"?e:e+""}function d$(i,e){if(i){if(typeof i=="string")return A6(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A6(i,e):void 0}}var j_=new WeakMap,cv=new WeakMap,X_=new WeakMap,f6=new WeakMap,d6=new WeakMap,p6=new WeakMap,p$=(function(){function i(){Tge(this,i),W_(this,j_,new Map),W_(this,cv,new Map),W_(this,X_,function(e){return e}),W_(this,f6,function(){return{}}),W_(this,d6,function(){}),W_(this,p6,function(){})}return Mge(i,[{key:"getObj",value:function(t){return Ho(j_,this).get(Ho(X_,this).call(this,t))}},{key:"getData",value:function(t){return Ho(cv,this).get(t)}},{key:"entries",value:function(){return Lge(Ho(cv,this).entries()).map(function(t){var n=Nge(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return aE(X_,this,rt(t)),this}},{key:"onCreateObj",value:function(t){return aE(f6,this,t),this}},{key:"onUpdateObj",value:function(t){return aE(d6,this,t),this}},{key:"onRemoveObj",value:function(t){return aE(p6,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!Ho(j_,n).has(Ho(X_,n).call(n,s))}).forEach(function(s){var o=Ho(f6,n).call(n,s);Ho(j_,n).set(Ho(X_,n).call(n,s),o),Ho(cv,n).set(o,s)});var r=new Map(t.map(function(s){return[Ho(X_,n).call(n,s),s]}));return Ho(j_,this).forEach(function(s,o){r.has(o)?Ho(d6,n).call(n,s,r.get(o)):(Ho(p6,n).call(n,s,o),Ho(j_,n).delete(o),Ho(cv,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var qm=bse(A$(),1);var yi=11102230246251565e-32,Ts=134217729,hv=(3+8*yi)*yi;function sm(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,p=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++p]);let x=0;if(f<i&&p<t)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++f]):(o=u+s,a=s-(o-u),u=n[++p]),s=o,a!==0&&(r[x++]=a);f<i&&p<t;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++p]),s=o,a!==0&&(r[x++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[x++]=a);for(;p<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++p],s=o,a!==0&&(r[x++]=a);return(s!==0||x===0)&&(r[x++]=s),x}function fv(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ut(i){return new Float64Array(i)}var Oge=(3+16*yi)*yi,Bge=(2+12*yi)*yi,Uge=(9+64*yi)*yi*yi,$_=ut(4),m$=ut(8),g$=ut(12),_$=ut(16),ya=ut(4);function kge(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B=i-r,z=t-r,V=e-s,H=n-s;C=B*H,p=Ts*B,x=p-(p-B),v=B-x,p=Ts*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=V*z,p=Ts*V,x=p-(p-V),v=V-x,p=Ts*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,$_[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,$_[1]=R-(T+f)+(f-D),N=P+T,f=N-P,$_[2]=P-(N-f)+(T-f),$_[3]=N;let K=fv(4,$_),J=Bge*o;if(K>=J||-K>=J||(f=i-B,a=i-(B+f)+(f-r),f=t-z,c=t-(z+f)+(f-r),f=e-V,l=e-(V+f)+(f-s),f=n-H,u=n-(H+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(J=Uge*o+hv*Math.abs(K),K+=B*u+H*a-(V*c+z*l),K>=J||-K>=J))return K;C=a*H,p=Ts*a,x=p-(p-a),v=a-x,p=Ts*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=l*z,p=Ts*l,x=p-(p-l),v=l-x,p=Ts*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ya[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ya[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ya[2]=P-(N-f)+(T-f),ya[3]=N;let j=sm(4,$_,4,ya,m$);C=B*u,p=Ts*B,x=p-(p-B),v=B-x,p=Ts*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=V*c,p=Ts*V,x=p-(p-V),v=V-x,p=Ts*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ya[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ya[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ya[2]=P-(N-f)+(T-f),ya[3]=N;let Z=sm(j,m$,4,ya,g$);C=a*u,p=Ts*a,x=p-(p-a),v=a-x,p=Ts*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=l*c,p=Ts*l,x=p-(p-l),v=l-x,p=Ts*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ya[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ya[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ya[2]=P-(N-f)+(T-f),ya[3]=N;let ee=sm(Z,g$,4,ya,_$);return _$[ee-1]}function Up(i,e,t,n,r,s){let o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=Oge*c?l:-kge(i,e,t,n,r,s,c)}var HYe=(7+56*yi)*yi,WYe=(3+28*yi)*yi,jYe=(26+288*yi)*yi*yi,XYe=ut(4),$Ye=ut(4),YYe=ut(4),KYe=ut(4),ZYe=ut(4),QYe=ut(4),JYe=ut(4),eKe=ut(4),tKe=ut(4),nKe=ut(8),iKe=ut(8),rKe=ut(8),sKe=ut(4),oKe=ut(8),aKe=ut(8),lKe=ut(16),cKe=ut(12),uKe=ut(192),hKe=ut(192);var pKe=(10+96*yi)*yi,AKe=(4+48*yi)*yi,mKe=(44+576*yi)*yi*yi,gKe=ut(4),_Ke=ut(4),xKe=ut(4),yKe=ut(4),vKe=ut(4),bKe=ut(4),wKe=ut(4),SKe=ut(4),TKe=ut(8),EKe=ut(8),MKe=ut(8),CKe=ut(8),RKe=ut(8),PKe=ut(8),IKe=ut(8),NKe=ut(8),LKe=ut(8),DKe=ut(4),FKe=ut(4),OKe=ut(4),BKe=ut(8),UKe=ut(16),kKe=ut(16),GKe=ut(16),zKe=ut(32),VKe=ut(32),qKe=ut(48),HKe=ut(64),WKe=ut(1152),jKe=ut(1152);var KKe=(16+224*yi)*yi,ZKe=(5+72*yi)*yi,QKe=(71+1408*yi)*yi*yi,JKe=ut(4),eZe=ut(4),tZe=ut(4),nZe=ut(4),iZe=ut(4),rZe=ut(4),sZe=ut(4),oZe=ut(4),aZe=ut(4),lZe=ut(4),cZe=ut(24),uZe=ut(24),hZe=ut(24),fZe=ut(24),dZe=ut(24),pZe=ut(24),AZe=ut(24),mZe=ut(24),gZe=ut(24),_Ze=ut(24),xZe=ut(1152),yZe=ut(1152),vZe=ut(1152),bZe=ut(1152),wZe=ut(1152),SZe=ut(2304),TZe=ut(2304),EZe=ut(3456),MZe=ut(5760),CZe=ut(8),RZe=ut(8),PZe=ut(8),IZe=ut(16),NZe=ut(24),LZe=ut(48),DZe=ut(48),FZe=ut(96),OZe=ut(192),BZe=ut(384),UZe=ut(384),kZe=ut(384),GZe=ut(768);var zZe=ut(96),VZe=ut(96),qZe=ut(96),HZe=ut(1152);var y$=Math.pow(2,-52),lE=new Uint32Array(512),kp=class i{static from(e,t=Wge,n=jge){let r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){let a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new i(s)}constructor(e){let t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1,a=1/0,l=1/0,c=-1/0,u=-1/0;for(let B=0;B<o;B++){let z=e[2*B],V=e[2*B+1];z<a&&(a=z),V<l&&(l=V),z>c&&(c=z),V>u&&(u=V),this._ids[B]=B}let f=(a+c)/2,p=(l+u)/2,x=0,v=0,w=0;for(let B=0,z=1/0;B<o;B++){let V=g6(f,p,e[2*B],e[2*B+1]);V<z&&(x=B,z=V)}let S=e[2*x],T=e[2*x+1];for(let B=0,z=1/0;B<o;B++){if(B===x)continue;let V=g6(S,T,e[2*B],e[2*B+1]);V<z&&V>0&&(v=B,z=V)}let P=e[2*v],R=e[2*v+1],C=1/0;for(let B=0;B<o;B++){if(B===x||B===v)continue;let z=qge(S,T,P,R,e[2*B],e[2*B+1]);z<C&&(w=B,C=z)}let L=e[2*w],D=e[2*w+1];if(C===1/0){for(let V=0;V<o;V++)this._dists[V]=e[2*V]-e[0]||e[2*V+1]-e[1];Y_(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),z=0;for(let V=0,H=-1/0;V<o;V++){let K=this._ids[V],J=this._dists[K];J>H&&(B[z++]=K,H=J)}this.hull=B.subarray(0,z),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Up(S,T,P,R,L,D)<0){let B=v,z=P,V=R;v=w,P=L,R=D,w=B,L=z,D=V}let F=Hge(S,T,P,R,L,D);this._cx=F.x,this._cy=F.y;for(let B=0;B<o;B++)this._dists[B]=g6(e[2*B],e[2*B+1],F.x,F.y);Y_(this._ids,this._dists,0,o-1),this._hullStart=x;let N=3;n[x]=t[w]=v,n[v]=t[x]=w,n[w]=t[v]=x,r[x]=0,r[v]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=x,s[this._hashKey(P,R)]=v,s[this._hashKey(L,D)]=w,this.trianglesLen=0,this._addTriangle(x,v,w,-1,-1,-1);for(let B=0,z=0,V=0;B<this._ids.length;B++){let H=this._ids[B],K=e[2*H],J=e[2*H+1];if(B>0&&Math.abs(K-z)<=y$&&Math.abs(J-V)<=y$||(z=K,V=J,H===x||H===v||H===w))continue;let j=0;for(let de=0,ve=this._hashKey(K,J);de<this._hashSize&&(j=s[(ve+de)%this._hashSize],!(j!==-1&&j!==n[j]));de++);j=t[j];let Z=j,ee;for(;ee=n[Z],Up(K,J,e[2*Z],e[2*Z+1],e[2*ee],e[2*ee+1])>=0;)if(Z=ee,Z===j){Z=-1;break}if(Z===-1)continue;let ae=this._addTriangle(Z,H,n[Z],-1,-1,r[Z]);r[H]=this._legalize(ae+2),r[Z]=ae,N++;let ce=n[Z];for(;ee=n[ce],Up(K,J,e[2*ce],e[2*ce+1],e[2*ee],e[2*ee+1])<0;)ae=this._addTriangle(ce,H,ee,r[H],-1,r[ce]),r[H]=this._legalize(ae+2),n[ce]=ce,N--,ce=ee;if(Z===j)for(;ee=t[Z],Up(K,J,e[2*ee],e[2*ee+1],e[2*Z],e[2*Z+1])<0;)ae=this._addTriangle(ee,H,Z,-1,r[Z],r[ee]),this._legalize(ae+2),r[ee]=ae,n[Z]=Z,N--,Z=ee;this._hullStart=t[H]=Z,n[Z]=t[ce]=H,n[H]=ce,s[this._hashKey(K,J)]=H,s[this._hashKey(e[2*Z],e[2*Z+1])]=Z}this.hull=new Uint32Array(N);for(let B=0,z=this._hullStart;B<N;B++)this.hull[B]=z,z=n[z];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(zge(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:t,_halfedges:n,coords:r}=this,s=0,o=0;for(;;){let a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=lE[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,p=t[o],x=t[e],v=t[u],w=t[f];if(Vge(r[2*p],r[2*p+1],r[2*x],r[2*x+1],r[2*v],r[2*v+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=p;let T=n[f];if(T===-1){let R=this._hullStart;do{if(this._hullTri[R]===f){this._hullTri[R]=e;break}R=this._hullPrev[R]}while(R!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let P=c+(a+1)%3;s<lE.length&&(lE[s++]=P)}else{if(s===0)break;e=lE[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}};function zge(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function g6(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function Vge(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,p=r-o,x=s-a,v=l*l+c*c,w=u*u+f*f,S=p*p+x*x;return l*(f*S-w*x)-c*(u*S-w*p)+v*(u*x-f*p)<0}function qge(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,p=.5/(o*c-a*l),x=(c*u-a*f)*p,v=(o*f-l*u)*p;return x*x+v*v}function Hge(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,p=.5/(o*c-a*l),x=i+(c*u-a*f)*p,v=e+(o*f-l*u)*p;return{x,y:v}}function Y_(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){let s=i[r],o=e[s],a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{let r=t+n>>1,s=t+1,o=n;dv(i,r,s),e[i[t]]>e[i[n]]&&dv(i,t,n),e[i[s]]>e[i[n]]&&dv(i,s,n),e[i[t]]>e[i[s]]&&dv(i,t,s);let a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;dv(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(Y_(i,e,s,n),Y_(i,e,t,o-1)):(Y_(i,e,t,o-1),Y_(i,e,s,n))}}function dv(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Wge(i){return i[0]}function jge(i){return i[1]}function v$(i,e){var t,n,r=0,s,o,a,l,c,u,f,p=i[0],x=i[1],v=e.length;for(t=0;t<v;t++){n=0;var w=e[t],S=w.length-1;if(u=w[0],u[0]!==w[S][0]&&u[1]!==w[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=u[0]-p,a=u[1]-x,n;n<S;n++){if(f=w[n+1],l=f[0]-p,c=f[1]-x,a===0&&c===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(s=Up(o,l,a,c,0,0),s===0)return 0;(s>0&&c>0&&a<=0||s<0&&c<=0&&a>0)&&r++}u=f,a=c,o=l}}return r%2!==0}function b$(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function w$(i){return i.type==="Feature"?i.geometry:i}function Xge(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=b$(i),r=w$(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&$ge(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=v$(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function $ge(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var S$=Xge;var rc=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}};var Gp=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}};var pv=class{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,s,o,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let w=0,S=0,T=n.length,P,R;w<T;w+=3,S+=2){let C=n[w]*2,L=n[w+1]*2,D=n[w+2]*2,F=e[C],N=e[C+1],B=e[L],z=e[L+1],V=e[D],H=e[D+1],K=B-F,J=z-N,j=V-F,Z=H-N,ee=(K*Z-J*j)*2;if(Math.abs(ee)<1e-9){if(s===void 0){s=o=0;for(let ce of t)s+=e[ce*2],o+=e[ce*2+1];s/=t.length,o/=t.length}let ae=1e9*Math.sign((s-F)*Z-(o-N)*j);P=(F+V)/2-ae*Z,R=(N+H)/2+ae*j}else{let ae=1/ee,ce=K*K+J*J,de=j*j+Z*Z;P=F+(Z*ce-J*de)*ae,R=N+(K*de-j*ce)*ae}a[S]=P,a[S+1]=R}let l=t[t.length-1],c,u=l*4,f,p=e[2*l],x,v=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=p,x=v,u=l*4,p=e[2*l],v=e[2*l+1],r[c+2]=r[u]=x-v,r[c+3]=r[u+1]=p-f}render(e){let t=e==null?e=new rc:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let p=n[u];if(p<u)continue;let x=Math.floor(u/3)*2,v=Math.floor(p/3)*2,w=o[x],S=o[x+1],T=o[v],P=o[v+1];this._renderSegment(w,S,T,P,e)}let l,c=s[s.length-1];for(let u=0;u<s.length;++u){l=c,c=s[u];let f=Math.floor(r[c]/3)*2,p=o[f],x=o[f+1],v=l*4,w=this._project(p,x,a[v+2],a[v+3]);w&&this._renderSegment(p,x,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new rc:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){let n=t==null?t=new rc:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){let r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){let t=new Gp;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o,a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){let t=this._clip(e);if(t)for(let n of this.delaunay.neighbors(e)){let r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){let{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;let a=[],l=o;do{let c=Math.floor(l/3);if(a.push(t[c*2],t[c*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let t=this._cell(e);if(t===null)return null;let{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){let n=t.length,r=null,s,o,a=t[n-2],l=t[n-1],c,u=this._regioncode(a,l),f,p=0;for(let x=0;x<n;x+=2)if(s=a,o=l,a=t[x],l=t[x+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=p,p=0,r?r.push(a,l):r=[a,l];else{let v,w,S,T,P;if(c===0){if((v=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,P]=v}else{if((v=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,P,w,S]=v,f=p,p=this._edgecode(w,S),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(w,S):r=[w,S]}f=p,p=this._edgecode(T,P),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(T,P):r=[T,P]}if(r)f=p,p=this._edgecode(r[0],r[1]),f&&p&&this._edge(e,f,p,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){let a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,c,u=s||o;u&8?(l=e+(n-e)*(this.ymax-t)/(r-t),c=this.ymax):u&4?(l=e+(n-e)*(this.ymin-t)/(r-t),c=this.ymin):u&2?(c=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(c=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=c,s=this._regioncode(e,t)):(n=l,r=c,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let c=0,u=a.length,f,p=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=p,p=this._edgecode(a[c],a[c+1]),f&&p&&(c=this._edge(e,f,p,a,c),u=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){let n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};var Yge=2*Math.PI,K_=Math.pow;function Kge(i){return i[0]}function Zge(i){return i[1]}function Qge(i){let{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){let r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function Jge(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var Z_=class i{static from(e,t=Kge,n=Zge,r){return new i("length"in e?e_e(e,t,n,r):Float64Array.from(t_e(e,t,n,r)))}constructor(e){this._delaunator=new kp(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&Qge(e)){this.collinear=Int32Array.from({length:t.length/2},(p,x)=>x).sort((p,x)=>t[2*p]-t[2*x]||t[2*p+1]-t[2*x+1]);let l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[t[2*l],t[2*l+1],t[2*c],t[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let p=0,x=t.length/2;p<x;++p){let v=Jge(t[2*p],t[2*p+1],f);t[2*p]=v[0],t[2*p+1]=v[1]}this._delaunator=new kp(t)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,c=n.length;l<c;++l){let u=s[l%3===2?l-2:l+1];(n[l]===-1||o[u]===-1)&&(o[u]=l)}for(let l=0,c=r.length;l<c;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new pv(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){let f=a.indexOf(e);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let l=t[e];if(l===-1)return;let c=l,u=-1;do{if(yield u=o[c],c=c%3===2?c-2:c+1,o[c]!==e)return;if(c=s[c],c===-1){let f=n[(r[e]+1)%n.length];f!==u&&(yield f);return}}while(c!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;let r=n,s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){let{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let u=e,f=K_(t-c[e*2],2)+K_(n-c[e*2+1],2),p=r[e],x=p;do{let v=l[x],w=K_(t-c[v*2],2)+K_(n-c[v*2+1],2);if(w<f&&(f=w,u=v),x=x%3===2?x-2:x+1,l[x]!==e)break;if(x=a[x],x===-1){if(x=s[(o[e]+1)%s.length],x!==v&&K_(t-c[x*2],2)+K_(n-c[x*2+1],2)<f)return x;break}}while(x!==p);return u}render(e){let t=e==null?e=new rc:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l<o)continue;let c=s[o]*2,u=s[l]*2;e.moveTo(n[c],n[c+1]),e.lineTo(n[u],n[u+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;let n=e==null?e=new rc:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){let a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,Yge)}return n&&n.value()}renderHull(e){let t=e==null?e=new rc:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){let l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){let e=new Gp;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new rc:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){let t=new Gp;return this.renderTriangle(e,t),t.value()}};function e_e(i,e,t,n){let r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){let a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*t_e(i,e,t,n){let r=0;for(let s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var Av=Math.PI,T$=Av/2,SQe=Av/4,TQe=Av*2,_6=180/Av,x6=Av/180;var y6=Math.atan2,cE=Math.cos;var E$=Math.max,M$=Math.min;var uE=Math.sin,C$=Math.sign||function(i){return i>0?1:i<0?-1:0},hE=Math.sqrt;function v6(i){return i>1?T$:i<-1?-T$:Math.asin(i)}function b6(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Ya(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function mv(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function gv(i){var e=hE(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function w6(i){return[y6(i[1],i[0])*_6,v6(E$(-1,M$(1,i[2])))*_6]}function uh(i){let e=i[0]*x6,t=i[1]*x6,n=cE(t);return[n*cE(e),n*uE(e),uE(t)]}function fE(i){return i=i.map(e=>uh(e)),b6(i[0],Ya(i[2],i[1]))}function P$(i){let e=i_e(i),t=s_e(e),n=r_e(t,i),r=a_e(t,i.length),s=n_e(r,i),o=o_e(t,i),{polygons:a,centers:l}=l_e(o,t,i),c=c_e(a),u=h_e(t,i),f=u_e(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function n_e(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,c=o,u=uh([r,s]);do a=o,o=null,l=t(u,uh(e[a])),i[a].forEach(f=>{let p=t(u,uh(e[f]));if(p<l){l=p,o=f,c=f;return}});while(o!==null);return c}}function i_e(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=TD(i[e]),n=qD().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let p=0,x=i.length;p<x;p++){let v=i[p][0]**2+i[p][1]**2;!isFinite(v)||v>1e32?r.push(p):v>s&&(s=v)}let o=1e6*hE(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=Z_.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let p=0,x=c.length;p<x;p++)if(c[p]<0){let v=p%3==2?p-2:p+1,w=p%3==0?p+2:p-1,S=c[v],T=c[w];c[S]=T,c[T]=S,c[v]=c[w]=-1,l[p]=l[v]=l[w]=e,u[l[S]]=S%3==0?S+2:S-1,u[l[T]]=T%3==0?T+2:T-1,f.push(Math.min(p,v,w)),p+=2-p%3}else l[p]>i.length-3-1&&(l[p]=e);return a}function r_e(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(fE(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(Ip([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function s_e(i){let{triangles:e}=i;if(!e)return[];let t=[];for(let n=0,r=e.length/3;n<r;n++){let s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function o_e(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(uh),r=mv(mv(Ya(n[1],n[0]),Ya(n[2],n[1])),Ya(n[0],n[2]));return w6(gv(r))})}function a_e(i,e){let t=[];return i.forEach(n=>{for(let r=0;r<3;r++){let s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function l_e(i,e,t){let n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){let a=uh(t[0]),l=uh(t[1]),c=gv(mv(a,l)),u=gv(Ya(a,l)),f=Ya(c,u),p=[c,Ya(c,f),Ya(Ya(c,f),f),Ya(Ya(Ya(c,f),f),f)].map(w6).map(o);return n.push(p),n.push(p.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let c=0;c<3;c++){let u=a[c],f=a[(c+1)%3],p=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,p,l,[u,f,p]])}});let s=n.map(a=>{let l=[a[0][2]],c=a[0][1];for(let u=1;u<a.length;u++)for(let f=0;f<a.length;f++)if(a[f][0]==c){c=a[f][1],l.push(a[f][2]);break}if(l.length>2)return l;if(l.length==2){let u=R$(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=R$(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),p=o(u),x=o(f);return[l[0],x,l[1],p]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((c,u)=>{c[0]===a[0]&&c[1]===a[1]&&(l=u+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function R$(i,e,t){i=uh(i),e=uh(e),t=uh(t);let n=C$(b6(Ya(e,i),t));return w6(gv(mv(i,e)).map(r=>n*r))}function c_e(i){let e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function u_e(i,e){return function(t){let n=new Map,r=new Map;return i.forEach((s,o)=>{let a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let c=Ip([s[l],s[(l+1)%3]]).join("-");n.get(c)>o&&(o=n.get(c),a=c)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function h_e(i,e){let t=new Set,n=[];i.map(a=>{if(!(fE(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let c=[a[l],a[(l+1)%3]],u=`${c[0]}-${c[1]}`;t.has(u)?t.delete(u):t.add(`${c[1]}-${c[0]}`)}});let r=new Map,s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function S6(i){let e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){let n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=P$(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return O3(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return O3(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>fE(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n=e.delaunay.edges.map(s=>$a(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let{centers:n,polygons:r}=e.delaunay,s=[];for(let o of r)if(o)for(let a=o.length,l=o[a-1],c=o[0],u=0;u<a;l=c,c=o[++u])c>l&&s.push([n[l],n[c]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||$a([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);let n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function E6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function f_e(i){if(Array.isArray(i))return i}function d_e(i){if(Array.isArray(i))return E6(i)}function p_e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function A_e(i,e,t){return e=pE(e),w_e(i,N$()?Reflect.construct(e,[],pE(i).constructor):e.apply(i,t))}function m_e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function g_e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function pE(i){return pE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pE(i)}function __e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&M6(i,e)}function N$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(N$=function(){return!!i})()}function x_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function y_e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function v_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4125-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4126-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w_e(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return p_e(i)}function M6(i,e){return M6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},M6(i,e)}function hh(i,e){return f_e(i)||y_e(i,e)||L$(i,e)||v_e()}function T6(i){return d_e(i)||x_e(i)||L$(i)||b_e()}function L$(i,e){if(i){if(typeof i=="string")return E6(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?E6(i,e):void 0}}function S_e(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=T_e(i,n),s=rh(r),o=E_e(i,n),a=[].concat(T6(s),T6(o)),l={type:"Polygon",coordinates:i},c=C3(l),u=hh(c,2),f=hh(u[0],2),p=f[0],x=f[1],v=hh(u[1],2),w=v[0],S=v[1],T=p>w||S>=89||x<=-89,P=[];if(T){var R=S6(a).triangles(),C=new Map(a.map(function(ee,ae){var ce=hh(ee,2),de=ce[0],ve=ce[1];return["".concat(de,"-").concat(ve),ae]}));R.features.forEach(function(ee){var ae,ce=ee.geometry.coordinates[0].slice(0,3).reverse(),de=[];if(ce.forEach(function(Ie){var Qe=hh(Ie,2),Ue=Qe[0],mt=Qe[1],Me="".concat(Ue,"-").concat(mt);C.has(Me)&&de.push(C.get(Me))}),de.length===3){if(de.some(function(Ie){return Ie<s.length})){var ve=ee.properties.circumcenter;if(!C6(ve,l,T))return}(ae=P).push.apply(ae,de)}})}else if(o.length)for(var B=kp.from(a),z=function(ae){var ce,de=[2,1,0].map(function(Qe){return B.triangles[ae+Qe]}),ve=de.map(function(Qe){return a[Qe]});if(de.some(function(Qe){return Qe<s.length})){var Ie=[0,1].map(function(Qe){return u3(ve,function(Ue){return Ue[Qe]})});if(!C6(Ie,l,T))return 1}(ce=P).push.apply(ce,T6(de))},V=0,H=B.triangles.length;V<H;V+=3)z(V);else{var L=H_(r),D=L.vertices,F=L.holes,N=F===void 0?[]:F;P=i6(D,N,2)}var K=ja(Ip(a,function(ee){return ee[0]}),[0,1]),J=ja(Ip(a,function(ee){return ee[1]}),[0,1]),j=a.map(function(ee){var ae=hh(ee,2),ce=ae[0],de=ae[1];return[K(ce),J(de)]}),Z={points:a,indices:P,uvs:j};return{contour:r,triangles:Z}}function T_e(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=$a(s,r)*180/Math.PI;if(o>e)for(var a=em(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function E_e(i,e){var t={type:"Polygon",coordinates:i},n=C3(t),r=hh(n,2),s=hh(r[0],2),o=s[0],a=s[1],l=hh(r[1],2),c=l[0],u=l[1];if(Math.min(Math.abs(c-o),Math.abs(u-a))<e)return[];var f=o>c||u>=89||a<=-89;return M_e(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(p){return C6(p,t,f)})}function M_e(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(T){return T/a*360%360-180},c=function(T){return Math.acos(2*T/o-1)/Math.PI*180-90},u=function(T){return o*(Math.cos((T+90)*Math.PI/180)+1)/2},f=[s!==void 0?Math.ceil(u(s)):0,r!==void 0?Math.floor(u(r)):o-1],p=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},x=[],v=f[0];v<=f[1];v++){var w=l(v);p(w)&&x.push([w,c(v)])}return x}function C6(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?ND(e,i):S$(i,e)}var dE=window.THREE?window.THREE:{BufferGeometry:Zn,Float32BufferAttribute:kn},I$=new dE.BufferGeometry().setAttribute?"setAttribute":"addAttribute",AE=(function(i){function e(t,n,r,s,o,a,l){var c;m_e(this,e),c=A_e(this,e),c.type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var u=S_e(t,{resolution:l}),f=u.contour,p=u.triangles,x=rh(p.uvs),v=[],w=[],S=[],T=0,P=function(F){var N=Math.round(v.length/3),B=S.length;v=v.concat(F.vertices),w=w.concat(F.uvs),S=S.concat(N?F.indices.map(function(z){return z+N}):F.indices),c.addGroup(B,S.length-B,T++)};a&&P(C()),s&&P(L(n,!1)),o&&P(L(r,!0)),c.setIndex(S),c[I$]("position",new dE.Float32BufferAttribute(v,3)),c[I$]("uv",new dE.Float32BufferAttribute(w,2)),c.computeVertexNormals();function R(D,F){var N=typeof F=="function"?F:function(){return F},B=D.map(function(z){return z.map(function(V){var H=hh(V,2),K=H[0],J=H[1];return C_e(J,K,N(K,J))})});return H_(B)}function C(){for(var D=R(f,n),F=D.vertices,N=D.holes,B=R(f,r),z=B.vertices,V=rh([z,F]),H=Math.round(z.length/3),K=new Set(N),J=0,j=[],Z=0;Z<H;Z++){var ee=Z+1;if(ee===H)ee=J;else if(K.has(ee)){var ae=ee;ee=J,J=ae}j.push(Z,Z+H,ee+H),j.push(ee+H,ee,Z)}for(var ce=[],de=1;de>=0;de--)for(var ve=0;ve<H;ve+=1)ce.push(ve/(H-1),de);return{indices:j,vertices:V,uvs:ce}}function L(D){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:F?p.indices:p.indices.slice().reverse(),vertices:R([p.points],D).vertices,uvs:x}}return c}return __e(e,i),g_e(e)})(dE.BufferGeometry);function C_e(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function R6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function R_e(i){if(Array.isArray(i))return i}function P_e(i){if(Array.isArray(i))return R6(i)}function I_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function N_e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function L_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4127-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4128-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function F_e(i,e){if(i==null)return{};var t,n,r=O_e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function O_e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function B_e(i,e){return R_e(i)||N_e(i,e)||D$(i,e)||L_e()}function U_e(i){return P_e(i)||I_e(i)||D$(i)||D_e()}function k_e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function G_e(i){var e=k_e(i,"string");return typeof e=="symbol"?e:e+""}function D$(i,e){if(i){if(typeof i=="string")return R6(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?R6(i,e):void 0}}var F$=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var c=a,u=l;return r.forEach(function(f,p){var x=f.keyAccessor,v=f.isProp,w;if(v){var S=u,T=S[x],P=F_e(S,[x].map(G_e));w=T,u=P}else w=x(u,p);p+1<r.length?(c.hasOwnProperty(w)||(c[w]={}),c=c[w]):t?(c.hasOwnProperty(w)||(c[w]=[]),c[w].push(u)):c[w]=u}),a},{});t instanceof Function&&(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===r.length?Object.keys(l).forEach(function(u){return l[u]=t(l[u])}):Object.values(l).forEach(function(u){return a(u,c+1)})})(s);var o=s;return n&&(o=[],(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===r.length?o.push({keys:c,vals:l}):Object.entries(l).forEach(function(u){var f=B_e(u,2),p=f[0],x=f[1];return a(x,[].concat(U_e(c),[p]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var hi=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=[],s="";function o(Ne){return e.locateFile?e.locateFile(Ne,s):s+Ne}var a;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",a=function(nt,It,He){var h=new XMLHttpRequest;h.open("GET",nt,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){It(h.response);return}var bi=wt(nt);if(bi){It(bi.buffer);return}He()},h.onerror=He,h.send(null)};var l=e.print||console.log.bind(console),c=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&(r=e.arguments);var u=0,f=function(Ne){u=Ne},p=function(){return u},x=8;function v(Ne,nt,It,He){switch(It=It||"i8",It.charAt(It.length-1)==="*"&&(It="i32"),It){case"i1":J[Ne>>0]=nt;break;case"i8":J[Ne>>0]=nt;break;case"i16":Z[Ne>>1]=nt;break;case"i32":ae[Ne>>2]=nt;break;case"i64":Ve=[nt>>>0,(Pe=nt,+vt(Pe)>=1?Pe>0?(Zt(+ln(Pe/4294967296),4294967295)|0)>>>0:~~+yt((Pe-+(~~Pe>>>0))/4294967296)>>>0:0)],ae[Ne>>2]=Ve[0],ae[Ne+4>>2]=Ve[1];break;case"float":de[Ne>>2]=nt;break;case"double":ve[Ne>>3]=nt;break;default:S0("invalid type for setValue: "+It)}}function w(Ne,nt,It){switch(nt=nt||"i8",nt.charAt(nt.length-1)==="*"&&(nt="i32"),nt){case"i1":return J[Ne>>0];case"i8":return J[Ne>>0];case"i16":return Z[Ne>>1];case"i32":return ae[Ne>>2];case"i64":return ae[Ne>>2];case"float":return de[Ne>>2];case"double":return ve[Ne>>3];default:S0("invalid type for getValue: "+nt)}return null}var S=!1;function T(Ne,nt){Ne||S0("Assertion failed: "+nt)}function P(Ne){var nt=e["_"+Ne];return T(nt,"Cannot call unknown function "+Ne+", make sure it is exported"),nt}function R(Ne,nt,It,He,h){var ji={string:function(Qn){var Ii=0;if(Qn!=null&&Qn!==0){var kb=(Qn.length<<2)+1;Ii=Gk(kb),B(Qn,Ii,kb)}return Ii},array:function(Qn){var Ii=Gk(Qn.length);return V(Qn,Ii),Ii}};function bi(Qn){return nt==="string"?F(Qn):nt==="boolean"?!!Qn:Qn}var ne=P(Ne),Xi=[],Na=0;if(He)for(var Hs=0;Hs<He.length;Hs++){var Ps=ji[It[Hs]];Ps?(Na===0&&(Na=Rie()),Xi[Hs]=Ps(He[Hs])):Xi[Hs]=He[Hs]}var ts=ne.apply(null,Xi);return ts=bi(ts),Na!==0&&Cie(Na),ts}function C(Ne,nt,It,He){It=It||[];var h=It.every(function(bi){return bi==="number"}),ji=nt!=="string";return ji&&h&&!He?P(Ne):function(){return R(Ne,nt,It,arguments,He)}}var L=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Ne,nt,It){for(var He=nt+It,h=nt;Ne[h]&&!(h>=He);)++h;if(h-nt>16&&Ne.subarray&&L)return L.decode(Ne.subarray(nt,h));for(var ji="";nt<h;){var bi=Ne[nt++];if(!(bi&128)){ji+=String.fromCharCode(bi);continue}var ne=Ne[nt++]&63;if((bi&224)==192){ji+=String.fromCharCode((bi&31)<<6|ne);continue}var Xi=Ne[nt++]&63;if((bi&240)==224?bi=(bi&15)<<12|ne<<6|Xi:bi=(bi&7)<<18|ne<<12|Xi<<6|Ne[nt++]&63,bi<65536)ji+=String.fromCharCode(bi);else{var Na=bi-65536;ji+=String.fromCharCode(55296|Na>>10,56320|Na&1023)}}return ji}function F(Ne,nt){return Ne?D(j,Ne,nt):""}function N(Ne,nt,It,He){if(!(He>0))return 0;for(var h=It,ji=It+He-1,bi=0;bi<Ne.length;++bi){var ne=Ne.charCodeAt(bi);if(ne>=55296&&ne<=57343){var Xi=Ne.charCodeAt(++bi);ne=65536+((ne&1023)<<10)|Xi&1023}if(ne<=127){if(It>=ji)break;nt[It++]=ne}else if(ne<=2047){if(It+1>=ji)break;nt[It++]=192|ne>>6,nt[It++]=128|ne&63}else if(ne<=65535){if(It+2>=ji)break;nt[It++]=224|ne>>12,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}else{if(It+3>=ji)break;nt[It++]=240|ne>>18,nt[It++]=128|ne>>12&63,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}}return nt[It]=0,It-h}function B(Ne,nt,It){return N(Ne,j,nt,It)}var z=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function V(Ne,nt){J.set(Ne,nt)}function H(Ne,nt){return Ne%nt>0&&(Ne+=nt-Ne%nt),Ne}var K,J,j,Z,ee,ae,ce,de,ve;function Ie(Ne){K=Ne,e.HEAP8=J=new Int8Array(Ne),e.HEAP16=Z=new Int16Array(Ne),e.HEAP32=ae=new Int32Array(Ne),e.HEAPU8=j=new Uint8Array(Ne),e.HEAPU16=ee=new Uint16Array(Ne),e.HEAPU32=ce=new Uint32Array(Ne),e.HEAPF32=de=new Float32Array(Ne),e.HEAPF64=ve=new Float64Array(Ne)}var Qe=5271296,Ue=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?K=e.buffer:K=new ArrayBuffer(mt),mt=K.byteLength,Ie(K),ae[Ue>>2]=Qe;function Me(Ne){for(;Ne.length>0;){var nt=Ne.shift();if(typeof nt=="function"){nt();continue}var It=nt.func;typeof It=="number"?nt.arg===void 0?e.dynCall_v(It):e.dynCall_vi(It,nt.arg):It(nt.arg===void 0?null:nt.arg)}}var ze=[],$e=[],Et=[],Tt=[];function Ct(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)st(e.preRun.shift());Me(ze)}function un(){Me($e)}function Gt(){Me(Et)}function Xe(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)tt(e.postRun.shift());Me(Tt)}function st(Ne){ze.unshift(Ne)}function tt(Ne){Tt.unshift(Ne)}var vt=Math.abs,yt=Math.ceil,ln=Math.floor,Zt=Math.min,Qt=0,xn=null,ge=null;function di(Ne){Qt++,e.monitorRunDependencies&&e.monitorRunDependencies(Qt)}function On(Ne){if(Qt--,e.monitorRunDependencies&&e.monitorRunDependencies(Qt),Qt==0&&(xn!==null&&(clearInterval(xn),xn=null),ge)){var nt=ge;ge=null,nt()}}e.preloadedImages={},e.preloadedAudios={};var le=null,X="data:application/octet-stream;base64,";function Te(Ne){return String.prototype.startsWith?Ne.startsWith(X):Ne.indexOf(X)===0}var Pe,Ve;le="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAABgtRFT7IQlAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCUAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAABgtRFT7IQnAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCcAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAMpi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP6phvycGBZRAJbod0OgwfkCp+L8jatBmQCjl3pGrPlFAfMWm114SOkButwtqS7UjQHQwbcjXyw1A8jnLuuyA9j9KwjL0VwHhPyotk0lcs8k/Q5PvEs9rsz+SfsOQEVqdPzUAKDojLoY/WJz/kcjCcD8YFu070FRZPyoLC2BdJEM/YOXQAuiMM0HIBz1bw3sdQdV46aaHRwZByatzjDPX8EDb3Jie8HXZQCJxj6ULP8NAUaG6uRAZrUCWdmou5/mVQLb9huRPm4BAhvoCHygZaUCuX/I3SPdSQC9/bC/1qTxAfKxsYQ6pJUCuslH+N14QQMS/cv7SvPg/Ol8maYKx4j8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAKriWFiWZfg/Y2nmTbY/8z8MHSPSqmnjv6hnn18HR3c/quJYWJZl+D/jq5TzDdzyPwwdI9KqaeO/u0kC1eFSBECq4lhYlmX4P69pJmt7c/E/NnkJi6jSBsDESFlzKkr6P33ArMz7sfY/o2q2uqM08D+oZ59fB0d3PzEqCi3qrvK/kmm4ANp49D+4wS2wzhzvP9WJvyAnx+E/upcY75RVx7+95t+9y0T1P9L18g1caO0/k6CkRyVzAEBf99+e/GjxP6QMsuuLQ/U/PlP4Qr8q7j8Mb/GO2GMCwLl2K/DQIghAePiwytEp9D9UHrsuI/nqPzjMedJ+yuy/k6xgf58n/L+XoQtn22DzP2lzCnsYk+s/JhUSDI4P8z+8lFcBhgTcPxOqKRxEX/M/89MEdoPQ6j8OKQaXDob7vzWwNvblgAPAzGkxMcl88j9Nm4okPkbpP0vI89vxSgRAdac2Z6W2/T+6UFOMC3zyP/+2XEF3hug/QqhELwGKCMAwdlQerEoEQFcr/B+VnvE/hB1hfFzT5j8wdsE/Da64P0hIvnF/sOC/KH/hrXUg8T9bI5OQHaLlP+mYzla7td6/CtKG6iOm8b8FW3TV8oXwP8ORhtNuJ+c/q8JrTMz/AcC8PaUl+PUFwAXv9rkMT/A/m+sAswr15D+7hk/O3yvkP6c/yVsOHKI/qqAX9idJ8D/8hNz1KNPiP7xSXh3Ggvg/epbkiKr57T/23/LB1GLvP4GTTeNZi+M/W4TqlTheBcDupZgIdYUIQGwlcW3YZO8/tQvDXQ3H4j8Bt+sf9DkAQMdFie+nNvg/Z5Uh1wDX7j9h5X2d4KjhPxMJ1ZVT4Pa/evqB8xB//7+W183U9QLsPwzNxsC7AOA/af/LqCnK/r/lPceQ0FQDwHoY0nYIW+w/bHNSHrTg4D/DFcMAdabuv2sz5Ojhnve/FvLf01HN6z/tEDL2Hz/gP0bBv0KUhPA/pd7sEnMc4D8EGon4Lo7sP5NVbYtSON8/DAMC50odBkB+Z2J8MGYCQIhlM1gubOo/FssiPwWy4D8OIlGqRnkCQAd1vopp6f4/QS1keLLK6T9rfoBuT7LZP3KQbH5ugwjAjqVPXTmbBUBL/JxcqR3qP3oSeovuktg/Y6pRhJmqy7+0kwuU0Yjmv2wvsfFmQ+g/R98lJFqQ2T/IGb5gjLkCwK3mNff3kQbAqDznPFM86T+iiP0FfsvYP7fzKG6Mls0/h7+at2btzL8tsUTgk+LmP/YEIrTDINU/WmwKoVjA5L9aC02r6FHxvzzFCT/Qg+Y/nx0V97en0j8+1toJOm77P1kZ7h8KjfQ/GBbbqxgk5j9RGXM79G/SP+beHsWmweQ/9REi4eX0xD/V9s+kmMHkP+pb9yNs09A/c5ERjVDTAECqEr3OBCH7P14ILfMECOU/piRx4P8P0j+JYU//bfL0Pw62fw28B+w/l5YW2Ga45D9+CyKRbenOP5cH6fHy1/S/o/egk03++r91nTYRL/bjP3fHN6OJVdA/7xXQh1XLBcAB3g6tBdUIQKW2KnGYjeQ/SqIpagclyz8F9P3YgNL6v9H6NBsZ8QDAW2k5L5Qs4z/0axa1l6zLP1GE65Mu4wNAwfX+BYmWAEBBgJP90M3hP6/03qhPLdA/zqo5bJz2778/ESlPCTn1v7JkhGyvzuE/DM7sj5twwz/6xbXLavYGQH29RFRGkgNA7bOXVSJ54T9fEhTHO/TDP+8t+HMOiwDAxa0SbGTtA8Atii7y0mLgP4cecHFB3sM/uPUpyv+K7j8nktD1/WvhP2cWmi772d8/Fj7uU9kEvD8oKOESLzKmvwSdCqrHdNu/XCluGsvI3T929OW5md+uP9dP6rXcZNq/gXM+ggzL6b+eKjsPgJncP6i1e9aVu7E/2CnPNJyD1D/DnyGgSe+xvy8k7g9bp9s/nYmLvHn1sz9cFOwApH8IwGa6Mjy9cgZAJr95SiSW2z8rCkhOFvqdP3SIKmO/UwPAEy0zkN7bBsCds8Hg/13YP1zv413hVGi/FVtqixSn6L9XAPQGul3yv7SGu2BoCNk/n94bv7Maj79p13T6X9z3P45MPCW3WvI/rU/8/LRj1T9cgR6SXd+ZPymL2DstbPI/8s/pAkIz6z/fmoB+8efYPz2XyfWgYaa/6wys72AW/j8LZImhgrf3P729Zla/n9U/ySB8B3PBqL8O2nhevvbxv17+5A+n6fe/YrGIqEGB1T+wCEGbkhaxv989QHVE5wFAzd12PTu3/T9AHUPZY2DUP3SQDST0zq2/JCxAlIoj5T+Mhe1IJkrQP/cRpl8QhtU/amc4seFts79khiUSVaz3vxYfWtjPwf2/CHscxQqD0j/ctUBQ9my3v0POnFiyXv2/pjjn2Ju/AcDk45DwBhPRP/GjwlCrv7m/aT2ciwolBsAQOzHr/wUJQCzpq5UYvtI/gDCf3SlCwb+4i7S+mukEQBDA1f8mowFA2utnRN3KyT9T+9EYAVG6v9/IVZ0enrE/7NbRtdGfzr/8y8GpRz7LP3U0vTSk18e/JzHEcwiBB0AGm8Q7AJkEQNLciyt4Esk/gLou5zoQxr+RrOfM91oBwEzd36KybgTAgLou5zoQxj/S3IsreBLJv1gCch0OHO8/FD+RxSLN4j91NL00pNfHP/zLwalHPsu/nL7/By4Pyr8tSP5h7CPiv1P70RgBUbo/2utnRN3Kyb/KfllfCpUIwLkP5zj+NwdAgDCf3SlCwT8s6auVGL7Sv2aFPlaC4eC/XrS5UVH77b/xo8JQq7+5P+TjkPAGE9G/Q30/RYbn1z8FF/ISafuLv9y1QFD2bLc/CHscxQqD0r/fi+tPROX0P6vRc+19ie0/amc4seFtsz/3EaZfEIbVv77TYpahl/o/DDsu0CaC9D90kA0k9M6tP0AdQ9ljYNS/CCI0rxjZA8BgfCaLthgHwLAIQZuSFrE/YrGIqEGB1b8kvQ982+rsv4J8EWu7jPS/ySB8B3PBqD+9vWZWv5/VvwrAByWcJgBAxFujmE9a+j89l8n1oGGmP9+agH7x59i/N03cuJUt9L8X9v4GdIz6v1yBHpJd35m/rU/8/LRj1b8mz69sydf/vyu5idMqVQLAn94bv7Majz8AhrtgaAjZv+aCE66WZ/q/lA1Mgz/p/79c7+Nd4VRoP52zweD/Xdi/TJZpMTb4AkDLWZShPOb/PysKSE4W+p2/Jr95SiSW27/PkmbE7zjnP6UAiCDmMNI/nYmLvHn1s78vJO4PW6fbv5MWA2vqSrQ/V5WLwPB51b+otXvWlbuxv54qOw+Amdy/1keqzYeRBsApIEMHgZIIQHb05bmZ366/XCluGsvI3b8W44a9X9UFQEeQtDM4rwJAFj7uU9kEvL9nFpou+9nfv3Co+JcyyQhAcdkCX2KzBUCHHnBxQd7Dvy2KLvLSYuC/o6+5YTt/AcCHCNDW+8YEwF8SFMc79MO/7bOXVSJ54b9E/pfA2S3xPzD9xaBb0uQ/DM7sj5tww7+yZIRsr87hv7c4c0SEXNG/Tr79/9M+5r+v9N6oTy3Qv5uAk/3QzeG/XcI1OVQkAUAQSV9Z7Qr9P/RrFrWXrMu/W2k5L5Qs479Zo2IBM/vkv6FuipzkFvG/SqIpagcly7+ltipxmI3kv0pmis91cfc/gWQecsRh8D93xzejiVXQv3WdNhEv9uO/D7mgYy612j+PyVPNaT2jv34LIpFt6c6/l5YW2Ga45L+LUp+2A2z9P39i5xSpRfc/piRx4P8P0r9eCC3zBAjlv5n4OKmIUf2/jj/kUAwgAsDqW/cjbNPQv9X2z6SYweS/aTdljlWd8L94R8vZ8SL3v1EZczv0b9K/GBbbqxgk5r9XdfyikfEDwPILMvas0gfAnx0V97en0r88xQk/0IPmvxGErZ681fa/9kCaiOy2/b/2BCK0wyDVvy2xROCT4ua/+5EBLOXxA0B7p53+BnkAQKKI/QV+y9i/qDznPFM86b/snWGNkkgHwC+ByugkUwdAR98lJFqQ2b9sL7HxZkPovyJNGM67oek/HzNy6BqA1D96EnqL7pLYv0v8nFypHeq/axL/u1FnB0AkSEHvxn8DQGt+gG5Pstm/QS1keLLK6b/Sk/O6mtGzPxU8pLcPNty/FssiPwWy4L+IZTNYLmzqvw4szKfSouq/G+XJHY1a87+TVW2LUjjfvwQaifgujuy/3VARaoMl2L9NFodfK+/qv+0QMvYfP+C/FvLf01HN67+ETOQysd8AwH71iI/eGgXAbHNSHrTg4L96GNJ2CFvsv6BnExReeAFA5CakvxSl+j8MzcbAuwDgv5bXzdT1Auy/uVq8/8x58z+uvPMNqzTnP2HlfZ3gqOG/Z5Uh1wDX7r8PUbMSo2P7P9VfBrXlxPI/tQvDXQ3H4r9sJXFt2GTvvyDssGgO0PG/WxT/uE4N+r+Bk03jWYvjv/bf8sHUYu+/rUXN8hUe3j9m5HB1yZCzv/yE3PUo0+K/qqAX9idJ8L9mByqLMMH5v4kHC7KQowHAm+sAswr15L8F7/a5DE/wv2JLsGADFwTAKQjVGovZCMDDkYbTbifnvwVbdNXyhfC/malhH7yI7D+oevd0GWDZP1sjk5AdouW/KH/hrXUg8b8KWmrpQ0sFQAzEAF/pTgBAhB1hfFzT5r9XK/wflZ7xv18hRuqKXAjA/5rUd9v1BED/tlxBd4bov7pQU4wLfPK/4pnwn0T/sj/c277XPF3jv02biiQ+Rum/zGkxMcl88r8Yk0HhJVzjv62yUUFRjfS/89MEdoPQ6r8TqikcRF/zvxQxghHovfY/cfM1eFWE5j9pcwp7GJPrv5ehC2fbYPO/KUV2nGg0/795OhmUaqEFwFQeuy4j+eq/ePiwytEp9L8DuqWfW+8BQLytJylXHPY/PlP4Qr8q7r+kDLLri0P1vxT4ShWL+Oo/DMsWg0zlv7/S9fINXGjtv73m373LRPW/+xg/Gaxd8b94MdQEfW0AwLjBLbDOHO+/kmm4ANp49L+cShSMMbAEwKyjUgWirAdAo2q2uqM08L99wKzM+7H2v3RdlNBXFgnA8S9+ewyV/z+vaSZre3Pxv6riWFiWZfi/2J7VSZZ60j+LES81zPn3v+OrlPMN3PK/quJYWJZl+L/OZbufkEcEQLCNB/1lPOO/Y2nmTbY/87+q4lhYlmX4v7CNB/1lPOO/zmW7n5BHBEBwKD1Aa57LP/XsSsw7RbU/PMDPJGsfoD/TqningGKIPzFtCLYmb3I/qYfrJr7eWz9pQmleXRFFP0rWlJkA2i8/pCvcttgTGD9Dt8IWbjMCPyCG4GRlhOs+1JI2GhDN1D7ns8cGvXK/Pi8m8UTJxac+hNTfA2z4kT7GI8kjLyt7Pv//////HwAI//////8zEAj/////fzIgCP////9vMjAI/////2MyQAj///8/YjJQCP///zdiMmAI////M2IycAj//78zYjKACP//qzNiMpAI/3+rM2IyoAj/D6szYjKwCP8DqzNiMsAIvwOrM2Iy0AifA6szYjLgCJkDqzNiMvAI//////8/Dwj//////ysfCP////9/KS8I/////z8pPwj/////OSlPCP///z84KV8I////Dzgpbwj///8OOCl/CP//Hw44KY8I//8PDjgpnwj/fw0OOCmvCP8PDQ44Kb8I/w0NDjgpzwj/DA0OOCnfCMcMDQ44Ke8IxAwNDjgp/wgHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAAEAAAADAAAADgAAAAYAAAALAAAAAgAAAAcAAAABAAAAGAAAAAUAAAAKAAAAAQAAAAYAAAAAAAAAJgAAAAcAAAAMAAAAAwAAAAgAAAACAAAAMQAAAAkAAAAOAAAAAAAAAAUAAAAEAAAAOgAAAAgAAAANAAAABAAAAAkAAAADAAAAPwAAAAsAAAAGAAAADwAAAAoAAAAQAAAASAAAAAwAAAAHAAAAEAAAAAsAAAARAAAAUwAAAAoAAAAFAAAAEwAAAA4AAAAPAAAAYQAAAA0AAAAIAAAAEQAAAAwAAAASAAAAawAAAA4AAAAJAAAAEgAAAA0AAAATAAAAdQAAAA8AAAATAAAAEQAAABIAAAAQAAAABgAAAAIAAAADAAAABQAAAAQAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAMAAAABAAAABQAAAAQAAAAAAAAAAAAAAAcAAAAFAAAAAwAAAAQAAAABAAAAAAAAAAIAAAAAAAAAAgAAAAMAAAABAAAABQAAAAQAAAAGAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifm/GC1EVPshCUAYLURU+yEJwGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjZWxsc1RvTXVsdGlQb2x5LmMAY2VsbFRvRWRnZUFyY3MAAAEDAgQABAMFAQJjYW5jZWxBcmNQYWlycwBjcmVhdGVTb3J0YWJsZUxvb3AAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAdmVjM1RvQ2VsbABjZWxsVG9DaGlsZFBvcwB2YWxpZGF0ZUNoaWxkUG9zAHJldkRpciAhPSBJTlZBTElEX0RJR0lUAGxvY2FsaWouYwBjZWxsVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAYmFzZUNlbGwgPT0gb3JpZ2luQmFzZUNlbGwALi4vaW5jbHVkZS9jb29yZGlqay5oAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAYmFzZUNlbGwgIT0gSU5WQUxJRF9CQVNFX0NFTEwAbG9jYWxJamtUb0NlbGwAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAZ3JpZFBhdGhDZWxsc0ludGVycG9sYXRlAHBvbHlmaWxsLmMAaXRlclN0ZXBQb2x5Z29uQ29tcGFjdAAwAHZlcnRleC5jAHZlcnRleFJvdGF0aW9ucwBjZWxsVG9WZXJ0ZXg=";var gt=28400;function St(Ne){return Ne}function qe(Ne){var nt=/\b__Z[\w\d_]+/g;return Ne.replace(nt,function(It){var He=It;return It===He?It:He+" ["+It+"]"})}function Ze(){var Ne=new Error;if(!Ne.stack){try{throw new Error(0)}catch(nt){Ne=nt}if(!Ne.stack)return"(no stack trace available)"}return Ne.stack.toString()}function Rt(){var Ne=Ze();return e.extraStackTrace&&(Ne+=`4129-`+e.extraStackTrace()),qe(Ne)}function en(Ne,nt,It,He){S0("Assertion failed: "+F(Ne)+", at: "+[nt?F(nt):"unknown filename",It,He?F(He):"unknown function"])}function Pt(){return J.length}function Mt(Ne,nt,It){j.set(j.subarray(nt,nt+It),Ne)}function cn(Ne){return e.___errno_location&&(ae[e.___errno_location()>>2]=Ne),Ne}function yn(Ne){S0("OOM")}function Rn(Ne){try{var nt=new ArrayBuffer(Ne);return nt.byteLength!=Ne?void 0:(new Int8Array(nt).set(J),tn(nt),Ie(nt),1)}catch{}}function xe(Ne){var nt=Pt(),It=16777216,He=2147483648-It;if(Ne>He)return!1;for(var h=16777216,ji=Math.max(nt,h);ji<Ne;)ji<=536870912?ji=H(2*ji,It):ji=Math.min(H((3*ji+2147483648)/4,It),He);var bi=Rn(ji);return!!bi}var bt=typeof atob=="function"?atob:function(Ne){var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",He,h,ji,bi,ne,Xi,Na,Hs=0;Ne=Ne.replace(/[^A-Za-z0-9\+\/\=]/g,"");do bi=nt.indexOf(Ne.charAt(Hs++)),ne=nt.indexOf(Ne.charAt(Hs++)),Xi=nt.indexOf(Ne.charAt(Hs++)),Na=nt.indexOf(Ne.charAt(Hs++)),He=bi<<2|ne>>4,h=(ne&15)<<4|Xi>>2,ji=(Xi&3)<<6|Na,It=It+String.fromCharCode(He),Xi!==64&&(It=It+String.fromCharCode(h)),Na!==64&&(It=It+String.fromCharCode(ji));while(Hs<Ne.length);return It};function Ye(Ne){try{for(var nt=bt(Ne),It=new Uint8Array(nt.length),He=0;He<nt.length;++He)It[He]=nt.charCodeAt(He);return It}catch{throw new Error("Converting base64 string to bytes failed.")}}function wt(Ne){if(Te(Ne))return Ye(Ne.slice(X.length))}var Dt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ct={a:S0,b:f,c:p,d:en,e:cn,f:Pt,g:Mt,h:xe,i:yn,j:St,k:qe,l:Rn,m:Ze,n:Rt,o:gt,p:Ue},Ce=(function(Ne,nt,It){"almost asm";var He=new Ne.Int8Array(It),h=new Ne.Int32Array(It),ji=new Ne.Uint8Array(It),bi=new Ne.Float32Array(It),ne=new Ne.Float64Array(It),Xi=nt.o|0,Na=nt.p|0,Hs=Ne.Math.floor,Ps=Ne.Math.abs,ts=Ne.Math.sqrt,Qn=Ne.Math.cos,Ii=Ne.Math.sin,kb=Ne.Math.tan,Pie=Ne.Math.acos,J1=Ne.Math.asin,Hk=Ne.Math.atan,ta=Ne.Math.atan2,$m=Ne.Math.ceil,La=Ne.Math.imul,r4=Ne.Math.min,Iie=Ne.Math.max,jh=Ne.Math.clz32,Nie=nt.a,Ln=nt.b,Q=nt.c,li=nt.d,Wk=nt.e,Lie=nt.f,Die=nt.g,Fie=nt.h,Oie=nt.i,Y=28416;function Bie(d){return He=new Int8Array(d),ji=new Uint8Array(d),h=new Int32Array(d),bi=new Float32Array(d),ne=new Float64Array(d),It=d,!0}function Uie(d){d=d|0;var A=0;return A=Y,Y=Y+d|0,Y=Y+15&-16,A|0}function kie(){return Y|0}function Gie(d){d=d|0,Y=d}function zie(d,A){d=d|0,A=A|0,Y=d}function Vie(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;return(d|0)<0?(A=2,A|0):(d|0)>13780509?(A=qb(15,A)|0,A|0):(m=((d|0)<0)<<31>>31,g=lr(d|0,m|0,3,0)|0,_=Q()|0,m=pt(d|0,m|0,1,0)|0,m=lr(g|0,_|0,m|0,Q()|0)|0,m=pt(m|0,Q()|0,1,0)|0,d=Q()|0,h[A>>2]=m,h[A+4>>2]=d,A=0,A|0)}function jk(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,Xk(d,A,m,_,0)|0}function Xk(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0;if(M=Y,Y=Y+16|0,b=M,!($k(d,A,m,_,g)|0))return _=0,Y=M,_|0;do if((m|0)>=0){if((m|0)>13780509){if(y=qb(15,b)|0,y|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else y=((m|0)<0)<<31>>31,I=lr(m|0,y|0,3,0)|0,E=Q()|0,y=pt(m|0,y|0,1,0)|0,y=lr(I|0,E|0,y|0,Q()|0)|0,y=pt(y|0,Q()|0,1,0)|0,E=Q()|0,h[b>>2]=y,h[b+4>>2]=E,b=y;if(sd(_|0,0,b<<3|0)|0,g|0){sd(g|0,0,b<<2|0)|0,y=fu(d,A,m,_,g,b,E,0)|0;break}y=na(b,4)|0,y?(I=fu(d,A,m,_,y,b,E,0)|0,_t(y),y=I):y=13}else y=2;while(!1);return I=y,Y=M,I|0}function $k(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(oe=Y,Y=Y+16|0,W=oe,$=oe+8|0,q=W,h[q>>2]=d,h[q+4>>2]=A,(m|0)<0)return $=2,Y=oe,$|0;if(y=_,h[y>>2]=d,h[y+4>>2]=A,y=(g|0)!=0,y&&(h[g>>2]=0),Ui(d,A)|0)return $=9,Y=oe,$|0;h[$>>2]=0;e:do if((m|0)>=1)if(y)for(O=1,I=0,G=0,q=1,y=d;;){if(!(I|G)){if(y=Is(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Ui(y,A)|0){y=9;break e}}if(y=Is(y,A,h[26864+(G<<2)>>2]|0,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,d=_+(O<<3)|0,h[d>>2]=y,h[d+4>>2]=A,h[g+(O<<2)>>2]=q,d=I+1|0,b=(d|0)==(q|0),E=G+1|0,M=(E|0)==6,Ui(y,A)|0){y=9;break e}if(q=q+(M&b&1)|0,(q|0)>(m|0)){y=0;break}else O=O+1|0,I=b?0:d,G=b?M?0:E:G}else for(O=1,I=0,G=0,q=1,y=d;;){if(!(I|G)){if(y=Is(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Ui(y,A)|0){y=9;break e}}if(y=Is(y,A,h[26864+(G<<2)>>2]|0,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,d=_+(O<<3)|0,h[d>>2]=y,h[d+4>>2]=A,d=I+1|0,b=(d|0)==(q|0),E=G+1|0,M=(E|0)==6,Ui(y,A)|0){y=9;break e}if(q=q+(M&b&1)|0,(q|0)>(m|0)){y=0;break}else O=O+1|0,I=b?0:d,G=b?M?0:E:G}else y=0;while(!1);return $=y,Y=oe,$|0}function fu(d,A,m,_,g,y,b,E){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0,E=E|0;var M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(oe=Y,Y=Y+16|0,W=oe+8|0,$=oe,M=Xh(d|0,A|0,y|0,b|0)|0,O=Q()|0,G=_+(M<<3)|0,ue=G,_e=h[ue>>2]|0,ue=h[ue+4>>2]|0,I=(_e|0)==(d|0)&(ue|0)==(A|0),!((_e|0)==0&(ue|0)==0|I))do M=pt(M|0,O|0,1,0)|0,M=rd(M|0,Q()|0,y|0,b|0)|0,O=Q()|0,G=_+(M<<3)|0,_e=G,ue=h[_e>>2]|0,_e=h[_e+4>>2]|0,I=(ue|0)==(d|0)&(_e|0)==(A|0);while(!((ue|0)==0&(_e|0)==0|I));if(M=g+(M<<2)|0,I&&(h[M>>2]|0)<=(E|0)||(_e=G,h[_e>>2]=d,h[_e+4>>2]=A,h[M>>2]=E,(E|0)>=(m|0)))return _e=0,Y=oe,_e|0;switch(I=E+1|0,h[W>>2]=0,M=Is(d,A,2,W,$)|0,M|0){case 9:{q=9;break}case 0:{M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M||(q=9);break}default:}e:do if((q|0)==9){switch(h[W>>2]=0,M=Is(d,A,3,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Is(d,A,1,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Is(d,A,5,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Is(d,A,4,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Is(d,A,6,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}return _e=0,Y=oe,_e|0}while(!1);return _e=M,Y=oe,_e|0}function Is(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(m>>>0>6)return g=1,g|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(y=0;;){switch(m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}if(y=y+1|0,(y|0)==(b|0))break e}while(!1);if(G=et(d|0,A|0,45)|0,Q()|0,O=G&127,O>>>0>121)return g=5,g|0;M=Da(d,A)|0,y=et(d|0,A|0,52)|0,Q()|0,y=y&15;e:do if(!y)I=15;else{for(;;){if(b=(15-y|0)*3|0,E=et(d|0,A|0,b|0)|0,Q()|0,E=E&7,(E|0)==7){A=5;break}if($=(Bl(y)|0)==0,y=y+-1|0,q=ht(7,0,b|0)|0,A=A&~(Q()|0),W=ht(h[($?432:16)+(E*28|0)+(m<<2)>>2]|0,0,b|0)|0,b=Q()|0,m=h[($?640:224)+(E*28|0)+(m<<2)>>2]|0,d=W|d&~q,A=b|A,!m){m=0;break e}if(!y){I=15;break e}}return A|0}while(!1);(I|0)==15&&($=h[848+(O*28|0)+(m<<2)>>2]|0,W=ht($|0,0,45)|0,d=W|d,A=Q()|0|A&-1040385,m=h[4272+(O*28|0)+(m<<2)>>2]|0,($&127|0)==127&&($=ht(h[848+(O*28|0)+20>>2]|0,0,45)|0,A=Q()|0|A&-1040385,m=h[4272+(O*28|0)+20>>2]|0,d=T0($|d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1)),E=et(d|0,A|0,45)|0,Q()|0,E=E&127;e:do if(or(E)|0){t:do if((Da(d,A)|0)==1){if((O|0)!=(E|0))if(Qk(E,h[7696+(O*28|0)>>2]|0)|0){d=m4(d,A)|0,b=1,A=Q()|0;break}else li(27634,26928,533,26936);switch(M|0){case 3:{d=T0(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{d=m4(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return $=9,$|0;default:return $=1,$|0}}else b=0;while(!1);if((m|0)>0){y=0;do d=A4(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}if((O|0)!=(E|0)){if(!(s4(E)|0)){if((b|0)!=0|(Da(d,A)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(G&127){case 8:case 118:break e;default:}(Da(d,A)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((m|0)>0){y=0;do d=T0(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+m|0)%6|0,$=g,h[$>>2]=d,h[$+4>>2]=A,$=0,$|0}function qie(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,Yk(d,A,m,_)|0?(sd(_|0,0,m*48|0)|0,_=Hie(d,A,m,_)|0,_|0):(_=0,_|0)}function Yk(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if($=Y,Y=Y+16|0,q=$,W=$+8|0,G=q,h[G>>2]=d,h[G+4>>2]=A,(m|0)<0)return W=2,Y=$,W|0;if(!m)return W=_,h[W>>2]=d,h[W+4>>2]=A,W=0,Y=$,W|0;h[W>>2]=0;e:do if(Ui(d,A)|0)d=9;else{g=0,G=d;do{if(d=Is(G,A,4,W,q)|0,d|0)break e;if(A=q,G=h[A>>2]|0,A=h[A+4>>2]|0,g=g+1|0,Ui(G,A)|0){d=9;break e}}while((g|0)<(m|0));O=_,h[O>>2]=G,h[O+4>>2]=A,O=m+-1|0,I=0,d=1;do{if(g=26864+(I<<2)|0,(I|0)==5)for(b=h[g>>2]|0,y=0,g=d;;){if(d=q,d=Is(h[d>>2]|0,h[d+4>>2]|0,b,W,q)|0,d|0)break e;if((y|0)!=(O|0))if(M=q,E=h[M>>2]|0,M=h[M+4>>2]|0,d=_+(g<<3)|0,h[d>>2]=E,h[d+4>>2]=M,!(Ui(E,M)|0))d=g+1|0;else{d=9;break e}else d=g;if(y=y+1|0,(y|0)>=(m|0))break;g=d}else for(b=q,M=h[g>>2]|0,E=0,g=d,y=h[b>>2]|0,b=h[b+4>>2]|0;;){if(d=Is(y,b,M,W,q)|0,d|0)break e;if(b=q,y=h[b>>2]|0,b=h[b+4>>2]|0,d=_+(g<<3)|0,h[d>>2]=y,h[d+4>>2]=b,d=g+1|0,Ui(y,b)|0){d=9;break e}if(E=E+1|0,(E|0)>=(m|0))break;g=d}I=I+1|0}while(I>>>0<6);d=q,d=(G|0)==(h[d>>2]|0)&&(A|0)==(h[d+4>>2]|0)?0:9}while(!1);return W=d,Y=$,W|0}function Hie(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;if(G=Y,Y=Y+16|0,b=G,!m)return h[_>>2]=d,h[_+4>>2]=A,_=0,Y=G,_|0;do if((m|0)>=0){if((m|0)>13780509){if(g=qb(15,b)|0,g|0)break;y=b,g=h[y>>2]|0,y=h[y+4>>2]|0}else g=((m|0)<0)<<31>>31,O=lr(m|0,g|0,3,0)|0,y=Q()|0,g=pt(m|0,g|0,1,0)|0,g=lr(O|0,y|0,g|0,Q()|0)|0,g=pt(g|0,Q()|0,1,0)|0,y=Q()|0,O=b,h[O>>2]=g,h[O+4>>2]=y;if(I=na(g,8)|0,!I)g=13;else{if(O=na(g,4)|0,!O){_t(I),g=13;break}if(g=fu(d,A,m,I,O,g,y,0)|0,g|0){_t(I),_t(O);break}if(A=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&A>>>0>0){g=0,E=0,M=0;do d=I+(E<<3)|0,y=h[d>>2]|0,d=h[d+4>>2]|0,!((y|0)==0&(d|0)==0)&&(h[O+(E<<2)>>2]|0)==(m|0)&&(q=_+(g<<3)|0,h[q>>2]=y,h[q+4>>2]=d,g=g+1|0),E=pt(E|0,M|0,1,0)|0,M=Q()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<A>>>0)}_t(I),_t(O),g=0}}else g=2;while(!1);return q=g,Y=G,q|0}function Gb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;for(E=Y,Y=Y+16|0,y=E,b=E+8|0,g=(Ui(d,A)|0)==0,g=g?1:2;;){if(h[b>>2]=0,I=(Is(d,A,g,b,y)|0)==0,M=y,I&((h[M>>2]|0)==(m|0)?(h[M+4>>2]|0)==(_|0):0)){d=4;break}if(g=g+1|0,g>>>0>=7){g=7,d=4;break}}return(d|0)==4?(Y=E,g|0):0}function Wie(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;if(E=Y,Y=Y+48|0,g=E+16|0,y=E+8|0,b=E,m=ax(m)|0,m|0)return b=m,Y=E,b|0;if(I=d,M=h[I+4>>2]|0,m=y,h[m>>2]=h[I>>2],h[m+4>>2]=M,m9(y,g),m=n9(g,A,b)|0,!m){if(A=h[y>>2]|0,y=h[d+8>>2]|0,(y|0)>0){g=h[d+12>>2]|0,m=0;do A=(h[g+(m<<3)>>2]|0)+A|0,m=m+1|0;while((m|0)<(y|0))}m=b,g=h[m>>2]|0,m=h[m+4>>2]|0,y=((A|0)<0)<<31>>31,(m|0)<(y|0)|(m|0)==(y|0)&g>>>0<A>>>0?(m=b,h[m>>2]=A,h[m+4>>2]=y,m=y):A=g,M=pt(A|0,m|0,12,0)|0,I=Q()|0,m=b,h[m>>2]=M,h[m+4>>2]=I,m=_,h[m>>2]=M,h[m+4>>2]=I,m=0}return I=m,Y=E,I|0}function Kk(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,mi=0,oo=0,Bn=0,gi=0,ia=0;if(mi=Y,Y=Y+64|0,Ot=mi+48|0,at=mi+32|0,dt=mi+24|0,Fe=mi+8|0,Ke=mi,M=h[d>>2]|0,(M|0)<=0)return ci=0,Y=mi,ci|0;for(Ee=d+4|0,ye=Ot+8|0,At=at+8|0,We=Fe+8|0,E=0,be=0;;){I=h[Ee>>2]|0,re=I+(be<<4)|0,h[Ot>>2]=h[re>>2],h[Ot+4>>2]=h[re+4>>2],h[Ot+8>>2]=h[re+8>>2],h[Ot+12>>2]=h[re+12>>2],(be|0)==(M+-1|0)?(h[at>>2]=h[I>>2],h[at+4>>2]=h[I+4>>2],h[at+8>>2]=h[I+8>>2],h[at+12>>2]=h[I+12>>2]):(re=I+(be+1<<4)|0,h[at>>2]=h[re>>2],h[at+4>>2]=h[re+4>>2],h[at+8>>2]=h[re+8>>2],h[at+12>>2]=h[re+12>>2]),M=ore(Ot,at,_,dt)|0;e:do if(M)I=0,E=M;else if(M=dt,I=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&I>>>0>0){_e=0,re=0;t:for(;;){if(Bn=1/(+(I>>>0)+4294967296*+(M|0)),ia=+ne[Ot>>3],M=Ns(I|0,M|0,_e|0,re|0)|0,gi=+(M>>>0)+4294967296*+(Q()|0),oo=+(_e>>>0)+4294967296*+(re|0),ne[Fe>>3]=Bn*(ia*gi)+Bn*(+ne[at>>3]*oo),ne[We>>3]=Bn*(+ne[ye>>3]*gi)+Bn*(+ne[At>>3]*oo),M=g4(Fe,_,Ke)|0,M|0){E=M;break}ue=Ke,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,q=Xh(oe|0,ue|0,A|0,m|0)|0,O=Q()|0,M=b+(q<<3)|0,G=M,I=h[G>>2]|0,G=h[G+4>>2]|0;n:do if((I|0)==0&(G|0)==0)me=M,ci=16;else for(W=0,$=0;;){if((W|0)>(m|0)|(W|0)==(m|0)&$>>>0>A>>>0){E=1;break t}if((I|0)==(oe|0)&(G|0)==(ue|0))break n;if(M=pt(q|0,O|0,1,0)|0,q=rd(M|0,Q()|0,A|0,m|0)|0,O=Q()|0,$=pt($|0,W|0,1,0)|0,W=Q()|0,M=b+(q<<3)|0,G=M,I=h[G>>2]|0,G=h[G+4>>2]|0,(I|0)==0&(G|0)==0){me=M,ci=16;break}}while(!1);if((ci|0)==16&&(ci=0,!((oe|0)==0&(ue|0)==0))&&($=me,h[$>>2]=oe,h[$+4>>2]=ue,$=y+(h[g>>2]<<3)|0,h[$>>2]=oe,h[$+4>>2]=ue,$=g,$=pt(h[$>>2]|0,h[$+4>>2]|0,1,0)|0,oe=Q()|0,ue=g,h[ue>>2]=$,h[ue+4>>2]=oe),_e=pt(_e|0,re|0,1,0)|0,re=Q()|0,M=dt,I=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(re|0)|(M|0)==(re|0)&I>>>0>_e>>>0)){I=1;break e}}I=0}else I=1;while(!1);if(be=be+1|0,!I){ci=21;break}if(M=h[d>>2]|0,(be|0)>=(M|0)){E=0,ci=21;break}}return(ci|0)==21?(Y=mi,E|0):0}function jie(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,mi=0,oo=0,Bn=0,gi=0;if(gi=Y,Y=Y+112|0,ci=gi+80|0,M=gi+72|0,mi=gi,oo=gi+56|0,g=ax(m)|0,g|0)return Bn=g,Y=gi,Bn|0;if(I=d+8|0,Bn=ar((h[I>>2]<<5)+32|0)|0,!Bn)return Bn=13,Y=gi,Bn|0;if(S4(d,Bn),g=ax(m)|0,!g){if(at=d,dt=h[at+4>>2]|0,g=M,h[g>>2]=h[at>>2],h[g+4>>2]=dt,m9(M,ci),g=n9(ci,A,mi)|0,g)at=0,dt=0;else{if(g=h[M>>2]|0,y=h[I>>2]|0,(y|0)>0){b=h[d+12>>2]|0,m=0;do g=(h[b+(m<<3)>>2]|0)+g|0,m=m+1|0;while((m|0)!=(y|0));m=g}else m=g;g=mi,y=h[g>>2]|0,g=h[g+4>>2]|0,b=((m|0)<0)<<31>>31,(g|0)<(b|0)|(g|0)==(b|0)&y>>>0<m>>>0?(g=mi,h[g>>2]=m,h[g+4>>2]=b,g=b):m=y,at=pt(m|0,g|0,12,0)|0,dt=Q()|0,g=mi,h[g>>2]=at,h[g+4>>2]=dt,g=0}if(!g){if(m=na(at,8)|0,!m)return _t(Bn),Bn=13,Y=gi,Bn|0;if(E=na(at,8)|0,!E)return _t(Bn),_t(m),Bn=13,Y=gi,Bn|0;We=ci,h[We>>2]=0,h[We+4>>2]=0,We=d,Ot=h[We+4>>2]|0,g=M,h[g>>2]=h[We>>2],h[g+4>>2]=Ot,g=Kk(M,at,dt,A,ci,m,E)|0;e:do if(g)_t(m),_t(E),_t(Bn);else{t:do if((h[I>>2]|0)>0){for(b=d+12|0,y=0;g=Kk((h[b>>2]|0)+(y<<3)|0,at,dt,A,ci,m,E)|0,y=y+1|0,!(g|0);)if((y|0)>=(h[I>>2]|0))break t;_t(m),_t(E),_t(Bn);break e}while(!1);(dt|0)>0|(dt|0)==0&at>>>0>0&&sd(E|0,0,at<<3|0)|0,Ot=ci,We=h[Ot+4>>2]|0;t:do if((We|0)>0|(We|0)==0&(h[Ot>>2]|0)>>>0>0){Ee=m,ye=E,At=m,We=E,Ot=m,g=m,me=m,Fe=E,Ke=E,m=E;n:for(;;){for(ue=0,_e=0,re=0,be=0,y=0,b=0;;){E=mi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(A=Ee+(ue<<3)|0,I=h[A>>2]|0,A=h[A+4>>2]|0,$k(I,A,1,mi,0)|0){E=mi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=na(7,4)|0,E|0&&(fu(I,A,1,mi,E,7,0,0)|0,_t(E))}for(oe=0;;){$=mi+(oe<<3)|0,W=h[$>>2]|0,$=h[$+4>>2]|0;i:do if((W|0)==0&($|0)==0)E=y,M=b;else{if(O=Xh(W|0,$|0,at|0,dt|0)|0,I=Q()|0,E=_+(O<<3)|0,A=E,M=h[A>>2]|0,A=h[A+4>>2]|0,!((M|0)==0&(A|0)==0)){G=0,q=0;do{if((G|0)>(dt|0)|(G|0)==(dt|0)&q>>>0>at>>>0)break n;if((M|0)==(W|0)&(A|0)==($|0)){E=y,M=b;break i}E=pt(O|0,I|0,1,0)|0,O=rd(E|0,Q()|0,at|0,dt|0)|0,I=Q()|0,q=pt(q|0,G|0,1,0)|0,G=Q()|0,E=_+(O<<3)|0,A=E,M=h[A>>2]|0,A=h[A+4>>2]|0}while(!((M|0)==0&(A|0)==0))}if((W|0)==0&($|0)==0){E=y,M=b;break}Zm(W,$,oo)|0,T4(d,Bn,oo)|0&&(q=pt(y|0,b|0,1,0)|0,b=Q()|0,G=E,h[G>>2]=W,h[G+4>>2]=$,y=ye+(y<<3)|0,h[y>>2]=W,h[y+4>>2]=$,y=q),E=y,M=b}while(!1);if(oe=oe+1|0,oe>>>0>=7)break;y=E,b=M}if(ue=pt(ue|0,_e|0,1,0)|0,_e=Q()|0,re=pt(re|0,be|0,1,0)|0,be=Q()|0,b=ci,y=h[b>>2]|0,b=h[b+4>>2]|0,(be|0)<(b|0)|(be|0)==(b|0)&re>>>0<y>>>0)y=E,b=M;else break}if((b|0)>0|(b|0)==0&y>>>0>0){y=0,b=0;do be=Ee+(y<<3)|0,h[be>>2]=0,h[be+4>>2]=0,y=pt(y|0,b|0,1,0)|0,b=Q()|0,be=ci,re=h[be+4>>2]|0;while((b|0)<(re|0)|((b|0)==(re|0)?y>>>0<(h[be>>2]|0)>>>0:0))}if(be=ci,h[be>>2]=E,h[be+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)oe=m,ue=Ke,_e=Ot,re=Fe,be=ye,m=me,Ke=g,Fe=At,me=oe,g=ue,Ot=We,We=_e,At=re,ye=Ee,Ee=be;else break t}_t(At),_t(We),_t(Bn),g=1;break e}else g=E;while(!1);_t(Bn),_t(m),_t(g),g=0}while(!1);return Bn=g,Y=gi,Bn|0}}return _t(Bn),Bn=g,Y=gi,Bn|0}function Xie(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0;if(E=Y,Y=Y+16|0,b=E,d=lre(d,A,((A|0)<0)<<31>>31,b)|0,d|0)return b=d,Y=E,b|0;if(y=qre(b,m)|0,m=b+4|0,(h[b>>2]|0)>0){A=0;do{if(g=h[m>>2]|0,_=g+(A<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[g+(A<<4)>>2]=0,_=g+(A<<4)+8|0,g=g+(A<<4)+12|0,(h[_>>2]|0)>0){d=0;do M=h[g>>2]|0,I=M+(d<<3)+4|0,_t(h[I>>2]|0),h[I>>2]=0,h[M+(d<<3)>>2]=0,d=d+1|0;while((d|0)<(h[_>>2]|0))}_t(h[g>>2]|0),h[g>>2]=0,h[_>>2]=0,A=A+1|0}while((A|0)<(h[b>>2]|0))}return _t(h[m>>2]|0),h[m>>2]=0,h[b>>2]=0,I=y,Y=E,I|0}function Ol(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(b=h[d>>2]|0,(b|0)<=0)return g=0,_=0,b=g<0,_=12.566370614359172-_,_=g+_,g=b?_:g,ne[A>>3]=g,0;if(y=h[d+4>>2]|0,d=(b|0)!=1&1,E=+ne[y>>3]*.5+.7853981633974483,g=+ne[y+(d<<4)>>3]*.5+.7853981633974483,m=+Ii(+E)*+Ii(+g),_=+ne[y+(d<<4)+8>>3]-+ne[y+8>>3],m=+ta(+(+Ii(+_)*m),+(+Qn(+E)*+Qn(+g)+ +Qn(+_)*m))*-2,_=m+0,m=_-m,(b|0)==1)return E=_,g=m,b=E<0,g=12.566370614359172-g,g=E+g,E=b?g:E,ne[A>>3]=E,0;for(d=1,g=_;O=d,d=d+1|0,G=(d|0)%(b|0)|0,I=+ne[y+(O<<4)>>3]*.5+.7853981633974483,M=+ne[y+(G<<4)>>3]*.5+.7853981633974483,_=+Ii(+I)*+Ii(+M),E=+ne[y+(G<<4)+8>>3]-+ne[y+(O<<4)+8>>3],m=+ta(+(+Ii(+E)*_),+(+Qn(+I)*+Qn(+M)+ +Qn(+E)*_))*-2-m,_=g+m,m=_-g-m,!((d|0)>=(b|0));)g=_;return G=_<0,I=12.566370614359172-m,I=_+I,I=G?I:_,ne[A>>3]=I,0}function $ie(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=E0(d,A,g)|0,d|0?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Ol(_,m)|0,y=0,Y=b,y|0)}function Yie(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=E0(d,A,g)|0,d?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Ol(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8,y=0,Y=b,y|0)}function Kie(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=E0(d,A,g)|0,d?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Ol(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8*1e6,y=0,Y=b,y|0)}function or(d){return d=d|0,d>>>0>121?(d=0,d|0):(d=h[7696+(d*28|0)+16>>2]|0,d|0)}function s4(d){return d=d|0,(d|0)==4|(d|0)==117|0}function Zk(d){return d=d|0,h[11120+((h[d>>2]|0)*216|0)+((h[d+4>>2]|0)*72|0)+((h[d+8>>2]|0)*24|0)+(h[d+12>>2]<<3)>>2]|0}function Zie(d){return d=d|0,h[11120+((h[d>>2]|0)*216|0)+((h[d+4>>2]|0)*72|0)+((h[d+8>>2]|0)*24|0)+(h[d+12>>2]<<3)+4>>2]|0}function Qie(d,A){d=d|0,A=A|0,d=7696+(d*28|0)|0,h[A>>2]=h[d>>2],h[A+4>>2]=h[d+4>>2],h[A+8>>2]=h[d+8>>2],h[A+12>>2]=h[d+12>>2]}function Jie(d,A){d=d|0,A=A|0;var m=0,_=0;if(A>>>0>20)return A=-1,A|0;do if((h[11120+(A*216|0)>>2]|0)!=(d|0))if((h[11120+(A*216|0)+8>>2]|0)!=(d|0))if((h[11120+(A*216|0)+16>>2]|0)!=(d|0))if((h[11120+(A*216|0)+24>>2]|0)!=(d|0))if((h[11120+(A*216|0)+32>>2]|0)!=(d|0))if((h[11120+(A*216|0)+40>>2]|0)!=(d|0))if((h[11120+(A*216|0)+48>>2]|0)!=(d|0))if((h[11120+(A*216|0)+56>>2]|0)!=(d|0))if((h[11120+(A*216|0)+64>>2]|0)!=(d|0))if((h[11120+(A*216|0)+72>>2]|0)!=(d|0))if((h[11120+(A*216|0)+80>>2]|0)!=(d|0))if((h[11120+(A*216|0)+88>>2]|0)!=(d|0))if((h[11120+(A*216|0)+96>>2]|0)!=(d|0))if((h[11120+(A*216|0)+104>>2]|0)!=(d|0))if((h[11120+(A*216|0)+112>>2]|0)!=(d|0))if((h[11120+(A*216|0)+120>>2]|0)!=(d|0))if((h[11120+(A*216|0)+128>>2]|0)!=(d|0))if((h[11120+(A*216|0)+136>>2]|0)==(d|0))d=2,m=1,_=2;else{if((h[11120+(A*216|0)+144>>2]|0)==(d|0)){d=0,m=2,_=0;break}if((h[11120+(A*216|0)+152>>2]|0)==(d|0)){d=0,m=2,_=1;break}if((h[11120+(A*216|0)+160>>2]|0)==(d|0)){d=0,m=2,_=2;break}if((h[11120+(A*216|0)+168>>2]|0)==(d|0)){d=1,m=2,_=0;break}if((h[11120+(A*216|0)+176>>2]|0)==(d|0)){d=1,m=2,_=1;break}if((h[11120+(A*216|0)+184>>2]|0)==(d|0)){d=1,m=2,_=2;break}if((h[11120+(A*216|0)+192>>2]|0)==(d|0)){d=2,m=2,_=0;break}if((h[11120+(A*216|0)+200>>2]|0)==(d|0)){d=2,m=2,_=1;break}if((h[11120+(A*216|0)+208>>2]|0)==(d|0)){d=2,m=2,_=2;break}else d=-1;return d|0}else d=2,m=1,_=1;else d=2,m=1,_=0;else d=1,m=1,_=2;else d=1,m=1,_=1;else d=1,m=1,_=0;else d=0,m=1,_=2;else d=0,m=1,_=1;else d=0,m=1,_=0;else d=2,m=0,_=2;else d=2,m=0,_=1;else d=2,m=0,_=0;else d=1,m=0,_=2;else d=1,m=0,_=1;else d=1,m=0,_=0;else d=0,m=0,_=2;else d=0,m=0,_=1;else d=0,m=0,_=0;while(!1);return A=h[11120+(A*216|0)+(m*72|0)+(d*24|0)+(_<<3)+4>>2]|0,A|0}function Qk(d,A){return d=d|0,A=A|0,(h[7696+(d*28|0)+20>>2]|0)==(A|0)?(A=1,A|0):(A=(h[7696+(d*28|0)+24>>2]|0)==(A|0),A|0)}function o4(d,A){return d=d|0,A=A|0,h[848+(d*28|0)+(A<<2)>>2]|0}function a4(d,A){return d=d|0,A=A|0,(h[848+(d*28|0)>>2]|0)==(A|0)?(A=0,A|0):(h[848+(d*28|0)+4>>2]|0)==(A|0)?(A=1,A|0):(h[848+(d*28|0)+8>>2]|0)==(A|0)?(A=2,A|0):(h[848+(d*28|0)+12>>2]|0)==(A|0)?(A=3,A|0):(h[848+(d*28|0)+16>>2]|0)==(A|0)?(A=4,A|0):(h[848+(d*28|0)+20>>2]|0)==(A|0)?(A=5,A|0):((h[848+(d*28|0)+24>>2]|0)==(A|0)?6:7)|0}function ere(){return 122}function tre(d){d=d|0;var A=0,m=0,_=0;A=0;do ht(A|0,0,45)|0,_=Q()|0|134225919,m=d+(A<<3)|0,h[m>>2]=-1,h[m+4>>2]=_,A=A+1|0;while((A|0)!=122);return 0}function nre(d){d=d|0;var A=0,m=0,_=0;return _=+ne[d+16>>3],m=+ne[d+24>>3],A=_-m,+(_<m?A+6.283185307179586:A)}function ire(d){return d=d|0,+ne[d+16>>3]<+ne[d+24>>3]|0}function rre(d){return d=d|0,+(+ne[d>>3]-+ne[d+8>>3])}function Jk(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;return m=+ne[A>>3],!(m>=+ne[d+8>>3])||!(m<=+ne[d>>3])?(A=0,A|0):(_=+ne[d+16>>3],m=+ne[d+24>>3],g=+ne[A+8>>3],A=g>=m,d=g<=_&1,_<m?A&&(d=1):A||(d=0),A=(d|0)!=0,A|0)}function l4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;return+ne[d>>3]<+ne[A+8>>3]||+ne[d+8>>3]>+ne[A>>3]?(_=0,_|0):(y=+ne[d+16>>3],m=d+24|0,O=+ne[m>>3],b=y<O,_=A+16|0,I=+ne[_>>3],g=A+24|0,M=+ne[g>>3],E=I<M,A=O-I<M-y,d=b?E|A?1:2:0,A=E?b?1:A?2:1:0,y=+ol(y,d),y<+ol(+ne[g>>3],A)||(O=+ol(+ne[m>>3],d),O>+ol(+ne[_>>3],A))?(E=0,E|0):(E=1,E|0))}function sre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0;y=+ne[d+16>>3],M=+ne[d+24>>3],d=y<M,E=+ne[A+16>>3],b=+ne[A+24>>3],g=E<b,A=M-E<b-y,h[m>>2]=d?g|A?1:2:0,h[_>>2]=g?d?1:A?2:1:0}function e9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;return+ne[d>>3]<+ne[A>>3]||+ne[d+8>>3]>+ne[A+8>>3]?(_=0,_|0):(_=d+16|0,M=+ne[_>>3],y=+ne[d+24>>3],b=M<y,m=A+16|0,O=+ne[m>>3],g=A+24|0,I=+ne[g>>3],E=O<I,A=y-O<I-M,d=b?E|A?1:2:0,A=E?b?1:A?2:1:0,y=+ol(y,d),y<=+ol(+ne[g>>3],A)?(O=+ol(+ne[_>>3],d),E=O>=+ol(+ne[m>>3],A),E|0):(E=0,E|0))}function t9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;g=Y,Y=Y+176|0,_=g,h[_>>2]=4,E=+ne[A>>3],ne[_+8>>3]=E,y=+ne[A+16>>3],ne[_+16>>3]=y,ne[_+24>>3]=E,E=+ne[A+24>>3],ne[_+32>>3]=E,b=+ne[A+8>>3],ne[_+40>>3]=b,ne[_+48>>3]=E,ne[_+56>>3]=b,ne[_+64>>3]=y,A=_+72|0,m=A+96|0;do h[A>>2]=0,A=A+4|0;while((A|0)<(m|0));_c(d|0,_|0,168)|0,Y=g}function n9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;$=Y,Y=Y+288|0,O=$+264|0,G=$+96|0,I=$,E=I,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return A=x4(A,I)|0,A|0?(W=A,Y=$,W|0):(M=I,I=h[M>>2]|0,M=h[M+4>>2]|0,Zm(I,M,O)|0,E0(I,M,G)|0,b=+rx(O,G+8|0),ne[O>>3]=+ne[d>>3],M=O+8|0,ne[M>>3]=+ne[d+16>>3],ne[G>>3]=+ne[d+8>>3],I=G+8|0,ne[I>>3]=+ne[d+24>>3],g=+rx(O,G),ue=+ne[M>>3]-+ne[I>>3],y=+Ps(+ue),oe=+ne[O>>3]-+ne[G>>3],_=+Ps(+oe),!(ue==0|oe==0)&&(ue=+R9(+y,+_),ue=+$m(+(g*g/+Kb(+(ue/+Kb(+y,+_)),3)/(b*(b*2.59807621135)*.8))),ne[Xi>>3]=ue,q=~~ue>>>0,W=+Ps(ue)>=1?ue>0?~~+r4(+Hs(ue/4294967296),4294967295)>>>0:~~+$m((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[Xi+4>>2]&2146435072|0)!=2146435072)?(G=(q|0)==0&(W|0)==0,A=m,h[A>>2]=G?1:q,h[A+4>>2]=G?0:W,A=0):A=1,W=A,Y=$,W|0)}function ore(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;I=Y,Y=Y+288|0,b=I+264|0,E=I+96|0,M=I,g=M,y=g+96|0;do h[g>>2]=0,g=g+4|0;while((g|0)<(y|0));return m=x4(m,M)|0,m|0?(_=m,Y=I,_|0):(m=M,g=h[m>>2]|0,m=h[m+4>>2]|0,Zm(g,m,b)|0,E0(g,m,E)|0,O=+rx(b,E+8|0),O=+$m(+(+rx(d,A)/(O*2))),ne[Xi>>3]=O,m=~~O>>>0,g=+Ps(O)>=1?O>0?~~+r4(+Hs(O/4294967296),4294967295)>>>0:~~+$m((O-+(~~O>>>0))/4294967296)>>>0:0,(h[Xi+4>>2]&2146435072|0)==2146435072?(_=1,Y=I,_|0):(M=(m|0)==0&(g|0)==0,h[_>>2]=M?1:m,h[_+4>>2]=M?0:g,_=0,Y=I,_|0))}function are(d,A){d=d|0,A=+A;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;y=d+16|0,b=+ne[y>>3],m=d+24|0,g=+ne[m>>3],_=b-g,_=b<g?_+6.283185307179586:_,I=+ne[d>>3],E=d+8|0,M=+ne[E>>3],O=I-M,_=(_*A-_)*.5,A=(O*A-O)*.5,I=I+A,ne[d>>3]=I>1.5707963267948966?1.5707963267948966:I,A=M-A,ne[E>>3]=A<-1.5707963267948966?-1.5707963267948966:A,A=b+_,A=A>3.141592653589793?A+-6.283185307179586:A,ne[y>>3]=A<-3.141592653589793?A+6.283185307179586:A,A=g-_,A=A>3.141592653589793?A+-6.283185307179586:A,ne[m>>3]=A<-3.141592653589793?A+6.283185307179586:A}function lre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0;if(dt=Y,Y=Y+224|0,At=dt,Fe=dt+48|0,M=(m|0)>0|(m|0)==0&A>>>0>0,M&(m>>>0>0|(m|0)==0&A>>>0>17895697))return at=14,Y=dt,at|0;if((m|0)<0)return at=2,Y=dt,at|0;if((A|0)==0&(m|0)==0)return h[_>>2]=0,h[_+4>>2]=0,at=0,Y=dt,at|0;for(g=d,g=f4(h[g>>2]|0,h[g+4>>2]|0)|0,b=0,E=0;;){if(y=d+(b<<3)|0,at=y,!(Vb(h[at>>2]|0,h[at+4>>2]|0)|0)){g=5,We=159;break}if(at=y,at=(f4(h[at>>2]|0,h[at+4>>2]|0)|0)==(g|0),b=pt(b|0,E|0,1,0)|0,E=Q()|0,!at){g=12,We=159;break}if(!((E|0)<(m|0)|(E|0)==(m|0)&b>>>0<A>>>0)){We=8;break}}if((We|0)==8){do if((m|0)>0|(m|0)==0&A>>>0>1){if(g=A<<3,b=ar(g)|0,!b)return at=13,Y=dt,at|0;for(_c(b|0,d|0,g|0)|0,jb(b,A,8,1),g=1,y=0;Ot=b+(g<<3)|0,at=b+(g+-1<<3)|0,at=(h[Ot>>2]|0)==(h[at>>2]|0)?(h[Ot+4>>2]|0)==(h[at+4>>2]|0):0,g=pt(g|0,y|0,1,0)|0,y=Q()|0,!at;)if(!((y|0)<(m|0)|(y|0)==(m|0)&g>>>0<A>>>0)){We=14;break}if((We|0)==14){_t(b);break}return _t(b),at=10,Y=dt,at|0}while(!1);if(g=lr(A|0,m|0,6,0)|0,y=Q()|0,M){b=0,E=0;do at=d+(E<<3)|0,at=((Ui(h[at>>2]|0,h[at+4>>2]|0)|0)!=0)<<31>>31,g=pt(g|0,y|0,at|0,((at|0)<0)<<31>>31|0)|0,y=Q()|0,E=pt(E|0,b|0,1,0)|0,b=Q()|0;while((b|0)<(m|0)|(b|0)==(m|0)&E>>>0<A>>>0);me=g,be=y}else me=g,be=y;if(_e=lr(me|0,be|0,10,0)|0,re=Q()|0,Ot=ar(me<<5)|0,!Ot)return at=13,Y=dt,at|0;if(at=na(_e,4)|0,!at)return _t(Ot),at=13,Y=dt,at|0;e:do if(M){for(ye=d,c4(h[ye>>2]|0,h[ye+4>>2]|0,At)|0,W=Ot,$=0,oe=0,g=0,ue=0;;){M=At,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,y=M?26990:26995,b=M?5:6,E=0,M=At+((M&1)<<3)|0,I=pt(b|0,E|0,-1,-1)|0,O=Q()|0,G=0,q=0;do Ee=M+(G<<3)|0,Ke=h[Ee+4>>2]|0,ye=W+(G<<5)|0,h[ye>>2]=h[Ee>>2],h[ye+4>>2]=Ke,He[W+(G<<5)+9>>0]=0,He[W+(G<<5)+8>>0]=0,h[W+(G<<5)+20>>2]=W,ye=W+(G<<5)+24|0,h[ye>>2]=1,h[ye+4>>2]=0,ye=He[y+G>>0]|0,Ke=pt(I|0,O|0,G|0,q|0)|0,Ke=Xh(Ke|0,Q()|0,b|0,E|0)|0,Q()|0,Ke=He[y+Ke>>0]|0,G=pt(G|0,q|0,1,0)|0,q=Q()|0,Ee=He[y+((G|0)==(b|0)&(q|0)==(E|0)?0:G)>>0]|0,ye=ye&255,h[W+(ye<<5)+16>>2]=W+((Ke&255)<<5),h[W+(ye<<5)+12>>2]=W+((Ee&255)<<5);while(q>>>0<E>>>0|(q|0)==(E|0)&G>>>0<b>>>0);if($=pt($|0,oe|0,1,0)|0,oe=Q()|0,g=pt(b|0,E|0,g|0,ue|0)|0,ue=Q()|0,!((oe|0)<(m|0)|(oe|0)==(m|0)&$>>>0<A>>>0))break e;ye=d+($<<3)|0,c4(h[ye>>2]|0,h[ye+4>>2]|0,At)|0||(W=Ot+(g<<5)|0)}li(27634,26956,108,26975)}while(!1);if((be|0)>0|(be|0)==0&me>>>0>0){E=0,M=0;do{if(y=Ot+(E<<5)|0,b=h[y>>2]|0,y=h[y+4>>2]|0,g=et(b|0,y|0,30)|0,y=lr(g^b|0,(Q()|0)^y|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=lr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Xh(g^b|0,(Q()|0)^y|0,_e|0,re|0)|0,b=Q()|0,g=at+(y<<2)|0,h[g>>2]|0)do g=pt(y|0,b|0,1,0)|0,y=rd(g|0,Q()|0,_e|0,re|0)|0,b=Q()|0,g=at+(y<<2)|0;while((h[g>>2]|0)!=0);h[g>>2]=Ot+(E<<5),E=pt(E|0,M|0,1,0)|0,M=Q()|0}while((M|0)<(be|0)|(M|0)==(be|0)&E>>>0<me>>>0);G=0,q=0;do{if(E=Ot+(G<<5)|0,M=Ot+(G<<5)+9|0,!(He[M>>0]|0)){if(ye=E,r9(h[ye>>2]|0,h[ye+4>>2]|0,At)|0){We=39;break}O=At,I=h[O>>2]|0,O=h[O+4>>2]|0,y=et(I|0,O|0,30)|0,y=lr(y^I|0,(Q()|0)^O|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=lr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Xh(g^b|0,(Q()|0)^y|0,_e|0,re|0)|0,b=Q()|0,g=h[at+(y<<2)>>2]|0;e:do if(g|0){for(;ye=g,!((h[ye>>2]|0)==(I|0)&&(h[ye+4>>2]|0)==(O|0));)if(g=pt(y|0,b|0,1,0)|0,y=rd(g|0,Q()|0,_e|0,re|0)|0,b=Q()|0,g=h[at+(y<<2)>>2]|0,!g)break e;He[M>>0]=1,He[g+9>>0]=1,y=g+16|0,ye=Ot+(G<<5)+12|0,h[(h[ye>>2]|0)+16>>2]=h[y>>2],m=g+12|0,Ee=h[Ot+(G<<5)+16>>2]|0,h[Ee+12>>2]=h[m>>2],h[(h[m>>2]|0)+16>>2]=Ee,h[(h[y>>2]|0)+12>>2]=h[ye>>2],y=zb(E)|0,ye=zb(g)|0,g=y+24|0,m=h[g+4>>2]|0,Ee=ye+24|0,Ke=h[Ee+4>>2]|0,Ee=(m|0)<(Ke|0)|((m|0)==(Ke|0)?(h[g>>2]|0)>>>0<(h[Ee>>2]|0)>>>0:0),g=Ee?y:ye,y=Ee?ye:y,(y|0)!=(g|0)&&(Ke=g+24|0,ye=y+24|0,Ee=ye,Ke=pt(h[Ee>>2]|0,h[Ee+4>>2]|0,h[Ke>>2]|0,h[Ke+4>>2]|0)|0,Ee=Q()|0,h[ye>>2]=Ke,h[ye+4>>2]=Ee,h[g+20>>2]=y)}while(!1)}G=pt(G|0,q|0,1,0)|0,q=Q()|0}while((q|0)<(be|0)|(q|0)==(be|0)&G>>>0<me>>>0);(We|0)==39&&li(27634,26956,258,27001),g=0,y=0;do He[Ot+(g<<5)+8>>0]=0,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(be|0)|(y|0)==(be|0)&g>>>0<me>>>0);for(I=0,b=0,M=0,O=0;;){if(g=Ot+(I<<5)|0,(He[Ot+(I<<5)+8>>0]|0)==0&&(He[Ot+(I<<5)+9>>0]|0)==0){E=g,y=h[E>>2]|0,E=h[E+4>>2]|0;do He[g+8>>0]=1,g=h[g+12>>2]|0,ye=g;while(!((h[ye>>2]|0)==(y|0)&&(h[ye+4>>2]|0)==(E|0)));b=pt(b|0,M|0,1,0)|0,E=Q()|0}else E=M;if(I=pt(I|0,O|0,1,0)|0,O=Q()|0,(O|0)<(be|0)|(O|0)==(be|0)&I>>>0<me>>>0)M=E;else break}g=0,y=0;do He[Ot+(g<<5)+8>>0]=0,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(be|0)|(y|0)==(be|0)&g>>>0<me>>>0);Ee=b,Ke=E,g=1}else Ee=0,Ke=0,g=0;ye=ar(Ee*24|0)|0;e:do if(ye|0){t:do if(g){d=0,_e=0,m=0,A=0;n:for(;;){if(g=Ot+(d<<5)|0,(He[Ot+(d<<5)+8>>0]|0)==0&&(He[Ot+(d<<5)+9>>0]|0)==0){ue=g,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,y=0,b=0;do y=pt(y|0,b|0,2,0)|0,b=Q()|0,g=h[g+12>>2]|0,re=g;while(!((h[re>>2]|0)==(oe|0)&&(h[re+4>>2]|0)==(ue|0)));if($=ar(y<<4)|0,!$)break;y=oe,b=ue,W=0,q=0,E=0,M=0;do{if(ex(y,b,Fe)|0){We=69;break n}if(re=h[Fe>>2]|0,O=re+-1|0,G=((O|0)<0)<<31>>31,(re|0)>1){b=E,I=0,y=M,E=0;do re=$+(b<<4)|0,M=Fe+8+(I<<4)|0,h[re>>2]=h[M>>2],h[re+4>>2]=h[M+4>>2],h[re+8>>2]=h[M+8>>2],h[re+12>>2]=h[M+12>>2],b=pt(b|0,y|0,1,0)|0,y=Q()|0,I=pt(I|0,E|0,1,0)|0,E=Q()|0;while((E|0)<(G|0)|(E|0)==(G|0)&I>>>0<O>>>0);E=b,M=y}W=pt(W|0,q|0,O|0,G|0)|0,q=Q()|0,He[g+8>>0]=1,g=h[g+12>>2]|0,b=g,y=h[b>>2]|0,b=h[b+4>>2]|0}while(!((y|0)==(oe|0)&(b|0)==(ue|0)));if(y=cse($,W<<4)|0,!y){We=75;break}ue=zb(g)|0,re=h[ue+4>>2]|0,g=ye+(m*24|0)|0,h[g>>2]=h[ue>>2],h[g+4>>2]=re,g=ye+(m*24|0)+16|0,h[g>>2]=W,h[ye+(m*24|0)+20>>2]=y,h[At>>2]=h[g>>2],h[At+4>>2]=h[g+4>>2],Ol(At,ye+(m*24|0)+8|0)|0,y=pt(m|0,_e|0,1,0)|0,g=Q()|0}else y=m,g=_e;if(d=pt(d|0,A|0,1,0)|0,A=Q()|0,(A|0)<(be|0)|(A|0)==(be|0)&d>>>0<me>>>0)_e=g,m=y;else break t}if((We|0)==69?li(27634,26956,351,27016):(We|0)==75&&_t($),(_e|0)>0|(_e|0)==0&m>>>0>0)for(E=0,M=0,g=m,b=_e;y=h[ye+(E*24|0)+20>>2]|0,y?(_t(y),y=_e,g=m):y=b,E=pt(E|0,M|0,1,0)|0,M=Q()|0,(M|0)<(y|0)|(M|0)==(y|0)&E>>>0<g>>>0;)b=y;_t(ye);break e}while(!1);jb(ye,Ee,24,2);t:do if((Ee|0)==0&(Ke|0)==0){if(re=ar(192)|0,re|0){if(h[re+16>>2]=0,h[re+20>>2]=0,q=re+8|0,h[q>>2]=3,g=ar(48)|0,W=re+12|0,h[W>>2]=g,g|0){h[g>>2]=h[3860],h[g+4>>2]=h[3861],h[g+8>>2]=h[3862],h[g+12>>2]=h[3863],G=g+16|0,h[G>>2]=h[3864],h[G+4>>2]=h[3865],h[G+8>>2]=h[3866],h[G+12>>2]=h[3867],G=g+32|0,h[G>>2]=h[3868],h[G+4>>2]=h[3869],h[G+8>>2]=h[3870],h[G+12>>2]=h[3871],h[At>>2]=h[q>>2],h[At+4>>2]=h[q+4>>2],Ol(At,re)|0,h[re+40>>2]=0,h[re+44>>2]=0,G=re+32|0,h[G>>2]=3,g=ar(48)|0,$=re+36|0,h[$>>2]=g;do if(!g)E=0,M=1;else{if(h[g>>2]=h[3872],h[g+4>>2]=h[3873],h[g+8>>2]=h[3874],h[g+12>>2]=h[3875],O=g+16|0,h[O>>2]=h[3876],h[O+4>>2]=h[3877],h[O+8>>2]=h[3878],h[O+12>>2]=h[3879],O=g+32|0,h[O>>2]=h[3880],h[O+4>>2]=h[3881],h[O+8>>2]=h[3882],h[O+12>>2]=h[3883],h[At>>2]=h[G>>2],h[At+4>>2]=h[G+4>>2],Ol(At,re+24|0)|0,h[re+64>>2]=0,h[re+68>>2]=0,O=re+56|0,h[O>>2]=3,g=ar(48)|0,oe=re+60|0,h[oe>>2]=g,!g){E=0,M=2;break}if(h[g>>2]=h[3884],h[g+4>>2]=h[3885],h[g+8>>2]=h[3886],h[g+12>>2]=h[3887],I=g+16|0,h[I>>2]=h[3888],h[I+4>>2]=h[3889],h[I+8>>2]=h[3890],h[I+12>>2]=h[3891],I=g+32|0,h[I>>2]=h[3892],h[I+4>>2]=h[3893],h[I+8>>2]=h[3894],h[I+12>>2]=h[3895],h[At>>2]=h[O>>2],h[At+4>>2]=h[O+4>>2],Ol(At,re+48|0)|0,h[re+88>>2]=0,h[re+92>>2]=0,I=re+80|0,h[I>>2]=3,g=ar(48)|0,ue=re+84|0,h[ue>>2]=g,!g){E=0,M=3;break}if(h[g>>2]=h[3896],h[g+4>>2]=h[3897],h[g+8>>2]=h[3898],h[g+12>>2]=h[3899],M=g+16|0,h[M>>2]=h[3900],h[M+4>>2]=h[3901],h[M+8>>2]=h[3902],h[M+12>>2]=h[3903],M=g+32|0,h[M>>2]=h[3904],h[M+4>>2]=h[3905],h[M+8>>2]=h[3906],h[M+12>>2]=h[3907],h[At>>2]=h[I>>2],h[At+4>>2]=h[I+4>>2],Ol(At,re+72|0)|0,h[re+112>>2]=0,h[re+116>>2]=0,M=re+104|0,h[M>>2]=3,g=ar(48)|0,d=re+108|0,h[d>>2]=g,!g){E=0,M=4;break}if(h[g>>2]=h[3908],h[g+4>>2]=h[3909],h[g+8>>2]=h[3910],h[g+12>>2]=h[3911],E=g+16|0,h[E>>2]=h[3912],h[E+4>>2]=h[3913],h[E+8>>2]=h[3914],h[E+12>>2]=h[3915],E=g+32|0,h[E>>2]=h[3916],h[E+4>>2]=h[3917],h[E+8>>2]=h[3918],h[E+12>>2]=h[3919],h[At>>2]=h[M>>2],h[At+4>>2]=h[M+4>>2],Ol(At,re+96|0)|0,h[re+136>>2]=0,h[re+140>>2]=0,E=re+128|0,h[E>>2]=3,g=ar(48)|0,A=re+132|0,h[A>>2]=g,!g){E=0,M=5;break}if(h[g>>2]=h[3920],h[g+4>>2]=h[3921],h[g+8>>2]=h[3922],h[g+12>>2]=h[3923],b=g+16|0,h[b>>2]=h[3924],h[b+4>>2]=h[3925],h[b+8>>2]=h[3926],h[b+12>>2]=h[3927],b=g+32|0,h[b>>2]=h[3928],h[b+4>>2]=h[3929],h[b+8>>2]=h[3930],h[b+12>>2]=h[3931],h[At>>2]=h[E>>2],h[At+4>>2]=h[E+4>>2],Ol(At,re+120|0)|0,h[re+160>>2]=0,h[re+164>>2]=0,b=re+152|0,h[b>>2]=3,g=ar(48)|0,m=re+156|0,h[m>>2]=g,!g){E=0,M=6;break}if(h[g>>2]=h[3932],h[g+4>>2]=h[3933],h[g+8>>2]=h[3934],h[g+12>>2]=h[3935],y=g+16|0,h[y>>2]=h[3936],h[y+4>>2]=h[3937],h[y+8>>2]=h[3938],h[y+12>>2]=h[3939],y=g+32|0,h[y>>2]=h[3940],h[y+4>>2]=h[3941],h[y+8>>2]=h[3942],h[y+12>>2]=h[3943],h[At>>2]=h[b>>2],h[At+4>>2]=h[b+4>>2],Ol(At,re+144|0)|0,h[re+184>>2]=0,h[re+188>>2]=0,y=re+176|0,h[y>>2]=3,g=ar(48)|0,_e=re+180|0,h[_e>>2]=g,!g){E=0,M=7;break}if(h[g>>2]=h[3944],h[g+4>>2]=h[3945],h[g+8>>2]=h[3946],h[g+12>>2]=h[3947],Fe=g+16|0,h[Fe>>2]=h[3948],h[Fe+4>>2]=h[3949],h[Fe+8>>2]=h[3950],h[Fe+12>>2]=h[3951],g=g+32|0,h[g>>2]=h[3952],h[g+4>>2]=h[3953],h[g+8>>2]=h[3954],h[g+12>>2]=h[3955],h[At>>2]=h[y>>2],h[At+4>>2]=h[y+4>>2],Ol(At,re+168|0)|0,jb(re,8,24,3),g=ar(128)|0,h[_+4>>2]=g,g|0){h[_>>2]=8,h[g>>2]=h[q>>2],h[g+4>>2]=h[q+4>>2],h[g+8>>2]=h[q+8>>2],h[g+12>>2]=h[q+12>>2],We=g+16|0,h[We>>2]=h[G>>2],h[We+4>>2]=h[G+4>>2],h[We+8>>2]=h[G+8>>2],h[We+12>>2]=h[G+12>>2],We=g+32|0,h[We>>2]=h[O>>2],h[We+4>>2]=h[O+4>>2],h[We+8>>2]=h[O+8>>2],h[We+12>>2]=h[O+12>>2],We=g+48|0,h[We>>2]=h[I>>2],h[We+4>>2]=h[I+4>>2],h[We+8>>2]=h[I+8>>2],h[We+12>>2]=h[I+12>>2],We=g+64|0,h[We>>2]=h[M>>2],h[We+4>>2]=h[M+4>>2],h[We+8>>2]=h[M+8>>2],h[We+12>>2]=h[M+12>>2],We=g+80|0,h[We>>2]=h[E>>2],h[We+4>>2]=h[E+4>>2],h[We+8>>2]=h[E+8>>2],h[We+12>>2]=h[E+12>>2],We=g+96|0,h[We>>2]=h[b>>2],h[We+4>>2]=h[b+4>>2],h[We+8>>2]=h[b+8>>2],h[We+12>>2]=h[b+12>>2],We=g+112|0,h[We>>2]=h[y>>2],h[We+4>>2]=h[y+4>>2],h[We+8>>2]=h[y+8>>2],h[We+12>>2]=h[y+12>>2],_t(re),We=158;break t}g=h[W>>2]|0,g|0&&_t(g),g=h[$>>2]|0,g|0&&_t(g),g=h[oe>>2]|0,g|0&&_t(g),g=h[ue>>2]|0,g|0&&_t(g),g=h[d>>2]|0,g|0&&_t(g),g=h[A>>2]|0,g|0&&_t(g),g=h[m>>2]|0,g|0&&_t(g),g=h[_e>>2]|0,g|0&&_t(g),_t(re);break t}while(!1);g=0,b=0;do y=h[re+(g*24|0)+12>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&g>>>0<M>>>0)}_t(re),We=152}}else{if((Ke|0)>0|(Ke|0)==0&Ee>>>0>0){b=0,E=0,M=0,y=0,g=0,I=0;do Fe=ye+(b*24|0)|0,At=E,E=h[Fe>>2]|0,We=M,M=h[Fe+4>>2]|0,y=pt(y|0,g|0,((E|0)!=(At|0)|(M|0)!=(We|0))&1|0,0)|0,g=Q()|0,b=pt(b|0,I|0,1,0)|0,I=Q()|0;while((I|0)<(Ke|0)|(I|0)==(Ke|0)&b>>>0<Ee>>>0);ue=y,oe=g}else ue=0,oe=0;if(d=ar(ue*24|0)|0,d){n:do if((Ke|0)>=0){for(q=0,W=0,y=0,b=0,$=0,E=0;;){if(!((q|0)==(Ee|0)&(W|0)==(Ke|0))&&(At=ye+(y*24|0)|0,We=ye+(q*24|0)|0,(h[At>>2]|0)==(h[We>>2]|0)?(h[At+4>>2]|0)==(h[We+4>>2]|0):0))g=$;else{if(O=ye+(y*24|0)|0,We=Ns(q|0,W|0,y|0,b|0)|0,At=Q()|0,G=pt(We|0,At|0,-1,-1)|0,b=Q()|0,(At|0)>0|(At|0)==0&We>>>0>1){if(g=ar(G<<3)|0,!g)break;M=0,I=0;do We=M,M=pt(M|0,I|0,1,0)|0,I=Q()|0,Fe=O+(M*24|0)+16|0,At=h[Fe+4>>2]|0,We=g+(We<<3)|0,h[We>>2]=h[Fe>>2],h[We+4>>2]=At;while((I|0)<(b|0)|(I|0)==(b|0)&M>>>0<G>>>0)}else g=0;At=ye+(y*24|0)+16|0,We=h[At+4>>2]|0,b=d+(E*24|0)+8|0,h[b>>2]=h[At>>2],h[b+4>>2]=We,h[d+(E*24|0)+16>>2]=G,h[d+(E*24|0)+20>>2]=g,ne[d+(E*24|0)>>3]=+ne[ye+(y*24|0)+8>>3],E=pt(E|0,$|0,1,0)|0,y=q,b=W,g=Q()|0}if(We=q,q=pt(q|0,W|0,1,0)|0,At=W,W=Q()|0,(At|0)<(Ke|0)|(At|0)==(Ke|0)&We>>>0<Ee>>>0)$=g;else break n}if(($|0)>0|($|0)==0&E>>>0>0){g=0,b=0;do y=h[d+(g*24|0)+20>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while((b|0)<($|0)|(b|0)==($|0)&g>>>0<E>>>0)}_t(d),We=152;break t}while(!1);if(jb(d,ue,24,3),g=ar(ue<<4)|0,b=_+4|0,h[b>>2]=g,g){h[_>>2]=ue;do if((oe|0)>0|(oe|0)==0&ue>>>0>0){if(_=d+8|0,h[g>>2]=h[_>>2],h[g+4>>2]=h[_+4>>2],h[g+8>>2]=h[_+8>>2],h[g+12>>2]=h[_+12>>2],(ue|0)==1&(oe|0)==0||(_=g+16|0,We=d+32|0,h[_>>2]=h[We>>2],h[_+4>>2]=h[We+4>>2],h[_+8>>2]=h[We+8>>2],h[_+12>>2]=h[We+12>>2],!((oe|0)>0|(oe|0)==0&ue>>>0>2)))break;g=2,y=0;do _=(h[b>>2]|0)+(g<<4)|0,We=d+(g*24|0)+8|0,h[_>>2]=h[We>>2],h[_+4>>2]=h[We+4>>2],h[_+8>>2]=h[We+8>>2],h[_+12>>2]=h[We+12>>2],g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(oe|0)|(y|0)==(oe|0)&g>>>0<ue>>>0)}while(!1);_t(d),We=158;break}else{if((oe|0)>0|(oe|0)==0&ue>>>0>0){g=0,b=0;do y=h[d+(g*24|0)+20>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while((b|0)<(oe|0)|(b|0)==(oe|0)&g>>>0<ue>>>0)}_t(d),We=152;break}}else We=152}while(!1);if((We|0)==158)return _t(Ot),_t(at),_t(ye),at=0,Y=dt,at|0;if((We|0)==152&&(Ke|0)>0|(Ke|0)==0&Ee>>>0>0)for(E=0,M=0,g=Ee,b=Ke;y=h[ye+(E*24|0)+20>>2]|0,y?(_t(y),y=Ke,g=Ee):y=b,E=pt(E|0,M|0,1,0)|0,M=Q()|0,(M|0)<(y|0)|(M|0)==(y|0)&E>>>0<g>>>0;)b=y;return _t(ye),_t(Ot),_t(at),at=13,Y=dt,at|0}while(!1);return _t(Ot),_t(at),at=13,Y=dt,at|0}else if((We|0)==159)return Y=dt,g|0;return 0}function cre(d,A){d=d|0,A=A|0;var m=0,_=0;return _=d,d=h[_>>2]|0,_=h[_+4>>2]|0,m=A,A=h[m>>2]|0,m=h[m+4>>2]|0,(_>>>0<m>>>0|(_|0)==(m|0)&d>>>0<A>>>0?-1:(_>>>0>m>>>0|(_|0)==(m|0)&d>>>0>A>>>0)&1)|0}function zb(d){d=d|0;var A=0,m=0;return A=d+20|0,m=h[A>>2]|0,(m|0)==(d|0)?d|0:(m=zb(m)|0,h[A>>2]=m,m|0)}function ure(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;return E=d,b=h[E>>2]|0,E=h[E+4>>2]|0,y=A,g=h[y>>2]|0,y=h[y+4>>2]|0,E>>>0<y>>>0|(E|0)==(y|0)&b>>>0<g>>>0?(A=-1,A|0):E>>>0>y>>>0|(E|0)==(y|0)&b>>>0>g>>>0?(A=1,A|0):(_=+ne[d+8>>3],m=+ne[A+8>>3],_<m?(A=-1,A|0):(A=_>m&1,A|0))}function hre(d,A){d=d|0,A=A|0;var m=0,_=0;return _=+ne[d>>3],m=+ne[A>>3],(_>m?-1:_<m&1)|0}function fre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(G=Y,Y=Y+64|0,O=G,E=G+56|0,!(!0&(A&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return g=5,Y=G,g|0;if((d|0)==(m|0)&(A|0)==(_|0))return h[g>>2]=0,g=0,Y=G,g|0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,I=et(m|0,_|0,52)|0,Q()|0,(b|0)!=(I&15|0))return g=12,Y=G,g|0;if(y=b+-1|0,b>>>0>1){p4(d,A,y,O)|0,p4(m,_,y,E)|0,I=O,M=h[I>>2]|0,I=h[I+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(I|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,y=et(d|0,A|0,b|0)|0,Q()|0,y=y&7,b=et(m|0,_|0,b|0)|0,Q()|0,b=b&7;do if((y|0)==0|(b|0)==0)h[g>>2]=1,y=0;else if((y|0)==7)y=5;else{if((y|0)==1|(b|0)==1&&Ui(M,I)|0){y=5;break}if((h[15824+(y<<2)>>2]|0)!=(b|0)&&(h[15856+(y<<2)>>2]|0)!=(b|0))break e;h[g>>2]=1,y=0}while(!1);return g=y,Y=G,g|0}while(!1)}y=O,b=y+56|0;do h[y>>2]=0,y=y+4|0;while((y|0)<(b|0));return jk(d,A,1,O)|0,A=O,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0))&&(A=O+8|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+16|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+24|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+32|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+40|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))?(y=O+48|0,y=((h[y>>2]|0)==(m|0)?(h[y+4>>2]|0)==(_|0):0)&1):y=1,h[g>>2]=y,g=0,Y=G,g|0}function dre(d,A,m,_,g){return d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,m=Gb(d,A,m,_)|0,(m|0)==7?(g=11,g|0):(_=ht(m|0,0,56)|0,A=A&-2130706433|(Q()|0)|268435456,h[g>>2]=d|_,h[g+4>>2]=A,g=0,g|0)}function pre(d,A,m){return d=d|0,A=A|0,m=m|0,!0&(A&2013265920|0)==268435456?(h[m>>2]=d,h[m+4>>2]=A&-2130706433|134217728,m=0,m|0):(m=6,m|0)}function Are(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return g=Y,Y=Y+16|0,_=g,h[_>>2]=0,!0&(A&2013265920|0)==268435456?(y=et(d|0,A|0,56)|0,Q()|0,_=Is(d,A&-2130706433|134217728,y&7,_,m)|0,Y=g,_|0):(_=6,Y=g,_|0)}function i9(d,A){d=d|0,A=A|0;var m=0;switch(m=et(d|0,A|0,56)|0,Q()|0,m&7){case 0:case 7:return m=0,m|0;default:}return m=A&-2130706433|134217728,!(!0&(A&2013265920|0)==268435456)||!0&(A&117440512|0)==16777216&(Ui(d,m)|0)!=0?(m=0,m|0):(m=Vb(d,m)|0,m|0)}function mre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return g=Y,Y=Y+16|0,_=g,!0&(A&2013265920|0)==268435456?(y=A&-2130706433|134217728,b=m,h[b>>2]=d,h[b+4>>2]=y,h[_>>2]=0,A=et(d|0,A|0,56)|0,Q()|0,_=Is(d,y,A&7,_,m+8|0)|0,Y=g,_|0):(_=6,Y=g,_|0)}function c4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0;return g=(Ui(d,A)|0)==0,A=A&-2130706433,_=m,h[_>>2]=g?d:0,h[_+4>>2]=g?A|285212672:0,_=m+8|0,h[_>>2]=d,h[_+4>>2]=A|301989888,_=m+16|0,h[_>>2]=d,h[_+4>>2]=A|318767104,_=m+24|0,h[_>>2]=d,h[_+4>>2]=A|335544320,_=m+32|0,h[_>>2]=d,h[_+4>>2]=A|352321536,m=m+40|0,h[m>>2]=d,h[m+4>>2]=A|369098752,0}function ex(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+16|0,g=b,y=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(_=et(d|0,A|0,56)|0,Q()|0,_=ose(d,y,_&7)|0,(_|0)==-1?(h[m>>2]=0,y=6,Y=b,y|0):(Km(d,y,g)|0&&li(27634,27035,282,27050),A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Ui(d,y)|0?u4(g,A,_,2,m):h4(g,A,_,2,m),y=0,Y=b,y|0)):(y=6,Y=b,y|0)}function r9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+16|0,_=b+8|0,g=b,y=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(h[_>>2]=0,A=et(d|0,A|0,56)|0,Q()|0,A=Is(d,y,A&7,_,g)|0,A|0?(m=A,Y=b,m|0):(_=h[g>>2]|0,g=h[g+4>>2]|0,A=Gb(_,g,d,y)|0,(A|0)==7?(m=11,Y=b,m|0):(d=ht(A|0,0,56)|0,y=g&-2130706433|(Q()|0)|268435456,h[m>>2]=_|d,h[m+4>>2]=y,m=0,Y=b,m|0))):(m=6,Y=b,m|0)}function gre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0;h[m>>2]=0,I=+ne[d>>3],O=+ne[d+8>>3],M=+ne[d+16>>3],g=0,y=5,_=5,d=0;do oe=+ne[15888+(g*24|0)>>3]-I,$=+ne[15888+(g*24|0)+8>>3]-O,b=+ne[15888+(g*24|0)+16>>3]-M,b=oe*oe+$*$+b*b,b<_&&(h[m>>2]=g,y=b,d=g,_=b),g=g+1|0;while((g|0)!=20);if(y=+Pie(+(1-y*.5)),y<1e-16)M=0,b=0;else{if(me=+ne[16368+(d*24|0)>>3],re=+ne[15888+(d*24|0)>>3],be=+ne[15888+(d*24|0)+8>>3],_e=+ne[15888+(d*24|0)+16>>3],Fe=-(_e+(re*0+be*0)),b=re*Fe+0,oe=be*Fe+0,Fe=_e*Fe+1,ue=+ts(+(Fe*Fe+(b*b+oe*oe))),ue=ue>0?1/ue:0,b=b*ue,oe=oe*ue,ue=Fe*ue,Fe=-(I*re+O*be+M*_e),$=I+re*Fe,_=O+be*Fe,I=M+_e*Fe,O=+ts(+(I*I+($*$+_*_))),O=O>0?1/O:0,$=$*O,_=_*O,O=I*O,_=+ix(me-+ix(+ta(+(O*(be*b-re*oe)+($*(_e*oe-be*ue)+_*(re*ue-_e*b))),+(ue*O+(b*$+oe*_))))),Bl(A)|0?b=+ix(_+-.3334731722518321):b=_,_=+kb(+y)*2.618033988749896,(A|0)>0){d=0;do _=_*2.6457513110645907,d=d+1|0;while((d|0)!=(A|0))}M=+Qn(+b)*_,b=+Ii(+b)*_}A=m+4|0,W=m+12|0,h[W>>2]=0,y=+Ps(+b)*1.1547005383792515,_=+Ps(+M)+y*.5,d=~~_,g=~~y,_=_-+(d|0),y=y-+(g|0);do if(_<.5)if(_<.3333333333333333)if(h[A>>2]=d,y<(_+1)*.5){h[m+8>>2]=g;break}else{g=g+1|0,h[m+8>>2]=g;break}else if(Fe=1-_,g=(!(y<Fe)&1)+g|0,h[m+8>>2]=g,Fe<=y&y<_*2){d=d+1|0,h[A>>2]=d;break}else{h[A>>2]=d;break}else{if(!(_<.6666666666666666))if(d=d+1|0,h[A>>2]=d,y<_*.5){h[m+8>>2]=g;break}else{g=g+1|0,h[m+8>>2]=g;break}if(y<1-_){if(h[m+8>>2]=g,_*2+-1<y){h[A>>2]=d;break}}else g=g+1|0,h[m+8>>2]=g;d=d+1|0,h[A>>2]=d}while(!1);do if(M<0)if(g&1){q=(g+1|0)/2|0,q=Ns(d|0,((d|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,d=~~(+(d|0)-((+(q>>>0)+4294967296*+(Q()|0))*2+1)),h[A>>2]=d,q=A;break}else{q=(g|0)/2|0,q=Ns(d|0,((d|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,d=~~(+(d|0)-(+(q>>>0)+4294967296*+(Q()|0))*2),h[A>>2]=d,q=A;break}else q=A;while(!1);G=m+8|0,A=0-g|0,b<0?(m=d-((g<<1|1|0)/2|0)|0,h[q>>2]=m,h[G>>2]=A,g=A):m=d,d=g-m|0,A=0-m|0,(m|0)<0?(h[G>>2]=d,h[W>>2]=A,h[q>>2]=0,E=0):(d=g,E=m,A=0),m=E-d|0,g=A-d|0,(d|0)<0?(h[q>>2]=m,h[W>>2]=g,h[G>>2]=0,E=m,d=0):g=A,m=E-g|0,A=d-g|0,(g|0)<0?(h[q>>2]=m,h[G>>2]=A,h[W>>2]=0,g=0):(A=d,m=E),d=(A|0)<(m|0)?A:m,d=(g|0)<(d|0)?g:d,!((d|0)<=0)&&(h[q>>2]=m-d,h[G>>2]=A-d,h[W>>2]=g-d)}function _re(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;_=Y,Y=Y+16|0,g=_,b=h[d+12>>2]|0,y=+((h[d+8>>2]|0)-b|0),ne[g>>3]=+((h[d+4>>2]|0)-b|0)-y*.5,ne[g+8>>3]=y*.8660254037844386,tx(g,h[d>>2]|0,A,0,m),Y=_}function tx(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;if(y=+sse(d),y<1e-16){A=15888+(A*24|0)|0,h[g>>2]=h[A>>2],h[g+4>>2]=h[A+4>>2],h[g+8>>2]=h[A+8>>2],h[g+12>>2]=h[A+12>>2],h[g+16>>2]=h[A+16>>2],h[g+20>>2]=h[A+20>>2];return}if(b=+ta(+ +ne[d+8>>3],+ +ne[d>>3]),(m|0)>0){d=0;do y=y*.37796447300922725,d=d+1|0;while((d|0)!=(m|0))}E=y*.3333333333333333,_?(m=(Bl(m)|0)==0,y=+Hk(+((m?E:E*.37796447300922725)*.381966011250105))):(y=+Hk(+(y*.381966011250105)),Bl(m)|0&&(b=+ix(b+.3334731722518321))),G=+ix(+ne[16368+(A*24|0)>>3]-b),E=+ne[15888+(A*24|0)>>3],O=+ne[15888+(A*24|0)+8>>3],oe=+ne[15888+(A*24|0)+16>>3],W=-(oe+(E*0+O*0)),I=E*W+0,b=O*W+0,W=oe*W+1,q=+ts(+(W*W+(I*I+b*b))),q=q>0?1/q:0,I=I*q,b=b*q,q=W*q,W=+Qn(+G),G=+Ii(+G),ue=+Qn(+y),$=+Ii(+y),M=ue*E+$*(W*I+G*(oe*b-O*q)),y=ue*O+$*(W*b+G*(E*q-oe*I)),b=ue*oe+$*(W*q+G*(O*I-E*b)),E=+ts(+(b*b+(M*M+y*y))),E=E>0?1/E:0,ne[g>>3]=M*E,ne[g+8>>3]=y*E,ne[g+16>>3]=b*E}function u4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,mi=0,oo=0,Bn=0,gi=0,ia=0,fs=0,zr=0,ds=0,ns=0,Fa=0,Ws=0,js=0,kl=0,ao=0,wi=0,M0=0;if(Fa=Y,Y=Y+256|0,y=Fa+240|0,ci=Fa+224|0,zr=Fa,ds=Fa+208|0,ns=Fa+192|0,mi=Fa+168|0,oo=Fa+152|0,Bn=Fa+136|0,gi=Fa+120|0,ia=Fa+104|0,fs=Fa+80|0,h[y>>2]=A,h[ci>>2]=h[d>>2],h[ci+4>>2]=h[d+4>>2],h[ci+8>>2]=h[d+8>>2],h[ci+12>>2]=h[d+12>>2],s9(ci,y,zr),h[g>>2]=0,ci=_+m+((_|0)==5&1)|0,(ci|0)<=(m|0)){Y=Fa;return}me=h[y>>2]|0,be=ds+4|0,_e=ds+8|0,re=ds+12|0,Fe=ns+8|0,Ke=m+5|0,Ee=16848+(me<<2)|0,ye=mi+8|0,At=16928+(me<<2)|0,We=oo+8|0,Ot=Bn+8|0,at=gi+8|0,dt=ns+8|0,W=mi+8|0,oe=mi+16|0,$=fs+8|0,ue=fs+16|0,q=m,_=0,b=0,E=0,M=0;e:for(;;){G=zr+(((q|0)%5|0)<<4)|0,h[ds>>2]=h[G>>2],h[ds+4>>2]=h[G+4>>2],h[ds+8>>2]=h[G+8>>2],h[ds+12>>2]=h[G+12>>2];do;while((Ym(ds,me,0,1)|0)==2);if((q|0)>(m|0)&(Bl(A)|0)!=0){if(G=h[ds>>2]|0,d=h[be>>2]|0,I=h[_e>>2]|0,y=h[re>>2]|0,Ws=+(E-M|0),ne[ns>>3]=+(b-M|0)-Ws*.5,ne[Fe>>3]=Ws*.8660254037844386,M=h[17008+(G*80|0)+(_<<2)>>2]|0,O=h[18608+(G*80|0)+(M*20|0)>>2]|0,E=h[18608+(G*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=I;do ao=y+d|0,wi=(ao|0)<0,I=_+d-(wi?ao:0)|0,kl=(I|0)<0,js=y+_-(wi?ao:0)-(kl?I:0)|0,y=(js|0)<0,d=(wi?0:ao)-(kl?I:0)-(y?js:0)|0,_=(kl?0:I)-(y?js:0)|0,js=y?0:js,y=(_|0)<(d|0)?_:d,y=(js|0)<(y|0)?js:y,I=(y|0)>0,d=d-(I?y:0)|0,_=_-(I?y:0)|0,y=js-(I?y:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=I;switch(wi=(h[Ee>>2]|0)*3|0,js=(La(wi,h[18608+(G*80|0)+(M*20|0)+4>>2]|0)|0)+d|0,I=(La(wi,h[18608+(G*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,wi=(La(wi,h[18608+(G*80|0)+(M*20|0)+12>>2]|0)|0)+y|0,M=(js|0)<0,I=I-(M?js:0)|0,kl=(I|0)<0,wi=wi+(M?0-js|0:0)+(kl?0-I|0:0)|0,ao=(wi|0)<0,js=(M?0:js)-(kl?I:0)-(ao?wi:0)|0,I=(kl?0:I)-(ao?wi:0)|0,wi=ao?0:wi,ao=(I|0)<(js|0)?I:js,ao=(wi|0)<(ao|0)?wi:ao,kl=(ao|0)>0,wi=wi-(kl?ao:0)|0,Ws=+(I-(kl?ao:0)-wi|0),ne[mi>>3]=+(js-(kl?ao:0)-wi|0)-Ws*.5,ne[ye>>3]=Ws*.8660254037844386,Ws=+(h[At>>2]|0),ne[oo>>3]=Ws*3,ne[We>>3]=0,M0=Ws*-1.5,ne[Bn>>3]=M0,ne[Ot>>3]=Ws*2.598076211353316,ne[gi>>3]=M0,ne[at>>3]=Ws*-2.598076211353316,h[17008+(O*80|0)+(G<<2)>>2]|0){case 1:{d=Bn,_=oo;break}case 3:{d=gi,_=Bn;break}case 2:{d=oo,_=gi;break}default:{d=12;break e}}x9(ns,mi,_,d,ia),tx(ia,O,me,1,fs),wi=h[g>>2]|0,Ws=+J1(+ +ne[ue>>3]),M0=+ta(+ +ne[$>>3],+ +ne[fs>>3]),ne[g+8+(wi<<4)>>3]=Ws,ne[g+8+(wi<<4)+8>>3]=M0,h[g>>2]=(h[g>>2]|0)+1}if((q|0)<(Ke|0)&&(wi=h[re>>2]|0,Ws=+((h[_e>>2]|0)-wi|0),ne[ns>>3]=+((h[be>>2]|0)-wi|0)-Ws*.5,ne[dt>>3]=Ws*.8660254037844386,tx(ns,h[ds>>2]|0,me,1,mi),wi=h[g>>2]|0,Ws=+J1(+ +ne[oe>>3]),M0=+ta(+ +ne[W>>3],+ +ne[mi>>3]),ne[g+8+(wi<<4)>>3]=Ws,ne[g+8+(wi<<4)+8>>3]=M0,h[g>>2]=(h[g>>2]|0)+1),q=q+1|0,(q|0)>=(ci|0)){d=3;break}else _=h[ds>>2]|0,b=h[be>>2]|0,E=h[_e>>2]|0,M=h[re>>2]|0}if((d|0)==3){Y=Fa;return}else(d|0)==12&&li(27073,27120,599,27130)}function s9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;$=Y,Y=Y+128|0,_=$+64|0,g=$,y=_,b=20208,E=y+60|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));y=g,b=20272,E=y+60|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));if(O=(Bl(h[A>>2]|0)|0)==0,O=O?_:g,W=d+4|0,y=h[W>>2]|0,G=d+8|0,_=h[G>>2]|0,q=d+12|0,g=h[q>>2]|0,b=_+(y<<1)|0,h[W>>2]=b,_=g+(_<<1)|0,h[G>>2]=_,y=(g<<1)+y|0,h[q>>2]=y,g=_-b|0,E=y-b|0,(b|0)<0&&(h[G>>2]=g,h[q>>2]=E,h[W>>2]=0,_=g,b=0,y=E),E=b-_|0,g=y-_|0,(_|0)<0?(h[W>>2]=E,h[q>>2]=g,h[G>>2]=0,_=0):(g=y,E=b),b=E-g|0,y=_-g|0,(g|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(g=g-_|0,y=y-_|0,b=b-_|0,h[W>>2]=b,h[G>>2]=y,h[q>>2]=g),M=(y<<1)+b|0,E=g+(b<<1)|0,h[W>>2]=E,h[G>>2]=M,y=(g<<1)+y|0,h[q>>2]=y,_=M-E|0,g=y-E|0,(E|0)<0?(h[G>>2]=_,h[q>>2]=g,h[W>>2]=0,E=0,y=g):_=M,b=E-_|0,g=y-_|0,(_|0)<0?(h[W>>2]=b,h[q>>2]=g,h[G>>2]=0,E=b,_=0):g=y,b=E-g|0,y=_-g|0,(g|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[W>>2]=b-_,h[G>>2]=y-_,h[q>>2]=g-_),Bl(h[A>>2]|0)|0&&(y=h[W>>2]|0,b=h[G>>2]|0,g=h[q>>2]|0,_=(b*3|0)+y|0,y=g+(y*3|0)|0,h[W>>2]=y,h[G>>2]=_,b=(g*3|0)+b|0,h[q>>2]=b,g=_-y|0,E=b-y|0,(y|0)<0?(h[G>>2]=g,h[q>>2]=E,h[W>>2]=0,_=g,M=0):(M=y,E=b),y=M-_|0,g=E-_|0,(_|0)<0?(h[W>>2]=y,h[q>>2]=g,h[G>>2]=0,M=y,b=0):(b=_,g=E),y=M-g|0,_=b-g|0,(g|0)<0?(h[W>>2]=y,h[G>>2]=_,h[q>>2]=0,b=_,g=0):y=M,_=(b|0)<(y|0)?b:y,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[W>>2]=y-_,h[G>>2]=b-_,h[q>>2]=g-_),h[A>>2]=(h[A>>2]|0)+1),h[m>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+4>>2]|0,I=h[O+8>>2]|0,b=(h[O>>2]|0)+(h[W>>2]|0)|0,M=m+4|0,h[M>>2]=b,g=A+g|0,A=m+8|0,h[A>>2]=g,_=I+_|0,I=m+12|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+16>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+16>>2]|0,I=h[O+20>>2]|0,b=(h[O+12>>2]|0)+(h[W>>2]|0)|0,M=m+20|0,h[M>>2]=b,g=A+g|0,A=m+24|0,h[A>>2]=g,_=I+_|0,I=m+28|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+32>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+28>>2]|0,I=h[O+32>>2]|0,b=(h[O+24>>2]|0)+(h[W>>2]|0)|0,M=m+36|0,h[M>>2]=b,g=A+g|0,A=m+40|0,h[A>>2]=g,_=I+_|0,I=m+44|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+48>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+40>>2]|0,I=h[O+44>>2]|0,b=(h[O+36>>2]|0)+(h[W>>2]|0)|0,M=m+52|0,h[M>>2]=b,g=A+g|0,A=m+56|0,h[A>>2]=g,_=I+_|0,I=m+60|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+64>>2]=h[d>>2],y=h[G>>2]|0,_=h[q>>2]|0,I=h[O+52>>2]|0,M=h[O+56>>2]|0,b=(h[O+48>>2]|0)+(h[W>>2]|0)|0,A=m+68|0,h[A>>2]=b,y=I+y|0,I=m+72|0,h[I>>2]=y,_=M+_|0,M=m+76|0,h[M>>2]=_,g=y-b|0,(b|0)<0?(_=_-b|0,h[I>>2]=g,h[M>>2]=_,h[A>>2]=0,y=0):(g=y,y=b),(g|0)<0&&(y=y-g|0,h[A>>2]=y,_=_-g|0,h[M>>2]=_,h[I>>2]=0,g=0),E=y-_|0,b=g-_|0,(_|0)<0?(h[A>>2]=E,h[I>>2]=b,h[M>>2]=0,y=E,_=0):b=g,g=(b|0)<(y|0)?b:y,g=(_|0)<(g|0)?_:g,(g|0)<=0){Y=$;return}h[A>>2]=y-g,h[I>>2]=b-g,h[M>>2]=_-g,Y=$}function Ym(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(q=h[16928+(A<<2)>>2]|0,G=(_|0)!=0,q=G?q*3|0:q,O=d+4|0,E=h[O>>2]|0,I=d+8|0,y=h[I>>2]|0,G){if(b=d+12|0,_=h[b>>2]|0,g=y+E+_|0,(g|0)==(q|0))return q=1,q|0;M=b}else M=d+12|0,g=h[M>>2]|0,_=g,g=y+E+g|0;if((g|0)<=(q|0))return q=0,q|0;do if((_|0)>0){if(g=h[d>>2]|0,(y|0)>0){g=18608+(g*80|0)+60|0,b=E;break}g=18608+(g*80|0)+40|0,m?(b=E-q|0,m=y+b|0,W=(m|0)<0,y=_+y-(W?m:0)|0,E=(y|0)<0,_=_+b-(W?m:0)-(E?y:0)|0,b=(_|0)<0,m=(W?0:m)-(E?y:0)-(b?_:0)|0,y=(E?0:y)-(b?_:0)|0,_=b?0:_,b=(y|0)<(m|0)?y:m,b=(_|0)<(b|0)?_:b,E=(b|0)>0,y=y-(E?b:0)|0,_=_-(E?b:0)|0,b=m-(E?b:0)+q|0,h[O>>2]=b,h[I>>2]=y,h[M>>2]=_):b=E}else g=18608+((h[d>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[d>>2]=h[g>>2],E=h[g+16>>2]|0,(E|0)>0){m=0;do W=_+b|0,$=(W|0)<0,_e=$?W:0,oe=y+b-_e|0,ue=(oe|0)<0,d=ue?oe:0,b=_+y-_e-d|0,y=(b|0)<0,_=y?0:b,b=y?b:0,y=(ue?0:oe)-b|0,b=($?0:W)-d-b|0,d=(y|0)<(b|0)?y:b,d=(_|0)<(d|0)?_:d,(d|0)>0&&(b=b-d|0,y=y-d|0,_=_-d|0),m=m+1|0;while((m|0)<(E|0));h[O>>2]=b,h[I>>2]=y,h[M>>2]=_}return oe=h[16848+(A<<2)>>2]|0,oe=G?oe*3|0:oe,ue=La(oe,h[g+8>>2]|0)|0,_e=La(oe,h[g+12>>2]|0)|0,b=(La(oe,h[g+4>>2]|0)|0)+b|0,h[O>>2]=b,y=ue+y|0,h[I>>2]=y,_=_e+_|0,h[M>>2]=_,g=y-b|0,(b|0)<0?(_=_-b|0,h[I>>2]=g,h[M>>2]=_,h[O>>2]=0,y=0):(g=y,y=b),(g|0)<0?(d=y-g|0,h[O>>2]=d,_=_-g|0,h[M>>2]=_,h[I>>2]=0,b=0):(d=y,b=g),y=d-_|0,g=b-_|0,(_|0)<0?(h[O>>2]=y,h[I>>2]=g,h[M>>2]=0,_=0):(g=b,y=d),b=(g|0)<(y|0)?g:y,b=(_|0)<(b|0)?_:b,(b|0)>0&&(y=y-b|0,g=g-b|0,_=_-b|0,h[O>>2]=y,h[I>>2]=g,h[M>>2]=_),G?(_e=(g+y+_|0)==(q|0)?1:2,_e|0):(_e=2,_e|0)}function xre(d,A){d=d|0,A=A|0;var m=0;do m=Ym(d,A,0,1)|0;while((m|0)==2);return m|0}function h4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,mi=0,oo=0,Bn=0,gi=0,ia=0,fs=0,zr=0,ds=0,ns=0;if(fs=Y,Y=Y+272|0,y=fs+256|0,b=fs+240|0,Bn=fs,gi=fs+224|0,ia=fs+208|0,We=fs+184|0,Ot=fs+168|0,at=fs+152|0,dt=fs+136|0,ci=fs+120|0,mi=fs+96|0,h[y>>2]=A,h[b>>2]=h[d>>2],h[b+4>>2]=h[d+4>>2],h[b+8>>2]=h[d+8>>2],h[b+12>>2]=h[d+12>>2],o9(b,y,Bn),h[g>>2]=0,At=_+m+((_|0)==6&1)|0,(At|0)<=(m|0)){Y=fs;return}_e=h[y>>2]|0,re=m+6|0,be=ia+8|0,me=We+8|0,Fe=16928+(_e<<2)|0,Ke=Ot+8|0,Ee=at+8|0,ye=dt+8|0,oe=h[b>>2]|0,q=gi+4|0,W=gi+8|0,$=gi+12|0,ue=ia+8|0,M=We+8|0,O=We+16|0,I=mi+8|0,G=mi+16|0,b=0,E=m,_=-1;e:for(;;){if(y=(E|0)%6|0,d=Bn+(y<<4)|0,h[gi>>2]=h[d>>2],h[gi+4>>2]=h[d+4>>2],h[gi+8>>2]=h[d+8>>2],h[gi+12>>2]=h[d+12>>2],d=b,b=Ym(gi,_e,0,1)|0,(E|0)>(m|0)&(Bl(A)|0)!=0&&(oo=h[gi>>2]|0,(d|0)!=1&(oo|0)!=(_|0))){switch(ns=(y+5|0)%6|0,d=h[Bn+(ns<<4)+12>>2]|0,zr=+((h[Bn+(ns<<4)+8>>2]|0)-d|0),ne[ia>>3]=+((h[Bn+(ns<<4)+4>>2]|0)-d|0)-zr*.5,ne[be>>3]=zr*.8660254037844386,d=h[Bn+(y<<4)+12>>2]|0,zr=+((h[Bn+(y<<4)+8>>2]|0)-d|0),ne[We>>3]=+((h[Bn+(y<<4)+4>>2]|0)-d|0)-zr*.5,ne[me>>3]=zr*.8660254037844386,zr=+(h[Fe>>2]|0),ne[Ot>>3]=zr*3,ne[Ke>>3]=0,ds=zr*-1.5,ne[at>>3]=ds,ne[Ee>>3]=zr*2.598076211353316,ne[dt>>3]=ds,ne[ye>>3]=zr*-2.598076211353316,h[17008+(oe*80|0)+(((_|0)==(oe|0)?oo:_)<<2)>>2]|0){case 1:{d=at,_=Ot;break}case 3:{d=dt,_=at;break}case 2:{d=Ot,_=dt;break}default:{d=8;break e}}x9(ia,We,_,d,ci),!(y9(ia,ci)|0)&&!(y9(We,ci)|0)&&(tx(ci,oe,_e,1,mi),ns=h[g>>2]|0,zr=+J1(+ +ne[G>>3]),ds=+ta(+ +ne[I>>3],+ +ne[mi>>3]),ne[g+8+(ns<<4)>>3]=zr,ne[g+8+(ns<<4)+8>>3]=ds,h[g>>2]=(h[g>>2]|0)+1)}if((E|0)<(re|0)&&(ns=h[$>>2]|0,zr=+((h[W>>2]|0)-ns|0),ne[ia>>3]=+((h[q>>2]|0)-ns|0)-zr*.5,ne[ue>>3]=zr*.8660254037844386,tx(ia,h[gi>>2]|0,_e,1,We),ns=h[g>>2]|0,zr=+J1(+ +ne[O>>3]),ds=+ta(+ +ne[M>>3],+ +ne[We>>3]),ne[g+8+(ns<<4)>>3]=zr,ne[g+8+(ns<<4)+8>>3]=ds,h[g>>2]=(h[g>>2]|0)+1),E=E+1|0,(E|0)>=(At|0)){d=3;break}else _=h[gi>>2]|0}if((d|0)==3){Y=fs;return}else(d|0)==8&&li(27157,27120,766,27202)}function o9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;oe=Y,Y=Y+160|0,_=oe+80|0,g=oe,y=_,b=20336,E=y+72|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));y=g,b=20416,E=y+72|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));G=(Bl(h[A>>2]|0)|0)==0,G=G?_:g,$=d+4|0,y=h[$>>2]|0,q=d+8|0,_=h[q>>2]|0,W=d+12|0,g=h[W>>2]|0,b=_+(y<<1)|0,h[$>>2]=b,_=g+(_<<1)|0,h[q>>2]=_,y=(g<<1)+y|0,h[W>>2]=y,g=_-b|0,E=y-b|0,(b|0)<0&&(h[q>>2]=g,h[W>>2]=E,h[$>>2]=0,_=g,b=0,y=E),E=b-_|0,g=y-_|0,(_|0)<0?(h[$>>2]=E,h[W>>2]=g,h[q>>2]=0,_=0):(g=y,E=b),b=E-g|0,y=_-g|0,(g|0)<0?(h[$>>2]=b,h[q>>2]=y,h[W>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(g=g-_|0,y=y-_|0,b=b-_|0,h[$>>2]=b,h[q>>2]=y,h[W>>2]=g),M=(y<<1)+b|0,E=g+(b<<1)|0,h[$>>2]=E,h[q>>2]=M,y=(g<<1)+y|0,h[W>>2]=y,_=M-E|0,g=y-E|0,(E|0)<0?(h[q>>2]=_,h[W>>2]=g,h[$>>2]=0,E=0,y=g):_=M,b=E-_|0,g=y-_|0,(_|0)<0?(h[$>>2]=b,h[W>>2]=g,h[q>>2]=0,E=b,_=0):g=y,b=E-g|0,y=_-g|0,(g|0)<0?(h[$>>2]=b,h[q>>2]=y,h[W>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[$>>2]=b-_,h[q>>2]=y-_,h[W>>2]=g-_),Bl(h[A>>2]|0)|0&&(y=h[$>>2]|0,b=h[q>>2]|0,g=h[W>>2]|0,_=(b*3|0)+y|0,y=g+(y*3|0)|0,h[$>>2]=y,h[q>>2]=_,b=(g*3|0)+b|0,h[W>>2]=b,g=_-y|0,E=b-y|0,(y|0)<0?(h[q>>2]=g,h[W>>2]=E,h[$>>2]=0,_=g,M=0):(M=y,E=b),y=M-_|0,g=E-_|0,(_|0)<0?(h[$>>2]=y,h[W>>2]=g,h[q>>2]=0,M=y,b=0):(b=_,g=E),y=M-g|0,_=b-g|0,(g|0)<0?(h[$>>2]=y,h[q>>2]=_,h[W>>2]=0,b=_,g=0):y=M,_=(b|0)<(y|0)?b:y,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[$>>2]=y-_,h[q>>2]=b-_,h[W>>2]=g-_),h[A>>2]=(h[A>>2]|0)+1),M=0;do h[m+(M<<4)>>2]=h[d>>2],g=h[q>>2]|0,_=h[W>>2]|0,I=h[G+(M*12|0)+4>>2]|0,O=h[G+(M*12|0)+8>>2]|0,b=(h[G+(M*12|0)>>2]|0)+(h[$>>2]|0)|0,A=m+(M<<4)+4|0,h[A>>2]=b,g=I+g|0,I=m+(M<<4)+8|0,h[I>>2]=g,_=O+_|0,O=m+(M<<4)+12|0,h[O>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[I>>2]=y,h[O>>2]=_,h[A>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[A>>2]=b,_=_-g|0,h[O>>2]=_,h[I>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[A>>2]=E,h[I>>2]=y,h[O>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[A>>2]=b-g,h[I>>2]=y-g,h[O>>2]=_-g),M=M+1|0;while((M|0)!=6);Y=oe}function f4(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&15|0}function a9(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,45)|0,Q()|0,A&127|0}function yre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(m+-1|0)>>>0>14?(_=4,_|0):(m=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,h[_>>2]=m&7,_=0,_|0)}function vre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;if(d>>>0>15)return _=4,_|0;if(A>>>0>121)return _=17,_|0;b=ht(d|0,0,52)|0,g=Q()|0,E=ht(A|0,0,45)|0,g=g|(Q()|0)|134225919;e:do if((d|0)>=1){for(E=1,b=(He[20496+A>>0]|0)!=0,y=-1;;){if(A=h[m+(E+-1<<2)>>2]|0,A>>>0>6){g=18,A=10;break}if(!((A|0)==0|b^1))if((A|0)==1){g=19,A=10;break}else b=0;if(I=(15-E|0)*3|0,M=ht(7,0,I|0)|0,g=g&~(Q()|0),A=ht(A|0,((A|0)<0)<<31>>31|0,I|0)|0,y=A|y&~M,g=Q()|0|g,(E|0)<(d|0))E=E+1|0;else break e}if((A|0)==10)return g|0}else y=-1;while(!1);return I=_,h[I>>2]=y,h[I+4>>2]=g,I=0,I|0}function Vb(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;return!(!0&(A&-16777216|0)==134217728)||(_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0,m=m&127,m>>>0>121)?(d=0,d|0):(b=(_^15)*3|0,g=et(d|0,A|0,b|0)|0,b=ht(g|0,Q()|0,b|0)|0,g=Q()|0,y=Ns(-1227133514,-1171,b|0,g|0)|0,!((b&613566756&y|0)==0&(g&4681&(Q()|0)|0)==0)||(b=(_*3|0)+19|0,y=ht(~d|0,~A|0,b|0)|0,b=et(y|0,Q()|0,b|0)|0,!((_|0)==15|(b|0)==0&(Q()|0)==0))?(b=0,b|0):!(He[20496+m>>0]|0)||(A=A&8191,(d|0)==0&(A|0)==0)?(b=1,b|0):(b=C4(d|0,A|0,0)|0,Q()|0,((63-b|0)%3|0|0)!=0|0))}function bre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;return!0&(A&-16777216|0)==134217728&&(_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0,m=m&127,m>>>0<=121)&&(b=(_^15)*3|0,g=et(d|0,A|0,b|0)|0,b=ht(g|0,Q()|0,b|0)|0,g=Q()|0,y=Ns(-1227133514,-1171,b|0,g|0)|0,(b&613566756&y|0)==0&(g&4681&(Q()|0)|0)==0)&&(b=(_*3|0)+19|0,y=ht(~d|0,~A|0,b|0)|0,b=et(y|0,Q()|0,b|0)|0,(_|0)==15|(b|0)==0&(Q()|0)==0)&&(!(He[20496+m>>0]|0)||(m=A&8191,(d|0)==0&(m|0)==0)||(b=C4(d|0,m|0,0)|0,Q()|0,(63-b|0)%3|0|0))||i9(d,A)|0?(b=1,b|0):(b=(v9(d,A)|0)!=0&1,b|0)}function d4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0;if(g=ht(A|0,0,52)|0,y=Q()|0,m=ht(m|0,0,45)|0,m=y|(Q()|0)|134225919,(A|0)<1){y=-1,_=m,A=d,h[A>>2]=y,d=d+4|0,h[d>>2]=_;return}for(y=1,g=-1;b=(15-y|0)*3|0,E=ht(7,0,b|0)|0,m=m&~(Q()|0),b=ht(_|0,0,b|0)|0,g=g&~E|b,m=m|(Q()|0),(y|0)!=(A|0);)y=y+1|0;E=d,b=E,h[b>>2]=g,E=E+4|0,h[E>>2]=m}function p4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,m>>>0>15)return _=4,_|0;if((y|0)<(m|0))return _=12,_|0;if((y|0)==(m|0))return h[_>>2]=d,h[_+4>>2]=A,_=0,_|0;if(g=ht(m|0,0,52)|0,g=g|d,d=Q()|0|A&-15728641,(y|0)>(m|0))do A=ht(7,0,(14-m|0)*3|0)|0,m=m+1|0,g=A|g,d=Q()|0|d;while((m|0)<(y|0));return h[_>>2]=g,h[_+4>>2]=d,_=0,_|0}function nx(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,!((m|0)<16&(y|0)<=(m|0)))return _=4,_|0;g=m-y|0,m=et(d|0,A|0,45)|0,Q()|0;e:do if(!(or(m&127)|0))m=nd(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;else{t:do if(y|0){for(m=1;b=ht(7,0,(15-m|0)*3|0)|0,!!((b&d|0)==0&((Q()|0)&A|0)==0);)if(m>>>0<y>>>0)m=m+1|0;else break t;m=nd(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;break e}while(!1);m=nd(7,0,g,((g|0)<0)<<31>>31)|0,m=lr(m|0,Q()|0,5,0)|0,m=pt(m|0,Q()|0,-5,-1)|0,m=id(m|0,Q()|0,6,0)|0,m=pt(m|0,Q()|0,1,0)|0,g=Q()|0}while(!1);return b=_,h[b>>2]=m,h[b+4>>2]=g,b=0,b|0}function Ui(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;if(g=et(d|0,A|0,45)|0,Q()|0,!(or(g&127)|0))return g=0,g|0;g=et(d|0,A|0,52)|0,Q()|0,g=g&15;e:do if(!g)m=0;else for(_=1;;){if(m=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,m=m&7,m|0)break e;if(_>>>0<g>>>0)_=_+1|0;else{m=0;break}}while(!1);return g=(m|0)==0&1,g|0}function wre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0;if(b=Y,Y=Y+16|0,y=b,y4(y,d,A,m),A=y,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0)return Y=b,0;g=0,m=0;do E=_+(g<<3)|0,h[E>>2]=d,h[E+4>>2]=A,g=pt(g|0,m|0,1,0)|0,m=Q()|0,v4(y),E=y,d=h[E>>2]|0,A=h[E+4>>2]|0;while(!((d|0)==0&(A|0)==0));return Y=b,0}function l9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(_|0)<(m|0)?(m=A,_=d,Ln(m|0),_|0):(m=ht(-1,-1,((_-m|0)*3|0)+3|0)|0,_=ht(~m|0,~(Q()|0)|0,(15-_|0)*3|0)|0,m=~(Q()|0)&A,_=~_&d,Ln(m|0),_|0)}function c9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0;return g=et(d|0,A|0,52)|0,Q()|0,g=g&15,(m|0)<16&(g|0)<=(m|0)?((g|0)<(m|0)&&(g=ht(-1,-1,((m+-1-g|0)*3|0)+3|0)|0,g=ht(~g|0,~(Q()|0)|0,(15-m|0)*3|0)|0,A=~(Q()|0)&A,d=~g&d),g=ht(m|0,0,52)|0,m=A&-15728641|(Q()|0),h[_>>2]=d|g,h[_+4>>2]=m,_=0,_|0):(_=4,_|0)}function Sre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0;if((m|0)==0&(_|0)==0)return dt=0,dt|0;if(g=d,y=h[g>>2]|0,g=h[g+4>>2]|0,!0&(g&15728640|0)==0){if(!((_|0)>0|(_|0)==0&m>>>0>0)||(dt=A,h[dt>>2]=y,h[dt+4>>2]=g,(m|0)==1&(_|0)==0))return dt=0,dt|0;g=1,y=0;do Ot=d+(g<<3)|0,at=h[Ot+4>>2]|0,dt=A+(g<<3)|0,h[dt>>2]=h[Ot>>2],h[dt+4>>2]=at,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(_|0)|(y|0)==(_|0)&g>>>0<m>>>0);return g=0,g|0}if(We=m<<3,at=ar(We)|0,!at)return dt=13,dt|0;if(_c(at|0,d|0,We|0)|0,Ot=na(m,8)|0,!Ot)return _t(at),dt=13,dt|0;e:for(;;){g=at,I=h[g>>2]|0,g=h[g+4>>2]|0,ye=et(I|0,g|0,52)|0,Q()|0,ye=ye&15,At=ye+-1|0,Ee=(ye|0)!=0,Ke=(_|0)>0|(_|0)==0&m>>>0>0;t:do if(Ee&Ke){if(re=ht(At|0,0,52)|0,be=Q()|0,At>>>0>15){if(!((I|0)==0&(g|0)==0)){dt=16;break e}for(y=0,d=0;;){if(y=pt(y|0,d|0,1,0)|0,d=Q()|0,!((d|0)<(_|0)|(d|0)==(_|0)&y>>>0<m>>>0))break t;if(b=at+(y<<3)|0,Fe=h[b>>2]|0,b=h[b+4>>2]|0,!((Fe|0)==0&(b|0)==0)){g=b,dt=16;break e}}}for(E=I,d=g,y=0,b=0;;){if(!((E|0)==0&(d|0)==0)){if(!(!0&(d&117440512|0)==0)){dt=21;break e}if(O=et(E|0,d|0,52)|0,Q()|0,O=O&15,(O|0)<(At|0)){g=12,dt=27;break e}if((O|0)!=(At|0)&&(E=E|re,d=d&-15728641|be,O>>>0>=ye>>>0)){M=At;do Fe=ht(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Fe|E,d=Q()|0|d;while(M>>>0<O>>>0)}if(q=Xh(E|0,d|0,m|0,_|0)|0,W=Q()|0,M=Ot+(q<<3)|0,O=M,G=h[O>>2]|0,O=h[O+4>>2]|0,!((G|0)==0&(O|0)==0)){ue=0,_e=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&_e>>>0>m>>>0){dt=31;break e}if((G|0)==(E|0)&(O&-117440513|0)==(d|0)){$=et(G|0,O|0,56)|0,Q()|0,$=$&7,oe=$+1|0,Fe=et(G|0,O|0,45)|0,Q()|0;n:do if(!(or(Fe&127)|0))O=7;else{if(G=et(G|0,O|0,52)|0,Q()|0,G=G&15,!G){O=6;break}for(O=1;;){if(Fe=ht(7,0,(15-O|0)*3|0)|0,!((Fe&E|0)==0&((Q()|0)&d|0)==0)){O=7;break n}if(O>>>0<G>>>0)O=O+1|0;else{O=6;break}}}while(!1);if(($+2|0)>>>0>O>>>0){dt=41;break e}Fe=ht(oe|0,0,56)|0,d=Q()|0|d&-117440513,me=M,h[me>>2]=0,h[me+4>>2]=0,E=Fe|E}else q=pt(q|0,W|0,1,0)|0,q=rd(q|0,Q()|0,m|0,_|0)|0,W=Q()|0;_e=pt(_e|0,ue|0,1,0)|0,ue=Q()|0,M=Ot+(q<<3)|0,O=M,G=h[O>>2]|0,O=h[O+4>>2]|0}while(!((G|0)==0&(O|0)==0))}Fe=M,h[Fe>>2]=E,h[Fe+4>>2]=d}if(y=pt(y|0,b|0,1,0)|0,b=Q()|0,!((b|0)<(_|0)|(b|0)==(_|0)&y>>>0<m>>>0))break t;d=at+(y<<3)|0,E=h[d>>2]|0,d=h[d+4>>2]|0}}while(!1);if(Fe=pt(m|0,_|0,5,0)|0,me=Q()|0,me>>>0<0|(me|0)==0&Fe>>>0<11){dt=85;break}if(Fe=id(m|0,_|0,6,0)|0,Q()|0,Fe=na(Fe,8)|0,!Fe){dt=48;break}do if(Ke){for(oe=0,d=0,$=0,ue=0;;){if(O=Ot+(oe<<3)|0,b=O,y=h[b>>2]|0,b=h[b+4>>2]|0,(y|0)==0&(b|0)==0)me=$;else{G=et(y|0,b|0,56)|0,Q()|0,G=G&7,E=G+1|0,q=b&-117440513,me=et(y|0,b|0,45)|0,Q()|0;t:do if(or(me&127)|0){if(W=et(y|0,b|0,52)|0,Q()|0,W=W&15,W|0)for(M=1;;){if(me=ht(7,0,(15-M|0)*3|0)|0,!((y&me|0)==0&(q&(Q()|0)|0)==0))break t;if(M>>>0<W>>>0)M=M+1|0;else break}b=ht(E|0,0,56)|0,y=b|y,b=Q()|0|q,E=O,h[E>>2]=y,h[E+4>>2]=b,E=G+2|0}while(!1);(E|0)==7?(me=Fe+(d<<3)|0,h[me>>2]=y,h[me+4>>2]=b&-117440513,d=pt(d|0,$|0,1,0)|0,me=Q()|0):me=$}if(oe=pt(oe|0,ue|0,1,0)|0,ue=Q()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&oe>>>0<m>>>0)$=me;else break}if(Ke){if(_e=At>>>0>15,re=ht(At|0,0,52)|0,be=Q()|0,!Ee){for(y=0,M=0,E=0,b=0;(I|0)==0&(g|0)==0||(At=A+(y<<3)|0,h[At>>2]=I,h[At+4>>2]=g,y=pt(y|0,M|0,1,0)|0,M=Q()|0),E=pt(E|0,b|0,1,0)|0,b=Q()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<m>>>0);)g=at+(E<<3)|0,I=h[g>>2]|0,g=h[g+4>>2]|0;g=me;break}for(y=0,M=0,b=0,E=0;;){do if(!((I|0)==0&(g|0)==0)){if(W=et(I|0,g|0,52)|0,Q()|0,W=W&15,_e|(W|0)<(At|0)){dt=80;break e}if((W|0)!=(At|0)){if(O=I|re,G=g&-15728641|be,W>>>0>=ye>>>0){q=At;do Ee=ht(7,0,(14-q|0)*3|0)|0,q=q+1|0,O=Ee|O,G=Q()|0|G;while(q>>>0<W>>>0)}}else O=I,G=g;$=Xh(O|0,G|0,m|0,_|0)|0,q=0,W=0,ue=Q()|0;do{if((q|0)>(_|0)|(q|0)==(_|0)&W>>>0>m>>>0){dt=81;break e}if(Ee=Ot+($<<3)|0,oe=h[Ee+4>>2]|0,(oe&-117440513|0)==(G|0)&&(h[Ee>>2]|0)==(O|0)){dt=65;break}Ee=pt($|0,ue|0,1,0)|0,$=rd(Ee|0,Q()|0,m|0,_|0)|0,ue=Q()|0,W=pt(W|0,q|0,1,0)|0,q=Q()|0,Ee=Ot+($<<3)|0}while(!((h[Ee>>2]|0)==(O|0)&&(h[Ee+4>>2]|0)==(G|0)));if((dt|0)==65&&(dt=0,!0&(oe&117440512|0)==100663296))break;Ee=A+(y<<3)|0,h[Ee>>2]=I,h[Ee+4>>2]=g,y=pt(y|0,M|0,1,0)|0,M=Q()|0}while(!1);if(b=pt(b|0,E|0,1,0)|0,E=Q()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<m>>>0))break;g=at+(b<<3)|0,I=h[g>>2]|0,g=h[g+4>>2]|0}g=me}else y=0,g=me}else y=0,d=0,g=0;while(!1);if(sd(Ot|0,0,We|0)|0,_c(at|0,Fe|0,d<<3|0)|0,_t(Fe),(d|0)==0&(g|0)==0){dt=89;break}else A=A+(y<<3)|0,_=g,m=d}if((dt|0)==16)!0&(g&117440512|0)==0?(g=4,dt=27):dt=21;else if((dt|0)==31)li(27634,27225,620,27235);else{if((dt|0)==41)return _t(at),_t(Ot),dt=10,dt|0;if((dt|0)==48)return _t(at),_t(Ot),dt=13,dt|0;(dt|0)==80?li(27634,27225,711,27235):(dt|0)==81?li(27634,27225,723,27235):(dt|0)==85&&(_c(A|0,at|0,m<<3|0)|0,dt=89)}return(dt|0)==21?(_t(at),_t(Ot),dt=5,dt|0):(dt|0)==27?(_t(at),_t(Ot),dt=g,dt|0):(dt|0)==89?(_t(at),_t(Ot),dt=0,dt|0):0}function Tre(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(oe=Y,Y=Y+16|0,$=oe,!((m|0)>0|(m|0)==0&A>>>0>0))return $=0,Y=oe,$|0;if((b|0)>=16)return $=12,Y=oe,$|0;q=0,W=0,G=0,E=0;e:for(;;){if(I=d+(q<<3)|0,M=h[I>>2]|0,I=h[I+4>>2]|0,O=et(M|0,I|0,52)|0,Q()|0,(O&15|0)>(b|0)){E=12,M=11;break}if(y4($,M,I,b),O=$,I=h[O>>2]|0,O=h[O+4>>2]|0,(I|0)==0&(O|0)==0)M=G;else{M=G;do{if(!((E|0)<(y|0)|(E|0)==(y|0)&M>>>0<g>>>0)){M=10;break e}G=_+(M<<3)|0,h[G>>2]=I,h[G+4>>2]=O,M=pt(M|0,E|0,1,0)|0,E=Q()|0,v4($),G=$,I=h[G>>2]|0,O=h[G+4>>2]|0}while(!((I|0)==0&(O|0)==0))}if(q=pt(q|0,W|0,1,0)|0,W=Q()|0,(W|0)<(m|0)|(W|0)==(m|0)&q>>>0<A>>>0)G=M;else{E=0,M=11;break}}return(M|0)==10?($=14,Y=oe,$|0):(M|0)==11?(Y=oe,E|0):0}function Ere(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;q=Y,Y=Y+16|0,G=q;e:do if((m|0)>0|(m|0)==0&A>>>0>0){for(I=0,b=0,y=0,O=0;;){if(M=d+(I<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=(nx(E,M,_,G)|0)==0,E=G,b=pt(h[E>>2]|0,h[E+4>>2]|0,b|0,y|0)|0,y=Q()|0,!M)){y=12;break}if(I=pt(I|0,O|0,1,0)|0,O=Q()|0,!((O|0)<(m|0)|(O|0)==(m|0)&I>>>0<A>>>0))break e}return Y=q,y|0}else b=0,y=0;while(!1);return h[g>>2]=b,h[g+4>>2]=y,g=0,Y=q,g|0}function Mre(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&1|0}function Da(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,!g)return g=0,g|0;for(_=1;;){if(m=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,m=m&7,m|0){_=5;break}if(_>>>0<g>>>0)_=_+1|0;else{m=0,_=5;break}}return(_|0)==5?m|0:0}function A4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Ln(I|0),O|0;for(I=1,m=0;;){switch(_=(15-I|0)*3|0,E=ht(7,0,_|0)|0,M=Q()|0,y=d&~E,b=A&~M,d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=d&7}_=ht(d|0,0,_|0)|0,g=Q()|0,d=_|y,A=g|b;e:do if(!m)if((_&E|0)==0&(g&M|0)==0)m=0;else if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)m=1;else{m=1;t:for(;;){switch(M=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,M&7){case 1:break t;case 0:break;default:{m=1;break e}}if(m>>>0<b>>>0)m=m+1|0;else{m=1;break e}}for(y=1;;){switch(g=(15-y|0)*3|0,m=et(d|0,A|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,_=d&~_,A=A&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,d=d|_,A=Q()|0|A,y>>>0<b>>>0)y=y+1|0;else{m=1;break e}}}while(!1);if(I>>>0<O>>>0)I=I+1|0;else break}return Ln(A|0),d|0}function T0(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)return y=A,b=d,Ln(y|0),b|0;for(y=1;;){switch(g=(15-y|0)*3|0,m=et(d|0,A|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,_=d&~_,A=A&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,d=d|_,A=Q()|0|A,y>>>0<b>>>0)y=y+1|0;else break}return Ln(A|0),d|0}function Cre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Ln(I|0),O|0;for(I=1,m=0;;){switch(_=(15-I|0)*3|0,E=ht(7,0,_|0)|0,M=Q()|0,y=d&~E,b=A&~M,d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}_=ht(d|0,0,_|0)|0,g=Q()|0,d=_|y,A=g|b;e:do if(!m)if((_&E|0)==0&(g&M|0)==0)m=0;else if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)m=1;else{m=1;t:for(;;){switch(M=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,M&7){case 1:break t;case 0:break;default:{m=1;break e}}if(m>>>0<b>>>0)m=m+1|0;else{m=1;break e}}for(y=1;;){switch(m=(15-y|0)*3|0,_=ht(7,0,m|0)|0,_=d&~_,g=A&~(Q()|0),d=et(d|0,A|0,m|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(d=ht(d|0,0,m|0)|0,d=d|_,A=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else{m=1;break e}}}while(!1);if(I>>>0<O>>>0)I=I+1|0;else break}return Ln(A|0),d|0}function m4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)return y=A,b=d,Ln(y|0),b|0;for(y=1;;){switch(_=(15-y|0)*3|0,m=ht(7,0,_|0)|0,m=d&~m,g=A&~(Q()|0),d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(d=ht(d|0,0,_|0)|0,d=d|m,A=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else break}return Ln(A|0),d|0}function Rre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0;if(me=Y,Y=Y+16|0,be=me,ht(A|0,0,52)|0,m=Q()|0|134225919,!A)return(h[d+4>>2]|0)>2||(h[d+8>>2]|0)>2||(h[d+12>>2]|0)>2?(re=0,be=0,Ln(re|0),Y=me,be|0):(ht(Zk(d)|0,0,45)|0,re=Q()|0|m,be=-1,Ln(re|0),Y=me,be|0);h[be>>2]=h[d>>2],h[be+4>>2]=h[d+4>>2],h[be+8>>2]=h[d+8>>2],h[be+12>>2]=h[d+12>>2],re=be+4|0;e:do if((A|0)>0)for(oe=be+8|0,ue=be+12|0,$=A,G=h[oe>>2]|0,q=h[ue>>2]|0,A=-1,O=h[be+4>>2]|0;;){W=$,$=$+-1|0,d=O-q|0,_=G-q|0,W&1?(y=du(+((d*3|0)-_|0)*.14285714285714285)|0,h[re>>2]=y,d=du(+((_<<1)+d|0)*.14285714285714285)|0,h[oe>>2]=d,h[ue>>2]=0,_=d-y|0,g=0-y|0,(y|0)<0?(h[oe>>2]=_,h[ue>>2]=g,h[re>>2]=0,d=_,b=0):(b=y,g=0),y=b-d|0,_=g-d|0,(d|0)<0?(h[re>>2]=y,h[ue>>2]=_,h[oe>>2]=0,b=y,y=0):(_=g,y=d),d=b-_|0,g=y-_|0,(_|0)<0?(h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=0,y=0):(g=y,d=b,y=_),_=(g|0)<(d|0)?g:d,_=(y|0)<(_|0)?y:_,(_|0)>0&&(y=y-_|0,g=g-_|0,d=d-_|0,h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=y),Ke=g+(d*3|0)|0,Fe=(Ke|0)<0,I=y+(g*3|0)-(Fe?Ke:0)|0,M=(I|0)<0,_=(y*3|0)+d-(Fe?Ke:0)-(M?I:0)|0,E=(_|0)<0,Ee=E?0:_,b=(M?0:I)-(E?_:0)|0,_=(Fe?0:Ke)-(M?I:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Ee|0)<(E|0)?Ee:E,I=(E|0)>0,M=I?E:0,b=b-(I?E:0)|0,E=Ee-(I?E:0)|0,I=y):(E=du(+((d<<1)+_|0)*.14285714285714285)|0,h[re>>2]=E,g=du(+((_*3|0)-d|0)*.14285714285714285)|0,h[oe>>2]=g,h[ue>>2]=0,_=g-E|0,d=0-E|0,(E|0)<0?(h[oe>>2]=_,h[ue>>2]=d,h[re>>2]=0,g=_,E=0):d=0,b=E-g|0,_=d-g|0,(g|0)<0?(h[re>>2]=b,h[ue>>2]=_,h[oe>>2]=0,y=_,g=0):(y=d,b=E),d=b-y|0,_=g-y|0,(y|0)<0?(h[re>>2]=d,h[oe>>2]=_,h[ue>>2]=0,g=_,y=0):d=b,_=(g|0)<(d|0)?g:d,_=(y|0)<(_|0)?y:_,(_|0)>0&&(y=y-_|0,g=g-_|0,d=d-_|0,h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=y),Ke=y+(d*3|0)|0,Ee=(Ke|0)<0,I=(g*3|0)+d-(Ee?Ke:0)|0,M=(I|0)<0,_=(y*3|0)+g-(Ee?Ke:0)-(M?I:0)|0,E=(_|0)<0,Fe=E?0:_,b=(M?0:I)-(E?_:0)|0,_=(Ee?0:Ke)-(M?I:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Fe|0)<(E|0)?Fe:E,I=(E|0)>0,M=I?E:0,b=b-(I?E:0)|0,E=Fe-(I?E:0)|0,I=y),_=O+(M-_)|0,y=(_|0)<0,M=G-b-(y?_:0)|0,b=(M|0)<0,q=q-E+(y?0-_|0:0)+(b?0-M|0:0)|0,O=(q|0)<0,E=O?0:q,Ee=(b?0:M)-(O?q:0)|0,q=(y?0:_)-(b?M:0)-(O?q:0)|0,O=(Ee|0)<(q|0)?Ee:q,O=(E|0)<(O|0)?E:O,M=(O|0)>0,q=q-(M?O:0)|0,b=(15-W|0)*3|0,_=ht(7,0,b|0)|0,_=A&~_,y=m&~(Q()|0),G=(q|0)<0,Ke=G?q:0,Ee=Ee-(M?O:0)-Ke|0,Fe=(Ee|0)<0,Ke=(Fe?0-Ee|0:0)+(E-(M?O:0)-Ke)|0,m=(Ke|0)<0,A=m?0:Ke,Ke=m?Ke:0,m=(Fe?0:Ee)-Ke|0,Ke=(G?0:q)-(Fe?Ee:0)-Ke|0,Ee=(m|0)<(Ke|0)?m:Ke,Ee=(A|0)<(Ee|0)?A:Ee,Ee=(Ee|0)>0?Ee:0,A=A-Ee|0,m=m-Ee|0;t:do switch(Ke-Ee|0){case 0:switch(m|0){case 0:{A=(A|0)==0?0:(A|0)==1?1:7;break t}case 1:{A=(A|0)==0?2:(A|0)==1?3:7;break t}default:{_e=36;break t}}case 1:switch(m|0){case 0:{A=(A|0)==0?4:(A|0)==1?5:7;break t}case 1:if(A){_e=36;break t}else{A=6;break t}default:{_e=36;break t}}default:_e=36}while(!1);if((_e|0)==36&&(_e=0,A=7),A=ht(A|0,0,b|0)|0,A=A|_,m=Q()|0|y,(W|0)<=1)break e;G=g,q=I,O=d}else A=-1,d=h[re>>2]|0;while(!1);e:do if((d|0)<=2&&(h[be+8>>2]|0)<=2&&(h[be+12>>2]|0)<=2){if(_=Zk(be)|0,d=ht(_|0,0,45)|0,A=d|A,d=Q()|0|m&-1040385,M=Zie(be)|0,!(or(_)|0)){if((M|0)<=0)break;for(E=0;;){b=et(A|0,d|0,52)|0,Q()|0,b=b&15;t:do if(b)for(y=1;;){switch(g=(15-y|0)*3|0,m=et(A|0,d|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,A=A&~_,_=d&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,A=d|A,d=Q()|0|_,y>>>0<b>>>0)y=y+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=et(A|0,d|0,52)|0,Q()|0,b=b&15;t:do if(b){m=1;n:for(;;){switch(Ee=et(A|0,d|0,(15-m|0)*3|0)|0,Q()|0,Ee&7){case 1:break n;case 0:break;default:break t}if(m>>>0<b>>>0)m=m+1|0;else break t}if(Qk(_,h[be>>2]|0)|0)for(y=1;;){switch(m=(15-y|0)*3|0,_=ht(7,0,m|0)|0,_=A&~_,g=d&~(Q()|0),d=et(A|0,d|0,m|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(A=ht(d|0,0,m|0)|0,A=A|_,d=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else break t}else for(y=1;;){switch(g=(15-y|0)*3|0,m=et(A|0,d|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,A=A&~_,_=d&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,A=d|A,d=Q()|0|_,y>>>0<b>>>0)y=y+1|0;else break t}}while(!1);if((M|0)>0){m=0;do A=A4(A,d)|0,d=Q()|0,m=m+1|0;while((m|0)!=(M|0))}}else A=0,d=0;while(!1);return Ke=d,Ee=A,Ln(Ke|0),Y=me,Ee|0}function Bl(d){return d=d|0,(d|0)%2|0|0}function g4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(O=Y,Y=Y+64|0,E=O+24|0,M=O+48|0,I=O,A>>>0>15)return I=4,Y=O,I|0;if(y=+ne[d>>3],ne[Xi>>3]=y,(h[Xi+4>>2]&2146435072|0)==2146435072||(_=+ne[d+8>>3],ne[Xi>>3]=_,(h[Xi+4>>2]&2146435072|0)==2146435072))return I=3,Y=O,I|0;g=+Qn(+y),G=g*+Qn(+_),g=g*+Ii(+_),_=+Ii(+y),ne[I>>3]=G,ne[I+8>>3]=g,ne[I+16>>3]=_,ne[Xi>>3]=G;do if((h[Xi+4>>2]&2146435072|0)!=2146435072&&(ne[Xi>>3]=_,d=h[Xi+4>>2]|0,ne[Xi>>3]=g,!((h[Xi+4>>2]&2146435072|0)==2146435072|!0&(d&2146435072|0)==2146435072)))if(h[E>>2]=h[I>>2],h[E+4>>2]=h[I+4>>2],h[E+8>>2]=h[I+8>>2],h[E+12>>2]=h[I+12>>2],h[E+16>>2]=h[I+16>>2],h[E+20>>2]=h[I+20>>2],gre(E,A,M),M=Rre(M,A)|0,I=Q()|0,h[m>>2]=M,h[m+4>>2]=I,(M|0)==0&(I|0)==0)li(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return I=b,Y=O,I|0}function _4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(W=m+4|0,$=et(d|0,A|0,52)|0,Q()|0,$=$&15,q=et(d|0,A|0,45)|0,Q()|0,_=($|0)==0,or(q&127)|0){if(_)return $=1,$|0;_=1}else{if(_)return $=0,$|0;(h[W>>2]|0)==0&&(h[m+8>>2]|0)==0?_=(h[m+12>>2]|0)!=0&1:_=1}for(q=m+8|0,G=m+12|0,O=1,m=h[W>>2]|0,b=h[q>>2]|0,y=h[G>>2]|0;g=m*3|0,E=b*3|0,I=y*3|0,O&1?(M=b+g|0,h[W>>2]=M,y=y+E|0,h[q>>2]=y,g=I+m|0,h[G>>2]=g,m=y-M|0,b=g-M|0,(M|0)<0?(h[q>>2]=m,h[G>>2]=b,h[W>>2]=0,E=0,g=b):(m=y,E=M),b=E-m|0,y=g-m|0,(m|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,E=b,g=0):(y=g,g=m),m=E-y|0,b=g-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=b,h[G>>2]=0,y=0):(b=g,m=E),g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)):(M=E+m|0,E=y+g|0,h[W>>2]=E,h[q>>2]=M,g=I+b|0,h[G>>2]=g,m=M-E|0,y=g-E|0,(E|0)<0?(h[q>>2]=m,h[G>>2]=y,h[W>>2]=0,E=0,g=y):m=M,b=E-m|0,y=g-m|0,(m|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,E=b,g=0):(y=g,g=m),m=E-y|0,b=g-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=b,h[G>>2]=0,y=0):(b=g,m=E),g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)),g=et(d|0,A|0,(15-O|0)*3|0)|0,Q()|0,g=g&7,(g+-1|0)>>>0<6&&(M=h[22032+(g*12|0)+4>>2]|0,I=h[22032+(g*12|0)+8>>2]|0,E=(h[22032+(g*12|0)>>2]|0)+m|0,h[W>>2]=E,b=M+b|0,h[q>>2]=b,m=I+y|0,h[G>>2]=m,y=b-E|0,g=m-E|0,(E|0)<0&&(h[q>>2]=y,h[G>>2]=g,h[W>>2]=0,E=0,m=g,b=y),g=E-b|0,y=m-b|0,(b|0)<0?(h[W>>2]=g,h[G>>2]=y,h[q>>2]=0,E=g,b=0):y=m,m=E-y|0,g=b-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=g,h[G>>2]=0,b=g,y=0):m=E,g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)),O>>>0<$>>>0;)O=O+1|0;return _|0}function Km(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if($=Y,Y=Y+16|0,G=$,q=et(d|0,A|0,45)|0,Q()|0,q=q&127,q>>>0>121)return h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,W=5,Y=$,W|0;e:do if((or(q)|0)!=0&&(E=et(d|0,A|0,52)|0,Q()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(W=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,W&7){case 5:break t;case 0:break;default:{I=A;break e}}if(_>>>0<E>>>0)_=_+1|0;else{I=A;break e}}for(b=1,_=A;;){switch(A=(15-b|0)*3|0,g=ht(7,0,A|0)|0,g=d&~g,y=_&~(Q()|0),_=et(d|0,_|0,A|0)|0,Q()|0,_&7){case 1:{_=3;break}case 3:{_=2;break}case 2:{_=6;break}case 6:{_=4;break}case 4:{_=5;break}case 5:{_=1;break}default:_=_&7}if(d=ht(_|0,0,A|0)|0,d=d|g,_=Q()|0|y,b>>>0<E>>>0)b=b+1|0;else{I=_;break e}}}else I=A;while(!1);if(W=7696+(q*28|0)|0,h[m>>2]=h[W>>2],h[m+4>>2]=h[W+4>>2],h[m+8>>2]=h[W+8>>2],h[m+12>>2]=h[W+12>>2],!(_4(d,I,m)|0))return W=0,Y=$,W|0;if(W=m+4|0,h[G>>2]=h[W>>2],h[G+4>>2]=h[W+4>>2],h[G+8>>2]=h[W+8>>2],M=et(d|0,I|0,52)|0,Q()|0,O=M&15,M&1?(y=h[W>>2]|0,E=m+8|0,g=h[E>>2]|0,M=m+12|0,A=h[M>>2]|0,_=(g*3|0)+y|0,y=A+(y*3|0)|0,h[W>>2]=y,h[E>>2]=_,g=(A*3|0)+g|0,h[M>>2]=g,A=_-y|0,b=g-y|0,(y|0)<0&&(h[E>>2]=A,h[M>>2]=b,h[W>>2]=0,_=A,y=0,g=b),b=y-_|0,A=g-_|0,(_|0)<0?(h[W>>2]=b,h[M>>2]=A,h[E>>2]=0,_=0):(A=g,b=y),y=b-A|0,g=_-A|0,(A|0)<0?(h[W>>2]=y,h[E>>2]=g,h[M>>2]=0,A=0):(g=_,y=b),_=(g|0)<(y|0)?g:y,_=(A|0)<(_|0)?A:_,(_|0)>0&&(h[W>>2]=y-_,h[E>>2]=g-_,h[M>>2]=A-_),g=O+1|0):g=O,!(or(q)|0))_=0;else{e:do if(!O)_=0;else for(A=1;;){if(_=et(d|0,I|0,(15-A|0)*3|0)|0,Q()|0,_=_&7,_|0)break e;if(A>>>0<O>>>0)A=A+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(Ym(m,g,_,0)|0))(g|0)!=(O|0)&&(h[W>>2]=h[G>>2],h[W+4>>2]=h[G+4>>2],h[W+8>>2]=h[G+8>>2]);else{if(or(q)|0)do;while((Ym(m,g,0,0)|0)!=0);(g|0)!=(O|0)&&(E=m+12|0,d=h[E>>2]|0,_=(h[W>>2]|0)-d|0,b=m+8|0,d=(h[b>>2]|0)-d|0,A=du(+((_<<1)+d|0)*.14285714285714285)|0,h[W>>2]=A,_=du(+((d*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,d=_-A|0,g=0-A|0,(A|0)<0?(h[b>>2]=d,h[E>>2]=g,h[W>>2]=0,_=d,A=0):g=0,y=A-_|0,d=g-_|0,(_|0)<0?(h[W>>2]=y,h[E>>2]=d,h[b>>2]=0,A=y,_=0):d=g,y=A-d|0,g=_-d|0,(d|0)<0?(h[W>>2]=y,h[b>>2]=g,h[E>>2]=0,A=y,d=0):g=_,_=(g|0)<(A|0)?g:A,_=(d|0)<(_|0)?d:_,(_|0)>0&&(h[W>>2]=A-_,h[b>>2]=g-_,h[E>>2]=d-_))}return W=0,Y=$,W|0}function Zm(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0;return b=Y,Y=Y+48|0,_=b+24|0,g=b,y=Km(d,A,_)|0,y?(Y=b,y|0):(y=et(d|0,A|0,52)|0,Q()|0,_re(_,y&15,g),M=+J1(+ +ne[g+16>>3]),E=+ta(+ +ne[g+8>>3],+ +ne[g>>3]),ne[m>>3]=M,ne[m+8>>3]=E,y=0,Y=b,y|0)}function E0(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0;if(b=Y,Y=Y+16|0,y=b,_=Km(d,A,y)|0,_|0)return y=_,Y=b,y|0;_=et(d|0,A|0,45)|0,Q()|0,_=(or(_&127)|0)==0,g=et(d|0,A|0,52)|0,Q()|0,g=g&15;e:do if(!_){if(g|0)for(_=1;;){if(E=ht(7,0,(15-_|0)*3|0)|0,!((E&d|0)==0&((Q()|0)&A|0)==0))break e;if(_>>>0<g>>>0)_=_+1|0;else break}return u4(y,g,0,5,m),E=0,Y=b,E|0}while(!1);return h4(y,g,0,6,m),E=0,Y=b,E|0}function Pre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(g=et(d|0,A|0,45)|0,Q()|0,!(or(g&127)|0))return g=2,h[m>>2]=g,0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,!g)return g=5,h[m>>2]=g,0;for(_=1;;){if(y=ht(7,0,(15-_|0)*3|0)|0,!((y&d|0)==0&((Q()|0)&A|0)==0)){_=2,d=6;break}if(_>>>0<g>>>0)_=_+1|0;else{_=5,d=6;break}}return(d|0)==6&&(h[m>>2]=_),0}function u9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+128|0,I=G+112|0,y=G+96|0,O=G,g=et(d|0,A|0,52)|0,Q()|0,E=g&15,h[I>>2]=E,b=et(d|0,A|0,45)|0,Q()|0,b=b&127;e:do if(or(b)|0){if(E|0)for(_=1;;){if(M=ht(7,0,(15-_|0)*3|0)|0,!((M&d|0)==0&((Q()|0)&A|0)==0)){g=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(g&1)g=1;else return M=ht(E+1|0,0,52)|0,O=Q()|0|A&-15728641,I=ht(7,0,(14-E|0)*3|0)|0,O=u9((M|d)&~I,O&~(Q()|0),m)|0,Y=G,O|0}else g=0;while(!1);if(_=Km(d,A,y)|0,!_){g?(s9(y,I,O),M=5):(o9(y,I,O),M=6);e:do if(or(b)|0)if(!E)d=5;else for(_=1;;){if(b=ht(7,0,(15-_|0)*3|0)|0,!((b&d|0)==0&((Q()|0)&A|0)==0)){d=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{d=5;break}}else d=2;while(!1);sd(m|0,-1,d<<2|0)|0;e:do if(g)for(y=0;;){if(b=O+(y<<4)|0,xre(b,h[I>>2]|0)|0,b=h[b>>2]|0,E=h[m>>2]|0,(E|0)==-1|(E|0)==(b|0))_=m;else{g=0;do{if(g=g+1|0,g>>>0>=d>>>0){_=1;break e}_=m+(g<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,y=y+1|0,y>>>0>=M>>>0){_=0;break}}else for(y=0;;){if(b=O+(y<<4)|0,Ym(b,h[I>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[m>>2]|0,(E|0)==-1|(E|0)==(b|0))_=m;else{g=0;do{if(g=g+1|0,g>>>0>=d>>>0){_=1;break e}_=m+(g<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,y=y+1|0,y>>>0>=M>>>0){_=0;break}}while(!1)}return O=_,Y=G,O|0}function Ire(){return 12}function x4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0;if(d>>>0>15)return E=4,E|0;if(ht(d|0,0,52)|0,E=Q()|0|134225919,!d){m=0,_=0;do or(_)|0&&(ht(_|0,0,45)|0,b=E|(Q()|0),d=A+(m<<3)|0,h[d>>2]=-1,h[d+4>>2]=b,m=m+1|0),_=_+1|0;while((_|0)!=122);return m=0,m|0}m=0,b=0;do{if(or(b)|0){for(ht(b|0,0,45)|0,_=1,g=-1,y=E|(Q()|0);M=ht(7,0,(15-_|0)*3|0)|0,g=g&~M,y=y&~(Q()|0),(_|0)!=(d|0);)_=_+1|0;M=A+(m<<3)|0,h[M>>2]=g,h[M+4>>2]=y,m=m+1|0}b=b+1|0}while((b|0)!=122);return m=0,m|0}function Nre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if(re=Y,Y=Y+16|0,ue=re,_e=et(d|0,A|0,52)|0,Q()|0,_e=_e&15,m>>>0>15)return _e=4,Y=re,_e|0;if((_e|0)<(m|0))return _e=12,Y=re,_e|0;if((_e|0)!=(m|0))if(y=ht(m|0,0,52)|0,y=y|d,E=Q()|0|A&-15728641,(_e|0)>(m|0)){M=m;do oe=ht(7,0,(14-M|0)*3|0)|0,M=M+1|0,y=oe|y,E=Q()|0|E;while((M|0)<(_e|0));oe=y}else oe=y;else oe=d,E=A;$=et(oe|0,E|0,45)|0,Q()|0;e:do if(or($&127)|0){if(M=et(oe|0,E|0,52)|0,Q()|0,M=M&15,M|0)for(y=1;;){if($=ht(7,0,(15-y|0)*3|0)|0,!(($&oe|0)==0&((Q()|0)&E|0)==0)){I=33;break e}if(y>>>0<M>>>0)y=y+1|0;else break}if($=_,h[$>>2]=0,h[$+4>>2]=0,(_e|0)>(m|0)){for($=A&-15728641,W=_e;;){if(q=W,W=W+-1|0,W>>>0>15|(_e|0)<(W|0)){I=19;break}if((_e|0)!=(W|0))if(y=ht(W|0,0,52)|0,y=y|d,M=Q()|0|$,(_e|0)<(q|0))G=y;else{I=W;do G=ht(7,0,(14-I|0)*3|0)|0,I=I+1|0,y=G|y,M=Q()|0|M;while((I|0)<(_e|0));G=y}else G=d,M=A;if(O=et(G|0,M|0,45)|0,Q()|0,!(or(O&127)|0))y=0;else{O=et(G|0,M|0,52)|0,Q()|0,O=O&15;t:do if(!O)y=0;else for(I=1;;){if(y=et(G|0,M|0,(15-I|0)*3|0)|0,Q()|0,y=y&7,y|0)break t;if(I>>>0<O>>>0)I=I+1|0;else{y=0;break}}while(!1);y=(y|0)==0&1}if(M=et(d|0,A|0,(15-q|0)*3|0)|0,Q()|0,M=M&7,(M|0)==7){g=5,I=42;break}if(y=(y|0)!=0,(M|0)==1&y){g=5,I=42;break}if(G=M+(((M|0)!=0&y)<<31>>31)|0,G|0&&(I=_e-q|0,I=nd(7,0,I,((I|0)<0)<<31>>31)|0,O=Q()|0,y?(y=lr(I|0,O|0,5,0)|0,y=pt(y|0,Q()|0,-5,-1)|0,y=id(y|0,Q()|0,6,0)|0,y=pt(y|0,Q()|0,1,0)|0,M=Q()|0):(y=I,M=O),q=G+-1|0,q=lr(I|0,O|0,q|0,((q|0)<0)<<31>>31|0)|0,q=pt(y|0,M|0,q|0,Q()|0)|0,G=Q()|0,O=_,O=pt(q|0,G|0,h[O>>2]|0,h[O+4>>2]|0)|0,G=Q()|0,q=_,h[q>>2]=O,h[q+4>>2]=G),(W|0)<=(m|0)){I=37;break}}if((I|0)==19)li(27634,27225,1407,27259);else if((I|0)==37){b=_,g=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((I|0)==42)return Y=re,g|0}else g=0,b=0}else I=33;while(!1);e:do if((I|0)==33)if($=_,h[$>>2]=0,h[$+4>>2]=0,(_e|0)>(m|0)){for(y=_e;;){if(g=et(d|0,A|0,(15-y|0)*3|0)|0,Q()|0,g=g&7,(g|0)==7){g=5;break}if(b=_e-y|0,b=nd(7,0,b,((b|0)<0)<<31>>31)|0,g=lr(b|0,Q()|0,g|0,0)|0,b=Q()|0,$=_,b=pt(h[$>>2]|0,h[$+4>>2]|0,g|0,b|0)|0,g=Q()|0,$=_,h[$>>2]=b,h[$+4>>2]=g,y=y+-1|0,(y|0)<=(m|0))break e}return Y=re,g|0}else g=0,b=0;while(!1);return nx(oe,E,_e,ue)|0&&li(27634,27225,1367,27274),_e=ue,ue=h[_e+4>>2]|0,((g|0)>-1|(g|0)==-1&b>>>0>4294967295)&((ue|0)>(g|0)|((ue|0)==(g|0)?(h[_e>>2]|0)>>>0>b>>>0:0))?(_e=0,Y=re,_e|0):(li(27634,27225,1447,27259),0)}function Lre(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(G=Y,Y=Y+16|0,b=G,g>>>0>15)return y=4,Y=G,y|0;if(E=et(m|0,_|0,52)|0,Q()|0,E=E&15,(E|0)>(g|0))return y=12,Y=G,y|0;if(nx(m,_,g,b)|0&&li(27634,27225,1367,27274),O=b,I=h[O+4>>2]|0,!(((A|0)>-1|(A|0)==-1&d>>>0>4294967295)&((I|0)>(A|0)|((I|0)==(A|0)?(h[O>>2]|0)>>>0>d>>>0:0))))return y=2,Y=G,y|0;O=g-E|0,g=ht(g|0,0,52)|0,M=Q()|0|_&-15728641,I=y,h[I>>2]=g|m,h[I+4>>2]=M,I=et(m|0,_|0,45)|0,Q()|0;e:do if(or(I&127)|0){if(E|0)for(b=1;;){if(I=ht(7,0,(15-b|0)*3|0)|0,!((I&m|0)==0&((Q()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((O|0)<1)return y=0,Y=G,y|0;for(I=E^15,_=-1,M=1,b=1;;){E=O-M|0,E=nd(7,0,E,((E|0)<0)<<31>>31)|0,m=Q()|0;do if(b)if(b=lr(E|0,m|0,5,0)|0,b=pt(b|0,Q()|0,-5,-1)|0,b=id(b|0,Q()|0,6,0)|0,g=Q()|0,(A|0)>(g|0)|(A|0)==(g|0)&d>>>0>b>>>0){A=pt(d|0,A|0,-1,-1)|0,A=Ns(A|0,Q()|0,b|0,g|0)|0,b=Q()|0,q=y,$=h[q>>2]|0,q=h[q+4>>2]|0,oe=(I+_|0)*3|0,W=ht(7,0,oe|0)|0,q=q&~(Q()|0),_=id(A|0,b|0,E|0,m|0)|0,d=Q()|0,g=pt(_|0,d|0,2,0)|0,oe=ht(g|0,Q()|0,oe|0)|0,q=Q()|0|q,g=y,h[g>>2]=oe|$&~W,h[g+4>>2]=q,d=lr(_|0,d|0,E|0,m|0)|0,d=Ns(A|0,b|0,d|0,Q()|0)|0,b=0,A=Q()|0;break}else{oe=y,W=h[oe>>2]|0,oe=h[oe+4>>2]|0,$=ht(7,0,(I+_|0)*3|0)|0,oe=oe&~(Q()|0),b=y,h[b>>2]=W&~$,h[b+4>>2]=oe,b=1;break}else W=y,g=h[W>>2]|0,W=h[W+4>>2]|0,_=(I+_|0)*3|0,q=ht(7,0,_|0)|0,W=W&~(Q()|0),oe=id(d|0,A|0,E|0,m|0)|0,b=Q()|0,_=ht(oe|0,b|0,_|0)|0,W=Q()|0|W,$=y,h[$>>2]=_|g&~q,h[$+4>>2]=W,b=lr(oe|0,b|0,E|0,m|0)|0,d=Ns(d|0,A|0,b|0,Q()|0)|0,b=0,A=Q()|0;while(!1);if((O|0)>(M|0))_=~M,M=M+1|0;else{A=0;break}}return Y=G,A|0}while(!1);if((O|0)<1)return oe=0,Y=G,oe|0;for(g=E^15,b=1;;)if($=O-b|0,$=nd(7,0,$,(($|0)<0)<<31>>31)|0,oe=Q()|0,M=y,m=h[M>>2]|0,M=h[M+4>>2]|0,E=(g-b|0)*3|0,_=ht(7,0,E|0)|0,M=M&~(Q()|0),q=id(d|0,A|0,$|0,oe|0)|0,W=Q()|0,E=ht(q|0,W|0,E|0)|0,M=Q()|0|M,I=y,h[I>>2]=E|m&~_,h[I+4>>2]=M,oe=lr(q|0,W|0,$|0,oe|0)|0,d=Ns(d|0,A|0,oe|0,Q()|0)|0,A=Q()|0,(O|0)<=(b|0)){A=0;break}else b=b+1|0;return Y=G,A|0}function y4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;g=et(A|0,m|0,52)|0,Q()|0,g=g&15,(A|0)==0&(m|0)==0|((_|0)>15|(g|0)>(_|0))?(y=-1,A=-1,m=0,g=0):(A=l9(A,m,g+1|0,_)|0,b=(Q()|0)&-15728641,m=ht(_|0,0,52)|0,m=A|m,b=b|(Q()|0),A=(Ui(m,b)|0)==0,y=g,A=A?-1:_,g=b),b=d,h[b>>2]=m,h[b+4>>2]=g,h[d+8>>2]=y,h[d+12>>2]=A}function h9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,y=_+8|0,h[y>>2]=g,(d|0)==0&(A|0)==0|((m|0)>15|(g|0)>(m|0))){m=_,h[m>>2]=0,h[m+4>>2]=0,h[y>>2]=-1,h[_+12>>2]=-1;return}if(d=l9(d,A,g+1|0,m)|0,y=(Q()|0)&-15728641,g=ht(m|0,0,52)|0,g=d|g,y=y|(Q()|0),d=_,h[d>>2]=g,h[d+4>>2]=y,d=_+12|0,Ui(g,y)|0){h[d>>2]=m;return}else{h[d>>2]=-1;return}}function v4(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0;if(m=d,A=h[m>>2]|0,m=h[m+4>>2]|0,!((A|0)==0&(m|0)==0)&&(_=et(A|0,m|0,52)|0,Q()|0,_=_&15,E=ht(1,0,(_^15)*3|0)|0,A=pt(E|0,Q()|0,A|0,m|0)|0,m=Q()|0,E=d,h[E>>2]=A,h[E+4>>2]=m,E=d+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=d+12|0,y=_;;){if((y|0)==(b|0)){_=5;break}if(I=(y|0)==(h[M>>2]|0),g=(15-y|0)*3|0,_=et(A|0,m|0,g|0)|0,Q()|0,_=_&7,I&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(I=ht(1,0,g|0)|0,A=pt(A|0,m|0,I|0,Q()|0)|0,m=Q()|0,I=d,h[I>>2]=A,h[I+4>>2]=m,(y|0)>(b|0))y=y+-1|0;else{_=10;break}}if((_|0)==5){I=d,h[I>>2]=0,h[I+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ht(1,0,g|0)|0,b=pt(A|0,m|0,b|0,Q()|0)|0,E=Q()|0,I=d,h[I>>2]=b,h[I+4>>2]=E,h[M>>2]=y+-1;return}else if((_|0)==10)return}}function ix(d){d=+d;var A=0;return A=d<0?d+6.283185307179586:d,+(d>=6.283185307179586?A+-6.283185307179586:A)}function ol(d,A){switch(d=+d,A=A|0,A|0){case 1:{d=d<0?d+6.283185307179586:d;break}case 2:{d=d>0?d+-6.283185307179586:d;break}default:}return+d}function Dre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ta(+ +ts(+m),+ +ts(+(1-m)))*2)}function rx(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ta(+ +ts(+m),+ +ts(+(1-m)))*2*6371.007180918475)}function Fre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ta(+ +ts(+m),+ +ts(+(1-m)))*2*6371.007180918475*1e3)}function f9(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20624+(d<<3)>>3],A=0,A|0)}function Ore(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20752+(d<<3)>>3],A=0,A|0)}function Bre(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20880+(d<<3)>>3],A=0,A|0)}function Ure(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[21008+(d<<3)>>3],A=0,A|0)}function qb(d,A){d=d|0,A=A|0;var m=0;return d>>>0>15?(A=4,A|0):(m=nd(7,0,d,((d|0)<0)<<31>>31)|0,m=lr(m|0,Q()|0,120,0)|0,d=Q()|0,h[A>>2]=m|2,h[A+4>>2]=d,A=0,A|0)}function kre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ex(d,A,b)|0,d|0)return b=d,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+_)*+Qn(+I)*M),y=y+ +ta(+ +ts(+M),+ +ts(+(1-M)))*2;while((d|0)<(A|0));return ne[m>>3]=y,b=0,Y=E,b|0}function Gre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ex(d,A,b)|0,d|0)return b=d,y=+ne[m>>3],y=y*6371.007180918475,ne[m>>3]=y,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,y=0,y=y*6371.007180918475,ne[m>>3]=y,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +ta(+ +ts(+M),+ +ts(+(1-M)))*2;while((d|0)!=(A|0));return ne[m>>3]=y,b=0,O=y,O=O*6371.007180918475,ne[m>>3]=O,Y=E,b|0}function zre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ex(d,A,b)|0,d|0)return b=d,y=+ne[m>>3],y=y*6371.007180918475,y=y*1e3,ne[m>>3]=y,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,y=0,y=y*6371.007180918475,y=y*1e3,ne[m>>3]=y,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +ta(+ +ts(+M),+ +ts(+(1-M)))*2;while((d|0)!=(A|0));return ne[m>>3]=y,b=0,O=y,O=O*6371.007180918475,O=O*1e3,ne[m>>3]=O,Y=E,b|0}function Vre(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0;if(d)for(y=d+4|0,b=d+8|0,_=1,g=d;;){if(A=h[g>>2]|0,A|0)do{if(m=h[A>>2]|0,m|0)do E=m,m=h[m+16>>2]|0,_t(E);while((m|0)!=0);E=A,A=h[A+8>>2]|0,_t(E)}while((A|0)!=0);if(A=g,g=h[g+8>>2]|0,_?(h[d>>2]=0,h[y>>2]=0,h[b>>2]=0):_t(A),g)_=0;else break}}function qre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(h[A>>2]=0,ue=A+4|0,h[ue>>2]=0,_e=A+8|0,h[_e>>2]=0,oe=h[d>>2]|0,(oe|0)<=0)return A=0,A|0;$=d+4|0,d=A,W=0;e:for(;;){if(W){if(m=na(1,12)|0,!m){m=5;break}h[d+8>>2]=m,d=m}if(M=h[$>>2]|0,I=na(1,12)|0,!I){d=13,m=37;break}if(q=d+4|0,_=h[q>>2]|0,h[((_|0)==0?d:_+8|0)>>2]=I,h[q>>2]=I,_=h[M+(W<<4)>>2]|0,(_|0)<3){d=1,m=37;break}g=M+(W<<4)+4|0,y=I+4|0,m=0,b=0;do{if(E=b,b=ar(24)|0,!b){d=13,m=37;break e}R4(b|0,(h[g>>2]|0)+(m<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[I>>2]=b,h[y>>2]=b,m=m+1|0}while((m|0)<(_|0));if(G=h[M+(W<<4)+8>>2]|0,(G|0)>0){O=M+(W<<4)+12|0,M=0;do{if(_=h[O>>2]|0,m=I,I=na(1,12)|0,!I){d=13,m=37;break e}if(h[m+8>>2]=I,h[q>>2]=I,E=h[_+(M<<3)>>2]|0,(E|0)<3){d=1,m=37;break e}_=_+(M<<3)+4|0,g=I+4|0,m=0,y=0;do{if(b=y,y=ar(24)|0,!y){d=13,m=37;break e}R4(y|0,(h[_>>2]|0)+(m<<4)|0,16)|0,h[y+16>>2]=0,b?h[b+16>>2]=y:h[I>>2]=y,h[g>>2]=y,m=m+1|0}while((m|0)<(E|0));M=M+1|0}while((M|0)<(G|0))}if(W=W+1|0,(W|0)>=(oe|0)){d=0,m=50;break}}if((m|0)==5){if(!A)return A=13,A|0;for(_=1,g=A;;){if(d=h[g>>2]|0,d|0)do{if(m=h[d>>2]|0,m|0)do oe=m,m=h[m+16>>2]|0,_t(oe);while((m|0)!=0);oe=d,d=h[d+8>>2]|0,_t(oe)}while((d|0)!=0);if(d=g,g=h[g+8>>2]|0,_?(h[A>>2]=0,h[ue>>2]=0,h[_e>>2]=0):_t(d),g)_=0;else{d=13;break}}return d|0}else if((m|0)==37){if(!A)return A=d,A|0;for(g=1,y=A;;){if(m=h[y>>2]|0,m|0)do{if(_=h[m>>2]|0,_|0)do oe=_,_=h[_+16>>2]|0,_t(oe);while((_|0)!=0);oe=m,m=h[m+8>>2]|0,_t(oe)}while((m|0)!=0);if(m=y,y=h[y+8>>2]|0,g?(h[A>>2]=0,h[ue>>2]=0,h[_e>>2]=0):_t(m),y)g=0;else break}return d|0}else if((m|0)==50)return d|0;return 0}function sx(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if(_e=Y,Y=Y+16|0,ue=_e,O=et(d|0,A|0,52)|0,Q()|0,O=O&15,W=et(m|0,_|0,52)|0,Q()|0,(O|0)!=(W&15|0))return ue=12,Y=_e,ue|0;if(M=et(d|0,A|0,45)|0,Q()|0,M=M&127,I=et(m|0,_|0,45)|0,Q()|0,I=I&127,M>>>0>121|I>>>0>121)return ue=5,Y=_e,ue|0;if(W=(M|0)!=(I|0),W){if(b=a4(M,I)|0,(b|0)==7)return ue=1,Y=_e,ue|0;E=a4(I,M)|0,(E|0)==7?li(27291,27315,164,27325):(oe=b,y=E)}else oe=0,y=0;G=or(M)|0,q=or(I)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(oe){I=h[4272+(M*28|0)+(oe<<2)>>2]|0,b=(I|0)>0;e:do if(q)if(b)for(M=0,E=m,b=_;;){switch(E=Cre(E,b)|0,b=Q()|0,y|0){case 5:case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}default:}if(M=M+1|0,(M|0)==(I|0)){I=y,M=E,E=b;break e}}else I=y,M=m,E=_;else if(b)for(M=0,E=m,b=_;;){switch(E=m4(E,b)|0,b=Q()|0,y|0){case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}case 5:{y=1;break}default:}if(M=M+1|0,(M|0)==(I|0)){I=y,M=E,E=b;break e}}else I=y,M=m,E=_;while(!1);if(_4(M,E,ue)|0,W||li(27340,27315,194,27325),b=(G|0)!=0,y=(q|0)!=0,b&y&&li(27367,27315,195,27325),b){if(y=Da(d,A)|0,(y|0)==7){y=5;break}if(He[21968+(y*7|0)+oe>>0]|0){y=1;break}q=h[21136+(y*28|0)+(oe<<2)>>2]|0,W=q}else if(y){if(y=Da(M,E)|0,(y|0)==7){y=5;break}if(He[21968+(y*7|0)+I>>0]|0){y=1;break}W=0,q=h[21136+(I*28|0)+(y<<2)>>2]|0}else W=0,q=0;if((W|q|0)>=0){if((q|0)>0){m=ue+4|0,_=ue+8|0,G=ue+12|0,I=0,E=h[m>>2]|0,b=h[_>>2]|0,y=h[G>>2]|0;do $=b+E|0,A=($|0)<0,re=A?$:0,b=y+b-re|0,d=(b|0)<0,M=d?b:0,E=y+E-re-M|0,re=(E|0)<0,y=re?0:E,E=re?E:0,b=(d?0:b)-E|0,E=(A?0:$)-M-E|0,M=(b|0)<(E|0)?b:E,M=(y|0)<(M|0)?y:M,(M|0)>0&&(E=E-M|0,b=b-M|0,y=y-M|0),I=I+1|0;while((I|0)!=(q|0));h[m>>2]=E,h[_>>2]=b,h[G>>2]=y}if((oe+-1|0)>>>0<6?(y=h[22032+(oe*12|0)>>2]|0,E=h[22032+(oe*12|0)+4>>2]|0,re=h[22032+(oe*12|0)+8>>2]|0,b=(E|0)<(y|0)?E:y,b=(re|0)<(b|0)?re:b,b=(b|0)>0?b:0,y=y-b|0,E=E-b|0,b=re-b|0):(y=0,E=0,b=0),O)for(;;)if(M=y*3|0,I=E*3|0,m=b*3|0,Bl(O)|0?(A=M+E|0,d=(A|0)<0,re=I+b-(d?A:0)|0,$=(re|0)<0,E=y+m-(d?A:0)-($?re:0)|0,b=(E|0)<0,oe=b?0:E,M=($?0:re)-(b?E:0)|0,E=(d?0:A)-($?re:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(oe|0)<(b|0)?oe:b,re=(b|0)>0,y=re?b:0,M=M-(re?b:0)|0,b=oe-(re?b:0)|0):($=M+b|0,A=($|0)<0,re=I+y-(A?$:0)|0,y=(re|0)<0,E=m+E-(A?$:0)-(y?re:0)|0,b=(E|0)<0,oe=b?0:E,M=(y?0:re)-(b?E:0)|0,E=(A?0:$)-(y?re:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(oe|0)<(b|0)?oe:b,re=(b|0)>0,y=re?b:0,M=M-(re?b:0)|0,b=oe-(re?b:0)|0),y=E-y|0,(O|0)>1)O=O+-1|0,E=M;else{E=M;break}if((W|0)>0){M=0;do A=y+E|0,d=(A|0)<0,re=E+b-(d?A:0)|0,$=(re|0)<0,oe=y+b-(d?A:0)-($?re:0)|0,y=(oe|0)<0,b=y?0:oe,E=($?0:re)-(y?oe:0)|0,oe=(d?0:A)-($?re:0)-(y?oe:0)|0,y=(E|0)<(oe|0)?E:oe,y=(b|0)<(y|0)?b:y,re=(y|0)>0,b=b-(re?y:0)|0,E=E-(re?y:0)|0,y=oe-(re?y:0)|0,M=M+1|0;while((M|0)!=(W|0))}m=ue+4|0,O=ue+8|0,oe=h[O>>2]|0,_=ue+12|0,re=h[_>>2]|0,M=(h[m>>2]|0)+y|0,h[m>>2]=M,E=oe+E|0,h[O>>2]=E,y=re+b|0,h[_>>2]=y,b=E-M|0,(M|0)<0?(y=y-M|0,h[O>>2]=b,h[_>>2]=y,h[m>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[m>>2]=E,y=y-b|0,h[_>>2]=y,h[O>>2]=0,b=0),I=E-y|0,M=b-y|0,(y|0)<0?(h[m>>2]=I,h[O>>2]=M,h[_>>2]=0,E=I,y=0):M=b,b=(M|0)<(E|0)?M:E,b=(y|0)<(b|0)?y:b,(b|0)>0&&(h[m>>2]=E-b,h[O>>2]=M-b,h[_>>2]=y-b),$=77}else y=5}else if(_4(m,_,ue)|0,(G|0)!=0&(q|0)!=0)if((I|0)!=(M|0)&&li(27398,27315,264,27325),b=Da(d,A)|0,y=Da(m,_)|0,(b|0)==7|(y|0)==7)y=5;else if(He[21968+(b*7|0)+y>>0]|0)y=1;else if(m=h[21136+(b*28|0)+(y<<2)>>2]|0,(m|0)>0){O=ue+4|0,_=ue+8|0,G=ue+12|0,I=0,E=h[O>>2]|0,b=h[_>>2]|0,y=h[G>>2]|0;do oe=b+E|0,$=(oe|0)<0,d=$?oe:0,b=y+b-d|0,A=(b|0)<0,M=A?b:0,E=y+E-d-M|0,d=(E|0)<0,y=d?0:E,E=d?E:0,b=(A?0:b)-E|0,E=($?0:oe)-M-E|0,M=(b|0)<(E|0)?b:E,M=(y|0)<(M|0)?y:M,(M|0)>0&&(E=E-M|0,b=b-M|0,y=y-M|0),I=I+1|0;while((I|0)!=(m|0));h[O>>2]=E,h[_>>2]=b,h[G>>2]=y,$=77}else $=77;else $=77;while(!1);return($|0)==77&&(y=ue+4|0,h[g>>2]=h[y>>2],h[g+4>>2]=h[y+4>>2],h[g+8>>2]=h[y+8>>2],y=0),re=y,Y=_e,re|0}function d9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,me=et(d|0,A|0,45)|0,Q()|0,me=me&127,me>>>0>121)return _=5,_|0;if(ue=or(me)|0,ht(y|0,0,52)|0,E=Q()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[m>>2]|0,E=h[m+4>>2]|0,m=h[m+8>>2]|0,!y){A=(b|0)<0,_e=A?b:0,be=E-_e|0,ue=(be|0)<0,_e=(ue?0-be|0:0)+(m-_e)|0,m=(_e|0)<0,g=m?0:_e,_e=m?_e:0,m=(ue?0:be)-_e|0,_e=(A?0:b)-(ue?be:0)-_e|0,be=(m|0)<(_e|0)?m:_e,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,m=m-be|0;e:do switch(_e-be|0){case 0:switch(m|0){case 0:if(g){g=(g|0)==1?1:7,re=11;break e}else{g=0;break e}case 1:if(g){g=(g|0)==1?3:7,re=11;break e}else{g=2;break e}default:return _=1,_|0}case 1:switch(m|0){case 0:if(g){g=(g|0)==1?5:7,re=11;break e}else{g=4;break e}case 1:{if(g)g=1;else{g=6;break e}return g|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(re|0)==11&&(g|0)==7||(g=o4(me,g)|0,(g|0)==127)?(_=1,_|0):(be=ht(g|0,0,45)|0,me=Q()|0,re=_,me=h[re+4>>2]&-1040385|me,h[_>>2]=h[re>>2]|be,h[_+4>>2]=me,_=0,_|0)}for(;;){if(oe=y,y=y+-1|0,$=b-m|0,W=E-m|0,M=$>>>0>715827881|W>>>0>715827881,Bl(oe)|0){if(M){if(O=($|0)>0,G=2147483647-$|0,q=-2147483648-$|0,O?(G|0)<($|0):(q|0)>($|0)){g=1,re=107;break}if(ye=$<<1,O?(2147483647-ye|0)<($|0):(-2147483648-ye|0)>($|0)){g=1,re=107;break}if((W|0)>0?(2147483647-W|0)<(W|0):(-2147483648-W|0)>(W|0)){g=1,re=107;break}if(M=$*3|0,I=W<<1,(O?(G|0)<(I|0):(q|0)>(I|0))||(($|0)>-1?(M|-2147483648|0)>=(W|0):(M^-2147483648|0)<(W|0))){g=1,re=107;break}}else M=$*3|0,I=W<<1;if(G=du(+(M-W|0)*.14285714285714285)|0,O=du(+(I+$|0)*.14285714285714285)|0,I=(O|0)<(G|0),M=I?G:O,I=I?O:G,(I|0)<0){if((I|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(I|0):(-2147483648-M|0)>(I|0))){re=24;break}if((M|0)>-1?(M|-2147483648|0)>=(I|0):(M^-2147483648|0)<(I|0)){re=24;break}}q=(G|0)<0,W=O-(q?G:0)|0,Ke=(W|0)<0,Fe=(q?0-G|0:0)-(Ke?W:0)|0,$=(Fe|0)<0,q=(q?0:G)-(Ke?W:0)-($?Fe:0)|0,W=(Ke?0:W)-($?Fe:0)|0,Fe=$?0:Fe,$=(W|0)<(q|0)?W:q,$=(Fe|0)<($|0)?Fe:$,Ke=($|0)>0,q=q-(Ke?$:0)|0,W=W-(Ke?$:0)|0,$=Fe-(Ke?$:0)|0,Ke=(q*3|0)+W|0,Fe=(Ke|0)<0,ye=(W*3|0)+$-(Fe?Ke:0)|0,M=(ye|0)<0,G=($*3|0)+q-(Fe?Ke:0)-(M?ye:0)|0,O=(G|0)<0,Ee=O?0:G,I=(M?0:ye)-(O?G:0)|0,G=(Fe?0:Ke)-(M?ye:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ee|0)<(O|0)?Ee:O,ye=(O|0)>0,M=ye?O:0,I=I-(ye?O:0)|0,O=Ee-(ye?O:0)|0}else{if(M){if(I=($|0)>0,I?(2147483647-$|0)<($|0):(-2147483648-$|0)>($|0)){g=1,re=107;break}if(M=$<<1,O=(W|0)>0,O?(2147483647-W|0)<(W|0):(-2147483648-W|0)>(W|0)){g=1,re=107;break}if(q=W<<1,O?(2147483647-q|0)<(W|0):(-2147483648-q|0)>(W|0)){g=1,re=107;break}if(I?(2147483647-M|0)<(W|0):(-2147483648-M|0)>(W|0)){g=1,re=107;break}if(I=W*3|0,(W|0)>-1?(I|-2147483648|0)>=($|0):(I^-2147483648|0)<($|0)){g=1,re=107;break}}else M=$<<1,I=W*3|0;if(G=du(+(M+W|0)*.14285714285714285)|0,O=du(+(I-$|0)*.14285714285714285)|0,I=(O|0)<(G|0),M=I?G:O,I=I?O:G,(I|0)<0){if((I|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(I|0):(-2147483648-M|0)>(I|0))){re=36;break}if((M|0)>-1?(M|-2147483648|0)>=(I|0):(M^-2147483648|0)<(I|0)){re=36;break}}q=(G|0)<0,W=O-(q?G:0)|0,Ee=(W|0)<0,ye=(q?0-G|0:0)-(Ee?W:0)|0,$=(ye|0)<0,q=(q?0:G)-(Ee?W:0)-($?ye:0)|0,W=(Ee?0:W)-($?ye:0)|0,ye=$?0:ye,$=(W|0)<(q|0)?W:q,$=(ye|0)<($|0)?ye:$,Ee=($|0)>0,q=q-(Ee?$:0)|0,W=W-(Ee?$:0)|0,$=ye-(Ee?$:0)|0,Ee=(q*3|0)+$|0,ye=(Ee|0)<0,Fe=(W*3|0)+q-(ye?Ee:0)|0,M=(Fe|0)<0,G=($*3|0)+W-(ye?Ee:0)-(M?Fe:0)|0,O=(G|0)<0,Ke=O?0:G,I=(M?0:Fe)-(O?G:0)|0,G=(ye?0:Ee)-(M?Fe:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ke|0)<(O|0)?Ke:O,Fe=(O|0)>0,M=Fe?O:0,I=I-(Fe?O:0)|0,O=Ke-(Fe?O:0)|0}M=b+(M-G)|0,Ee=(M|0)<0,I=E-I-(Ee?M:0)|0,G=(I|0)<0,Fe=m-O+(Ee?0-M|0:0)+(G?0-I|0:0)|0,b=(Fe|0)<0,O=b?0:Fe,ye=(G?0:I)-(b?Fe:0)|0,Fe=(Ee?0:M)-(G?I:0)-(b?Fe:0)|0,b=(ye|0)<(Fe|0)?ye:Fe,b=(O|0)<(b|0)?O:b,m=(b|0)>0,Fe=Fe-(m?b:0)|0,I=_,G=h[I>>2]|0,I=h[I+4>>2]|0,E=(15-oe|0)*3|0,M=ht(7,0,E|0)|0,M=G&~M,I=I&~(Q()|0),G=(Fe|0)<0,Ee=G?Fe:0,ye=ye-(m?b:0)-Ee|0,Ke=(ye|0)<0,Ee=(Ke?0-ye|0:0)+(O-(m?b:0)-Ee)|0,b=(Ee|0)<0,m=b?0:Ee,Ee=b?Ee:0,b=(Ke?0:ye)-Ee|0,Ee=(G?0:Fe)-(Ke?ye:0)-Ee|0,ye=(b|0)<(Ee|0)?b:Ee,ye=(m|0)<(ye|0)?m:ye,ye=(ye|0)>0?ye:0,m=m-ye|0,b=b-ye|0;e:do switch(Ee-ye|0){case 0:switch(b|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break e}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break e}default:{re=45;break e}}case 1:switch(b|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break e}case 1:if(m){re=45;break e}else{m=6;break e}default:{re=45;break e}}default:re=45}while(!1);if((re|0)==45&&(re=0,m=7),Ke=ht(m|0,0,E|0)|0,Ee=Q()|0|I,ye=_,h[ye>>2]=Ke|M,h[ye+4>>2]=Ee,(oe|0)<=1){re=47;break}else b=q,E=W,m=$}if((re|0)==24)li(27634,27425,416,27447);else if((re|0)==36)li(27634,27425,464,27461);else if((re|0)==47){if((q|0)>1|(W|0)>1|($|0)>1)return ye=1,ye|0;Fe=(q|0)<0,Ee=Fe?q:0,ye=W-Ee|0,Ke=(ye|0)<0,Ee=(Ke?0-ye|0:0)+($-Ee)|0,y=(Ee|0)<0,m=y?0:Ee,Ee=y?Ee:0,y=(Ke?0:ye)-Ee|0,Ee=(Fe?0:q)-(Ke?ye:0)-Ee|0,ye=(y|0)<(Ee|0)?y:Ee,ye=(m|0)<(ye|0)?m:ye,ye=(ye|0)>0?ye:0,m=m-ye|0,y=y-ye|0;e:do switch(Ee-ye|0){case 0:switch(y|0){case 0:{y=(m|0)==0?0:(m|0)==1?1:7;break e}case 1:{y=(m|0)==0?2:(m|0)==1?3:7;break e}default:{re=55;break e}}case 1:switch(y|0){case 0:{y=(m|0)==0?4:(m|0)==1?5:7;break e}case 1:if(m){re=55;break e}else{y=6;break e}default:{re=55;break e}}default:re=55}while(!1);(re|0)==55&&(y=7),E=o4(me,y)|0,(E|0)==127?I=0:I=or(E)|0;e:do if(y){if(ue){if(m=Da(d,A)|0,(m|0)==7)return ye=5,ye|0;b=h[21344+(m*28|0)+(y<<2)>>2]|0;t:do if((b|0)>0)for(m=y,y=0;;){switch(m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}if(y=y+1|0,(y|0)==(b|0))break t}else m=y;while(!1);if((m|0)==1)return ye=9,ye|0;y=o4(me,m)|0,(y|0)==127&&li(27476,27315,415,27506),or(y)|0?li(27521,27315,416,27506):(g=y,be=b,_e=m)}else g=E,be=0,_e=y;if(M=h[4272+(me*28|0)+(_e<<2)>>2]|0,(M|0)<=-1&&li(27552,27315,423,27506),!I){if((be|0)<0)return ye=5,ye|0;if(be|0){b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=T0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,m=m+1|0;while((m|0)<(be|0))}if((M|0)<=0){re=104;break}for(b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;;)if(y=T0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,m=m+1|0,(m|0)==(M|0)){re=104;break e}}if(E=a4(g,me)|0,(E|0)==7&&li(27291,27315,432,27506),m=_,y=h[m>>2]|0,m=h[m+4>>2]|0,(M|0)>0){b=0;do y=T0(y,m)|0,m=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=m,b=b+1|0;while((b|0)!=(M|0))}if(m=Da(y,m)|0,(m|0)==7&&li(27634,27315,444,27506),y=s4(g)|0,y=h[(y?21760:21552)+(E*28|0)+(m<<2)>>2]|0,(y|0)<0&&li(27634,27315,458,27506),!y)re=104;else{E=_,m=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=A4(b,E)|0,E=Q()|0,ye=_,h[ye>>2]=b,h[ye+4>>2]=E,m=m+1|0;while((m|0)<(y|0));re=104}}else if((ue|0)!=0&(I|0)!=0){if(g=Da(d,A)|0,m=_,m=Da(h[m>>2]|0,h[m+4>>2]|0)|0,(g|0)==7|(m|0)==7||(m=h[21344+(g*28|0)+(m<<2)>>2]|0,(m|0)<0))return ye=5,ye|0;if(!m)g=E,re=105;else{b=_,g=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=T0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,g=g+1|0;while((g|0)<(m|0));g=E,re=104}}else g=E,re=104;while(!1);return(re|0)==104&&I&&(re=105),(re|0)==105&&(ye=_,(Da(h[ye>>2]|0,h[ye+4>>2]|0)|0)==1)?(ye=9,ye|0):(Ee=_,Fe=h[Ee>>2]|0,Ee=h[Ee+4>>2]&-1040385,Ke=ht(g|0,0,45)|0,Ee=Ee|(Q()|0),ye=_,h[ye>>2]=Fe|Ke,h[ye+4>>2]=Ee,ye=0,ye|0)}else if((re|0)==107)return g|0;return 0}function Hre(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0;return E=Y,Y=Y+16|0,b=E,g|0?(b=15,Y=E,b|0):(d=sx(d,A,m,_,b)|0,d||(g=h[b+4>>2]|0,d=h[b+8>>2]|0,h[y>>2]=(h[b>>2]|0)-d,h[y+4>>2]=g-d,d=0),b=d,Y=E,b|0)}function Wre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;return G=Y,Y=Y+16|0,O=G,_|0?(O=15,Y=G,O|0):(E=h[m>>2]|0,b=h[m+4>>2]|0,h[O>>2]=E,M=O+4|0,h[M>>2]=b,I=O+8|0,h[I>>2]=0,m=(b|0)<(E|0),_=m?E:b,m=m?b:E,(m|0)<0?!((m|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(m|0):(-2147483648-_|0)>(m|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(m|0):(_^-2147483648|0)<(m|0))?y=5:_=1:y=5,(y|0)==5&&(_=b-E|0,y=0-E|0,(E|0)<0?(h[M>>2]=_,h[I>>2]=y,h[O>>2]=0,E=0):(_=b,y=0),b=E-_|0,m=y-_|0,(_|0)<0?(h[O>>2]=b,h[I>>2]=m,h[M>>2]=0,E=b,_=0):m=y,b=E-m|0,y=_-m|0,(m|0)<0?(h[O>>2]=b,h[M>>2]=y,h[I>>2]=0,m=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[O>>2]=b-_,h[M>>2]=y-_,h[I>>2]=m-_),_=d9(d,A,O,g)|0),O=_,Y=G,O|0)}function b4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0;return M=Y,Y=Y+32|0,b=M+12|0,E=M,y=sx(d,A,d,A,b)|0,y|0?(E=y,Y=M,E|0):(d=sx(d,A,m,_,E)|0,d|0?(E=d,Y=M,E|0):(d=(h[b>>2]|0)-(h[E>>2]|0)|0,I=(d|0)<0,_=I?0-d|0:0,m=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,A=(m|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(A?0-m|0:0)|0,y=(_|0)<0,b=y?0:_,_=y?_:0,y=(A?0:m)-_|0,_=(I?0:d)-(A?m:0)-_|0,E=(y|0)<(_|0)?y:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,y=y-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,y=(y|0)>-1?y:0-y|0,b=(b|0)>-1?b:0-b|0,b=(y|0)>(b|0)?y:b,b=(E|0)>(b|0)?E:b,E=g,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Y=M,E|0))}function jre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0;return b=Y,Y=Y+16|0,y=b,d=b4(d,A,m,_,y)|0,d|0?(y=d,Y=b,y|0):(m=y,m=pt(h[m>>2]|0,h[m+4>>2]|0,1,0)|0,_=Q()|0,y=g,h[y>>2]=m,h[y+4>>2]=_,y=0,Y=b,y|0)}function Xre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0;return M=Y,Y=Y+16|0,y=M,b=b4(d,A,m,_,y)|0,b|0?(g=b,Y=M,g|0):(b=y,y=h[b>>2]|0,b=h[b+4>>2]|0,(y|0)==0&(b|0)==0?(h[g>>2]=d,h[g+4>>2]=A,g=0,Y=M,g|0):(E=p9(d,A,m,_,y,b,g,0,0,1,0)|0,E?(g=(p9(m,_,d,A,y,b,g,y,b,-1,-1)|0)==0,g=g?0:E,Y=M,g|0):(g=0,Y=M,g|0)))}function p9(d,A,m,_,g,y,b,E,M,I,O){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0,E=E|0,M=M|0,I=I|0,O=O|0;var G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0;if(Ot=Y,Y=Y+48|0,G=Ot+24|0,q=Ot+12|0,We=Ot,h[G>>2]=0,h[G+4>>2]=0,h[G+8>>2]=0,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,sx(d,A,d,A,G)|0&&li(27634,27315,696,27575),sx(d,A,m,_,q)|0&&li(27634,27315,701,27575),oe=G+8|0,_=h[oe>>2]|0,m=_-(h[G>>2]|0)|0,h[G>>2]=m,At=G+4|0,_=(h[At>>2]|0)-_|0,h[At>>2]=_,At=_+m|0,G=0-At|0,h[oe>>2]=G,oe=q+8|0,re=h[oe>>2]|0,_e=re-(h[q>>2]|0)|0,h[q>>2]=_e,ye=q+4|0,re=(h[ye>>2]|0)-re|0,h[ye>>2]=re,ye=re+_e|0,h[oe>>2]=0-ye,Ee=1/(+(g>>>0)+4294967296*+(y|0)),Fe=Ee*+(_e-m|0),Ke=Ee*+(re-_|0),Ee=Ee*+(At-ye|0),h[We>>2]=m,ye=We+4|0,h[ye>>2]=_,At=We+8|0,h[At>>2]=G,(y|0)<0)return I=0,Y=Ot,I|0;for(me=+(m|0),be=+(_|0),ue=+(G|0),_e=0,re=0;;){if($=+(_e>>>0)+4294967296*+(re|0),at=Fe*$+me,W=Ke*$+be,$=Ee*$+ue,_=~~+Zb(+at),G=~~+Zb(+W),m=~~+Zb(+$),at=+Ps(+(+(_|0)-at)),W=+Ps(+(+(G|0)-W)),$=+Ps(+(+(m|0)-$)),at>W&at>$?(q=m+G|0,_=0-q|0):(q=0-_|0,W>$&&(G=q-m|0)),h[ye>>2]=G,h[We>>2]=q,h[At>>2]=0,m=_+G|0,(_|0)>0?(h[ye>>2]=m,h[At>>2]=_,h[We>>2]=0,q=0):(m=G,_=0),(m|0)<0?(G=q-m|0,h[We>>2]=G,_=_-m|0,h[At>>2]=_,h[ye>>2]=0,q=G-_|0,m=0-_|0,(_|0)<0?(h[We>>2]=q,h[ye>>2]=m,h[At>>2]=0,oe=m,_=0):(oe=0,q=G)):oe=m,m=(oe|0)<(q|0)?oe:q,m=(_|0)<(m|0)?_:m,(m|0)>0&&(h[We>>2]=q-m,h[ye>>2]=oe-m,h[At>>2]=_-m),m=lr(_e|0,re|0,I|0,O|0)|0,m=pt(m|0,Q()|0,E|0,M|0)|0,Q()|0,m=d9(d,A,We,b+(m<<3)|0)|0,m|0){_=20;break}if(oe=_e,_e=pt(_e|0,re|0,1,0)|0,q=re,re=Q()|0,!((q|0)<(y|0)|(q|0)==(y|0)&oe>>>0<g>>>0)){m=0,_=20;break}}return(_|0)==20?(Y=Ot,m|0):0}function nd(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if((m|0)==0&(_|0)==0)return g=0,y=1,Ln(g|0),y|0;y=d,g=A,d=1,A=0;do b=(m&1|0)==0&!0,d=lr((b?1:y)|0,(b?0:g)|0,d|0,A|0)|0,A=Q()|0,m=C9(m|0,_|0,1)|0,_=Q()|0,y=lr(y|0,g|0,y|0,g|0)|0,g=Q()|0;while(!((m|0)==0&(_|0)==0));return Ln(A|0),d|0}function w4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;E=Y,Y=Y+16|0,y=E,b=et(d|0,A|0,52)|0,Q()|0,b=b&15;do if(b){if(g=Zm(d,A,y)|0,!g){I=+ne[y>>3],M=1/+Qn(+I),O=+ne[26032+(b<<3)>>3],ne[m>>3]=I+O,ne[m+8>>3]=I-O,I=+ne[y+8>>3],M=O*M,ne[m+16>>3]=M+I,ne[m+24>>3]=I-M;break}return b=g,Y=E,b|0}else{if(g=et(d|0,A|0,45)|0,Q()|0,g=g&127,g>>>0>121)return b=5,Y=E,b|0;y=22128+(g<<5)|0,h[m>>2]=h[y>>2],h[m+4>>2]=h[y+4>>2],h[m+8>>2]=h[y+8>>2],h[m+12>>2]=h[y+12>>2],h[m+16>>2]=h[y+16>>2],h[m+20>>2]=h[y+20>>2],h[m+24>>2]=h[y+24>>2],h[m+28>>2]=h[y+28>>2];break}while(!1);return are(m,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(d|0)&&(h[_+4>>2]|0)==(A|0)&&(ne[m>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(d|0)&&(h[b+4>>2]|0)==(A|0)&&(ne[m+8>>3]=-1.5707963267948966),+ne[m>>3]!=1.5707963267948966&&+ne[m+8>>3]!=-1.5707963267948966?(b=0,Y=E,b|0):(ne[m+16>>3]=3.141592653589793,ne[m+24>>3]=-3.141592653589793,b=0,Y=E,b|0)}function $re(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;I=Y,Y=Y+48|0,b=I+32|0,y=I+40|0,E=I,d4(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0<=15){if(g=ax(_)|0,g|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=g,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+2>>0]|0;break}if(g=na((h[A+8>>2]|0)+1|0,32)|0,g){S4(A,g),O=E,h[O>>2]=M,h[O+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=m,h[E+16>>2]=_,h[E+20>>2]=A,h[E+24>>2]=g,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+2>>0]|0;break}else{_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=13,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+2>>0]|0;break}}else M=E,h[M>>2]=0,h[M+4>>2]=0,h[E+8>>2]=4,h[E+12>>2]=-1,M=E+16|0,O=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[y>>0]|0,He[O+1>>0]=He[y+1>>0]|0,He[O+2>>0]=He[y+2>>0]|0;while(!1);Hb(E),h[d>>2]=h[E>>2],h[d+4>>2]=h[E+4>>2],h[d+8>>2]=h[E+8>>2],h[d+12>>2]=h[E+12>>2],h[d+16>>2]=h[E+16>>2],h[d+20>>2]=h[E+20>>2],h[d+24>>2]=h[E+24>>2],h[d+28>>2]=h[E+28>>2],Y=I}function Hb(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0;if(me=Y,Y=Y+336|0,W=me+168|0,$=me,_=d,m=h[_>>2]|0,_=h[_+4>>2]|0,(m|0)==0&(_|0)==0){Y=me;return}if(A=d+28|0,He[A>>0]|0?(m=A9(m,_)|0,_=Q()|0):He[A>>0]=1,be=d+20|0,!(h[h[be>>2]>>2]|0)){A=d+24|0,m=h[A>>2]|0,m|0&&_t(m),re=d,h[re>>2]=0,h[re+4>>2]=0,h[d+8>>2]=0,h[be>>2]=0,h[d+12>>2]=-1,h[d+16>>2]=0,h[A>>2]=0,Y=me;return}re=d+16|0,A=h[re>>2]|0,g=A&15;e:do if((m|0)==0&(_|0)==0)_e=d+24|0;else{oe=d+12|0,G=(g|0)==3,O=A&255,M=(g|1|0)==3,q=d+24|0,I=(g+-1|0)>>>0<3,b=(g|2|0)==3,E=$+8|0;t:for(;;){if(y=et(m|0,_|0,52)|0,Q()|0,y=y&15,(y|0)==(h[oe>>2]|0)){switch(O&15){case 0:case 2:case 3:{if(g=Zm(m,_,W)|0,g|0){ue=15;break t}if(T4(h[be>>2]|0,h[q>>2]|0,W)|0){ue=19;break t}break}default:}if(M&&(g=h[(h[be>>2]|0)+4>>2]|0,h[W>>2]=h[g>>2],h[W+4>>2]=h[g+4>>2],h[W+8>>2]=h[g+8>>2],h[W+12>>2]=h[g+12>>2],Jk(26896,W)|0)){if(g4(h[(h[be>>2]|0)+4>>2]|0,y,$)|0){ue=25;break}if(g=$,(h[g>>2]|0)==(m|0)&&(h[g+4>>2]|0)==(_|0)){ue=29;break}}if(I){if(g=E0(m,_,W)|0,g|0){ue=32;break}if(w4(m,_,$,0)|0){ue=36;break}if(b&&g9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}if(M&&_9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}}if(G){if(A=w4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=45;break}if(l4(g,W)|0){if(t9($,W),e9(W,h[q>>2]|0)|0){ue=53;break}if(T4(h[be>>2]|0,h[q>>2]|0,E)|0){ue=53;break}if(_9(h[be>>2]|0,h[q>>2]|0,$,W)|0){ue=53;break}}}}do if((y|0)<(h[oe>>2]|0)){if(A=w4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=58;break t}if(!(l4(g,W)|0)){ue=73;break}if(e9(h[q>>2]|0,W)|0&&(t9($,W),g9(h[be>>2]|0,h[q>>2]|0,$,W)|0)){ue=65;break t}if(m=c9(m,_,y+1|0,$)|0,m|0){ue=67;break t}_=$,m=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,m=A9(m,_)|0,_=Q()|0),(m|0)==0&(_|0)==0){_e=q;break e}}switch(ue|0){case 15:{A=h[q>>2]|0,A|0&&_t(A),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,ue=20;break}case 19:{h[d>>2]=m,h[d+4>>2]=_,ue=20;break}case 25:{li(27634,27600,470,27611);break}case 29:{h[d>>2]=m,h[d+4>>2]=_,Y=me;return}case 32:{A=h[q>>2]|0,A|0&&_t(A),_e=d,h[_e>>2]=0,h[_e+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,Y=me;return}case 36:{li(27634,27600,493,27611);break}case 42:{h[d>>2]=m,h[d+4>>2]=_,Y=me;return}case 45:{g|0&&_t(g),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=A,ue=55;break}case 53:{h[d>>2]=m,h[d+4>>2]=_,ue=55;break}case 58:{g|0&&_t(g),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=A,ue=71;break}case 65:{h[d>>2]=m,h[d+4>>2]=_,ue=71;break}case 67:{A=h[q>>2]|0,A|0&&_t(A),_e=d,h[_e>>2]=0,h[_e+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=m,Y=me;return}}if((ue|0)==20){Y=me;return}else if((ue|0)==55){Y=me;return}else if((ue|0)==71){Y=me;return}}while(!1);A=h[_e>>2]|0,A|0&&_t(A),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[d+8>>2]=0,h[be>>2]=0,h[d+12>>2]=-1,h[re>>2]=0,h[_e>>2]=0,Y=me}function A9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+16|0,O=G,_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0;do if(_){for(;m=ht(_+4095|0,0,52)|0,g=Q()|0|A&-15728641,y=(15-_|0)*3|0,b=ht(7,0,y|0)|0,E=Q()|0,m=m|d|b,g=g|E,M=et(d|0,A|0,y|0)|0,Q()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)A=g,d=m;else{I=4;break}if((I|0)==4){m=et(m|0,g|0,45)|0,Q()|0;break}return O=(M|0)==0&(Ui(m,g)|0)!=0,O=ht((O?2:1)+M|0,0,y|0)|0,I=Q()|0|A&~E,O=O|d&~b,Ln(I|0),Y=G,O|0}while(!1);return m=m&127,m>>>0>120?(I=0,O=0,Ln(I|0),Y=G,O|0):(d4(O,0,m+1|0,0),I=h[O+4>>2]|0,O=h[O>>2]|0,Ln(I|0),Y=G,O|0)}function Yre(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;ue=Y,Y=Y+160|0,G=ue+80|0,E=ue+64|0,q=ue+112|0,oe=ue,$re(G,d,A,m),I=G,y4(E,h[I>>2]|0,h[I+4>>2]|0,A),I=E,M=h[I>>2]|0,I=h[I+4>>2]|0,b=h[G+8>>2]|0,W=q+4|0,h[W>>2]=h[G>>2],h[W+4>>2]=h[G+4>>2],h[W+8>>2]=h[G+8>>2],h[W+12>>2]=h[G+12>>2],h[W+16>>2]=h[G+16>>2],h[W+20>>2]=h[G+20>>2],h[W+24>>2]=h[G+24>>2],h[W+28>>2]=h[G+28>>2],W=oe,h[W>>2]=M,h[W+4>>2]=I,W=oe+8|0,h[W>>2]=b,d=oe+12|0,A=q,m=d+36|0;do h[d>>2]=h[A>>2],d=d+4|0,A=A+4|0;while((d|0)<(m|0));if(q=oe+48|0,h[q>>2]=h[E>>2],h[q+4>>2]=h[E+4>>2],h[q+8>>2]=h[E+8>>2],h[q+12>>2]=h[E+12>>2],(M|0)==0&(I|0)==0)return oe=b,Y=ue,oe|0;m=oe+16|0,O=oe+24|0,G=oe+28|0,b=0,E=0,A=M,d=I;do{if(!((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<_>>>0)){$=4;break}if(I=E,E=pt(E|0,b|0,1,0)|0,b=Q()|0,I=y+(I<<3)|0,h[I>>2]=A,h[I+4>>2]=d,v4(q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0,(A|0)==0&(d|0)==0){if(Hb(m),A=m,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0){$=10;break}h9(d,A,h[G>>2]|0,q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0}I=oe,h[I>>2]=A,h[I+4>>2]=d}while(!((A|0)==0&(d|0)==0));return($|0)==4?(d=oe+40|0,A=h[d>>2]|0,A|0&&_t(A),$=oe+16|0,h[$>>2]=0,h[$+4>>2]=0,h[O>>2]=0,h[oe+36>>2]=0,h[G>>2]=-1,h[oe+32>>2]=0,h[d>>2]=0,h9(0,0,0,q),h[oe>>2]=0,h[oe+4>>2]=0,h[W>>2]=0,oe=14,Y=ue,oe|0):(($|0)==10&&(h[oe>>2]=0,h[oe+4>>2]=0,h[W>>2]=h[O>>2]),oe=h[W>>2]|0,Y=ue,oe|0)}function Kre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0;if(G=Y,Y=Y+48|0,M=G+32|0,E=G+40|0,I=G,!(h[d>>2]|0))return O=_,h[O>>2]=0,h[O+4>>2]=0,O=0,Y=G,O|0;d4(M,0,0,0),b=M,g=h[b>>2]|0,b=h[b+4>>2]|0;do if(A>>>0>15)O=I,h[O>>2]=0,h[O+4>>2]=0,h[I+8>>2]=4,h[I+12>>2]=-1,O=I+16|0,m=I+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[m>>0]=He[E>>0]|0,He[m+1>>0]=He[E+1>>0]|0,He[m+2>>0]=He[E+2>>0]|0,m=4,O=9;else{if(m=ax(m)|0,m|0){M=I,h[M>>2]=0,h[M+4>>2]=0,h[I+8>>2]=m,h[I+12>>2]=-1,M=I+16|0,O=I+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[E>>0]|0,He[O+1>>0]=He[E+1>>0]|0,He[O+2>>0]=He[E+2>>0]|0,O=9;break}if(m=na((h[d+8>>2]|0)+1|0,32)|0,!m){O=I,h[O>>2]=0,h[O+4>>2]=0,h[I+8>>2]=13,h[I+12>>2]=-1,O=I+16|0,m=I+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[m>>0]=He[E>>0]|0,He[m+1>>0]=He[E+1>>0]|0,He[m+2>>0]=He[E+2>>0]|0,m=13,O=9;break}S4(d,m),W=I,h[W>>2]=g,h[W+4>>2]=b,b=I+8|0,h[b>>2]=0,h[I+12>>2]=A,h[I+20>>2]=d,h[I+24>>2]=m,He[I+28>>0]=0,g=I+29|0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,h[I+16>>2]=3,q=+rre(m),q=q*+nre(m),y=+Ps(+ +ne[m>>3]),y=q/+Qn(+ +Kb(+y,+ +Ps(+ +ne[m+8>>3])))*6371.007180918475*6371.007180918475,g=I+12|0,m=h[g>>2]|0;e:do if((m|0)>0)do{if(f9(m+-1|0,M)|0,!(y/+ne[M>>3]>10))break e;W=h[g>>2]|0,m=W+-1|0,h[g>>2]=m}while((W|0)>1);while(!1);if(Hb(I),g=_,h[g>>2]=0,h[g+4>>2]=0,g=I,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0))do nx(m,g,A,M)|0,E=M,d=_,E=pt(h[d>>2]|0,h[d+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,d=Q()|0,W=_,h[W>>2]=E,h[W+4>>2]=d,Hb(I),W=I,m=h[W>>2]|0,g=h[W+4>>2]|0;while(!((m|0)==0&(g|0)==0));m=h[b>>2]|0}while(!1);return W=m,Y=G,W|0}function ox(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;if(!(Jk(A,m)|0)||(A=ire(A)|0,_=+ne[m>>3],g=+ne[m+8>>3],g=A&g<0?g+6.283185307179586:g,q=h[d>>2]|0,(q|0)<=0))return q=0,q|0;if(G=h[d+4>>2]|0,A){A=0,O=g,m=-1,d=0;e:for(;;){for(I=d;b=+ne[G+(I<<4)>>3],g=+ne[G+(I<<4)+8>>3],d=(m+2|0)%(q|0)|0,y=+ne[G+(d<<4)>>3],E=+ne[G+(d<<4)+8>>3],b>y?(M=b,b=E):(M=y,y=b,b=g,g=E),_=_==y|_==M?_+2220446049250313e-31:_,!!(_<y|_>M);)if(m=I+1|0,(m|0)>=(q|0)){m=22;break e}else d=I,I=m,m=d;if(E=b<0?b+6.283185307179586:b,b=g<0?g+6.283185307179586:g,O=E==O|b==O?O+-2220446049250313e-31:O,M=E+(b-E)*((_-y)/(M-y)),(M<0?M+6.283185307179586:M)>O&&(A=A^1),d=I+1|0,(d|0)>=(q|0)){m=22;break}else m=I}if((m|0)==22)return A|0}else{A=0,O=g,m=-1,d=0;e:for(;;){for(I=d;b=+ne[G+(I<<4)>>3],g=+ne[G+(I<<4)+8>>3],d=(m+2|0)%(q|0)|0,y=+ne[G+(d<<4)>>3],E=+ne[G+(d<<4)+8>>3],b>y?(M=b,b=E):(M=y,y=b,b=g,g=E),_=_==y|_==M?_+2220446049250313e-31:_,!!(_<y|_>M);)if(m=I+1|0,(m|0)>=(q|0)){m=22;break e}else d=I,I=m,m=d;if(O=b==O|g==O?O+-2220446049250313e-31:O,b+(g-b)*((_-y)/(M-y))>O&&(A=A^1),d=I+1|0,(d|0)>=(q|0)){m=22;break}else m=I}if((m|0)==22)return A|0}return 0}function m9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if($=h[d>>2]|0,!$){h[A>>2]=0,h[A+4>>2]=0,h[A+8>>2]=0,h[A+12>>2]=0,h[A+16>>2]=0,h[A+20>>2]=0,h[A+24>>2]=0,h[A+28>>2]=0;return}if(oe=A+8|0,ne[oe>>3]=17976931348623157e292,ue=A+24|0,ne[ue>>3]=17976931348623157e292,ne[A>>3]=-17976931348623157e292,_e=A+16|0,ne[_e>>3]=-17976931348623157e292,!(($|0)<=0)){for(q=h[d+4>>2]|0,I=17976931348623157e292,O=-17976931348623157e292,G=0,d=-1,y=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,W=0;m=+ne[q+(W<<4)>>3],E=+ne[q+(W<<4)+8>>3],d=d+2|0,g=+ne[q+(((d|0)==($|0)?0:d)<<4)+8>>3],m<y&&(ne[oe>>3]=m,y=m),E<b&&(ne[ue>>3]=E,b=E),m>M?ne[A>>3]=m:m=M,E>_&&(ne[_e>>3]=E,_=E),I=E>0&E<I?E:I,O=E<0&E>O?E:O,G=G|+Ps(+(E-g))>3.141592653589793,d=W+1|0,(d|0)!=($|0);)re=W,M=m,W=d,d=re;G&&(ne[_e>>3]=O,ne[ue>>3]=I)}}function ax(d){return d=d|0,(d>>>0<4?0:15)|0}function S4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0;if($=h[d>>2]|0,$){if(oe=A+8|0,ne[oe>>3]=17976931348623157e292,ue=A+24|0,ne[ue>>3]=17976931348623157e292,ne[A>>3]=-17976931348623157e292,_e=A+16|0,ne[_e>>3]=-17976931348623157e292,($|0)>0){for(g=h[d+4>>2]|0,q=17976931348623157e292,W=-17976931348623157e292,_=0,m=-1,M=17976931348623157e292,I=17976931348623157e292,G=-17976931348623157e292,b=-17976931348623157e292,re=0;y=+ne[g+(re<<4)>>3],O=+ne[g+(re<<4)+8>>3],Ke=m+2|0,E=+ne[g+(((Ke|0)==($|0)?0:Ke)<<4)+8>>3],y<M&&(ne[oe>>3]=y,M=y),O<I&&(ne[ue>>3]=O,I=O),y>G?ne[A>>3]=y:y=G,O>b&&(ne[_e>>3]=O,b=O),q=O>0&O<q?O:q,W=O<0&O>W?O:W,_=_|+Ps(+(O-E))>3.141592653589793,m=re+1|0,(m|0)!=($|0);)Ke=re,G=y,re=m,m=Ke;_&&(ne[_e>>3]=W,ne[ue>>3]=q)}}else h[A>>2]=0,h[A+4>>2]=0,h[A+8>>2]=0,h[A+12>>2]=0,h[A+16>>2]=0,h[A+20>>2]=0,h[A+24>>2]=0,h[A+28>>2]=0;if(Ke=d+8|0,m=h[Ke>>2]|0,!((m|0)<=0)){Fe=d+12|0,me=0;do if(g=h[Fe>>2]|0,_=me,me=me+1|0,ue=A+(me<<5)|0,_e=h[g+(_<<3)>>2]|0,_e){if(re=A+(me<<5)+8|0,ne[re>>3]=17976931348623157e292,d=A+(me<<5)+24|0,ne[d>>3]=17976931348623157e292,ne[ue>>3]=-17976931348623157e292,be=A+(me<<5)+16|0,ne[be>>3]=-17976931348623157e292,(_e|0)>0){for($=h[g+(_<<3)+4>>2]|0,q=17976931348623157e292,W=-17976931348623157e292,g=0,_=-1,oe=0,M=17976931348623157e292,I=17976931348623157e292,O=-17976931348623157e292,b=-17976931348623157e292;y=+ne[$+(oe<<4)>>3],G=+ne[$+(oe<<4)+8>>3],_=_+2|0,E=+ne[$+(((_|0)==(_e|0)?0:_)<<4)+8>>3],y<M&&(ne[re>>3]=y,M=y),G<I&&(ne[d>>3]=G,I=G),y>O?ne[ue>>3]=y:y=O,G>b&&(ne[be>>3]=G,b=G),q=G>0&G<q?G:q,W=G<0&G>W?G:W,g=g|+Ps(+(G-E))>3.141592653589793,_=oe+1|0,(_|0)!=(_e|0);)Ee=oe,oe=_,O=y,_=Ee;g&&(ne[be>>3]=W,ne[d>>3]=q)}}else h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0,h[ue+16>>2]=0,h[ue+20>>2]=0,h[ue+24>>2]=0,h[ue+28>>2]=0,m=h[Ke>>2]|0;while((me|0)<(m|0))}}function T4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(!(ox(d,A,m)|0))return g=0,g|0;if(g=d+8|0,(h[g>>2]|0)<=0)return g=1,g|0;for(_=d+12|0,d=0;;){if(y=d,d=d+1|0,ox((h[_>>2]|0)+(y<<3)|0,A+(d<<5)|0,m)|0){d=0,_=6;break}if((d|0)>=(h[g>>2]|0)){d=1,_=6;break}}return(_|0)==6?d|0:0}function g9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(I=Y,Y=Y+16|0,E=I,b=m+8|0,!(ox(d,A,b)|0))return M=0,Y=I,M|0;M=d+8|0;e:do if((h[M>>2]|0)>0){for(y=d+12|0,g=0;;){if(O=g,g=g+1|0,ox((h[y>>2]|0)+(O<<3)|0,A+(g<<5)|0,b)|0){g=0;break}if((g|0)>=(h[M>>2]|0))break e}return Y=I,g|0}while(!1);if(Wb(d,A,m,_)|0)return O=0,Y=I,O|0;h[E>>2]=h[m>>2],h[E+4>>2]=b,g=h[M>>2]|0;e:do if((g|0)>0)for(d=d+12|0,b=0,y=g;;){if(g=h[d>>2]|0,(h[g+(b<<3)>>2]|0)>0){if(ox(E,_,h[g+(b<<3)+4>>2]|0)|0){g=0;break e}if(g=b+1|0,Wb((h[d>>2]|0)+(b<<3)|0,A+(g<<5)|0,m,_)|0){g=0;break e}y=h[M>>2]|0}else g=b+1|0;if((g|0)<(y|0))b=g;else{g=1;break}}else g=1;while(!1);return O=g,Y=I,O|0}function Wb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ke=0,Ee=0,ye=0;if(Ke=Y,Y=Y+176|0,re=Ke+172|0,g=Ke+168|0,be=Ke,!(l4(A,_)|0))return d=0,Y=Ke,d|0;if(sre(A,_,re,g),_c(be|0,m|0,168)|0,(h[m>>2]|0)>0){A=0;do Ee=be+8+(A<<4)+8|0,_e=+ol(+ne[Ee>>3],h[g>>2]|0),ne[Ee>>3]=_e,A=A+1|0;while((A|0)<(h[m>>2]|0))}oe=+ne[_>>3],ue=+ne[_+8>>3],_e=+ol(+ne[_+16>>3],h[g>>2]|0),W=+ol(+ne[_+24>>3],h[g>>2]|0);e:do if((h[d>>2]|0)>0){if(_=d+4|0,g=h[be>>2]|0,(g|0)<=0){for(A=0;;)if(A=A+1|0,(A|0)>=(h[d>>2]|0)){A=0;break e}}for(m=0;;){if(A=h[_>>2]|0,q=+ne[A+(m<<4)>>3],$=+ol(+ne[A+(m<<4)+8>>3],h[re>>2]|0),A=h[_>>2]|0,m=m+1|0,Ee=(m|0)%(h[d>>2]|0)|0,y=+ne[A+(Ee<<4)>>3],b=+ol(+ne[A+(Ee<<4)+8>>3],h[re>>2]|0),!(q>=oe)|!(y>=oe)&&!(q<=ue)|!(y<=ue)&&!($<=W)|!(b<=W)&&!($>=_e)|!(b>=_e)){G=y-q,I=b-$,A=0;do if(ye=A,A=A+1|0,Ee=(A|0)==(g|0)?0:A,y=+ne[be+8+(ye<<4)+8>>3],b=+ne[be+8+(Ee<<4)+8>>3]-y,E=+ne[be+8+(ye<<4)>>3],M=+ne[be+8+(Ee<<4)>>3]-E,O=G*b-I*M,O!=0&&(me=$-y,Fe=q-E,M=(me*M-b*Fe)/O,!(M<0|M>1))&&(O=(G*me-I*Fe)/O,O>=0&O<=1)){A=1;break e}while((A|0)<(g|0))}if((m|0)>=(h[d>>2]|0)){A=0;break}}}else A=0;while(!1);return ye=A,Y=Ke,ye|0}function _9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(Wb(d,A,m,_)|0)return y=1,y|0;if(y=d+8|0,(h[y>>2]|0)<=0)return y=0,y|0;for(g=d+12|0,d=0;;){if(b=d,d=d+1|0,Wb((h[g>>2]|0)+(b<<3)|0,A+(d<<5)|0,m,_)|0){d=1,g=6;break}if((d|0)>=(h[y>>2]|0)){d=0,g=6;break}}return(g|0)==6?d|0:0}function Zre(){return 8}function Qre(){return 16}function Jre(){return 168}function ese(){return 8}function tse(){return 16}function nse(){return 12}function ise(){return 8}function rse(d){return d=d|0,+(+((h[d>>2]|0)>>>0)+4294967296*+(h[d+4>>2]|0))}function sse(d){d=d|0;var A=0,m=0;return m=+ne[d>>3],A=+ne[d+8>>3],+ +ts(+(m*m+A*A))}function x9(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;I=+ne[d>>3],M=+ne[A>>3]-I,E=+ne[d+8>>3],b=+ne[A+8>>3]-E,G=+ne[m>>3],y=+ne[_>>3]-G,q=+ne[m+8>>3],O=+ne[_+8>>3]-q,y=(y*(E-q)-(I-G)*O)/(M*O-b*y),ne[g>>3]=I+M*y,ne[g+8>>3]=E+b*y}function y9(d,A){return d=d|0,A=A|0,+Ps(+(+ne[d>>3]-+ne[A>>3]))<11920928955078125e-23?(A=+Ps(+(+ne[d+8>>3]-+ne[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function ose(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(y=Y,Y=Y+16|0,g=y,_=Ui(d,A)|0,(m+-1|0)>>>0>5||(_=(_|0)!=0,(m|0)==1&_))return g=-1,Y=y,g|0;do if(lx(d,A,g)|0)_=-1;else if(_){_=((h[26416+(m<<2)>>2]|0)+5-(h[g>>2]|0)|0)%5|0;break}else{_=((h[26448+(m<<2)>>2]|0)+6-(h[g>>2]|0)|0)%6|0;break}while(!1);return g=_,Y=y,g|0}function lx(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=Y,Y=Y+32|0,E=O+16|0,M=O,_=Km(d,A,E)|0,_|0)return m=_,Y=O,m|0;y=a9(d,A)|0,I=Da(d,A)|0,Qie(y,M),_=Jie(y,h[E>>2]|0)|0;do if(or(y)|0){do switch(y|0){case 4:{g=0;break}case 14:{g=1;break}case 24:{g=2;break}case 38:{g=3;break}case 49:{g=4;break}case 58:{g=5;break}case 63:{g=6;break}case 72:{g=7;break}case 83:{g=8;break}case 97:{g=9;break}case 107:{g=10;break}case 117:{g=11;break}default:li(27634,27636,75,27645)}while(!1);if(b=h[26480+(g*24|0)+8>>2]|0,A=h[26480+(g*24|0)+16>>2]|0,d=h[E>>2]|0,(d|0)!=(h[M>>2]|0)&&(M=s4(y)|0,d=h[E>>2]|0,M|(d|0)==(A|0)&&(_=(_+1|0)%6|0)),(I|0)==3&(d|0)==(A|0)){_=(_+5|0)%6|0;break}(I|0)==5&(d|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[m>>2]=_,m=0,Y=O,m|0}function Ul(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0;if(be=Y,Y=Y+32|0,re=be+24|0,ue=be+20|0,$=be+8|0,W=be+16|0,q=be,M=(Ui(d,A)|0)==0,M=M?6:5,O=et(d|0,A|0,52)|0,Q()|0,O=O&15,M>>>0<=m>>>0)return _=2,Y=be,_|0;G=(O|0)==0,!G&&(oe=ht(7,0,(O^15)*3|0)|0,(oe&d|0)==0&((Q()|0)&A|0)==0)?g=m:y=4;e:do if((y|0)==4){if(g=(Ui(d,A)|0)!=0,((g?4:5)|0)<(m|0)||lx(d,A,re)|0||(y=(h[re>>2]|0)+m|0,g?g=26768+(((y|0)%5|0)<<2)|0:g=26800+(((y|0)%6|0)<<2)|0,oe=h[g>>2]|0,(oe|0)==7))return _=1,Y=be,_|0;h[ue>>2]=0,g=Is(d,A,oe,ue,$)|0;do if(!g){if(E=$,I=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<A>>>0|(E|0)==(A|0)&I>>>0<d>>>0,y=b?I:d,b=b?E:A,!G&&(G=ht(7,0,(O^15)*3|0)|0,(I&G|0)==0&(E&(Q()|0)|0)==0))g=m;else{if(E=(m+-1+M|0)%(M|0)|0,g=Ui(d,A)|0,(E|0)<0&&li(27634,27636,248,27661),M=(g|0)!=0,((M?4:5)|0)<(E|0)&&li(27634,27636,248,27661),lx(d,A,re)|0&&li(27634,27636,248,27661),g=(h[re>>2]|0)+E|0,M?g=26768+(((g|0)%5|0)<<2)|0:g=26800+(((g|0)%6|0)<<2)|0,E=h[g>>2]|0,(E|0)==7&&li(27634,27636,248,27661),h[W>>2]=0,g=Is(d,A,E,W,q)|0,g|0)break;I=q,M=h[I>>2]|0,I=h[I+4>>2]|0;do if(I>>>0<b>>>0|(I|0)==(b|0)&M>>>0<y>>>0){if(Ui(M,I)|0?y=Gb(M,I,d,A)|0:y=h[26864+((((h[W>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=Ui(M,I)|0,(y+-1|0)>>>0>5){g=-1,y=M,b=I;break}if(g=(g|0)!=0,(y|0)==1&g){g=-1,y=M,b=I;break}do if(lx(M,I,re)|0)g=-1;else if(g){g=((h[26416+(y<<2)>>2]|0)+5-(h[re>>2]|0)|0)%5|0;break}else{g=((h[26448+(y<<2)>>2]|0)+6-(h[re>>2]|0)|0)%6|0;break}while(!1);y=M,b=I}else g=m;while(!1);E=$,I=h[E>>2]|0,E=h[E+4>>2]|0}if((y|0)==(I|0)&(b|0)==(E|0)){if(M=(Ui(I,E)|0)!=0,M?d=Gb(I,E,d,A)|0:d=h[26864+((((h[ue>>2]|0)+(h[26832+(oe<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=Ui(I,E)|0,(d+-1|0)>>>0<=5&&(_e=(g|0)!=0,!((d|0)==1&_e)))do if(lx(I,E,re)|0)g=-1;else if(_e){g=((h[26416+(d<<2)>>2]|0)+5-(h[re>>2]|0)|0)%5|0;break}else{g=((h[26448+(d<<2)>>2]|0)+6-(h[re>>2]|0)|0)%6|0;break}while(!1);else g=-1;g=g+1|0,g=(g|0)==6|M&(g|0)==5?0:g}A=b,d=y;break e}while(!1);return _=g,Y=be,_|0}while(!1);return _e=ht(g|0,0,56)|0,re=Q()|0|A&-2130706433|536870912,h[_>>2]=_e|d,h[_+4>>2]=re,_=0,Y=be,_|0}function ase(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return y=(Ui(d,A)|0)==0,_=Ul(d,A,0,m)|0,g=(_|0)==0,y?!g||(_=Ul(d,A,1,m+8|0)|0,_|0)||(_=Ul(d,A,2,m+16|0)|0,_|0)||(_=Ul(d,A,3,m+24|0)|0,_|0)||(_=Ul(d,A,4,m+32|0)|0,_)?(y=_,y|0):Ul(d,A,5,m+40|0)|0:!g||(_=Ul(d,A,1,m+8|0)|0,_|0)||(_=Ul(d,A,2,m+16|0)|0,_|0)||(_=Ul(d,A,3,m+24|0)|0,_|0)||(_=Ul(d,A,4,m+32|0)|0,_|0)?(y=_,y|0):(y=m+40|0,h[y>>2]=0,h[y+4>>2]=0,y=0,y|0)}function lse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0;return M=Y,Y=Y+192|0,g=M,y=M+168|0,b=et(d|0,A|0,56)|0,Q()|0,b=b&7,E=A&-2130706433|134217728,_=Km(d,E,y)|0,_|0?(E=_,Y=M,E|0):(A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Ui(d,E)|0?u4(y,A,b,1,g):h4(y,A,b,1,g),E=g+8|0,h[m>>2]=h[E>>2],h[m+4>>2]=h[E+4>>2],h[m+8>>2]=h[E+8>>2],h[m+12>>2]=h[E+12>>2],E=0,Y=M,E|0)}function v9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=Y,Y=Y+16|0,m=g,!(!0&(A&2013265920|0)==536870912)||(_=A&-2130706433|134217728,!(Vb(d,_)|0))?(_=0,Y=g,_|0):(y=et(d|0,A|0,56)|0,Q()|0,y=(Ul(d,_,y&7,m)|0)==0,_=m,_=y&((h[_>>2]|0)==(d|0)?(h[_+4>>2]|0)==(A|0):0)&1,Y=g,_|0)}function b9(){return 27680}function jb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;G=Y,Y=Y+208|0,M=G,I=G+192|0,b=La(m,A)|0,E=I,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-m|0,h[M+4>>2]=m,h[M>>2]=m,g=2,A=m,y=m;A=A+m+y|0,h[M+(g<<2)>>2]=A,A>>>0<b>>>0;)q=y,g=g+1|0,y=A,A=q;if(y=d+b+E|0,y>>>0>d>>>0){b=y,g=1,A=1;do{do if((A&3|0)!=3)if(A=g+-1|0,(h[M+(A<<2)>>2]|0)>>>0<(b-d|0)>>>0?E4(d,m,_,g,M):$b(d,m,_,I,g,0,M),(g|0)==1){Yb(I,1),g=0;break}else{Yb(I,A),g=1;break}else E4(d,m,_,g,M),Xb(I,2),g=g+2|0;while(!1);A=h[I>>2]|1,h[I>>2]=A,d=d+m|0}while(d>>>0<y>>>0)}else g=1,A=1;for($b(d,m,_,I,g,0,M),y=I+4|0;;){if((g|0)==1&(A|0)==1)if(h[y>>2]|0)O=19;else break e;else(g|0)<2?O=19:(Yb(I,2),q=g+-2|0,h[I>>2]=h[I>>2]^7,Xb(I,1),$b(d+(0-(h[M+(q<<2)>>2]|0))+E|0,m,_,I,g+-1|0,1,M),Yb(I,1),A=h[I>>2]|1,h[I>>2]=A,d=d+E|0,$b(d,m,_,I,q,1,M),g=q);(O|0)==19&&(O=0,A=w9(I)|0,Xb(I,A),d=d+E|0,g=A+g|0,A=h[I>>2]|0)}}while(!1);Y=G}function E4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+240|0,O=G,h[O>>2]=d;e:do if((_|0)>1)for(I=0-A|0,E=d,y=_,_=1,b=d;;){if(E=E+I|0,M=y+-2|0,d=E+(0-(h[g+(M<<2)>>2]|0))|0,(ad[m&3](b,d)|0)>-1&&(ad[m&3](b,E)|0)>-1||(b=O+(_<<2)|0,(ad[m&3](d,E)|0)>-1?(h[b>>2]=d,y=y+-1|0):(h[b>>2]=E,d=E,y=M),_=_+1|0,(y|0)<=1))break e;E=d,b=h[O>>2]|0}else _=1;while(!1);T9(A,O,_),Y=G}function Xb(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;g=d+4|0,A>>>0>31?(_=h[g>>2]|0,h[d>>2]=_,h[g>>2]=0,A=A+-32|0,m=0):(m=h[g>>2]|0,_=h[d>>2]|0),h[d>>2]=m<<32-A|_>>>A,h[g>>2]=m>>>A}function $b(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;W=Y,Y=Y+240|0,G=W+232|0,q=W,$=h[_>>2]|0,h[G>>2]=$,M=h[_+4>>2]|0,I=G+4|0,h[I>>2]=M,h[q>>2]=d;e:do if(($|0)!=1|(M|0)!=0&&(O=0-A|0,E=d+(0-(h[b+(g<<2)>>2]|0))|0,(ad[m&3](E,d)|0)>=1))for(_=1,y=(y|0)==0,M=E;;){if(y&(g|0)>1){if(y=d+O|0,E=h[b+(g+-2<<2)>>2]|0,(ad[m&3](y,M)|0)>-1){E=10;break e}if((ad[m&3](y+(0-E)|0,M)|0)>-1){E=10;break e}}if(y=_+1|0,h[q+(_<<2)>>2]=M,$=w9(G)|0,Xb(G,$),g=$+g|0,!((h[G>>2]|0)!=1|(h[I>>2]|0)!=0)){_=y,d=M,E=10;break e}if(d=M+(0-(h[b+(g<<2)>>2]|0))|0,(ad[m&3](d,h[q>>2]|0)|0)<1){d=M,_=y,y=0,E=9;break}else $=M,_=y,y=1,M=d,d=$}else _=1,E=9;while(!1);(E|0)==9&&(y|0)==0&&(E=10),(E|0)==10&&(T9(A,q,_),E4(d,A,m,g,b)),Y=W}function Yb(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;g=d+4|0,A>>>0>31?(_=h[d>>2]|0,h[g>>2]=_,h[d>>2]=0,A=A+-32|0,m=0):(m=h[d>>2]|0,_=h[g>>2]|0),h[g>>2]=m>>>(32-A|0)|_<<A,h[d>>2]=m<<A}function w9(d){d=d|0;var A=0;return A=S9((h[d>>2]|0)+-1|0)|0,A?A|0:(A=S9(h[d+4>>2]|0)|0,((A|0)==0?0:A+32|0)|0)}function S9(d){d=d|0;var A=0;if(d)if(d&1)d=0;else for(A=d,d=0;d=d+1|0,!(A&2);)A=A>>>1;else d=32;return d|0}function T9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0;b=Y,Y=Y+256|0,_=b;e:do if((m|0)>=2&&(y=A+(m<<2)|0,h[y>>2]=_,d|0))for(;;){g=d>>>0<256?d:256,_c(_|0,h[A>>2]|0,g|0)|0,_=0;do E=A+(_<<2)|0,_=_+1|0,_c(h[E>>2]|0,h[A+(_<<2)>>2]|0,g|0)|0,h[E>>2]=(h[E>>2]|0)+g;while((_|0)!=(m|0));if(d=d-g|0,!d)break e;_=h[y>>2]|0}while(!1);Y=b}function du(d){return d=+d,~~+P9(+d)|0}function ar(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0;Fe=Y,Y=Y+16|0,q=Fe;do if(d>>>0<245){if(I=d>>>0<11?16:d+11&-8,d=I>>>3,G=h[6921]|0,m=G>>>d,m&3|0)return A=(m&1^1)+d|0,d=27724+(A<<1<<2)|0,m=d+8|0,_=h[m>>2]|0,g=_+8|0,y=h[g>>2]|0,(y|0)==(d|0)?h[6921]=G&~(1<<A):(h[y+12>>2]=d,h[m>>2]=y),me=A<<3,h[_+4>>2]=me|3,me=_+me+4|0,h[me>>2]=h[me>>2]|1,me=g,Y=Fe,me|0;if(O=h[6923]|0,I>>>0>O>>>0){if(m|0)return A=2<<d,A=m<<d&(A|0-A),A=(A&0-A)+-1|0,E=A>>>12&16,A=A>>>E,m=A>>>5&8,A=A>>>m,y=A>>>2&4,A=A>>>y,d=A>>>1&2,A=A>>>d,_=A>>>1&1,_=(m|E|y|d|_)+(A>>>_)|0,A=27724+(_<<1<<2)|0,d=A+8|0,y=h[d>>2]|0,E=y+8|0,m=h[E>>2]|0,(m|0)==(A|0)?(d=G&~(1<<_),h[6921]=d):(h[m+12>>2]=A,h[d>>2]=m,d=G),me=_<<3,b=me-I|0,h[y+4>>2]=I|3,g=y+I|0,h[g+4>>2]=b|1,h[y+me>>2]=b,O|0&&(_=h[6926]|0,A=O>>>3,m=27724+(A<<1<<2)|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=_,h[A+12>>2]=_,h[_+8>>2]=A,h[_+12>>2]=m),h[6923]=b,h[6926]=g,me=E,Y=Fe,me|0;if(y=h[6922]|0,y){for(m=(y&0-y)+-1|0,g=m>>>12&16,m=m>>>g,_=m>>>5&8,m=m>>>_,b=m>>>2&4,m=m>>>b,E=m>>>1&2,m=m>>>E,M=m>>>1&1,M=h[27988+((_|g|b|E|M)+(m>>>M)<<2)>>2]|0,m=M,E=M,M=(h[M+4>>2]&-8)-I|0;d=h[m+16>>2]|0,!(!d&&(d=h[m+20>>2]|0,!d));)b=(h[d+4>>2]&-8)-I|0,g=b>>>0<M>>>0,m=d,E=g?d:E,M=g?b:M;if(b=E+I|0,b>>>0>E>>>0){g=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+20|0,A=h[d>>2]|0,!A&&(d=E+16|0,A=h[d>>2]|0,!A)){m=0;break}for(;;)if(_=A+20|0,m=h[_>>2]|0,m)A=m,d=_;else if(_=A+16|0,m=h[_>>2]|0,m)A=m,d=_;else break;h[d>>2]=0,m=A}else m=h[E+8>>2]|0,h[m+12>>2]=A,h[A+8>>2]=m,m=A;while(!1);do if(g|0){if(A=h[E+28>>2]|0,d=27988+(A<<2)|0,(E|0)==(h[d>>2]|0)){if(h[d>>2]=m,!m){h[6922]=y&~(1<<A);break}}else if(me=g+16|0,h[((h[me>>2]|0)==(E|0)?me:g+20|0)>>2]=m,!m)break;h[m+24>>2]=g,A=h[E+16>>2]|0,A|0&&(h[m+16>>2]=A,h[A+24>>2]=m),A=h[E+20>>2]|0,A|0&&(h[m+20>>2]=A,h[A+24>>2]=m)}while(!1);return M>>>0<16?(me=M+I|0,h[E+4>>2]=me|3,me=E+me+4|0,h[me>>2]=h[me>>2]|1):(h[E+4>>2]=I|3,h[b+4>>2]=M|1,h[b+M>>2]=M,O|0&&(_=h[6926]|0,A=O>>>3,m=27724+(A<<1<<2)|0,A=1<<A,A&G?(d=m+8|0,A=h[d>>2]|0):(h[6921]=A|G,A=m,d=m+8|0),h[d>>2]=_,h[A+12>>2]=_,h[_+8>>2]=A,h[_+12>>2]=m),h[6923]=M,h[6926]=b),me=E+8|0,Y=Fe,me|0}else G=I}else G=I}else G=I}else if(d>>>0<=4294967231)if(d=d+11|0,I=d&-8,_=h[6922]|0,_){g=0-I|0,d=d>>>8,d?I>>>0>16777215?M=31:(G=(d+1048320|0)>>>16&8,oe=d<<G,E=(oe+520192|0)>>>16&4,oe=oe<<E,M=(oe+245760|0)>>>16&2,M=14-(E|G|M)+(oe<<M>>>15)|0,M=I>>>(M+7|0)&1|M<<1):M=0,m=h[27988+(M<<2)>>2]|0;e:do if(!m)m=0,d=0,oe=61;else for(d=0,E=I<<((M|0)==31?0:25-(M>>>1)|0),y=0;;){if(b=(h[m+4>>2]&-8)-I|0,b>>>0<g>>>0)if(b)d=m,g=b;else{d=m,g=0,oe=65;break e}if(oe=h[m+20>>2]|0,m=h[m+16+(E>>>31<<2)>>2]|0,y=(oe|0)==0|(oe|0)==(m|0)?y:oe,m)E=E<<1;else{m=y,oe=61;break}}while(!1);if((oe|0)==61){if((m|0)==0&(d|0)==0){if(d=2<<M,d=(d|0-d)&_,!d){G=I;break}G=(d&0-d)+-1|0,b=G>>>12&16,G=G>>>b,y=G>>>5&8,G=G>>>y,E=G>>>2&4,G=G>>>E,M=G>>>1&2,G=G>>>M,m=G>>>1&1,d=0,m=h[27988+((y|b|E|M|m)+(G>>>m)<<2)>>2]|0}m?oe=65:(E=d,b=g)}if((oe|0)==65)for(y=m;;)if(G=(h[y+4>>2]&-8)-I|0,m=G>>>0<g>>>0,g=m?G:g,d=m?y:d,m=h[y+16>>2]|0,m||(m=h[y+20>>2]|0),m)y=m;else{E=d,b=g;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-I|0)>>>0&&(O=E+I|0,O>>>0>E>>>0)){y=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+20|0,A=h[d>>2]|0,!A&&(d=E+16|0,A=h[d>>2]|0,!A)){A=0;break}for(;;)if(g=A+20|0,m=h[g>>2]|0,m)A=m,d=g;else if(g=A+16|0,m=h[g>>2]|0,m)A=m,d=g;else break;h[d>>2]=0}else me=h[E+8>>2]|0,h[me+12>>2]=A,h[A+8>>2]=me;while(!1);do if(y){if(d=h[E+28>>2]|0,m=27988+(d<<2)|0,(E|0)==(h[m>>2]|0)){if(h[m>>2]=A,!A){_=_&~(1<<d),h[6922]=_;break}}else if(me=y+16|0,h[((h[me>>2]|0)==(E|0)?me:y+20|0)>>2]=A,!A)break;h[A+24>>2]=y,d=h[E+16>>2]|0,d|0&&(h[A+16>>2]=d,h[d+24>>2]=A),d=h[E+20>>2]|0,d&&(h[A+20>>2]=d,h[d+24>>2]=A)}while(!1);e:do if(b>>>0<16)me=b+I|0,h[E+4>>2]=me|3,me=E+me+4|0,h[me>>2]=h[me>>2]|1;else{if(h[E+4>>2]=I|3,h[O+4>>2]=b|1,h[O+b>>2]=b,A=b>>>3,b>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=O,h[A+12>>2]=O,h[O+8>>2]=A,h[O+12>>2]=m;break}if(A=b>>>8,A?b>>>0>16777215?m=31:(be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,m=(me+245760|0)>>>16&2,m=14-(re|be|m)+(me<<m>>>15)|0,m=b>>>(m+7|0)&1|m<<1):m=0,A=27988+(m<<2)|0,h[O+28>>2]=m,d=O+16|0,h[d+4>>2]=0,h[d>>2]=0,d=1<<m,!(_&d)){h[6922]=_|d,h[A>>2]=O,h[O+24>>2]=A,h[O+12>>2]=O,h[O+8>>2]=O;break}A=h[A>>2]|0;t:do if((h[A+4>>2]&-8|0)!=(b|0)){for(_=b<<((m|0)==31?0:25-(m>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(b|0)){A=d;break t}else _=_<<1,A=d;h[m>>2]=O,h[O+24>>2]=A,h[O+12>>2]=O,h[O+8>>2]=O;break e}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=O,h[be>>2]=O,h[O+8>>2]=me,h[O+12>>2]=A,h[O+24>>2]=0}while(!1);return me=E+8|0,Y=Fe,me|0}else G=I}else G=I;else G=-1;while(!1);if(m=h[6923]|0,m>>>0>=G>>>0)return A=m-G|0,d=h[6926]|0,A>>>0>15?(me=d+G|0,h[6926]=me,h[6923]=A,h[me+4>>2]=A|1,h[d+m>>2]=A,h[d+4>>2]=G|3):(h[6923]=0,h[6926]=0,h[d+4>>2]=m|3,me=d+m+4|0,h[me>>2]=h[me>>2]|1),me=d+8|0,Y=Fe,me|0;if(b=h[6924]|0,b>>>0>G>>>0)return re=b-G|0,h[6924]=re,me=h[6927]|0,be=me+G|0,h[6927]=be,h[be+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0;if(h[7039]|0?d=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=q&-16^1431655768,d=4096),E=G+48|0,M=G+47|0,y=d+M|0,g=0-d|0,I=y&g,I>>>0<=G>>>0||(d=h[7031]|0,d|0&&(O=h[7029]|0,q=O+I|0,q>>>0<=O>>>0|q>>>0>d>>>0)))return me=0,Y=Fe,me|0;e:do if(h[7032]&4)A=0,oe=143;else{m=h[6927]|0;t:do if(m){for(_=28132;q=h[_>>2]|0,!(q>>>0<=m>>>0&&(q+(h[_+4>>2]|0)|0)>>>0>m>>>0);)if(d=h[_+8>>2]|0,d)_=d;else{oe=128;break t}if(A=y-b&g,A>>>0<2147483647)if(d=od(A|0)|0,(d|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((d|0)!=-1){b=A,y=d,oe=145;break e}}else _=d,oe=136;else A=0}else oe=128;while(!1);do if((oe|0)==128)if(m=od(0)|0,(m|0)!=-1&&(A=m,W=h[7040]|0,$=W+-1|0,A=(($&A|0)==0?0:($+A&0-W)-A|0)+I|0,W=h[7029]|0,$=A+W|0,A>>>0>G>>>0&A>>>0<2147483647)){if(q=h[7031]|0,q|0&&$>>>0<=W>>>0|$>>>0>q>>>0){A=0;break}if(d=od(A|0)|0,(d|0)==(m|0)){b=A,y=m,oe=145;break e}else _=d,oe=136}else A=0;while(!1);do if((oe|0)==136){if(m=0-A|0,!(E>>>0>A>>>0&(A>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){A=0;break}else{b=A,y=_,oe=145;break e}if(d=h[7041]|0,d=M-A+d&0-d,d>>>0>=2147483647){b=A,y=_,oe=145;break e}if((od(d|0)|0)==-1){od(m|0)|0,A=0;break}else{b=d+A|0,y=_,oe=145;break e}}while(!1);h[7032]=h[7032]|4,oe=143}while(!1);if((oe|0)==143&&I>>>0<2147483647&&(re=od(I|0)|0,$=od(0)|0,ue=$-re|0,_e=ue>>>0>(G+40|0)>>>0,!((re|0)==-1|_e^1|re>>>0<$>>>0&((re|0)!=-1&($|0)!=-1)^1))&&(b=_e?ue:A,y=re,oe=145),(oe|0)==145){A=(h[7029]|0)+b|0,h[7029]=A,A>>>0>(h[7030]|0)>>>0&&(h[7030]=A),M=h[6927]|0;e:do if(M){for(A=28132;;){if(d=h[A>>2]|0,m=h[A+4>>2]|0,(y|0)==(d+m|0)){oe=154;break}if(_=h[A+8>>2]|0,_)A=_;else break}if((oe|0)==154&&(be=A+4|0,(h[A+12>>2]&8|0)==0)&&y>>>0>M>>>0&d>>>0<=M>>>0){h[be>>2]=m+b,me=(h[6924]|0)+b|0,re=M+8|0,re=(re&7|0)==0?0:0-re&7,be=M+re|0,re=me-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[M+me+4>>2]=40,h[6928]=h[7043];break}for(y>>>0<(h[6925]|0)>>>0&&(h[6925]=y),m=y+b|0,A=28132;;){if((h[A>>2]|0)==(m|0)){oe=162;break}if(d=h[A+8>>2]|0,d)A=d;else break}if((oe|0)==162&&(h[A+12>>2]&8|0)==0){h[A>>2]=y,O=A+4|0,h[O>>2]=(h[O>>2]|0)+b,O=y+8|0,O=y+((O&7|0)==0?0:0-O&7)|0,A=m+8|0,A=m+((A&7|0)==0?0:0-A&7)|0,I=O+G|0,E=A-O-G|0,h[O+4>>2]=G|3;t:do if((M|0)==(A|0))me=(h[6924]|0)+E|0,h[6924]=me,h[6927]=I,h[I+4>>2]=me|1;else{if((h[6926]|0)==(A|0)){me=(h[6923]|0)+E|0,h[6923]=me,h[6926]=I,h[I+4>>2]=me|1,h[I+me>>2]=me;break}if(d=h[A+4>>2]|0,(d&3|0)==1){b=d&-8,_=d>>>3;n:do if(d>>>0<256)if(d=h[A+8>>2]|0,m=h[A+12>>2]|0,(m|0)==(d|0)){h[6921]=h[6921]&~(1<<_);break}else{h[d+12>>2]=m,h[m+8>>2]=d;break}else{y=h[A+24>>2]|0,d=h[A+12>>2]|0;do if((d|0)==(A|0)){if(m=A+16|0,_=m+4|0,d=h[_>>2]|0,d)m=_;else if(d=h[m>>2]|0,!d){d=0;break}for(;;)if(g=d+20|0,_=h[g>>2]|0,_)d=_,m=g;else if(g=d+16|0,_=h[g>>2]|0,_)d=_,m=g;else break;h[m>>2]=0}else me=h[A+8>>2]|0,h[me+12>>2]=d,h[d+8>>2]=me;while(!1);if(!y)break;m=h[A+28>>2]|0,_=27988+(m<<2)|0;do if((h[_>>2]|0)!=(A|0)){if(me=y+16|0,h[((h[me>>2]|0)==(A|0)?me:y+20|0)>>2]=d,!d)break n}else{if(h[_>>2]=d,d|0)break;h[6922]=h[6922]&~(1<<m);break n}while(!1);if(h[d+24>>2]=y,m=A+16|0,_=h[m>>2]|0,_|0&&(h[d+16>>2]=_,h[_+24>>2]=d),m=h[m+4>>2]|0,!m)break;h[d+20>>2]=m,h[m+24>>2]=d}while(!1);A=A+b|0,g=b+E|0}else g=E;if(A=A+4|0,h[A>>2]=h[A>>2]&-2,h[I+4>>2]=g|1,h[I+g>>2]=g,A=g>>>3,g>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=I,h[A+12>>2]=I,h[I+8>>2]=A,h[I+12>>2]=m;break}A=g>>>8;do if(!A)_=0;else{if(g>>>0>16777215){_=31;break}be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|be|_)+(me<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1}while(!1);if(A=27988+(_<<2)|0,h[I+28>>2]=_,d=I+16|0,h[d+4>>2]=0,h[d>>2]=0,d=h[6922]|0,m=1<<_,!(d&m)){h[6922]=d|m,h[A>>2]=I,h[I+24>>2]=A,h[I+12>>2]=I,h[I+8>>2]=I;break}A=h[A>>2]|0;n:do if((h[A+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(g|0)){A=d;break n}else _=_<<1,A=d;h[m>>2]=I,h[I+24>>2]=A,h[I+12>>2]=I,h[I+8>>2]=I;break t}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=I,h[be>>2]=I,h[I+8>>2]=me,h[I+12>>2]=A,h[I+24>>2]=0}while(!1);return me=O+8|0,Y=Fe,me|0}for(A=28132;d=h[A>>2]|0,!(d>>>0<=M>>>0&&(me=d+(h[A+4>>2]|0)|0,me>>>0>M>>>0));)A=h[A+8>>2]|0;g=me+-47|0,d=g+8|0,d=g+((d&7|0)==0?0:0-d&7)|0,g=M+16|0,d=d>>>0<g>>>0?M:d,A=d+8|0,m=b+-40|0,re=y+8|0,re=(re&7|0)==0?0:0-re&7,be=y+re|0,re=m-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[y+m+4>>2]=40,h[6928]=h[7043],m=d+4|0,h[m>>2]=27,h[A>>2]=h[7033],h[A+4>>2]=h[7034],h[A+8>>2]=h[7035],h[A+12>>2]=h[7036],h[7033]=y,h[7034]=b,h[7036]=0,h[7035]=A,A=d+24|0;do be=A,A=A+4|0,h[A>>2]=7;while((be+8|0)>>>0<me>>>0);if((d|0)!=(M|0)){if(y=d-M|0,h[m>>2]=h[m>>2]&-2,h[M+4>>2]=y|1,h[d>>2]=y,A=y>>>3,y>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=M,h[A+12>>2]=M,h[M+8>>2]=A,h[M+12>>2]=m;break}if(A=y>>>8,A?y>>>0>16777215?_=31:(be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|be|_)+(me<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[g>>2]=0,A=h[6922]|0,d=1<<_,!(A&d)){h[6922]=A|d,h[m>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break}A=h[m>>2]|0;t:do if((h[A+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(y|0)){A=d;break t}else _=_<<1,A=d;h[m>>2]=M,h[M+24>>2]=A,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=M,h[be>>2]=M,h[M+8>>2]=me,h[M+12>>2]=A,h[M+24>>2]=0}}else me=h[6925]|0,(me|0)==0|y>>>0<me>>>0&&(h[6925]=y),h[7033]=y,h[7034]=b,h[7036]=0,h[6930]=h[7039],h[6929]=-1,h[6934]=27724,h[6933]=27724,h[6936]=27732,h[6935]=27732,h[6938]=27740,h[6937]=27740,h[6940]=27748,h[6939]=27748,h[6942]=27756,h[6941]=27756,h[6944]=27764,h[6943]=27764,h[6946]=27772,h[6945]=27772,h[6948]=27780,h[6947]=27780,h[6950]=27788,h[6949]=27788,h[6952]=27796,h[6951]=27796,h[6954]=27804,h[6953]=27804,h[6956]=27812,h[6955]=27812,h[6958]=27820,h[6957]=27820,h[6960]=27828,h[6959]=27828,h[6962]=27836,h[6961]=27836,h[6964]=27844,h[6963]=27844,h[6966]=27852,h[6965]=27852,h[6968]=27860,h[6967]=27860,h[6970]=27868,h[6969]=27868,h[6972]=27876,h[6971]=27876,h[6974]=27884,h[6973]=27884,h[6976]=27892,h[6975]=27892,h[6978]=27900,h[6977]=27900,h[6980]=27908,h[6979]=27908,h[6982]=27916,h[6981]=27916,h[6984]=27924,h[6983]=27924,h[6986]=27932,h[6985]=27932,h[6988]=27940,h[6987]=27940,h[6990]=27948,h[6989]=27948,h[6992]=27956,h[6991]=27956,h[6994]=27964,h[6993]=27964,h[6996]=27972,h[6995]=27972,me=b+-40|0,re=y+8|0,re=(re&7|0)==0?0:0-re&7,be=y+re|0,re=me-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[y+me+4>>2]=40,h[6928]=h[7043];while(!1);if(A=h[6924]|0,A>>>0>G>>>0)return re=A-G|0,h[6924]=re,me=h[6927]|0,be=me+G|0,h[6927]=be,h[be+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0}return me=b9()|0,h[me>>2]=12,me=0,Y=Fe,me|0}function _t(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0;if(d){m=d+-8|0,g=h[6925]|0,d=h[d+-4>>2]|0,A=d&-8,M=m+A|0;do if(d&1)E=m,b=m;else{if(_=h[m>>2]|0,!(d&3)||(b=m+(0-_)|0,y=_+A|0,b>>>0<g>>>0))return;if((h[6926]|0)==(b|0)){if(d=M+4|0,A=h[d>>2]|0,(A&3|0)!=3){E=b,A=y;break}h[6923]=y,h[d>>2]=A&-2,h[b+4>>2]=y|1,h[b+y>>2]=y;return}if(m=_>>>3,_>>>0<256)if(d=h[b+8>>2]|0,A=h[b+12>>2]|0,(A|0)==(d|0)){h[6921]=h[6921]&~(1<<m),E=b,A=y;break}else{h[d+12>>2]=A,h[A+8>>2]=d,E=b,A=y;break}g=h[b+24>>2]|0,d=h[b+12>>2]|0;do if((d|0)==(b|0)){if(A=b+16|0,m=A+4|0,d=h[m>>2]|0,d)A=m;else if(d=h[A>>2]|0,!d){d=0;break}for(;;)if(_=d+20|0,m=h[_>>2]|0,m)d=m,A=_;else if(_=d+16|0,m=h[_>>2]|0,m)d=m,A=_;else break;h[A>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=d,h[d+8>>2]=E;while(!1);if(g){if(A=h[b+28>>2]|0,m=27988+(A<<2)|0,(h[m>>2]|0)==(b|0)){if(h[m>>2]=d,!d){h[6922]=h[6922]&~(1<<A),E=b,A=y;break}}else if(E=g+16|0,h[((h[E>>2]|0)==(b|0)?E:g+20|0)>>2]=d,!d){E=b,A=y;break}h[d+24>>2]=g,A=b+16|0,m=h[A>>2]|0,m|0&&(h[d+16>>2]=m,h[m+24>>2]=d),A=h[A+4>>2]|0,A?(h[d+20>>2]=A,h[A+24>>2]=d,E=b,A=y):(E=b,A=y)}else E=b,A=y}while(!1);if(!(b>>>0>=M>>>0)&&(d=M+4|0,_=h[d>>2]|0,!!(_&1))){if(_&2)h[d>>2]=_&-2,h[E+4>>2]=A|1,h[b+A>>2]=A,g=A;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+A|0,h[6924]=M,h[6927]=E,h[E+4>>2]=M|1,(E|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(M|0)){M=(h[6923]|0)+A|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}g=(_&-8)+A|0,m=_>>>3;do if(_>>>0<256)if(A=h[M+8>>2]|0,d=h[M+12>>2]|0,(d|0)==(A|0)){h[6921]=h[6921]&~(1<<m);break}else{h[A+12>>2]=d,h[d+8>>2]=A;break}else{y=h[M+24>>2]|0,d=h[M+12>>2]|0;do if((d|0)==(M|0)){if(A=M+16|0,m=A+4|0,d=h[m>>2]|0,d)A=m;else if(d=h[A>>2]|0,!d){m=0;break}for(;;)if(_=d+20|0,m=h[_>>2]|0,m)d=m,A=_;else if(_=d+16|0,m=h[_>>2]|0,m)d=m,A=_;else break;h[A>>2]=0,m=d}else m=h[M+8>>2]|0,h[m+12>>2]=d,h[d+8>>2]=m,m=d;while(!1);if(y|0){if(d=h[M+28>>2]|0,A=27988+(d<<2)|0,(h[A>>2]|0)==(M|0)){if(h[A>>2]=m,!m){h[6922]=h[6922]&~(1<<d);break}}else if(_=y+16|0,h[((h[_>>2]|0)==(M|0)?_:y+20|0)>>2]=m,!m)break;h[m+24>>2]=y,d=M+16|0,A=h[d>>2]|0,A|0&&(h[m+16>>2]=A,h[A+24>>2]=m),d=h[d+4>>2]|0,d|0&&(h[m+20>>2]=d,h[d+24>>2]=m)}}while(!1);if(h[E+4>>2]=g|1,h[b+g>>2]=g,(E|0)==(h[6926]|0)){h[6923]=g;return}}if(d=g>>>3,g>>>0<256){m=27724+(d<<1<<2)|0,A=h[6921]|0,d=1<<d,A&d?(A=m+8|0,d=h[A>>2]|0):(h[6921]=A|d,d=m,A=m+8|0),h[A>>2]=E,h[d+12>>2]=E,h[E+8>>2]=d,h[E+12>>2]=m;return}d=g>>>8,d?g>>>0>16777215?_=31:(b=(d+1048320|0)>>>16&8,M=d<<b,y=(M+520192|0)>>>16&4,M=M<<y,_=(M+245760|0)>>>16&2,_=14-(y|b|_)+(M<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1):_=0,d=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,A=h[6922]|0,m=1<<_;e:do if(!(A&m))h[6922]=A|m,h[d>>2]=E,h[E+24>>2]=d,h[E+12>>2]=E,h[E+8>>2]=E;else{d=h[d>>2]|0;t:do if((h[d+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=d+16+(_>>>31<<2)|0,A=h[m>>2]|0,!!A;)if((h[A+4>>2]&-8|0)==(g|0)){d=A;break t}else _=_<<1,d=A;h[m>>2]=E,h[E+24>>2]=d,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=d+8|0,M=h[b>>2]|0,h[M+12>>2]=E,h[b>>2]=E,h[E+8>>2]=M,h[E+12>>2]=d,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(d=28140;d=h[d>>2]|0,d;)d=d+8|0;h[6929]=-1}}}}function na(d,A){d=d|0,A=A|0;var m=0;return d?(m=La(A,d)|0,(A|d)>>>0>65535&&(m=((m>>>0)/(d>>>0)|0|0)==(A|0)?m:-1)):m=0,d=ar(m)|0,!d||!(h[d+-4>>2]&3)||sd(d|0,0,m|0)|0,d|0}function cse(d,A){d=d|0,A=A|0;var m=0,_=0;return d?A>>>0>4294967231?(A=b9()|0,h[A>>2]=12,A=0,A|0):(m=use(d+-8|0,A>>>0<11?16:A+11&-8)|0,m|0?(A=m+8|0,A|0):(m=ar(A)|0,m?(_=h[d+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,_c(m|0,d|0,(_>>>0<A>>>0?_:A)|0)|0,_t(d),A=m,A|0):(A=0,A|0))):(A=ar(A)|0,A|0)}function use(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(O=d+4|0,G=h[O>>2]|0,m=G&-8,E=d+m|0,!(G&3))return A>>>0<256?(d=0,d|0):(m>>>0>=(A+4|0)>>>0&&(m-A|0)>>>0<=h[7041]<<1>>>0||(d=0),d|0);if(m>>>0>=A>>>0)return m=m-A|0,m>>>0<=15||(I=d+A|0,h[O>>2]=G&1|A|2,h[I+4>>2]=m|3,G=E+4|0,h[G>>2]=h[G>>2]|1,E9(I,m)),d|0;if((h[6927]|0)==(E|0))return I=(h[6924]|0)+m|0,m=I-A|0,_=d+A|0,I>>>0<=A>>>0?(d=0,d|0):(h[O>>2]=G&1|A|2,h[_+4>>2]=m|1,h[6927]=_,h[6924]=m,d|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+m|0,_>>>0<A>>>0?(d=0,d|0):(m=_-A|0,m>>>0>15?(I=d+A|0,_=d+_|0,h[O>>2]=G&1|A|2,h[I+4>>2]=m|1,h[_>>2]=m,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=I):(h[O>>2]=G&1|_|2,_=d+_+4|0,h[_>>2]=h[_>>2]|1,_=0,m=0),h[6923]=m,h[6926]=_,d|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+m|0,M>>>0<A>>>0))return d=0,d|0;I=M-A|0,g=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(_|0)){h[6921]=h[6921]&~(1<<g);break}else{h[_+12>>2]=m,h[m+8>>2]=_;break}else{b=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(_=E+16|0,g=_+4|0,m=h[g>>2]|0,m)_=g;else if(m=h[_>>2]|0,!m){g=0;break}for(;;)if(y=m+20|0,g=h[y>>2]|0,g)m=g,_=y;else if(y=m+16|0,g=h[y>>2]|0,g)m=g,_=y;else break;h[_>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);if(b|0){if(m=h[E+28>>2]|0,_=27988+(m<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(y=b+16|0,h[((h[y>>2]|0)==(E|0)?y:b+20|0)>>2]=g,!g)break;h[g+24>>2]=b,m=E+16|0,_=h[m>>2]|0,_|0&&(h[g+16>>2]=_,h[_+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);return I>>>0<16?(h[O>>2]=G&1|M|2,G=d+M+4|0,h[G>>2]=h[G>>2]|1,d|0):(E=d+A|0,h[O>>2]=G&1|A|2,h[E+4>>2]=I|3,G=d+M+4|0,h[G>>2]=h[G>>2]|1,E9(E,I),d|0)}function E9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;E=d+A|0,m=h[d+4>>2]|0;do if(m&1)b=d;else{if(g=h[d>>2]|0,!(m&3))return;if(b=d+(0-g)|0,A=g+A|0,(h[6926]|0)==(b|0)){if(d=E+4|0,m=h[d>>2]|0,(m&3|0)!=3)break;h[6923]=A,h[d>>2]=m&-2,h[b+4>>2]=A|1,h[E>>2]=A;return}if(_=g>>>3,g>>>0<256)if(d=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(d|0)){h[6921]=h[6921]&~(1<<_);break}else{h[d+12>>2]=m,h[m+8>>2]=d;break}y=h[b+24>>2]|0,d=h[b+12>>2]|0;do if((d|0)==(b|0)){if(m=b+16|0,_=m+4|0,d=h[_>>2]|0,d)m=_;else if(d=h[m>>2]|0,!d){d=0;break}for(;;)if(g=d+20|0,_=h[g>>2]|0,_)d=_,m=g;else if(g=d+16|0,_=h[g>>2]|0,_)d=_,m=g;else break;h[m>>2]=0}else g=h[b+8>>2]|0,h[g+12>>2]=d,h[d+8>>2]=g;while(!1);if(y){if(m=h[b+28>>2]|0,_=27988+(m<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=d,!d){h[6922]=h[6922]&~(1<<m);break}}else if(g=y+16|0,h[((h[g>>2]|0)==(b|0)?g:y+20|0)>>2]=d,!d)break;h[d+24>>2]=y,m=b+16|0,_=h[m>>2]|0,_|0&&(h[d+16>>2]=_,h[_+24>>2]=d),m=h[m+4>>2]|0,m&&(h[d+20>>2]=m,h[m+24>>2]=d)}}while(!1);if(d=E+4|0,_=h[d>>2]|0,_&2)h[d>>2]=_&-2,h[b+4>>2]=A|1,h[b+A>>2]=A,g=A;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+A|0,h[6924]=E,h[6927]=b,h[b+4>>2]=E|1,(b|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(E|0)){E=(h[6923]|0)+A|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}g=(_&-8)+A|0,m=_>>>3;do if(_>>>0<256)if(d=h[E+8>>2]|0,A=h[E+12>>2]|0,(A|0)==(d|0)){h[6921]=h[6921]&~(1<<m);break}else{h[d+12>>2]=A,h[A+8>>2]=d;break}else{y=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+16|0,m=d+4|0,A=h[m>>2]|0,A)d=m;else if(A=h[d>>2]|0,!A){m=0;break}for(;;)if(_=A+20|0,m=h[_>>2]|0,m)A=m,d=_;else if(_=A+16|0,m=h[_>>2]|0,m)A=m,d=_;else break;h[d>>2]=0,m=A}else m=h[E+8>>2]|0,h[m+12>>2]=A,h[A+8>>2]=m,m=A;while(!1);if(y|0){if(A=h[E+28>>2]|0,d=27988+(A<<2)|0,(h[d>>2]|0)==(E|0)){if(h[d>>2]=m,!m){h[6922]=h[6922]&~(1<<A);break}}else if(_=y+16|0,h[((h[_>>2]|0)==(E|0)?_:y+20|0)>>2]=m,!m)break;h[m+24>>2]=y,A=E+16|0,d=h[A>>2]|0,d|0&&(h[m+16>>2]=d,h[d+24>>2]=m),A=h[A+4>>2]|0,A|0&&(h[m+20>>2]=A,h[A+24>>2]=m)}}while(!1);if(h[b+4>>2]=g|1,h[b+g>>2]=g,(b|0)==(h[6926]|0)){h[6923]=g;return}}if(A=g>>>3,g>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=b,h[A+12>>2]=b,h[b+8>>2]=A,h[b+12>>2]=m;return}if(A=g>>>8,A?g>>>0>16777215?_=31:(y=(A+1048320|0)>>>16&8,E=A<<y,m=(E+520192|0)>>>16&4,E=E<<m,_=(E+245760|0)>>>16&2,_=14-(m|y|_)+(E<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1):_=0,A=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,d=h[6922]|0,m=1<<_,!(d&m)){h[6922]=d|m,h[A>>2]=b,h[b+24>>2]=A,h[b+12>>2]=b,h[b+8>>2]=b;return}A=h[A>>2]|0;e:do if((h[A+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(g|0)){A=d;break e}else _=_<<1,A=d;h[m>>2]=b,h[b+24>>2]=A,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);y=A+8|0,E=h[y>>2]|0,h[E+12>>2]=b,h[y>>2]=b,h[b+8>>2]=E,h[b+12>>2]=A,h[b+24>>2]=0}function pt(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,m=d+m>>>0,Ln(A+_+(m>>>0<d>>>0|0)>>>0|0),m|0|0}function Ns(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,_=A-_-(m>>>0>d>>>0|0)>>>0,Ln(_|0),d-m>>>0|0|0}function M9(d){return d=d|0,(d?31-(jh(d^d-1)|0)|0:32)|0}function M4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(O=d,M=A,I=M,b=m,q=_,E=q,!I)return y=(g|0)!=0,E?y?(h[g>>2]=d|0,h[g+4>>2]=A&0,q=0,g=0,Ln(q|0),g|0):(q=0,g=0,Ln(q|0),g|0):(y&&(h[g>>2]=(O>>>0)%(b>>>0),h[g+4>>2]=0),q=0,g=(O>>>0)/(b>>>0)>>>0,Ln(q|0),g|0);y=(E|0)==0;do if(b){if(!y){if(y=(jh(E|0)|0)-(jh(I|0)|0)|0,y>>>0<=31){G=y+1|0,E=31-y|0,A=y-31>>31,b=G,d=O>>>(G>>>0)&A|I<<E,A=I>>>(G>>>0)&A,y=0,E=O<<E;break}return g?(h[g>>2]=d|0,h[g+4>>2]=M|A&0,q=0,g=0,Ln(q|0),g|0):(q=0,g=0,Ln(q|0),g|0)}if(y=b-1|0,y&b|0){E=(jh(b|0)|0)+33-(jh(I|0)|0)|0,$=64-E|0,G=32-E|0,M=G>>31,W=E-32|0,A=W>>31,b=E,d=G-1>>31&I>>>(W>>>0)|(I<<G|O>>>(E>>>0))&A,A=A&I>>>(E>>>0),y=O<<$&M,E=(I<<$|O>>>(W>>>0))&M|O<<G&E-33>>31;break}return g|0&&(h[g>>2]=y&O,h[g+4>>2]=0),(b|0)==1?(W=M|A&0,$=d|0|0,Ln(W|0),$|0):($=M9(b|0)|0,W=I>>>($>>>0)|0,$=I<<32-$|O>>>($>>>0)|0,Ln(W|0),$|0)}else{if(y)return g|0&&(h[g>>2]=(I>>>0)%(b>>>0),h[g+4>>2]=0),W=0,$=(I>>>0)/(b>>>0)>>>0,Ln(W|0),$|0;if(!O)return g|0&&(h[g>>2]=0,h[g+4>>2]=(I>>>0)%(E>>>0)),W=0,$=(I>>>0)/(E>>>0)>>>0,Ln(W|0),$|0;if(y=E-1|0,!(y&E))return g|0&&(h[g>>2]=d|0,h[g+4>>2]=y&I|A&0),W=0,$=I>>>((M9(E|0)|0)>>>0),Ln(W|0),$|0;if(y=(jh(E|0)|0)-(jh(I|0)|0)|0,y>>>0<=30){A=y+1|0,E=31-y|0,b=A,d=I<<E|O>>>(A>>>0),A=I>>>(A>>>0),y=0,E=O<<E;break}return g?(h[g>>2]=d|0,h[g+4>>2]=M|A&0,W=0,$=0,Ln(W|0),$|0):(W=0,$=0,Ln(W|0),$|0)}while(!1);if(!b)I=E,M=0,E=0;else{G=m|0|0,O=q|_&0,I=pt(G|0,O|0,-1,-1)|0,m=Q()|0,M=E,E=0;do _=M,M=y>>>31|M<<1,y=E|y<<1,_=d<<1|_>>>31|0,q=d>>>31|A<<1|0,Ns(I|0,m|0,_|0,q|0)|0,$=Q()|0,W=$>>31|(($|0)<0?-1:0)<<1,E=W&1,d=Ns(_|0,q|0,W&G|0,((($|0)<0?-1:0)>>31|(($|0)<0?-1:0)<<1)&O|0)|0,A=Q()|0,b=b-1|0;while((b|0)!=0);I=M,M=0}return b=0,g|0&&(h[g>>2]=d,h[g+4>>2]=A),W=(y|0)>>>31|(I|b)<<1|(b<<1|y>>>31)&0|M,$=(y<<1|0)&-2|E,Ln(W|0),$|0}function id(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;return I=A>>31|((A|0)<0?-1:0)<<1,M=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,y=_>>31|((_|0)<0?-1:0)<<1,g=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=Ns(I^d|0,M^A|0,I|0,M|0)|0,b=Q()|0,d=y^I,A=g^M,Ns((M4(E,b,Ns(y^m|0,g^_|0,y|0,g|0)|0,Q()|0,0)|0)^d|0,(Q()|0)^A|0,d|0,A|0)|0}function hse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return y=d&65535,g=A&65535,m=La(g,y)|0,_=d>>>16,d=(m>>>16)+(La(g,_)|0)|0,g=A>>>16,A=La(g,y)|0,Ln((d>>>16)+(La(g,_)|0)+(((d&65535)+A|0)>>>16)|0),d+A<<16|m&65535|0|0}function lr(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return g=d,y=m,m=hse(g,y)|0,d=Q()|0,Ln((La(A,y)|0)+(La(_,g)|0)+d|d&0|0),m|0|0|0}function rd(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;return g=Y,Y=Y+16|0,E=g|0,b=A>>31|((A|0)<0?-1:0)<<1,y=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,I=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,d=Ns(b^d|0,y^A|0,b|0,y|0)|0,A=Q()|0,M4(d,A,Ns(I^m|0,M^_|0,I|0,M|0)|0,Q()|0,E)|0,_=Ns(h[E>>2]^b|0,h[E+4>>2]^y|0,b|0,y|0)|0,m=Q()|0,Y=g,Ln(m|0),_|0}function Xh(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return y=Y,Y=Y+16|0,g=y|0,M4(d,A,m,_,g)|0,Y=y,Ln(h[g+4>>2]|0),h[g>>2]|0|0}function C9(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Ln(A>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Ln(((A|0)<0?-1:0)|0),A>>m-32|0)}function et(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Ln(A>>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Ln(0),A>>>m-32|0)}function ht(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Ln(A<<m|(d&(1<<m)-1<<32-m)>>>32-m|0),d<<m):(Ln(d<<m-32|0),0)}function C4(d,A,m){return d=d|0,A=A|0,m=m|0,A=jh(A)|0,(A|0)==32&&(A=A+(jh(d)|0)|0),Ln(0),A|0}function R9(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+Iie(+d,+A)}function Kb(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+r4(+d,+A)}function Zb(d){return d=+d,d>=0?+Hs(d+.5):+$m(d-.5)}function _c(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if((m|0)>=8192)return Die(d|0,A|0,m|0)|0,d|0;if(y=d|0,g=d+m|0,(d&3)==(A&3)){for(;d&3;){if(!m)return y|0;He[d>>0]=He[A>>0]|0,d=d+1|0,A=A+1|0,m=m-1|0}for(m=g&-4|0,_=m-64|0;(d|0)<=(_|0);)h[d>>2]=h[A>>2],h[d+4>>2]=h[A+4>>2],h[d+8>>2]=h[A+8>>2],h[d+12>>2]=h[A+12>>2],h[d+16>>2]=h[A+16>>2],h[d+20>>2]=h[A+20>>2],h[d+24>>2]=h[A+24>>2],h[d+28>>2]=h[A+28>>2],h[d+32>>2]=h[A+32>>2],h[d+36>>2]=h[A+36>>2],h[d+40>>2]=h[A+40>>2],h[d+44>>2]=h[A+44>>2],h[d+48>>2]=h[A+48>>2],h[d+52>>2]=h[A+52>>2],h[d+56>>2]=h[A+56>>2],h[d+60>>2]=h[A+60>>2],d=d+64|0,A=A+64|0;for(;(d|0)<(m|0);)h[d>>2]=h[A>>2],d=d+4|0,A=A+4|0}else for(m=g-4|0;(d|0)<(m|0);)He[d>>0]=He[A>>0]|0,He[d+1>>0]=He[A+1>>0]|0,He[d+2>>0]=He[A+2>>0]|0,He[d+3>>0]=He[A+3>>0]|0,d=d+4|0,A=A+4|0;for(;(d|0)<(g|0);)He[d>>0]=He[A>>0]|0,d=d+1|0,A=A+1|0;return y|0}function R4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0;if((A|0)<(d|0)&(d|0)<(A+m|0)){for(_=d,A=A+m|0,d=d+m|0;(m|0)>0;)d=d-1|0,A=A-1|0,m=m-1|0,He[d>>0]=He[A>>0]|0;d=_}else _c(d,A,m)|0;return d|0}function sd(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;if(y=d+m|0,A=A&255,(m|0)>=67){for(;d&3;)He[d>>0]=A,d=d+1|0;for(_=y&-4|0,b=A|A<<8|A<<16|A<<24,g=_-64|0;(d|0)<=(g|0);)h[d>>2]=b,h[d+4>>2]=b,h[d+8>>2]=b,h[d+12>>2]=b,h[d+16>>2]=b,h[d+20>>2]=b,h[d+24>>2]=b,h[d+28>>2]=b,h[d+32>>2]=b,h[d+36>>2]=b,h[d+40>>2]=b,h[d+44>>2]=b,h[d+48>>2]=b,h[d+52>>2]=b,h[d+56>>2]=b,h[d+60>>2]=b,d=d+64|0;for(;(d|0)<(_|0);)h[d>>2]=b,d=d+4|0}for(;(d|0)<(y|0);)He[d>>0]=A,d=d+1|0;return y-m|0}function P9(d){return d=+d,d>=0?+Hs(d+.5):+$m(d-.5)}function od(d){d=d|0;var A=0,m=0,_=0;return _=Lie()|0,m=h[Na>>2]|0,A=m+d|0,(d|0)>0&(A|0)<(m|0)|(A|0)<0?(Oie(A|0)|0,Wk(12),-1):(A|0)>(_|0)&&!(Fie(A|0)|0)?(Wk(12),-1):(h[Na>>2]=A,m|0)}function fse(d,A,m){return d=d|0,A=A|0,m=m|0,ad[d&3](A|0,m|0)|0}function dse(d,A){return d=d|0,A=A|0,Nie(0),0}var ad=[dse,cre,ure,hre];return{___divdi3:id,___muldi3:lr,___remdi3:rd,___uremdi3:Xh,_areNeighborCells:fre,_bitshift64Ashr:C9,_bitshift64Lshr:et,_bitshift64Shl:ht,_calloc:na,_cellAreaKm2:Yie,_cellAreaM2:Kie,_cellAreaRads2:$ie,_cellToBoundary:E0,_cellToCenterChild:c9,_cellToChildPos:Nre,_cellToChildren:wre,_cellToChildrenSize:nx,_cellToLatLng:Zm,_cellToLocalIj:Hre,_cellToParent:p4,_cellToVertex:Ul,_cellToVertexes:ase,_cellsToDirectedEdge:dre,_cellsToLinkedMultiPolygon:Xie,_childPosToCell:Lre,_compactCells:Sre,_constructCell:vre,_destroyLinkedMultiPolygon:Vre,_directedEdgeToBoundary:ex,_directedEdgeToCells:mre,_edgeLengthKm:Gre,_edgeLengthM:zre,_edgeLengthRads:kre,_emscripten_replace_memory:Bie,_free:_t,_getBaseCellNumber:a9,_getDirectedEdgeDestination:Are,_getDirectedEdgeOrigin:pre,_getHexagonAreaAvgKm2:f9,_getHexagonAreaAvgM2:Ore,_getHexagonEdgeLengthAvgKm:Bre,_getHexagonEdgeLengthAvgM:Ure,_getIcosahedronFaces:u9,_getIndexDigit:yre,_getNumCells:qb,_getPentagons:x4,_getRes0Cells:tre,_getResolution:f4,_greatCircleDistanceKm:rx,_greatCircleDistanceM:Fre,_greatCircleDistanceRads:Dre,_gridDisk:jk,_gridDiskDistances:Xk,_gridDistance:b4,_gridPathCells:Xre,_gridPathCellsSize:jre,_gridRing:qie,_gridRingUnsafe:Yk,_i64Add:pt,_i64Subtract:Ns,_isPentagon:Ui,_isResClassIII:Mre,_isValidCell:Vb,_isValidDirectedEdge:i9,_isValidIndex:bre,_isValidVertex:v9,_latLngToCell:g4,_llvm_ctlz_i64:C4,_llvm_maxnum_f64:R9,_llvm_minnum_f64:Kb,_llvm_round_f64:Zb,_localIjToCell:Wre,_malloc:ar,_maxFaceCount:Pre,_maxGridDiskSize:Vie,_maxPolygonToCellsSize:Wie,_maxPolygonToCellsSizeExperimental:Kre,_memcpy:_c,_memmove:R4,_memset:sd,_originToDirectedEdges:c4,_pentagonCount:Ire,_polygonToCells:jie,_polygonToCellsExperimental:Yre,_readInt64AsDoubleFromPointer:rse,_res0CellCount:ere,_reverseDirectedEdge:r9,_round:P9,_sbrk:od,_sizeOfCellBoundary:Jre,_sizeOfCoordIJ:ise,_sizeOfGeoLoop:ese,_sizeOfGeoPolygon:tse,_sizeOfH3Index:Zre,_sizeOfLatLng:Qre,_sizeOfLinkedGeoPolygon:nse,_uncompactCells:Tre,_uncompactCellsSize:Ere,_vertexToLatLng:lse,dynCall_iii:fse,establishStackSpace:zie,stackAlloc:Uie,stackRestore:Gie,stackSave:kie}})(Dt,ct,K),jt=e.___divdi3=Ce.___divdi3,qi=e.___muldi3=Ce.___muldi3,In=e.___remdi3=Ce.___remdi3,Ur=e.___uremdi3=Ce.___uremdi3,mr=e._areNeighborCells=Ce._areNeighborCells,nl=e._bitshift64Ashr=Ce._bitshift64Ashr,ea=e._bitshift64Lshr=Ce._bitshift64Lshr,il=e._bitshift64Shl=Ce._bitshift64Shl,Pa=e._calloc=Ce._calloc,sr=e._cellAreaKm2=Ce._cellAreaKm2,Rs=e._cellAreaM2=Ce._cellAreaM2,rl=e._cellAreaRads2=Ce._cellAreaRads2,hu=e._cellToBoundary=Ce._cellToBoundary,Bb=e._cellToCenterChild=Ce._cellToCenterChild,KR=e._cellToChildPos=Ce._cellToChildPos,ZR=e._cellToChildren=Ce._cellToChildren,Z1=e._cellToChildrenSize=Ce._cellToChildrenSize,QR=e._cellToLatLng=Ce._cellToLatLng,Q1=e._cellToLocalIj=Ce._cellToLocalIj,JR=e._cellToParent=Ce._cellToParent,e4=e._cellToVertex=Ce._cellToVertex,Ok=e._cellToVertexes=Ce._cellToVertexes,Bk=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,Uk=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,kk=e._childPosToCell=Ce._childPosToCell,te=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,Le=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,De=e._directedEdgeToCells=Ce._directedEdgeToCells,zt=e._edgeLengthKm=Ce._edgeLengthKm,Yt=e._edgeLengthM=Ce._edgeLengthM,kt=e._edgeLengthRads=Ce._edgeLengthRads,tn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,hn=e._free=Ce._free,Gn=e._getBaseCellNumber=Ce._getBaseCellNumber,Xn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,pn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Bi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,kr=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Tr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,Hi=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,so=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Xt=e._getIndexDigit=Ce._getIndexDigit,Ia=e._getNumCells=Ce._getNumCells,Ai=e._getPentagons=Ce._getPentagons,sl=e._getRes0Cells=Ce._getRes0Cells,gc=e._getResolution=Ce._getResolution,qh=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,b0=e._greatCircleDistanceM=Ce._greatCircleDistanceM,Wi=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,Gr=e._gridDisk=Ce._gridDisk,Hh=e._gridDiskDistances=Ce._gridDiskDistances,er=e._gridDistance=Ce._gridDistance,Wh=e._gridPathCells=Ce._gridPathCells,w0=e._gridPathCellsSize=Ce._gridPathCellsSize,t4=e._gridRing=Ce._gridRing,e4e=e._gridRingUnsafe=Ce._gridRingUnsafe,t4e=e._i64Add=Ce._i64Add,n4e=e._i64Subtract=Ce._i64Subtract,i4e=e._isPentagon=Ce._isPentagon,r4e=e._isResClassIII=Ce._isResClassIII,s4e=e._isValidCell=Ce._isValidCell,o4e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,a4e=e._isValidIndex=Ce._isValidIndex,l4e=e._isValidVertex=Ce._isValidVertex,c4e=e._latLngToCell=Ce._latLngToCell,u4e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,h4e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,f4e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,d4e=e._llvm_round_f64=Ce._llvm_round_f64,p4e=e._localIjToCell=Ce._localIjToCell,A4e=e._malloc=Ce._malloc,m4e=e._maxFaceCount=Ce._maxFaceCount,g4e=e._maxGridDiskSize=Ce._maxGridDiskSize,_4e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,x4e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,y4e=e._memcpy=Ce._memcpy,v4e=e._memmove=Ce._memmove,b4e=e._memset=Ce._memset,w4e=e._originToDirectedEdges=Ce._originToDirectedEdges,S4e=e._pentagonCount=Ce._pentagonCount,T4e=e._polygonToCells=Ce._polygonToCells,E4e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,M4e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,C4e=e._res0CellCount=Ce._res0CellCount,R4e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,P4e=e._round=Ce._round,I4e=e._sbrk=Ce._sbrk,N4e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,L4e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,D4e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,F4e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,O4e=e._sizeOfH3Index=Ce._sizeOfH3Index,B4e=e._sizeOfLatLng=Ce._sizeOfLatLng,U4e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,k4e=e._uncompactCells=Ce._uncompactCells,G4e=e._uncompactCellsSize=Ce._uncompactCellsSize,z4e=e._vertexToLatLng=Ce._vertexToLatLng,V4e=e.establishStackSpace=Ce.establishStackSpace,Gk=e.stackAlloc=Ce.stackAlloc,Cie=e.stackRestore=Ce.stackRestore,Rie=e.stackSave=Ce.stackSave,q4e=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=C,e.setValue=v,e.getValue=w,le){Te(le)||(le=o(le));{di("memory initializer");var n4=function(Ne){Ne.byteLength&&(Ne=new Uint8Array(Ne)),j.set(Ne,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,On("memory initializer")},zk=function(){a(le,n4,function(){throw"could not load memory initializer "+le})},Vk=wt(le);if(Vk)n4(Vk.buffer);else if(e.memoryInitializerRequest){var qk=function(){var Ne=e.memoryInitializerRequest,nt=Ne.response;if(Ne.status!==200&&Ne.status!==0){var It=wt(e.memoryInitializerRequestURL);if(It)nt=It.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ne.status+", retrying "+le),zk();return}}n4(nt)};e.memoryInitializerRequest.response?setTimeout(qk,0):e.memoryInitializerRequest.addEventListener("load",qk)}else zk()}}var Ub;ge=function Ne(){Ub||i4(),Ub||(ge=Ne)};function i4(Ne){if(Ne=Ne||r,Qt>0||(Ct(),Qt>0))return;function nt(){Ub||(Ub=!0,!S&&(un(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Xe()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),nt()},1)):nt()}e.run=i4;function S0(Ne){throw e.onAbort&&e.onAbort(Ne),Ne+="",l(Ne),c(Ne),S=!0,"abort("+Ne+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=S0,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return i4(),i})(typeof hi=="object"?hi:{}),wn="number",vn=wn,Q_=wn,Tn=wn,En=wn,to=wn,qt=wn,z_e=[["sizeOfH3Index",wn],["sizeOfLatLng",wn],["sizeOfCellBoundary",wn],["sizeOfGeoLoop",wn],["sizeOfGeoPolygon",wn],["sizeOfLinkedGeoPolygon",wn],["sizeOfCoordIJ",wn],["readInt64AsDoubleFromPointer",wn],["isValidCell",Q_,[Tn,En]],["isValidIndex",Q_,[Tn,En]],["latLngToCell",vn,[wn,wn,to,qt]],["cellToLatLng",vn,[Tn,En,qt]],["cellToBoundary",vn,[Tn,En,qt]],["maxGridDiskSize",vn,[wn,qt]],["gridDisk",vn,[Tn,En,wn,qt]],["gridDiskDistances",vn,[Tn,En,wn,qt,qt]],["gridRing",vn,[Tn,En,wn,qt]],["gridRingUnsafe",vn,[Tn,En,wn,qt]],["maxPolygonToCellsSize",vn,[qt,to,wn,qt]],["polygonToCells",vn,[qt,to,wn,qt]],["maxPolygonToCellsSizeExperimental",vn,[qt,to,wn,qt]],["polygonToCellsExperimental",vn,[qt,to,wn,wn,wn,qt]],["cellsToLinkedMultiPolygon",vn,[qt,wn,qt]],["destroyLinkedMultiPolygon",null,[qt]],["compactCells",vn,[qt,qt,wn,wn]],["uncompactCells",vn,[qt,wn,wn,qt,wn,to]],["uncompactCellsSize",vn,[qt,wn,wn,to,qt]],["isPentagon",Q_,[Tn,En]],["isResClassIII",Q_,[Tn,En]],["getBaseCellNumber",wn,[Tn,En]],["getResolution",wn,[Tn,En]],["getIndexDigit",wn,[Tn,En,wn]],["constructCell",vn,[wn,wn,qt,qt]],["maxFaceCount",vn,[Tn,En,qt]],["getIcosahedronFaces",vn,[Tn,En,qt]],["cellToParent",vn,[Tn,En,to,qt]],["cellToChildren",vn,[Tn,En,to,qt]],["cellToCenterChild",vn,[Tn,En,to,qt]],["cellToChildrenSize",vn,[Tn,En,to,qt]],["cellToChildPos",vn,[Tn,En,to,qt]],["childPosToCell",vn,[wn,wn,Tn,En,to,qt]],["areNeighborCells",vn,[Tn,En,Tn,En,qt]],["cellsToDirectedEdge",vn,[Tn,En,Tn,En,qt]],["getDirectedEdgeOrigin",vn,[Tn,En,qt]],["getDirectedEdgeDestination",vn,[Tn,En,qt]],["isValidDirectedEdge",Q_,[Tn,En]],["directedEdgeToCells",vn,[Tn,En,qt]],["originToDirectedEdges",vn,[Tn,En,qt]],["directedEdgeToBoundary",vn,[Tn,En,qt]],["reverseDirectedEdge",vn,[Tn,En,qt]],["gridDistance",vn,[Tn,En,Tn,En,qt]],["gridPathCells",vn,[Tn,En,Tn,En,qt]],["gridPathCellsSize",vn,[Tn,En,Tn,En,qt]],["cellToLocalIj",vn,[Tn,En,Tn,En,wn,qt]],["localIjToCell",vn,[Tn,En,qt,wn,qt]],["getHexagonAreaAvgM2",vn,[to,qt]],["getHexagonAreaAvgKm2",vn,[to,qt]],["getHexagonEdgeLengthAvgM",vn,[to,qt]],["getHexagonEdgeLengthAvgKm",vn,[to,qt]],["greatCircleDistanceM",wn,[qt,qt]],["greatCircleDistanceKm",wn,[qt,qt]],["greatCircleDistanceRads",wn,[qt,qt]],["cellAreaM2",vn,[Tn,En,qt]],["cellAreaKm2",vn,[Tn,En,qt]],["cellAreaRads2",vn,[Tn,En,qt]],["edgeLengthM",vn,[Tn,En,qt]],["edgeLengthKm",vn,[Tn,En,qt]],["edgeLengthRads",vn,[Tn,En,qt]],["getNumCells",vn,[to,qt]],["getRes0Cells",vn,[qt]],["res0CellCount",wn],["getPentagons",vn,[wn,qt]],["pentagonCount",wn],["cellToVertex",vn,[Tn,En,wn,qt]],["cellToVertexes",vn,[Tn,En,qt]],["vertexToLatLng",vn,[Tn,En,qt]],["isValidVertex",Q_,[Tn,En]]],V_e=0,q_e=1,H_e=2,W_e=3,U$=4,j_e=5,X_e=6,$_e=7,Y_e=8,K_e=9,Z_e=10,Q_e=11,J_e=12,e1e=13,t1e=14,n1e=15,i1e=16,r1e=17,s1e=18,o1e=19,as={};as[V_e]="Success";as[q_e]="The operation failed but a more specific error is not available";as[H_e]="Argument was outside of acceptable range";as[W_e]="Latitude or longitude arguments were outside of acceptable range";as[U$]="Resolution argument was outside of acceptable range";as[j_e]="Cell argument was not valid";as[X_e]="Directed edge argument was not valid";as[$_e]="Undirected edge argument was not valid";as[Y_e]="Vertex argument was not valid";as[K_e]="Pentagon distortion was encountered";as[Z_e]="Duplicate input";as[Q_e]="Cell arguments were not neighbors";as[J_e]="Cell arguments had incompatible resolutions";as[e1e]="Memory allocation failed";as[t1e]="Bounds of provided memory were insufficient";as[n1e]="Mode or flags argument was not valid";as[i1e]="Index argument was not valid";as[r1e]="Base cell number was outside of acceptable range";as[s1e]="Child indexing digits invalid";as[o1e]="Child indexing digits refer to a deleted subsequence";var a1e=1e3,k$=1001,G$=1002,_E={};_E[a1e]="Unknown unit";_E[k$]="Array length out of bounds";_E[G$]="Got unexpected null value for H3 index";var l1e="Unknown error";function z$(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||l1e)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function V$(i,e){var t=arguments.length===2?{value:e}:{};return z$(as,i,t)}function q$(i,e){var t=arguments.length===2?{value:e}:{};return z$(_E,i,t)}function xv(i){if(i!==0)throw V$(i)}var Ka={};z_e.forEach(function(e){Ka[e[0]]=hi.cwrap.apply(hi,e)});var J_=16;var yv=4;var e1=8,c1e=8,mE=Ka.sizeOfH3Index(),P6=Ka.sizeOfLatLng(),u1e=Ka.sizeOfCellBoundary(),h1e=Ka.sizeOfGeoPolygon(),_v=Ka.sizeOfGeoLoop(),KQe=Ka.sizeOfLinkedGeoPolygon(),ZQe=Ka.sizeOfCoordIJ();function f1e(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw V$(U$,i);return i}function d1e(i){if(!i)throw q$(G$);return i}var p1e=Math.pow(2,32)-1,QQe=Math.pow(2,31)-1;function A1e(i){if(i>p1e)throw q$(k$,i);return i}var m1e=/[^0-9a-fA-F]/;function H$(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||m1e.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),J_),t=parseInt(i.substring(i.length-8),J_);return[t,e]}function O$(i){if(i>=0)return i.toString(J_);i=i&2147483647;var e=W$(8,i.toString(J_)),t=(parseInt(e[0],J_)+8).toString(J_);return e=t+e.substring(1),e}function g1e(i,e){return O$(e)+W$(8,O$(i))}function W$(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var JQe=Math.pow(2,32);function B$(i,e,t){for(var n=i.length,r=hi._calloc(n,P6),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)hi.HEAPF64.set([i[a/2][s],i[a/2][o]].map(Y$),r/e1+a);return hi.HEAPU32.set([n,r],e/yv),e}function _1e(i,e){var t=i.length-1,n=hi._calloc(h1e),r=0,s=r+_v,o=s+yv;B$(i[0],n+r,e);var a;if(t>0){a=hi._calloc(t,_v);for(var l=0;l<t;l++)B$(i[l+1],a+_v*l,e)}return hi.setValue(n+s,t,"i32"),hi.setValue(n+o,a,"i32"),n}function x1e(i){var e=0,t=e+_v,n=t+yv,r=yv;hi._free(hi.getValue(i+e+r,"i8*"));var s=hi.getValue(i+t,"i32");if(s>0){for(var o=hi.getValue(i+n,"i32"),a=0;a<s;a++)hi._free(hi.getValue(o+_v*a+r,"i8*"));hi._free(o)}hi._free(i)}function j$(i,e){e===void 0&&(e=0);var t=hi.getValue(i+mE*e,"i32"),n=hi.getValue(i+mE*e+yv,"i32");return n?g1e(t,n):null}function y1e(i){return Ka.readInt64AsDoubleFromPointer(i)}function v1e(i,e){for(var t=[],n=0;n<e;n++){var r=j$(i,n);r!==null&&t.push(r)}return t}function gE(i){return S1e(hi.getValue(i,"double"))}function X$(i){return[gE(i),gE(i+e1)]}function b1e(i){return[gE(i+e1),gE(i)]}function w1e(i,e,t){for(var n=hi.getValue(i,"i32"),r=i+e1,s=[],o=e?b1e:X$,a=0;a<n*2;a+=2)s.push(o(r+e1*a));return t&&s.push(s[0]),s}function $$(i,e,t){var n=hi._malloc(P6);hi.HEAPF64.set([i,e].map(Y$),n/e1);var r=hi._malloc(mE);try{return xv(Ka.latLngToCell(n,t,r)),d1e(j$(r))}finally{hi._free(r),hi._free(n)}}function I6(i){var e=hi._malloc(P6),t=H$(i),n=t[0],r=t[1];try{return xv(Ka.cellToLatLng(n,r,e)),X$(e)}finally{hi._free(e)}}function N6(i,e){var t=hi._malloc(u1e),n=H$(i),r=n[0],s=n[1];try{return xv(Ka.cellToBoundary(r,s,t)),w1e(t,e,e)}finally{hi._free(t)}}function L6(i,e,t){if(f1e(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=_1e(n,t),s=hi._malloc(c1e);try{xv(Ka.maxPolygonToCellsSize(r,e,0,s));var o=A1e(y1e(s)),a=hi._calloc(o,mE);try{return xv(Ka.polygonToCells(r,e,0,a)),v1e(a,o)}finally{hi._free(a)}}finally{hi._free(s),x1e(r)}}function Y$(i){return i*Math.PI/180}function S1e(i){return i*180/Math.PI}function D6(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}var T1e=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],K$=new WeakMap,Z$=new WeakMap,Q$=new WeakMap,x8=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=T1e,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,object:r}=e;if(t={geometryId:n.id,worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}let{environmentIntensity:s,environmentRotation:o}=e.scene;t.environmentIntensity=s,t.environmentRotation=o.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.isInterleavedBufferAttribute?r.data.uuid:r.id,version:r.isInterleavedBufferAttribute?r.data.version:r.version}}return t}containsNode(e){let t=e.material;for(let n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Q$.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Q$.set(e,t)),t}getMaterialData(e){let t=Z$.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:0}:t[n]=r.clone():t[n]=r)}Z$.set(e,t)}return t}equals(e,t,n){let{object:r,material:s,geometry:o}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(r.matrixWorld)!==!0)return a.worldMatrix.copy(r.matrixWorld),!1;let l=this.getMaterialData(e.material);if(l._renderId!==n){l._renderId=n;for(let f in l){let p=l[f],x=s[f];if(f!=="_renderId"&&f!=="_equal"){if(p.equals!==void 0){if(p.equals(x)===!1)return p.copy(x),l._equal=!1,!1}else if(x.isTexture===!0){if(p.id!==x.id||p.version!==x.version)return p.id=x.id,p.version=x.version,l._equal=!1,!1}else if(p!==x)return l[f]=x,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:p}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==p)return a.bufferWidth=f,a.bufferHeight=p,l._equal=!1,!1}l._equal=!0}else if(l._equal===!1)return!1;if(a.geometryId!==o.id)return a.geometryId=o.id,!1;let c=this.getGeometryData(e.geometry);if(c._renderId!==n){c._renderId=n;let f=o.attributes,p=c.attributes,x=0,v=0;for(let C in f)x++;for(let C in p){v++;let L=p[C],D=f[C];if(D===void 0)return delete p[C],c._equal=!1,!1;let F=D.isInterleavedBufferAttribute?D.data.uuid:D.id,N=D.isInterleavedBufferAttribute?D.data.version:D.version;if(L.id!==F||L.version!==N)return L.id=F,L.version=N,c._equal=!1,!1}if(v!==x)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,P=w?w.id:null,R=w?w.version:null;if(S!==P||T!==R)return c.indexId=P,c.indexVersion=R,c._equal=!1,!1;if(c.drawRange.start!==o.drawRange.start||c.drawRange.count!==o.drawRange.count)return c.drawRange.start=o.drawRange.start,c.drawRange.count=o.drawRange.count,c._equal=!1,!1;c._equal=!0}else if(c._equal===!1)return!1;if(a.morphTargetInfluences){let f=!1;for(let p=0;p<a.morphTargetInfluences.length;p++)a.morphTargetInfluences[p]!==r.morphTargetInfluences[p]&&(a.morphTargetInfluences[p]=r.morphTargetInfluences[p],f=!0);if(f)return!1}if(a.lights){for(let f=0;f<t.length;f++)if(a.lights[f].map!==t[f].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(a.environmentIntensity!==u.environmentIntensity||a.environmentRotation.equals(u.environmentRotation)===!1)?(a.environmentIntensity=u.environmentIntensity,a.environmentRotation.copy(u.environmentRotation),!1):a.center&&a.center.equals(r.center)===!1?(a.center.copy(r.center),!1):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){let n=K$.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},K$.set(e,n)),n.renderId===t||(n.renderId=t,this.getLightsData(e.getLights(),n.lightsData)),n.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;let o=this.getLights(e.lightsNode,n);return this.equals(e,o,n)!==!0}},E1e=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function M1e(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4130-`).map(t=>{let n=t.match(e);if(!n)return null;let r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!E1e.some(n=>n.test(t.file)))}var Fr=class{constructor(e=null){this.isStackTrace=!0,this.stack=M1e(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(n=>{let r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(`4116+}`,UL=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new vy(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new jr({vertexShader:jpe,fragmentShader:Xpe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new SA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},kL=class extends Go{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,p=null,x=null,v=null,w=typeof XRWebGLBinding<"u",S=new UL,T={},P=t.getContextAttributes(),R=null,C=null,L=[],D=[],F=new Oe,N=null,B=new Rr;B.viewport=new gn;let z=new Rr;z.viewport=new gn;let V=[B,z],H=new v_,Z=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Me){let ze=L[Me];return ze===void 0&&(ze=new qd,L[Me]=ze),ze.getTargetRaySpace()},this.getControllerGrip=function(Me){let ze=L[Me];return ze===void 0&&(ze=new qd,L[Me]=ze),ze.getGripSpace()},this.getHand=function(Me){let ze=L[Me];return ze===void 0&&(ze=new qd,L[Me]=ze),ze.getHandSpace()};function j(Me){let ze=D.indexOf(Me.inputSource);if(ze===-1)return;let $e=L[ze];$e!==void 0&&($e.update(Me.inputSource,Me.frame,c||o),$e.dispatchEvent({type:Me.type,data:Me.inputSource}))}function K(){r.removeEventListener("select",j),r.removeEventListener("selectstart",j),r.removeEventListener("selectend",j),r.removeEventListener("squeeze",j),r.removeEventListener("squeezestart",j),r.removeEventListener("squeezeend",j),r.removeEventListener("end",K),r.removeEventListener("inputsourceschange",ee);for(let Me=0;Me<L.length;Me++){let ze=D[Me];ze!==null&&(D[Me]=null,L[Me].disconnect(ze))}Z=null,J=null,S.reset();for(let Me in T)delete T[Me];e.setRenderTarget(R),x=null,p=null,f=null,r=null,C=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(N),e.setSize(F.width,F.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Me){s=Me,n.isPresenting===!0&&je("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Me){a=Me,n.isPresenting===!0&&je("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Me){c=Me},this.getBaseLayer=function(){return p!==null?p:x},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(Me){if(r=Me,r!==null){if(R=e.getRenderTarget(),r.addEventListener("select",j),r.addEventListener("selectstart",j),r.addEventListener("selectend",j),r.addEventListener("squeeze",j),r.addEventListener("squeezestart",j),r.addEventListener("squeezeend",j),r.addEventListener("end",K),r.addEventListener("inputsourceschange",ee),P.xrCompatible!==!0&&await t.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(F),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let $e=null,Et=null,Tt=null;P.depth&&(Tt=P.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,$e=P.stencil?Qs:ys,Et=P.stencil?zo:pi);let Ct={colorFormat:t.RGBA8,depthFormat:Tt,scaleFactor:s};f=this.getBinding(),p=f.createProjectionLayer(Ct),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),C=new ua(p.textureWidth,p.textureHeight,{format:xr,type:Gi,depthTexture:new os(p.textureWidth,p.textureHeight,Et,void 0,void 0,void 0,void 0,void 0,void 0,$e),stencilBuffer:P.stencil,colorSpace:e.outputColorSpace,samples:P.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{let $e={antialias:P.antialias,alpha:!0,depth:P.depth,stencil:P.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(r,t,$e),r.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),C=new ua(x.framebufferWidth,x.framebufferHeight,{format:xr,type:Gi,colorSpace:e.outputColorSpace,stencilBuffer:P.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}C.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),mt.setContext(r),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function ee(Me){for(let ze=0;ze<Me.removed.length;ze++){let $e=Me.removed[ze],Et=D.indexOf($e);Et>=0&&(D[Et]=null,L[Et].disconnect($e))}for(let ze=0;ze<Me.added.length;ze++){let $e=Me.added[ze],Et=D.indexOf($e);if(Et===-1){for(let Ct=0;Ct<L.length;Ct++)if(Ct>=D.length){D.push($e),Et=Ct;break}else if(D[Ct]===null){D[Ct]=$e,Et=Ct;break}if(Et===-1)break}let Tt=L[Et];Tt&&Tt.connect($e)}}let ae=new ie,ce=new ie;function de(Me,ze,$e){ae.setFromMatrixPosition(ze.matrixWorld),ce.setFromMatrixPosition($e.matrixWorld);let Et=ae.distanceTo(ce),Tt=ze.projectionMatrix.elements,Ct=$e.projectionMatrix.elements,un=Tt[14]/(Tt[10]-1),Gt=Tt[14]/(Tt[10]+1),Xe=(Tt[9]+1)/Tt[5],st=(Tt[9]-1)/Tt[5],tt=(Tt[8]-1)/Tt[0],vt=(Ct[8]+1)/Ct[0],yt=un*tt,ln=un*vt,Kt=Et/(-tt+vt),Qt=Kt*-tt;if(ze.matrixWorld.decompose(Me.position,Me.quaternion,Me.scale),Me.translateX(Qt),Me.translateZ(Kt),Me.matrixWorld.compose(Me.position,Me.quaternion,Me.scale),Me.matrixWorldInverse.copy(Me.matrixWorld).invert(),Tt[10]===-1)Me.projectionMatrix.copy(ze.projectionMatrix),Me.projectionMatrixInverse.copy(ze.projectionMatrixInverse);else{let xn=un+Kt,ge=Gt+Kt,di=yt-Qt,On=ln+(Et-Qt),le=Xe*Gt/ge*xn,X=st*Gt/ge*xn;Me.projectionMatrix.makePerspective(di,On,le,X,xn,ge),Me.projectionMatrixInverse.copy(Me.projectionMatrix).invert()}}function ve(Me,ze){ze===null?Me.matrixWorld.copy(Me.matrix):Me.matrixWorld.multiplyMatrices(ze.matrixWorld,Me.matrix),Me.matrixWorldInverse.copy(Me.matrixWorld).invert()}this.updateCamera=function(Me){if(r===null)return;let ze=Me.near,$e=Me.far;S.texture!==null&&(S.depthNear>0&&(ze=S.depthNear),S.depthFar>0&&($e=S.depthFar)),H.near=z.near=B.near=ze,H.far=z.far=B.far=$e,(Z!==H.near||J!==H.far)&&(r.updateRenderState({depthNear:H.near,depthFar:H.far}),Z=H.near,J=H.far),H.layers.mask=Me.layers.mask|6,B.layers.mask=H.layers.mask&-5,z.layers.mask=H.layers.mask&-3;let Et=Me.parent,Tt=H.cameras;ve(H,Et);for(let Ct=0;Ct<Tt.length;Ct++)ve(Tt[Ct],Et);Tt.length===2?de(H,B,z):H.projectionMatrix.copy(B.projectionMatrix),Ie(Me,H,Et)};function Ie(Me,ze,$e){$e===null?Me.matrix.copy(ze.matrixWorld):(Me.matrix.copy($e.matrixWorld),Me.matrix.invert(),Me.matrix.multiply(ze.matrixWorld)),Me.matrix.decompose(Me.position,Me.quaternion,Me.scale),Me.updateMatrixWorld(!0),Me.projectionMatrix.copy(ze.projectionMatrix),Me.projectionMatrixInverse.copy(ze.projectionMatrixInverse),Me.isPerspectiveCamera&&(Me.fov=Ef*2*Math.atan(1/Me.projectionMatrix.elements[5]),Me.zoom=1)}this.getCamera=function(){return H},this.getFoveation=function(){if(!(p===null&&x===null))return l},this.setFoveation=function(Me){l=Me,p!==null&&(p.fixedFoveation=Me),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=Me)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(H)},this.getCameraTexture=function(Me){return T[Me]};let Qe=null;function Ue(Me,ze){if(u=ze.getViewerPose(c||o),v=ze,u!==null){let $e=u.views;x!==null&&(e.setRenderTargetFramebuffer(C,x.framebuffer),e.setRenderTarget(C));let Et=!1;$e.length!==H.cameras.length&&(H.cameras.length=0,Et=!0);for(let Gt=0;Gt<$e.length;Gt++){let Xe=$e[Gt],st=null;if(x!==null)st=x.getViewport(Xe);else{let vt=f.getViewSubImage(p,Xe);st=vt.viewport,Gt===0&&(e.setRenderTargetTextures(C,vt.colorTexture,vt.depthStencilTexture),e.setRenderTarget(C))}let tt=V[Gt];tt===void 0&&(tt=new Rr,tt.layers.enable(Gt),tt.viewport=new gn,V[Gt]=tt),tt.matrix.fromArray(Xe.transform.matrix),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.projectionMatrix.fromArray(Xe.projectionMatrix),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert(),tt.viewport.set(st.x,st.y,st.width,st.height),Gt===0&&(H.matrix.copy(tt.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale)),Et===!0&&H.cameras.push(tt)}let Tt=r.enabledFeatures;if(Tt&&Tt.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation($e[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Tt&&Tt.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<$e.length;Gt++){let Xe=$e[Gt].camera;if(Xe){let st=T[Xe];st||(st=new vy,T[Xe]=st);let tt=f.getCameraImage(Xe);st.sourceTexture=tt}}}}for(let $e=0;$e<L.length;$e++){let Et=D[$e],Tt=L[$e];Et!==null&&Tt!==void 0&&Tt.update(Et,ze,c||o)}Qe&&Qe(Me,ze),ze.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ze}),v=null}let mt=new wW;mt.setAnimationLoop(Ue),this.setAnimationLoop=function(Me){Qe=Me},this.dispose=function(){}}},$pe=new on,RW=new Sn;RW.set(-1,0,0,0,1,0,0,0,1);function Ype(i,e){function t(S,T){S.matrixAutoUpdate===!0&&S.updateMatrix(),T.value.copy(S.matrix)}function n(S,T){T.color.getRGB(S.fogColor.value,gL(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,P,R,C){T.isNodeMaterial?T.uniformsNeedUpdate=!1:T.isMeshBasicMaterial?s(S,T):T.isMeshLambertMaterial?(s(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshToonMaterial?(s(S,T),f(S,T)):T.isMeshPhongMaterial?(s(S,T),u(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshStandardMaterial?(s(S,T),p(S,T),T.isMeshPhysicalMaterial&&x(S,T,C)):T.isMeshMatcapMaterial?(s(S,T),v(S,T)):T.isMeshDepthMaterial?s(S,T):T.isMeshDistanceMaterial?(s(S,T),w(S,T)):T.isMeshNormalMaterial?s(S,T):T.isLineBasicMaterial?(o(S,T),T.isLineDashedMaterial&&a(S,T)):T.isPointsMaterial?l(S,T,P,R):T.isSpriteMaterial?c(S,T):T.isShadowMaterial?(S.color.value.copy(T.color),S.opacity.value=T.opacity):T.isShaderMaterial&&(T.uniformsNeedUpdate=!1)}function s(S,T){S.opacity.value=T.opacity,T.color&&S.diffuse.value.copy(T.color),T.emissive&&S.emissive.value.copy(T.emissive).multiplyScalar(T.emissiveIntensity),T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.bumpMap&&(S.bumpMap.value=T.bumpMap,t(T.bumpMap,S.bumpMapTransform),S.bumpScale.value=T.bumpScale,T.side===ui&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===ui&&S.normalScale.value.negate()),T.displacementMap&&(S.displacementMap.value=T.displacementMap,t(T.displacementMap,S.displacementMapTransform),S.displacementScale.value=T.displacementScale,S.displacementBias.value=T.displacementBias),T.emissiveMap&&(S.emissiveMap.value=T.emissiveMap,t(T.emissiveMap,S.emissiveMapTransform)),T.specularMap&&(S.specularMap.value=T.specularMap,t(T.specularMap,S.specularMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest);let P=e.get(T),R=P.envMap,C=P.envMapRotation;R&&(S.envMap.value=R,S.envMapRotation.value.setFromMatrix4($pe.makeRotationFromEuler(C)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(RW),S.reflectivity.value=T.reflectivity,S.ior.value=T.ior,S.refractionRatio.value=T.refractionRatio),T.lightMap&&(S.lightMap.value=T.lightMap,S.lightMapIntensity.value=T.lightMapIntensity,t(T.lightMap,S.lightMapTransform)),T.aoMap&&(S.aoMap.value=T.aoMap,S.aoMapIntensity.value=T.aoMapIntensity,t(T.aoMap,S.aoMapTransform))}function o(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform))}function a(S,T){S.dashSize.value=T.dashSize,S.totalSize.value=T.dashSize+T.gapSize,S.scale.value=T.scale}function l(S,T,P,R){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*P,S.scale.value=R*.5,T.map&&(S.map.value=T.map,t(T.map,S.uvTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function c(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.rotation.value=T.rotation,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function u(S,T){S.specular.value.copy(T.specular),S.shininess.value=Math.max(T.shininess,1e-4)}function f(S,T){T.gradientMap&&(S.gradientMap.value=T.gradientMap)}function p(S,T){S.metalness.value=T.metalness,T.metalnessMap&&(S.metalnessMap.value=T.metalnessMap,t(T.metalnessMap,S.metalnessMapTransform)),S.roughness.value=T.roughness,T.roughnessMap&&(S.roughnessMap.value=T.roughnessMap,t(T.roughnessMap,S.roughnessMapTransform)),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)}function x(S,T,P){S.ior.value=T.ior,T.sheen>0&&(S.sheenColor.value.copy(T.sheenColor).multiplyScalar(T.sheen),S.sheenRoughness.value=T.sheenRoughness,T.sheenColorMap&&(S.sheenColorMap.value=T.sheenColorMap,t(T.sheenColorMap,S.sheenColorMapTransform)),T.sheenRoughnessMap&&(S.sheenRoughnessMap.value=T.sheenRoughnessMap,t(T.sheenRoughnessMap,S.sheenRoughnessMapTransform))),T.clearcoat>0&&(S.clearcoat.value=T.clearcoat,S.clearcoatRoughness.value=T.clearcoatRoughness,T.clearcoatMap&&(S.clearcoatMap.value=T.clearcoatMap,t(T.clearcoatMap,S.clearcoatMapTransform)),T.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=T.clearcoatRoughnessMap,t(T.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),T.clearcoatNormalMap&&(S.clearcoatNormalMap.value=T.clearcoatNormalMap,t(T.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(T.clearcoatNormalScale),T.side===ui&&S.clearcoatNormalScale.value.negate())),T.dispersion>0&&(S.dispersion.value=T.dispersion),T.iridescence>0&&(S.iridescence.value=T.iridescence,S.iridescenceIOR.value=T.iridescenceIOR,S.iridescenceThicknessMinimum.value=T.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=T.iridescenceThicknessRange[1],T.iridescenceMap&&(S.iridescenceMap.value=T.iridescenceMap,t(T.iridescenceMap,S.iridescenceMapTransform)),T.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=T.iridescenceThicknessMap,t(T.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),T.transmission>0&&(S.transmission.value=T.transmission,S.transmissionSamplerMap.value=P.texture,S.transmissionSamplerSize.value.set(P.width,P.height),T.transmissionMap&&(S.transmissionMap.value=T.transmissionMap,t(T.transmissionMap,S.transmissionMapTransform)),S.thickness.value=T.thickness,T.thicknessMap&&(S.thicknessMap.value=T.thicknessMap,t(T.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=T.attenuationDistance,S.attenuationColor.value.copy(T.attenuationColor)),T.anisotropy>0&&(S.anisotropyVector.value.set(T.anisotropy*Math.cos(T.anisotropyRotation),T.anisotropy*Math.sin(T.anisotropyRotation)),T.anisotropyMap&&(S.anisotropyMap.value=T.anisotropyMap,t(T.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=T.specularIntensity,S.specularColor.value.copy(T.specularColor),T.specularColorMap&&(S.specularColorMap.value=T.specularColorMap,t(T.specularColorMap,S.specularColorMapTransform)),T.specularIntensityMap&&(S.specularIntensityMap.value=T.specularIntensityMap,t(T.specularIntensityMap,S.specularIntensityMapTransform))}function v(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let P=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(P.matrixWorld),S.nearDistance.value=P.shadow.camera.near,S.farDistance.value=P.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Zpe(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(C,L){let D=L.program;n.uniformBlockBinding(C,D)}function c(C,L){let D=r[C.id];D===void 0&&(S(C),D=u(C),r[C.id]=D,C.addEventListener("dispose",P));let F=L.program;n.updateUBOMapping(C,F);let N=e.render.frame;s[C.id]!==N&&(p(C),s[C.id]=N)}function u(C){let L=f();C.__bindingPointIndex=L;let D=i.createBuffer(),F=C.__size,N=C.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,F,N),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,L,D),D}function f(){for(let C=0;C<a;C++)if(o.indexOf(C)===-1)return o.push(C),C;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(C){let L=r[C.id],D=C.uniforms,F=C.__cache;i.bindBuffer(i.UNIFORM_BUFFER,L);for(let N=0,B=D.length;N<B;N++){let z=D[N];if(Array.isArray(z))for(let V=0,H=z.length;V<H;V++)x(z[V],N,V,F);else x(z,N,0,F)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function x(C,L,D,F){if(w(C,L,D,F)===!0){let N=C.__offset,B=C.value;if(Array.isArray(B)){let z=0;for(let V=0;V<B.length;V++){let H=B[V],Z=T(H);v(H,C.__data,z),typeof H!="number"&&typeof H!="boolean"&&!H.isMatrix3&&!ArrayBuffer.isView(H)&&(z+=Z.storage/Float32Array.BYTES_PER_ELEMENT)}}else v(B,C.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,N,C.__data)}}function v(C,L,D){typeof C=="number"||typeof C=="boolean"?L[0]=C:C.isMatrix3?(L[0]=C.elements[0],L[1]=C.elements[1],L[2]=C.elements[2],L[3]=0,L[4]=C.elements[3],L[5]=C.elements[4],L[6]=C.elements[5],L[7]=0,L[8]=C.elements[6],L[9]=C.elements[7],L[10]=C.elements[8],L[11]=0):ArrayBuffer.isView(C)?L.set(new C.constructor(C.buffer,C.byteOffset,L.length)):C.toArray(L,D)}function w(C,L,D,F){let N=C.value,B=L+"_"+D;if(F[B]===void 0)return typeof N=="number"||typeof N=="boolean"?F[B]=N:ArrayBuffer.isView(N)?F[B]=N.slice():F[B]=N.clone(),!0;{let z=F[B];if(typeof N=="number"||typeof N=="boolean"){if(z!==N)return F[B]=N,!0}else{if(ArrayBuffer.isView(N))return!0;if(z.equals(N)===!1)return z.copy(N),!0}}return!1}function S(C){let L=C.uniforms,D=0,F=16;for(let B=0,z=L.length;B<z;B++){let V=Array.isArray(L[B])?L[B]:[L[B]];for(let H=0,Z=V.length;H<Z;H++){let J=V[H],j=Array.isArray(J.value)?J.value:[J.value];for(let K=0,ee=j.length;K<ee;K++){let ae=j[K],ce=T(ae),de=D%F,ve=de%ce.boundary,Ie=de+ve;D+=ve,Ie!==0&&F-Ie<ce.storage&&(D+=F-Ie),J.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=D,D+=ce.storage}}}let N=D%F;return N>0&&(D+=F-N),C.__size=D,C.__cache={},this}function T(C){let L={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(L.boundary=4,L.storage=4):C.isVector2?(L.boundary=8,L.storage=8):C.isVector3||C.isColor?(L.boundary=16,L.storage=12):C.isVector4?(L.boundary=16,L.storage=16):C.isMatrix3?(L.boundary=48,L.storage=48):C.isMatrix4?(L.boundary=64,L.storage=64):C.isTexture?je("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(C)?(L.boundary=16,L.storage=C.byteLength):je("WebGLRenderer: Unsupported uniform value type.",C),L}function P(C){let L=C.target;L.removeEventListener("dispose",P);let D=o.indexOf(L.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function R(){for(let C in r)i.deleteBuffer(r[C]);o=[],r={},s={}}return{bind:l,update:c,dispose:R}}var Kpe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),nh=null;function Qpe(){return nh===null&&(nh=new xA(Kpe,16,16,Ss,Li),nh.name="DFG_LUT",nh.minFilter=vi,nh.magFilter=vi,nh.wrapS=ko,nh.wrapT=ko,nh.generateMipmaps=!1,nh.needsUpdate=!0),nh}var JT=class{constructor(e={}){let{canvas:t=$T(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:p=!1,outputBufferType:x=Gi}=e;this.isWebGLRenderer=!0;let v;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");v=n.getContextAttributes().alpha}else v=o;let w=x,S=new Set([ip,$u,Xu]),T=new Set([Gi,pi,Wa,zo,IA,NA]),P=new Uint32Array(4),R=new Int32Array(4),C=new ie,L=null,D=null,F=[],N=[],B=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ks,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let z=this,V=!1,H=null,Z=null,J=null,j=null;this._outputColorSpace=Wr;let K=0,ee=0,ae=null,ce=-1,de=null,ve=new gn,Ie=new gn,Qe=null,Ue=new Ut(0),mt=0,Me=t.width,ze=t.height,$e=1,Et=null,Tt=null,Ct=new gn(0,0,Me,ze),un=new gn(0,0,Me,ze),Gt=!1,Xe=new Zl,st=!1,tt=!1,vt=new on,yt=new ie,ln=new gn,Kt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Qt=!1;function xn(){return ae===null?$e:1}let ge=n;function di(te,Se){return t.getContext(te,Se)}try{let te={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"185"}`),t.addEventListener("webglcontextlost",qi,!1),t.addEventListener("webglcontextrestored",In,!1),t.addEventListener("webglcontextcreationerror",Ur,!1),ge===null){let Se="webgl2";if(ge=di(Se,te),ge===null)throw di(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(te){throw Ge("WebGLRenderer: "+te.message),te}let On,le,X,Te,Pe,Ve,gt,St,qe,Ke,Rt,en,Pt,Mt,cn,yn,Rn,xe,bt,Ye,wt,Dt,ct;function Ce(){On=new sde(ge),On.init(),wt=new Wpe(ge,On),le=new Kfe(ge,On,e,wt),X=new qpe(ge,On),le.reversedDepthBuffer&&p&&X.buffers.depth.setReversed(!0),Z=ge.createFramebuffer(),J=ge.createFramebuffer(),j=ge.createFramebuffer(),Te=new lde(ge),Pe=new Rpe,Ve=new Hpe(ge,On,X,Pe,le,wt,Te),gt=new rde(z),St=new fue(ge),Dt=new Yfe(ge,St),qe=new ode(ge,St,Te,Dt),Ke=new ude(ge,qe,St,Dt,Te),xe=new cde(ge,le,Ve),cn=new Qfe(Pe),Rt=new Cpe(z,gt,On,le,Dt,cn),en=new Ype(z,Pe),Pt=new Ipe,Mt=new Bpe(On),Rn=new $fe(z,gt,X,Ke,v,l),yn=new Vpe(z,Ke,le),ct=new Zpe(ge,Te,le,X),bt=new Zfe(ge,On,Te),Ye=new ade(ge,On,Te),Te.programs=Rt.programs,z.capabilities=le,z.extensions=On,z.properties=Pe,z.renderLists=Pt,z.shadowMap=yn,z.state=X,z.info=Te}Ce(),w!==Gi&&(B=new fde(w,t.width,t.height,a,r,s));let jt=new kL(z,ge);this.xr=jt,this.getContext=function(){return ge},this.getContextAttributes=function(){return ge.getContextAttributes()},this.forceContextLoss=function(){let te=On.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){let te=On.get("WEBGL_lose_context");te&&te.restoreContext()},this.getPixelRatio=function(){return $e},this.setPixelRatio=function(te){te!==void 0&&($e=te,this.setSize(Me,ze,!1))},this.getSize=function(te){return te.set(Me,ze)},this.setSize=function(te,Se,ke=!0){if(jt.isPresenting){je("WebGLRenderer: Can't change size while VR device is presenting.");return}Me=te,ze=Se,t.width=Math.floor(te*$e),t.height=Math.floor(Se*$e),ke===!0&&(t.style.width=te+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,te,Se)},this.getDrawingBufferSize=function(te){return te.set(Me*$e,ze*$e).floor()},this.setDrawingBufferSize=function(te,Se,ke){Me=te,ze=Se,$e=ke,t.width=Math.floor(te*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,te,Se)},this.setEffects=function(te){if(w===Gi){Ge("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(te){for(let Se=0;Se<te.length;Se++)if(te[Se].isOutputPass===!0){je("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(te||[])},this.getCurrentViewport=function(te){return te.copy(ve)},this.getViewport=function(te){return te.copy(Ct)},this.setViewport=function(te,Se,ke,Le){te.isVector4?Ct.set(te.x,te.y,te.z,te.w):Ct.set(te,Se,ke,Le),X.viewport(ve.copy(Ct).multiplyScalar($e).round())},this.getScissor=function(te){return te.copy(un)},this.setScissor=function(te,Se,ke,Le){te.isVector4?un.set(te.x,te.y,te.z,te.w):un.set(te,Se,ke,Le),X.scissor(Ie.copy(un).multiplyScalar($e).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(te){X.setScissorTest(Gt=te)},this.setOpaqueSort=function(te){Et=te},this.setTransparentSort=function(te){Tt=te},this.getClearColor=function(te){return te.copy(Rn.getClearColor())},this.setClearColor=function(){Rn.setClearColor(...arguments)},this.getClearAlpha=function(){return Rn.getClearAlpha()},this.setClearAlpha=function(){Rn.setClearAlpha(...arguments)},this.clear=function(te=!0,Se=!0,ke=!0){let Le=0;if(te){let De=!1;if(ae!==null){let zt=ae.texture.format;De=S.has(zt)}if(De){let zt=ae.texture.type,Yt=T.has(zt),kt=Rn.getClearColor(),tn=Rn.getClearAlpha(),hn=kt.r,Gn=kt.g,Xn=kt.b;Yt?(P[0]=hn,P[1]=Gn,P[2]=Xn,P[3]=tn,ge.clearBufferuiv(ge.COLOR,0,P)):(R[0]=hn,R[1]=Gn,R[2]=Xn,R[3]=tn,ge.clearBufferiv(ge.COLOR,0,R))}else Le|=ge.COLOR_BUFFER_BIT}Se&&(Le|=ge.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(Le|=ge.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Le!==0&&ge.clear(Le)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(te){te.setRenderer(this),H=te},this.dispose=function(){t.removeEventListener("webglcontextlost",qi,!1),t.removeEventListener("webglcontextrestored",In,!1),t.removeEventListener("webglcontextcreationerror",Ur,!1),Rn.dispose(),Pt.dispose(),Mt.dispose(),Pe.dispose(),gt.dispose(),Ke.dispose(),Dt.dispose(),ct.dispose(),Rt.dispose(),jt.dispose(),jt.removeEventListener("sessionstart",Rs),jt.removeEventListener("sessionend",sl),hu.stop()};function qi(te){te.preventDefault(),AA("WebGLRenderer: Context Lost."),V=!0}function In(){AA("WebGLRenderer: Context Restored."),V=!1;let te=Te.autoReset,Se=yn.enabled,ke=yn.autoUpdate,Le=yn.needsUpdate,De=yn.type;Ce(),Te.autoReset=te,yn.enabled=Se,yn.autoUpdate=ke,yn.needsUpdate=Le,yn.type=De}function Ur(te){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function mr(te){let Se=te.target;Se.removeEventListener("dispose",mr),il(Se)}function il(te){ta(te),Pe.remove(te)}function ta(te){let Se=Pe.get(te).programs;Se!==void 0&&(Se.forEach(function(ke){Rt.releaseProgram(ke)}),te.isShaderMaterial&&Rt.releaseShaderCache(te))}this.renderBufferDirect=function(te,Se,ke,Le,De,zt){Se===null&&(Se=Kt);let Yt=De.isMesh&&De.matrixWorld.determinantAffine()<0,kt=kk(te,Se,ke,Le,De);X.setMaterial(Le,Yt);let tn=ke.index,hn=1;if(Le.wireframe===!0){if(tn=qe.getWireframeAttribute(ke),tn===void 0)return;hn=2}let Gn=ke.drawRange,Xn=ke.attributes.position,pn=Gn.start*hn,Bi=(Gn.start+Gn.count)*hn;zt!==null&&(pn=Math.max(pn,zt.start*hn),Bi=Math.min(Bi,(zt.start+zt.count)*hn)),tn!==null?(pn=Math.max(pn,0),Bi=Math.min(Bi,tn.count)):Xn!=null&&(pn=Math.max(pn,0),Bi=Math.min(Bi,Xn.count));let kr=Bi-pn;if(kr<0||kr===1/0)return;Dt.setup(De,Le,kt,ke,tn);let Tr,Hi=bt;if(tn!==null&&(Tr=St.get(tn),Hi=Ye,Hi.setIndex(Tr)),De.isMesh)Le.wireframe===!0?(X.setLineWidth(Le.wireframeLinewidth*xn()),Hi.setMode(ge.LINES)):Hi.setMode(ge.TRIANGLES);else if(De.isLine){let so=Le.linewidth;so===void 0&&(so=1),X.setLineWidth(so*xn()),De.isLineSegments?Hi.setMode(ge.LINES):De.isLineLoop?Hi.setMode(ge.LINE_LOOP):Hi.setMode(ge.LINE_STRIP)}else De.isPoints?Hi.setMode(ge.POINTS):De.isSprite&&Hi.setMode(ge.TRIANGLES);if(De.isBatchedMesh)if(On.get("WEBGL_multi_draw"))Hi.renderMultiDraw(De._multiDrawStarts,De._multiDrawCounts,De._multiDrawCount);else{let so=De._multiDrawStarts,Xt=De._multiDrawCounts,Na=De._multiDrawCount,Ai=tn?St.get(tn).bytesPerElement:1,ol=Pe.get(Le).currentProgram.getUniforms();for(let gc=0;gc<Na;gc++)ol.setValue(ge,"_gl_DrawID",gc),Hi.render(so[gc]/Ai,Xt[gc])}else if(De.isInstancedMesh)Hi.renderInstances(pn,kr,De.count);else if(ke.isInstancedBufferGeometry){let so=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Xt=Math.min(ke.instanceCount,so);Hi.renderInstances(pn,kr,Xt)}else Hi.render(pn,kr)};function rl(te,Se,ke){te.transparent===!0&&te.side===ir&&te.forceSinglePass===!1?(te.side=ui,te.needsUpdate=!0,Q1(te,Se,ke),te.side=Ao,te.needsUpdate=!0,Q1(te,Se,ke),te.side=ir):Q1(te,Se,ke)}this.compile=function(te,Se,ke=null){ke===null&&(ke=te),D=Mt.get(ke),D.init(Se),N.push(D),ke.traverseVisible(function(De){De.isLight&&De.layers.test(Se.layers)&&(D.pushLight(De),De.castShadow&&D.pushShadow(De))}),te!==ke&&te.traverseVisible(function(De){De.isLight&&De.layers.test(Se.layers)&&(D.pushLight(De),De.castShadow&&D.pushShadow(De))}),D.setupLights();let Le=new Set;return te.traverse(function(De){if(!(De.isMesh||De.isPoints||De.isLine||De.isSprite))return;let zt=De.material;if(zt)if(Array.isArray(zt))for(let Yt=0;Yt<zt.length;Yt++){let kt=zt[Yt];rl(kt,ke,De),Le.add(kt)}else rl(zt,ke,De),Le.add(zt)}),D=N.pop(),Le},this.compileAsync=function(te,Se,ke=null){let Le=this.compile(te,Se,ke);return new Promise(De=>{function zt(){if(Le.forEach(function(Yt){Pe.get(Yt).currentProgram.isReady()&&Le.delete(Yt)}),Le.size===0){De(te);return}setTimeout(zt,10)}On.get("KHR_parallel_shader_compile")!==null?zt():setTimeout(zt,10)})};let Ia=null;function sr(te){Ia&&Ia(te)}function Rs(){hu.stop()}function sl(){hu.start()}let hu=new wW;hu.setAnimationLoop(sr),typeof self<"u"&&hu.setContext(self),this.setAnimationLoop=function(te){Ia=te,jt.setAnimationLoop(te),te===null?hu.stop():hu.start()},jt.addEventListener("sessionstart",Rs),jt.addEventListener("sessionend",sl),this.render=function(te,Se){if(Se!==void 0&&Se.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;H!==null&&H.renderStart(te,Se);let ke=jt.enabled===!0&&jt.isPresenting===!0,Le=B!==null&&(ae===null||ke)&&B.begin(z,ae);if(te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),jt.enabled===!0&&jt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(jt.cameraAutoUpdate===!0&&jt.updateCamera(Se),Se=jt.getCamera()),te.isScene===!0&&te.onBeforeRender(z,te,Se,ae),D=Mt.get(te,N.length),D.init(Se),D.state.textureUnits=Ve.getTextureUnits(),N.push(D),vt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),Xe.setFromProjectionMatrix(vt,po,Se.reversedDepth),tt=this.localClippingEnabled,st=cn.init(this.clippingPlanes,tt),L=Pt.get(te,F.length),L.init(),F.push(L),jt.enabled===!0&&jt.isPresenting===!0){let Yt=z.xr.getDepthSensingMesh();Yt!==null&&Bb(Yt,Se,-1/0,z.sortObjects)}Bb(te,Se,0,z.sortObjects),L.finish(),z.sortObjects===!0&&L.sort(Et,Tt,Se.reversedDepth),Qt=jt.enabled===!1||jt.isPresenting===!1||jt.hasDepthSensing()===!1,Qt&&Rn.addToRenderList(L,te),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),st===!0&&cn.beginShadows();let De=D.state.shadowsArray;if(yn.render(De,te,Se),st===!0&&cn.endShadows(),(Le&&B.hasRenderPass())===!1){let Yt=L.opaque,kt=L.transmissive;if(D.setupLights(),Se.isArrayCamera){let tn=Se.cameras;if(kt.length>0)for(let hn=0,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn];QR(Yt,kt,te,Xn)}Qt&&Rn.render(te);for(let hn=0,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn];KR(L,te,Xn,Xn.viewport)}}else kt.length>0&&QR(Yt,kt,te,Se),Qt&&Rn.render(te),KR(L,te,Se)}ae!==null&&ee===0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),Le&&B.end(z),te.isScene===!0&&te.onAfterRender(z,te,Se),Dt.resetDefaultState(),ce=-1,de=null,N.pop(),N.length>0?(D=N[N.length-1],Ve.setTextureUnits(D.state.textureUnits),st===!0&&cn.setGlobalState(z.clippingPlanes,D.state.camera)):D=null,F.pop(),F.length>0?L=F[F.length-1]:L=null,H!==null&&H.renderEnd()};function Bb(te,Se,ke,Le){if(te.visible===!1)return;if(te.layers.test(Se.layers)){if(te.isGroup)ke=te.renderOrder;else if(te.isLOD)te.autoUpdate===!0&&te.update(Se);else if(te.isLightProbeGrid)D.pushLightProbeGrid(te);else if(te.isLight)D.pushLight(te),te.castShadow&&D.pushShadow(te);else if(te.isSprite){if(!te.frustumCulled||Xe.intersectsSprite(te)){Le&&ln.setFromMatrixPosition(te.matrixWorld).applyMatrix4(vt);let Yt=Ke.update(te),kt=te.material;kt.visible&&L.push(te,Yt,kt,ke,ln.z,null)}}else if((te.isMesh||te.isLine||te.isPoints)&&(!te.frustumCulled||Xe.intersectsObject(te))){let Yt=Ke.update(te),kt=te.material;if(Le&&(te.boundingSphere!==void 0?(te.boundingSphere===null&&te.computeBoundingSphere(),ln.copy(te.boundingSphere.center)):(Yt.boundingSphere===null&&Yt.computeBoundingSphere(),ln.copy(Yt.boundingSphere.center)),ln.applyMatrix4(te.matrixWorld).applyMatrix4(vt)),Array.isArray(kt)){let tn=Yt.groups;for(let hn=0,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn],pn=kt[Xn.materialIndex];pn&&pn.visible&&L.push(te,Yt,pn,ke,ln.z,Xn)}}else kt.visible&&L.push(te,Yt,kt,ke,ln.z,null)}}let zt=te.children;for(let Yt=0,kt=zt.length;Yt<kt;Yt++)Bb(zt[Yt],Se,ke,Le)}function KR(te,Se,ke,Le){let{opaque:De,transmissive:zt,transparent:Yt}=te;D.setupLightsView(ke),st===!0&&cn.setGlobalState(z.clippingPlanes,ke),Le&&X.viewport(ve.copy(Le)),De.length>0&&K1(De,Se,ke),zt.length>0&&K1(zt,Se,ke),Yt.length>0&&K1(Yt,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function QR(te,Se,ke,Le){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Le.id]===void 0){let pn=On.has("EXT_color_buffer_half_float")||On.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Le.id]=new ua(1,1,{generateMipmaps:!0,type:pn?Li:Gi,minFilter:go,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:sn.workingColorSpace})}let zt=D.state.transmissionRenderTarget[Le.id],Yt=Le.viewport||ve;zt.setSize(Yt.z*z.transmissionResolutionScale,Yt.w*z.transmissionResolutionScale);let kt=z.getRenderTarget(),tn=z.getActiveCubeFace(),hn=z.getActiveMipmapLevel();z.setRenderTarget(zt),z.getClearColor(Ue),mt=z.getClearAlpha(),mt<1&&z.setClearColor(16777215,.5),z.clear(),Qt&&Rn.render(ke);let Gn=z.toneMapping;z.toneMapping=ks;let Xn=Le.viewport;if(Le.viewport!==void 0&&(Le.viewport=void 0),D.setupLightsView(Le),st===!0&&cn.setGlobalState(z.clippingPlanes,Le),K1(te,ke,Le),Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt),On.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let Bi=0,kr=Se.length;Bi<kr;Bi++){let Tr=Se[Bi],{object:Hi,geometry:so,material:Xt,group:Na}=Tr;if(Xt.side===ir&&Hi.layers.test(Le.layers)){let Ai=Xt.side;Xt.side=ui,Xt.needsUpdate=!0,JR(Hi,ke,Le,so,Xt,Na),Xt.side=Ai,Xt.needsUpdate=!0,pn=!0}}pn===!0&&(Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt))}z.setRenderTarget(kt,tn,hn),z.setClearColor(Ue,mt),Xn!==void 0&&(Le.viewport=Xn),z.toneMapping=Gn}function K1(te,Se,ke){let Le=Se.isScene===!0?Se.overrideMaterial:null;for(let De=0,zt=te.length;De<zt;De++){let Yt=te[De],{object:kt,geometry:tn,group:hn}=Yt,Gn=Yt.material;Gn.allowOverride===!0&&Le!==null&&(Gn=Le),kt.layers.test(ke.layers)&&JR(kt,Se,ke,tn,Gn,hn)}}function JR(te,Se,ke,Le,De,zt){te.onBeforeRender(z,Se,ke,Le,De,zt),te.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,te.matrixWorld),te.normalMatrix.getNormalMatrix(te.modelViewMatrix),De.onBeforeRender(z,Se,ke,Le,te,zt),De.transparent===!0&&De.side===ir&&De.forceSinglePass===!1?(De.side=ui,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=Ao,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=ir):z.renderBufferDirect(ke,Se,Le,De,te,zt),te.onAfterRender(z,Se,ke,Le,De,zt)}function Q1(te,Se,ke){Se.isScene!==!0&&(Se=Kt);let Le=Pe.get(te),De=D.state.lights,zt=D.state.shadowsArray,Yt=De.state.version,kt=Rt.getParameters(te,De.state,zt,Se,ke,D.state.lightProbeGridArray),tn=Rt.getProgramCacheKey(kt),hn=Le.programs;Le.environment=te.isMeshStandardMaterial||te.isMeshLambertMaterial||te.isMeshPhongMaterial?Se.environment:null,Le.fog=Se.fog;let Gn=te.isMeshStandardMaterial||te.isMeshLambertMaterial&&!te.envMap||te.isMeshPhongMaterial&&!te.envMap;Le.envMap=gt.get(te.envMap||Le.environment,Gn),Le.envMapRotation=Le.environment!==null&&te.envMap===null?Se.environmentRotation:te.envMapRotation,hn===void 0&&(te.addEventListener("dispose",mr),hn=new Map,Le.programs=hn);let Xn=hn.get(tn);if(Xn!==void 0){if(Le.currentProgram===Xn&&Le.lightsStateVersion===Yt)return t4(te,kt),Xn}else kt.uniforms=Rt.getUniforms(te),H!==null&&te.isNodeMaterial&&H.build(te,ke,kt),te.onBeforeCompile(kt,z),Xn=Rt.acquireProgram(kt,tn),hn.set(tn,Xn),Le.uniforms=kt.uniforms;let pn=Le.uniforms;return(!te.isShaderMaterial&&!te.isRawShaderMaterial||te.clipping===!0)&&(pn.clippingPlanes=cn.uniform),t4(te,kt),Le.needsLights=zk(te),Le.lightsStateVersion=Yt,Le.needsLights&&(pn.ambientLightColor.value=De.state.ambient,pn.lightProbe.value=De.state.probe,pn.directionalLights.value=De.state.directional,pn.directionalLightShadows.value=De.state.directionalShadow,pn.spotLights.value=De.state.spot,pn.spotLightShadows.value=De.state.spotShadow,pn.rectAreaLights.value=De.state.rectArea,pn.ltc_1.value=De.state.rectAreaLTC1,pn.ltc_2.value=De.state.rectAreaLTC2,pn.pointLights.value=De.state.point,pn.pointLightShadows.value=De.state.pointShadow,pn.hemisphereLights.value=De.state.hemi,pn.directionalShadowMatrix.value=De.state.directionalShadowMatrix,pn.spotLightMatrix.value=De.state.spotLightMatrix,pn.spotLightMap.value=De.state.spotLightMap,pn.pointShadowMatrix.value=De.state.pointShadowMatrix),Le.lightProbeGrid=D.state.lightProbeGridArray.length>0,Le.currentProgram=Xn,Le.uniformsList=null,Xn}function e4(te){if(te.uniformsList===null){let Se=te.currentProgram.getUniforms();te.uniformsList=C_.seqWithValue(Se.seq,te.uniforms)}return te.uniformsList}function t4(te,Se){let ke=Pe.get(te);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function Uk(te,Se){if(te.length===0)return null;if(te.length===1)return te[0].texture!==null?te[0]:null;C.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,Le=te.length;ke<Le;ke++){let De=te[ke];if(De.texture!==null&&De.boundingBox.containsPoint(C))return De}return null}function kk(te,Se,ke,Le,De){Se.isScene!==!0&&(Se=Kt),Ve.resetTextureUnits();let zt=Se.fog,Yt=Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial?Se.environment:null,kt=ae===null?z.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:sn.workingColorSpace,tn=Le.isMeshStandardMaterial||Le.isMeshLambertMaterial&&!Le.envMap||Le.isMeshPhongMaterial&&!Le.envMap,hn=gt.get(Le.envMap||Yt,tn),Gn=Le.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Xn=!!ke.attributes.tangent&&(!!Le.normalMap||Le.anisotropy>0),pn=!!ke.morphAttributes.position,Bi=!!ke.morphAttributes.normal,kr=!!ke.morphAttributes.color,Tr=ks;Le.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Tr=z.toneMapping);let Hi=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,so=Hi!==void 0?Hi.length:0,Xt=Pe.get(Le),Na=D.state.lights;if(st===!0&&(tt===!0||te!==de)){let er=te===de&&Le.id===ce;cn.setState(Le,te,er)}let Ai=!1;Le.version===Xt.__version?(Xt.needsLights&&Xt.lightsStateVersion!==Na.state.version||Xt.outputColorSpace!==kt||De.isBatchedMesh&&Xt.batching===!1||!De.isBatchedMesh&&Xt.batching===!0||De.isBatchedMesh&&Xt.batchingColor===!0&&De.colorTexture===null||De.isBatchedMesh&&Xt.batchingColor===!1&&De.colorTexture!==null||De.isInstancedMesh&&Xt.instancing===!1||!De.isInstancedMesh&&Xt.instancing===!0||De.isSkinnedMesh&&Xt.skinning===!1||!De.isSkinnedMesh&&Xt.skinning===!0||De.isInstancedMesh&&Xt.instancingColor===!0&&De.instanceColor===null||De.isInstancedMesh&&Xt.instancingColor===!1&&De.instanceColor!==null||De.isInstancedMesh&&Xt.instancingMorph===!0&&De.morphTexture===null||De.isInstancedMesh&&Xt.instancingMorph===!1&&De.morphTexture!==null||Xt.envMap!==hn||Le.fog===!0&&Xt.fog!==zt||Xt.numClippingPlanes!==void 0&&(Xt.numClippingPlanes!==cn.numPlanes||Xt.numIntersection!==cn.numIntersection)||Xt.vertexAlphas!==Gn||Xt.vertexTangents!==Xn||Xt.morphTargets!==pn||Xt.morphNormals!==Bi||Xt.morphColors!==kr||Xt.toneMapping!==Tr||Xt.morphTargetsCount!==so||!!Xt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(Ai=!0):(Ai=!0,Xt.__version=Le.version);let ol=Xt.currentProgram;Ai===!0&&(ol=Q1(Le,Se,De),H&&Le.isNodeMaterial&&H.onUpdateProgram(Le,ol,Xt));let gc=!1,qh=!1,b0=!1,Wi=ol.getUniforms(),Gr=Xt.uniforms;if(X.useProgram(ol.program)&&(gc=!0,qh=!0,b0=!0),Le.id!==ce&&(ce=Le.id,qh=!0),Xt.needsLights){let er=Uk(D.state.lightProbeGridArray,De);Xt.lightProbeGrid!==er&&(Xt.lightProbeGrid=er,qh=!0)}if(gc||de!==te){X.buffers.depth.getReversed()&&te.reversedDepth!==!0&&(te._reversedDepth=!0,te.updateProjectionMatrix()),Wi.setValue(ge,"projectionMatrix",te.projectionMatrix),Wi.setValue(ge,"viewMatrix",te.matrixWorldInverse);let Wh=Wi.map.cameraPosition;Wh!==void 0&&Wh.setValue(ge,yt.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&Wi.setValue(ge,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Le.isMeshPhongMaterial||Le.isMeshToonMaterial||Le.isMeshLambertMaterial||Le.isMeshBasicMaterial||Le.isMeshStandardMaterial||Le.isShaderMaterial)&&Wi.setValue(ge,"isOrthographic",te.isOrthographicCamera===!0),de!==te&&(de=te,qh=!0,b0=!0)}if(Xt.needsLights&&(Na.state.directionalShadowMap.length>0&&Wi.setValue(ge,"directionalShadowMap",Na.state.directionalShadowMap,Ve),Na.state.spotShadowMap.length>0&&Wi.setValue(ge,"spotShadowMap",Na.state.spotShadowMap,Ve),Na.state.pointShadowMap.length>0&&Wi.setValue(ge,"pointShadowMap",Na.state.pointShadowMap,Ve)),De.isSkinnedMesh){Wi.setOptional(ge,De,"bindMatrix"),Wi.setOptional(ge,De,"bindMatrixInverse");let er=De.skeleton;er&&(er.boneTexture===null&&er.computeBoneTexture(),Wi.setValue(ge,"boneTexture",er.boneTexture,Ve))}De.isBatchedMesh&&(Wi.setOptional(ge,De,"batchingTexture"),Wi.setValue(ge,"batchingTexture",De._matricesTexture,Ve),Wi.setOptional(ge,De,"batchingIdTexture"),Wi.setValue(ge,"batchingIdTexture",De._indirectTexture,Ve),Wi.setOptional(ge,De,"batchingColorTexture"),De._colorsTexture!==null&&Wi.setValue(ge,"batchingColorTexture",De._colorsTexture,Ve));let Hh=ke.morphAttributes;if((Hh.position!==void 0||Hh.normal!==void 0||Hh.color!==void 0)&&xe.update(De,ke,ol),(qh||Xt.receiveShadow!==De.receiveShadow)&&(Xt.receiveShadow=De.receiveShadow,Wi.setValue(ge,"receiveShadow",De.receiveShadow)),(Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial)&&Le.envMap===null&&Se.environment!==null&&(Gr.envMapIntensity.value=Se.environmentIntensity),Gr.dfgLUT!==void 0&&(Gr.dfgLUT.value=Qpe()),qh){if(Wi.setValue(ge,"toneMappingExposure",z.toneMappingExposure),Xt.needsLights&&Gk(Gr,b0),zt&&Le.fog===!0&&en.refreshFogUniforms(Gr,zt),en.refreshMaterialUniforms(Gr,Le,$e,ze,D.state.transmissionRenderTarget[te.id]),Xt.needsLights&&Xt.lightProbeGrid){let er=Xt.lightProbeGrid;Gr.probesSH.value=er.texture,Gr.probesMin.value.copy(er.boundingBox.min),Gr.probesMax.value.copy(er.boundingBox.max),Gr.probesResolution.value.copy(er.resolution)}C_.upload(ge,e4(Xt),Gr,Ve)}if(Le.isShaderMaterial&&Le.uniformsNeedUpdate===!0&&(C_.upload(ge,e4(Xt),Gr,Ve),Le.uniformsNeedUpdate=!1),Le.isSpriteMaterial&&Wi.setValue(ge,"center",De.center),Wi.setValue(ge,"modelViewMatrix",De.modelViewMatrix),Wi.setValue(ge,"normalMatrix",De.normalMatrix),Wi.setValue(ge,"modelMatrix",De.matrixWorld),Le.uniformsGroups!==void 0){let er=Le.uniformsGroups;for(let Wh=0,w0=er.length;Wh<w0;Wh++){let n4=er[Wh];ct.update(n4,ol),ct.bind(n4,ol)}}return ol}function Gk(te,Se){te.ambientLightColor.needsUpdate=Se,te.lightProbe.needsUpdate=Se,te.directionalLights.needsUpdate=Se,te.directionalLightShadows.needsUpdate=Se,te.pointLights.needsUpdate=Se,te.pointLightShadows.needsUpdate=Se,te.spotLights.needsUpdate=Se,te.spotLightShadows.needsUpdate=Se,te.rectAreaLights.needsUpdate=Se,te.hemisphereLights.needsUpdate=Se}function zk(te){return te.isMeshLambertMaterial||te.isMeshToonMaterial||te.isMeshPhongMaterial||te.isMeshStandardMaterial||te.isShadowMaterial||te.isShaderMaterial&&te.lights===!0}this.getActiveCubeFace=function(){return K},this.getActiveMipmapLevel=function(){return ee},this.getRenderTarget=function(){return ae},this.setRenderTargetTextures=function(te,Se,ke){let Le=Pe.get(te);Le.__autoAllocateDepthBuffer=te.resolveDepthBuffer===!1,Le.__autoAllocateDepthBuffer===!1&&(Le.__useRenderToTexture=!1),Pe.get(te.texture).__webglTexture=Se,Pe.get(te.depthTexture).__webglTexture=Le.__autoAllocateDepthBuffer?void 0:ke,Le.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(te,Se){let ke=Pe.get(te);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(te,Se=0,ke=0){ae=te,K=Se,ee=ke;let Le=null,De=!1,zt=!1;if(te){let kt=Pe.get(te);if(kt.__useDefaultFramebuffer!==void 0){X.bindFramebuffer(ge.FRAMEBUFFER,kt.__webglFramebuffer),ve.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest,X.viewport(ve),X.scissor(Ie),X.setScissorTest(Qe),ce=-1;return}else if(kt.__webglFramebuffer===void 0)Ve.setupRenderTarget(te);else if(kt.__hasExternalTextures)Ve.rebindTextures(te,Pe.get(te.texture).__webglTexture,Pe.get(te.depthTexture).__webglTexture);else if(te.depthBuffer){let Gn=te.depthTexture;if(kt.__boundDepthTexture!==Gn){if(Gn!==null&&Pe.has(Gn)&&(te.width!==Gn.image.width||te.height!==Gn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ve.setupDepthRenderbuffer(te)}}let tn=te.texture;(tn.isData3DTexture||tn.isDataArrayTexture||tn.isCompressedArrayTexture)&&(zt=!0);let hn=Pe.get(te).__webglFramebuffer;te.isWebGLCubeRenderTarget?(Array.isArray(hn[Se])?Le=hn[Se][ke]:Le=hn[Se],De=!0):te.samples>0&&Ve.useMultisampledRTT(te)===!1?Le=Pe.get(te).__webglMultisampledFramebuffer:Array.isArray(hn)?Le=hn[ke]:Le=hn,ve.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest}else ve.copy(Ct).multiplyScalar($e).floor(),Ie.copy(un).multiplyScalar($e).floor(),Qe=Gt;if(ke!==0&&(Le=Z),X.bindFramebuffer(ge.FRAMEBUFFER,Le)&&X.drawBuffers(te,Le),X.viewport(ve),X.scissor(Ie),X.setScissorTest(Qe),De){let kt=Pe.get(te.texture);ge.framebufferTexture2D(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_CUBE_MAP_POSITIVE_X+Se,kt.__webglTexture,ke)}else if(zt){let kt=Se;for(let tn=0;tn<te.textures.length;tn++){let hn=Pe.get(te.textures[tn]);ge.framebufferTextureLayer(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0+tn,hn.__webglTexture,ke,kt)}}else if(te!==null&&ke!==0){let kt=Pe.get(te.texture);ge.framebufferTexture2D(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,kt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(te,Se,ke,Le,De,zt,Yt,kt=0){if(!(te&&te.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let tn=Pe.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Yt!==void 0&&(tn=tn[Yt]),tn){X.bindFramebuffer(ge.FRAMEBUFFER,tn);try{let hn=te.textures[kt],Gn=hn.format,Xn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(Gn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Xn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=te.width-Le&&ke>=0&&ke<=te.height-De&&ge.readPixels(Se,ke,Le,De,wt.convert(Gn),wt.convert(Xn),zt)}finally{let hn=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,hn)}}},this.readRenderTargetPixelsAsync=async function(te,Se,ke,Le,De,zt,Yt,kt=0){if(!(te&&te.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let tn=Pe.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Yt!==void 0&&(tn=tn[Yt]),tn)if(Se>=0&&Se<=te.width-Le&&ke>=0&&ke<=te.height-De){X.bindFramebuffer(ge.FRAMEBUFFER,tn);let hn=te.textures[kt],Gn=hn.format,Xn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(Gn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Xn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let pn=ge.createBuffer();ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.bufferData(ge.PIXEL_PACK_BUFFER,zt.byteLength,ge.STREAM_READ),ge.readPixels(Se,ke,Le,De,wt.convert(Gn),wt.convert(Xn),0);let Bi=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,Bi);let kr=ge.fenceSync(ge.SYNC_GPU_COMMANDS_COMPLETE,0);return ge.flush(),await jH(ge,kr,4),ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.getBufferSubData(ge.PIXEL_PACK_BUFFER,0,zt),ge.deleteBuffer(pn),ge.deleteSync(kr),zt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(te,Se=null,ke=0){let Le=Math.pow(2,-ke),De=Math.floor(te.image.width*Le),zt=Math.floor(te.image.height*Le),Yt=Se!==null?Se.x:0,kt=Se!==null?Se.y:0;Ve.setTexture2D(te,0),ge.copyTexSubImage2D(ge.TEXTURE_2D,ke,0,0,Yt,kt,De,zt),X.unbindTexture()},this.copyTextureToTexture=function(te,Se,ke=null,Le=null,De=0,zt=0){let Yt,kt,tn,hn,Gn,Xn,pn,Bi,kr,Tr=te.isCompressedTexture?te.mipmaps[zt]:te.image;if(ke!==null)Yt=ke.max.x-ke.min.x,kt=ke.max.y-ke.min.y,tn=ke.isBox3?ke.max.z-ke.min.z:1,hn=ke.min.x,Gn=ke.min.y,Xn=ke.isBox3?ke.min.z:0;else{let Gr=Math.pow(2,-De);Yt=Math.floor(Tr.width*Gr),kt=Math.floor(Tr.height*Gr),te.isDataArrayTexture?tn=Tr.depth:te.isData3DTexture?tn=Math.floor(Tr.depth*Gr):tn=1,hn=0,Gn=0,Xn=0}Le!==null?(pn=Le.x,Bi=Le.y,kr=Le.z):(pn=0,Bi=0,kr=0);let Hi=wt.convert(Se.format),so=wt.convert(Se.type),Xt;Se.isData3DTexture?(Ve.setTexture3D(Se,0),Xt=ge.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ve.setTexture2DArray(Se,0),Xt=ge.TEXTURE_2D_ARRAY):(Ve.setTexture2D(Se,0),Xt=ge.TEXTURE_2D),X.activeTexture(ge.TEXTURE0),X.pixelStorei(ge.UNPACK_FLIP_Y_WEBGL,Se.flipY),X.pixelStorei(ge.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),X.pixelStorei(ge.UNPACK_ALIGNMENT,Se.unpackAlignment);let Na=X.getParameter(ge.UNPACK_ROW_LENGTH),Ai=X.getParameter(ge.UNPACK_IMAGE_HEIGHT),ol=X.getParameter(ge.UNPACK_SKIP_PIXELS),gc=X.getParameter(ge.UNPACK_SKIP_ROWS),qh=X.getParameter(ge.UNPACK_SKIP_IMAGES);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Tr.width),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Tr.height),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hn),X.pixelStorei(ge.UNPACK_SKIP_ROWS,Gn),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Xn);let b0=te.isDataArrayTexture||te.isData3DTexture,Wi=Se.isDataArrayTexture||Se.isData3DTexture;if(te.isDepthTexture){let Gr=Pe.get(te),Hh=Pe.get(Se),er=Pe.get(Gr.__renderTarget),Wh=Pe.get(Hh.__renderTarget);X.bindFramebuffer(ge.READ_FRAMEBUFFER,er.__webglFramebuffer),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,Wh.__webglFramebuffer);for(let w0=0;w0<tn;w0++)b0&&(ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(te).__webglTexture,De,Xn+w0),ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,zt,kr+w0)),ge.blitFramebuffer(hn,Gn,Yt,kt,pn,Bi,Yt,kt,ge.DEPTH_BUFFER_BIT,ge.NEAREST);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else if(De!==0||te.isRenderTargetTexture||Pe.has(te)){let Gr=Pe.get(te),Hh=Pe.get(Se);X.bindFramebuffer(ge.READ_FRAMEBUFFER,J),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,j);for(let er=0;er<tn;er++)b0?ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Gr.__webglTexture,De,Xn+er):ge.framebufferTexture2D(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Gr.__webglTexture,De),Wi?ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Hh.__webglTexture,zt,kr+er):ge.framebufferTexture2D(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Hh.__webglTexture,zt),De!==0?ge.blitFramebuffer(hn,Gn,Yt,kt,pn,Bi,Yt,kt,ge.COLOR_BUFFER_BIT,ge.NEAREST):Wi?ge.copyTexSubImage3D(Xt,zt,pn,Bi,kr+er,hn,Gn,Yt,kt):ge.copyTexSubImage2D(Xt,zt,pn,Bi,hn,Gn,Yt,kt);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else Wi?te.isDataTexture||te.isData3DTexture?ge.texSubImage3D(Xt,zt,pn,Bi,kr,Yt,kt,tn,Hi,so,Tr.data):Se.isCompressedArrayTexture?ge.compressedTexSubImage3D(Xt,zt,pn,Bi,kr,Yt,kt,tn,Hi,Tr.data):ge.texSubImage3D(Xt,zt,pn,Bi,kr,Yt,kt,tn,Hi,so,Tr):te.isDataTexture?ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Yt,kt,Hi,so,Tr.data):te.isCompressedTexture?ge.compressedTexSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Tr.width,Tr.height,Hi,Tr.data):ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Yt,kt,Hi,so,Tr);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Na),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Ai),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,ol),X.pixelStorei(ge.UNPACK_SKIP_ROWS,gc),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,qh),zt===0&&Se.generateMipmaps&&ge.generateMipmap(Xt),X.unbindTexture()},this.initRenderTarget=function(te){Pe.get(te).__webglFramebuffer===void 0&&Ve.setupRenderTarget(te)},this.initTexture=function(te){te.isCubeTexture?Ve.setTextureCube(te,0):te.isData3DTexture?Ve.setTexture3D(te,0):te.isDataArrayTexture||te.isCompressedArrayTexture?Ve.setTexture2DArray(te,0):Ve.setTexture2D(te,0),X.unbindTexture()},this.resetState=function(){K=0,ee=0,ae=null,X.reset(),Dt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return po}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=sn._getDrawingBufferColorSpace(e),t.unpackColorSpace=sn._getUnpackColorSpace()}};var n3=class extends $i{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Oe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}},P_=new ie,PW=new on,IW=new on,NW=new ie,LW=new ie,i3=class{constructor(e={}){let t=this,n,r,s,o,a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:n,height:r}},this.render=function(v,w){v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),PW.copy(w.matrixWorldInverse),IW.multiplyMatrices(w.projectionMatrix,PW),u(v,v,w),this.sortObjects&&x(v)},this.setSize=function(v,w){n=v,r=w,s=n/2,o=r/2,l.style.width=v+"px",l.style.height=w+"px"};function c(v){v.isCSS2DObject&&(v.element.style.display="none");for(let w=0,S=v.children.length;w<S;w++)c(v.children[w])}function u(v,w,S){if(v.visible===!1){c(v);return}if(v.isCSS2DObject){P_.setFromMatrixPosition(v.matrixWorld),P_.applyMatrix4(IW);let T=P_.z>=-1&&P_.z<=1&&v.layers.test(S.layers)===!0,P=v.element;P.style.display=T===!0?"":"none",T===!0&&(v.onBeforeRender(t,w,S),P.style.transform="translate("+-100*v.center.x+"%,"+-100*v.center.y+"%)translate("+(P_.x*s+s)+"px,"+(-P_.y*o+o)+"px)",P.parentNode!==l&&l.appendChild(P),v.onAfterRender(t,w,S));let R={distanceToCameraSquared:f(S,v)};a.objects.set(v,R)}for(let T=0,P=v.children.length;T<P;T++)u(v.children[T],w,S)}function f(v,w){return NW.setFromMatrixPosition(v.matrixWorld),LW.setFromMatrixPosition(w.matrixWorld),NW.distanceToSquared(LW)}function p(v){let w=[];return v.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function x(v){let w=p(v).sort(function(T,P){if(T.renderOrder!==P.renderOrder)return P.renderOrder-T.renderOrder;let R=a.objects.get(T).distanceToCameraSquared,C=a.objects.get(P).distanceToCameraSquared;return R-C}),S=w.length;for(let T=0,P=w.length;T<P;T++)w[T].element.style.zIndex=S-T}}};function Jpe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var M2=Jpe;var e0e=typeof global=="object"&&global&&global.Object===Object&&global,DW=e0e;var t0e=typeof self=="object"&&self&&self.Object===Object&&self,n0e=DW||t0e||Function("return this")(),r3=n0e;var i0e=function(){return r3.Date.now()},s3=i0e;var r0e=/\s/;function s0e(i){for(var e=i.length;e--&&r0e.test(i.charAt(e)););return e}var FW=s0e;var o0e=/^\s+/;function a0e(i){return i&&i.slice(0,FW(i)+1).replace(o0e,"")}var OW=a0e;var l0e=r3.Symbol,I_=l0e;var BW=Object.prototype,c0e=BW.hasOwnProperty,u0e=BW.toString,C2=I_?I_.toStringTag:void 0;function h0e(i){var e=c0e.call(i,C2),t=i[C2];try{i[C2]=void 0;var n=!0}catch{}var r=u0e.call(i);return n&&(e?i[C2]=t:delete i[C2]),r}var UW=h0e;var f0e=Object.prototype,d0e=f0e.toString;function p0e(i){return d0e.call(i)}var kW=p0e;var A0e="[object Null]",m0e="[object Undefined]",GW=I_?I_.toStringTag:void 0;function g0e(i){return i==null?i===void 0?m0e:A0e:GW&&GW in Object(i)?UW(i):kW(i)}var zW=g0e;function _0e(i){return i!=null&&typeof i=="object"}var VW=_0e;var x0e="[object Symbol]";function y0e(i){return typeof i=="symbol"||VW(i)&&zW(i)==x0e}var qW=y0e;var HW=NaN,v0e=/^[-+]0x[0-9a-f]+$/i,b0e=/^0b[01]+$/i,w0e=/^0o[0-7]+$/i,S0e=parseInt;function T0e(i){if(typeof i=="number")return i;if(qW(i))return HW;if(M2(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=M2(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=OW(i);var t=b0e.test(i);return t||w0e.test(i)?S0e(i.slice(2),t?2:8):v0e.test(i)?HW:+i}var GL=T0e;var E0e="Expected a function",M0e=Math.max,C0e=Math.min;function R0e(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,p=!0;if(typeof i!="function")throw new TypeError(E0e);e=GL(e)||0,M2(t)&&(u=!!t.leading,f="maxWait"in t,s=f?M0e(GL(t.maxWait)||0,e):s,p="trailing"in t?!!t.trailing:p);function x(D){var F=n,N=r;return n=r=void 0,c=D,o=i.apply(N,F),o}function v(D){return c=D,a=setTimeout(T,e),u?x(D):o}function w(D){var F=D-l,N=D-c,B=e-F;return f?C0e(B,s-N):B}function S(D){var F=D-l,N=D-c;return l===void 0||F>=e||F<0||f&&N>=s}function T(){var D=s3();if(S(D))return P(D);a=setTimeout(T,w(D))}function P(D){return a=void 0,p&&n?x(D):(n=r=void 0,o)}function R(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function C(){return a===void 0?o:P(s3())}function L(){var D=s3(),F=S(D);if(n=arguments,r=this,l=D,F){if(a===void 0)return v(l);if(f)return clearTimeout(a),a=setTimeout(T,e),x(l)}return a===void 0&&(a=setTimeout(T,e)),o}return L.cancel=R,L.flush=C,L}var WW=R0e;function jW(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function P0e(i){if(Array.isArray(i))return i}function I0e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function N0e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function L0e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function D0e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4117+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function F0e(i,e){return P0e(i)||L0e(i,e)||O0e(i,e)||D0e()}function O0e(i,e){if(i){if(typeof i=="string")return jW(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?jW(i,e):void 0}}var B0e=N0e(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(c,u){}:a;I0e(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Nr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,c=i.init,u=c===void 0?function(){}:c,f=i.update,p=f===void 0?function(){}:f,x=Object.keys(r).map(function(v){return new B0e(v,r[v])});return function v(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var P=!!(this instanceof v&&this.constructor),R=P?S.shift():void 0,C=S[0],L=C===void 0?{}:C,D=Object.assign({},t instanceof Function?t(L):t,{initialised:!1}),F={};function N(V){return B(V,L),z(),N}var B=function(H,Z){u.call(N,H,D,Z),D.initialised=!0},z=WW(function(){D.initialised&&(p.call(N,D,F),F={})},1);return x.forEach(function(V){N[V.name]=H(V);function H(Z){var J=Z.name,j=Z.triggerUpdate,K=j===void 0?!1:j,ee=Z.onChange,ae=ee===void 0?function(ve,Ie){}:ee,ce=Z.defaultVal,de=ce===void 0?null:ce;return function(ve){var Ie=D[J];if(!arguments.length)return Ie;var Qe=ve===void 0?de:ve;return D[J]=Qe,ae.call(N,Qe,D,Ie),!F.hasOwnProperty(J)&&(F[J]=Ie),K&&z(),N}}}),Object.keys(o).forEach(function(V){N[V]=function(){for(var H,Z=arguments.length,J=new Array(Z),j=0;j<Z;j++)J[j]=arguments[j];return(H=o[V]).call.apply(H,[N,D].concat(J))}}),Object.entries(l).forEach(function(V){var H=F0e(V,2),Z=H[0],J=H[1];return N[Z]=N[J]}),N.resetProps=function(){return x.forEach(function(V){N[V.name](V.defaultVal)}),N},N.resetProps(),D._rerender=z,P&&R&&N(R),N}}var Lr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Lr.Bounce.Out(1-i)},Out:function(i){return i<.36363636363636365?7.5625*i*i:i<.7272727272727273?7.5625*(i-=.5454545454545454)*i+.75:i<.9090909090909091?7.5625*(i-=.8181818181818182)*i+.9375:7.5625*(i-=.9545454545454546)*i+.984375},InOut:function(i){return i<.5?Lr.Bounce.In(i*2)*.5:Lr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),R2=function(){return performance.now()},WA=(function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=R2()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i})(),N_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=N_.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=N_.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=N_.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=N_.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:(function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}})(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},XW=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),zL=new WA,Vs=(function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Lr.Linear.None,this._interpolationFunction=N_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=XW.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=zL,zL.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=R2()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(n[o]);if(!(c==="undefined"||c==="function")){if(u){var f=n[o];if(f.length===0)continue;for(var p=[a],x=0,v=f.length;x<v;x+=1){var w=this._handleRelativeValue(a,f[x]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(w)}u&&(n[o]=p)}if((c==="object"||l)&&a&&!u){t[o]=l?[]:{};var S=a;for(var T in S)t[o][T]=S[T];r[o]=l?[]:{};var f=n[o];if(!this._isDynamic){var P={};for(var T in f)P[T]=f[T];n[o]=f=P}this._setupProperties(S,t[o],f,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),u?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=R2()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=R2()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Lr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=N_.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=R2()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,c=function(){if(n._duration===0||o>l)return 1;var w=Math.trunc(o/a),S=o-w*a,T=Math.min(S/n._duration,1);return T===0&&o===n._duration?1:T},u=c(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var x=0,v=this._chainedTweens.length;x<v;x++)this._chainedTweens[x].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i})();var iHe=XW.nextId,ih=zL,rHe=ih.getAll.bind(ih),sHe=ih.removeAll.bind(ih),oHe=ih.add.bind(ih),aHe=ih.remove.bind(ih),lHe=ih.update.bind(ih);function $W(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return YW(this.cover(e,t,n),e,t,n,i)}function YW(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,c=i._y0,u=i._z0,f=i._x1,p=i._y1,x=i._z1,v,w,S,T,P,R,C,L,D,F,N;if(!o)return i._root=a,i;for(;o.length;)if((C=e>=(v=(l+f)/2))?l=v:f=v,(L=t>=(w=(c+p)/2))?c=w:p=w,(D=n>=(S=(u+x)/2))?u=S:x=S,s=o,!(o=o[F=D<<2|L<<1|C]))return s[F]=a,i;if(T=+i._x.call(null,o.data),P=+i._y.call(null,o.data),R=+i._z.call(null,o.data),e===T&&t===P&&n===R)return a.next=o,s?s[F]=a:i._root=a,i;do s=s?s[F]=new Array(8):i._root=new Array(8),(C=e>=(v=(l+f)/2))?l=v:f=v,(L=t>=(w=(c+p)/2))?c=w:p=w,(D=n>=(S=(u+x)/2))?u=S:x=S;while((F=D<<2|L<<1|C)===(N=(R>=S)<<2|(P>=w)<<1|T>=v));return s[N]=o,s[F]=a,i}function ZW(i){Array.isArray(i)||(i=Array.from(i));let e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e),s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let f=0,p,x,v,w;f<e;++f)isNaN(x=+this._x.call(null,p=i[f]))||isNaN(v=+this._y.call(null,p))||isNaN(w=+this._z.call(null,p))||(t[f]=x,n[f]=v,r[f]=w,x<s&&(s=x),x>l&&(l=x),v<o&&(o=v),v>c&&(c=v),w<a&&(a=w),w>u&&(u=w));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let f=0;f<e;++f)YW(this,t[f],n[f],r[f],i[f]);return this}function KW(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=o-n||1,u=this._root,f,p;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(p=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[p]=u,u=f,c*=2,p){case 0:o=n+c,a=r+c,l=s+c;break;case 1:n=o-c,a=r+c,l=s+c;break;case 2:o=n+c,r=a-c,l=s+c;break;case 3:n=o-c,r=a-c,l=s+c;break;case 4:o=n+c,a=r+c,s=l-c;break;case 5:n=o-c,a=r+c,s=l-c;break;case 6:o=n+c,r=a-c,s=l-c;break;case 7:n=o-c,r=a-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function QW(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function JW(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Di(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function ej(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,p,x,v=this._x1,w=this._y1,S=this._z1,T=[],P=this._root,R,C;for(P&&T.push(new Di(P,s,o,a,v,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,v=i+n,w=e+n,S=t+n,n*=n);R=T.pop();)if(!(!(P=R.node)||(l=R.x0)>v||(c=R.y0)>w||(u=R.z0)>S||(f=R.x1)<s||(p=R.y1)<o||(x=R.z1)<a))if(P.length){var L=(l+f)/2,D=(c+p)/2,F=(u+x)/2;T.push(new Di(P[7],L,D,F,f,p,x),new Di(P[6],l,D,F,L,p,x),new Di(P[5],L,c,F,f,D,x),new Di(P[4],l,c,F,L,D,x),new Di(P[3],L,D,u,f,p,F),new Di(P[2],l,D,u,L,p,F),new Di(P[1],L,c,u,f,D,F),new Di(P[0],l,c,u,L,D,F)),(C=(t>=F)<<2|(e>=D)<<1|i>=L)&&(R=T[T.length-1],T[T.length-1]=T[T.length-1-C],T[T.length-1-C]=R)}else{var N=i-+this._x.call(null,P.data),B=e-+this._y.call(null,P.data),z=t-+this._z.call(null,P.data),V=N*N+B*B+z*z;if(V<n){var H=Math.sqrt(n=V);s=i-H,o=e-H,a=t-H,v=i+H,w=e+H,S=t+H,r=P.data}}return r}var U0e=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function tj(i,e,t,n){let r=[],s=i-n,o=e-n,a=t-n,l=i+n,c=e+n,u=t+n;return this.visit((f,p,x,v,w,S,T)=>{if(!f.length)do{let P=f.data;U0e(i,e,t,this._x(P),this._y(P),this._z(P))<=n&&r.push(P)}while(f=f.next);return p>l||x>c||v>u||w<s||S<o||T<a}),r}function nj(i){if(isNaN(p=+this._x.call(null,i))||isNaN(x=+this._y.call(null,i))||isNaN(v=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,c=this._x1,u=this._y1,f=this._z1,p,x,v,w,S,T,P,R,C,L,D;if(!t)return this;if(t.length)for(;;){if((P=p>=(w=(o+c)/2))?o=w:c=w,(R=x>=(S=(a+u)/2))?a=S:u=S,(C=v>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[L=C<<2|R<<1|P]))return this;if(!t.length)break;(e[L+1&7]||e[L+2&7]||e[L+3&7]||e[L+4&7]||e[L+5&7]||e[L+6&7]||e[L+7&7])&&(n=e,D=L)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[L]=s:delete e[L],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[D]=t:this._root=t),this):(this._root=s,this)}function ij(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function rj(){return this._root}function sj(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function oj(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new Di(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,c=t.y1,u=t.z1)&&n.length){var f=(s+l)/2,p=(o+c)/2,x=(a+u)/2;(r=n[7])&&e.push(new Di(r,f,p,x,l,c,u)),(r=n[6])&&e.push(new Di(r,s,p,x,f,c,u)),(r=n[5])&&e.push(new Di(r,f,o,x,l,p,u)),(r=n[4])&&e.push(new Di(r,s,o,x,f,p,u)),(r=n[3])&&e.push(new Di(r,f,p,a,l,c,x)),(r=n[2])&&e.push(new Di(r,s,p,a,f,c,x)),(r=n[1])&&e.push(new Di(r,f,o,a,l,p,x)),(r=n[0])&&e.push(new Di(r,s,o,a,f,p,x))}return this}function aj(i){var e=[],t=[],n;for(this._root&&e.push(new Di(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,f=n.z1,p=(o+c)/2,x=(a+u)/2,v=(l+f)/2;(s=r[0])&&e.push(new Di(s,o,a,l,p,x,v)),(s=r[1])&&e.push(new Di(s,p,a,l,c,x,v)),(s=r[2])&&e.push(new Di(s,o,x,l,p,u,v)),(s=r[3])&&e.push(new Di(s,p,x,l,c,u,v)),(s=r[4])&&e.push(new Di(s,o,a,v,p,x,f)),(s=r[5])&&e.push(new Di(s,p,a,v,c,x,f)),(s=r[6])&&e.push(new Di(s,o,x,v,p,u,f)),(s=r[7])&&e.push(new Di(s,p,x,v,c,u,f))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function lj(i){return i[0]}function cj(i){return arguments.length?(this._x=i,this):this._x}function uj(i){return i[1]}function hj(i){return arguments.length?(this._y=i,this):this._y}function fj(i){return i[2]}function dj(i){return arguments.length?(this._z=i,this):this._z}function P2(i,e,t,n){var r=new VL(e??lj,t??uj,n??fj,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function VL(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function pj(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var _o=P2.prototype=VL.prototype;_o.copy=function(){var i=new VL(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=pj(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=pj(n));return i};_o.add=$W;_o.addAll=ZW;_o.cover=KW;_o.data=QW;_o.extent=JW;_o.find=ej;_o.findAllWithinRadius=tj;_o.remove=nj;_o.removeAll=ij;_o.root=rj;_o.size=sj;_o.visit=oj;_o.visitAfter=aj;_o.x=cj;_o.y=hj;_o.z=dj;function jA(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function qL(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function o3(i){let e,t,n;i.length!==2?(e=jA,t=(a,l)=>jA(i(a),l),n=(a,l)=>i(a)-l):(e=i===jA||i===qL?i:k0e,t=i,n=i);function r(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){let f=r(a,l,c,u-1);return f>c&&n(a[f-1],l)>-n(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function k0e(){return 0}function HL(i){return i===null?NaN:+i}var Aj=o3(jA),mj=Aj.right,G0e=Aj.left,z0e=o3(HL).center,I2=mj;function Ip(i,e){let t,n;if(e===void 0)for(let r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}var xo=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}};var V0e=Math.sqrt(50),q0e=Math.sqrt(10),H0e=Math.sqrt(2);function a3(i,e,t){let n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=V0e?10:s>=q0e?5:s>=H0e?2:1,a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(i*c),l=Math.round(e*c),a/c<i&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(i/c),l=Math.round(e/c),a*c<i&&++a,l*c>e&&--l),l<a&&.5<=t&&t<2?a3(i,e,t*2):[a,l,c]}function l3(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];let n=e<i,[r,s,o]=n?a3(e,i,t):a3(i,e,t);if(!(s>=r))return[];let a=s-r+1,l=new Array(a);if(n)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}function N2(i,e,t){return e=+e,i=+i,t=+t,a3(i,e,t)[2]}function WL(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?N2(e,i,t):N2(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function c3(i,e){let t;if(e===void 0)for(let n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let r of i)(r=e(r,++n,i))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function u3(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*W0e(i){for(let e of i)yield*e}function rh(i){return Array.from(W0e(i))}function Ff(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function h3(i,e){let t=0;if(e===void 0)for(let n of i)(n=+n)&&(t+=n);else{let n=-1;for(let r of i)(r=+e(r,++n,i))&&(t+=r)}return t}function f3(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function d3(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function jL(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function F2(){}var L2=.7,m3=1/L2,L_="\\s*([+-]?\\d+)\\s*",D2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",sh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",j0e=/^#([0-9a-f]{3,8})$/,X0e=new RegExp(`^rgb\\(${L_},${L_},${L_}\\)$`),$0e=new RegExp(`^rgb\\(${sh},${sh},${sh}\\)$`),Y0e=new RegExp(`^rgba\\(${L_},${L_},${L_},${D2}\\)$`),Z0e=new RegExp(`^rgba\\(${sh},${sh},${sh},${D2}\\)$`),K0e=new RegExp(`^hsl\\(${D2},${sh},${sh}\\)$`),Q0e=new RegExp(`^hsla\\(${D2},${sh},${sh},${D2}\\)$`),gj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};d3(F2,Xc,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:_j,formatHex:_j,formatHex8:J0e,formatHsl:eAe,formatRgb:xj,toString:xj});function _j(){return this.rgb().formatHex()}function J0e(){return this.rgb().formatHex8()}function eAe(){return Tj(this).formatHsl()}function xj(){return this.rgb().formatRgb()}function Xc(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=j0e.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?yj(e):t===3?new ja(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?p3(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?p3(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=X0e.exec(i))?new ja(e[1],e[2],e[3],1):(e=$0e.exec(i))?new ja(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Y0e.exec(i))?p3(e[1],e[2],e[3],e[4]):(e=Z0e.exec(i))?p3(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=K0e.exec(i))?wj(e[1],e[2]/100,e[3]/100,1):(e=Q0e.exec(i))?wj(e[1],e[2]/100,e[3]/100,e[4]):gj.hasOwnProperty(i)?yj(gj[i]):i==="transparent"?new ja(NaN,NaN,NaN,0):null}function yj(i){return new ja(i>>16&255,i>>8&255,i&255,1)}function p3(i,e,t,n){return n<=0&&(i=e=t=NaN),new ja(i,e,t,n)}function tAe(i){return i instanceof F2||(i=Xc(i)),i?(i=i.rgb(),new ja(i.r,i.g,i.b,i.opacity)):new ja}function D_(i,e,t,n){return arguments.length===1?tAe(i):new ja(i,e,t,n??1)}function ja(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}d3(ja,D_,jL(F2,{brighter(i){return i=i==null?m3:Math.pow(m3,i),new ja(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?L2:Math.pow(L2,i),new ja(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new ja($A(this.r),$A(this.g),$A(this.b),g3(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:vj,formatHex:vj,formatHex8:nAe,formatRgb:bj,toString:bj}));function vj(){return`#${XA(this.r)}${XA(this.g)}${XA(this.b)}`}function nAe(){return`#${XA(this.r)}${XA(this.g)}${XA(this.b)}${XA((isNaN(this.opacity)?1:this.opacity)*255)}`}function bj(){let i=g3(this.opacity);return`${i===1?"rgb(":"rgba("}${$A(this.r)}, ${$A(this.g)}, ${$A(this.b)}${i===1?")":`, ${i})`}`}function g3(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function $A(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function XA(i){return i=$A(i),(i<16?"0":"")+i.toString(16)}function wj(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new jc(i,e,t,n)}function Tj(i){if(i instanceof jc)return new jc(i.h,i.s,i.l,i.opacity);if(i instanceof F2||(i=Xc(i)),!i)return new jc;if(i instanceof jc)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new jc(o,a,l,i.opacity)}function Ej(i,e,t,n){return arguments.length===1?Tj(i):new jc(i,e,t,n??1)}function jc(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}d3(jc,Ej,jL(F2,{brighter(i){return i=i==null?m3:Math.pow(m3,i),new jc(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?L2:Math.pow(L2,i),new jc(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new ja(XL(i>=240?i-240:i+120,r,n),XL(i,r,n),XL(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new jc(Sj(this.h),A3(this.s),A3(this.l),g3(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 i=g3(this.opacity);return`${i===1?"hsl(":"hsla("}${Sj(this.h)}, ${A3(this.s)*100}%, ${A3(this.l)*100}%${i===1?")":`, ${i})`}`}}));function Sj(i){return i=(i||0)%360,i<0?i+360:i}function A3(i){return Math.max(0,Math.min(1,i||0))}function XL(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}function $L(i,e,t,n,r){var s=i*i,o=s*i;return((1-3*i+3*s-o)*e+(4-6*s+3*o)*t+(1+3*i+3*s-3*o)*n+o*r)/6}function Mj(i){var e=i.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,e-1):Math.floor(t*e),r=i[n],s=i[n+1],o=n>0?i[n-1]:2*r-s,a=n<e-1?i[n+2]:2*s-r;return $L((t-n/e)*e,o,r,s,a)}}function Cj(i){var e=i.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*e),r=i[(n+e-1)%e],s=i[n%e],o=i[(n+1)%e],a=i[(n+2)%e];return $L((t-n/e)*e,r,s,o,a)}}var O2=i=>()=>i;function iAe(i,e){return function(t){return i+t*e}}function rAe(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function Rj(i){return(i=+i)==1?_3:function(e,t){return t-e?rAe(e,t,i):O2(isNaN(e)?t:e)}}function _3(i,e){var t=e-i;return t?iAe(i,t):O2(isNaN(i)?e:i)}var YL=(function i(e){var t=Rj(e);function n(r,s){var o=t((r=D_(r)).r,(s=D_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=_3(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return n.gamma=i,n})(1);function Pj(i){return function(e){var t=e.length,n=new Array(t),r=new Array(t),s=new Array(t),o,a;for(o=0;o<t;++o)a=D_(e[o]),n[o]=a.r||0,r[o]=a.g||0,s[o]=a.b||0;return n=i(n),r=i(r),s=i(s),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=s(l),a+""}}}var BWe=Pj(Mj),UWe=Pj(Cj);function x3(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function y3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ZL(i,e){return(y3(e)?x3:KL)(i,e)}function KL(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=YA(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function Ij(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function oh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function Nj(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=YA(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var JL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,QL=new RegExp(JL.source,"g");function sAe(i){return function(){return i}}function oAe(i){return function(e){return i(e)+""}}function Lj(i,e){var t=JL.lastIndex=QL.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=JL.exec(i))&&(r=QL.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:oh(n,r)})),t=QL.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?oAe(l[0].x):sAe(e):(e=l.length,function(c){for(var u=0,f;u<e;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function YA(i,e){var t=typeof e,n;return e==null||t==="boolean"?O2(e):(t==="number"?oh:t==="string"?(n=Xc(e))?(e=n,YL):Lj:e instanceof Xc?YL:e instanceof Date?Ij:y3(e)?x3:Array.isArray(e)?KL:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Nj:oh)(i,e)}function eD(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function tD(i){return function(){return i}}function nD(i){return+i}var Dj=[0,1];function F_(i){return i}function iD(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:tD(isNaN(e)?NaN:.5)}function aAe(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function lAe(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=iD(r,n),s=t(o,s)):(n=iD(n,r),s=t(s,o)),function(a){return s(n(a))}}function cAe(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=iD(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=I2(i,a,1,n)-1;return s[l](r[l](a))}}function Fj(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function uAe(){var i=Dj,e=Dj,t=YA,n,r,s,o=F_,a,l,c;function u(){var p=Math.min(i.length,e.length);return o!==F_&&(o=aAe(i[0],i[p-1])),a=p>2?cAe:lAe,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?s:(l||(l=a(i.map(n),e,t)))(n(o(p)))}return f.invert=function(p){return o(r((c||(c=a(e,i.map(n),oh)))(p)))},f.domain=function(p){return arguments.length?(i=Array.from(p,nD),u()):i.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),u()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),t=eD,u()},f.clamp=function(p){return arguments.length?(o=p?!0:F_,u()):o!==F_},f.interpolate=function(p){return arguments.length?(t=p,u()):t},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,x){return n=p,r=x,u()}}function rD(){return uAe()(F_,F_)}function Oj(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function ZA(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function ah(i){return i=ZA(Math.abs(i)),i?i[1]:NaN}function Bj(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function Uj(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var hAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Np(i){if(!(e=hAe.exec(i)))throw new Error("invalid format: "+i);var e;return new v3({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Np.prototype=v3.prototype;function v3(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}v3.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function kj(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var B2;function Gj(i,e){var t=ZA(i,e);if(!t)return B2=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(B2=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+ZA(i,Math.max(0,e+s-1))[0]}function sD(i,e){var t=ZA(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}var oD={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:Oj,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>sD(i*100,e),r:sD,s:Gj,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function aD(i){return i}var zj=Array.prototype.map,Vj=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function qj(i){var e=i.grouping===void 0||i.thousands===void 0?aD:Bj(zj.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?aD:Uj(zj.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"\u2212":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(f,p){f=Np(f);var x=f.fill,v=f.align,w=f.sign,S=f.symbol,T=f.zero,P=f.width,R=f.comma,C=f.precision,L=f.trim,D=f.type;D==="n"?(R=!0,D="g"):oD[D]||(C===void 0&&(C=12),L=!0,D="g"),(T||x==="0"&&v==="=")&&(T=!0,x="0",v="=");var F=(p&&p.prefix!==void 0?p.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),N=(S==="$"?n:/[%p]/.test(D)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),B=oD[D],z=/[defgprs%]/.test(D);C=C===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function V(H){var Z=F,J=N,j,K,ee;if(D==="c")J=B(H)+J,H="";else{H=+H;var ae=H<0||1/H<0;if(H=isNaN(H)?l:B(Math.abs(H),C),L&&(H=kj(H)),ae&&+H==0&&w!=="+"&&(ae=!1),Z=(ae?w==="("?w:a:w==="-"||w==="("?"":w)+Z,J=(D==="s"&&!isNaN(H)&&B2!==void 0?Vj[8+B2/3]:"")+J+(ae&&w==="("?")":""),z){for(j=-1,K=H.length;++j<K;)if(ee=H.charCodeAt(j),48>ee||ee>57){J=(ee===46?r+H.slice(j+1):H.slice(j))+J,H=H.slice(0,j);break}}}R&&!T&&(H=e(H,1/0));var ce=Z.length+H.length+J.length,de=ce<P?new Array(P-ce+1).join(x):"";switch(R&&T&&(H=e(de+H,de.length?P-J.length:1/0),de=""),v){case"<":H=Z+H+J+de;break;case"=":H=Z+de+H+J;break;case"^":H=de.slice(0,ce=de.length>>1)+Z+H+J+de.slice(ce);break;default:H=de+Z+H+J;break}return s(H)}return V.toString=function(){return f+""},V}function u(f,p){var x=Math.max(-8,Math.min(8,Math.floor(ah(p)/3)))*3,v=Math.pow(10,-x),w=c((f=Np(f),f.type="f",f),{suffix:Vj[8+x/3]});return function(S){return w(v*S)}}return{format:c,formatPrefix:u}}var b3,w3,S3;lD({thousands:",",grouping:[3],currency:["$",""]});function lD(i){return b3=qj(i),w3=b3.format,S3=b3.formatPrefix,b3}function cD(i){return Math.max(0,-ah(Math.abs(i)))}function uD(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ah(e)/3)))*3-ah(Math.abs(i)))}function hD(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,ah(e)-ah(i))+1}function fD(i,e,t,n){var r=WL(i,e,t),s;switch(n=Np(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=uD(r,o))&&(n.precision=s),S3(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=hD(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=cD(r))&&(n.precision=s-(n.type==="%")*2);break}}return w3(n)}function dD(i){var e=i.domain;return i.ticks=function(t){var n=e();return l3(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return fD(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,c,u=10;for(a<o&&(c=o,o=a,a=c,c=r,r=s,s=c);u-- >0;){if(c=N2(o,a,t),c===l)return n[r]=o,n[s]=a,e(n);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return i},i}function Xa(){var i=rD();return i.copy=function(){return Fj(i,Xa())},f3.apply(i,arguments),dD(i)}function U2(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[I2(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[i,n[0]]:c>=t?[n[t-1],e]:[n[c-1],n[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return U2().domain([i,e]).range(r).unknown(s)},f3.apply(dD(o),arguments)}var Cn=1e-6,KA=1e-12,Jn=Math.PI,Js=Jn/2,O_=Jn/4,eo=Jn*2,Zi=180/Jn,mn=Jn/180,ei=Math.abs,B_=Math.atan,as=Math.atan2,fn=Math.cos,k2=Math.ceil,Hj=Math.exp;var T3=Math.hypot,Wj=Math.log;var an=Math.sin,jj=Math.sign||function(i){return i>0?1:i<0?-1:0},yo=Math.sqrt,Xj=Math.tan;function $j(i){return i>1?0:i<-1?Jn:Math.acos(i)}function Ho(i){return i>1?Js:i<-1?-Js:Math.asin(i)}function pD(i){return(i=an(i/2))*i}function $r(){}function E3(i,e){i&&Zj.hasOwnProperty(i.type)&&Zj[i.type](i,e)}var Yj={Feature:function(i,e){E3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)E3(t[n].geometry,e)}},Zj={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){AD(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)AD(t[n],e,0)},Polygon:function(i,e){Kj(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)Kj(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)E3(t[n],e)}};function AD(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function Kj(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)AD(i[t],e,1);e.polygonEnd()}function Lp(i,e){i&&Yj.hasOwnProperty(i.type)?Yj[i.type](i,e):E3(i,e)}var G2=new xo,Qj=new xo,Jj,eX,mD,gD,_D,lh={point:$r,lineStart:$r,lineEnd:$r,polygonStart:function(){G2=new xo,lh.lineStart=fAe,lh.lineEnd=dAe},polygonEnd:function(){var i=+G2;Qj.add(i<0?eo+i:i),this.lineStart=this.lineEnd=this.point=$r},sphere:function(){Qj.add(eo)}};function fAe(){lh.point=pAe}function dAe(){tX(Jj,eX)}function pAe(i,e){lh.point=tX,Jj=i,eX=e,i*=mn,e*=mn,mD=i,gD=fn(e=e/2+O_),_D=an(e)}function tX(i,e){i*=mn,e*=mn,e=e/2+O_;var t=i-mD,n=t>=0?1:-1,r=n*t,s=fn(e),o=an(e),a=_D*o,l=gD*s+a*fn(r),c=a*n*an(r);G2.add(as(c,l)),mD=i,gD=s,_D=o}function QA(i){return[as(i[1],i[0]),Ho(i[2])]}function tc(i){var e=i[0],t=i[1],n=fn(t);return[n*fn(e),n*an(e),an(t)]}function z2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Of(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function M3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function V2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function JA(i){var e=yo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Dr,$a,Yr,yl,em,sX,oX,U_,q2,Dp,Uf,Bf={point:xD,lineStart:nX,lineEnd:iX,polygonStart:function(){Bf.point=lX,Bf.lineStart=AAe,Bf.lineEnd=mAe,q2=new xo,lh.polygonStart()},polygonEnd:function(){lh.polygonEnd(),Bf.point=xD,Bf.lineStart=nX,Bf.lineEnd=iX,G2<0?(Dr=-(Yr=180),$a=-(yl=90)):q2>Cn?yl=90:q2<-Cn&&($a=-90),Uf[0]=Dr,Uf[1]=Yr},sphere:function(){Dr=-(Yr=180),$a=-(yl=90)}};function xD(i,e){Dp.push(Uf=[Dr=i,Yr=i]),e<$a&&($a=e),e>yl&&(yl=e)}function aX(i,e){var t=tc([i*mn,e*mn]);if(U_){var n=Of(U_,t),r=[n[1],-n[0],0],s=Of(r,n);JA(s),s=QA(s);var o=i-em,a=o>0?1:-1,l=s[0]*Zi*a,c,u=ei(o)>180;u^(a*em<l&&l<a*i)?(c=s[1]*Zi,c>yl&&(yl=c)):(l=(l+360)%360-180,u^(a*em<l&&l<a*i)?(c=-s[1]*Zi,c<$a&&($a=c)):(e<$a&&($a=e),e>yl&&(yl=e))),u?i<em?xl(Dr,i)>xl(Dr,Yr)&&(Yr=i):xl(i,Yr)>xl(Dr,Yr)&&(Dr=i):Yr>=Dr?(i<Dr&&(Dr=i),i>Yr&&(Yr=i)):i>em?xl(Dr,i)>xl(Dr,Yr)&&(Yr=i):xl(i,Yr)>xl(Dr,Yr)&&(Dr=i)}else Dp.push(Uf=[Dr=i,Yr=i]);e<$a&&($a=e),e>yl&&(yl=e),U_=t,em=i}function nX(){Bf.point=aX}function iX(){Uf[0]=Dr,Uf[1]=Yr,Bf.point=xD,U_=null}function lX(i,e){if(U_){var t=i-em;q2.add(ei(t)>180?t+(t>0?360:-360):t)}else sX=i,oX=e;lh.point(i,e),aX(i,e)}function AAe(){lh.lineStart()}function mAe(){lX(sX,oX),lh.lineEnd(),ei(q2)>Cn&&(Dr=-(Yr=180)),Uf[0]=Dr,Uf[1]=Yr,U_=null}function xl(i,e){return(e-=i)<0?e+360:e}function gAe(i,e){return i[0]-e[0]}function rX(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function C3(i){var e,t,n,r,s,o,a;if(yl=Yr=-(Dr=$a=1/0),Dp=[],Lp(i,Bf),t=Dp.length){for(Dp.sort(gAe),e=1,n=Dp[0],s=[n];e<t;++e)r=Dp[e],rX(n,r[0])||rX(n,r[1])?(xl(n[0],r[1])>xl(n[0],n[1])&&(n[1]=r[1]),xl(r[0],n[1])>xl(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(o=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(a=xl(n[1],r[0]))>o&&(o=a,Dr=r[0],Yr=n[1])}return Dp=Uf=null,Dr===1/0||$a===1/0?[[NaN,NaN],[NaN,NaN]]:[[Dr,$a],[Yr,yl]]}var H2,R3,P3,I3,N3,L3,D3,F3,yD,vD,bD,hX,fX,_a,xa,ya,$c={sphere:$r,point:wD,lineStart:cX,lineEnd:uX,polygonStart:function(){$c.lineStart=yAe,$c.lineEnd=vAe},polygonEnd:function(){$c.lineStart=cX,$c.lineEnd=uX}};function wD(i,e){i*=mn,e*=mn;var t=fn(e);W2(t*fn(i),t*an(i),an(e))}function W2(i,e,t){++H2,P3+=(i-P3)/H2,I3+=(e-I3)/H2,N3+=(t-N3)/H2}function cX(){$c.point=_Ae}function _Ae(i,e){i*=mn,e*=mn;var t=fn(e);_a=t*fn(i),xa=t*an(i),ya=an(e),$c.point=xAe,W2(_a,xa,ya)}function xAe(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=as(yo((o=xa*s-ya*r)*o+(o=ya*n-_a*s)*o+(o=_a*r-xa*n)*o),_a*n+xa*r+ya*s);R3+=o,L3+=o*(_a+(_a=n)),D3+=o*(xa+(xa=r)),F3+=o*(ya+(ya=s)),W2(_a,xa,ya)}function uX(){$c.point=wD}function yAe(){$c.point=bAe}function vAe(){dX(hX,fX),$c.point=wD}function bAe(i,e){hX=i,fX=e,i*=mn,e*=mn,$c.point=dX;var t=fn(e);_a=t*fn(i),xa=t*an(i),ya=an(e),W2(_a,xa,ya)}function dX(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=xa*s-ya*r,a=ya*n-_a*s,l=_a*r-xa*n,c=T3(o,a,l),u=Ho(c),f=c&&-u/c;yD.add(f*o),vD.add(f*a),bD.add(f*l),R3+=u,L3+=u*(_a+(_a=n)),D3+=u*(xa+(xa=r)),F3+=u*(ya+(ya=s)),W2(_a,xa,ya)}function O3(i){H2=R3=P3=I3=N3=L3=D3=F3=0,yD=new xo,vD=new xo,bD=new xo,Lp(i,$c);var e=+yD,t=+vD,n=+bD,r=T3(e,t,n);return r<KA&&(e=L3,t=D3,n=F3,R3<Cn&&(e=P3,t=I3,n=N3),r=T3(e,t,n),r<KA)?[NaN,NaN]:[as(t,e)*Zi,Ho(n/r)*Zi]}function j2(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function SD(i,e){return ei(i)>Jn&&(i-=Math.round(i/eo)*eo),[i,e]}SD.invert=SD;function TD(i,e,t){return(i%=eo)?e||t?j2(AX(i),mX(e,t)):AX(i):e||t?mX(e,t):SD}function pX(i){return function(e,t){return e+=i,ei(e)>Jn&&(e-=Math.round(e/eo)*eo),[e,t]}}function AX(i){var e=pX(i);return e.invert=pX(-i),e}function mX(i,e){var t=fn(i),n=an(i),r=fn(e),s=an(e);function o(a,l){var c=fn(l),u=fn(a)*c,f=an(a)*c,p=an(l),x=p*t+u*n;return[as(f*r-x*s,u*t-p*n),Ho(x*r+f*s)]}return o.invert=function(a,l){var c=fn(l),u=fn(a)*c,f=an(a)*c,p=an(l),x=p*r-f*s;return[as(f*r+p*s,u*t+x*n),Ho(x*t-u*n)]},o}function ED(i){i=TD(i[0]*mn,i[1]*mn,i.length>2?i[2]*mn:0);function e(t){return t=i(t[0]*mn,t[1]*mn),t[0]*=Zi,t[1]*=Zi,t}return e.invert=function(t){return t=i.invert(t[0]*mn,t[1]*mn),t[0]*=Zi,t[1]*=Zi,t},e}function _X(i,e,t,n,r,s){if(t){var o=fn(e),a=an(e),l=n*t;r==null?(r=e+n*eo,s=e-l/2):(r=gX(o,r),s=gX(o,s),(n>0?r<s:r>s)&&(r+=n*eo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=QA([o,-a*fn(u),-a*an(u)]),i.point(c[0],c[1])}}function gX(i,e){e=tc(e),e[0]-=i,JA(e);var t=$j(-e[1]);return((-e[2]<0?-t:t)+eo-Cn)%eo}function B3(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:$r,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function k_(i,e){return ei(i[0]-e[0])<Cn&&ei(i[1]-e[1])<Cn}function U3(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function k3(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(v){if(!((w=v.length-1)<=0)){var w,S=v[0],T=v[w],P;if(k_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=v[a])[0],S[1]);r.lineEnd();return}T[0]+=2*Cn}s.push(P=new U3(S,v,null,!0)),o.push(P.o=new U3(S,null,P,!1)),s.push(P=new U3(T,v,null,!1)),o.push(P.o=new U3(T,null,P,!0))}}),!!s.length){for(o.sort(e),xX(s),xX(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var p=c,x=!0;p.v;)if((p=p.n)===c)return;u=p.z,r.lineStart();do{if(p.v=p.o.v=!0,p.e){if(x)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(p.x,p.n.x,1,r);p=p.n}else{if(x)for(u=p.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(p.x,p.p.x,-1,r);p=p.p}p=p.o,u=p.z,x=!x}while(!p.v);r.lineEnd()}}}function xX(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function MD(i){return ei(i[0])<=Jn?i[0]:jj(i[0])*((ei(i[0])+Jn)%eo-Jn)}function G3(i,e){var t=MD(e),n=e[1],r=an(n),s=[an(t),-fn(t),0],o=0,a=0,l=new xo;r===1?n=Js+Cn:r===-1&&(n=-Js-Cn);for(var c=0,u=i.length;c<u;++c)if(p=(f=i[c]).length)for(var f,p,x=f[p-1],v=MD(x),w=x[1]/2+O_,S=an(w),T=fn(w),P=0;P<p;++P,v=C,S=D,T=F,x=R){var R=f[P],C=MD(R),L=R[1]/2+O_,D=an(L),F=fn(L),N=C-v,B=N>=0?1:-1,z=B*N,V=z>Jn,H=S*D;if(l.add(as(H*B*an(z),T*F+H*fn(z))),o+=V?N+B*eo:N,V^v>=t^C>=t){var Z=Of(tc(x),tc(R));JA(Z);var J=Of(s,Z);JA(J);var j=(V^N>=0?-1:1)*Ho(J[2]);(n>j||n===j&&(Z[0]||Z[1]))&&(a+=V^N>=0?1:-1)}}return(o<-Cn||o<Cn&&l<-KA)^a&1}function z3(i,e,t,n){return function(r){var s=e(r),o=B3(),a=e(o),l=!1,c,u,f,p={point:x,lineStart:w,lineEnd:S,polygonStart:function(){p.point=T,p.lineStart=P,p.lineEnd=R,u=[],c=[]},polygonEnd:function(){p.point=x,p.lineStart=w,p.lineEnd=S,u=rh(u);var C=G3(c,n);u.length?(l||(r.polygonStart(),l=!0),k3(u,SAe,C,t,r)):C&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),u=c=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function x(C,L){i(C,L)&&r.point(C,L)}function v(C,L){s.point(C,L)}function w(){p.point=v,s.lineStart()}function S(){p.point=x,s.lineEnd()}function T(C,L){f.push([C,L]),a.point(C,L)}function P(){a.lineStart(),f=[]}function R(){T(f[0][0],f[0][1]),a.lineEnd();var C=a.clean(),L=o.result(),D,F=L.length,N,B,z;if(f.pop(),c.push(f),f=null,!!F){if(C&1){if(B=L[0],(N=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<N;++D)r.point((z=B[D])[0],z[1]);r.lineEnd()}return}F>1&&C&2&&L.push(L.pop().concat(L.shift())),u.push(L.filter(wAe))}}return p}}function wAe(i){return i.length>1}function SAe(i,e){return((i=i.x)[0]<0?i[1]-Js-Cn:Js-i[1])-((e=e.x)[0]<0?e[1]-Js-Cn:Js-e[1])}var CD=z3(function(){return!0},TAe,MAe,[-Jn,-Js]);function TAe(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?Jn:-Jn,l=ei(s-e);ei(l-Jn)<Cn?(i.point(e,t=(t+o)/2>0?Js:-Js),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=Jn&&(ei(e-n)<Cn&&(e-=n*Cn),ei(s-a)<Cn&&(s-=a*Cn),t=EAe(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function EAe(i,e,t,n){var r,s,o=an(i-t);return ei(o)>Cn?B_((an(e)*(s=fn(n))*an(t)-an(n)*(r=fn(e))*an(i))/(r*s*o)):(e+n)/2}function MAe(i,e,t,n){var r;if(i==null)r=t*Js,n.point(-Jn,r),n.point(0,r),n.point(Jn,r),n.point(Jn,0),n.point(Jn,-r),n.point(0,-r),n.point(-Jn,-r),n.point(-Jn,0),n.point(-Jn,r);else if(ei(i[0]-e[0])>Cn){var s=i[0]<e[0]?Jn:-Jn;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function yX(i){var e=fn(i),t=2*mn,n=e>0,r=ei(e)>Cn;function s(u,f,p,x){_X(x,i,t,p,u,f)}function o(u,f){return fn(u)*fn(f)>e}function a(u){var f,p,x,v,w;return{lineStart:function(){v=x=!1,w=1},point:function(S,T){var P=[S,T],R,C=o(S,T),L=n?C?0:c(S,T):C?c(S+(S<0?Jn:-Jn),T):0;if(!f&&(v=x=C)&&u.lineStart(),C!==x&&(R=l(f,P),(!R||k_(f,R)||k_(P,R))&&(P[2]=1)),C!==x)w=0,C?(u.lineStart(),R=l(P,f),u.point(R[0],R[1])):(R=l(f,P),u.point(R[0],R[1],2),u.lineEnd()),f=R;else if(r&&f&&n^C){var D;!(L&p)&&(D=l(P,f,!0))&&(w=0,n?(u.lineStart(),u.point(D[0][0],D[0][1]),u.point(D[1][0],D[1][1]),u.lineEnd()):(u.point(D[1][0],D[1][1]),u.lineEnd(),u.lineStart(),u.point(D[0][0],D[0][1],3)))}C&&(!f||!k_(f,P))&&u.point(P[0],P[1]),f=P,x=C,p=L},lineEnd:function(){x&&u.lineEnd(),f=null},clean:function(){return w|(v&&x)<<1}}}function l(u,f,p){var x=tc(u),v=tc(f),w=[1,0,0],S=Of(x,v),T=z2(S,S),P=S[0],R=T-P*P;if(!R)return!p&&u;var C=e*T/R,L=-e*P/R,D=Of(w,S),F=V2(w,C),N=V2(S,L);M3(F,N);var B=D,z=z2(F,B),V=z2(B,B),H=z*z-V*(z2(F,F)-1);if(!(H<0)){var Z=yo(H),J=V2(B,(-z-Z)/V);if(M3(J,F),J=QA(J),!p)return J;var j=u[0],K=f[0],ee=u[1],ae=f[1],ce;K<j&&(ce=j,j=K,K=ce);var de=K-j,ve=ei(de-Jn)<Cn,Ie=ve||de<Cn;if(!ve&&ae<ee&&(ce=ee,ee=ae,ae=ce),Ie?ve?ee+ae>0^J[1]<(ei(J[0]-j)<Cn?ee:ae):ee<=J[1]&&J[1]<=ae:de>Jn^(j<=J[0]&&J[0]<=K)){var Qe=V2(B,(-z+Z)/V);return M3(Qe,F),[J,QA(Qe)]}}}function c(u,f){var p=n?i:Jn-i,x=0;return u<-p?x|=1:u>p&&(x|=2),f<-p?x|=4:f>p&&(x|=8),x}return z3(o,a,s,n?[0,-i]:[-Jn,i-Jn])}function vX(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,p=l-o,x=c-a,v;if(v=t-o,!(!p&&v>0)){if(v/=p,p<0){if(v<u)return;v<f&&(f=v)}else if(p>0){if(v>f)return;v>u&&(u=v)}if(v=r-o,!(!p&&v<0)){if(v/=p,p<0){if(v>f)return;v>u&&(u=v)}else if(p>0){if(v<u)return;v<f&&(f=v)}if(v=n-a,!(!x&&v>0)){if(v/=x,x<0){if(v<u)return;v<f&&(f=v)}else if(x>0){if(v>f)return;v>u&&(u=v)}if(v=s-a,!(!x&&v<0)){if(v/=x,x<0){if(v>f)return;v>u&&(u=v)}else if(x>0){if(v<u)return;v<f&&(f=v)}return u>0&&(i[0]=o+u*p,i[1]=a+u*x),f<1&&(e[0]=o+f*p,e[1]=a+f*x),!0}}}}}var X2=1e9,V3=-X2;function RD(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,p){var x=0,v=0;if(c==null||(x=o(c,f))!==(v=o(u,f))||l(c,u)<0^f>0)do p.point(x===0||x===3?i:t,x>1?n:e);while((x=(x+f+4)%4)!==v);else p.point(u[0],u[1])}function o(c,u){return ei(c[0]-i)<Cn?u>0?0:3:ei(c[0]-t)<Cn?u>0?2:1:ei(c[1]-e)<Cn?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),p=o(u,1);return f!==p?f-p:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=B3(),p,x,v,w,S,T,P,R,C,L,D,F={point:N,lineStart:H,lineEnd:Z,polygonStart:z,polygonEnd:V};function N(j,K){r(j,K)&&u.point(j,K)}function B(){for(var j=0,K=0,ee=x.length;K<ee;++K)for(var ae=x[K],ce=1,de=ae.length,ve=ae[0],Ie,Qe,Ue=ve[0],mt=ve[1];ce<de;++ce)Ie=Ue,Qe=mt,ve=ae[ce],Ue=ve[0],mt=ve[1],Qe<=n?mt>n&&(Ue-Ie)*(n-Qe)>(mt-Qe)*(i-Ie)&&++j:mt<=n&&(Ue-Ie)*(n-Qe)<(mt-Qe)*(i-Ie)&&--j;return j}function z(){u=f,p=[],x=[],D=!0}function V(){var j=B(),K=D&&j,ee=(p=rh(p)).length;(K||ee)&&(c.polygonStart(),K&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),ee&&k3(p,a,j,s,c),c.polygonEnd()),u=c,p=x=v=null}function H(){F.point=J,x&&x.push(v=[]),L=!0,C=!1,P=R=NaN}function Z(){p&&(J(w,S),T&&C&&f.rejoin(),p.push(f.result())),F.point=N,C&&u.lineEnd()}function J(j,K){var ee=r(j,K);if(x&&v.push([j,K]),L)w=j,S=K,T=ee,L=!1,ee&&(u.lineStart(),u.point(j,K));else if(ee&&C)u.point(j,K);else{var ae=[P=Math.max(V3,Math.min(X2,P)),R=Math.max(V3,Math.min(X2,R))],ce=[j=Math.max(V3,Math.min(X2,j)),K=Math.max(V3,Math.min(X2,K))];vX(ae,ce,i,e,t,n)?(C||(u.lineStart(),u.point(ae[0],ae[1])),u.point(ce[0],ce[1]),ee||u.lineEnd(),D=!1):ee&&(u.lineStart(),u.point(j,K),D=!1)}P=j,R=K,C=ee}return F}}var PD,ID,q3,H3,G_={sphere:$r,point:$r,lineStart:CAe,lineEnd:$r,polygonStart:$r,polygonEnd:$r};function CAe(){G_.point=PAe,G_.lineEnd=RAe}function RAe(){G_.point=G_.lineEnd=$r}function PAe(i,e){i*=mn,e*=mn,ID=i,q3=an(e),H3=fn(e),G_.point=IAe}function IAe(i,e){i*=mn,e*=mn;var t=an(e),n=fn(e),r=ei(i-ID),s=fn(r),o=an(r),a=n*o,l=H3*t-q3*n*s,c=q3*t+H3*n*s;PD.add(as(yo(a*a+l*l),c)),ID=i,q3=t,H3=n}function bX(i){return PD=new xo,Lp(i,G_),+PD}var ND=[null,null],NAe={type:"LineString",coordinates:ND};function Ya(i,e){return ND[0]=i,ND[1]=e,bX(NAe)}var wX={Feature:function(i,e){return W3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(W3(t[n].geometry,e))return!0;return!1}},SX={Sphere:function(){return!0},Point:function(i,e){return TX(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(TX(t[n],e))return!0;return!1},LineString:function(i,e){return EX(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(EX(t[n],e))return!0;return!1},Polygon:function(i,e){return MX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(MX(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(W3(t[n],e))return!0;return!1}};function W3(i,e){return i&&SX.hasOwnProperty(i.type)?SX[i.type](i,e):!1}function TX(i,e){return Ya(i,e)===0}function EX(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Ya(i[s],e),n===0||s>0&&(r=Ya(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<KA*r))return!0;t=n}return!1}function MX(i,e){return!!G3(i.map(LAe),CX(e))}function LAe(i){return i=i.map(CX),i.pop(),i}function CX(i){return[i[0]*mn,i[1]*mn]}function LD(i,e){return(i&&wX.hasOwnProperty(i.type)?wX[i.type]:W3)(i,e)}function RX(i,e,t){var n=Ff(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function PX(i,e,t){var n=Ff(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function DD(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,p,x,v,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:P()}}function P(){return Ff(k2(n/u)*u,t,u).map(v).concat(Ff(k2(a/f)*f,o,f).map(w)).concat(Ff(k2(e/l)*l,i,l).filter(function(R){return ei(R%u)>Cn}).map(p)).concat(Ff(k2(s/c)*c,r,c).filter(function(R){return ei(R%f)>Cn}).map(x))}return T.lines=function(){return P().map(function(R){return{type:"LineString",coordinates:R}})},T.outline=function(){return{type:"Polygon",coordinates:[v(n).concat(w(o).slice(1),v(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(R){return arguments.length?T.extentMajor(R).extentMinor(R):T.extentMinor()},T.extentMajor=function(R){return arguments.length?(n=+R[0][0],t=+R[1][0],a=+R[0][1],o=+R[1][1],n>t&&(R=n,n=t,t=R),a>o&&(R=a,a=o,o=R),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(R){return arguments.length?(e=+R[0][0],i=+R[1][0],s=+R[0][1],r=+R[1][1],e>i&&(R=e,e=i,i=R),s>r&&(R=s,s=r,r=R),T.precision(S)):[[e,s],[i,r]]},T.step=function(R){return arguments.length?T.stepMajor(R).stepMinor(R):T.stepMinor()},T.stepMajor=function(R){return arguments.length?(u=+R[0],f=+R[1],T):[u,f]},T.stepMinor=function(R){return arguments.length?(l=+R[0],c=+R[1],T):[l,c]},T.precision=function(R){return arguments.length?(S=+R,p=RX(s,r,90),x=PX(e,i,S),v=RX(a,o,90),w=PX(n,t,S),T):S},T.extentMajor([[-180,-90+Cn],[180,90-Cn]]).extentMinor([[-180,-80-Cn],[180,80+Cn]])}function FD(){return DD()()}function tm(i,e){var t=i[0]*mn,n=i[1]*mn,r=e[0]*mn,s=e[1]*mn,o=fn(n),a=an(n),l=fn(s),c=an(s),u=o*fn(t),f=o*an(t),p=l*fn(r),x=l*an(r),v=2*Ho(yo(pD(s-n)+o*l*pD(r-t))),w=an(v),S=v?function(T){var P=an(T*=v)/w,R=an(v-T)/w,C=R*u+P*p,L=R*f+P*x,D=R*a+P*c;return[as(L,C)*Zi,as(D,yo(C*C+L*L))*Zi]}:function(){return[t*Zi,n*Zi]};return S.distance=v,S}var OD=i=>i;var z_=1/0,j3=z_,$2=-z_,X3=$2,DAe={point:FAe,lineStart:$r,lineEnd:$r,polygonStart:$r,polygonEnd:$r,result:function(){var i=[[z_,j3],[$2,X3]];return $2=X3=-(j3=z_=1/0),i}};function FAe(i,e){i<z_&&(z_=i),i>$2&&($2=i),e<j3&&(j3=e),e>X3&&(X3=e)}var BD=DAe;function Y2(i){return function(e){var t=new UD;for(var n in i)t[n]=i[n];return t.stream=e,t}}function UD(){}UD.prototype={constructor:UD,point:function(i,e){this.stream.point(i,e)},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()}};function kD(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),Lp(t,i.stream(BD)),e(BD.result()),n!=null&&i.clipExtent(n),i}function GD(i,e,t){return kD(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function IX(i,e,t){return GD(i,[[0,0],e],t)}function NX(i,e,t){return kD(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function LX(i,e,t){return kD(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var DX=16,OAe=fn(30*mn);function zD(i,e){return+e?UAe(i,e):BAe(i)}function BAe(i){return Y2({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function UAe(i,e){function t(n,r,s,o,a,l,c,u,f,p,x,v,w,S){var T=c-n,P=u-r,R=T*T+P*P;if(R>4*e&&w--){var C=o+p,L=a+x,D=l+v,F=yo(C*C+L*L+D*D),N=Ho(D/=F),B=ei(ei(D)-1)<Cn||ei(s-f)<Cn?(s+f)/2:as(L,C),z=i(B,N),V=z[0],H=z[1],Z=V-n,J=H-r,j=P*Z-T*J;(j*j/R>e||ei((T*Z+P*J)/R-.5)>.3||o*p+a*x+l*v<OAe)&&(t(n,r,s,o,a,l,V,H,B,C/=F,L/=F,D,w,S),S.point(V,H),t(V,H,B,C,L,D,c,u,f,p,x,v,w,S))}}return function(n){var r,s,o,a,l,c,u,f,p,x,v,w,S={point:T,lineStart:P,lineEnd:C,polygonStart:function(){n.polygonStart(),S.lineStart=L},polygonEnd:function(){n.polygonEnd(),S.lineStart=P}};function T(N,B){N=i(N,B),n.point(N[0],N[1])}function P(){f=NaN,S.point=R,n.lineStart()}function R(N,B){var z=tc([N,B]),V=i(N,B);t(f,p,u,x,v,w,f=V[0],p=V[1],u=N,x=z[0],v=z[1],w=z[2],DX,n),n.point(f,p)}function C(){S.point=T,n.lineEnd()}function L(){P(),S.point=D,S.lineEnd=F}function D(N,B){R(r=N,B),s=f,o=p,a=x,l=v,c=w,S.point=R}function F(){t(f,p,u,x,v,w,s,o,r,a,l,c,DX,n),S.lineEnd=C,C()}return S}}var kAe=Y2({point:function(i,e){this.stream.point(i*mn,e*mn)}});function GAe(i){return Y2({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function zAe(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function FX(i,e,t,n,r,s){if(!s)return zAe(i,e,t,n,r);var o=fn(s),a=an(s),l=o*i,c=a*i,u=o/i,f=a/i,p=(a*t-o*e)/i,x=(a*e+o*t)/i;function v(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return v.invert=function(w,S){return[n*(u*w-f*S+p),r*(x-f*w-u*S)]},v}function VD(i){return VAe(function(){return i})()}function VAe(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,p=1,x=1,v=null,w=CD,S=null,T,P,R,C=OD,L=.5,D,F,N,B,z;function V(j){return N(j[0]*mn,j[1]*mn)}function H(j){return j=N.invert(j[0],j[1]),j&&[j[0]*Zi,j[1]*Zi]}V.stream=function(j){return B&&z===j?B:B=kAe(GAe(u)(w(D(C(z=j)))))},V.preclip=function(j){return arguments.length?(w=j,v=void 0,J()):w},V.postclip=function(j){return arguments.length?(C=j,S=T=P=R=null,J()):C},V.clipAngle=function(j){return arguments.length?(w=+j?yX(v=j*mn):(v=null,CD),J()):v*Zi},V.clipExtent=function(j){return arguments.length?(C=j==null?(S=T=P=R=null,OD):RD(S=+j[0][0],T=+j[0][1],P=+j[1][0],R=+j[1][1]),J()):S==null?null:[[S,T],[P,R]]},V.scale=function(j){return arguments.length?(t=+j,Z()):t},V.translate=function(j){return arguments.length?(n=+j[0],r=+j[1],Z()):[n,r]},V.center=function(j){return arguments.length?(s=j[0]%360*mn,o=j[1]%360*mn,Z()):[s*Zi,o*Zi]},V.rotate=function(j){return arguments.length?(a=j[0]%360*mn,l=j[1]%360*mn,c=j.length>2?j[2]%360*mn:0,Z()):[a*Zi,l*Zi,c*Zi]},V.angle=function(j){return arguments.length?(f=j%360*mn,Z()):f*Zi},V.reflectX=function(j){return arguments.length?(p=j?-1:1,Z()):p<0},V.reflectY=function(j){return arguments.length?(x=j?-1:1,Z()):x<0},V.precision=function(j){return arguments.length?(D=zD(F,L=j*j),J()):yo(L)},V.fitExtent=function(j,K){return GD(V,j,K)},V.fitSize=function(j,K){return IX(V,j,K)},V.fitWidth=function(j,K){return NX(V,j,K)},V.fitHeight=function(j,K){return LX(V,j,K)};function Z(){var j=FX(t,0,0,p,x,f).apply(null,e(s,o)),K=FX(t,n-j[0],r-j[1],p,x,f);return u=TD(a,l,c),F=j2(e,K),N=j2(u,F),D=zD(F,L),J()}function J(){return B=z=null,V}return function(){return e=i.apply(this,arguments),V.invert=e.invert&&H,Z()}}function OX(i){return function(e,t){var n=yo(e*e+t*t),r=i(n),s=an(r),o=fn(r);return[as(e*s,n*o),Ho(n&&t*s/n)]}}function Z2(i,e){return[i,Wj(Xj((Js+e)/2))]}Z2.invert=function(i,e){return[i,2*B_(Hj(e))-Js]};function qD(i,e){var t=fn(e),n=1+fn(i)*t;return[t*an(i)/n,an(e)/n]}qD.invert=OX(function(i){return 2*B_(i)});function HD(){return VD(qD).scale(250).clipAngle(142)}function XD(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function qAe(i){if(Array.isArray(i))return i}function HAe(i){if(Array.isArray(i))return XD(i)}function K2(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function WAe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function jAe(i,e,t){return e=K3(e),nme(i,zX()?Reflect.construct(e,[],K3(i).constructor):e.apply(i,t))}function GX(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function XAe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ti(i,e){return i.get(K2(i,e))}function Fp(i,e,t){GX(i,e),e.set(i,t)}function Op(i,e,t){return i.set(K2(i,e),t),t}function $Ae(i,e){GX(i,e),e.add(i)}function YAe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,qX(n.key),n)}}function ZAe(i,e,t){return e&&YAe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function V_(i,e,t){return(e=qX(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function K3(i){return K3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},K3(i)}function KAe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&$D(i,e)}function zX(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zX=function(){return!!i})()}function QAe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function JAe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function eme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4118+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4119+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nme(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return WAe(i)}function $D(i,e){return $D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},$D(i,e)}function Z3(i,e){return qAe(i)||JAe(i,e)||HX(i,e)||eme()}function VX(i){return HAe(i)||QAe(i)||HX(i)||tme()}function ime(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function qX(i){var e=ime(i,"string");return typeof e=="symbol"?e:e+""}function HX(i,e){if(i){if(typeof i=="string")return XD(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?XD(i,e):void 0}}var WX=function(e){e instanceof Array?e.forEach(WX):(e.map&&e.map.dispose(),e.dispose())},YD=function(e){e.geometry&&e.geometry.dispose(),e.material&&WX(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(YD)};function jX(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function rme(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function nm(i){return i*Math.PI/180}var XX=function(e){return 1-(Z2(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},WD=function(e){return Math.max(0,Math.min(1,XX(e)))},BX=function(e){return .5-Z2.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},sme=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=Xa().domain([1,0]).range([t,n]).clamp(!0),s=Xa().domain([WD(t),WD(n)]).range([1,0]).clamp(!0),o=function(f){return s(WD(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},UX=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,XX(a))));var l=Math.floor(a*s);return[o,l]},ZD=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),c=360/l,u=180/l,f=s===void 0?l-1:s,p=o===void 0?l-1:o,x=n,v=Math.min(l-1,f);x<=v;x++)for(var w=r,S=Math.min(l-1,p);w<=S;w++){var T=w,P=u;if(t){T=w===0?w:BX(w/l)*l;var R=w+1===l?w+1:BX((w+1)/l)*l;P=(R-T)*180/l}var C=-180+(x+.5)*c,L=90-(T*180/l+P/2),D=P;a.push({x,y:w,lng:C,lat:L,latLen:D})}return a},ome=6,ame=7,lme=3,cme=90,ch=new WeakMap,Bp=new WeakMap,jD=new WeakMap,$3=new WeakMap,nc=new WeakMap,Q3=new WeakMap,q_=new WeakMap,im=new WeakMap,Y3=new WeakSet,$X=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,c=l===void 0?17:l,u=r.mercatorProjection,f=u===void 0?!0:u;return XAe(this,e),n=jAe(this,e),$Ae(n,Y3),Fp(n,ch,void 0),Fp(n,Bp,void 0),Fp(n,jD,void 0),Fp(n,$3,void 0),Fp(n,nc,{}),Fp(n,Q3,void 0),Fp(n,q_,void 0),Fp(n,im,void 0),V_(n,"minLevel",void 0),V_(n,"maxLevel",void 0),V_(n,"thresholds",VX(new Array(30)).map(function(p,x){return 8/Math.pow(2,x)})),V_(n,"curvatureResolution",5),V_(n,"tileMargin",0),V_(n,"clearTiles",function(){Object.values(ti(nc,n)).forEach(function(p){p.forEach(function(x){x.obj&&(n.remove(x.obj),YD(x.obj),delete x.obj)})}),Op(nc,n,{})}),Op(ch,n,t),n.tileUrl=s,Op(Bp,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Op(im,n,new Hn(new pa(ti(ch,n)*.99,180,90),new Us({color:0})))),ti(im,n).visible=!1,ti(im,n).material.polygonOffset=!0,ti(im,n).material.polygonOffsetUnits=3,ti(im,n).material.polygonOffsetFactor=1,n}return KAe(e,i),ZAe(e,[{key:"tileUrl",get:function(){return ti(jD,this)},set:function(n){Op(jD,this,n),this.updatePov(ti(q_,this))}},{key:"level",get:function(){return ti($3,this)},set:function(n){var r,s=this;ti(nc,this)[n]||K2(Y3,this,ume).call(this,n);var o=ti($3,this);if(Op($3,this,n),!(n===o||o===void 0)){if(ti(im,this).visible=n>0,ti(nc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=ti(nc,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)ti(nc,this)[a]&&ti(nc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),YD(l.obj),delete l.obj)});K2(Y3,this,kX).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Rf))){Op(q_,this,n);var s;if(Op(Q3,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),p=u.lng,x=u.lat,v=u.latLen,w=p-f/2,S=p+f/2,T=x-v/2,P=x+v/2;u.hullPnts=[[x,p],[T,w],[P,w],[T,S],[P,S]].map(function(R){var C=Z3(R,2),L=C[0],D=C[1];return jX(L,D,ti(ch,r))}).map(function(R){var C=R.x,L=R.y,D=R.z;return new ie(C,L,D)})}return s||(s=new Zl,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new on().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(R){return s.containsPoint(R.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new ie)),l=(a-ti(ch,this))/ti(ch,this),c=this.thresholds.findIndex(function(u){return u&&u<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,c<0?this.thresholds.length:c)),K2(Y3,this,kX).call(this)}}}}])})(xs);function ume(i){var e=this;if(i>ame){ti(nc,this)[i]=[];return}var t=ti(nc,this)[i]=ZD(i,ti(Bp,this));t.forEach(function(n){return n.centroid=jX(n.lat,n.lng,ti(ch,e))}),t.octree=P2().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function kX(){var i=this;if(!(!this.tileUrl||this.level===void 0||!ti(nc,this).hasOwnProperty(this.level))&&!(!ti(Q3,this)&&this.level>ome)){var e=ti(nc,this)[this.level];if(ti(q_,this)){var t=this.worldToLocal(ti(q_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(ti(q_,this).position.clone()),s=(r.length()-ti(ch,this))*lme;e=(n=e.octree).findAllWithinRadius.apply(n,VX(r).concat([s]))}else{var o=rme(t),a=(o.r/ti(ch,this)-1)*cme,l=a/Math.cos(nm(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=UX(this.level,ti(Bp,this),c[0],u[0]),p=Z3(f,2),x=p[0],v=p[1],w=UX(this.level,ti(Bp,this),c[1],u[1]),S=Z3(w,2),T=S[0],P=S[1];!e.record&&(e.record={});var R=e.record;if(!R.hasOwnProperty("".concat(Math.round((x+T)/2),"_").concat(Math.round((v+P)/2))))e=ZD(this.level,ti(Bp,this),x,v,T,P).map(function(N){var B="".concat(N.x,"_").concat(N.y);return R.hasOwnProperty(B)?R[B]:(R[B]=N,e.push(N),N)});else{for(var C=[],L=x;L<=T;L++)for(var D=v;D<=P;D++){var F="".concat(L,"_").concat(D);R.hasOwnProperty(F)||(R[F]=ZD(this.level,ti(Bp,this),L,D,L,D)[0],e.push(R[F])),C.push(R[F])}e=C}}}e.filter(function(N){return!N.obj}).filter(ti(Q3,this)||function(){return!0}).forEach(function(N){var B=N.x,z=N.y,V=N.lng,H=N.lat,Z=N.latLen,J=360/Math.pow(2,i.level);if(!N.obj){var j=J*(1-i.tileMargin),K=Z*(1-i.tileMargin),ee=nm(V),ae=nm(-H),ce=new Hn(new pa(ti(ch,i),Math.ceil(j/i.curvatureResolution),Math.ceil(K/i.curvatureResolution),nm(90-j/2)+ee,nm(j),nm(90-K/2)+ae,nm(K)),new Aa);if(ti(Bp,i)){var de=[H+Z/2,H-Z/2].map(function(Ue){return .5-Ue/180}),ve=Z3(de,2),Ie=ve[0],Qe=ve[1];sme(ce.geometry.attributes.uv,Ie,Qe)}N.obj=ce}N.loading||(N.loading=!0,new zc().load(i.tileUrl(B,z,i.level),function(Ue){var mt=N.obj;mt&&(Ue.colorSpace=Wr,mt.material.map=Ue,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),N.loading=!1}))})}}var tv=new Set,KD=!1;function r6(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;tv.size&&tv.clear();let s=QX(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=Ame(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return QD(s,o,a,l,c),o}function QX(i,e,t,n,r){let s=null;if(r===Cme(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=KX(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=KX(o/n|0,i[o],i[o+1],s);return s&&nv(s,s.next)&&(rv(s),s=s.next),s}function sm(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(tv.size===0||!tv.has(n))&&(nv(n,n.next)||Ts(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),KD=!0,rv(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function QD(i,e,t,n,r){r&&bme(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Ts(a,i,l)<0&&(r?fme(i,t,n,r):hme(i))){e.push(a.i,i.i,l.i),rv(i),i=l,s=l;continue}if(i=l,i===s){if(KD=!1,i=sm(i),KD){s=i;continue}if(!o){i=dme(i,e),s=i,o=!0;continue}pme(i,e,t,n,r);break}}}function hme(i){let e=i.prev,t=i,n=i.next,r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&!(r===v.x&&a===v.y)&&nE(r,a,s,l,o,c,v.x,v.y)&&Ts(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function fme(i,e,t,n){let r=i.prev,s=i,o=i.next,a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=n6(x,v,e,t,n),P=n6(w,S,e,t,n),R=i.prevZ;for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==o&&!(a===R.x&&u===R.y)&&nE(a,u,l,f,c,p,R.x,R.y)&&Ts(R.prev,R,R.next)>=0)return!1;R=R.prevZ}let C=i.nextZ;for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==o&&!(a===C.x&&u===C.y)&&nE(a,u,l,f,c,p,C.x,C.y)&&Ts(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function dme(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;t$(r,t,t.next,s,!1)&&iv(r,s)&&iv(s,r)&&(e.push(r.i,t.i,s.i),rv(t),rv(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?sm(t):t}function pme(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&Tme(s,o)){let a=n$(s,o);s=sm(s,s.next),a=sm(a,a.next),QD(s,e,t,n,r),QD(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var JD=!1;function Ame(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=QX(i,a,l,n,!1);c===c.next&&tv.add(c),r.push(Sme(c))}r.sort(mme),_me(i.length/n,e.length),e$(t,t),JD=!0;for(let s=0;s<r.length;s++)t=gme(r[s],t);return JD=!1,sm(t)}function mme(i,e){return i.x-e.x||i.y-e.y||(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)}function gme(i,e){let t=yme(i,e);if(!t)return e;let n=n$(t,i),r=n.next;return e$(t,r.next),sm(n,n.next),sm(t,t.next)}var JX=16,Zr=new Float64Array(0),tE=0,e6=[],t6=[];function _me(i,e){let t=Math.ceil((i+2*e)/JX)+e+2;Zr.length<t*4&&(Zr=new Float64Array(t*4)),tE=0}function e$(i,e){let t=i;do{let n=tE++;e6[n]=t;let r=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{let u=t.next;t.z=n,t.x<r&&(r=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),u.x<r&&(r=u.x),u.x>o&&(o=u.x),u.y<s&&(s=u.y),u.y>a&&(a=u.y),t=u}while(++l<JX&&t!==e);t6[n]=t;let c=n*4;Zr[c]=r,Zr[c+1]=s,Zr[c+2]=o,Zr[c+3]=a}while(t!==e)}function xme(i,e){let t=i.z*4;e.x<Zr[t]&&(Zr[t]=e.x),e.y<Zr[t+1]&&(Zr[t+1]=e.y),e.x>Zr[t+2]&&(Zr[t+2]=e.x),e.y>Zr[t+3]&&(Zr[t+3]=e.y)}function YX(i){let e=t6[i];for(;e.prev.next!==e;)e=e.next;return t6[i]=e,e}function ZX(i){let e=e6[i];for(;e.prev.next!==e;)e=e.next;return e6[i]=e,e}function yme(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(nv(i,t))return t;for(let p=0,x=0;p<tE;p++,x+=4){if(r<Zr[x+1]||r>Zr[x+3]||Zr[x]>n||Zr[x+2]<=s)continue;let v=YX(p);t=ZX(p);do{if(t.prev.next===t){if(nv(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let w=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(w<=n&&w>s&&(s=w,o=t.x<t.next.x?t:t.next,w===n))return o}}t=t.next}while(t!==v)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(r,l),u=Math.max(r,l),f=1/0;for(let p=0,x=0;p<tE;p++,x+=4){if(Zr[x+2]<a||Zr[x]>n||Zr[x+3]<c||Zr[x+1]>u)continue;let v=YX(p);t=ZX(p);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&nE(r<l?n:s,r,a,l,r<l?s:n,r,t.x,t.y)){let w=Math.abs(r-t.y)/(n-t.x);(iv(t,i)||t.y===r&&t.next.y===r&&t.next.x>n)&&(w<f||w===f&&(t.x>o.x||t.x===o.x&&vme(o,t)))&&(o=t,f=w)}t=t.next}while(t!==v)}return o}function vme(i,e){return Ts(i.prev,i,e.prev)<0&&Ts(e.next,i,i.next)<0}var ic=[],Q2=[],rm=new Uint32Array(0),J2=new Uint32Array(0),ev=new Uint32Array(256);function bme(i,e,t,n){let r=i,s=0;do r.z=n6(r.x,r.y,e,t,n),ic[s++]=r,r=r.next;while(r!==i);wme(s);let o=null;for(let a=0;a<s;a++){let l=ic[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function wme(i){if(i<=32){for(let e=1;e<i;e++){let t=ic[e],n=t.z,r=e-1;for(;r>=0&&ic[r].z>n;)ic[r+1]=ic[r],r--;ic[r+1]=t}return}rm.length<i&&(rm=new Uint32Array(i),J2=new Uint32Array(i),Q2=new Array(i));for(let e=0;e<i;e++)rm[e]=ic[e].z;J3(i,ic,rm,Q2,J2,0),J3(i,Q2,J2,ic,rm,8),J3(i,ic,rm,Q2,J2,16),J3(i,Q2,J2,ic,rm,24)}function J3(i,e,t,n,r,s){ev.fill(0);for(let a=0;a<i;a++)ev[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=ev[a];ev[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=ev[l>>>s&255]++;n[c]=e[a],r[c]=l}}function n6(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Sme(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function nE(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function Tme(i,e){let t=nv(i,e)&&Ts(i.prev,i,i.next)>0&&Ts(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||iv(i,e)&&iv(e,i)&&(Ts(i.prev,i,e.prev)!==0||Ts(i,e.prev,e)!==0))&&!Eme(i,e)&&(t||Mme(i,e))}function Ts(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function nv(i,e){return i.x===e.x&&i.y===e.y}function t$(i,e,t,n,r=!0){let s=Ts(i,e,t),o=Ts(i,e,n),a=Ts(t,n,i),l=Ts(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&eE(i,t,e)||o===0&&eE(i,n,e)||a===0&&eE(t,i,n)||l===0&&eE(t,e,n)):!1}function eE(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Eme(i,e){let t=Math.min(i.x,e.x),n=Math.max(i.x,e.x),r=Math.min(i.y,e.y),s=Math.max(i.y,e.y),o=i;do{let a=o.next;if(o.x>n&&a.x>n||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<r&&a.y<r){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==e.i&&a.i!==e.i&&t$(o,a,i,e))return!0;o=a}while(o!==i);return!1}function iv(i,e){return Ts(i.prev,i,i.next)<0?Ts(i,e,i.next)>=0&&Ts(i,i.prev,e)>=0:Ts(i,e,i.prev)<0||Ts(i,i.next,e)<0}function Mme(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do{let o=t.next;t.y>s!=o.y>s&&r<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(n=!n),t=o}while(t!==i);return n}function n$(i,e){let t=i6(i.i,i.x,i.y),n=i6(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function KX(i,e,t,n){let r=i6(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function rv(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ),JD&&xme(i.prev,i.next)}function i6(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Cme(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}function H_(i){let e=[],t=[],n=i[0][0].length,r=0,s=0;for(let o of i){for(let a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function o6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Rme(i){if(Array.isArray(i))return i}function Pme(i){if(Array.isArray(i))return o6(i)}function Ime(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Nme(i,e,t){return e=iE(e),zme(i,s$()?Reflect.construct(e,[],iE(i).constructor):e.apply(i,t))}function Lme(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Dme(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Fme(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=c6(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.4120+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function iE(i){return iE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},iE(i)}function Ome(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&a6(i,e)}function s$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(s$=function(){return!!i})()}function Bme(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Ume(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function kme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4121+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4122+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zme(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ime(i)}function a6(i,e){return a6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},a6(i,e)}function sv(i,e){return Rme(i)||Ume(i,e)||c6(i,e)||kme()}function Vme(i){return Pme(i)||Bme(i)||c6(i)||Gme()}function c6(i,e){if(i){if(typeof i=="string")return o6(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o6(i,e):void 0}}var i$=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=Ya(s,r)*180/Math.PI;if(o>t)for(var a=tm(r,s),l=r.length>2||s.length>2?oh(r[2]||0,s[2]||0):null,c=l?function(p){return[].concat(Vme(a(p)),[l(p)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},l6=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Kn,Float32BufferAttribute:kn},qme=new l6.BufferGeometry().setAttribute?"setAttribute":"addAttribute",u6=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;Lme(this,e),n=Nme(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:p,MultiLineString:x,Polygon:v,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;ov({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[qme]("position",new l6.Float32BufferAttribute(l,3));function u(S,T){var P=s6(S[1],S[0],T+(S[2]||0)),R=[];return[{vertices:P,indices:R}]}function f(S,T){var P={vertices:[],indices:[]};return S.map(function(R){return u(R,T)}).forEach(function(R){var C=sv(R,1),L=C[0];ov(P,L)}),[P]}function p(S,T){for(var P=i$(S,s).map(function(N){var B=sv(N,3),z=B[0],V=B[1],H=B[2],Z=H===void 0?0:H;return s6(V,z,T+Z)}),R=H_([P]),C=R.vertices,L=Math.round(C.length/3),D=[],F=1;F<L;F++)D.push(F-1,F);return[{vertices:C,indices:D}]}function x(S,T){var P={vertices:[],indices:[]};return S.map(function(R){return p(R,T)}).forEach(function(R){var C=sv(R,1),L=C[0];ov(P,L)}),[P]}function v(S,T){for(var P=S.map(function(j){return i$(j,s).map(function(K){var ee=sv(K,3),ae=ee[0],ce=ee[1],de=ee[2],ve=de===void 0?0:de;return s6(ce,ae,T+ve)})}),R=H_(P),C=R.vertices,L=R.holes,D=L[0]||1/0,F=C.slice(0,D*3),N=C.slice(D*3),B=new Set(L),z=Math.round(C.length/3),V=[],H=[],Z=1;Z<z;Z++)B.has(Z)||(Z<D?V.push(Z-1,Z):H.push(Z-1-D,Z-D));var J=[{indices:V,vertices:F}];return L.length&&J.push({indices:H,vertices:N}),J}function w(S,T){var P={vertices:[],indices:[]},R={vertices:[],indices:[]};S.map(function(L){return v(L,T)}).forEach(function(L){var D=sv(L,2),F=D[0],N=D[1];ov(P,F),N&&ov(R,N)});var C=[P];return R.vertices.length&&C.push(R),C}return n}return Ome(e,i),Dme(e)})(l6.BufferGeometry);function ov(i,e){var t=Math.round(i.vertices.length/3);r$(i.vertices,e.vertices),r$(i.indices,e.indices.map(function(n){return n+t}))}function r$(i,e){var t=Fme(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function s6(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var av={};wse(av,{computeMikkTSpaceTangents:()=>Hme,computeMorphedAttributes:()=>Qme,deepCloneAttribute:()=>jme,deinterleaveAttribute:()=>rE,deinterleaveGeometry:()=>$me,estimateBytesUsed:()=>Yme,interleaveAttributes:()=>Xme,mergeAttributes:()=>h6,mergeGeometries:()=>Wme,mergeGroups:()=>Jme,mergeVertices:()=>Zme,toCreasedNormals:()=>ege,toTrianglesDrawMode:()=>Kme});function Hme(i,e,t=!0){if(!e||!e.isReady)throw new Error("THREE.BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('THREE.BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){let a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}let r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Ni(s,4)),i!==r&&i.copy(r),i}function Wme(i,e=!1){let t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Kn,c=0;for(let u=0;u<i.length;++u){let f=i[u],p=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let x in f.attributes){if(!n.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+x+'" attribute exists among all geometries, or in none of them.'),null;s[x]===void 0&&(s[x]=[]),s[x].push(f.attributes[x]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let x in f.morphAttributes){if(!r.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[x]===void 0&&(o[x]=[]),o[x].push(f.morphAttributes[x])}if(e){let x;if(t)x=f.index.count;else if(f.attributes.position!==void 0)x=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,x,u),c+=x}}if(t){let u=0,f=[];for(let p=0;p<i.length;++p){let x=i[p].index;for(let v=0;v<x.count;++v)f.push(x.getX(v)+u);u+=i[p].attributes.position.count}l.setIndex(f)}for(let u in s){let f=h6(s[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,f)}for(let u in o){let f=o[u][0].length;if(f!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let p=0;p<f;++p){let x=[];for(let w=0;w<o[u].length;++w)x.push(o[u][w][p]);let v=h6(x);if(!v)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(v)}}}return l}function h6(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new Ni(o,t,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let f=l/t;for(let p=0,x=u.count;p<x;p++)for(let v=0;v<t;v++){let w=u.getComponent(p,v);a.setComponent(p+f,v,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function jme(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?rE(i):i.isInstancedBufferAttribute?new Al().copy(i):new Ni().copy(i)}function Xme(i){let e,t=0,n=0;for(let c=0,u=i.length;c<u;++c){let f=i[c];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=f.array.length,n+=f.itemSize}let r=new Mf(new e(t),n),s=0,o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=i.length;c<u;c++){let f=i[c],p=f.itemSize,x=f.count,v=new mo(r,p,s,f.normalized);o.push(v),s+=p;for(let w=0;w<x;w++)for(let S=0;S<p;S++)v[l[S]](w,f[a[S]](w))}return o}function rE(i){let e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n),o;i.isInstancedInterleavedBufferAttribute?o=new Al(s,n,r,i.meshPerAttribute):o=new Ni(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function $me(i){let e=i.attributes,t=i.morphTargets,n=new Map;for(let r in e){let s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,rE(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,rE(s)),t[r]=n.get(s))}}function Yme(i){let e=0;for(let n in i.attributes){let r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}let t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function Zme(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],f=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"];for(let P=0,R=a.length;P<R;P++){let C=a[P],L=i.attributes[C];l[C]=new L.constructor(new L.array.constructor(L.count*L.itemSize),L.itemSize,L.normalized);let D=i.morphAttributes[C];D&&(c[C]||(c[C]=[]),D.forEach((F,N)=>{let B=new F.array.constructor(F.count*F.itemSize);c[C][N]=new F.constructor(B,F.itemSize,F.normalized)}))}let x=e*.5,v=Math.log10(1/e),w=Math.pow(10,v),S=x*w;for(let P=0;P<s;P++){let R=n?n.getX(P):P,C="";for(let L=0,D=a.length;L<D;L++){let F=a[L],N=i.getAttribute(F),B=N.itemSize;for(let z=0;z<B;z++)C+=`${~~(N[f[z]](R)*w+S)},`}if(C in t)u.push(t[C]);else{for(let L=0,D=a.length;L<D;L++){let F=a[L],N=i.getAttribute(F),B=i.morphAttributes[F],z=N.itemSize,V=l[F],H=c[F];for(let Z=0;Z<z;Z++){let J=f[Z],j=p[Z];if(V[j](o,N[J](R)),B)for(let K=0,ee=B.length;K<ee;K++)H[K][j](o,B[K][J](R))}}t[C]=o,u.push(o),o++}}let T=i.clone();for(let P in i.attributes){let R=l[P];if(T.setAttribute(P,new R.constructor(R.array.slice(0,o*R.itemSize),R.itemSize,R.normalized)),P in c)for(let C=0;C<c[P].length;C++){let L=c[P][C];T.morphAttributes[P][C]=new L.constructor(L.array.slice(0,o*L.itemSize),L.itemSize,L.normalized)}}return T.setIndex(u),T}function Kme(i,e){if(e===ZN)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===WT||e===KN){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,r=[];if(e===WT)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function Qme(i){let e=new ie,t=new ie,n=new ie,r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie;function u(ce,de,ve,Ie,Qe,Ue,mt,Me){e.fromBufferAttribute(de,Qe),t.fromBufferAttribute(de,Ue),n.fromBufferAttribute(de,mt);let ze=ce.morphTargetInfluences;if(ve&&ze){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let $e=0,Et=ve.length;$e<Et;$e++){let Tt=ze[$e],Ct=ve[$e];Tt!==0&&(r.fromBufferAttribute(Ct,Qe),s.fromBufferAttribute(Ct,Ue),o.fromBufferAttribute(Ct,mt),Ie?(a.addScaledVector(r,Tt),l.addScaledVector(s,Tt),c.addScaledVector(o,Tt)):(a.addScaledVector(r.sub(e),Tt),l.addScaledVector(s.sub(t),Tt),c.addScaledVector(o.sub(n),Tt)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Ue,t),ce.applyBoneTransform(mt,n)),Me[Qe*3+0]=e.x,Me[Qe*3+1]=e.y,Me[Qe*3+2]=e.z,Me[Ue*3+0]=t.x,Me[Ue*3+1]=t.y,Me[Ue*3+2]=t.z,Me[mt*3+0]=n.x,Me[mt*3+1]=n.y,Me[mt*3+2]=n.z}let f=i.geometry,p=i.material,x,v,w,S=f.index,T=f.attributes.position,P=f.morphAttributes.position,R=f.morphTargetsRelative,C=f.attributes.normal,L=f.morphAttributes.normal,D=f.groups,F=f.drawRange,N,B,z,V,H,Z,J,j=new Float32Array(T.count*T.itemSize),K=new Float32Array(C.count*C.itemSize);if(S!==null)if(Array.isArray(p))for(N=0,z=D.length;N<z;N++)for(H=D[N],Z=Math.max(H.start,F.start),J=Math.min(H.start+H.count,F.start+F.count),B=Z,V=J;B<V;B+=3)x=S.getX(B),v=S.getX(B+1),w=S.getX(B+2),u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else for(Z=Math.max(0,F.start),J=Math.min(S.count,F.start+F.count),N=Z,z=J;N<z;N+=3)x=S.getX(N),v=S.getX(N+1),w=S.getX(N+2),u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else if(Array.isArray(p))for(N=0,z=D.length;N<z;N++)for(H=D[N],Z=Math.max(H.start,F.start),J=Math.min(H.start+H.count,F.start+F.count),B=Z,V=J;B<V;B+=3)x=B,v=B+1,w=B+2,u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else for(Z=Math.max(0,F.start),J=Math.min(T.count,F.start+F.count),N=Z,z=J;N<z;N+=3)x=N,v=N+1,w=N+2,u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);let ee=new kn(j,3),ae=new kn(K,3);return{positionAttribute:T,normalAttribute:C,morphedPositionAttribute:ee,morphedNormalAttribute:ae}}function Jme(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){let o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}let t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){let a=e[o],l=a.start,c=l+a.count;for(let u=l;u<c;u++)n.push(t.getX(u))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){let a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){let a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function ege(i,e=Math.PI/3){let t=i.index?i.toNonIndexed():i,n=t.attributes.position,r=n.count,s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(r*3);for(let C=0;C<r;C++)s[3*C+0]=n.getX(C),s[3*C+1]=n.getY(C),s[3*C+2]=n.getZ(C)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let C=0;C<l;C++){let L=9*C,D=s[L+0],F=s[L+1],N=s[L+2],B=s[L+3],z=s[L+4],V=s[L+5],H=s[L+6],Z=s[L+7],J=s[L+8],j=H-B,K=Z-z,ee=J-V,ae=D-B,ce=F-z,de=N-V,ve=K*de-ee*ce,Ie=ee*ae-j*de,Qe=j*ce-K*ae,Ue=1/(Math.sqrt(ve*ve+Ie*Ie+Qe*Qe)||1);c[3*C+0]=ve*Ue,c[3*C+1]=Ie*Ue,c[3*C+2]=Qe*Ue}let u=new Int32Array(r),f=new Int32Array(r*3),p=1;for(;p<r*2;)p<<=1;let x=p-1,v=new Int32Array(p),w=0;for(let C=0;C<r;C++){let L=3*C,D=~~(s[L+0]*a),F=~~(s[L+1]*a),N=~~(s[L+2]*a),B=(Math.imul(D,73856093)^Math.imul(F,19349663)^Math.imul(N,83492791))&x;for(;;){let z=v[B];if(z===0){let H=3*w;f[H+0]=D,f[H+1]=F,f[H+2]=N,v[B]=w+1,u[C]=w++;break}let V=3*(z-1);if(f[V+0]===D&&f[V+1]===F&&f[V+2]===N){u[C]=z-1;break}B=B+1&x}}let S=new Int32Array(w+1);for(let C=0;C<r;C++)S[u[C]+1]++;for(let C=0;C<w;C++)S[C+1]+=S[C];let T=new Int32Array(r),P=S.slice(0,w);for(let C=0;C<l;C++){let L=3*C;T[P[u[L+0]]++]=C,T[P[u[L+1]]++]=C,T[P[u[L+2]]++]=C}let R=new Float32Array(r*3);for(let C=0;C<l;C++){let L=3*C,D=c[L+0],F=c[L+1],N=c[L+2];for(let B=0;B<3;B++){let z=L+B,V=u[z],H=0,Z=0,J=0;for(let K=S[V],ee=S[V+1];K<ee;K++){let ae=3*T[K],ce=c[ae+0],de=c[ae+1],ve=c[ae+2];D*ce+F*de+N*ve>o&&(H+=ce,Z+=de,J+=ve)}let j=1/(Math.sqrt(H*H+Z*Z+J*J)||1);R[3*z+0]=H*j,R[3*z+1]=Z*j,R[3*z+2]=J*j}}return t.setAttribute("normal",new Ni(R,3,!1)),t}var rt=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function sE(i){"@babel/helpers - typeof";return sE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sE(i)}var tge=/^\s+/,nge=/\s+$/;function dn(i,e){if(i=i||"",e=e||{},i instanceof dn)return i;if(!(this instanceof dn))return new dn(i,e);var t=ige(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}dn.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=f$(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=a$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=a$(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=o$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=o$(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return l$(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return age(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(yr(this._r,255)*100)+"%",g:Math.round(yr(this._g,255)*100)+"%",b:Math.round(yr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(yr(this._r,255)*100)+"%, "+Math.round(yr(this._g,255)*100)+"%, "+Math.round(yr(this._b,255)*100)+"%)":"rgba("+Math.round(yr(this._r,255)*100)+"%, "+Math.round(yr(this._g,255)*100)+"%, "+Math.round(yr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:xge[l$(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+c$(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=dn(e);n="#"+c$(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return dn(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(hge,arguments)},brighten:function(){return this._applyModification(fge,arguments)},darken:function(){return this._applyModification(dge,arguments)},desaturate:function(){return this._applyModification(lge,arguments)},saturate:function(){return this._applyModification(cge,arguments)},greyscale:function(){return this._applyModification(uge,arguments)},spin:function(){return this._applyModification(pge,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(gge,arguments)},complement:function(){return this._applyCombination(Age,arguments)},monochromatic:function(){return this._applyCombination(_ge,arguments)},splitcomplement:function(){return this._applyCombination(mge,arguments)},triad:function(){return this._applyCombination(u$,[3])},tetrad:function(){return this._applyCombination(u$,[4])}};dn.fromRatio=function(i,e){if(sE(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=lv(i[n]));i=t}return dn(i,e)};function ige(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=wge(i)),sE(i)=="object"&&(kf(i.r)&&kf(i.g)&&kf(i.b)?(e=rge(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):kf(i.h)&&kf(i.s)&&kf(i.v)?(n=lv(i.s),r=lv(i.v),e=oge(i.h,n,r),o=!0,a="hsv"):kf(i.h)&&kf(i.s)&&kf(i.l)&&(n=lv(i.s),s=lv(i.l),e=sge(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=f$(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function rge(i,e,t){return{r:yr(i,255)*255,g:yr(e,255)*255,b:yr(t,255)*255}}function o$(i,e,t){i=yr(i,255),e=yr(e,255),t=yr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function sge(i,e,t){var n,r,s;i=yr(i,360),e=yr(e,100),t=yr(t,100);function o(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function a$(i,e,t){i=yr(i,255),e=yr(e,255),t=yr(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function oge(i,e,t){i=yr(i,360)*6,e=yr(e,100),t=yr(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,c=[t,o,s,s,a,t][l],u=[a,t,t,o,s,s][l],f=[s,s,a,t,t,o][l];return{r:c*255,g:u*255,b:f*255}}function l$(i,e,t,n){var r=[Zc(Math.round(i).toString(16)),Zc(Math.round(e).toString(16)),Zc(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function age(i,e,t,n,r){var s=[Zc(Math.round(i).toString(16)),Zc(Math.round(e).toString(16)),Zc(Math.round(t).toString(16)),Zc(d$(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function c$(i,e,t,n){var r=[Zc(d$(n)),Zc(Math.round(i).toString(16)),Zc(Math.round(e).toString(16)),Zc(Math.round(t).toString(16))];return r.join("")}dn.equals=function(i,e){return!i||!e?!1:dn(i).toRgbString()==dn(e).toRgbString()};dn.random=function(){return dn.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function lge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s-=e/100,t.s=oE(t.s),dn(t)}function cge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s+=e/100,t.s=oE(t.s),dn(t)}function uge(i){return dn(i).desaturate(100)}function hge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l+=e/100,t.l=oE(t.l),dn(t)}function fge(i,e){e=e===0?0:e||10;var t=dn(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),dn(t)}function dge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l-=e/100,t.l=oE(t.l),dn(t)}function pge(i,e){var t=dn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,dn(t)}function Age(i){var e=dn(i).toHsl();return e.h=(e.h+180)%360,dn(e)}function u$(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=dn(i).toHsl(),n=[dn(i)],r=360/e,s=1;s<e;s++)n.push(dn({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function mge(i){var e=dn(i).toHsl(),t=e.h;return[dn(i),dn({h:(t+72)%360,s:e.s,l:e.l}),dn({h:(t+216)%360,s:e.s,l:e.l})]}function gge(i,e,t){e=e||6,t=t||30;var n=dn(i).toHsl(),r=360/t,s=[dn(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(dn(n));return s}function _ge(i,e){e=e||6;for(var t=dn(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(dn({h:n,s:r,v:s})),s=(s+a)%1;return o}dn.mix=function(i,e,t){t=t===0?0:t||50;var n=dn(i).toRgb(),r=dn(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return dn(o)};dn.readability=function(i,e){var t=dn(i),n=dn(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};dn.isReadable=function(i,e,t){var n=dn.readability(i,e),r,s;switch(s=!1,r=Sge(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};dn.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;c<e.length;c++)s=dn.readability(i,e[c]),s>r&&(r=s,n=dn(e[c]));return dn.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,dn.mostReadable(i,["#fff","#000"],t))};var f6=dn.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},xge=dn.hexNames=yge(f6);function yge(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function f$(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function yr(i,e){vge(i)&&(i="100%");var t=bge(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function oE(i){return Math.min(1,Math.max(0,i))}function vl(i){return parseInt(i,16)}function vge(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function bge(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Zc(i){return i.length==1?"0"+i:""+i}function lv(i){return i<=1&&(i=i*100+"%"),i}function d$(i){return Math.round(parseFloat(i)*255).toString(16)}function h$(i){return vl(i)/255}var Yc=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function kf(i){return!!Yc.CSS_UNIT.exec(i)}function wge(i){i=i.replace(tge,"").replace(nge,"").toLowerCase();var e=!1;if(f6[i])i=f6[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Yc.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Yc.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Yc.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Yc.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Yc.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Yc.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Yc.hex8.exec(i))?{r:vl(t[1]),g:vl(t[2]),b:vl(t[3]),a:h$(t[4]),format:e?"name":"hex8"}:(t=Yc.hex6.exec(i))?{r:vl(t[1]),g:vl(t[2]),b:vl(t[3]),format:e?"name":"hex"}:(t=Yc.hex4.exec(i))?{r:vl(t[1]+""+t[1]),g:vl(t[2]+""+t[2]),b:vl(t[3]+""+t[3]),a:h$(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Yc.hex3.exec(i))?{r:vl(t[1]+""+t[1]),g:vl(t[2]+""+t[2]),b:vl(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function Sge(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function m6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Tge(i){if(Array.isArray(i))return i}function Ege(i){if(Array.isArray(i))return m6(i)}function p$(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Mge(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Cge(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Wo(i,e){return i.get(p$(i,e))}function W_(i,e,t){Mge(i,e),e.set(i,t)}function aE(i,e,t){return i.set(p$(i,e),t),t}function Rge(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Uge(n.key),n)}}function Pge(i,e,t){return e&&Rge(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ige(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Nge(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Lge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4123+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dge(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4124+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fge(i,e){return Tge(i)||Nge(i,e)||A$(i,e)||Lge()}function Oge(i){return Ege(i)||Ige(i)||A$(i)||Dge()}function Bge(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function Uge(i){var e=Bge(i,"string");return typeof e=="symbol"?e:e+""}function A$(i,e){if(i){if(typeof i=="string")return m6(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?m6(i,e):void 0}}var j_=new WeakMap,cv=new WeakMap,X_=new WeakMap,d6=new WeakMap,p6=new WeakMap,A6=new WeakMap,m$=(function(){function i(){Cge(this,i),W_(this,j_,new Map),W_(this,cv,new Map),W_(this,X_,function(e){return e}),W_(this,d6,function(){return{}}),W_(this,p6,function(){}),W_(this,A6,function(){})}return Pge(i,[{key:"getObj",value:function(t){return Wo(j_,this).get(Wo(X_,this).call(this,t))}},{key:"getData",value:function(t){return Wo(cv,this).get(t)}},{key:"entries",value:function(){return Oge(Wo(cv,this).entries()).map(function(t){var n=Fge(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return aE(X_,this,rt(t)),this}},{key:"onCreateObj",value:function(t){return aE(d6,this,t),this}},{key:"onUpdateObj",value:function(t){return aE(p6,this,t),this}},{key:"onRemoveObj",value:function(t){return aE(A6,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!Wo(j_,n).has(Wo(X_,n).call(n,s))}).forEach(function(s){var o=Wo(d6,n).call(n,s);Wo(j_,n).set(Wo(X_,n).call(n,s),o),Wo(cv,n).set(o,s)});var r=new Map(t.map(function(s){return[Wo(X_,n).call(n,s),s]}));return Wo(j_,this).forEach(function(s,o){r.has(o)?Wo(p6,n).call(n,s,r.get(o)):(Wo(A6,n).call(n,s,o),Wo(j_,n).delete(o),Wo(cv,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var Hm=Tse(g$(),1);var yi=11102230246251565e-32,Es=134217729,hv=(3+8*yi)*yi;function om(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,p=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++p]);let x=0;if(f<i&&p<t)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++f]):(o=u+s,a=s-(o-u),u=n[++p]),s=o,a!==0&&(r[x++]=a);f<i&&p<t;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++p]),s=o,a!==0&&(r[x++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[x++]=a);for(;p<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++p],s=o,a!==0&&(r[x++]=a);return(s!==0||x===0)&&(r[x++]=s),x}function fv(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ut(i){return new Float64Array(i)}var kge=(3+16*yi)*yi,Gge=(2+12*yi)*yi,zge=(9+64*yi)*yi*yi,$_=ut(4),_$=ut(8),x$=ut(12),y$=ut(16),va=ut(4);function Vge(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B=i-r,z=t-r,V=e-s,H=n-s;C=B*H,p=Es*B,x=p-(p-B),v=B-x,p=Es*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=V*z,p=Es*V,x=p-(p-V),v=V-x,p=Es*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,$_[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,$_[1]=R-(T+f)+(f-D),N=P+T,f=N-P,$_[2]=P-(N-f)+(T-f),$_[3]=N;let Z=fv(4,$_),J=Gge*o;if(Z>=J||-Z>=J||(f=i-B,a=i-(B+f)+(f-r),f=t-z,c=t-(z+f)+(f-r),f=e-V,l=e-(V+f)+(f-s),f=n-H,u=n-(H+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(J=zge*o+hv*Math.abs(Z),Z+=B*u+H*a-(V*c+z*l),Z>=J||-Z>=J))return Z;C=a*H,p=Es*a,x=p-(p-a),v=a-x,p=Es*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=l*z,p=Es*l,x=p-(p-l),v=l-x,p=Es*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,va[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,va[1]=R-(T+f)+(f-D),N=P+T,f=N-P,va[2]=P-(N-f)+(T-f),va[3]=N;let j=om(4,$_,4,va,_$);C=B*u,p=Es*B,x=p-(p-B),v=B-x,p=Es*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=V*c,p=Es*V,x=p-(p-V),v=V-x,p=Es*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,va[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,va[1]=R-(T+f)+(f-D),N=P+T,f=N-P,va[2]=P-(N-f)+(T-f),va[3]=N;let K=om(j,_$,4,va,x$);C=a*u,p=Es*a,x=p-(p-a),v=a-x,p=Es*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=l*c,p=Es*l,x=p-(p-l),v=l-x,p=Es*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,va[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,va[1]=R-(T+f)+(f-D),N=P+T,f=N-P,va[2]=P-(N-f)+(T-f),va[3]=N;let ee=om(K,x$,4,va,y$);return y$[ee-1]}function Up(i,e,t,n,r,s){let o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=kge*c?l:-Vge(i,e,t,n,r,s,c)}var $Ye=(7+56*yi)*yi,YYe=(3+28*yi)*yi,ZYe=(26+288*yi)*yi*yi,KYe=ut(4),QYe=ut(4),JYe=ut(4),eZe=ut(4),tZe=ut(4),nZe=ut(4),iZe=ut(4),rZe=ut(4),sZe=ut(4),oZe=ut(8),aZe=ut(8),lZe=ut(8),cZe=ut(4),uZe=ut(8),hZe=ut(8),fZe=ut(16),dZe=ut(12),pZe=ut(192),AZe=ut(192);var _Ze=(10+96*yi)*yi,xZe=(4+48*yi)*yi,yZe=(44+576*yi)*yi*yi,vZe=ut(4),bZe=ut(4),wZe=ut(4),SZe=ut(4),TZe=ut(4),EZe=ut(4),MZe=ut(4),CZe=ut(4),RZe=ut(8),PZe=ut(8),IZe=ut(8),NZe=ut(8),LZe=ut(8),DZe=ut(8),FZe=ut(8),OZe=ut(8),BZe=ut(8),UZe=ut(4),kZe=ut(4),GZe=ut(4),zZe=ut(8),VZe=ut(16),qZe=ut(16),HZe=ut(16),WZe=ut(32),jZe=ut(32),XZe=ut(48),$Ze=ut(64),YZe=ut(1152),ZZe=ut(1152);var eKe=(16+224*yi)*yi,tKe=(5+72*yi)*yi,nKe=(71+1408*yi)*yi*yi,iKe=ut(4),rKe=ut(4),sKe=ut(4),oKe=ut(4),aKe=ut(4),lKe=ut(4),cKe=ut(4),uKe=ut(4),hKe=ut(4),fKe=ut(4),dKe=ut(24),pKe=ut(24),AKe=ut(24),mKe=ut(24),gKe=ut(24),_Ke=ut(24),xKe=ut(24),yKe=ut(24),vKe=ut(24),bKe=ut(24),wKe=ut(1152),SKe=ut(1152),TKe=ut(1152),EKe=ut(1152),MKe=ut(1152),CKe=ut(2304),RKe=ut(2304),PKe=ut(3456),IKe=ut(5760),NKe=ut(8),LKe=ut(8),DKe=ut(8),FKe=ut(16),OKe=ut(24),BKe=ut(48),UKe=ut(48),kKe=ut(96),GKe=ut(192),zKe=ut(384),VKe=ut(384),qKe=ut(384),HKe=ut(768);var WKe=ut(96),jKe=ut(96),XKe=ut(96),$Ke=ut(1152);var b$=Math.pow(2,-52),lE=new Uint32Array(512),kp=class i{static from(e,t=$ge,n=Yge){let r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){let a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new i(s)}constructor(e){let t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1,a=1/0,l=1/0,c=-1/0,u=-1/0;for(let B=0;B<o;B++){let z=e[2*B],V=e[2*B+1];z<a&&(a=z),V<l&&(l=V),z>c&&(c=z),V>u&&(u=V),this._ids[B]=B}let f=(a+c)/2,p=(l+u)/2,x=0,v=0,w=0;for(let B=0,z=1/0;B<o;B++){let V=_6(f,p,e[2*B],e[2*B+1]);V<z&&(x=B,z=V)}let S=e[2*x],T=e[2*x+1];for(let B=0,z=1/0;B<o;B++){if(B===x)continue;let V=_6(S,T,e[2*B],e[2*B+1]);V<z&&V>0&&(v=B,z=V)}let P=e[2*v],R=e[2*v+1],C=1/0;for(let B=0;B<o;B++){if(B===x||B===v)continue;let z=jge(S,T,P,R,e[2*B],e[2*B+1]);z<C&&(w=B,C=z)}let L=e[2*w],D=e[2*w+1];if(C===1/0){for(let V=0;V<o;V++)this._dists[V]=e[2*V]-e[0]||e[2*V+1]-e[1];Y_(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),z=0;for(let V=0,H=-1/0;V<o;V++){let Z=this._ids[V],J=this._dists[Z];J>H&&(B[z++]=Z,H=J)}this.hull=B.subarray(0,z),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Up(S,T,P,R,L,D)<0){let B=v,z=P,V=R;v=w,P=L,R=D,w=B,L=z,D=V}let F=Xge(S,T,P,R,L,D);this._cx=F.x,this._cy=F.y;for(let B=0;B<o;B++)this._dists[B]=_6(e[2*B],e[2*B+1],F.x,F.y);Y_(this._ids,this._dists,0,o-1),this._hullStart=x;let N=3;n[x]=t[w]=v,n[v]=t[x]=w,n[w]=t[v]=x,r[x]=0,r[v]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=x,s[this._hashKey(P,R)]=v,s[this._hashKey(L,D)]=w,this.trianglesLen=0,this._addTriangle(x,v,w,-1,-1,-1);for(let B=0,z=0,V=0;B<this._ids.length;B++){let H=this._ids[B],Z=e[2*H],J=e[2*H+1];if(B>0&&Math.abs(Z-z)<=b$&&Math.abs(J-V)<=b$||(z=Z,V=J,H===x||H===v||H===w))continue;let j=0;for(let de=0,ve=this._hashKey(Z,J);de<this._hashSize&&(j=s[(ve+de)%this._hashSize],!(j!==-1&&j!==n[j]));de++);j=t[j];let K=j,ee;for(;ee=n[K],Up(Z,J,e[2*K],e[2*K+1],e[2*ee],e[2*ee+1])>=0;)if(K=ee,K===j){K=-1;break}if(K===-1)continue;let ae=this._addTriangle(K,H,n[K],-1,-1,r[K]);r[H]=this._legalize(ae+2),r[K]=ae,N++;let ce=n[K];for(;ee=n[ce],Up(Z,J,e[2*ce],e[2*ce+1],e[2*ee],e[2*ee+1])<0;)ae=this._addTriangle(ce,H,ee,r[H],-1,r[ce]),r[H]=this._legalize(ae+2),n[ce]=ce,N--,ce=ee;if(K===j)for(;ee=t[K],Up(Z,J,e[2*ee],e[2*ee+1],e[2*K],e[2*K+1])<0;)ae=this._addTriangle(ee,H,K,-1,r[K],r[ee]),this._legalize(ae+2),r[ee]=ae,n[K]=K,N--,K=ee;this._hullStart=t[H]=K,n[K]=t[ce]=H,n[H]=ce,s[this._hashKey(Z,J)]=H,s[this._hashKey(e[2*K],e[2*K+1])]=K}this.hull=new Uint32Array(N);for(let B=0,z=this._hullStart;B<N;B++)this.hull[B]=z,z=n[z];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(Hge(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:t,_halfedges:n,coords:r}=this,s=0,o=0;for(;;){let a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=lE[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,p=t[o],x=t[e],v=t[u],w=t[f];if(Wge(r[2*p],r[2*p+1],r[2*x],r[2*x+1],r[2*v],r[2*v+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=p;let T=n[f];if(T===-1){let R=this._hullStart;do{if(this._hullTri[R]===f){this._hullTri[R]=e;break}R=this._hullPrev[R]}while(R!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let P=c+(a+1)%3;s<lE.length&&(lE[s++]=P)}else{if(s===0)break;e=lE[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}};function Hge(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function _6(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function Wge(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,p=r-o,x=s-a,v=l*l+c*c,w=u*u+f*f,S=p*p+x*x;return l*(f*S-w*x)-c*(u*S-w*p)+v*(u*x-f*p)<0}function jge(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,p=.5/(o*c-a*l),x=(c*u-a*f)*p,v=(o*f-l*u)*p;return x*x+v*v}function Xge(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,p=.5/(o*c-a*l),x=i+(c*u-a*f)*p,v=e+(o*f-l*u)*p;return{x,y:v}}function Y_(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){let s=i[r],o=e[s],a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{let r=t+n>>1,s=t+1,o=n;dv(i,r,s),e[i[t]]>e[i[n]]&&dv(i,t,n),e[i[s]]>e[i[n]]&&dv(i,s,n),e[i[t]]>e[i[s]]&&dv(i,t,s);let a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;dv(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(Y_(i,e,s,n),Y_(i,e,t,o-1)):(Y_(i,e,t,o-1),Y_(i,e,s,n))}}function dv(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function $ge(i){return i[0]}function Yge(i){return i[1]}function w$(i,e){var t,n,r=0,s,o,a,l,c,u,f,p=i[0],x=i[1],v=e.length;for(t=0;t<v;t++){n=0;var w=e[t],S=w.length-1;if(u=w[0],u[0]!==w[S][0]&&u[1]!==w[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=u[0]-p,a=u[1]-x,n;n<S;n++){if(f=w[n+1],l=f[0]-p,c=f[1]-x,a===0&&c===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(s=Up(o,l,a,c,0,0),s===0)return 0;(s>0&&c>0&&a<=0||s<0&&c<=0&&a>0)&&r++}u=f,a=c,o=l}}return r%2!==0}function S$(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function T$(i){return i.type==="Feature"?i.geometry:i}function Zge(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=S$(i),r=T$(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&Kge(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=w$(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function Kge(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var E$=Zge;var rc=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}};var Gp=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}};var pv=class{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,s,o,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let w=0,S=0,T=n.length,P,R;w<T;w+=3,S+=2){let C=n[w]*2,L=n[w+1]*2,D=n[w+2]*2,F=e[C],N=e[C+1],B=e[L],z=e[L+1],V=e[D],H=e[D+1],Z=B-F,J=z-N,j=V-F,K=H-N,ee=(Z*K-J*j)*2;if(Math.abs(ee)<1e-9){if(s===void 0){s=o=0;for(let ce of t)s+=e[ce*2],o+=e[ce*2+1];s/=t.length,o/=t.length}let ae=1e9*Math.sign((s-F)*K-(o-N)*j);P=(F+V)/2-ae*K,R=(N+H)/2+ae*j}else{let ae=1/ee,ce=Z*Z+J*J,de=j*j+K*K;P=F+(K*ce-J*de)*ae,R=N+(Z*de-j*ce)*ae}a[S]=P,a[S+1]=R}let l=t[t.length-1],c,u=l*4,f,p=e[2*l],x,v=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=p,x=v,u=l*4,p=e[2*l],v=e[2*l+1],r[c+2]=r[u]=x-v,r[c+3]=r[u+1]=p-f}render(e){let t=e==null?e=new rc:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let p=n[u];if(p<u)continue;let x=Math.floor(u/3)*2,v=Math.floor(p/3)*2,w=o[x],S=o[x+1],T=o[v],P=o[v+1];this._renderSegment(w,S,T,P,e)}let l,c=s[s.length-1];for(let u=0;u<s.length;++u){l=c,c=s[u];let f=Math.floor(r[c]/3)*2,p=o[f],x=o[f+1],v=l*4,w=this._project(p,x,a[v+2],a[v+3]);w&&this._renderSegment(p,x,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new rc:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){let n=t==null?t=new rc:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){let r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){let t=new Gp;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o,a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){let t=this._clip(e);if(t)for(let n of this.delaunay.neighbors(e)){let r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){let{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;let a=[],l=o;do{let c=Math.floor(l/3);if(a.push(t[c*2],t[c*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let t=this._cell(e);if(t===null)return null;let{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){let n=t.length,r=null,s,o,a=t[n-2],l=t[n-1],c,u=this._regioncode(a,l),f,p=0;for(let x=0;x<n;x+=2)if(s=a,o=l,a=t[x],l=t[x+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=p,p=0,r?r.push(a,l):r=[a,l];else{let v,w,S,T,P;if(c===0){if((v=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,P]=v}else{if((v=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,P,w,S]=v,f=p,p=this._edgecode(w,S),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(w,S):r=[w,S]}f=p,p=this._edgecode(T,P),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(T,P):r=[T,P]}if(r)f=p,p=this._edgecode(r[0],r[1]),f&&p&&this._edge(e,f,p,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){let a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,c,u=s||o;u&8?(l=e+(n-e)*(this.ymax-t)/(r-t),c=this.ymax):u&4?(l=e+(n-e)*(this.ymin-t)/(r-t),c=this.ymin):u&2?(c=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(c=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=c,s=this._regioncode(e,t)):(n=l,r=c,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let c=0,u=a.length,f,p=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=p,p=this._edgecode(a[c],a[c+1]),f&&p&&(c=this._edge(e,f,p,a,c),u=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){let n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};var Qge=2*Math.PI,Z_=Math.pow;function Jge(i){return i[0]}function e_e(i){return i[1]}function t_e(i){let{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){let r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function n_e(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var K_=class i{static from(e,t=Jge,n=e_e,r){return new i("length"in e?i_e(e,t,n,r):Float64Array.from(r_e(e,t,n,r)))}constructor(e){this._delaunator=new kp(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&t_e(e)){this.collinear=Int32Array.from({length:t.length/2},(p,x)=>x).sort((p,x)=>t[2*p]-t[2*x]||t[2*p+1]-t[2*x+1]);let l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[t[2*l],t[2*l+1],t[2*c],t[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let p=0,x=t.length/2;p<x;++p){let v=n_e(t[2*p],t[2*p+1],f);t[2*p]=v[0],t[2*p+1]=v[1]}this._delaunator=new kp(t)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,c=n.length;l<c;++l){let u=s[l%3===2?l-2:l+1];(n[l]===-1||o[u]===-1)&&(o[u]=l)}for(let l=0,c=r.length;l<c;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new pv(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){let f=a.indexOf(e);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let l=t[e];if(l===-1)return;let c=l,u=-1;do{if(yield u=o[c],c=c%3===2?c-2:c+1,o[c]!==e)return;if(c=s[c],c===-1){let f=n[(r[e]+1)%n.length];f!==u&&(yield f);return}}while(c!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;let r=n,s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){let{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let u=e,f=Z_(t-c[e*2],2)+Z_(n-c[e*2+1],2),p=r[e],x=p;do{let v=l[x],w=Z_(t-c[v*2],2)+Z_(n-c[v*2+1],2);if(w<f&&(f=w,u=v),x=x%3===2?x-2:x+1,l[x]!==e)break;if(x=a[x],x===-1){if(x=s[(o[e]+1)%s.length],x!==v&&Z_(t-c[x*2],2)+Z_(n-c[x*2+1],2)<f)return x;break}}while(x!==p);return u}render(e){let t=e==null?e=new rc:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l<o)continue;let c=s[o]*2,u=s[l]*2;e.moveTo(n[c],n[c+1]),e.lineTo(n[u],n[u+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;let n=e==null?e=new rc:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){let a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,Qge)}return n&&n.value()}renderHull(e){let t=e==null?e=new rc:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){let l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){let e=new Gp;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new rc:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){let t=new Gp;return this.renderTriangle(e,t),t.value()}};function i_e(i,e,t,n){let r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){let a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*r_e(i,e,t,n){let r=0;for(let s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var Av=Math.PI,M$=Av/2,CQe=Av/4,RQe=Av*2,x6=180/Av,y6=Av/180;var v6=Math.atan2,cE=Math.cos;var C$=Math.max,R$=Math.min;var uE=Math.sin,P$=Math.sign||function(i){return i>0?1:i<0?-1:0},hE=Math.sqrt;function b6(i){return i>1?M$:i<-1?-M$:Math.asin(i)}function w6(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Za(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function mv(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function gv(i){var e=hE(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function S6(i){return[v6(i[1],i[0])*x6,b6(C$(-1,R$(1,i[2])))*x6]}function uh(i){let e=i[0]*y6,t=i[1]*y6,n=cE(t);return[n*cE(e),n*uE(e),uE(t)]}function fE(i){return i=i.map(e=>uh(e)),w6(i[0],Za(i[2],i[1]))}function N$(i){let e=o_e(i),t=l_e(e),n=a_e(t,i),r=u_e(t,i.length),s=s_e(r,i),o=c_e(t,i),{polygons:a,centers:l}=h_e(o,t,i),c=f_e(a),u=p_e(t,i),f=d_e(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function s_e(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,c=o,u=uh([r,s]);do a=o,o=null,l=t(u,uh(e[a])),i[a].forEach(f=>{let p=t(u,uh(e[f]));if(p<l){l=p,o=f,c=f;return}});while(o!==null);return c}}function o_e(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=ED(i[e]),n=HD().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let p=0,x=i.length;p<x;p++){let v=i[p][0]**2+i[p][1]**2;!isFinite(v)||v>1e32?r.push(p):v>s&&(s=v)}let o=1e6*hE(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=K_.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let p=0,x=c.length;p<x;p++)if(c[p]<0){let v=p%3==2?p-2:p+1,w=p%3==0?p+2:p-1,S=c[v],T=c[w];c[S]=T,c[T]=S,c[v]=c[w]=-1,l[p]=l[v]=l[w]=e,u[l[S]]=S%3==0?S+2:S-1,u[l[T]]=T%3==0?T+2:T-1,f.push(Math.min(p,v,w)),p+=2-p%3}else l[p]>i.length-3-1&&(l[p]=e);return a}function a_e(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(fE(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(Ip([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function l_e(i){let{triangles:e}=i;if(!e)return[];let t=[];for(let n=0,r=e.length/3;n<r;n++){let s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function c_e(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(uh),r=mv(mv(Za(n[1],n[0]),Za(n[2],n[1])),Za(n[0],n[2]));return S6(gv(r))})}function u_e(i,e){let t=[];return i.forEach(n=>{for(let r=0;r<3;r++){let s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function h_e(i,e,t){let n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){let a=uh(t[0]),l=uh(t[1]),c=gv(mv(a,l)),u=gv(Za(a,l)),f=Za(c,u),p=[c,Za(c,f),Za(Za(c,f),f),Za(Za(Za(c,f),f),f)].map(S6).map(o);return n.push(p),n.push(p.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let c=0;c<3;c++){let u=a[c],f=a[(c+1)%3],p=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,p,l,[u,f,p]])}});let s=n.map(a=>{let l=[a[0][2]],c=a[0][1];for(let u=1;u<a.length;u++)for(let f=0;f<a.length;f++)if(a[f][0]==c){c=a[f][1],l.push(a[f][2]);break}if(l.length>2)return l;if(l.length==2){let u=I$(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=I$(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),p=o(u),x=o(f);return[l[0],x,l[1],p]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((c,u)=>{c[0]===a[0]&&c[1]===a[1]&&(l=u+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function I$(i,e,t){i=uh(i),e=uh(e),t=uh(t);let n=P$(w6(Za(e,i),t));return S6(gv(mv(i,e)).map(r=>n*r))}function f_e(i){let e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function d_e(i,e){return function(t){let n=new Map,r=new Map;return i.forEach((s,o)=>{let a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let c=Ip([s[l],s[(l+1)%3]]).join("-");n.get(c)>o&&(o=n.get(c),a=c)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function p_e(i,e){let t=new Set,n=[];i.map(a=>{if(!(fE(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let c=[a[l],a[(l+1)%3]],u=`${c[0]}-${c[1]}`;t.has(u)?t.delete(u):t.add(`${c[1]}-${c[0]}`)}});let r=new Map,s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function T6(i){let e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){let n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=N$(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return O3(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return O3(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>fE(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n=e.delaunay.edges.map(s=>Ya(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let{centers:n,polygons:r}=e.delaunay,s=[];for(let o of r)if(o)for(let a=o.length,l=o[a-1],c=o[0],u=0;u<a;l=c,c=o[++u])c>l&&s.push([n[l],n[c]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Ya([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);let n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function M6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function A_e(i){if(Array.isArray(i))return i}function m_e(i){if(Array.isArray(i))return M6(i)}function g_e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function __e(i,e,t){return e=pE(e),E_e(i,D$()?Reflect.construct(e,[],pE(i).constructor):e.apply(i,t))}function x_e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function y_e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function pE(i){return pE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pE(i)}function v_e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&C6(i,e)}function D$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(D$=function(){return!!i})()}function b_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function w_e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function S_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4125+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4126+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E_e(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return g_e(i)}function C6(i,e){return C6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},C6(i,e)}function hh(i,e){return A_e(i)||w_e(i,e)||F$(i,e)||S_e()}function E6(i){return m_e(i)||b_e(i)||F$(i)||T_e()}function F$(i,e){if(i){if(typeof i=="string")return M6(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?M6(i,e):void 0}}function M_e(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=C_e(i,n),s=rh(r),o=R_e(i,n),a=[].concat(E6(s),E6(o)),l={type:"Polygon",coordinates:i},c=C3(l),u=hh(c,2),f=hh(u[0],2),p=f[0],x=f[1],v=hh(u[1],2),w=v[0],S=v[1],T=p>w||S>=89||x<=-89,P=[];if(T){var R=T6(a).triangles(),C=new Map(a.map(function(ee,ae){var ce=hh(ee,2),de=ce[0],ve=ce[1];return["".concat(de,"-").concat(ve),ae]}));R.features.forEach(function(ee){var ae,ce=ee.geometry.coordinates[0].slice(0,3).reverse(),de=[];if(ce.forEach(function(Ie){var Qe=hh(Ie,2),Ue=Qe[0],mt=Qe[1],Me="".concat(Ue,"-").concat(mt);C.has(Me)&&de.push(C.get(Me))}),de.length===3){if(de.some(function(Ie){return Ie<s.length})){var ve=ee.properties.circumcenter;if(!R6(ve,l,T))return}(ae=P).push.apply(ae,de)}})}else if(o.length)for(var B=kp.from(a),z=function(ae){var ce,de=[2,1,0].map(function(Qe){return B.triangles[ae+Qe]}),ve=de.map(function(Qe){return a[Qe]});if(de.some(function(Qe){return Qe<s.length})){var Ie=[0,1].map(function(Qe){return u3(ve,function(Ue){return Ue[Qe]})});if(!R6(Ie,l,T))return 1}(ce=P).push.apply(ce,E6(de))},V=0,H=B.triangles.length;V<H;V+=3)z(V);else{var L=H_(r),D=L.vertices,F=L.holes,N=F===void 0?[]:F;P=r6(D,N,2)}var Z=Xa(Ip(a,function(ee){return ee[0]}),[0,1]),J=Xa(Ip(a,function(ee){return ee[1]}),[0,1]),j=a.map(function(ee){var ae=hh(ee,2),ce=ae[0],de=ae[1];return[Z(ce),J(de)]}),K={points:a,indices:P,uvs:j};return{contour:r,triangles:K}}function C_e(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Ya(s,r)*180/Math.PI;if(o>e)for(var a=tm(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function R_e(i,e){var t={type:"Polygon",coordinates:i},n=C3(t),r=hh(n,2),s=hh(r[0],2),o=s[0],a=s[1],l=hh(r[1],2),c=l[0],u=l[1];if(Math.min(Math.abs(c-o),Math.abs(u-a))<e)return[];var f=o>c||u>=89||a<=-89;return P_e(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(p){return R6(p,t,f)})}function P_e(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(T){return T/a*360%360-180},c=function(T){return Math.acos(2*T/o-1)/Math.PI*180-90},u=function(T){return o*(Math.cos((T+90)*Math.PI/180)+1)/2},f=[s!==void 0?Math.ceil(u(s)):0,r!==void 0?Math.floor(u(r)):o-1],p=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},x=[],v=f[0];v<=f[1];v++){var w=l(v);p(w)&&x.push([w,c(v)])}return x}function R6(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?LD(e,i):E$(i,e)}var dE=window.THREE?window.THREE:{BufferGeometry:Kn,Float32BufferAttribute:kn},L$=new dE.BufferGeometry().setAttribute?"setAttribute":"addAttribute",AE=(function(i){function e(t,n,r,s,o,a,l){var c;x_e(this,e),c=__e(this,e),c.type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var u=M_e(t,{resolution:l}),f=u.contour,p=u.triangles,x=rh(p.uvs),v=[],w=[],S=[],T=0,P=function(F){var N=Math.round(v.length/3),B=S.length;v=v.concat(F.vertices),w=w.concat(F.uvs),S=S.concat(N?F.indices.map(function(z){return z+N}):F.indices),c.addGroup(B,S.length-B,T++)};a&&P(C()),s&&P(L(n,!1)),o&&P(L(r,!0)),c.setIndex(S),c[L$]("position",new dE.Float32BufferAttribute(v,3)),c[L$]("uv",new dE.Float32BufferAttribute(w,2)),c.computeVertexNormals();function R(D,F){var N=typeof F=="function"?F:function(){return F},B=D.map(function(z){return z.map(function(V){var H=hh(V,2),Z=H[0],J=H[1];return I_e(J,Z,N(Z,J))})});return H_(B)}function C(){for(var D=R(f,n),F=D.vertices,N=D.holes,B=R(f,r),z=B.vertices,V=rh([z,F]),H=Math.round(z.length/3),Z=new Set(N),J=0,j=[],K=0;K<H;K++){var ee=K+1;if(ee===H)ee=J;else if(Z.has(ee)){var ae=ee;ee=J,J=ae}j.push(K,K+H,ee+H),j.push(ee+H,ee,K)}for(var ce=[],de=1;de>=0;de--)for(var ve=0;ve<H;ve+=1)ce.push(ve/(H-1),de);return{indices:j,vertices:V,uvs:ce}}function L(D){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:F?p.indices:p.indices.slice().reverse(),vertices:R([p.points],D).vertices,uvs:x}}return c}return v_e(e,i),y_e(e)})(dE.BufferGeometry);function I_e(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function P6(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function N_e(i){if(Array.isArray(i))return i}function L_e(i){if(Array.isArray(i))return P6(i)}function D_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function F_e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function O_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4127+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4128+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U_e(i,e){if(i==null)return{};var t,n,r=k_e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function k_e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function G_e(i,e){return N_e(i)||F_e(i,e)||O$(i,e)||O_e()}function z_e(i){return L_e(i)||D_e(i)||O$(i)||B_e()}function V_e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function q_e(i){var e=V_e(i,"string");return typeof e=="symbol"?e:e+""}function O$(i,e){if(i){if(typeof i=="string")return P6(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?P6(i,e):void 0}}var B$=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var c=a,u=l;return r.forEach(function(f,p){var x=f.keyAccessor,v=f.isProp,w;if(v){var S=u,T=S[x],P=U_e(S,[x].map(q_e));w=T,u=P}else w=x(u,p);p+1<r.length?(c.hasOwnProperty(w)||(c[w]={}),c=c[w]):t?(c.hasOwnProperty(w)||(c[w]=[]),c[w].push(u)):c[w]=u}),a},{});t instanceof Function&&(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===r.length?Object.keys(l).forEach(function(u){return l[u]=t(l[u])}):Object.values(l).forEach(function(u){return a(u,c+1)})})(s);var o=s;return n&&(o=[],(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===r.length?o.push({keys:c,vals:l}):Object.entries(l).forEach(function(u){var f=G_e(u,2),p=f[0],x=f[1];return a(x,[].concat(z_e(c),[p]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var hi=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=[],s="";function o(Ne){return e.locateFile?e.locateFile(Ne,s):s+Ne}var a;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",a=function(nt,It,He){var h=new XMLHttpRequest;h.open("GET",nt,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){It(h.response);return}var bi=wt(nt);if(bi){It(bi.buffer);return}He()},h.onerror=He,h.send(null)};var l=e.print||console.log.bind(console),c=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&(r=e.arguments);var u=0,f=function(Ne){u=Ne},p=function(){return u},x=8;function v(Ne,nt,It,He){switch(It=It||"i8",It.charAt(It.length-1)==="*"&&(It="i32"),It){case"i1":J[Ne>>0]=nt;break;case"i8":J[Ne>>0]=nt;break;case"i16":K[Ne>>1]=nt;break;case"i32":ae[Ne>>2]=nt;break;case"i64":Ve=[nt>>>0,(Pe=nt,+vt(Pe)>=1?Pe>0?(Kt(+ln(Pe/4294967296),4294967295)|0)>>>0:~~+yt((Pe-+(~~Pe>>>0))/4294967296)>>>0:0)],ae[Ne>>2]=Ve[0],ae[Ne+4>>2]=Ve[1];break;case"float":de[Ne>>2]=nt;break;case"double":ve[Ne>>3]=nt;break;default:S0("invalid type for setValue: "+It)}}function w(Ne,nt,It){switch(nt=nt||"i8",nt.charAt(nt.length-1)==="*"&&(nt="i32"),nt){case"i1":return J[Ne>>0];case"i8":return J[Ne>>0];case"i16":return K[Ne>>1];case"i32":return ae[Ne>>2];case"i64":return ae[Ne>>2];case"float":return de[Ne>>2];case"double":return ve[Ne>>3];default:S0("invalid type for getValue: "+nt)}return null}var S=!1;function T(Ne,nt){Ne||S0("Assertion failed: "+nt)}function P(Ne){var nt=e["_"+Ne];return T(nt,"Cannot call unknown function "+Ne+", make sure it is exported"),nt}function R(Ne,nt,It,He,h){var ji={string:function(Qn){var Ii=0;if(Qn!=null&&Qn!==0){var kb=(Qn.length<<2)+1;Ii=Vk(kb),B(Qn,Ii,kb)}return Ii},array:function(Qn){var Ii=Vk(Qn.length);return V(Qn,Ii),Ii}};function bi(Qn){return nt==="string"?F(Qn):nt==="boolean"?!!Qn:Qn}var ne=P(Ne),Xi=[],La=0;if(He)for(var Hs=0;Hs<He.length;Hs++){var Ps=ji[It[Hs]];Ps?(La===0&&(La=Nie()),Xi[Hs]=Ps(He[Hs])):Xi[Hs]=He[Hs]}var ns=ne.apply(null,Xi);return ns=bi(ns),La!==0&&Iie(La),ns}function C(Ne,nt,It,He){It=It||[];var h=It.every(function(bi){return bi==="number"}),ji=nt!=="string";return ji&&h&&!He?P(Ne):function(){return R(Ne,nt,It,arguments,He)}}var L=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Ne,nt,It){for(var He=nt+It,h=nt;Ne[h]&&!(h>=He);)++h;if(h-nt>16&&Ne.subarray&&L)return L.decode(Ne.subarray(nt,h));for(var ji="";nt<h;){var bi=Ne[nt++];if(!(bi&128)){ji+=String.fromCharCode(bi);continue}var ne=Ne[nt++]&63;if((bi&224)==192){ji+=String.fromCharCode((bi&31)<<6|ne);continue}var Xi=Ne[nt++]&63;if((bi&240)==224?bi=(bi&15)<<12|ne<<6|Xi:bi=(bi&7)<<18|ne<<12|Xi<<6|Ne[nt++]&63,bi<65536)ji+=String.fromCharCode(bi);else{var La=bi-65536;ji+=String.fromCharCode(55296|La>>10,56320|La&1023)}}return ji}function F(Ne,nt){return Ne?D(j,Ne,nt):""}function N(Ne,nt,It,He){if(!(He>0))return 0;for(var h=It,ji=It+He-1,bi=0;bi<Ne.length;++bi){var ne=Ne.charCodeAt(bi);if(ne>=55296&&ne<=57343){var Xi=Ne.charCodeAt(++bi);ne=65536+((ne&1023)<<10)|Xi&1023}if(ne<=127){if(It>=ji)break;nt[It++]=ne}else if(ne<=2047){if(It+1>=ji)break;nt[It++]=192|ne>>6,nt[It++]=128|ne&63}else if(ne<=65535){if(It+2>=ji)break;nt[It++]=224|ne>>12,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}else{if(It+3>=ji)break;nt[It++]=240|ne>>18,nt[It++]=128|ne>>12&63,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}}return nt[It]=0,It-h}function B(Ne,nt,It){return N(Ne,j,nt,It)}var z=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function V(Ne,nt){J.set(Ne,nt)}function H(Ne,nt){return Ne%nt>0&&(Ne+=nt-Ne%nt),Ne}var Z,J,j,K,ee,ae,ce,de,ve;function Ie(Ne){Z=Ne,e.HEAP8=J=new Int8Array(Ne),e.HEAP16=K=new Int16Array(Ne),e.HEAP32=ae=new Int32Array(Ne),e.HEAPU8=j=new Uint8Array(Ne),e.HEAPU16=ee=new Uint16Array(Ne),e.HEAPU32=ce=new Uint32Array(Ne),e.HEAPF32=de=new Float32Array(Ne),e.HEAPF64=ve=new Float64Array(Ne)}var Qe=5271296,Ue=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?Z=e.buffer:Z=new ArrayBuffer(mt),mt=Z.byteLength,Ie(Z),ae[Ue>>2]=Qe;function Me(Ne){for(;Ne.length>0;){var nt=Ne.shift();if(typeof nt=="function"){nt();continue}var It=nt.func;typeof It=="number"?nt.arg===void 0?e.dynCall_v(It):e.dynCall_vi(It,nt.arg):It(nt.arg===void 0?null:nt.arg)}}var ze=[],$e=[],Et=[],Tt=[];function Ct(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)st(e.preRun.shift());Me(ze)}function un(){Me($e)}function Gt(){Me(Et)}function Xe(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)tt(e.postRun.shift());Me(Tt)}function st(Ne){ze.unshift(Ne)}function tt(Ne){Tt.unshift(Ne)}var vt=Math.abs,yt=Math.ceil,ln=Math.floor,Kt=Math.min,Qt=0,xn=null,ge=null;function di(Ne){Qt++,e.monitorRunDependencies&&e.monitorRunDependencies(Qt)}function On(Ne){if(Qt--,e.monitorRunDependencies&&e.monitorRunDependencies(Qt),Qt==0&&(xn!==null&&(clearInterval(xn),xn=null),ge)){var nt=ge;ge=null,nt()}}e.preloadedImages={},e.preloadedAudios={};var le=null,X="data:application/octet-stream;base64,";function Te(Ne){return String.prototype.startsWith?Ne.startsWith(X):Ne.indexOf(X)===0}var Pe,Ve;le="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAABgtRFT7IQlAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCUAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAABgtRFT7IQnAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCcAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAMpi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP6phvycGBZRAJbod0OgwfkCp+L8jatBmQCjl3pGrPlFAfMWm114SOkButwtqS7UjQHQwbcjXyw1A8jnLuuyA9j9KwjL0VwHhPyotk0lcs8k/Q5PvEs9rsz+SfsOQEVqdPzUAKDojLoY/WJz/kcjCcD8YFu070FRZPyoLC2BdJEM/YOXQAuiMM0HIBz1bw3sdQdV46aaHRwZByatzjDPX8EDb3Jie8HXZQCJxj6ULP8NAUaG6uRAZrUCWdmou5/mVQLb9huRPm4BAhvoCHygZaUCuX/I3SPdSQC9/bC/1qTxAfKxsYQ6pJUCuslH+N14QQMS/cv7SvPg/Ol8maYKx4j8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAKriWFiWZfg/Y2nmTbY/8z8MHSPSqmnjv6hnn18HR3c/quJYWJZl+D/jq5TzDdzyPwwdI9KqaeO/u0kC1eFSBECq4lhYlmX4P69pJmt7c/E/NnkJi6jSBsDESFlzKkr6P33ArMz7sfY/o2q2uqM08D+oZ59fB0d3PzEqCi3qrvK/kmm4ANp49D+4wS2wzhzvP9WJvyAnx+E/upcY75RVx7+95t+9y0T1P9L18g1caO0/k6CkRyVzAEBf99+e/GjxP6QMsuuLQ/U/PlP4Qr8q7j8Mb/GO2GMCwLl2K/DQIghAePiwytEp9D9UHrsuI/nqPzjMedJ+yuy/k6xgf58n/L+XoQtn22DzP2lzCnsYk+s/JhUSDI4P8z+8lFcBhgTcPxOqKRxEX/M/89MEdoPQ6j8OKQaXDob7vzWwNvblgAPAzGkxMcl88j9Nm4okPkbpP0vI89vxSgRAdac2Z6W2/T+6UFOMC3zyP/+2XEF3hug/QqhELwGKCMAwdlQerEoEQFcr/B+VnvE/hB1hfFzT5j8wdsE/Da64P0hIvnF/sOC/KH/hrXUg8T9bI5OQHaLlP+mYzla7td6/CtKG6iOm8b8FW3TV8oXwP8ORhtNuJ+c/q8JrTMz/AcC8PaUl+PUFwAXv9rkMT/A/m+sAswr15D+7hk/O3yvkP6c/yVsOHKI/qqAX9idJ8D/8hNz1KNPiP7xSXh3Ggvg/epbkiKr57T/23/LB1GLvP4GTTeNZi+M/W4TqlTheBcDupZgIdYUIQGwlcW3YZO8/tQvDXQ3H4j8Bt+sf9DkAQMdFie+nNvg/Z5Uh1wDX7j9h5X2d4KjhPxMJ1ZVT4Pa/evqB8xB//7+W183U9QLsPwzNxsC7AOA/af/LqCnK/r/lPceQ0FQDwHoY0nYIW+w/bHNSHrTg4D/DFcMAdabuv2sz5Ojhnve/FvLf01HN6z/tEDL2Hz/gP0bBv0KUhPA/pd7sEnMc4D8EGon4Lo7sP5NVbYtSON8/DAMC50odBkB+Z2J8MGYCQIhlM1gubOo/FssiPwWy4D8OIlGqRnkCQAd1vopp6f4/QS1keLLK6T9rfoBuT7LZP3KQbH5ugwjAjqVPXTmbBUBL/JxcqR3qP3oSeovuktg/Y6pRhJmqy7+0kwuU0Yjmv2wvsfFmQ+g/R98lJFqQ2T/IGb5gjLkCwK3mNff3kQbAqDznPFM86T+iiP0FfsvYP7fzKG6Mls0/h7+at2btzL8tsUTgk+LmP/YEIrTDINU/WmwKoVjA5L9aC02r6FHxvzzFCT/Qg+Y/nx0V97en0j8+1toJOm77P1kZ7h8KjfQ/GBbbqxgk5j9RGXM79G/SP+beHsWmweQ/9REi4eX0xD/V9s+kmMHkP+pb9yNs09A/c5ERjVDTAECqEr3OBCH7P14ILfMECOU/piRx4P8P0j+JYU//bfL0Pw62fw28B+w/l5YW2Ga45D9+CyKRbenOP5cH6fHy1/S/o/egk03++r91nTYRL/bjP3fHN6OJVdA/7xXQh1XLBcAB3g6tBdUIQKW2KnGYjeQ/SqIpagclyz8F9P3YgNL6v9H6NBsZ8QDAW2k5L5Qs4z/0axa1l6zLP1GE65Mu4wNAwfX+BYmWAEBBgJP90M3hP6/03qhPLdA/zqo5bJz2778/ESlPCTn1v7JkhGyvzuE/DM7sj5twwz/6xbXLavYGQH29RFRGkgNA7bOXVSJ54T9fEhTHO/TDP+8t+HMOiwDAxa0SbGTtA8Atii7y0mLgP4cecHFB3sM/uPUpyv+K7j8nktD1/WvhP2cWmi772d8/Fj7uU9kEvD8oKOESLzKmvwSdCqrHdNu/XCluGsvI3T929OW5md+uP9dP6rXcZNq/gXM+ggzL6b+eKjsPgJncP6i1e9aVu7E/2CnPNJyD1D/DnyGgSe+xvy8k7g9bp9s/nYmLvHn1sz9cFOwApH8IwGa6Mjy9cgZAJr95SiSW2z8rCkhOFvqdP3SIKmO/UwPAEy0zkN7bBsCds8Hg/13YP1zv413hVGi/FVtqixSn6L9XAPQGul3yv7SGu2BoCNk/n94bv7Maj79p13T6X9z3P45MPCW3WvI/rU/8/LRj1T9cgR6SXd+ZPymL2DstbPI/8s/pAkIz6z/fmoB+8efYPz2XyfWgYaa/6wys72AW/j8LZImhgrf3P729Zla/n9U/ySB8B3PBqL8O2nhevvbxv17+5A+n6fe/YrGIqEGB1T+wCEGbkhaxv989QHVE5wFAzd12PTu3/T9AHUPZY2DUP3SQDST0zq2/JCxAlIoj5T+Mhe1IJkrQP/cRpl8QhtU/amc4seFts79khiUSVaz3vxYfWtjPwf2/CHscxQqD0j/ctUBQ9my3v0POnFiyXv2/pjjn2Ju/AcDk45DwBhPRP/GjwlCrv7m/aT2ciwolBsAQOzHr/wUJQCzpq5UYvtI/gDCf3SlCwb+4i7S+mukEQBDA1f8mowFA2utnRN3KyT9T+9EYAVG6v9/IVZ0enrE/7NbRtdGfzr/8y8GpRz7LP3U0vTSk18e/JzHEcwiBB0AGm8Q7AJkEQNLciyt4Esk/gLou5zoQxr+RrOfM91oBwEzd36KybgTAgLou5zoQxj/S3IsreBLJv1gCch0OHO8/FD+RxSLN4j91NL00pNfHP/zLwalHPsu/nL7/By4Pyr8tSP5h7CPiv1P70RgBUbo/2utnRN3Kyb/KfllfCpUIwLkP5zj+NwdAgDCf3SlCwT8s6auVGL7Sv2aFPlaC4eC/XrS5UVH77b/xo8JQq7+5P+TjkPAGE9G/Q30/RYbn1z8FF/ISafuLv9y1QFD2bLc/CHscxQqD0r/fi+tPROX0P6vRc+19ie0/amc4seFtsz/3EaZfEIbVv77TYpahl/o/DDsu0CaC9D90kA0k9M6tP0AdQ9ljYNS/CCI0rxjZA8BgfCaLthgHwLAIQZuSFrE/YrGIqEGB1b8kvQ982+rsv4J8EWu7jPS/ySB8B3PBqD+9vWZWv5/VvwrAByWcJgBAxFujmE9a+j89l8n1oGGmP9+agH7x59i/N03cuJUt9L8X9v4GdIz6v1yBHpJd35m/rU/8/LRj1b8mz69sydf/vyu5idMqVQLAn94bv7Majz8AhrtgaAjZv+aCE66WZ/q/lA1Mgz/p/79c7+Nd4VRoP52zweD/Xdi/TJZpMTb4AkDLWZShPOb/PysKSE4W+p2/Jr95SiSW27/PkmbE7zjnP6UAiCDmMNI/nYmLvHn1s78vJO4PW6fbv5MWA2vqSrQ/V5WLwPB51b+otXvWlbuxv54qOw+Amdy/1keqzYeRBsApIEMHgZIIQHb05bmZ366/XCluGsvI3b8W44a9X9UFQEeQtDM4rwJAFj7uU9kEvL9nFpou+9nfv3Co+JcyyQhAcdkCX2KzBUCHHnBxQd7Dvy2KLvLSYuC/o6+5YTt/AcCHCNDW+8YEwF8SFMc79MO/7bOXVSJ54b9E/pfA2S3xPzD9xaBb0uQ/DM7sj5tww7+yZIRsr87hv7c4c0SEXNG/Tr79/9M+5r+v9N6oTy3Qv5uAk/3QzeG/XcI1OVQkAUAQSV9Z7Qr9P/RrFrWXrMu/W2k5L5Qs479Zo2IBM/vkv6FuipzkFvG/SqIpagcly7+ltipxmI3kv0pmis91cfc/gWQecsRh8D93xzejiVXQv3WdNhEv9uO/D7mgYy612j+PyVPNaT2jv34LIpFt6c6/l5YW2Ga45L+LUp+2A2z9P39i5xSpRfc/piRx4P8P0r9eCC3zBAjlv5n4OKmIUf2/jj/kUAwgAsDqW/cjbNPQv9X2z6SYweS/aTdljlWd8L94R8vZ8SL3v1EZczv0b9K/GBbbqxgk5r9XdfyikfEDwPILMvas0gfAnx0V97en0r88xQk/0IPmvxGErZ681fa/9kCaiOy2/b/2BCK0wyDVvy2xROCT4ua/+5EBLOXxA0B7p53+BnkAQKKI/QV+y9i/qDznPFM86b/snWGNkkgHwC+ByugkUwdAR98lJFqQ2b9sL7HxZkPovyJNGM67oek/HzNy6BqA1D96EnqL7pLYv0v8nFypHeq/axL/u1FnB0AkSEHvxn8DQGt+gG5Pstm/QS1keLLK6b/Sk/O6mtGzPxU8pLcPNty/FssiPwWy4L+IZTNYLmzqvw4szKfSouq/G+XJHY1a87+TVW2LUjjfvwQaifgujuy/3VARaoMl2L9NFodfK+/qv+0QMvYfP+C/FvLf01HN67+ETOQysd8AwH71iI/eGgXAbHNSHrTg4L96GNJ2CFvsv6BnExReeAFA5CakvxSl+j8MzcbAuwDgv5bXzdT1Auy/uVq8/8x58z+uvPMNqzTnP2HlfZ3gqOG/Z5Uh1wDX7r8PUbMSo2P7P9VfBrXlxPI/tQvDXQ3H4r9sJXFt2GTvvyDssGgO0PG/WxT/uE4N+r+Bk03jWYvjv/bf8sHUYu+/rUXN8hUe3j9m5HB1yZCzv/yE3PUo0+K/qqAX9idJ8L9mByqLMMH5v4kHC7KQowHAm+sAswr15L8F7/a5DE/wv2JLsGADFwTAKQjVGovZCMDDkYbTbifnvwVbdNXyhfC/malhH7yI7D+oevd0GWDZP1sjk5AdouW/KH/hrXUg8b8KWmrpQ0sFQAzEAF/pTgBAhB1hfFzT5r9XK/wflZ7xv18hRuqKXAjA/5rUd9v1BED/tlxBd4bov7pQU4wLfPK/4pnwn0T/sj/c277XPF3jv02biiQ+Rum/zGkxMcl88r8Yk0HhJVzjv62yUUFRjfS/89MEdoPQ6r8TqikcRF/zvxQxghHovfY/cfM1eFWE5j9pcwp7GJPrv5ehC2fbYPO/KUV2nGg0/795OhmUaqEFwFQeuy4j+eq/ePiwytEp9L8DuqWfW+8BQLytJylXHPY/PlP4Qr8q7r+kDLLri0P1vxT4ShWL+Oo/DMsWg0zlv7/S9fINXGjtv73m373LRPW/+xg/Gaxd8b94MdQEfW0AwLjBLbDOHO+/kmm4ANp49L+cShSMMbAEwKyjUgWirAdAo2q2uqM08L99wKzM+7H2v3RdlNBXFgnA8S9+ewyV/z+vaSZre3Pxv6riWFiWZfi/2J7VSZZ60j+LES81zPn3v+OrlPMN3PK/quJYWJZl+L/OZbufkEcEQLCNB/1lPOO/Y2nmTbY/87+q4lhYlmX4v7CNB/1lPOO/zmW7n5BHBEBwKD1Aa57LP/XsSsw7RbU/PMDPJGsfoD/TqningGKIPzFtCLYmb3I/qYfrJr7eWz9pQmleXRFFP0rWlJkA2i8/pCvcttgTGD9Dt8IWbjMCPyCG4GRlhOs+1JI2GhDN1D7ns8cGvXK/Pi8m8UTJxac+hNTfA2z4kT7GI8kjLyt7Pv//////HwAI//////8zEAj/////fzIgCP////9vMjAI/////2MyQAj///8/YjJQCP///zdiMmAI////M2IycAj//78zYjKACP//qzNiMpAI/3+rM2IyoAj/D6szYjKwCP8DqzNiMsAIvwOrM2Iy0AifA6szYjLgCJkDqzNiMvAI//////8/Dwj//////ysfCP////9/KS8I/////z8pPwj/////OSlPCP///z84KV8I////Dzgpbwj///8OOCl/CP//Hw44KY8I//8PDjgpnwj/fw0OOCmvCP8PDQ44Kb8I/w0NDjgpzwj/DA0OOCnfCMcMDQ44Ke8IxAwNDjgp/wgHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAAEAAAADAAAADgAAAAYAAAALAAAAAgAAAAcAAAABAAAAGAAAAAUAAAAKAAAAAQAAAAYAAAAAAAAAJgAAAAcAAAAMAAAAAwAAAAgAAAACAAAAMQAAAAkAAAAOAAAAAAAAAAUAAAAEAAAAOgAAAAgAAAANAAAABAAAAAkAAAADAAAAPwAAAAsAAAAGAAAADwAAAAoAAAAQAAAASAAAAAwAAAAHAAAAEAAAAAsAAAARAAAAUwAAAAoAAAAFAAAAEwAAAA4AAAAPAAAAYQAAAA0AAAAIAAAAEQAAAAwAAAASAAAAawAAAA4AAAAJAAAAEgAAAA0AAAATAAAAdQAAAA8AAAATAAAAEQAAABIAAAAQAAAABgAAAAIAAAADAAAABQAAAAQAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAMAAAABAAAABQAAAAQAAAAAAAAAAAAAAAcAAAAFAAAAAwAAAAQAAAABAAAAAAAAAAIAAAAAAAAAAgAAAAMAAAABAAAABQAAAAQAAAAGAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifm/GC1EVPshCUAYLURU+yEJwGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjZWxsc1RvTXVsdGlQb2x5LmMAY2VsbFRvRWRnZUFyY3MAAAEDAgQABAMFAQJjYW5jZWxBcmNQYWlycwBjcmVhdGVTb3J0YWJsZUxvb3AAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAdmVjM1RvQ2VsbABjZWxsVG9DaGlsZFBvcwB2YWxpZGF0ZUNoaWxkUG9zAHJldkRpciAhPSBJTlZBTElEX0RJR0lUAGxvY2FsaWouYwBjZWxsVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAYmFzZUNlbGwgPT0gb3JpZ2luQmFzZUNlbGwALi4vaW5jbHVkZS9jb29yZGlqay5oAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAYmFzZUNlbGwgIT0gSU5WQUxJRF9CQVNFX0NFTEwAbG9jYWxJamtUb0NlbGwAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAZ3JpZFBhdGhDZWxsc0ludGVycG9sYXRlAHBvbHlmaWxsLmMAaXRlclN0ZXBQb2x5Z29uQ29tcGFjdAAwAHZlcnRleC5jAHZlcnRleFJvdGF0aW9ucwBjZWxsVG9WZXJ0ZXg=";var gt=28400;function St(Ne){return Ne}function qe(Ne){var nt=/\b__Z[\w\d_]+/g;return Ne.replace(nt,function(It){var He=It;return It===He?It:He+" ["+It+"]"})}function Ke(){var Ne=new Error;if(!Ne.stack){try{throw new Error(0)}catch(nt){Ne=nt}if(!Ne.stack)return"(no stack trace available)"}return Ne.stack.toString()}function Rt(){var Ne=Ke();return e.extraStackTrace&&(Ne+=`4129+`+e.extraStackTrace()),qe(Ne)}function en(Ne,nt,It,He){S0("Assertion failed: "+F(Ne)+", at: "+[nt?F(nt):"unknown filename",It,He?F(He):"unknown function"])}function Pt(){return J.length}function Mt(Ne,nt,It){j.set(j.subarray(nt,nt+It),Ne)}function cn(Ne){return e.___errno_location&&(ae[e.___errno_location()>>2]=Ne),Ne}function yn(Ne){S0("OOM")}function Rn(Ne){try{var nt=new ArrayBuffer(Ne);return nt.byteLength!=Ne?void 0:(new Int8Array(nt).set(J),tn(nt),Ie(nt),1)}catch{}}function xe(Ne){var nt=Pt(),It=16777216,He=2147483648-It;if(Ne>He)return!1;for(var h=16777216,ji=Math.max(nt,h);ji<Ne;)ji<=536870912?ji=H(2*ji,It):ji=Math.min(H((3*ji+2147483648)/4,It),He);var bi=Rn(ji);return!!bi}var bt=typeof atob=="function"?atob:function(Ne){var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",He,h,ji,bi,ne,Xi,La,Hs=0;Ne=Ne.replace(/[^A-Za-z0-9\+\/\=]/g,"");do bi=nt.indexOf(Ne.charAt(Hs++)),ne=nt.indexOf(Ne.charAt(Hs++)),Xi=nt.indexOf(Ne.charAt(Hs++)),La=nt.indexOf(Ne.charAt(Hs++)),He=bi<<2|ne>>4,h=(ne&15)<<4|Xi>>2,ji=(Xi&3)<<6|La,It=It+String.fromCharCode(He),Xi!==64&&(It=It+String.fromCharCode(h)),La!==64&&(It=It+String.fromCharCode(ji));while(Hs<Ne.length);return It};function Ye(Ne){try{for(var nt=bt(Ne),It=new Uint8Array(nt.length),He=0;He<nt.length;++He)It[He]=nt.charCodeAt(He);return It}catch{throw new Error("Converting base64 string to bytes failed.")}}function wt(Ne){if(Te(Ne))return Ye(Ne.slice(X.length))}var Dt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ct={a:S0,b:f,c:p,d:en,e:cn,f:Pt,g:Mt,h:xe,i:yn,j:St,k:qe,l:Rn,m:Ke,n:Rt,o:gt,p:Ue},Ce=(function(Ne,nt,It){"almost asm";var He=new Ne.Int8Array(It),h=new Ne.Int32Array(It),ji=new Ne.Uint8Array(It),bi=new Ne.Float32Array(It),ne=new Ne.Float64Array(It),Xi=nt.o|0,La=nt.p|0,Hs=Ne.Math.floor,Ps=Ne.Math.abs,ns=Ne.Math.sqrt,Qn=Ne.Math.cos,Ii=Ne.Math.sin,kb=Ne.Math.tan,Lie=Ne.Math.acos,J1=Ne.Math.asin,jk=Ne.Math.atan,na=Ne.Math.atan2,Ym=Ne.Math.ceil,Da=Ne.Math.imul,s4=Ne.Math.min,Die=Ne.Math.max,jh=Ne.Math.clz32,Fie=nt.a,Ln=nt.b,Q=nt.c,li=nt.d,Xk=nt.e,Oie=nt.f,Bie=nt.g,Uie=nt.h,kie=nt.i,Y=28416;function Gie(d){return He=new Int8Array(d),ji=new Uint8Array(d),h=new Int32Array(d),bi=new Float32Array(d),ne=new Float64Array(d),It=d,!0}function zie(d){d=d|0;var A=0;return A=Y,Y=Y+d|0,Y=Y+15&-16,A|0}function Vie(){return Y|0}function qie(d){d=d|0,Y=d}function Hie(d,A){d=d|0,A=A|0,Y=d}function Wie(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;return(d|0)<0?(A=2,A|0):(d|0)>13780509?(A=qb(15,A)|0,A|0):(m=((d|0)<0)<<31>>31,g=lr(d|0,m|0,3,0)|0,_=Q()|0,m=pt(d|0,m|0,1,0)|0,m=lr(g|0,_|0,m|0,Q()|0)|0,m=pt(m|0,Q()|0,1,0)|0,d=Q()|0,h[A>>2]=m,h[A+4>>2]=d,A=0,A|0)}function $k(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,Yk(d,A,m,_,0)|0}function Yk(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0;if(M=Y,Y=Y+16|0,b=M,!(Zk(d,A,m,_,g)|0))return _=0,Y=M,_|0;do if((m|0)>=0){if((m|0)>13780509){if(y=qb(15,b)|0,y|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else y=((m|0)<0)<<31>>31,I=lr(m|0,y|0,3,0)|0,E=Q()|0,y=pt(m|0,y|0,1,0)|0,y=lr(I|0,E|0,y|0,Q()|0)|0,y=pt(y|0,Q()|0,1,0)|0,E=Q()|0,h[b>>2]=y,h[b+4>>2]=E,b=y;if(sd(_|0,0,b<<3|0)|0,g|0){sd(g|0,0,b<<2|0)|0,y=fu(d,A,m,_,g,b,E,0)|0;break}y=ia(b,4)|0,y?(I=fu(d,A,m,_,y,b,E,0)|0,_t(y),y=I):y=13}else y=2;while(!1);return I=y,Y=M,I|0}function Zk(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(oe=Y,Y=Y+16|0,W=oe,$=oe+8|0,q=W,h[q>>2]=d,h[q+4>>2]=A,(m|0)<0)return $=2,Y=oe,$|0;if(y=_,h[y>>2]=d,h[y+4>>2]=A,y=(g|0)!=0,y&&(h[g>>2]=0),Ui(d,A)|0)return $=9,Y=oe,$|0;h[$>>2]=0;e:do if((m|0)>=1)if(y)for(O=1,I=0,G=0,q=1,y=d;;){if(!(I|G)){if(y=Is(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Ui(y,A)|0){y=9;break e}}if(y=Is(y,A,h[26864+(G<<2)>>2]|0,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,d=_+(O<<3)|0,h[d>>2]=y,h[d+4>>2]=A,h[g+(O<<2)>>2]=q,d=I+1|0,b=(d|0)==(q|0),E=G+1|0,M=(E|0)==6,Ui(y,A)|0){y=9;break e}if(q=q+(M&b&1)|0,(q|0)>(m|0)){y=0;break}else O=O+1|0,I=b?0:d,G=b?M?0:E:G}else for(O=1,I=0,G=0,q=1,y=d;;){if(!(I|G)){if(y=Is(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Ui(y,A)|0){y=9;break e}}if(y=Is(y,A,h[26864+(G<<2)>>2]|0,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,d=_+(O<<3)|0,h[d>>2]=y,h[d+4>>2]=A,d=I+1|0,b=(d|0)==(q|0),E=G+1|0,M=(E|0)==6,Ui(y,A)|0){y=9;break e}if(q=q+(M&b&1)|0,(q|0)>(m|0)){y=0;break}else O=O+1|0,I=b?0:d,G=b?M?0:E:G}else y=0;while(!1);return $=y,Y=oe,$|0}function fu(d,A,m,_,g,y,b,E){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0,E=E|0;var M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(oe=Y,Y=Y+16|0,W=oe+8|0,$=oe,M=Xh(d|0,A|0,y|0,b|0)|0,O=Q()|0,G=_+(M<<3)|0,ue=G,_e=h[ue>>2]|0,ue=h[ue+4>>2]|0,I=(_e|0)==(d|0)&(ue|0)==(A|0),!((_e|0)==0&(ue|0)==0|I))do M=pt(M|0,O|0,1,0)|0,M=rd(M|0,Q()|0,y|0,b|0)|0,O=Q()|0,G=_+(M<<3)|0,_e=G,ue=h[_e>>2]|0,_e=h[_e+4>>2]|0,I=(ue|0)==(d|0)&(_e|0)==(A|0);while(!((ue|0)==0&(_e|0)==0|I));if(M=g+(M<<2)|0,I&&(h[M>>2]|0)<=(E|0)||(_e=G,h[_e>>2]=d,h[_e+4>>2]=A,h[M>>2]=E,(E|0)>=(m|0)))return _e=0,Y=oe,_e|0;switch(I=E+1|0,h[W>>2]=0,M=Is(d,A,2,W,$)|0,M|0){case 9:{q=9;break}case 0:{M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M||(q=9);break}default:}e:do if((q|0)==9){switch(h[W>>2]=0,M=Is(d,A,3,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Is(d,A,1,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Is(d,A,5,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Is(d,A,4,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Is(d,A,6,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}return _e=0,Y=oe,_e|0}while(!1);return _e=M,Y=oe,_e|0}function Is(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(m>>>0>6)return g=1,g|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(y=0;;){switch(m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}if(y=y+1|0,(y|0)==(b|0))break e}while(!1);if(G=et(d|0,A|0,45)|0,Q()|0,O=G&127,O>>>0>121)return g=5,g|0;M=Fa(d,A)|0,y=et(d|0,A|0,52)|0,Q()|0,y=y&15;e:do if(!y)I=15;else{for(;;){if(b=(15-y|0)*3|0,E=et(d|0,A|0,b|0)|0,Q()|0,E=E&7,(E|0)==7){A=5;break}if($=(Bl(y)|0)==0,y=y+-1|0,q=ht(7,0,b|0)|0,A=A&~(Q()|0),W=ht(h[($?432:16)+(E*28|0)+(m<<2)>>2]|0,0,b|0)|0,b=Q()|0,m=h[($?640:224)+(E*28|0)+(m<<2)>>2]|0,d=W|d&~q,A=b|A,!m){m=0;break e}if(!y){I=15;break e}}return A|0}while(!1);(I|0)==15&&($=h[848+(O*28|0)+(m<<2)>>2]|0,W=ht($|0,0,45)|0,d=W|d,A=Q()|0|A&-1040385,m=h[4272+(O*28|0)+(m<<2)>>2]|0,($&127|0)==127&&($=ht(h[848+(O*28|0)+20>>2]|0,0,45)|0,A=Q()|0|A&-1040385,m=h[4272+(O*28|0)+20>>2]|0,d=T0($|d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1)),E=et(d|0,A|0,45)|0,Q()|0,E=E&127;e:do if(or(E)|0){t:do if((Fa(d,A)|0)==1){if((O|0)!=(E|0))if(e9(E,h[7696+(O*28|0)>>2]|0)|0){d=g4(d,A)|0,b=1,A=Q()|0;break}else li(27634,26928,533,26936);switch(M|0){case 3:{d=T0(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{d=g4(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return $=9,$|0;default:return $=1,$|0}}else b=0;while(!1);if((m|0)>0){y=0;do d=m4(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}if((O|0)!=(E|0)){if(!(o4(E)|0)){if((b|0)!=0|(Fa(d,A)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(G&127){case 8:case 118:break e;default:}(Fa(d,A)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((m|0)>0){y=0;do d=T0(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+m|0)%6|0,$=g,h[$>>2]=d,h[$+4>>2]=A,$=0,$|0}function jie(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,Kk(d,A,m,_)|0?(sd(_|0,0,m*48|0)|0,_=Xie(d,A,m,_)|0,_|0):(_=0,_|0)}function Kk(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if($=Y,Y=Y+16|0,q=$,W=$+8|0,G=q,h[G>>2]=d,h[G+4>>2]=A,(m|0)<0)return W=2,Y=$,W|0;if(!m)return W=_,h[W>>2]=d,h[W+4>>2]=A,W=0,Y=$,W|0;h[W>>2]=0;e:do if(Ui(d,A)|0)d=9;else{g=0,G=d;do{if(d=Is(G,A,4,W,q)|0,d|0)break e;if(A=q,G=h[A>>2]|0,A=h[A+4>>2]|0,g=g+1|0,Ui(G,A)|0){d=9;break e}}while((g|0)<(m|0));O=_,h[O>>2]=G,h[O+4>>2]=A,O=m+-1|0,I=0,d=1;do{if(g=26864+(I<<2)|0,(I|0)==5)for(b=h[g>>2]|0,y=0,g=d;;){if(d=q,d=Is(h[d>>2]|0,h[d+4>>2]|0,b,W,q)|0,d|0)break e;if((y|0)!=(O|0))if(M=q,E=h[M>>2]|0,M=h[M+4>>2]|0,d=_+(g<<3)|0,h[d>>2]=E,h[d+4>>2]=M,!(Ui(E,M)|0))d=g+1|0;else{d=9;break e}else d=g;if(y=y+1|0,(y|0)>=(m|0))break;g=d}else for(b=q,M=h[g>>2]|0,E=0,g=d,y=h[b>>2]|0,b=h[b+4>>2]|0;;){if(d=Is(y,b,M,W,q)|0,d|0)break e;if(b=q,y=h[b>>2]|0,b=h[b+4>>2]|0,d=_+(g<<3)|0,h[d>>2]=y,h[d+4>>2]=b,d=g+1|0,Ui(y,b)|0){d=9;break e}if(E=E+1|0,(E|0)>=(m|0))break;g=d}I=I+1|0}while(I>>>0<6);d=q,d=(G|0)==(h[d>>2]|0)&&(A|0)==(h[d+4>>2]|0)?0:9}while(!1);return W=d,Y=$,W|0}function Xie(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;if(G=Y,Y=Y+16|0,b=G,!m)return h[_>>2]=d,h[_+4>>2]=A,_=0,Y=G,_|0;do if((m|0)>=0){if((m|0)>13780509){if(g=qb(15,b)|0,g|0)break;y=b,g=h[y>>2]|0,y=h[y+4>>2]|0}else g=((m|0)<0)<<31>>31,O=lr(m|0,g|0,3,0)|0,y=Q()|0,g=pt(m|0,g|0,1,0)|0,g=lr(O|0,y|0,g|0,Q()|0)|0,g=pt(g|0,Q()|0,1,0)|0,y=Q()|0,O=b,h[O>>2]=g,h[O+4>>2]=y;if(I=ia(g,8)|0,!I)g=13;else{if(O=ia(g,4)|0,!O){_t(I),g=13;break}if(g=fu(d,A,m,I,O,g,y,0)|0,g|0){_t(I),_t(O);break}if(A=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&A>>>0>0){g=0,E=0,M=0;do d=I+(E<<3)|0,y=h[d>>2]|0,d=h[d+4>>2]|0,!((y|0)==0&(d|0)==0)&&(h[O+(E<<2)>>2]|0)==(m|0)&&(q=_+(g<<3)|0,h[q>>2]=y,h[q+4>>2]=d,g=g+1|0),E=pt(E|0,M|0,1,0)|0,M=Q()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<A>>>0)}_t(I),_t(O),g=0}}else g=2;while(!1);return q=g,Y=G,q|0}function Gb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;for(E=Y,Y=Y+16|0,y=E,b=E+8|0,g=(Ui(d,A)|0)==0,g=g?1:2;;){if(h[b>>2]=0,I=(Is(d,A,g,b,y)|0)==0,M=y,I&((h[M>>2]|0)==(m|0)?(h[M+4>>2]|0)==(_|0):0)){d=4;break}if(g=g+1|0,g>>>0>=7){g=7,d=4;break}}return(d|0)==4?(Y=E,g|0):0}function $ie(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;if(E=Y,Y=Y+48|0,g=E+16|0,y=E+8|0,b=E,m=ax(m)|0,m|0)return b=m,Y=E,b|0;if(I=d,M=h[I+4>>2]|0,m=y,h[m>>2]=h[I>>2],h[m+4>>2]=M,_9(y,g),m=r9(g,A,b)|0,!m){if(A=h[y>>2]|0,y=h[d+8>>2]|0,(y|0)>0){g=h[d+12>>2]|0,m=0;do A=(h[g+(m<<3)>>2]|0)+A|0,m=m+1|0;while((m|0)<(y|0))}m=b,g=h[m>>2]|0,m=h[m+4>>2]|0,y=((A|0)<0)<<31>>31,(m|0)<(y|0)|(m|0)==(y|0)&g>>>0<A>>>0?(m=b,h[m>>2]=A,h[m+4>>2]=y,m=y):A=g,M=pt(A|0,m|0,12,0)|0,I=Q()|0,m=b,h[m>>2]=M,h[m+4>>2]=I,m=_,h[m>>2]=M,h[m+4>>2]=I,m=0}return I=m,Y=E,I|0}function Qk(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,mi=0,oo=0,Bn=0,gi=0,ra=0;if(mi=Y,Y=Y+64|0,Ot=mi+48|0,at=mi+32|0,dt=mi+24|0,Fe=mi+8|0,Ze=mi,M=h[d>>2]|0,(M|0)<=0)return ci=0,Y=mi,ci|0;for(Ee=d+4|0,ye=Ot+8|0,At=at+8|0,We=Fe+8|0,E=0,be=0;;){I=h[Ee>>2]|0,re=I+(be<<4)|0,h[Ot>>2]=h[re>>2],h[Ot+4>>2]=h[re+4>>2],h[Ot+8>>2]=h[re+8>>2],h[Ot+12>>2]=h[re+12>>2],(be|0)==(M+-1|0)?(h[at>>2]=h[I>>2],h[at+4>>2]=h[I+4>>2],h[at+8>>2]=h[I+8>>2],h[at+12>>2]=h[I+12>>2]):(re=I+(be+1<<4)|0,h[at>>2]=h[re>>2],h[at+4>>2]=h[re+4>>2],h[at+8>>2]=h[re+8>>2],h[at+12>>2]=h[re+12>>2]),M=cre(Ot,at,_,dt)|0;e:do if(M)I=0,E=M;else if(M=dt,I=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&I>>>0>0){_e=0,re=0;t:for(;;){if(Bn=1/(+(I>>>0)+4294967296*+(M|0)),ra=+ne[Ot>>3],M=Ns(I|0,M|0,_e|0,re|0)|0,gi=+(M>>>0)+4294967296*+(Q()|0),oo=+(_e>>>0)+4294967296*+(re|0),ne[Fe>>3]=Bn*(ra*gi)+Bn*(+ne[at>>3]*oo),ne[We>>3]=Bn*(+ne[ye>>3]*gi)+Bn*(+ne[At>>3]*oo),M=_4(Fe,_,Ze)|0,M|0){E=M;break}ue=Ze,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,q=Xh(oe|0,ue|0,A|0,m|0)|0,O=Q()|0,M=b+(q<<3)|0,G=M,I=h[G>>2]|0,G=h[G+4>>2]|0;n:do if((I|0)==0&(G|0)==0)me=M,ci=16;else for(W=0,$=0;;){if((W|0)>(m|0)|(W|0)==(m|0)&$>>>0>A>>>0){E=1;break t}if((I|0)==(oe|0)&(G|0)==(ue|0))break n;if(M=pt(q|0,O|0,1,0)|0,q=rd(M|0,Q()|0,A|0,m|0)|0,O=Q()|0,$=pt($|0,W|0,1,0)|0,W=Q()|0,M=b+(q<<3)|0,G=M,I=h[G>>2]|0,G=h[G+4>>2]|0,(I|0)==0&(G|0)==0){me=M,ci=16;break}}while(!1);if((ci|0)==16&&(ci=0,!((oe|0)==0&(ue|0)==0))&&($=me,h[$>>2]=oe,h[$+4>>2]=ue,$=y+(h[g>>2]<<3)|0,h[$>>2]=oe,h[$+4>>2]=ue,$=g,$=pt(h[$>>2]|0,h[$+4>>2]|0,1,0)|0,oe=Q()|0,ue=g,h[ue>>2]=$,h[ue+4>>2]=oe),_e=pt(_e|0,re|0,1,0)|0,re=Q()|0,M=dt,I=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(re|0)|(M|0)==(re|0)&I>>>0>_e>>>0)){I=1;break e}}I=0}else I=1;while(!1);if(be=be+1|0,!I){ci=21;break}if(M=h[d>>2]|0,(be|0)>=(M|0)){E=0,ci=21;break}}return(ci|0)==21?(Y=mi,E|0):0}function Yie(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,mi=0,oo=0,Bn=0,gi=0;if(gi=Y,Y=Y+112|0,ci=gi+80|0,M=gi+72|0,mi=gi,oo=gi+56|0,g=ax(m)|0,g|0)return Bn=g,Y=gi,Bn|0;if(I=d+8|0,Bn=ar((h[I>>2]<<5)+32|0)|0,!Bn)return Bn=13,Y=gi,Bn|0;if(T4(d,Bn),g=ax(m)|0,!g){if(at=d,dt=h[at+4>>2]|0,g=M,h[g>>2]=h[at>>2],h[g+4>>2]=dt,_9(M,ci),g=r9(ci,A,mi)|0,g)at=0,dt=0;else{if(g=h[M>>2]|0,y=h[I>>2]|0,(y|0)>0){b=h[d+12>>2]|0,m=0;do g=(h[b+(m<<3)>>2]|0)+g|0,m=m+1|0;while((m|0)!=(y|0));m=g}else m=g;g=mi,y=h[g>>2]|0,g=h[g+4>>2]|0,b=((m|0)<0)<<31>>31,(g|0)<(b|0)|(g|0)==(b|0)&y>>>0<m>>>0?(g=mi,h[g>>2]=m,h[g+4>>2]=b,g=b):m=y,at=pt(m|0,g|0,12,0)|0,dt=Q()|0,g=mi,h[g>>2]=at,h[g+4>>2]=dt,g=0}if(!g){if(m=ia(at,8)|0,!m)return _t(Bn),Bn=13,Y=gi,Bn|0;if(E=ia(at,8)|0,!E)return _t(Bn),_t(m),Bn=13,Y=gi,Bn|0;We=ci,h[We>>2]=0,h[We+4>>2]=0,We=d,Ot=h[We+4>>2]|0,g=M,h[g>>2]=h[We>>2],h[g+4>>2]=Ot,g=Qk(M,at,dt,A,ci,m,E)|0;e:do if(g)_t(m),_t(E),_t(Bn);else{t:do if((h[I>>2]|0)>0){for(b=d+12|0,y=0;g=Qk((h[b>>2]|0)+(y<<3)|0,at,dt,A,ci,m,E)|0,y=y+1|0,!(g|0);)if((y|0)>=(h[I>>2]|0))break t;_t(m),_t(E),_t(Bn);break e}while(!1);(dt|0)>0|(dt|0)==0&at>>>0>0&&sd(E|0,0,at<<3|0)|0,Ot=ci,We=h[Ot+4>>2]|0;t:do if((We|0)>0|(We|0)==0&(h[Ot>>2]|0)>>>0>0){Ee=m,ye=E,At=m,We=E,Ot=m,g=m,me=m,Fe=E,Ze=E,m=E;n:for(;;){for(ue=0,_e=0,re=0,be=0,y=0,b=0;;){E=mi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(A=Ee+(ue<<3)|0,I=h[A>>2]|0,A=h[A+4>>2]|0,Zk(I,A,1,mi,0)|0){E=mi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=ia(7,4)|0,E|0&&(fu(I,A,1,mi,E,7,0,0)|0,_t(E))}for(oe=0;;){$=mi+(oe<<3)|0,W=h[$>>2]|0,$=h[$+4>>2]|0;i:do if((W|0)==0&($|0)==0)E=y,M=b;else{if(O=Xh(W|0,$|0,at|0,dt|0)|0,I=Q()|0,E=_+(O<<3)|0,A=E,M=h[A>>2]|0,A=h[A+4>>2]|0,!((M|0)==0&(A|0)==0)){G=0,q=0;do{if((G|0)>(dt|0)|(G|0)==(dt|0)&q>>>0>at>>>0)break n;if((M|0)==(W|0)&(A|0)==($|0)){E=y,M=b;break i}E=pt(O|0,I|0,1,0)|0,O=rd(E|0,Q()|0,at|0,dt|0)|0,I=Q()|0,q=pt(q|0,G|0,1,0)|0,G=Q()|0,E=_+(O<<3)|0,A=E,M=h[A>>2]|0,A=h[A+4>>2]|0}while(!((M|0)==0&(A|0)==0))}if((W|0)==0&($|0)==0){E=y,M=b;break}Qm(W,$,oo)|0,E4(d,Bn,oo)|0&&(q=pt(y|0,b|0,1,0)|0,b=Q()|0,G=E,h[G>>2]=W,h[G+4>>2]=$,y=ye+(y<<3)|0,h[y>>2]=W,h[y+4>>2]=$,y=q),E=y,M=b}while(!1);if(oe=oe+1|0,oe>>>0>=7)break;y=E,b=M}if(ue=pt(ue|0,_e|0,1,0)|0,_e=Q()|0,re=pt(re|0,be|0,1,0)|0,be=Q()|0,b=ci,y=h[b>>2]|0,b=h[b+4>>2]|0,(be|0)<(b|0)|(be|0)==(b|0)&re>>>0<y>>>0)y=E,b=M;else break}if((b|0)>0|(b|0)==0&y>>>0>0){y=0,b=0;do be=Ee+(y<<3)|0,h[be>>2]=0,h[be+4>>2]=0,y=pt(y|0,b|0,1,0)|0,b=Q()|0,be=ci,re=h[be+4>>2]|0;while((b|0)<(re|0)|((b|0)==(re|0)?y>>>0<(h[be>>2]|0)>>>0:0))}if(be=ci,h[be>>2]=E,h[be+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)oe=m,ue=Ze,_e=Ot,re=Fe,be=ye,m=me,Ze=g,Fe=At,me=oe,g=ue,Ot=We,We=_e,At=re,ye=Ee,Ee=be;else break t}_t(At),_t(We),_t(Bn),g=1;break e}else g=E;while(!1);_t(Bn),_t(m),_t(g),g=0}while(!1);return Bn=g,Y=gi,Bn|0}}return _t(Bn),Bn=g,Y=gi,Bn|0}function Zie(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0;if(E=Y,Y=Y+16|0,b=E,d=hre(d,A,((A|0)<0)<<31>>31,b)|0,d|0)return b=d,Y=E,b|0;if(y=jre(b,m)|0,m=b+4|0,(h[b>>2]|0)>0){A=0;do{if(g=h[m>>2]|0,_=g+(A<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[g+(A<<4)>>2]=0,_=g+(A<<4)+8|0,g=g+(A<<4)+12|0,(h[_>>2]|0)>0){d=0;do M=h[g>>2]|0,I=M+(d<<3)+4|0,_t(h[I>>2]|0),h[I>>2]=0,h[M+(d<<3)>>2]=0,d=d+1|0;while((d|0)<(h[_>>2]|0))}_t(h[g>>2]|0),h[g>>2]=0,h[_>>2]=0,A=A+1|0}while((A|0)<(h[b>>2]|0))}return _t(h[m>>2]|0),h[m>>2]=0,h[b>>2]=0,I=y,Y=E,I|0}function Ol(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(b=h[d>>2]|0,(b|0)<=0)return g=0,_=0,b=g<0,_=12.566370614359172-_,_=g+_,g=b?_:g,ne[A>>3]=g,0;if(y=h[d+4>>2]|0,d=(b|0)!=1&1,E=+ne[y>>3]*.5+.7853981633974483,g=+ne[y+(d<<4)>>3]*.5+.7853981633974483,m=+Ii(+E)*+Ii(+g),_=+ne[y+(d<<4)+8>>3]-+ne[y+8>>3],m=+na(+(+Ii(+_)*m),+(+Qn(+E)*+Qn(+g)+ +Qn(+_)*m))*-2,_=m+0,m=_-m,(b|0)==1)return E=_,g=m,b=E<0,g=12.566370614359172-g,g=E+g,E=b?g:E,ne[A>>3]=E,0;for(d=1,g=_;O=d,d=d+1|0,G=(d|0)%(b|0)|0,I=+ne[y+(O<<4)>>3]*.5+.7853981633974483,M=+ne[y+(G<<4)>>3]*.5+.7853981633974483,_=+Ii(+I)*+Ii(+M),E=+ne[y+(G<<4)+8>>3]-+ne[y+(O<<4)+8>>3],m=+na(+(+Ii(+E)*_),+(+Qn(+I)*+Qn(+M)+ +Qn(+E)*_))*-2-m,_=g+m,m=_-g-m,!((d|0)>=(b|0));)g=_;return G=_<0,I=12.566370614359172-m,I=_+I,I=G?I:_,ne[A>>3]=I,0}function Kie(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=E0(d,A,g)|0,d|0?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Ol(_,m)|0,y=0,Y=b,y|0)}function Qie(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=E0(d,A,g)|0,d?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Ol(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8,y=0,Y=b,y|0)}function Jie(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=E0(d,A,g)|0,d?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Ol(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8*1e6,y=0,Y=b,y|0)}function or(d){return d=d|0,d>>>0>121?(d=0,d|0):(d=h[7696+(d*28|0)+16>>2]|0,d|0)}function o4(d){return d=d|0,(d|0)==4|(d|0)==117|0}function Jk(d){return d=d|0,h[11120+((h[d>>2]|0)*216|0)+((h[d+4>>2]|0)*72|0)+((h[d+8>>2]|0)*24|0)+(h[d+12>>2]<<3)>>2]|0}function ere(d){return d=d|0,h[11120+((h[d>>2]|0)*216|0)+((h[d+4>>2]|0)*72|0)+((h[d+8>>2]|0)*24|0)+(h[d+12>>2]<<3)+4>>2]|0}function tre(d,A){d=d|0,A=A|0,d=7696+(d*28|0)|0,h[A>>2]=h[d>>2],h[A+4>>2]=h[d+4>>2],h[A+8>>2]=h[d+8>>2],h[A+12>>2]=h[d+12>>2]}function nre(d,A){d=d|0,A=A|0;var m=0,_=0;if(A>>>0>20)return A=-1,A|0;do if((h[11120+(A*216|0)>>2]|0)!=(d|0))if((h[11120+(A*216|0)+8>>2]|0)!=(d|0))if((h[11120+(A*216|0)+16>>2]|0)!=(d|0))if((h[11120+(A*216|0)+24>>2]|0)!=(d|0))if((h[11120+(A*216|0)+32>>2]|0)!=(d|0))if((h[11120+(A*216|0)+40>>2]|0)!=(d|0))if((h[11120+(A*216|0)+48>>2]|0)!=(d|0))if((h[11120+(A*216|0)+56>>2]|0)!=(d|0))if((h[11120+(A*216|0)+64>>2]|0)!=(d|0))if((h[11120+(A*216|0)+72>>2]|0)!=(d|0))if((h[11120+(A*216|0)+80>>2]|0)!=(d|0))if((h[11120+(A*216|0)+88>>2]|0)!=(d|0))if((h[11120+(A*216|0)+96>>2]|0)!=(d|0))if((h[11120+(A*216|0)+104>>2]|0)!=(d|0))if((h[11120+(A*216|0)+112>>2]|0)!=(d|0))if((h[11120+(A*216|0)+120>>2]|0)!=(d|0))if((h[11120+(A*216|0)+128>>2]|0)!=(d|0))if((h[11120+(A*216|0)+136>>2]|0)==(d|0))d=2,m=1,_=2;else{if((h[11120+(A*216|0)+144>>2]|0)==(d|0)){d=0,m=2,_=0;break}if((h[11120+(A*216|0)+152>>2]|0)==(d|0)){d=0,m=2,_=1;break}if((h[11120+(A*216|0)+160>>2]|0)==(d|0)){d=0,m=2,_=2;break}if((h[11120+(A*216|0)+168>>2]|0)==(d|0)){d=1,m=2,_=0;break}if((h[11120+(A*216|0)+176>>2]|0)==(d|0)){d=1,m=2,_=1;break}if((h[11120+(A*216|0)+184>>2]|0)==(d|0)){d=1,m=2,_=2;break}if((h[11120+(A*216|0)+192>>2]|0)==(d|0)){d=2,m=2,_=0;break}if((h[11120+(A*216|0)+200>>2]|0)==(d|0)){d=2,m=2,_=1;break}if((h[11120+(A*216|0)+208>>2]|0)==(d|0)){d=2,m=2,_=2;break}else d=-1;return d|0}else d=2,m=1,_=1;else d=2,m=1,_=0;else d=1,m=1,_=2;else d=1,m=1,_=1;else d=1,m=1,_=0;else d=0,m=1,_=2;else d=0,m=1,_=1;else d=0,m=1,_=0;else d=2,m=0,_=2;else d=2,m=0,_=1;else d=2,m=0,_=0;else d=1,m=0,_=2;else d=1,m=0,_=1;else d=1,m=0,_=0;else d=0,m=0,_=2;else d=0,m=0,_=1;else d=0,m=0,_=0;while(!1);return A=h[11120+(A*216|0)+(m*72|0)+(d*24|0)+(_<<3)+4>>2]|0,A|0}function e9(d,A){return d=d|0,A=A|0,(h[7696+(d*28|0)+20>>2]|0)==(A|0)?(A=1,A|0):(A=(h[7696+(d*28|0)+24>>2]|0)==(A|0),A|0)}function a4(d,A){return d=d|0,A=A|0,h[848+(d*28|0)+(A<<2)>>2]|0}function l4(d,A){return d=d|0,A=A|0,(h[848+(d*28|0)>>2]|0)==(A|0)?(A=0,A|0):(h[848+(d*28|0)+4>>2]|0)==(A|0)?(A=1,A|0):(h[848+(d*28|0)+8>>2]|0)==(A|0)?(A=2,A|0):(h[848+(d*28|0)+12>>2]|0)==(A|0)?(A=3,A|0):(h[848+(d*28|0)+16>>2]|0)==(A|0)?(A=4,A|0):(h[848+(d*28|0)+20>>2]|0)==(A|0)?(A=5,A|0):((h[848+(d*28|0)+24>>2]|0)==(A|0)?6:7)|0}function ire(){return 122}function rre(d){d=d|0;var A=0,m=0,_=0;A=0;do ht(A|0,0,45)|0,_=Q()|0|134225919,m=d+(A<<3)|0,h[m>>2]=-1,h[m+4>>2]=_,A=A+1|0;while((A|0)!=122);return 0}function sre(d){d=d|0;var A=0,m=0,_=0;return _=+ne[d+16>>3],m=+ne[d+24>>3],A=_-m,+(_<m?A+6.283185307179586:A)}function ore(d){return d=d|0,+ne[d+16>>3]<+ne[d+24>>3]|0}function are(d){return d=d|0,+(+ne[d>>3]-+ne[d+8>>3])}function t9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;return m=+ne[A>>3],!(m>=+ne[d+8>>3])||!(m<=+ne[d>>3])?(A=0,A|0):(_=+ne[d+16>>3],m=+ne[d+24>>3],g=+ne[A+8>>3],A=g>=m,d=g<=_&1,_<m?A&&(d=1):A||(d=0),A=(d|0)!=0,A|0)}function c4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;return+ne[d>>3]<+ne[A+8>>3]||+ne[d+8>>3]>+ne[A>>3]?(_=0,_|0):(y=+ne[d+16>>3],m=d+24|0,O=+ne[m>>3],b=y<O,_=A+16|0,I=+ne[_>>3],g=A+24|0,M=+ne[g>>3],E=I<M,A=O-I<M-y,d=b?E|A?1:2:0,A=E?b?1:A?2:1:0,y=+al(y,d),y<+al(+ne[g>>3],A)||(O=+al(+ne[m>>3],d),O>+al(+ne[_>>3],A))?(E=0,E|0):(E=1,E|0))}function lre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0;y=+ne[d+16>>3],M=+ne[d+24>>3],d=y<M,E=+ne[A+16>>3],b=+ne[A+24>>3],g=E<b,A=M-E<b-y,h[m>>2]=d?g|A?1:2:0,h[_>>2]=g?d?1:A?2:1:0}function n9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;return+ne[d>>3]<+ne[A>>3]||+ne[d+8>>3]>+ne[A+8>>3]?(_=0,_|0):(_=d+16|0,M=+ne[_>>3],y=+ne[d+24>>3],b=M<y,m=A+16|0,O=+ne[m>>3],g=A+24|0,I=+ne[g>>3],E=O<I,A=y-O<I-M,d=b?E|A?1:2:0,A=E?b?1:A?2:1:0,y=+al(y,d),y<=+al(+ne[g>>3],A)?(O=+al(+ne[_>>3],d),E=O>=+al(+ne[m>>3],A),E|0):(E=0,E|0))}function i9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;g=Y,Y=Y+176|0,_=g,h[_>>2]=4,E=+ne[A>>3],ne[_+8>>3]=E,y=+ne[A+16>>3],ne[_+16>>3]=y,ne[_+24>>3]=E,E=+ne[A+24>>3],ne[_+32>>3]=E,b=+ne[A+8>>3],ne[_+40>>3]=b,ne[_+48>>3]=E,ne[_+56>>3]=b,ne[_+64>>3]=y,A=_+72|0,m=A+96|0;do h[A>>2]=0,A=A+4|0;while((A|0)<(m|0));_c(d|0,_|0,168)|0,Y=g}function r9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;$=Y,Y=Y+288|0,O=$+264|0,G=$+96|0,I=$,E=I,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return A=y4(A,I)|0,A|0?(W=A,Y=$,W|0):(M=I,I=h[M>>2]|0,M=h[M+4>>2]|0,Qm(I,M,O)|0,E0(I,M,G)|0,b=+rx(O,G+8|0),ne[O>>3]=+ne[d>>3],M=O+8|0,ne[M>>3]=+ne[d+16>>3],ne[G>>3]=+ne[d+8>>3],I=G+8|0,ne[I>>3]=+ne[d+24>>3],g=+rx(O,G),ue=+ne[M>>3]-+ne[I>>3],y=+Ps(+ue),oe=+ne[O>>3]-+ne[G>>3],_=+Ps(+oe),!(ue==0|oe==0)&&(ue=+I9(+y,+_),ue=+Ym(+(g*g/+Zb(+(ue/+Zb(+y,+_)),3)/(b*(b*2.59807621135)*.8))),ne[Xi>>3]=ue,q=~~ue>>>0,W=+Ps(ue)>=1?ue>0?~~+s4(+Hs(ue/4294967296),4294967295)>>>0:~~+Ym((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[Xi+4>>2]&2146435072|0)!=2146435072)?(G=(q|0)==0&(W|0)==0,A=m,h[A>>2]=G?1:q,h[A+4>>2]=G?0:W,A=0):A=1,W=A,Y=$,W|0)}function cre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;I=Y,Y=Y+288|0,b=I+264|0,E=I+96|0,M=I,g=M,y=g+96|0;do h[g>>2]=0,g=g+4|0;while((g|0)<(y|0));return m=y4(m,M)|0,m|0?(_=m,Y=I,_|0):(m=M,g=h[m>>2]|0,m=h[m+4>>2]|0,Qm(g,m,b)|0,E0(g,m,E)|0,O=+rx(b,E+8|0),O=+Ym(+(+rx(d,A)/(O*2))),ne[Xi>>3]=O,m=~~O>>>0,g=+Ps(O)>=1?O>0?~~+s4(+Hs(O/4294967296),4294967295)>>>0:~~+Ym((O-+(~~O>>>0))/4294967296)>>>0:0,(h[Xi+4>>2]&2146435072|0)==2146435072?(_=1,Y=I,_|0):(M=(m|0)==0&(g|0)==0,h[_>>2]=M?1:m,h[_+4>>2]=M?0:g,_=0,Y=I,_|0))}function ure(d,A){d=d|0,A=+A;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;y=d+16|0,b=+ne[y>>3],m=d+24|0,g=+ne[m>>3],_=b-g,_=b<g?_+6.283185307179586:_,I=+ne[d>>3],E=d+8|0,M=+ne[E>>3],O=I-M,_=(_*A-_)*.5,A=(O*A-O)*.5,I=I+A,ne[d>>3]=I>1.5707963267948966?1.5707963267948966:I,A=M-A,ne[E>>3]=A<-1.5707963267948966?-1.5707963267948966:A,A=b+_,A=A>3.141592653589793?A+-6.283185307179586:A,ne[y>>3]=A<-3.141592653589793?A+6.283185307179586:A,A=g-_,A=A>3.141592653589793?A+-6.283185307179586:A,ne[m>>3]=A<-3.141592653589793?A+6.283185307179586:A}function hre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0;if(dt=Y,Y=Y+224|0,At=dt,Fe=dt+48|0,M=(m|0)>0|(m|0)==0&A>>>0>0,M&(m>>>0>0|(m|0)==0&A>>>0>17895697))return at=14,Y=dt,at|0;if((m|0)<0)return at=2,Y=dt,at|0;if((A|0)==0&(m|0)==0)return h[_>>2]=0,h[_+4>>2]=0,at=0,Y=dt,at|0;for(g=d,g=d4(h[g>>2]|0,h[g+4>>2]|0)|0,b=0,E=0;;){if(y=d+(b<<3)|0,at=y,!(Vb(h[at>>2]|0,h[at+4>>2]|0)|0)){g=5,We=159;break}if(at=y,at=(d4(h[at>>2]|0,h[at+4>>2]|0)|0)==(g|0),b=pt(b|0,E|0,1,0)|0,E=Q()|0,!at){g=12,We=159;break}if(!((E|0)<(m|0)|(E|0)==(m|0)&b>>>0<A>>>0)){We=8;break}}if((We|0)==8){do if((m|0)>0|(m|0)==0&A>>>0>1){if(g=A<<3,b=ar(g)|0,!b)return at=13,Y=dt,at|0;for(_c(b|0,d|0,g|0)|0,jb(b,A,8,1),g=1,y=0;Ot=b+(g<<3)|0,at=b+(g+-1<<3)|0,at=(h[Ot>>2]|0)==(h[at>>2]|0)?(h[Ot+4>>2]|0)==(h[at+4>>2]|0):0,g=pt(g|0,y|0,1,0)|0,y=Q()|0,!at;)if(!((y|0)<(m|0)|(y|0)==(m|0)&g>>>0<A>>>0)){We=14;break}if((We|0)==14){_t(b);break}return _t(b),at=10,Y=dt,at|0}while(!1);if(g=lr(A|0,m|0,6,0)|0,y=Q()|0,M){b=0,E=0;do at=d+(E<<3)|0,at=((Ui(h[at>>2]|0,h[at+4>>2]|0)|0)!=0)<<31>>31,g=pt(g|0,y|0,at|0,((at|0)<0)<<31>>31|0)|0,y=Q()|0,E=pt(E|0,b|0,1,0)|0,b=Q()|0;while((b|0)<(m|0)|(b|0)==(m|0)&E>>>0<A>>>0);me=g,be=y}else me=g,be=y;if(_e=lr(me|0,be|0,10,0)|0,re=Q()|0,Ot=ar(me<<5)|0,!Ot)return at=13,Y=dt,at|0;if(at=ia(_e,4)|0,!at)return _t(Ot),at=13,Y=dt,at|0;e:do if(M){for(ye=d,u4(h[ye>>2]|0,h[ye+4>>2]|0,At)|0,W=Ot,$=0,oe=0,g=0,ue=0;;){M=At,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,y=M?26990:26995,b=M?5:6,E=0,M=At+((M&1)<<3)|0,I=pt(b|0,E|0,-1,-1)|0,O=Q()|0,G=0,q=0;do Ee=M+(G<<3)|0,Ze=h[Ee+4>>2]|0,ye=W+(G<<5)|0,h[ye>>2]=h[Ee>>2],h[ye+4>>2]=Ze,He[W+(G<<5)+9>>0]=0,He[W+(G<<5)+8>>0]=0,h[W+(G<<5)+20>>2]=W,ye=W+(G<<5)+24|0,h[ye>>2]=1,h[ye+4>>2]=0,ye=He[y+G>>0]|0,Ze=pt(I|0,O|0,G|0,q|0)|0,Ze=Xh(Ze|0,Q()|0,b|0,E|0)|0,Q()|0,Ze=He[y+Ze>>0]|0,G=pt(G|0,q|0,1,0)|0,q=Q()|0,Ee=He[y+((G|0)==(b|0)&(q|0)==(E|0)?0:G)>>0]|0,ye=ye&255,h[W+(ye<<5)+16>>2]=W+((Ze&255)<<5),h[W+(ye<<5)+12>>2]=W+((Ee&255)<<5);while(q>>>0<E>>>0|(q|0)==(E|0)&G>>>0<b>>>0);if($=pt($|0,oe|0,1,0)|0,oe=Q()|0,g=pt(b|0,E|0,g|0,ue|0)|0,ue=Q()|0,!((oe|0)<(m|0)|(oe|0)==(m|0)&$>>>0<A>>>0))break e;ye=d+($<<3)|0,u4(h[ye>>2]|0,h[ye+4>>2]|0,At)|0||(W=Ot+(g<<5)|0)}li(27634,26956,108,26975)}while(!1);if((be|0)>0|(be|0)==0&me>>>0>0){E=0,M=0;do{if(y=Ot+(E<<5)|0,b=h[y>>2]|0,y=h[y+4>>2]|0,g=et(b|0,y|0,30)|0,y=lr(g^b|0,(Q()|0)^y|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=lr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Xh(g^b|0,(Q()|0)^y|0,_e|0,re|0)|0,b=Q()|0,g=at+(y<<2)|0,h[g>>2]|0)do g=pt(y|0,b|0,1,0)|0,y=rd(g|0,Q()|0,_e|0,re|0)|0,b=Q()|0,g=at+(y<<2)|0;while((h[g>>2]|0)!=0);h[g>>2]=Ot+(E<<5),E=pt(E|0,M|0,1,0)|0,M=Q()|0}while((M|0)<(be|0)|(M|0)==(be|0)&E>>>0<me>>>0);G=0,q=0;do{if(E=Ot+(G<<5)|0,M=Ot+(G<<5)+9|0,!(He[M>>0]|0)){if(ye=E,o9(h[ye>>2]|0,h[ye+4>>2]|0,At)|0){We=39;break}O=At,I=h[O>>2]|0,O=h[O+4>>2]|0,y=et(I|0,O|0,30)|0,y=lr(y^I|0,(Q()|0)^O|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=lr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Xh(g^b|0,(Q()|0)^y|0,_e|0,re|0)|0,b=Q()|0,g=h[at+(y<<2)>>2]|0;e:do if(g|0){for(;ye=g,!((h[ye>>2]|0)==(I|0)&&(h[ye+4>>2]|0)==(O|0));)if(g=pt(y|0,b|0,1,0)|0,y=rd(g|0,Q()|0,_e|0,re|0)|0,b=Q()|0,g=h[at+(y<<2)>>2]|0,!g)break e;He[M>>0]=1,He[g+9>>0]=1,y=g+16|0,ye=Ot+(G<<5)+12|0,h[(h[ye>>2]|0)+16>>2]=h[y>>2],m=g+12|0,Ee=h[Ot+(G<<5)+16>>2]|0,h[Ee+12>>2]=h[m>>2],h[(h[m>>2]|0)+16>>2]=Ee,h[(h[y>>2]|0)+12>>2]=h[ye>>2],y=zb(E)|0,ye=zb(g)|0,g=y+24|0,m=h[g+4>>2]|0,Ee=ye+24|0,Ze=h[Ee+4>>2]|0,Ee=(m|0)<(Ze|0)|((m|0)==(Ze|0)?(h[g>>2]|0)>>>0<(h[Ee>>2]|0)>>>0:0),g=Ee?y:ye,y=Ee?ye:y,(y|0)!=(g|0)&&(Ze=g+24|0,ye=y+24|0,Ee=ye,Ze=pt(h[Ee>>2]|0,h[Ee+4>>2]|0,h[Ze>>2]|0,h[Ze+4>>2]|0)|0,Ee=Q()|0,h[ye>>2]=Ze,h[ye+4>>2]=Ee,h[g+20>>2]=y)}while(!1)}G=pt(G|0,q|0,1,0)|0,q=Q()|0}while((q|0)<(be|0)|(q|0)==(be|0)&G>>>0<me>>>0);(We|0)==39&&li(27634,26956,258,27001),g=0,y=0;do He[Ot+(g<<5)+8>>0]=0,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(be|0)|(y|0)==(be|0)&g>>>0<me>>>0);for(I=0,b=0,M=0,O=0;;){if(g=Ot+(I<<5)|0,(He[Ot+(I<<5)+8>>0]|0)==0&&(He[Ot+(I<<5)+9>>0]|0)==0){E=g,y=h[E>>2]|0,E=h[E+4>>2]|0;do He[g+8>>0]=1,g=h[g+12>>2]|0,ye=g;while(!((h[ye>>2]|0)==(y|0)&&(h[ye+4>>2]|0)==(E|0)));b=pt(b|0,M|0,1,0)|0,E=Q()|0}else E=M;if(I=pt(I|0,O|0,1,0)|0,O=Q()|0,(O|0)<(be|0)|(O|0)==(be|0)&I>>>0<me>>>0)M=E;else break}g=0,y=0;do He[Ot+(g<<5)+8>>0]=0,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(be|0)|(y|0)==(be|0)&g>>>0<me>>>0);Ee=b,Ze=E,g=1}else Ee=0,Ze=0,g=0;ye=ar(Ee*24|0)|0;e:do if(ye|0){t:do if(g){d=0,_e=0,m=0,A=0;n:for(;;){if(g=Ot+(d<<5)|0,(He[Ot+(d<<5)+8>>0]|0)==0&&(He[Ot+(d<<5)+9>>0]|0)==0){ue=g,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,y=0,b=0;do y=pt(y|0,b|0,2,0)|0,b=Q()|0,g=h[g+12>>2]|0,re=g;while(!((h[re>>2]|0)==(oe|0)&&(h[re+4>>2]|0)==(ue|0)));if($=ar(y<<4)|0,!$)break;y=oe,b=ue,W=0,q=0,E=0,M=0;do{if(ex(y,b,Fe)|0){We=69;break n}if(re=h[Fe>>2]|0,O=re+-1|0,G=((O|0)<0)<<31>>31,(re|0)>1){b=E,I=0,y=M,E=0;do re=$+(b<<4)|0,M=Fe+8+(I<<4)|0,h[re>>2]=h[M>>2],h[re+4>>2]=h[M+4>>2],h[re+8>>2]=h[M+8>>2],h[re+12>>2]=h[M+12>>2],b=pt(b|0,y|0,1,0)|0,y=Q()|0,I=pt(I|0,E|0,1,0)|0,E=Q()|0;while((E|0)<(G|0)|(E|0)==(G|0)&I>>>0<O>>>0);E=b,M=y}W=pt(W|0,q|0,O|0,G|0)|0,q=Q()|0,He[g+8>>0]=1,g=h[g+12>>2]|0,b=g,y=h[b>>2]|0,b=h[b+4>>2]|0}while(!((y|0)==(oe|0)&(b|0)==(ue|0)));if(y=fse($,W<<4)|0,!y){We=75;break}ue=zb(g)|0,re=h[ue+4>>2]|0,g=ye+(m*24|0)|0,h[g>>2]=h[ue>>2],h[g+4>>2]=re,g=ye+(m*24|0)+16|0,h[g>>2]=W,h[ye+(m*24|0)+20>>2]=y,h[At>>2]=h[g>>2],h[At+4>>2]=h[g+4>>2],Ol(At,ye+(m*24|0)+8|0)|0,y=pt(m|0,_e|0,1,0)|0,g=Q()|0}else y=m,g=_e;if(d=pt(d|0,A|0,1,0)|0,A=Q()|0,(A|0)<(be|0)|(A|0)==(be|0)&d>>>0<me>>>0)_e=g,m=y;else break t}if((We|0)==69?li(27634,26956,351,27016):(We|0)==75&&_t($),(_e|0)>0|(_e|0)==0&m>>>0>0)for(E=0,M=0,g=m,b=_e;y=h[ye+(E*24|0)+20>>2]|0,y?(_t(y),y=_e,g=m):y=b,E=pt(E|0,M|0,1,0)|0,M=Q()|0,(M|0)<(y|0)|(M|0)==(y|0)&E>>>0<g>>>0;)b=y;_t(ye);break e}while(!1);jb(ye,Ee,24,2);t:do if((Ee|0)==0&(Ze|0)==0){if(re=ar(192)|0,re|0){if(h[re+16>>2]=0,h[re+20>>2]=0,q=re+8|0,h[q>>2]=3,g=ar(48)|0,W=re+12|0,h[W>>2]=g,g|0){h[g>>2]=h[3860],h[g+4>>2]=h[3861],h[g+8>>2]=h[3862],h[g+12>>2]=h[3863],G=g+16|0,h[G>>2]=h[3864],h[G+4>>2]=h[3865],h[G+8>>2]=h[3866],h[G+12>>2]=h[3867],G=g+32|0,h[G>>2]=h[3868],h[G+4>>2]=h[3869],h[G+8>>2]=h[3870],h[G+12>>2]=h[3871],h[At>>2]=h[q>>2],h[At+4>>2]=h[q+4>>2],Ol(At,re)|0,h[re+40>>2]=0,h[re+44>>2]=0,G=re+32|0,h[G>>2]=3,g=ar(48)|0,$=re+36|0,h[$>>2]=g;do if(!g)E=0,M=1;else{if(h[g>>2]=h[3872],h[g+4>>2]=h[3873],h[g+8>>2]=h[3874],h[g+12>>2]=h[3875],O=g+16|0,h[O>>2]=h[3876],h[O+4>>2]=h[3877],h[O+8>>2]=h[3878],h[O+12>>2]=h[3879],O=g+32|0,h[O>>2]=h[3880],h[O+4>>2]=h[3881],h[O+8>>2]=h[3882],h[O+12>>2]=h[3883],h[At>>2]=h[G>>2],h[At+4>>2]=h[G+4>>2],Ol(At,re+24|0)|0,h[re+64>>2]=0,h[re+68>>2]=0,O=re+56|0,h[O>>2]=3,g=ar(48)|0,oe=re+60|0,h[oe>>2]=g,!g){E=0,M=2;break}if(h[g>>2]=h[3884],h[g+4>>2]=h[3885],h[g+8>>2]=h[3886],h[g+12>>2]=h[3887],I=g+16|0,h[I>>2]=h[3888],h[I+4>>2]=h[3889],h[I+8>>2]=h[3890],h[I+12>>2]=h[3891],I=g+32|0,h[I>>2]=h[3892],h[I+4>>2]=h[3893],h[I+8>>2]=h[3894],h[I+12>>2]=h[3895],h[At>>2]=h[O>>2],h[At+4>>2]=h[O+4>>2],Ol(At,re+48|0)|0,h[re+88>>2]=0,h[re+92>>2]=0,I=re+80|0,h[I>>2]=3,g=ar(48)|0,ue=re+84|0,h[ue>>2]=g,!g){E=0,M=3;break}if(h[g>>2]=h[3896],h[g+4>>2]=h[3897],h[g+8>>2]=h[3898],h[g+12>>2]=h[3899],M=g+16|0,h[M>>2]=h[3900],h[M+4>>2]=h[3901],h[M+8>>2]=h[3902],h[M+12>>2]=h[3903],M=g+32|0,h[M>>2]=h[3904],h[M+4>>2]=h[3905],h[M+8>>2]=h[3906],h[M+12>>2]=h[3907],h[At>>2]=h[I>>2],h[At+4>>2]=h[I+4>>2],Ol(At,re+72|0)|0,h[re+112>>2]=0,h[re+116>>2]=0,M=re+104|0,h[M>>2]=3,g=ar(48)|0,d=re+108|0,h[d>>2]=g,!g){E=0,M=4;break}if(h[g>>2]=h[3908],h[g+4>>2]=h[3909],h[g+8>>2]=h[3910],h[g+12>>2]=h[3911],E=g+16|0,h[E>>2]=h[3912],h[E+4>>2]=h[3913],h[E+8>>2]=h[3914],h[E+12>>2]=h[3915],E=g+32|0,h[E>>2]=h[3916],h[E+4>>2]=h[3917],h[E+8>>2]=h[3918],h[E+12>>2]=h[3919],h[At>>2]=h[M>>2],h[At+4>>2]=h[M+4>>2],Ol(At,re+96|0)|0,h[re+136>>2]=0,h[re+140>>2]=0,E=re+128|0,h[E>>2]=3,g=ar(48)|0,A=re+132|0,h[A>>2]=g,!g){E=0,M=5;break}if(h[g>>2]=h[3920],h[g+4>>2]=h[3921],h[g+8>>2]=h[3922],h[g+12>>2]=h[3923],b=g+16|0,h[b>>2]=h[3924],h[b+4>>2]=h[3925],h[b+8>>2]=h[3926],h[b+12>>2]=h[3927],b=g+32|0,h[b>>2]=h[3928],h[b+4>>2]=h[3929],h[b+8>>2]=h[3930],h[b+12>>2]=h[3931],h[At>>2]=h[E>>2],h[At+4>>2]=h[E+4>>2],Ol(At,re+120|0)|0,h[re+160>>2]=0,h[re+164>>2]=0,b=re+152|0,h[b>>2]=3,g=ar(48)|0,m=re+156|0,h[m>>2]=g,!g){E=0,M=6;break}if(h[g>>2]=h[3932],h[g+4>>2]=h[3933],h[g+8>>2]=h[3934],h[g+12>>2]=h[3935],y=g+16|0,h[y>>2]=h[3936],h[y+4>>2]=h[3937],h[y+8>>2]=h[3938],h[y+12>>2]=h[3939],y=g+32|0,h[y>>2]=h[3940],h[y+4>>2]=h[3941],h[y+8>>2]=h[3942],h[y+12>>2]=h[3943],h[At>>2]=h[b>>2],h[At+4>>2]=h[b+4>>2],Ol(At,re+144|0)|0,h[re+184>>2]=0,h[re+188>>2]=0,y=re+176|0,h[y>>2]=3,g=ar(48)|0,_e=re+180|0,h[_e>>2]=g,!g){E=0,M=7;break}if(h[g>>2]=h[3944],h[g+4>>2]=h[3945],h[g+8>>2]=h[3946],h[g+12>>2]=h[3947],Fe=g+16|0,h[Fe>>2]=h[3948],h[Fe+4>>2]=h[3949],h[Fe+8>>2]=h[3950],h[Fe+12>>2]=h[3951],g=g+32|0,h[g>>2]=h[3952],h[g+4>>2]=h[3953],h[g+8>>2]=h[3954],h[g+12>>2]=h[3955],h[At>>2]=h[y>>2],h[At+4>>2]=h[y+4>>2],Ol(At,re+168|0)|0,jb(re,8,24,3),g=ar(128)|0,h[_+4>>2]=g,g|0){h[_>>2]=8,h[g>>2]=h[q>>2],h[g+4>>2]=h[q+4>>2],h[g+8>>2]=h[q+8>>2],h[g+12>>2]=h[q+12>>2],We=g+16|0,h[We>>2]=h[G>>2],h[We+4>>2]=h[G+4>>2],h[We+8>>2]=h[G+8>>2],h[We+12>>2]=h[G+12>>2],We=g+32|0,h[We>>2]=h[O>>2],h[We+4>>2]=h[O+4>>2],h[We+8>>2]=h[O+8>>2],h[We+12>>2]=h[O+12>>2],We=g+48|0,h[We>>2]=h[I>>2],h[We+4>>2]=h[I+4>>2],h[We+8>>2]=h[I+8>>2],h[We+12>>2]=h[I+12>>2],We=g+64|0,h[We>>2]=h[M>>2],h[We+4>>2]=h[M+4>>2],h[We+8>>2]=h[M+8>>2],h[We+12>>2]=h[M+12>>2],We=g+80|0,h[We>>2]=h[E>>2],h[We+4>>2]=h[E+4>>2],h[We+8>>2]=h[E+8>>2],h[We+12>>2]=h[E+12>>2],We=g+96|0,h[We>>2]=h[b>>2],h[We+4>>2]=h[b+4>>2],h[We+8>>2]=h[b+8>>2],h[We+12>>2]=h[b+12>>2],We=g+112|0,h[We>>2]=h[y>>2],h[We+4>>2]=h[y+4>>2],h[We+8>>2]=h[y+8>>2],h[We+12>>2]=h[y+12>>2],_t(re),We=158;break t}g=h[W>>2]|0,g|0&&_t(g),g=h[$>>2]|0,g|0&&_t(g),g=h[oe>>2]|0,g|0&&_t(g),g=h[ue>>2]|0,g|0&&_t(g),g=h[d>>2]|0,g|0&&_t(g),g=h[A>>2]|0,g|0&&_t(g),g=h[m>>2]|0,g|0&&_t(g),g=h[_e>>2]|0,g|0&&_t(g),_t(re);break t}while(!1);g=0,b=0;do y=h[re+(g*24|0)+12>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&g>>>0<M>>>0)}_t(re),We=152}}else{if((Ze|0)>0|(Ze|0)==0&Ee>>>0>0){b=0,E=0,M=0,y=0,g=0,I=0;do Fe=ye+(b*24|0)|0,At=E,E=h[Fe>>2]|0,We=M,M=h[Fe+4>>2]|0,y=pt(y|0,g|0,((E|0)!=(At|0)|(M|0)!=(We|0))&1|0,0)|0,g=Q()|0,b=pt(b|0,I|0,1,0)|0,I=Q()|0;while((I|0)<(Ze|0)|(I|0)==(Ze|0)&b>>>0<Ee>>>0);ue=y,oe=g}else ue=0,oe=0;if(d=ar(ue*24|0)|0,d){n:do if((Ze|0)>=0){for(q=0,W=0,y=0,b=0,$=0,E=0;;){if(!((q|0)==(Ee|0)&(W|0)==(Ze|0))&&(At=ye+(y*24|0)|0,We=ye+(q*24|0)|0,(h[At>>2]|0)==(h[We>>2]|0)?(h[At+4>>2]|0)==(h[We+4>>2]|0):0))g=$;else{if(O=ye+(y*24|0)|0,We=Ns(q|0,W|0,y|0,b|0)|0,At=Q()|0,G=pt(We|0,At|0,-1,-1)|0,b=Q()|0,(At|0)>0|(At|0)==0&We>>>0>1){if(g=ar(G<<3)|0,!g)break;M=0,I=0;do We=M,M=pt(M|0,I|0,1,0)|0,I=Q()|0,Fe=O+(M*24|0)+16|0,At=h[Fe+4>>2]|0,We=g+(We<<3)|0,h[We>>2]=h[Fe>>2],h[We+4>>2]=At;while((I|0)<(b|0)|(I|0)==(b|0)&M>>>0<G>>>0)}else g=0;At=ye+(y*24|0)+16|0,We=h[At+4>>2]|0,b=d+(E*24|0)+8|0,h[b>>2]=h[At>>2],h[b+4>>2]=We,h[d+(E*24|0)+16>>2]=G,h[d+(E*24|0)+20>>2]=g,ne[d+(E*24|0)>>3]=+ne[ye+(y*24|0)+8>>3],E=pt(E|0,$|0,1,0)|0,y=q,b=W,g=Q()|0}if(We=q,q=pt(q|0,W|0,1,0)|0,At=W,W=Q()|0,(At|0)<(Ze|0)|(At|0)==(Ze|0)&We>>>0<Ee>>>0)$=g;else break n}if(($|0)>0|($|0)==0&E>>>0>0){g=0,b=0;do y=h[d+(g*24|0)+20>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while((b|0)<($|0)|(b|0)==($|0)&g>>>0<E>>>0)}_t(d),We=152;break t}while(!1);if(jb(d,ue,24,3),g=ar(ue<<4)|0,b=_+4|0,h[b>>2]=g,g){h[_>>2]=ue;do if((oe|0)>0|(oe|0)==0&ue>>>0>0){if(_=d+8|0,h[g>>2]=h[_>>2],h[g+4>>2]=h[_+4>>2],h[g+8>>2]=h[_+8>>2],h[g+12>>2]=h[_+12>>2],(ue|0)==1&(oe|0)==0||(_=g+16|0,We=d+32|0,h[_>>2]=h[We>>2],h[_+4>>2]=h[We+4>>2],h[_+8>>2]=h[We+8>>2],h[_+12>>2]=h[We+12>>2],!((oe|0)>0|(oe|0)==0&ue>>>0>2)))break;g=2,y=0;do _=(h[b>>2]|0)+(g<<4)|0,We=d+(g*24|0)+8|0,h[_>>2]=h[We>>2],h[_+4>>2]=h[We+4>>2],h[_+8>>2]=h[We+8>>2],h[_+12>>2]=h[We+12>>2],g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(oe|0)|(y|0)==(oe|0)&g>>>0<ue>>>0)}while(!1);_t(d),We=158;break}else{if((oe|0)>0|(oe|0)==0&ue>>>0>0){g=0,b=0;do y=h[d+(g*24|0)+20>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while((b|0)<(oe|0)|(b|0)==(oe|0)&g>>>0<ue>>>0)}_t(d),We=152;break}}else We=152}while(!1);if((We|0)==158)return _t(Ot),_t(at),_t(ye),at=0,Y=dt,at|0;if((We|0)==152&&(Ze|0)>0|(Ze|0)==0&Ee>>>0>0)for(E=0,M=0,g=Ee,b=Ze;y=h[ye+(E*24|0)+20>>2]|0,y?(_t(y),y=Ze,g=Ee):y=b,E=pt(E|0,M|0,1,0)|0,M=Q()|0,(M|0)<(y|0)|(M|0)==(y|0)&E>>>0<g>>>0;)b=y;return _t(ye),_t(Ot),_t(at),at=13,Y=dt,at|0}while(!1);return _t(Ot),_t(at),at=13,Y=dt,at|0}else if((We|0)==159)return Y=dt,g|0;return 0}function fre(d,A){d=d|0,A=A|0;var m=0,_=0;return _=d,d=h[_>>2]|0,_=h[_+4>>2]|0,m=A,A=h[m>>2]|0,m=h[m+4>>2]|0,(_>>>0<m>>>0|(_|0)==(m|0)&d>>>0<A>>>0?-1:(_>>>0>m>>>0|(_|0)==(m|0)&d>>>0>A>>>0)&1)|0}function zb(d){d=d|0;var A=0,m=0;return A=d+20|0,m=h[A>>2]|0,(m|0)==(d|0)?d|0:(m=zb(m)|0,h[A>>2]=m,m|0)}function dre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;return E=d,b=h[E>>2]|0,E=h[E+4>>2]|0,y=A,g=h[y>>2]|0,y=h[y+4>>2]|0,E>>>0<y>>>0|(E|0)==(y|0)&b>>>0<g>>>0?(A=-1,A|0):E>>>0>y>>>0|(E|0)==(y|0)&b>>>0>g>>>0?(A=1,A|0):(_=+ne[d+8>>3],m=+ne[A+8>>3],_<m?(A=-1,A|0):(A=_>m&1,A|0))}function pre(d,A){d=d|0,A=A|0;var m=0,_=0;return _=+ne[d>>3],m=+ne[A>>3],(_>m?-1:_<m&1)|0}function Are(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(G=Y,Y=Y+64|0,O=G,E=G+56|0,!(!0&(A&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return g=5,Y=G,g|0;if((d|0)==(m|0)&(A|0)==(_|0))return h[g>>2]=0,g=0,Y=G,g|0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,I=et(m|0,_|0,52)|0,Q()|0,(b|0)!=(I&15|0))return g=12,Y=G,g|0;if(y=b+-1|0,b>>>0>1){A4(d,A,y,O)|0,A4(m,_,y,E)|0,I=O,M=h[I>>2]|0,I=h[I+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(I|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,y=et(d|0,A|0,b|0)|0,Q()|0,y=y&7,b=et(m|0,_|0,b|0)|0,Q()|0,b=b&7;do if((y|0)==0|(b|0)==0)h[g>>2]=1,y=0;else if((y|0)==7)y=5;else{if((y|0)==1|(b|0)==1&&Ui(M,I)|0){y=5;break}if((h[15824+(y<<2)>>2]|0)!=(b|0)&&(h[15856+(y<<2)>>2]|0)!=(b|0))break e;h[g>>2]=1,y=0}while(!1);return g=y,Y=G,g|0}while(!1)}y=O,b=y+56|0;do h[y>>2]=0,y=y+4|0;while((y|0)<(b|0));return $k(d,A,1,O)|0,A=O,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0))&&(A=O+8|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+16|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+24|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+32|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+40|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))?(y=O+48|0,y=((h[y>>2]|0)==(m|0)?(h[y+4>>2]|0)==(_|0):0)&1):y=1,h[g>>2]=y,g=0,Y=G,g|0}function mre(d,A,m,_,g){return d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,m=Gb(d,A,m,_)|0,(m|0)==7?(g=11,g|0):(_=ht(m|0,0,56)|0,A=A&-2130706433|(Q()|0)|268435456,h[g>>2]=d|_,h[g+4>>2]=A,g=0,g|0)}function gre(d,A,m){return d=d|0,A=A|0,m=m|0,!0&(A&2013265920|0)==268435456?(h[m>>2]=d,h[m+4>>2]=A&-2130706433|134217728,m=0,m|0):(m=6,m|0)}function _re(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return g=Y,Y=Y+16|0,_=g,h[_>>2]=0,!0&(A&2013265920|0)==268435456?(y=et(d|0,A|0,56)|0,Q()|0,_=Is(d,A&-2130706433|134217728,y&7,_,m)|0,Y=g,_|0):(_=6,Y=g,_|0)}function s9(d,A){d=d|0,A=A|0;var m=0;switch(m=et(d|0,A|0,56)|0,Q()|0,m&7){case 0:case 7:return m=0,m|0;default:}return m=A&-2130706433|134217728,!(!0&(A&2013265920|0)==268435456)||!0&(A&117440512|0)==16777216&(Ui(d,m)|0)!=0?(m=0,m|0):(m=Vb(d,m)|0,m|0)}function xre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return g=Y,Y=Y+16|0,_=g,!0&(A&2013265920|0)==268435456?(y=A&-2130706433|134217728,b=m,h[b>>2]=d,h[b+4>>2]=y,h[_>>2]=0,A=et(d|0,A|0,56)|0,Q()|0,_=Is(d,y,A&7,_,m+8|0)|0,Y=g,_|0):(_=6,Y=g,_|0)}function u4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0;return g=(Ui(d,A)|0)==0,A=A&-2130706433,_=m,h[_>>2]=g?d:0,h[_+4>>2]=g?A|285212672:0,_=m+8|0,h[_>>2]=d,h[_+4>>2]=A|301989888,_=m+16|0,h[_>>2]=d,h[_+4>>2]=A|318767104,_=m+24|0,h[_>>2]=d,h[_+4>>2]=A|335544320,_=m+32|0,h[_>>2]=d,h[_+4>>2]=A|352321536,m=m+40|0,h[m>>2]=d,h[m+4>>2]=A|369098752,0}function ex(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+16|0,g=b,y=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(_=et(d|0,A|0,56)|0,Q()|0,_=cse(d,y,_&7)|0,(_|0)==-1?(h[m>>2]=0,y=6,Y=b,y|0):(Km(d,y,g)|0&&li(27634,27035,282,27050),A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Ui(d,y)|0?h4(g,A,_,2,m):f4(g,A,_,2,m),y=0,Y=b,y|0)):(y=6,Y=b,y|0)}function o9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+16|0,_=b+8|0,g=b,y=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(h[_>>2]=0,A=et(d|0,A|0,56)|0,Q()|0,A=Is(d,y,A&7,_,g)|0,A|0?(m=A,Y=b,m|0):(_=h[g>>2]|0,g=h[g+4>>2]|0,A=Gb(_,g,d,y)|0,(A|0)==7?(m=11,Y=b,m|0):(d=ht(A|0,0,56)|0,y=g&-2130706433|(Q()|0)|268435456,h[m>>2]=_|d,h[m+4>>2]=y,m=0,Y=b,m|0))):(m=6,Y=b,m|0)}function yre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0;h[m>>2]=0,I=+ne[d>>3],O=+ne[d+8>>3],M=+ne[d+16>>3],g=0,y=5,_=5,d=0;do oe=+ne[15888+(g*24|0)>>3]-I,$=+ne[15888+(g*24|0)+8>>3]-O,b=+ne[15888+(g*24|0)+16>>3]-M,b=oe*oe+$*$+b*b,b<_&&(h[m>>2]=g,y=b,d=g,_=b),g=g+1|0;while((g|0)!=20);if(y=+Lie(+(1-y*.5)),y<1e-16)M=0,b=0;else{if(me=+ne[16368+(d*24|0)>>3],re=+ne[15888+(d*24|0)>>3],be=+ne[15888+(d*24|0)+8>>3],_e=+ne[15888+(d*24|0)+16>>3],Fe=-(_e+(re*0+be*0)),b=re*Fe+0,oe=be*Fe+0,Fe=_e*Fe+1,ue=+ns(+(Fe*Fe+(b*b+oe*oe))),ue=ue>0?1/ue:0,b=b*ue,oe=oe*ue,ue=Fe*ue,Fe=-(I*re+O*be+M*_e),$=I+re*Fe,_=O+be*Fe,I=M+_e*Fe,O=+ns(+(I*I+($*$+_*_))),O=O>0?1/O:0,$=$*O,_=_*O,O=I*O,_=+ix(me-+ix(+na(+(O*(be*b-re*oe)+($*(_e*oe-be*ue)+_*(re*ue-_e*b))),+(ue*O+(b*$+oe*_))))),Bl(A)|0?b=+ix(_+-.3334731722518321):b=_,_=+kb(+y)*2.618033988749896,(A|0)>0){d=0;do _=_*2.6457513110645907,d=d+1|0;while((d|0)!=(A|0))}M=+Qn(+b)*_,b=+Ii(+b)*_}A=m+4|0,W=m+12|0,h[W>>2]=0,y=+Ps(+b)*1.1547005383792515,_=+Ps(+M)+y*.5,d=~~_,g=~~y,_=_-+(d|0),y=y-+(g|0);do if(_<.5)if(_<.3333333333333333)if(h[A>>2]=d,y<(_+1)*.5){h[m+8>>2]=g;break}else{g=g+1|0,h[m+8>>2]=g;break}else if(Fe=1-_,g=(!(y<Fe)&1)+g|0,h[m+8>>2]=g,Fe<=y&y<_*2){d=d+1|0,h[A>>2]=d;break}else{h[A>>2]=d;break}else{if(!(_<.6666666666666666))if(d=d+1|0,h[A>>2]=d,y<_*.5){h[m+8>>2]=g;break}else{g=g+1|0,h[m+8>>2]=g;break}if(y<1-_){if(h[m+8>>2]=g,_*2+-1<y){h[A>>2]=d;break}}else g=g+1|0,h[m+8>>2]=g;d=d+1|0,h[A>>2]=d}while(!1);do if(M<0)if(g&1){q=(g+1|0)/2|0,q=Ns(d|0,((d|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,d=~~(+(d|0)-((+(q>>>0)+4294967296*+(Q()|0))*2+1)),h[A>>2]=d,q=A;break}else{q=(g|0)/2|0,q=Ns(d|0,((d|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,d=~~(+(d|0)-(+(q>>>0)+4294967296*+(Q()|0))*2),h[A>>2]=d,q=A;break}else q=A;while(!1);G=m+8|0,A=0-g|0,b<0?(m=d-((g<<1|1|0)/2|0)|0,h[q>>2]=m,h[G>>2]=A,g=A):m=d,d=g-m|0,A=0-m|0,(m|0)<0?(h[G>>2]=d,h[W>>2]=A,h[q>>2]=0,E=0):(d=g,E=m,A=0),m=E-d|0,g=A-d|0,(d|0)<0?(h[q>>2]=m,h[W>>2]=g,h[G>>2]=0,E=m,d=0):g=A,m=E-g|0,A=d-g|0,(g|0)<0?(h[q>>2]=m,h[G>>2]=A,h[W>>2]=0,g=0):(A=d,m=E),d=(A|0)<(m|0)?A:m,d=(g|0)<(d|0)?g:d,!((d|0)<=0)&&(h[q>>2]=m-d,h[G>>2]=A-d,h[W>>2]=g-d)}function vre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;_=Y,Y=Y+16|0,g=_,b=h[d+12>>2]|0,y=+((h[d+8>>2]|0)-b|0),ne[g>>3]=+((h[d+4>>2]|0)-b|0)-y*.5,ne[g+8>>3]=y*.8660254037844386,tx(g,h[d>>2]|0,A,0,m),Y=_}function tx(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;if(y=+lse(d),y<1e-16){A=15888+(A*24|0)|0,h[g>>2]=h[A>>2],h[g+4>>2]=h[A+4>>2],h[g+8>>2]=h[A+8>>2],h[g+12>>2]=h[A+12>>2],h[g+16>>2]=h[A+16>>2],h[g+20>>2]=h[A+20>>2];return}if(b=+na(+ +ne[d+8>>3],+ +ne[d>>3]),(m|0)>0){d=0;do y=y*.37796447300922725,d=d+1|0;while((d|0)!=(m|0))}E=y*.3333333333333333,_?(m=(Bl(m)|0)==0,y=+jk(+((m?E:E*.37796447300922725)*.381966011250105))):(y=+jk(+(y*.381966011250105)),Bl(m)|0&&(b=+ix(b+.3334731722518321))),G=+ix(+ne[16368+(A*24|0)>>3]-b),E=+ne[15888+(A*24|0)>>3],O=+ne[15888+(A*24|0)+8>>3],oe=+ne[15888+(A*24|0)+16>>3],W=-(oe+(E*0+O*0)),I=E*W+0,b=O*W+0,W=oe*W+1,q=+ns(+(W*W+(I*I+b*b))),q=q>0?1/q:0,I=I*q,b=b*q,q=W*q,W=+Qn(+G),G=+Ii(+G),ue=+Qn(+y),$=+Ii(+y),M=ue*E+$*(W*I+G*(oe*b-O*q)),y=ue*O+$*(W*b+G*(E*q-oe*I)),b=ue*oe+$*(W*q+G*(O*I-E*b)),E=+ns(+(b*b+(M*M+y*y))),E=E>0?1/E:0,ne[g>>3]=M*E,ne[g+8>>3]=y*E,ne[g+16>>3]=b*E}function h4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,mi=0,oo=0,Bn=0,gi=0,ra=0,ds=0,zr=0,ps=0,is=0,Oa=0,Ws=0,js=0,kl=0,ao=0,wi=0,M0=0;if(Oa=Y,Y=Y+256|0,y=Oa+240|0,ci=Oa+224|0,zr=Oa,ps=Oa+208|0,is=Oa+192|0,mi=Oa+168|0,oo=Oa+152|0,Bn=Oa+136|0,gi=Oa+120|0,ra=Oa+104|0,ds=Oa+80|0,h[y>>2]=A,h[ci>>2]=h[d>>2],h[ci+4>>2]=h[d+4>>2],h[ci+8>>2]=h[d+8>>2],h[ci+12>>2]=h[d+12>>2],a9(ci,y,zr),h[g>>2]=0,ci=_+m+((_|0)==5&1)|0,(ci|0)<=(m|0)){Y=Oa;return}me=h[y>>2]|0,be=ps+4|0,_e=ps+8|0,re=ps+12|0,Fe=is+8|0,Ze=m+5|0,Ee=16848+(me<<2)|0,ye=mi+8|0,At=16928+(me<<2)|0,We=oo+8|0,Ot=Bn+8|0,at=gi+8|0,dt=is+8|0,W=mi+8|0,oe=mi+16|0,$=ds+8|0,ue=ds+16|0,q=m,_=0,b=0,E=0,M=0;e:for(;;){G=zr+(((q|0)%5|0)<<4)|0,h[ps>>2]=h[G>>2],h[ps+4>>2]=h[G+4>>2],h[ps+8>>2]=h[G+8>>2],h[ps+12>>2]=h[G+12>>2];do;while((Zm(ps,me,0,1)|0)==2);if((q|0)>(m|0)&(Bl(A)|0)!=0){if(G=h[ps>>2]|0,d=h[be>>2]|0,I=h[_e>>2]|0,y=h[re>>2]|0,Ws=+(E-M|0),ne[is>>3]=+(b-M|0)-Ws*.5,ne[Fe>>3]=Ws*.8660254037844386,M=h[17008+(G*80|0)+(_<<2)>>2]|0,O=h[18608+(G*80|0)+(M*20|0)>>2]|0,E=h[18608+(G*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=I;do ao=y+d|0,wi=(ao|0)<0,I=_+d-(wi?ao:0)|0,kl=(I|0)<0,js=y+_-(wi?ao:0)-(kl?I:0)|0,y=(js|0)<0,d=(wi?0:ao)-(kl?I:0)-(y?js:0)|0,_=(kl?0:I)-(y?js:0)|0,js=y?0:js,y=(_|0)<(d|0)?_:d,y=(js|0)<(y|0)?js:y,I=(y|0)>0,d=d-(I?y:0)|0,_=_-(I?y:0)|0,y=js-(I?y:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=I;switch(wi=(h[Ee>>2]|0)*3|0,js=(Da(wi,h[18608+(G*80|0)+(M*20|0)+4>>2]|0)|0)+d|0,I=(Da(wi,h[18608+(G*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,wi=(Da(wi,h[18608+(G*80|0)+(M*20|0)+12>>2]|0)|0)+y|0,M=(js|0)<0,I=I-(M?js:0)|0,kl=(I|0)<0,wi=wi+(M?0-js|0:0)+(kl?0-I|0:0)|0,ao=(wi|0)<0,js=(M?0:js)-(kl?I:0)-(ao?wi:0)|0,I=(kl?0:I)-(ao?wi:0)|0,wi=ao?0:wi,ao=(I|0)<(js|0)?I:js,ao=(wi|0)<(ao|0)?wi:ao,kl=(ao|0)>0,wi=wi-(kl?ao:0)|0,Ws=+(I-(kl?ao:0)-wi|0),ne[mi>>3]=+(js-(kl?ao:0)-wi|0)-Ws*.5,ne[ye>>3]=Ws*.8660254037844386,Ws=+(h[At>>2]|0),ne[oo>>3]=Ws*3,ne[We>>3]=0,M0=Ws*-1.5,ne[Bn>>3]=M0,ne[Ot>>3]=Ws*2.598076211353316,ne[gi>>3]=M0,ne[at>>3]=Ws*-2.598076211353316,h[17008+(O*80|0)+(G<<2)>>2]|0){case 1:{d=Bn,_=oo;break}case 3:{d=gi,_=Bn;break}case 2:{d=oo,_=gi;break}default:{d=12;break e}}v9(is,mi,_,d,ra),tx(ra,O,me,1,ds),wi=h[g>>2]|0,Ws=+J1(+ +ne[ue>>3]),M0=+na(+ +ne[$>>3],+ +ne[ds>>3]),ne[g+8+(wi<<4)>>3]=Ws,ne[g+8+(wi<<4)+8>>3]=M0,h[g>>2]=(h[g>>2]|0)+1}if((q|0)<(Ze|0)&&(wi=h[re>>2]|0,Ws=+((h[_e>>2]|0)-wi|0),ne[is>>3]=+((h[be>>2]|0)-wi|0)-Ws*.5,ne[dt>>3]=Ws*.8660254037844386,tx(is,h[ps>>2]|0,me,1,mi),wi=h[g>>2]|0,Ws=+J1(+ +ne[oe>>3]),M0=+na(+ +ne[W>>3],+ +ne[mi>>3]),ne[g+8+(wi<<4)>>3]=Ws,ne[g+8+(wi<<4)+8>>3]=M0,h[g>>2]=(h[g>>2]|0)+1),q=q+1|0,(q|0)>=(ci|0)){d=3;break}else _=h[ps>>2]|0,b=h[be>>2]|0,E=h[_e>>2]|0,M=h[re>>2]|0}if((d|0)==3){Y=Oa;return}else(d|0)==12&&li(27073,27120,599,27130)}function a9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;$=Y,Y=Y+128|0,_=$+64|0,g=$,y=_,b=20208,E=y+60|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));y=g,b=20272,E=y+60|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));if(O=(Bl(h[A>>2]|0)|0)==0,O=O?_:g,W=d+4|0,y=h[W>>2]|0,G=d+8|0,_=h[G>>2]|0,q=d+12|0,g=h[q>>2]|0,b=_+(y<<1)|0,h[W>>2]=b,_=g+(_<<1)|0,h[G>>2]=_,y=(g<<1)+y|0,h[q>>2]=y,g=_-b|0,E=y-b|0,(b|0)<0&&(h[G>>2]=g,h[q>>2]=E,h[W>>2]=0,_=g,b=0,y=E),E=b-_|0,g=y-_|0,(_|0)<0?(h[W>>2]=E,h[q>>2]=g,h[G>>2]=0,_=0):(g=y,E=b),b=E-g|0,y=_-g|0,(g|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(g=g-_|0,y=y-_|0,b=b-_|0,h[W>>2]=b,h[G>>2]=y,h[q>>2]=g),M=(y<<1)+b|0,E=g+(b<<1)|0,h[W>>2]=E,h[G>>2]=M,y=(g<<1)+y|0,h[q>>2]=y,_=M-E|0,g=y-E|0,(E|0)<0?(h[G>>2]=_,h[q>>2]=g,h[W>>2]=0,E=0,y=g):_=M,b=E-_|0,g=y-_|0,(_|0)<0?(h[W>>2]=b,h[q>>2]=g,h[G>>2]=0,E=b,_=0):g=y,b=E-g|0,y=_-g|0,(g|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[W>>2]=b-_,h[G>>2]=y-_,h[q>>2]=g-_),Bl(h[A>>2]|0)|0&&(y=h[W>>2]|0,b=h[G>>2]|0,g=h[q>>2]|0,_=(b*3|0)+y|0,y=g+(y*3|0)|0,h[W>>2]=y,h[G>>2]=_,b=(g*3|0)+b|0,h[q>>2]=b,g=_-y|0,E=b-y|0,(y|0)<0?(h[G>>2]=g,h[q>>2]=E,h[W>>2]=0,_=g,M=0):(M=y,E=b),y=M-_|0,g=E-_|0,(_|0)<0?(h[W>>2]=y,h[q>>2]=g,h[G>>2]=0,M=y,b=0):(b=_,g=E),y=M-g|0,_=b-g|0,(g|0)<0?(h[W>>2]=y,h[G>>2]=_,h[q>>2]=0,b=_,g=0):y=M,_=(b|0)<(y|0)?b:y,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[W>>2]=y-_,h[G>>2]=b-_,h[q>>2]=g-_),h[A>>2]=(h[A>>2]|0)+1),h[m>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+4>>2]|0,I=h[O+8>>2]|0,b=(h[O>>2]|0)+(h[W>>2]|0)|0,M=m+4|0,h[M>>2]=b,g=A+g|0,A=m+8|0,h[A>>2]=g,_=I+_|0,I=m+12|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+16>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+16>>2]|0,I=h[O+20>>2]|0,b=(h[O+12>>2]|0)+(h[W>>2]|0)|0,M=m+20|0,h[M>>2]=b,g=A+g|0,A=m+24|0,h[A>>2]=g,_=I+_|0,I=m+28|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+32>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+28>>2]|0,I=h[O+32>>2]|0,b=(h[O+24>>2]|0)+(h[W>>2]|0)|0,M=m+36|0,h[M>>2]=b,g=A+g|0,A=m+40|0,h[A>>2]=g,_=I+_|0,I=m+44|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+48>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+40>>2]|0,I=h[O+44>>2]|0,b=(h[O+36>>2]|0)+(h[W>>2]|0)|0,M=m+52|0,h[M>>2]=b,g=A+g|0,A=m+56|0,h[A>>2]=g,_=I+_|0,I=m+60|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+64>>2]=h[d>>2],y=h[G>>2]|0,_=h[q>>2]|0,I=h[O+52>>2]|0,M=h[O+56>>2]|0,b=(h[O+48>>2]|0)+(h[W>>2]|0)|0,A=m+68|0,h[A>>2]=b,y=I+y|0,I=m+72|0,h[I>>2]=y,_=M+_|0,M=m+76|0,h[M>>2]=_,g=y-b|0,(b|0)<0?(_=_-b|0,h[I>>2]=g,h[M>>2]=_,h[A>>2]=0,y=0):(g=y,y=b),(g|0)<0&&(y=y-g|0,h[A>>2]=y,_=_-g|0,h[M>>2]=_,h[I>>2]=0,g=0),E=y-_|0,b=g-_|0,(_|0)<0?(h[A>>2]=E,h[I>>2]=b,h[M>>2]=0,y=E,_=0):b=g,g=(b|0)<(y|0)?b:y,g=(_|0)<(g|0)?_:g,(g|0)<=0){Y=$;return}h[A>>2]=y-g,h[I>>2]=b-g,h[M>>2]=_-g,Y=$}function Zm(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(q=h[16928+(A<<2)>>2]|0,G=(_|0)!=0,q=G?q*3|0:q,O=d+4|0,E=h[O>>2]|0,I=d+8|0,y=h[I>>2]|0,G){if(b=d+12|0,_=h[b>>2]|0,g=y+E+_|0,(g|0)==(q|0))return q=1,q|0;M=b}else M=d+12|0,g=h[M>>2]|0,_=g,g=y+E+g|0;if((g|0)<=(q|0))return q=0,q|0;do if((_|0)>0){if(g=h[d>>2]|0,(y|0)>0){g=18608+(g*80|0)+60|0,b=E;break}g=18608+(g*80|0)+40|0,m?(b=E-q|0,m=y+b|0,W=(m|0)<0,y=_+y-(W?m:0)|0,E=(y|0)<0,_=_+b-(W?m:0)-(E?y:0)|0,b=(_|0)<0,m=(W?0:m)-(E?y:0)-(b?_:0)|0,y=(E?0:y)-(b?_:0)|0,_=b?0:_,b=(y|0)<(m|0)?y:m,b=(_|0)<(b|0)?_:b,E=(b|0)>0,y=y-(E?b:0)|0,_=_-(E?b:0)|0,b=m-(E?b:0)+q|0,h[O>>2]=b,h[I>>2]=y,h[M>>2]=_):b=E}else g=18608+((h[d>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[d>>2]=h[g>>2],E=h[g+16>>2]|0,(E|0)>0){m=0;do W=_+b|0,$=(W|0)<0,_e=$?W:0,oe=y+b-_e|0,ue=(oe|0)<0,d=ue?oe:0,b=_+y-_e-d|0,y=(b|0)<0,_=y?0:b,b=y?b:0,y=(ue?0:oe)-b|0,b=($?0:W)-d-b|0,d=(y|0)<(b|0)?y:b,d=(_|0)<(d|0)?_:d,(d|0)>0&&(b=b-d|0,y=y-d|0,_=_-d|0),m=m+1|0;while((m|0)<(E|0));h[O>>2]=b,h[I>>2]=y,h[M>>2]=_}return oe=h[16848+(A<<2)>>2]|0,oe=G?oe*3|0:oe,ue=Da(oe,h[g+8>>2]|0)|0,_e=Da(oe,h[g+12>>2]|0)|0,b=(Da(oe,h[g+4>>2]|0)|0)+b|0,h[O>>2]=b,y=ue+y|0,h[I>>2]=y,_=_e+_|0,h[M>>2]=_,g=y-b|0,(b|0)<0?(_=_-b|0,h[I>>2]=g,h[M>>2]=_,h[O>>2]=0,y=0):(g=y,y=b),(g|0)<0?(d=y-g|0,h[O>>2]=d,_=_-g|0,h[M>>2]=_,h[I>>2]=0,b=0):(d=y,b=g),y=d-_|0,g=b-_|0,(_|0)<0?(h[O>>2]=y,h[I>>2]=g,h[M>>2]=0,_=0):(g=b,y=d),b=(g|0)<(y|0)?g:y,b=(_|0)<(b|0)?_:b,(b|0)>0&&(y=y-b|0,g=g-b|0,_=_-b|0,h[O>>2]=y,h[I>>2]=g,h[M>>2]=_),G?(_e=(g+y+_|0)==(q|0)?1:2,_e|0):(_e=2,_e|0)}function bre(d,A){d=d|0,A=A|0;var m=0;do m=Zm(d,A,0,1)|0;while((m|0)==2);return m|0}function f4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,mi=0,oo=0,Bn=0,gi=0,ra=0,ds=0,zr=0,ps=0,is=0;if(ds=Y,Y=Y+272|0,y=ds+256|0,b=ds+240|0,Bn=ds,gi=ds+224|0,ra=ds+208|0,We=ds+184|0,Ot=ds+168|0,at=ds+152|0,dt=ds+136|0,ci=ds+120|0,mi=ds+96|0,h[y>>2]=A,h[b>>2]=h[d>>2],h[b+4>>2]=h[d+4>>2],h[b+8>>2]=h[d+8>>2],h[b+12>>2]=h[d+12>>2],l9(b,y,Bn),h[g>>2]=0,At=_+m+((_|0)==6&1)|0,(At|0)<=(m|0)){Y=ds;return}_e=h[y>>2]|0,re=m+6|0,be=ra+8|0,me=We+8|0,Fe=16928+(_e<<2)|0,Ze=Ot+8|0,Ee=at+8|0,ye=dt+8|0,oe=h[b>>2]|0,q=gi+4|0,W=gi+8|0,$=gi+12|0,ue=ra+8|0,M=We+8|0,O=We+16|0,I=mi+8|0,G=mi+16|0,b=0,E=m,_=-1;e:for(;;){if(y=(E|0)%6|0,d=Bn+(y<<4)|0,h[gi>>2]=h[d>>2],h[gi+4>>2]=h[d+4>>2],h[gi+8>>2]=h[d+8>>2],h[gi+12>>2]=h[d+12>>2],d=b,b=Zm(gi,_e,0,1)|0,(E|0)>(m|0)&(Bl(A)|0)!=0&&(oo=h[gi>>2]|0,(d|0)!=1&(oo|0)!=(_|0))){switch(is=(y+5|0)%6|0,d=h[Bn+(is<<4)+12>>2]|0,zr=+((h[Bn+(is<<4)+8>>2]|0)-d|0),ne[ra>>3]=+((h[Bn+(is<<4)+4>>2]|0)-d|0)-zr*.5,ne[be>>3]=zr*.8660254037844386,d=h[Bn+(y<<4)+12>>2]|0,zr=+((h[Bn+(y<<4)+8>>2]|0)-d|0),ne[We>>3]=+((h[Bn+(y<<4)+4>>2]|0)-d|0)-zr*.5,ne[me>>3]=zr*.8660254037844386,zr=+(h[Fe>>2]|0),ne[Ot>>3]=zr*3,ne[Ze>>3]=0,ps=zr*-1.5,ne[at>>3]=ps,ne[Ee>>3]=zr*2.598076211353316,ne[dt>>3]=ps,ne[ye>>3]=zr*-2.598076211353316,h[17008+(oe*80|0)+(((_|0)==(oe|0)?oo:_)<<2)>>2]|0){case 1:{d=at,_=Ot;break}case 3:{d=dt,_=at;break}case 2:{d=Ot,_=dt;break}default:{d=8;break e}}v9(ra,We,_,d,ci),!(b9(ra,ci)|0)&&!(b9(We,ci)|0)&&(tx(ci,oe,_e,1,mi),is=h[g>>2]|0,zr=+J1(+ +ne[G>>3]),ps=+na(+ +ne[I>>3],+ +ne[mi>>3]),ne[g+8+(is<<4)>>3]=zr,ne[g+8+(is<<4)+8>>3]=ps,h[g>>2]=(h[g>>2]|0)+1)}if((E|0)<(re|0)&&(is=h[$>>2]|0,zr=+((h[W>>2]|0)-is|0),ne[ra>>3]=+((h[q>>2]|0)-is|0)-zr*.5,ne[ue>>3]=zr*.8660254037844386,tx(ra,h[gi>>2]|0,_e,1,We),is=h[g>>2]|0,zr=+J1(+ +ne[O>>3]),ps=+na(+ +ne[M>>3],+ +ne[We>>3]),ne[g+8+(is<<4)>>3]=zr,ne[g+8+(is<<4)+8>>3]=ps,h[g>>2]=(h[g>>2]|0)+1),E=E+1|0,(E|0)>=(At|0)){d=3;break}else _=h[gi>>2]|0}if((d|0)==3){Y=ds;return}else(d|0)==8&&li(27157,27120,766,27202)}function l9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;oe=Y,Y=Y+160|0,_=oe+80|0,g=oe,y=_,b=20336,E=y+72|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));y=g,b=20416,E=y+72|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));G=(Bl(h[A>>2]|0)|0)==0,G=G?_:g,$=d+4|0,y=h[$>>2]|0,q=d+8|0,_=h[q>>2]|0,W=d+12|0,g=h[W>>2]|0,b=_+(y<<1)|0,h[$>>2]=b,_=g+(_<<1)|0,h[q>>2]=_,y=(g<<1)+y|0,h[W>>2]=y,g=_-b|0,E=y-b|0,(b|0)<0&&(h[q>>2]=g,h[W>>2]=E,h[$>>2]=0,_=g,b=0,y=E),E=b-_|0,g=y-_|0,(_|0)<0?(h[$>>2]=E,h[W>>2]=g,h[q>>2]=0,_=0):(g=y,E=b),b=E-g|0,y=_-g|0,(g|0)<0?(h[$>>2]=b,h[q>>2]=y,h[W>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(g=g-_|0,y=y-_|0,b=b-_|0,h[$>>2]=b,h[q>>2]=y,h[W>>2]=g),M=(y<<1)+b|0,E=g+(b<<1)|0,h[$>>2]=E,h[q>>2]=M,y=(g<<1)+y|0,h[W>>2]=y,_=M-E|0,g=y-E|0,(E|0)<0?(h[q>>2]=_,h[W>>2]=g,h[$>>2]=0,E=0,y=g):_=M,b=E-_|0,g=y-_|0,(_|0)<0?(h[$>>2]=b,h[W>>2]=g,h[q>>2]=0,E=b,_=0):g=y,b=E-g|0,y=_-g|0,(g|0)<0?(h[$>>2]=b,h[q>>2]=y,h[W>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[$>>2]=b-_,h[q>>2]=y-_,h[W>>2]=g-_),Bl(h[A>>2]|0)|0&&(y=h[$>>2]|0,b=h[q>>2]|0,g=h[W>>2]|0,_=(b*3|0)+y|0,y=g+(y*3|0)|0,h[$>>2]=y,h[q>>2]=_,b=(g*3|0)+b|0,h[W>>2]=b,g=_-y|0,E=b-y|0,(y|0)<0?(h[q>>2]=g,h[W>>2]=E,h[$>>2]=0,_=g,M=0):(M=y,E=b),y=M-_|0,g=E-_|0,(_|0)<0?(h[$>>2]=y,h[W>>2]=g,h[q>>2]=0,M=y,b=0):(b=_,g=E),y=M-g|0,_=b-g|0,(g|0)<0?(h[$>>2]=y,h[q>>2]=_,h[W>>2]=0,b=_,g=0):y=M,_=(b|0)<(y|0)?b:y,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[$>>2]=y-_,h[q>>2]=b-_,h[W>>2]=g-_),h[A>>2]=(h[A>>2]|0)+1),M=0;do h[m+(M<<4)>>2]=h[d>>2],g=h[q>>2]|0,_=h[W>>2]|0,I=h[G+(M*12|0)+4>>2]|0,O=h[G+(M*12|0)+8>>2]|0,b=(h[G+(M*12|0)>>2]|0)+(h[$>>2]|0)|0,A=m+(M<<4)+4|0,h[A>>2]=b,g=I+g|0,I=m+(M<<4)+8|0,h[I>>2]=g,_=O+_|0,O=m+(M<<4)+12|0,h[O>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[I>>2]=y,h[O>>2]=_,h[A>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[A>>2]=b,_=_-g|0,h[O>>2]=_,h[I>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[A>>2]=E,h[I>>2]=y,h[O>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[A>>2]=b-g,h[I>>2]=y-g,h[O>>2]=_-g),M=M+1|0;while((M|0)!=6);Y=oe}function d4(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&15|0}function c9(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,45)|0,Q()|0,A&127|0}function wre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(m+-1|0)>>>0>14?(_=4,_|0):(m=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,h[_>>2]=m&7,_=0,_|0)}function Sre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;if(d>>>0>15)return _=4,_|0;if(A>>>0>121)return _=17,_|0;b=ht(d|0,0,52)|0,g=Q()|0,E=ht(A|0,0,45)|0,g=g|(Q()|0)|134225919;e:do if((d|0)>=1){for(E=1,b=(He[20496+A>>0]|0)!=0,y=-1;;){if(A=h[m+(E+-1<<2)>>2]|0,A>>>0>6){g=18,A=10;break}if(!((A|0)==0|b^1))if((A|0)==1){g=19,A=10;break}else b=0;if(I=(15-E|0)*3|0,M=ht(7,0,I|0)|0,g=g&~(Q()|0),A=ht(A|0,((A|0)<0)<<31>>31|0,I|0)|0,y=A|y&~M,g=Q()|0|g,(E|0)<(d|0))E=E+1|0;else break e}if((A|0)==10)return g|0}else y=-1;while(!1);return I=_,h[I>>2]=y,h[I+4>>2]=g,I=0,I|0}function Vb(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;return!(!0&(A&-16777216|0)==134217728)||(_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0,m=m&127,m>>>0>121)?(d=0,d|0):(b=(_^15)*3|0,g=et(d|0,A|0,b|0)|0,b=ht(g|0,Q()|0,b|0)|0,g=Q()|0,y=Ns(-1227133514,-1171,b|0,g|0)|0,!((b&613566756&y|0)==0&(g&4681&(Q()|0)|0)==0)||(b=(_*3|0)+19|0,y=ht(~d|0,~A|0,b|0)|0,b=et(y|0,Q()|0,b|0)|0,!((_|0)==15|(b|0)==0&(Q()|0)==0))?(b=0,b|0):!(He[20496+m>>0]|0)||(A=A&8191,(d|0)==0&(A|0)==0)?(b=1,b|0):(b=R4(d|0,A|0,0)|0,Q()|0,((63-b|0)%3|0|0)!=0|0))}function Tre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;return!0&(A&-16777216|0)==134217728&&(_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0,m=m&127,m>>>0<=121)&&(b=(_^15)*3|0,g=et(d|0,A|0,b|0)|0,b=ht(g|0,Q()|0,b|0)|0,g=Q()|0,y=Ns(-1227133514,-1171,b|0,g|0)|0,(b&613566756&y|0)==0&(g&4681&(Q()|0)|0)==0)&&(b=(_*3|0)+19|0,y=ht(~d|0,~A|0,b|0)|0,b=et(y|0,Q()|0,b|0)|0,(_|0)==15|(b|0)==0&(Q()|0)==0)&&(!(He[20496+m>>0]|0)||(m=A&8191,(d|0)==0&(m|0)==0)||(b=R4(d|0,m|0,0)|0,Q()|0,(63-b|0)%3|0|0))||s9(d,A)|0?(b=1,b|0):(b=(w9(d,A)|0)!=0&1,b|0)}function p4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0;if(g=ht(A|0,0,52)|0,y=Q()|0,m=ht(m|0,0,45)|0,m=y|(Q()|0)|134225919,(A|0)<1){y=-1,_=m,A=d,h[A>>2]=y,d=d+4|0,h[d>>2]=_;return}for(y=1,g=-1;b=(15-y|0)*3|0,E=ht(7,0,b|0)|0,m=m&~(Q()|0),b=ht(_|0,0,b|0)|0,g=g&~E|b,m=m|(Q()|0),(y|0)!=(A|0);)y=y+1|0;E=d,b=E,h[b>>2]=g,E=E+4|0,h[E>>2]=m}function A4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,m>>>0>15)return _=4,_|0;if((y|0)<(m|0))return _=12,_|0;if((y|0)==(m|0))return h[_>>2]=d,h[_+4>>2]=A,_=0,_|0;if(g=ht(m|0,0,52)|0,g=g|d,d=Q()|0|A&-15728641,(y|0)>(m|0))do A=ht(7,0,(14-m|0)*3|0)|0,m=m+1|0,g=A|g,d=Q()|0|d;while((m|0)<(y|0));return h[_>>2]=g,h[_+4>>2]=d,_=0,_|0}function nx(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,!((m|0)<16&(y|0)<=(m|0)))return _=4,_|0;g=m-y|0,m=et(d|0,A|0,45)|0,Q()|0;e:do if(!(or(m&127)|0))m=nd(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;else{t:do if(y|0){for(m=1;b=ht(7,0,(15-m|0)*3|0)|0,!!((b&d|0)==0&((Q()|0)&A|0)==0);)if(m>>>0<y>>>0)m=m+1|0;else break t;m=nd(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;break e}while(!1);m=nd(7,0,g,((g|0)<0)<<31>>31)|0,m=lr(m|0,Q()|0,5,0)|0,m=pt(m|0,Q()|0,-5,-1)|0,m=id(m|0,Q()|0,6,0)|0,m=pt(m|0,Q()|0,1,0)|0,g=Q()|0}while(!1);return b=_,h[b>>2]=m,h[b+4>>2]=g,b=0,b|0}function Ui(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;if(g=et(d|0,A|0,45)|0,Q()|0,!(or(g&127)|0))return g=0,g|0;g=et(d|0,A|0,52)|0,Q()|0,g=g&15;e:do if(!g)m=0;else for(_=1;;){if(m=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,m=m&7,m|0)break e;if(_>>>0<g>>>0)_=_+1|0;else{m=0;break}}while(!1);return g=(m|0)==0&1,g|0}function Ere(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0;if(b=Y,Y=Y+16|0,y=b,v4(y,d,A,m),A=y,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0)return Y=b,0;g=0,m=0;do E=_+(g<<3)|0,h[E>>2]=d,h[E+4>>2]=A,g=pt(g|0,m|0,1,0)|0,m=Q()|0,b4(y),E=y,d=h[E>>2]|0,A=h[E+4>>2]|0;while(!((d|0)==0&(A|0)==0));return Y=b,0}function u9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(_|0)<(m|0)?(m=A,_=d,Ln(m|0),_|0):(m=ht(-1,-1,((_-m|0)*3|0)+3|0)|0,_=ht(~m|0,~(Q()|0)|0,(15-_|0)*3|0)|0,m=~(Q()|0)&A,_=~_&d,Ln(m|0),_|0)}function h9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0;return g=et(d|0,A|0,52)|0,Q()|0,g=g&15,(m|0)<16&(g|0)<=(m|0)?((g|0)<(m|0)&&(g=ht(-1,-1,((m+-1-g|0)*3|0)+3|0)|0,g=ht(~g|0,~(Q()|0)|0,(15-m|0)*3|0)|0,A=~(Q()|0)&A,d=~g&d),g=ht(m|0,0,52)|0,m=A&-15728641|(Q()|0),h[_>>2]=d|g,h[_+4>>2]=m,_=0,_|0):(_=4,_|0)}function Mre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0;if((m|0)==0&(_|0)==0)return dt=0,dt|0;if(g=d,y=h[g>>2]|0,g=h[g+4>>2]|0,!0&(g&15728640|0)==0){if(!((_|0)>0|(_|0)==0&m>>>0>0)||(dt=A,h[dt>>2]=y,h[dt+4>>2]=g,(m|0)==1&(_|0)==0))return dt=0,dt|0;g=1,y=0;do Ot=d+(g<<3)|0,at=h[Ot+4>>2]|0,dt=A+(g<<3)|0,h[dt>>2]=h[Ot>>2],h[dt+4>>2]=at,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(_|0)|(y|0)==(_|0)&g>>>0<m>>>0);return g=0,g|0}if(We=m<<3,at=ar(We)|0,!at)return dt=13,dt|0;if(_c(at|0,d|0,We|0)|0,Ot=ia(m,8)|0,!Ot)return _t(at),dt=13,dt|0;e:for(;;){g=at,I=h[g>>2]|0,g=h[g+4>>2]|0,ye=et(I|0,g|0,52)|0,Q()|0,ye=ye&15,At=ye+-1|0,Ee=(ye|0)!=0,Ze=(_|0)>0|(_|0)==0&m>>>0>0;t:do if(Ee&Ze){if(re=ht(At|0,0,52)|0,be=Q()|0,At>>>0>15){if(!((I|0)==0&(g|0)==0)){dt=16;break e}for(y=0,d=0;;){if(y=pt(y|0,d|0,1,0)|0,d=Q()|0,!((d|0)<(_|0)|(d|0)==(_|0)&y>>>0<m>>>0))break t;if(b=at+(y<<3)|0,Fe=h[b>>2]|0,b=h[b+4>>2]|0,!((Fe|0)==0&(b|0)==0)){g=b,dt=16;break e}}}for(E=I,d=g,y=0,b=0;;){if(!((E|0)==0&(d|0)==0)){if(!(!0&(d&117440512|0)==0)){dt=21;break e}if(O=et(E|0,d|0,52)|0,Q()|0,O=O&15,(O|0)<(At|0)){g=12,dt=27;break e}if((O|0)!=(At|0)&&(E=E|re,d=d&-15728641|be,O>>>0>=ye>>>0)){M=At;do Fe=ht(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Fe|E,d=Q()|0|d;while(M>>>0<O>>>0)}if(q=Xh(E|0,d|0,m|0,_|0)|0,W=Q()|0,M=Ot+(q<<3)|0,O=M,G=h[O>>2]|0,O=h[O+4>>2]|0,!((G|0)==0&(O|0)==0)){ue=0,_e=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&_e>>>0>m>>>0){dt=31;break e}if((G|0)==(E|0)&(O&-117440513|0)==(d|0)){$=et(G|0,O|0,56)|0,Q()|0,$=$&7,oe=$+1|0,Fe=et(G|0,O|0,45)|0,Q()|0;n:do if(!(or(Fe&127)|0))O=7;else{if(G=et(G|0,O|0,52)|0,Q()|0,G=G&15,!G){O=6;break}for(O=1;;){if(Fe=ht(7,0,(15-O|0)*3|0)|0,!((Fe&E|0)==0&((Q()|0)&d|0)==0)){O=7;break n}if(O>>>0<G>>>0)O=O+1|0;else{O=6;break}}}while(!1);if(($+2|0)>>>0>O>>>0){dt=41;break e}Fe=ht(oe|0,0,56)|0,d=Q()|0|d&-117440513,me=M,h[me>>2]=0,h[me+4>>2]=0,E=Fe|E}else q=pt(q|0,W|0,1,0)|0,q=rd(q|0,Q()|0,m|0,_|0)|0,W=Q()|0;_e=pt(_e|0,ue|0,1,0)|0,ue=Q()|0,M=Ot+(q<<3)|0,O=M,G=h[O>>2]|0,O=h[O+4>>2]|0}while(!((G|0)==0&(O|0)==0))}Fe=M,h[Fe>>2]=E,h[Fe+4>>2]=d}if(y=pt(y|0,b|0,1,0)|0,b=Q()|0,!((b|0)<(_|0)|(b|0)==(_|0)&y>>>0<m>>>0))break t;d=at+(y<<3)|0,E=h[d>>2]|0,d=h[d+4>>2]|0}}while(!1);if(Fe=pt(m|0,_|0,5,0)|0,me=Q()|0,me>>>0<0|(me|0)==0&Fe>>>0<11){dt=85;break}if(Fe=id(m|0,_|0,6,0)|0,Q()|0,Fe=ia(Fe,8)|0,!Fe){dt=48;break}do if(Ze){for(oe=0,d=0,$=0,ue=0;;){if(O=Ot+(oe<<3)|0,b=O,y=h[b>>2]|0,b=h[b+4>>2]|0,(y|0)==0&(b|0)==0)me=$;else{G=et(y|0,b|0,56)|0,Q()|0,G=G&7,E=G+1|0,q=b&-117440513,me=et(y|0,b|0,45)|0,Q()|0;t:do if(or(me&127)|0){if(W=et(y|0,b|0,52)|0,Q()|0,W=W&15,W|0)for(M=1;;){if(me=ht(7,0,(15-M|0)*3|0)|0,!((y&me|0)==0&(q&(Q()|0)|0)==0))break t;if(M>>>0<W>>>0)M=M+1|0;else break}b=ht(E|0,0,56)|0,y=b|y,b=Q()|0|q,E=O,h[E>>2]=y,h[E+4>>2]=b,E=G+2|0}while(!1);(E|0)==7?(me=Fe+(d<<3)|0,h[me>>2]=y,h[me+4>>2]=b&-117440513,d=pt(d|0,$|0,1,0)|0,me=Q()|0):me=$}if(oe=pt(oe|0,ue|0,1,0)|0,ue=Q()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&oe>>>0<m>>>0)$=me;else break}if(Ze){if(_e=At>>>0>15,re=ht(At|0,0,52)|0,be=Q()|0,!Ee){for(y=0,M=0,E=0,b=0;(I|0)==0&(g|0)==0||(At=A+(y<<3)|0,h[At>>2]=I,h[At+4>>2]=g,y=pt(y|0,M|0,1,0)|0,M=Q()|0),E=pt(E|0,b|0,1,0)|0,b=Q()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<m>>>0);)g=at+(E<<3)|0,I=h[g>>2]|0,g=h[g+4>>2]|0;g=me;break}for(y=0,M=0,b=0,E=0;;){do if(!((I|0)==0&(g|0)==0)){if(W=et(I|0,g|0,52)|0,Q()|0,W=W&15,_e|(W|0)<(At|0)){dt=80;break e}if((W|0)!=(At|0)){if(O=I|re,G=g&-15728641|be,W>>>0>=ye>>>0){q=At;do Ee=ht(7,0,(14-q|0)*3|0)|0,q=q+1|0,O=Ee|O,G=Q()|0|G;while(q>>>0<W>>>0)}}else O=I,G=g;$=Xh(O|0,G|0,m|0,_|0)|0,q=0,W=0,ue=Q()|0;do{if((q|0)>(_|0)|(q|0)==(_|0)&W>>>0>m>>>0){dt=81;break e}if(Ee=Ot+($<<3)|0,oe=h[Ee+4>>2]|0,(oe&-117440513|0)==(G|0)&&(h[Ee>>2]|0)==(O|0)){dt=65;break}Ee=pt($|0,ue|0,1,0)|0,$=rd(Ee|0,Q()|0,m|0,_|0)|0,ue=Q()|0,W=pt(W|0,q|0,1,0)|0,q=Q()|0,Ee=Ot+($<<3)|0}while(!((h[Ee>>2]|0)==(O|0)&&(h[Ee+4>>2]|0)==(G|0)));if((dt|0)==65&&(dt=0,!0&(oe&117440512|0)==100663296))break;Ee=A+(y<<3)|0,h[Ee>>2]=I,h[Ee+4>>2]=g,y=pt(y|0,M|0,1,0)|0,M=Q()|0}while(!1);if(b=pt(b|0,E|0,1,0)|0,E=Q()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<m>>>0))break;g=at+(b<<3)|0,I=h[g>>2]|0,g=h[g+4>>2]|0}g=me}else y=0,g=me}else y=0,d=0,g=0;while(!1);if(sd(Ot|0,0,We|0)|0,_c(at|0,Fe|0,d<<3|0)|0,_t(Fe),(d|0)==0&(g|0)==0){dt=89;break}else A=A+(y<<3)|0,_=g,m=d}if((dt|0)==16)!0&(g&117440512|0)==0?(g=4,dt=27):dt=21;else if((dt|0)==31)li(27634,27225,620,27235);else{if((dt|0)==41)return _t(at),_t(Ot),dt=10,dt|0;if((dt|0)==48)return _t(at),_t(Ot),dt=13,dt|0;(dt|0)==80?li(27634,27225,711,27235):(dt|0)==81?li(27634,27225,723,27235):(dt|0)==85&&(_c(A|0,at|0,m<<3|0)|0,dt=89)}return(dt|0)==21?(_t(at),_t(Ot),dt=5,dt|0):(dt|0)==27?(_t(at),_t(Ot),dt=g,dt|0):(dt|0)==89?(_t(at),_t(Ot),dt=0,dt|0):0}function Cre(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(oe=Y,Y=Y+16|0,$=oe,!((m|0)>0|(m|0)==0&A>>>0>0))return $=0,Y=oe,$|0;if((b|0)>=16)return $=12,Y=oe,$|0;q=0,W=0,G=0,E=0;e:for(;;){if(I=d+(q<<3)|0,M=h[I>>2]|0,I=h[I+4>>2]|0,O=et(M|0,I|0,52)|0,Q()|0,(O&15|0)>(b|0)){E=12,M=11;break}if(v4($,M,I,b),O=$,I=h[O>>2]|0,O=h[O+4>>2]|0,(I|0)==0&(O|0)==0)M=G;else{M=G;do{if(!((E|0)<(y|0)|(E|0)==(y|0)&M>>>0<g>>>0)){M=10;break e}G=_+(M<<3)|0,h[G>>2]=I,h[G+4>>2]=O,M=pt(M|0,E|0,1,0)|0,E=Q()|0,b4($),G=$,I=h[G>>2]|0,O=h[G+4>>2]|0}while(!((I|0)==0&(O|0)==0))}if(q=pt(q|0,W|0,1,0)|0,W=Q()|0,(W|0)<(m|0)|(W|0)==(m|0)&q>>>0<A>>>0)G=M;else{E=0,M=11;break}}return(M|0)==10?($=14,Y=oe,$|0):(M|0)==11?(Y=oe,E|0):0}function Rre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;q=Y,Y=Y+16|0,G=q;e:do if((m|0)>0|(m|0)==0&A>>>0>0){for(I=0,b=0,y=0,O=0;;){if(M=d+(I<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=(nx(E,M,_,G)|0)==0,E=G,b=pt(h[E>>2]|0,h[E+4>>2]|0,b|0,y|0)|0,y=Q()|0,!M)){y=12;break}if(I=pt(I|0,O|0,1,0)|0,O=Q()|0,!((O|0)<(m|0)|(O|0)==(m|0)&I>>>0<A>>>0))break e}return Y=q,y|0}else b=0,y=0;while(!1);return h[g>>2]=b,h[g+4>>2]=y,g=0,Y=q,g|0}function Pre(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&1|0}function Fa(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,!g)return g=0,g|0;for(_=1;;){if(m=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,m=m&7,m|0){_=5;break}if(_>>>0<g>>>0)_=_+1|0;else{m=0,_=5;break}}return(_|0)==5?m|0:0}function m4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Ln(I|0),O|0;for(I=1,m=0;;){switch(_=(15-I|0)*3|0,E=ht(7,0,_|0)|0,M=Q()|0,y=d&~E,b=A&~M,d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=d&7}_=ht(d|0,0,_|0)|0,g=Q()|0,d=_|y,A=g|b;e:do if(!m)if((_&E|0)==0&(g&M|0)==0)m=0;else if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)m=1;else{m=1;t:for(;;){switch(M=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,M&7){case 1:break t;case 0:break;default:{m=1;break e}}if(m>>>0<b>>>0)m=m+1|0;else{m=1;break e}}for(y=1;;){switch(g=(15-y|0)*3|0,m=et(d|0,A|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,_=d&~_,A=A&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,d=d|_,A=Q()|0|A,y>>>0<b>>>0)y=y+1|0;else{m=1;break e}}}while(!1);if(I>>>0<O>>>0)I=I+1|0;else break}return Ln(A|0),d|0}function T0(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)return y=A,b=d,Ln(y|0),b|0;for(y=1;;){switch(g=(15-y|0)*3|0,m=et(d|0,A|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,_=d&~_,A=A&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,d=d|_,A=Q()|0|A,y>>>0<b>>>0)y=y+1|0;else break}return Ln(A|0),d|0}function Ire(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Ln(I|0),O|0;for(I=1,m=0;;){switch(_=(15-I|0)*3|0,E=ht(7,0,_|0)|0,M=Q()|0,y=d&~E,b=A&~M,d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}_=ht(d|0,0,_|0)|0,g=Q()|0,d=_|y,A=g|b;e:do if(!m)if((_&E|0)==0&(g&M|0)==0)m=0;else if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)m=1;else{m=1;t:for(;;){switch(M=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,M&7){case 1:break t;case 0:break;default:{m=1;break e}}if(m>>>0<b>>>0)m=m+1|0;else{m=1;break e}}for(y=1;;){switch(m=(15-y|0)*3|0,_=ht(7,0,m|0)|0,_=d&~_,g=A&~(Q()|0),d=et(d|0,A|0,m|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(d=ht(d|0,0,m|0)|0,d=d|_,A=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else{m=1;break e}}}while(!1);if(I>>>0<O>>>0)I=I+1|0;else break}return Ln(A|0),d|0}function g4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)return y=A,b=d,Ln(y|0),b|0;for(y=1;;){switch(_=(15-y|0)*3|0,m=ht(7,0,_|0)|0,m=d&~m,g=A&~(Q()|0),d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(d=ht(d|0,0,_|0)|0,d=d|m,A=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else break}return Ln(A|0),d|0}function Nre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0;if(me=Y,Y=Y+16|0,be=me,ht(A|0,0,52)|0,m=Q()|0|134225919,!A)return(h[d+4>>2]|0)>2||(h[d+8>>2]|0)>2||(h[d+12>>2]|0)>2?(re=0,be=0,Ln(re|0),Y=me,be|0):(ht(Jk(d)|0,0,45)|0,re=Q()|0|m,be=-1,Ln(re|0),Y=me,be|0);h[be>>2]=h[d>>2],h[be+4>>2]=h[d+4>>2],h[be+8>>2]=h[d+8>>2],h[be+12>>2]=h[d+12>>2],re=be+4|0;e:do if((A|0)>0)for(oe=be+8|0,ue=be+12|0,$=A,G=h[oe>>2]|0,q=h[ue>>2]|0,A=-1,O=h[be+4>>2]|0;;){W=$,$=$+-1|0,d=O-q|0,_=G-q|0,W&1?(y=du(+((d*3|0)-_|0)*.14285714285714285)|0,h[re>>2]=y,d=du(+((_<<1)+d|0)*.14285714285714285)|0,h[oe>>2]=d,h[ue>>2]=0,_=d-y|0,g=0-y|0,(y|0)<0?(h[oe>>2]=_,h[ue>>2]=g,h[re>>2]=0,d=_,b=0):(b=y,g=0),y=b-d|0,_=g-d|0,(d|0)<0?(h[re>>2]=y,h[ue>>2]=_,h[oe>>2]=0,b=y,y=0):(_=g,y=d),d=b-_|0,g=y-_|0,(_|0)<0?(h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=0,y=0):(g=y,d=b,y=_),_=(g|0)<(d|0)?g:d,_=(y|0)<(_|0)?y:_,(_|0)>0&&(y=y-_|0,g=g-_|0,d=d-_|0,h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=y),Ze=g+(d*3|0)|0,Fe=(Ze|0)<0,I=y+(g*3|0)-(Fe?Ze:0)|0,M=(I|0)<0,_=(y*3|0)+d-(Fe?Ze:0)-(M?I:0)|0,E=(_|0)<0,Ee=E?0:_,b=(M?0:I)-(E?_:0)|0,_=(Fe?0:Ze)-(M?I:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Ee|0)<(E|0)?Ee:E,I=(E|0)>0,M=I?E:0,b=b-(I?E:0)|0,E=Ee-(I?E:0)|0,I=y):(E=du(+((d<<1)+_|0)*.14285714285714285)|0,h[re>>2]=E,g=du(+((_*3|0)-d|0)*.14285714285714285)|0,h[oe>>2]=g,h[ue>>2]=0,_=g-E|0,d=0-E|0,(E|0)<0?(h[oe>>2]=_,h[ue>>2]=d,h[re>>2]=0,g=_,E=0):d=0,b=E-g|0,_=d-g|0,(g|0)<0?(h[re>>2]=b,h[ue>>2]=_,h[oe>>2]=0,y=_,g=0):(y=d,b=E),d=b-y|0,_=g-y|0,(y|0)<0?(h[re>>2]=d,h[oe>>2]=_,h[ue>>2]=0,g=_,y=0):d=b,_=(g|0)<(d|0)?g:d,_=(y|0)<(_|0)?y:_,(_|0)>0&&(y=y-_|0,g=g-_|0,d=d-_|0,h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=y),Ze=y+(d*3|0)|0,Ee=(Ze|0)<0,I=(g*3|0)+d-(Ee?Ze:0)|0,M=(I|0)<0,_=(y*3|0)+g-(Ee?Ze:0)-(M?I:0)|0,E=(_|0)<0,Fe=E?0:_,b=(M?0:I)-(E?_:0)|0,_=(Ee?0:Ze)-(M?I:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Fe|0)<(E|0)?Fe:E,I=(E|0)>0,M=I?E:0,b=b-(I?E:0)|0,E=Fe-(I?E:0)|0,I=y),_=O+(M-_)|0,y=(_|0)<0,M=G-b-(y?_:0)|0,b=(M|0)<0,q=q-E+(y?0-_|0:0)+(b?0-M|0:0)|0,O=(q|0)<0,E=O?0:q,Ee=(b?0:M)-(O?q:0)|0,q=(y?0:_)-(b?M:0)-(O?q:0)|0,O=(Ee|0)<(q|0)?Ee:q,O=(E|0)<(O|0)?E:O,M=(O|0)>0,q=q-(M?O:0)|0,b=(15-W|0)*3|0,_=ht(7,0,b|0)|0,_=A&~_,y=m&~(Q()|0),G=(q|0)<0,Ze=G?q:0,Ee=Ee-(M?O:0)-Ze|0,Fe=(Ee|0)<0,Ze=(Fe?0-Ee|0:0)+(E-(M?O:0)-Ze)|0,m=(Ze|0)<0,A=m?0:Ze,Ze=m?Ze:0,m=(Fe?0:Ee)-Ze|0,Ze=(G?0:q)-(Fe?Ee:0)-Ze|0,Ee=(m|0)<(Ze|0)?m:Ze,Ee=(A|0)<(Ee|0)?A:Ee,Ee=(Ee|0)>0?Ee:0,A=A-Ee|0,m=m-Ee|0;t:do switch(Ze-Ee|0){case 0:switch(m|0){case 0:{A=(A|0)==0?0:(A|0)==1?1:7;break t}case 1:{A=(A|0)==0?2:(A|0)==1?3:7;break t}default:{_e=36;break t}}case 1:switch(m|0){case 0:{A=(A|0)==0?4:(A|0)==1?5:7;break t}case 1:if(A){_e=36;break t}else{A=6;break t}default:{_e=36;break t}}default:_e=36}while(!1);if((_e|0)==36&&(_e=0,A=7),A=ht(A|0,0,b|0)|0,A=A|_,m=Q()|0|y,(W|0)<=1)break e;G=g,q=I,O=d}else A=-1,d=h[re>>2]|0;while(!1);e:do if((d|0)<=2&&(h[be+8>>2]|0)<=2&&(h[be+12>>2]|0)<=2){if(_=Jk(be)|0,d=ht(_|0,0,45)|0,A=d|A,d=Q()|0|m&-1040385,M=ere(be)|0,!(or(_)|0)){if((M|0)<=0)break;for(E=0;;){b=et(A|0,d|0,52)|0,Q()|0,b=b&15;t:do if(b)for(y=1;;){switch(g=(15-y|0)*3|0,m=et(A|0,d|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,A=A&~_,_=d&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,A=d|A,d=Q()|0|_,y>>>0<b>>>0)y=y+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=et(A|0,d|0,52)|0,Q()|0,b=b&15;t:do if(b){m=1;n:for(;;){switch(Ee=et(A|0,d|0,(15-m|0)*3|0)|0,Q()|0,Ee&7){case 1:break n;case 0:break;default:break t}if(m>>>0<b>>>0)m=m+1|0;else break t}if(e9(_,h[be>>2]|0)|0)for(y=1;;){switch(m=(15-y|0)*3|0,_=ht(7,0,m|0)|0,_=A&~_,g=d&~(Q()|0),d=et(A|0,d|0,m|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(A=ht(d|0,0,m|0)|0,A=A|_,d=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else break t}else for(y=1;;){switch(g=(15-y|0)*3|0,m=et(A|0,d|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,A=A&~_,_=d&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,A=d|A,d=Q()|0|_,y>>>0<b>>>0)y=y+1|0;else break t}}while(!1);if((M|0)>0){m=0;do A=m4(A,d)|0,d=Q()|0,m=m+1|0;while((m|0)!=(M|0))}}else A=0,d=0;while(!1);return Ze=d,Ee=A,Ln(Ze|0),Y=me,Ee|0}function Bl(d){return d=d|0,(d|0)%2|0|0}function _4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(O=Y,Y=Y+64|0,E=O+24|0,M=O+48|0,I=O,A>>>0>15)return I=4,Y=O,I|0;if(y=+ne[d>>3],ne[Xi>>3]=y,(h[Xi+4>>2]&2146435072|0)==2146435072||(_=+ne[d+8>>3],ne[Xi>>3]=_,(h[Xi+4>>2]&2146435072|0)==2146435072))return I=3,Y=O,I|0;g=+Qn(+y),G=g*+Qn(+_),g=g*+Ii(+_),_=+Ii(+y),ne[I>>3]=G,ne[I+8>>3]=g,ne[I+16>>3]=_,ne[Xi>>3]=G;do if((h[Xi+4>>2]&2146435072|0)!=2146435072&&(ne[Xi>>3]=_,d=h[Xi+4>>2]|0,ne[Xi>>3]=g,!((h[Xi+4>>2]&2146435072|0)==2146435072|!0&(d&2146435072|0)==2146435072)))if(h[E>>2]=h[I>>2],h[E+4>>2]=h[I+4>>2],h[E+8>>2]=h[I+8>>2],h[E+12>>2]=h[I+12>>2],h[E+16>>2]=h[I+16>>2],h[E+20>>2]=h[I+20>>2],yre(E,A,M),M=Nre(M,A)|0,I=Q()|0,h[m>>2]=M,h[m+4>>2]=I,(M|0)==0&(I|0)==0)li(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return I=b,Y=O,I|0}function x4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(W=m+4|0,$=et(d|0,A|0,52)|0,Q()|0,$=$&15,q=et(d|0,A|0,45)|0,Q()|0,_=($|0)==0,or(q&127)|0){if(_)return $=1,$|0;_=1}else{if(_)return $=0,$|0;(h[W>>2]|0)==0&&(h[m+8>>2]|0)==0?_=(h[m+12>>2]|0)!=0&1:_=1}for(q=m+8|0,G=m+12|0,O=1,m=h[W>>2]|0,b=h[q>>2]|0,y=h[G>>2]|0;g=m*3|0,E=b*3|0,I=y*3|0,O&1?(M=b+g|0,h[W>>2]=M,y=y+E|0,h[q>>2]=y,g=I+m|0,h[G>>2]=g,m=y-M|0,b=g-M|0,(M|0)<0?(h[q>>2]=m,h[G>>2]=b,h[W>>2]=0,E=0,g=b):(m=y,E=M),b=E-m|0,y=g-m|0,(m|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,E=b,g=0):(y=g,g=m),m=E-y|0,b=g-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=b,h[G>>2]=0,y=0):(b=g,m=E),g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)):(M=E+m|0,E=y+g|0,h[W>>2]=E,h[q>>2]=M,g=I+b|0,h[G>>2]=g,m=M-E|0,y=g-E|0,(E|0)<0?(h[q>>2]=m,h[G>>2]=y,h[W>>2]=0,E=0,g=y):m=M,b=E-m|0,y=g-m|0,(m|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,E=b,g=0):(y=g,g=m),m=E-y|0,b=g-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=b,h[G>>2]=0,y=0):(b=g,m=E),g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)),g=et(d|0,A|0,(15-O|0)*3|0)|0,Q()|0,g=g&7,(g+-1|0)>>>0<6&&(M=h[22032+(g*12|0)+4>>2]|0,I=h[22032+(g*12|0)+8>>2]|0,E=(h[22032+(g*12|0)>>2]|0)+m|0,h[W>>2]=E,b=M+b|0,h[q>>2]=b,m=I+y|0,h[G>>2]=m,y=b-E|0,g=m-E|0,(E|0)<0&&(h[q>>2]=y,h[G>>2]=g,h[W>>2]=0,E=0,m=g,b=y),g=E-b|0,y=m-b|0,(b|0)<0?(h[W>>2]=g,h[G>>2]=y,h[q>>2]=0,E=g,b=0):y=m,m=E-y|0,g=b-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=g,h[G>>2]=0,b=g,y=0):m=E,g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)),O>>>0<$>>>0;)O=O+1|0;return _|0}function Km(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if($=Y,Y=Y+16|0,G=$,q=et(d|0,A|0,45)|0,Q()|0,q=q&127,q>>>0>121)return h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,W=5,Y=$,W|0;e:do if((or(q)|0)!=0&&(E=et(d|0,A|0,52)|0,Q()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(W=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,W&7){case 5:break t;case 0:break;default:{I=A;break e}}if(_>>>0<E>>>0)_=_+1|0;else{I=A;break e}}for(b=1,_=A;;){switch(A=(15-b|0)*3|0,g=ht(7,0,A|0)|0,g=d&~g,y=_&~(Q()|0),_=et(d|0,_|0,A|0)|0,Q()|0,_&7){case 1:{_=3;break}case 3:{_=2;break}case 2:{_=6;break}case 6:{_=4;break}case 4:{_=5;break}case 5:{_=1;break}default:_=_&7}if(d=ht(_|0,0,A|0)|0,d=d|g,_=Q()|0|y,b>>>0<E>>>0)b=b+1|0;else{I=_;break e}}}else I=A;while(!1);if(W=7696+(q*28|0)|0,h[m>>2]=h[W>>2],h[m+4>>2]=h[W+4>>2],h[m+8>>2]=h[W+8>>2],h[m+12>>2]=h[W+12>>2],!(x4(d,I,m)|0))return W=0,Y=$,W|0;if(W=m+4|0,h[G>>2]=h[W>>2],h[G+4>>2]=h[W+4>>2],h[G+8>>2]=h[W+8>>2],M=et(d|0,I|0,52)|0,Q()|0,O=M&15,M&1?(y=h[W>>2]|0,E=m+8|0,g=h[E>>2]|0,M=m+12|0,A=h[M>>2]|0,_=(g*3|0)+y|0,y=A+(y*3|0)|0,h[W>>2]=y,h[E>>2]=_,g=(A*3|0)+g|0,h[M>>2]=g,A=_-y|0,b=g-y|0,(y|0)<0&&(h[E>>2]=A,h[M>>2]=b,h[W>>2]=0,_=A,y=0,g=b),b=y-_|0,A=g-_|0,(_|0)<0?(h[W>>2]=b,h[M>>2]=A,h[E>>2]=0,_=0):(A=g,b=y),y=b-A|0,g=_-A|0,(A|0)<0?(h[W>>2]=y,h[E>>2]=g,h[M>>2]=0,A=0):(g=_,y=b),_=(g|0)<(y|0)?g:y,_=(A|0)<(_|0)?A:_,(_|0)>0&&(h[W>>2]=y-_,h[E>>2]=g-_,h[M>>2]=A-_),g=O+1|0):g=O,!(or(q)|0))_=0;else{e:do if(!O)_=0;else for(A=1;;){if(_=et(d|0,I|0,(15-A|0)*3|0)|0,Q()|0,_=_&7,_|0)break e;if(A>>>0<O>>>0)A=A+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(Zm(m,g,_,0)|0))(g|0)!=(O|0)&&(h[W>>2]=h[G>>2],h[W+4>>2]=h[G+4>>2],h[W+8>>2]=h[G+8>>2]);else{if(or(q)|0)do;while((Zm(m,g,0,0)|0)!=0);(g|0)!=(O|0)&&(E=m+12|0,d=h[E>>2]|0,_=(h[W>>2]|0)-d|0,b=m+8|0,d=(h[b>>2]|0)-d|0,A=du(+((_<<1)+d|0)*.14285714285714285)|0,h[W>>2]=A,_=du(+((d*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,d=_-A|0,g=0-A|0,(A|0)<0?(h[b>>2]=d,h[E>>2]=g,h[W>>2]=0,_=d,A=0):g=0,y=A-_|0,d=g-_|0,(_|0)<0?(h[W>>2]=y,h[E>>2]=d,h[b>>2]=0,A=y,_=0):d=g,y=A-d|0,g=_-d|0,(d|0)<0?(h[W>>2]=y,h[b>>2]=g,h[E>>2]=0,A=y,d=0):g=_,_=(g|0)<(A|0)?g:A,_=(d|0)<(_|0)?d:_,(_|0)>0&&(h[W>>2]=A-_,h[b>>2]=g-_,h[E>>2]=d-_))}return W=0,Y=$,W|0}function Qm(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0;return b=Y,Y=Y+48|0,_=b+24|0,g=b,y=Km(d,A,_)|0,y?(Y=b,y|0):(y=et(d|0,A|0,52)|0,Q()|0,vre(_,y&15,g),M=+J1(+ +ne[g+16>>3]),E=+na(+ +ne[g+8>>3],+ +ne[g>>3]),ne[m>>3]=M,ne[m+8>>3]=E,y=0,Y=b,y|0)}function E0(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0;if(b=Y,Y=Y+16|0,y=b,_=Km(d,A,y)|0,_|0)return y=_,Y=b,y|0;_=et(d|0,A|0,45)|0,Q()|0,_=(or(_&127)|0)==0,g=et(d|0,A|0,52)|0,Q()|0,g=g&15;e:do if(!_){if(g|0)for(_=1;;){if(E=ht(7,0,(15-_|0)*3|0)|0,!((E&d|0)==0&((Q()|0)&A|0)==0))break e;if(_>>>0<g>>>0)_=_+1|0;else break}return h4(y,g,0,5,m),E=0,Y=b,E|0}while(!1);return f4(y,g,0,6,m),E=0,Y=b,E|0}function Lre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(g=et(d|0,A|0,45)|0,Q()|0,!(or(g&127)|0))return g=2,h[m>>2]=g,0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,!g)return g=5,h[m>>2]=g,0;for(_=1;;){if(y=ht(7,0,(15-_|0)*3|0)|0,!((y&d|0)==0&((Q()|0)&A|0)==0)){_=2,d=6;break}if(_>>>0<g>>>0)_=_+1|0;else{_=5,d=6;break}}return(d|0)==6&&(h[m>>2]=_),0}function f9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+128|0,I=G+112|0,y=G+96|0,O=G,g=et(d|0,A|0,52)|0,Q()|0,E=g&15,h[I>>2]=E,b=et(d|0,A|0,45)|0,Q()|0,b=b&127;e:do if(or(b)|0){if(E|0)for(_=1;;){if(M=ht(7,0,(15-_|0)*3|0)|0,!((M&d|0)==0&((Q()|0)&A|0)==0)){g=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(g&1)g=1;else return M=ht(E+1|0,0,52)|0,O=Q()|0|A&-15728641,I=ht(7,0,(14-E|0)*3|0)|0,O=f9((M|d)&~I,O&~(Q()|0),m)|0,Y=G,O|0}else g=0;while(!1);if(_=Km(d,A,y)|0,!_){g?(a9(y,I,O),M=5):(l9(y,I,O),M=6);e:do if(or(b)|0)if(!E)d=5;else for(_=1;;){if(b=ht(7,0,(15-_|0)*3|0)|0,!((b&d|0)==0&((Q()|0)&A|0)==0)){d=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{d=5;break}}else d=2;while(!1);sd(m|0,-1,d<<2|0)|0;e:do if(g)for(y=0;;){if(b=O+(y<<4)|0,bre(b,h[I>>2]|0)|0,b=h[b>>2]|0,E=h[m>>2]|0,(E|0)==-1|(E|0)==(b|0))_=m;else{g=0;do{if(g=g+1|0,g>>>0>=d>>>0){_=1;break e}_=m+(g<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,y=y+1|0,y>>>0>=M>>>0){_=0;break}}else for(y=0;;){if(b=O+(y<<4)|0,Zm(b,h[I>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[m>>2]|0,(E|0)==-1|(E|0)==(b|0))_=m;else{g=0;do{if(g=g+1|0,g>>>0>=d>>>0){_=1;break e}_=m+(g<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,y=y+1|0,y>>>0>=M>>>0){_=0;break}}while(!1)}return O=_,Y=G,O|0}function Dre(){return 12}function y4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0;if(d>>>0>15)return E=4,E|0;if(ht(d|0,0,52)|0,E=Q()|0|134225919,!d){m=0,_=0;do or(_)|0&&(ht(_|0,0,45)|0,b=E|(Q()|0),d=A+(m<<3)|0,h[d>>2]=-1,h[d+4>>2]=b,m=m+1|0),_=_+1|0;while((_|0)!=122);return m=0,m|0}m=0,b=0;do{if(or(b)|0){for(ht(b|0,0,45)|0,_=1,g=-1,y=E|(Q()|0);M=ht(7,0,(15-_|0)*3|0)|0,g=g&~M,y=y&~(Q()|0),(_|0)!=(d|0);)_=_+1|0;M=A+(m<<3)|0,h[M>>2]=g,h[M+4>>2]=y,m=m+1|0}b=b+1|0}while((b|0)!=122);return m=0,m|0}function Fre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if(re=Y,Y=Y+16|0,ue=re,_e=et(d|0,A|0,52)|0,Q()|0,_e=_e&15,m>>>0>15)return _e=4,Y=re,_e|0;if((_e|0)<(m|0))return _e=12,Y=re,_e|0;if((_e|0)!=(m|0))if(y=ht(m|0,0,52)|0,y=y|d,E=Q()|0|A&-15728641,(_e|0)>(m|0)){M=m;do oe=ht(7,0,(14-M|0)*3|0)|0,M=M+1|0,y=oe|y,E=Q()|0|E;while((M|0)<(_e|0));oe=y}else oe=y;else oe=d,E=A;$=et(oe|0,E|0,45)|0,Q()|0;e:do if(or($&127)|0){if(M=et(oe|0,E|0,52)|0,Q()|0,M=M&15,M|0)for(y=1;;){if($=ht(7,0,(15-y|0)*3|0)|0,!(($&oe|0)==0&((Q()|0)&E|0)==0)){I=33;break e}if(y>>>0<M>>>0)y=y+1|0;else break}if($=_,h[$>>2]=0,h[$+4>>2]=0,(_e|0)>(m|0)){for($=A&-15728641,W=_e;;){if(q=W,W=W+-1|0,W>>>0>15|(_e|0)<(W|0)){I=19;break}if((_e|0)!=(W|0))if(y=ht(W|0,0,52)|0,y=y|d,M=Q()|0|$,(_e|0)<(q|0))G=y;else{I=W;do G=ht(7,0,(14-I|0)*3|0)|0,I=I+1|0,y=G|y,M=Q()|0|M;while((I|0)<(_e|0));G=y}else G=d,M=A;if(O=et(G|0,M|0,45)|0,Q()|0,!(or(O&127)|0))y=0;else{O=et(G|0,M|0,52)|0,Q()|0,O=O&15;t:do if(!O)y=0;else for(I=1;;){if(y=et(G|0,M|0,(15-I|0)*3|0)|0,Q()|0,y=y&7,y|0)break t;if(I>>>0<O>>>0)I=I+1|0;else{y=0;break}}while(!1);y=(y|0)==0&1}if(M=et(d|0,A|0,(15-q|0)*3|0)|0,Q()|0,M=M&7,(M|0)==7){g=5,I=42;break}if(y=(y|0)!=0,(M|0)==1&y){g=5,I=42;break}if(G=M+(((M|0)!=0&y)<<31>>31)|0,G|0&&(I=_e-q|0,I=nd(7,0,I,((I|0)<0)<<31>>31)|0,O=Q()|0,y?(y=lr(I|0,O|0,5,0)|0,y=pt(y|0,Q()|0,-5,-1)|0,y=id(y|0,Q()|0,6,0)|0,y=pt(y|0,Q()|0,1,0)|0,M=Q()|0):(y=I,M=O),q=G+-1|0,q=lr(I|0,O|0,q|0,((q|0)<0)<<31>>31|0)|0,q=pt(y|0,M|0,q|0,Q()|0)|0,G=Q()|0,O=_,O=pt(q|0,G|0,h[O>>2]|0,h[O+4>>2]|0)|0,G=Q()|0,q=_,h[q>>2]=O,h[q+4>>2]=G),(W|0)<=(m|0)){I=37;break}}if((I|0)==19)li(27634,27225,1407,27259);else if((I|0)==37){b=_,g=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((I|0)==42)return Y=re,g|0}else g=0,b=0}else I=33;while(!1);e:do if((I|0)==33)if($=_,h[$>>2]=0,h[$+4>>2]=0,(_e|0)>(m|0)){for(y=_e;;){if(g=et(d|0,A|0,(15-y|0)*3|0)|0,Q()|0,g=g&7,(g|0)==7){g=5;break}if(b=_e-y|0,b=nd(7,0,b,((b|0)<0)<<31>>31)|0,g=lr(b|0,Q()|0,g|0,0)|0,b=Q()|0,$=_,b=pt(h[$>>2]|0,h[$+4>>2]|0,g|0,b|0)|0,g=Q()|0,$=_,h[$>>2]=b,h[$+4>>2]=g,y=y+-1|0,(y|0)<=(m|0))break e}return Y=re,g|0}else g=0,b=0;while(!1);return nx(oe,E,_e,ue)|0&&li(27634,27225,1367,27274),_e=ue,ue=h[_e+4>>2]|0,((g|0)>-1|(g|0)==-1&b>>>0>4294967295)&((ue|0)>(g|0)|((ue|0)==(g|0)?(h[_e>>2]|0)>>>0>b>>>0:0))?(_e=0,Y=re,_e|0):(li(27634,27225,1447,27259),0)}function Ore(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(G=Y,Y=Y+16|0,b=G,g>>>0>15)return y=4,Y=G,y|0;if(E=et(m|0,_|0,52)|0,Q()|0,E=E&15,(E|0)>(g|0))return y=12,Y=G,y|0;if(nx(m,_,g,b)|0&&li(27634,27225,1367,27274),O=b,I=h[O+4>>2]|0,!(((A|0)>-1|(A|0)==-1&d>>>0>4294967295)&((I|0)>(A|0)|((I|0)==(A|0)?(h[O>>2]|0)>>>0>d>>>0:0))))return y=2,Y=G,y|0;O=g-E|0,g=ht(g|0,0,52)|0,M=Q()|0|_&-15728641,I=y,h[I>>2]=g|m,h[I+4>>2]=M,I=et(m|0,_|0,45)|0,Q()|0;e:do if(or(I&127)|0){if(E|0)for(b=1;;){if(I=ht(7,0,(15-b|0)*3|0)|0,!((I&m|0)==0&((Q()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((O|0)<1)return y=0,Y=G,y|0;for(I=E^15,_=-1,M=1,b=1;;){E=O-M|0,E=nd(7,0,E,((E|0)<0)<<31>>31)|0,m=Q()|0;do if(b)if(b=lr(E|0,m|0,5,0)|0,b=pt(b|0,Q()|0,-5,-1)|0,b=id(b|0,Q()|0,6,0)|0,g=Q()|0,(A|0)>(g|0)|(A|0)==(g|0)&d>>>0>b>>>0){A=pt(d|0,A|0,-1,-1)|0,A=Ns(A|0,Q()|0,b|0,g|0)|0,b=Q()|0,q=y,$=h[q>>2]|0,q=h[q+4>>2]|0,oe=(I+_|0)*3|0,W=ht(7,0,oe|0)|0,q=q&~(Q()|0),_=id(A|0,b|0,E|0,m|0)|0,d=Q()|0,g=pt(_|0,d|0,2,0)|0,oe=ht(g|0,Q()|0,oe|0)|0,q=Q()|0|q,g=y,h[g>>2]=oe|$&~W,h[g+4>>2]=q,d=lr(_|0,d|0,E|0,m|0)|0,d=Ns(A|0,b|0,d|0,Q()|0)|0,b=0,A=Q()|0;break}else{oe=y,W=h[oe>>2]|0,oe=h[oe+4>>2]|0,$=ht(7,0,(I+_|0)*3|0)|0,oe=oe&~(Q()|0),b=y,h[b>>2]=W&~$,h[b+4>>2]=oe,b=1;break}else W=y,g=h[W>>2]|0,W=h[W+4>>2]|0,_=(I+_|0)*3|0,q=ht(7,0,_|0)|0,W=W&~(Q()|0),oe=id(d|0,A|0,E|0,m|0)|0,b=Q()|0,_=ht(oe|0,b|0,_|0)|0,W=Q()|0|W,$=y,h[$>>2]=_|g&~q,h[$+4>>2]=W,b=lr(oe|0,b|0,E|0,m|0)|0,d=Ns(d|0,A|0,b|0,Q()|0)|0,b=0,A=Q()|0;while(!1);if((O|0)>(M|0))_=~M,M=M+1|0;else{A=0;break}}return Y=G,A|0}while(!1);if((O|0)<1)return oe=0,Y=G,oe|0;for(g=E^15,b=1;;)if($=O-b|0,$=nd(7,0,$,(($|0)<0)<<31>>31)|0,oe=Q()|0,M=y,m=h[M>>2]|0,M=h[M+4>>2]|0,E=(g-b|0)*3|0,_=ht(7,0,E|0)|0,M=M&~(Q()|0),q=id(d|0,A|0,$|0,oe|0)|0,W=Q()|0,E=ht(q|0,W|0,E|0)|0,M=Q()|0|M,I=y,h[I>>2]=E|m&~_,h[I+4>>2]=M,oe=lr(q|0,W|0,$|0,oe|0)|0,d=Ns(d|0,A|0,oe|0,Q()|0)|0,A=Q()|0,(O|0)<=(b|0)){A=0;break}else b=b+1|0;return Y=G,A|0}function v4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;g=et(A|0,m|0,52)|0,Q()|0,g=g&15,(A|0)==0&(m|0)==0|((_|0)>15|(g|0)>(_|0))?(y=-1,A=-1,m=0,g=0):(A=u9(A,m,g+1|0,_)|0,b=(Q()|0)&-15728641,m=ht(_|0,0,52)|0,m=A|m,b=b|(Q()|0),A=(Ui(m,b)|0)==0,y=g,A=A?-1:_,g=b),b=d,h[b>>2]=m,h[b+4>>2]=g,h[d+8>>2]=y,h[d+12>>2]=A}function d9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,y=_+8|0,h[y>>2]=g,(d|0)==0&(A|0)==0|((m|0)>15|(g|0)>(m|0))){m=_,h[m>>2]=0,h[m+4>>2]=0,h[y>>2]=-1,h[_+12>>2]=-1;return}if(d=u9(d,A,g+1|0,m)|0,y=(Q()|0)&-15728641,g=ht(m|0,0,52)|0,g=d|g,y=y|(Q()|0),d=_,h[d>>2]=g,h[d+4>>2]=y,d=_+12|0,Ui(g,y)|0){h[d>>2]=m;return}else{h[d>>2]=-1;return}}function b4(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0;if(m=d,A=h[m>>2]|0,m=h[m+4>>2]|0,!((A|0)==0&(m|0)==0)&&(_=et(A|0,m|0,52)|0,Q()|0,_=_&15,E=ht(1,0,(_^15)*3|0)|0,A=pt(E|0,Q()|0,A|0,m|0)|0,m=Q()|0,E=d,h[E>>2]=A,h[E+4>>2]=m,E=d+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=d+12|0,y=_;;){if((y|0)==(b|0)){_=5;break}if(I=(y|0)==(h[M>>2]|0),g=(15-y|0)*3|0,_=et(A|0,m|0,g|0)|0,Q()|0,_=_&7,I&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(I=ht(1,0,g|0)|0,A=pt(A|0,m|0,I|0,Q()|0)|0,m=Q()|0,I=d,h[I>>2]=A,h[I+4>>2]=m,(y|0)>(b|0))y=y+-1|0;else{_=10;break}}if((_|0)==5){I=d,h[I>>2]=0,h[I+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ht(1,0,g|0)|0,b=pt(A|0,m|0,b|0,Q()|0)|0,E=Q()|0,I=d,h[I>>2]=b,h[I+4>>2]=E,h[M>>2]=y+-1;return}else if((_|0)==10)return}}function ix(d){d=+d;var A=0;return A=d<0?d+6.283185307179586:d,+(d>=6.283185307179586?A+-6.283185307179586:A)}function al(d,A){switch(d=+d,A=A|0,A|0){case 1:{d=d<0?d+6.283185307179586:d;break}case 2:{d=d>0?d+-6.283185307179586:d;break}default:}return+d}function Bre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+na(+ +ns(+m),+ +ns(+(1-m)))*2)}function rx(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+na(+ +ns(+m),+ +ns(+(1-m)))*2*6371.007180918475)}function Ure(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+na(+ +ns(+m),+ +ns(+(1-m)))*2*6371.007180918475*1e3)}function p9(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20624+(d<<3)>>3],A=0,A|0)}function kre(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20752+(d<<3)>>3],A=0,A|0)}function Gre(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20880+(d<<3)>>3],A=0,A|0)}function zre(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[21008+(d<<3)>>3],A=0,A|0)}function qb(d,A){d=d|0,A=A|0;var m=0;return d>>>0>15?(A=4,A|0):(m=nd(7,0,d,((d|0)<0)<<31>>31)|0,m=lr(m|0,Q()|0,120,0)|0,d=Q()|0,h[A>>2]=m|2,h[A+4>>2]=d,A=0,A|0)}function Vre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ex(d,A,b)|0,d|0)return b=d,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+_)*+Qn(+I)*M),y=y+ +na(+ +ns(+M),+ +ns(+(1-M)))*2;while((d|0)<(A|0));return ne[m>>3]=y,b=0,Y=E,b|0}function qre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ex(d,A,b)|0,d|0)return b=d,y=+ne[m>>3],y=y*6371.007180918475,ne[m>>3]=y,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,y=0,y=y*6371.007180918475,ne[m>>3]=y,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +na(+ +ns(+M),+ +ns(+(1-M)))*2;while((d|0)!=(A|0));return ne[m>>3]=y,b=0,O=y,O=O*6371.007180918475,ne[m>>3]=O,Y=E,b|0}function Hre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ex(d,A,b)|0,d|0)return b=d,y=+ne[m>>3],y=y*6371.007180918475,y=y*1e3,ne[m>>3]=y,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,y=0,y=y*6371.007180918475,y=y*1e3,ne[m>>3]=y,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +na(+ +ns(+M),+ +ns(+(1-M)))*2;while((d|0)!=(A|0));return ne[m>>3]=y,b=0,O=y,O=O*6371.007180918475,O=O*1e3,ne[m>>3]=O,Y=E,b|0}function Wre(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0;if(d)for(y=d+4|0,b=d+8|0,_=1,g=d;;){if(A=h[g>>2]|0,A|0)do{if(m=h[A>>2]|0,m|0)do E=m,m=h[m+16>>2]|0,_t(E);while((m|0)!=0);E=A,A=h[A+8>>2]|0,_t(E)}while((A|0)!=0);if(A=g,g=h[g+8>>2]|0,_?(h[d>>2]=0,h[y>>2]=0,h[b>>2]=0):_t(A),g)_=0;else break}}function jre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(h[A>>2]=0,ue=A+4|0,h[ue>>2]=0,_e=A+8|0,h[_e>>2]=0,oe=h[d>>2]|0,(oe|0)<=0)return A=0,A|0;$=d+4|0,d=A,W=0;e:for(;;){if(W){if(m=ia(1,12)|0,!m){m=5;break}h[d+8>>2]=m,d=m}if(M=h[$>>2]|0,I=ia(1,12)|0,!I){d=13,m=37;break}if(q=d+4|0,_=h[q>>2]|0,h[((_|0)==0?d:_+8|0)>>2]=I,h[q>>2]=I,_=h[M+(W<<4)>>2]|0,(_|0)<3){d=1,m=37;break}g=M+(W<<4)+4|0,y=I+4|0,m=0,b=0;do{if(E=b,b=ar(24)|0,!b){d=13,m=37;break e}P4(b|0,(h[g>>2]|0)+(m<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[I>>2]=b,h[y>>2]=b,m=m+1|0}while((m|0)<(_|0));if(G=h[M+(W<<4)+8>>2]|0,(G|0)>0){O=M+(W<<4)+12|0,M=0;do{if(_=h[O>>2]|0,m=I,I=ia(1,12)|0,!I){d=13,m=37;break e}if(h[m+8>>2]=I,h[q>>2]=I,E=h[_+(M<<3)>>2]|0,(E|0)<3){d=1,m=37;break e}_=_+(M<<3)+4|0,g=I+4|0,m=0,y=0;do{if(b=y,y=ar(24)|0,!y){d=13,m=37;break e}P4(y|0,(h[_>>2]|0)+(m<<4)|0,16)|0,h[y+16>>2]=0,b?h[b+16>>2]=y:h[I>>2]=y,h[g>>2]=y,m=m+1|0}while((m|0)<(E|0));M=M+1|0}while((M|0)<(G|0))}if(W=W+1|0,(W|0)>=(oe|0)){d=0,m=50;break}}if((m|0)==5){if(!A)return A=13,A|0;for(_=1,g=A;;){if(d=h[g>>2]|0,d|0)do{if(m=h[d>>2]|0,m|0)do oe=m,m=h[m+16>>2]|0,_t(oe);while((m|0)!=0);oe=d,d=h[d+8>>2]|0,_t(oe)}while((d|0)!=0);if(d=g,g=h[g+8>>2]|0,_?(h[A>>2]=0,h[ue>>2]=0,h[_e>>2]=0):_t(d),g)_=0;else{d=13;break}}return d|0}else if((m|0)==37){if(!A)return A=d,A|0;for(g=1,y=A;;){if(m=h[y>>2]|0,m|0)do{if(_=h[m>>2]|0,_|0)do oe=_,_=h[_+16>>2]|0,_t(oe);while((_|0)!=0);oe=m,m=h[m+8>>2]|0,_t(oe)}while((m|0)!=0);if(m=y,y=h[y+8>>2]|0,g?(h[A>>2]=0,h[ue>>2]=0,h[_e>>2]=0):_t(m),y)g=0;else break}return d|0}else if((m|0)==50)return d|0;return 0}function sx(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if(_e=Y,Y=Y+16|0,ue=_e,O=et(d|0,A|0,52)|0,Q()|0,O=O&15,W=et(m|0,_|0,52)|0,Q()|0,(O|0)!=(W&15|0))return ue=12,Y=_e,ue|0;if(M=et(d|0,A|0,45)|0,Q()|0,M=M&127,I=et(m|0,_|0,45)|0,Q()|0,I=I&127,M>>>0>121|I>>>0>121)return ue=5,Y=_e,ue|0;if(W=(M|0)!=(I|0),W){if(b=l4(M,I)|0,(b|0)==7)return ue=1,Y=_e,ue|0;E=l4(I,M)|0,(E|0)==7?li(27291,27315,164,27325):(oe=b,y=E)}else oe=0,y=0;G=or(M)|0,q=or(I)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(oe){I=h[4272+(M*28|0)+(oe<<2)>>2]|0,b=(I|0)>0;e:do if(q)if(b)for(M=0,E=m,b=_;;){switch(E=Ire(E,b)|0,b=Q()|0,y|0){case 5:case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}default:}if(M=M+1|0,(M|0)==(I|0)){I=y,M=E,E=b;break e}}else I=y,M=m,E=_;else if(b)for(M=0,E=m,b=_;;){switch(E=g4(E,b)|0,b=Q()|0,y|0){case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}case 5:{y=1;break}default:}if(M=M+1|0,(M|0)==(I|0)){I=y,M=E,E=b;break e}}else I=y,M=m,E=_;while(!1);if(x4(M,E,ue)|0,W||li(27340,27315,194,27325),b=(G|0)!=0,y=(q|0)!=0,b&y&&li(27367,27315,195,27325),b){if(y=Fa(d,A)|0,(y|0)==7){y=5;break}if(He[21968+(y*7|0)+oe>>0]|0){y=1;break}q=h[21136+(y*28|0)+(oe<<2)>>2]|0,W=q}else if(y){if(y=Fa(M,E)|0,(y|0)==7){y=5;break}if(He[21968+(y*7|0)+I>>0]|0){y=1;break}W=0,q=h[21136+(I*28|0)+(y<<2)>>2]|0}else W=0,q=0;if((W|q|0)>=0){if((q|0)>0){m=ue+4|0,_=ue+8|0,G=ue+12|0,I=0,E=h[m>>2]|0,b=h[_>>2]|0,y=h[G>>2]|0;do $=b+E|0,A=($|0)<0,re=A?$:0,b=y+b-re|0,d=(b|0)<0,M=d?b:0,E=y+E-re-M|0,re=(E|0)<0,y=re?0:E,E=re?E:0,b=(d?0:b)-E|0,E=(A?0:$)-M-E|0,M=(b|0)<(E|0)?b:E,M=(y|0)<(M|0)?y:M,(M|0)>0&&(E=E-M|0,b=b-M|0,y=y-M|0),I=I+1|0;while((I|0)!=(q|0));h[m>>2]=E,h[_>>2]=b,h[G>>2]=y}if((oe+-1|0)>>>0<6?(y=h[22032+(oe*12|0)>>2]|0,E=h[22032+(oe*12|0)+4>>2]|0,re=h[22032+(oe*12|0)+8>>2]|0,b=(E|0)<(y|0)?E:y,b=(re|0)<(b|0)?re:b,b=(b|0)>0?b:0,y=y-b|0,E=E-b|0,b=re-b|0):(y=0,E=0,b=0),O)for(;;)if(M=y*3|0,I=E*3|0,m=b*3|0,Bl(O)|0?(A=M+E|0,d=(A|0)<0,re=I+b-(d?A:0)|0,$=(re|0)<0,E=y+m-(d?A:0)-($?re:0)|0,b=(E|0)<0,oe=b?0:E,M=($?0:re)-(b?E:0)|0,E=(d?0:A)-($?re:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(oe|0)<(b|0)?oe:b,re=(b|0)>0,y=re?b:0,M=M-(re?b:0)|0,b=oe-(re?b:0)|0):($=M+b|0,A=($|0)<0,re=I+y-(A?$:0)|0,y=(re|0)<0,E=m+E-(A?$:0)-(y?re:0)|0,b=(E|0)<0,oe=b?0:E,M=(y?0:re)-(b?E:0)|0,E=(A?0:$)-(y?re:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(oe|0)<(b|0)?oe:b,re=(b|0)>0,y=re?b:0,M=M-(re?b:0)|0,b=oe-(re?b:0)|0),y=E-y|0,(O|0)>1)O=O+-1|0,E=M;else{E=M;break}if((W|0)>0){M=0;do A=y+E|0,d=(A|0)<0,re=E+b-(d?A:0)|0,$=(re|0)<0,oe=y+b-(d?A:0)-($?re:0)|0,y=(oe|0)<0,b=y?0:oe,E=($?0:re)-(y?oe:0)|0,oe=(d?0:A)-($?re:0)-(y?oe:0)|0,y=(E|0)<(oe|0)?E:oe,y=(b|0)<(y|0)?b:y,re=(y|0)>0,b=b-(re?y:0)|0,E=E-(re?y:0)|0,y=oe-(re?y:0)|0,M=M+1|0;while((M|0)!=(W|0))}m=ue+4|0,O=ue+8|0,oe=h[O>>2]|0,_=ue+12|0,re=h[_>>2]|0,M=(h[m>>2]|0)+y|0,h[m>>2]=M,E=oe+E|0,h[O>>2]=E,y=re+b|0,h[_>>2]=y,b=E-M|0,(M|0)<0?(y=y-M|0,h[O>>2]=b,h[_>>2]=y,h[m>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[m>>2]=E,y=y-b|0,h[_>>2]=y,h[O>>2]=0,b=0),I=E-y|0,M=b-y|0,(y|0)<0?(h[m>>2]=I,h[O>>2]=M,h[_>>2]=0,E=I,y=0):M=b,b=(M|0)<(E|0)?M:E,b=(y|0)<(b|0)?y:b,(b|0)>0&&(h[m>>2]=E-b,h[O>>2]=M-b,h[_>>2]=y-b),$=77}else y=5}else if(x4(m,_,ue)|0,(G|0)!=0&(q|0)!=0)if((I|0)!=(M|0)&&li(27398,27315,264,27325),b=Fa(d,A)|0,y=Fa(m,_)|0,(b|0)==7|(y|0)==7)y=5;else if(He[21968+(b*7|0)+y>>0]|0)y=1;else if(m=h[21136+(b*28|0)+(y<<2)>>2]|0,(m|0)>0){O=ue+4|0,_=ue+8|0,G=ue+12|0,I=0,E=h[O>>2]|0,b=h[_>>2]|0,y=h[G>>2]|0;do oe=b+E|0,$=(oe|0)<0,d=$?oe:0,b=y+b-d|0,A=(b|0)<0,M=A?b:0,E=y+E-d-M|0,d=(E|0)<0,y=d?0:E,E=d?E:0,b=(A?0:b)-E|0,E=($?0:oe)-M-E|0,M=(b|0)<(E|0)?b:E,M=(y|0)<(M|0)?y:M,(M|0)>0&&(E=E-M|0,b=b-M|0,y=y-M|0),I=I+1|0;while((I|0)!=(m|0));h[O>>2]=E,h[_>>2]=b,h[G>>2]=y,$=77}else $=77;else $=77;while(!1);return($|0)==77&&(y=ue+4|0,h[g>>2]=h[y>>2],h[g+4>>2]=h[y+4>>2],h[g+8>>2]=h[y+8>>2],y=0),re=y,Y=_e,re|0}function A9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,me=et(d|0,A|0,45)|0,Q()|0,me=me&127,me>>>0>121)return _=5,_|0;if(ue=or(me)|0,ht(y|0,0,52)|0,E=Q()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[m>>2]|0,E=h[m+4>>2]|0,m=h[m+8>>2]|0,!y){A=(b|0)<0,_e=A?b:0,be=E-_e|0,ue=(be|0)<0,_e=(ue?0-be|0:0)+(m-_e)|0,m=(_e|0)<0,g=m?0:_e,_e=m?_e:0,m=(ue?0:be)-_e|0,_e=(A?0:b)-(ue?be:0)-_e|0,be=(m|0)<(_e|0)?m:_e,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,m=m-be|0;e:do switch(_e-be|0){case 0:switch(m|0){case 0:if(g){g=(g|0)==1?1:7,re=11;break e}else{g=0;break e}case 1:if(g){g=(g|0)==1?3:7,re=11;break e}else{g=2;break e}default:return _=1,_|0}case 1:switch(m|0){case 0:if(g){g=(g|0)==1?5:7,re=11;break e}else{g=4;break e}case 1:{if(g)g=1;else{g=6;break e}return g|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(re|0)==11&&(g|0)==7||(g=a4(me,g)|0,(g|0)==127)?(_=1,_|0):(be=ht(g|0,0,45)|0,me=Q()|0,re=_,me=h[re+4>>2]&-1040385|me,h[_>>2]=h[re>>2]|be,h[_+4>>2]=me,_=0,_|0)}for(;;){if(oe=y,y=y+-1|0,$=b-m|0,W=E-m|0,M=$>>>0>715827881|W>>>0>715827881,Bl(oe)|0){if(M){if(O=($|0)>0,G=2147483647-$|0,q=-2147483648-$|0,O?(G|0)<($|0):(q|0)>($|0)){g=1,re=107;break}if(ye=$<<1,O?(2147483647-ye|0)<($|0):(-2147483648-ye|0)>($|0)){g=1,re=107;break}if((W|0)>0?(2147483647-W|0)<(W|0):(-2147483648-W|0)>(W|0)){g=1,re=107;break}if(M=$*3|0,I=W<<1,(O?(G|0)<(I|0):(q|0)>(I|0))||(($|0)>-1?(M|-2147483648|0)>=(W|0):(M^-2147483648|0)<(W|0))){g=1,re=107;break}}else M=$*3|0,I=W<<1;if(G=du(+(M-W|0)*.14285714285714285)|0,O=du(+(I+$|0)*.14285714285714285)|0,I=(O|0)<(G|0),M=I?G:O,I=I?O:G,(I|0)<0){if((I|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(I|0):(-2147483648-M|0)>(I|0))){re=24;break}if((M|0)>-1?(M|-2147483648|0)>=(I|0):(M^-2147483648|0)<(I|0)){re=24;break}}q=(G|0)<0,W=O-(q?G:0)|0,Ze=(W|0)<0,Fe=(q?0-G|0:0)-(Ze?W:0)|0,$=(Fe|0)<0,q=(q?0:G)-(Ze?W:0)-($?Fe:0)|0,W=(Ze?0:W)-($?Fe:0)|0,Fe=$?0:Fe,$=(W|0)<(q|0)?W:q,$=(Fe|0)<($|0)?Fe:$,Ze=($|0)>0,q=q-(Ze?$:0)|0,W=W-(Ze?$:0)|0,$=Fe-(Ze?$:0)|0,Ze=(q*3|0)+W|0,Fe=(Ze|0)<0,ye=(W*3|0)+$-(Fe?Ze:0)|0,M=(ye|0)<0,G=($*3|0)+q-(Fe?Ze:0)-(M?ye:0)|0,O=(G|0)<0,Ee=O?0:G,I=(M?0:ye)-(O?G:0)|0,G=(Fe?0:Ze)-(M?ye:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ee|0)<(O|0)?Ee:O,ye=(O|0)>0,M=ye?O:0,I=I-(ye?O:0)|0,O=Ee-(ye?O:0)|0}else{if(M){if(I=($|0)>0,I?(2147483647-$|0)<($|0):(-2147483648-$|0)>($|0)){g=1,re=107;break}if(M=$<<1,O=(W|0)>0,O?(2147483647-W|0)<(W|0):(-2147483648-W|0)>(W|0)){g=1,re=107;break}if(q=W<<1,O?(2147483647-q|0)<(W|0):(-2147483648-q|0)>(W|0)){g=1,re=107;break}if(I?(2147483647-M|0)<(W|0):(-2147483648-M|0)>(W|0)){g=1,re=107;break}if(I=W*3|0,(W|0)>-1?(I|-2147483648|0)>=($|0):(I^-2147483648|0)<($|0)){g=1,re=107;break}}else M=$<<1,I=W*3|0;if(G=du(+(M+W|0)*.14285714285714285)|0,O=du(+(I-$|0)*.14285714285714285)|0,I=(O|0)<(G|0),M=I?G:O,I=I?O:G,(I|0)<0){if((I|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(I|0):(-2147483648-M|0)>(I|0))){re=36;break}if((M|0)>-1?(M|-2147483648|0)>=(I|0):(M^-2147483648|0)<(I|0)){re=36;break}}q=(G|0)<0,W=O-(q?G:0)|0,Ee=(W|0)<0,ye=(q?0-G|0:0)-(Ee?W:0)|0,$=(ye|0)<0,q=(q?0:G)-(Ee?W:0)-($?ye:0)|0,W=(Ee?0:W)-($?ye:0)|0,ye=$?0:ye,$=(W|0)<(q|0)?W:q,$=(ye|0)<($|0)?ye:$,Ee=($|0)>0,q=q-(Ee?$:0)|0,W=W-(Ee?$:0)|0,$=ye-(Ee?$:0)|0,Ee=(q*3|0)+$|0,ye=(Ee|0)<0,Fe=(W*3|0)+q-(ye?Ee:0)|0,M=(Fe|0)<0,G=($*3|0)+W-(ye?Ee:0)-(M?Fe:0)|0,O=(G|0)<0,Ze=O?0:G,I=(M?0:Fe)-(O?G:0)|0,G=(ye?0:Ee)-(M?Fe:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ze|0)<(O|0)?Ze:O,Fe=(O|0)>0,M=Fe?O:0,I=I-(Fe?O:0)|0,O=Ze-(Fe?O:0)|0}M=b+(M-G)|0,Ee=(M|0)<0,I=E-I-(Ee?M:0)|0,G=(I|0)<0,Fe=m-O+(Ee?0-M|0:0)+(G?0-I|0:0)|0,b=(Fe|0)<0,O=b?0:Fe,ye=(G?0:I)-(b?Fe:0)|0,Fe=(Ee?0:M)-(G?I:0)-(b?Fe:0)|0,b=(ye|0)<(Fe|0)?ye:Fe,b=(O|0)<(b|0)?O:b,m=(b|0)>0,Fe=Fe-(m?b:0)|0,I=_,G=h[I>>2]|0,I=h[I+4>>2]|0,E=(15-oe|0)*3|0,M=ht(7,0,E|0)|0,M=G&~M,I=I&~(Q()|0),G=(Fe|0)<0,Ee=G?Fe:0,ye=ye-(m?b:0)-Ee|0,Ze=(ye|0)<0,Ee=(Ze?0-ye|0:0)+(O-(m?b:0)-Ee)|0,b=(Ee|0)<0,m=b?0:Ee,Ee=b?Ee:0,b=(Ze?0:ye)-Ee|0,Ee=(G?0:Fe)-(Ze?ye:0)-Ee|0,ye=(b|0)<(Ee|0)?b:Ee,ye=(m|0)<(ye|0)?m:ye,ye=(ye|0)>0?ye:0,m=m-ye|0,b=b-ye|0;e:do switch(Ee-ye|0){case 0:switch(b|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break e}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break e}default:{re=45;break e}}case 1:switch(b|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break e}case 1:if(m){re=45;break e}else{m=6;break e}default:{re=45;break e}}default:re=45}while(!1);if((re|0)==45&&(re=0,m=7),Ze=ht(m|0,0,E|0)|0,Ee=Q()|0|I,ye=_,h[ye>>2]=Ze|M,h[ye+4>>2]=Ee,(oe|0)<=1){re=47;break}else b=q,E=W,m=$}if((re|0)==24)li(27634,27425,416,27447);else if((re|0)==36)li(27634,27425,464,27461);else if((re|0)==47){if((q|0)>1|(W|0)>1|($|0)>1)return ye=1,ye|0;Fe=(q|0)<0,Ee=Fe?q:0,ye=W-Ee|0,Ze=(ye|0)<0,Ee=(Ze?0-ye|0:0)+($-Ee)|0,y=(Ee|0)<0,m=y?0:Ee,Ee=y?Ee:0,y=(Ze?0:ye)-Ee|0,Ee=(Fe?0:q)-(Ze?ye:0)-Ee|0,ye=(y|0)<(Ee|0)?y:Ee,ye=(m|0)<(ye|0)?m:ye,ye=(ye|0)>0?ye:0,m=m-ye|0,y=y-ye|0;e:do switch(Ee-ye|0){case 0:switch(y|0){case 0:{y=(m|0)==0?0:(m|0)==1?1:7;break e}case 1:{y=(m|0)==0?2:(m|0)==1?3:7;break e}default:{re=55;break e}}case 1:switch(y|0){case 0:{y=(m|0)==0?4:(m|0)==1?5:7;break e}case 1:if(m){re=55;break e}else{y=6;break e}default:{re=55;break e}}default:re=55}while(!1);(re|0)==55&&(y=7),E=a4(me,y)|0,(E|0)==127?I=0:I=or(E)|0;e:do if(y){if(ue){if(m=Fa(d,A)|0,(m|0)==7)return ye=5,ye|0;b=h[21344+(m*28|0)+(y<<2)>>2]|0;t:do if((b|0)>0)for(m=y,y=0;;){switch(m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}if(y=y+1|0,(y|0)==(b|0))break t}else m=y;while(!1);if((m|0)==1)return ye=9,ye|0;y=a4(me,m)|0,(y|0)==127&&li(27476,27315,415,27506),or(y)|0?li(27521,27315,416,27506):(g=y,be=b,_e=m)}else g=E,be=0,_e=y;if(M=h[4272+(me*28|0)+(_e<<2)>>2]|0,(M|0)<=-1&&li(27552,27315,423,27506),!I){if((be|0)<0)return ye=5,ye|0;if(be|0){b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=T0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,m=m+1|0;while((m|0)<(be|0))}if((M|0)<=0){re=104;break}for(b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;;)if(y=T0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,m=m+1|0,(m|0)==(M|0)){re=104;break e}}if(E=l4(g,me)|0,(E|0)==7&&li(27291,27315,432,27506),m=_,y=h[m>>2]|0,m=h[m+4>>2]|0,(M|0)>0){b=0;do y=T0(y,m)|0,m=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=m,b=b+1|0;while((b|0)!=(M|0))}if(m=Fa(y,m)|0,(m|0)==7&&li(27634,27315,444,27506),y=o4(g)|0,y=h[(y?21760:21552)+(E*28|0)+(m<<2)>>2]|0,(y|0)<0&&li(27634,27315,458,27506),!y)re=104;else{E=_,m=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=m4(b,E)|0,E=Q()|0,ye=_,h[ye>>2]=b,h[ye+4>>2]=E,m=m+1|0;while((m|0)<(y|0));re=104}}else if((ue|0)!=0&(I|0)!=0){if(g=Fa(d,A)|0,m=_,m=Fa(h[m>>2]|0,h[m+4>>2]|0)|0,(g|0)==7|(m|0)==7||(m=h[21344+(g*28|0)+(m<<2)>>2]|0,(m|0)<0))return ye=5,ye|0;if(!m)g=E,re=105;else{b=_,g=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=T0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,g=g+1|0;while((g|0)<(m|0));g=E,re=104}}else g=E,re=104;while(!1);return(re|0)==104&&I&&(re=105),(re|0)==105&&(ye=_,(Fa(h[ye>>2]|0,h[ye+4>>2]|0)|0)==1)?(ye=9,ye|0):(Ee=_,Fe=h[Ee>>2]|0,Ee=h[Ee+4>>2]&-1040385,Ze=ht(g|0,0,45)|0,Ee=Ee|(Q()|0),ye=_,h[ye>>2]=Fe|Ze,h[ye+4>>2]=Ee,ye=0,ye|0)}else if((re|0)==107)return g|0;return 0}function Xre(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0;return E=Y,Y=Y+16|0,b=E,g|0?(b=15,Y=E,b|0):(d=sx(d,A,m,_,b)|0,d||(g=h[b+4>>2]|0,d=h[b+8>>2]|0,h[y>>2]=(h[b>>2]|0)-d,h[y+4>>2]=g-d,d=0),b=d,Y=E,b|0)}function $re(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;return G=Y,Y=Y+16|0,O=G,_|0?(O=15,Y=G,O|0):(E=h[m>>2]|0,b=h[m+4>>2]|0,h[O>>2]=E,M=O+4|0,h[M>>2]=b,I=O+8|0,h[I>>2]=0,m=(b|0)<(E|0),_=m?E:b,m=m?b:E,(m|0)<0?!((m|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(m|0):(-2147483648-_|0)>(m|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(m|0):(_^-2147483648|0)<(m|0))?y=5:_=1:y=5,(y|0)==5&&(_=b-E|0,y=0-E|0,(E|0)<0?(h[M>>2]=_,h[I>>2]=y,h[O>>2]=0,E=0):(_=b,y=0),b=E-_|0,m=y-_|0,(_|0)<0?(h[O>>2]=b,h[I>>2]=m,h[M>>2]=0,E=b,_=0):m=y,b=E-m|0,y=_-m|0,(m|0)<0?(h[O>>2]=b,h[M>>2]=y,h[I>>2]=0,m=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[O>>2]=b-_,h[M>>2]=y-_,h[I>>2]=m-_),_=A9(d,A,O,g)|0),O=_,Y=G,O|0)}function w4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0;return M=Y,Y=Y+32|0,b=M+12|0,E=M,y=sx(d,A,d,A,b)|0,y|0?(E=y,Y=M,E|0):(d=sx(d,A,m,_,E)|0,d|0?(E=d,Y=M,E|0):(d=(h[b>>2]|0)-(h[E>>2]|0)|0,I=(d|0)<0,_=I?0-d|0:0,m=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,A=(m|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(A?0-m|0:0)|0,y=(_|0)<0,b=y?0:_,_=y?_:0,y=(A?0:m)-_|0,_=(I?0:d)-(A?m:0)-_|0,E=(y|0)<(_|0)?y:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,y=y-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,y=(y|0)>-1?y:0-y|0,b=(b|0)>-1?b:0-b|0,b=(y|0)>(b|0)?y:b,b=(E|0)>(b|0)?E:b,E=g,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Y=M,E|0))}function Yre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0;return b=Y,Y=Y+16|0,y=b,d=w4(d,A,m,_,y)|0,d|0?(y=d,Y=b,y|0):(m=y,m=pt(h[m>>2]|0,h[m+4>>2]|0,1,0)|0,_=Q()|0,y=g,h[y>>2]=m,h[y+4>>2]=_,y=0,Y=b,y|0)}function Zre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0;return M=Y,Y=Y+16|0,y=M,b=w4(d,A,m,_,y)|0,b|0?(g=b,Y=M,g|0):(b=y,y=h[b>>2]|0,b=h[b+4>>2]|0,(y|0)==0&(b|0)==0?(h[g>>2]=d,h[g+4>>2]=A,g=0,Y=M,g|0):(E=m9(d,A,m,_,y,b,g,0,0,1,0)|0,E?(g=(m9(m,_,d,A,y,b,g,y,b,-1,-1)|0)==0,g=g?0:E,Y=M,g|0):(g=0,Y=M,g|0)))}function m9(d,A,m,_,g,y,b,E,M,I,O){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0,E=E|0,M=M|0,I=I|0,O=O|0;var G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0;if(Ot=Y,Y=Y+48|0,G=Ot+24|0,q=Ot+12|0,We=Ot,h[G>>2]=0,h[G+4>>2]=0,h[G+8>>2]=0,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,sx(d,A,d,A,G)|0&&li(27634,27315,696,27575),sx(d,A,m,_,q)|0&&li(27634,27315,701,27575),oe=G+8|0,_=h[oe>>2]|0,m=_-(h[G>>2]|0)|0,h[G>>2]=m,At=G+4|0,_=(h[At>>2]|0)-_|0,h[At>>2]=_,At=_+m|0,G=0-At|0,h[oe>>2]=G,oe=q+8|0,re=h[oe>>2]|0,_e=re-(h[q>>2]|0)|0,h[q>>2]=_e,ye=q+4|0,re=(h[ye>>2]|0)-re|0,h[ye>>2]=re,ye=re+_e|0,h[oe>>2]=0-ye,Ee=1/(+(g>>>0)+4294967296*+(y|0)),Fe=Ee*+(_e-m|0),Ze=Ee*+(re-_|0),Ee=Ee*+(At-ye|0),h[We>>2]=m,ye=We+4|0,h[ye>>2]=_,At=We+8|0,h[At>>2]=G,(y|0)<0)return I=0,Y=Ot,I|0;for(me=+(m|0),be=+(_|0),ue=+(G|0),_e=0,re=0;;){if($=+(_e>>>0)+4294967296*+(re|0),at=Fe*$+me,W=Ze*$+be,$=Ee*$+ue,_=~~+Kb(+at),G=~~+Kb(+W),m=~~+Kb(+$),at=+Ps(+(+(_|0)-at)),W=+Ps(+(+(G|0)-W)),$=+Ps(+(+(m|0)-$)),at>W&at>$?(q=m+G|0,_=0-q|0):(q=0-_|0,W>$&&(G=q-m|0)),h[ye>>2]=G,h[We>>2]=q,h[At>>2]=0,m=_+G|0,(_|0)>0?(h[ye>>2]=m,h[At>>2]=_,h[We>>2]=0,q=0):(m=G,_=0),(m|0)<0?(G=q-m|0,h[We>>2]=G,_=_-m|0,h[At>>2]=_,h[ye>>2]=0,q=G-_|0,m=0-_|0,(_|0)<0?(h[We>>2]=q,h[ye>>2]=m,h[At>>2]=0,oe=m,_=0):(oe=0,q=G)):oe=m,m=(oe|0)<(q|0)?oe:q,m=(_|0)<(m|0)?_:m,(m|0)>0&&(h[We>>2]=q-m,h[ye>>2]=oe-m,h[At>>2]=_-m),m=lr(_e|0,re|0,I|0,O|0)|0,m=pt(m|0,Q()|0,E|0,M|0)|0,Q()|0,m=A9(d,A,We,b+(m<<3)|0)|0,m|0){_=20;break}if(oe=_e,_e=pt(_e|0,re|0,1,0)|0,q=re,re=Q()|0,!((q|0)<(y|0)|(q|0)==(y|0)&oe>>>0<g>>>0)){m=0,_=20;break}}return(_|0)==20?(Y=Ot,m|0):0}function nd(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if((m|0)==0&(_|0)==0)return g=0,y=1,Ln(g|0),y|0;y=d,g=A,d=1,A=0;do b=(m&1|0)==0&!0,d=lr((b?1:y)|0,(b?0:g)|0,d|0,A|0)|0,A=Q()|0,m=P9(m|0,_|0,1)|0,_=Q()|0,y=lr(y|0,g|0,y|0,g|0)|0,g=Q()|0;while(!((m|0)==0&(_|0)==0));return Ln(A|0),d|0}function S4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;E=Y,Y=Y+16|0,y=E,b=et(d|0,A|0,52)|0,Q()|0,b=b&15;do if(b){if(g=Qm(d,A,y)|0,!g){I=+ne[y>>3],M=1/+Qn(+I),O=+ne[26032+(b<<3)>>3],ne[m>>3]=I+O,ne[m+8>>3]=I-O,I=+ne[y+8>>3],M=O*M,ne[m+16>>3]=M+I,ne[m+24>>3]=I-M;break}return b=g,Y=E,b|0}else{if(g=et(d|0,A|0,45)|0,Q()|0,g=g&127,g>>>0>121)return b=5,Y=E,b|0;y=22128+(g<<5)|0,h[m>>2]=h[y>>2],h[m+4>>2]=h[y+4>>2],h[m+8>>2]=h[y+8>>2],h[m+12>>2]=h[y+12>>2],h[m+16>>2]=h[y+16>>2],h[m+20>>2]=h[y+20>>2],h[m+24>>2]=h[y+24>>2],h[m+28>>2]=h[y+28>>2];break}while(!1);return ure(m,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(d|0)&&(h[_+4>>2]|0)==(A|0)&&(ne[m>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(d|0)&&(h[b+4>>2]|0)==(A|0)&&(ne[m+8>>3]=-1.5707963267948966),+ne[m>>3]!=1.5707963267948966&&+ne[m+8>>3]!=-1.5707963267948966?(b=0,Y=E,b|0):(ne[m+16>>3]=3.141592653589793,ne[m+24>>3]=-3.141592653589793,b=0,Y=E,b|0)}function Kre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;I=Y,Y=Y+48|0,b=I+32|0,y=I+40|0,E=I,p4(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0<=15){if(g=ax(_)|0,g|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=g,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+2>>0]|0;break}if(g=ia((h[A+8>>2]|0)+1|0,32)|0,g){T4(A,g),O=E,h[O>>2]=M,h[O+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=m,h[E+16>>2]=_,h[E+20>>2]=A,h[E+24>>2]=g,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+2>>0]|0;break}else{_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=13,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+2>>0]|0;break}}else M=E,h[M>>2]=0,h[M+4>>2]=0,h[E+8>>2]=4,h[E+12>>2]=-1,M=E+16|0,O=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[y>>0]|0,He[O+1>>0]=He[y+1>>0]|0,He[O+2>>0]=He[y+2>>0]|0;while(!1);Hb(E),h[d>>2]=h[E>>2],h[d+4>>2]=h[E+4>>2],h[d+8>>2]=h[E+8>>2],h[d+12>>2]=h[E+12>>2],h[d+16>>2]=h[E+16>>2],h[d+20>>2]=h[E+20>>2],h[d+24>>2]=h[E+24>>2],h[d+28>>2]=h[E+28>>2],Y=I}function Hb(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0;if(me=Y,Y=Y+336|0,W=me+168|0,$=me,_=d,m=h[_>>2]|0,_=h[_+4>>2]|0,(m|0)==0&(_|0)==0){Y=me;return}if(A=d+28|0,He[A>>0]|0?(m=g9(m,_)|0,_=Q()|0):He[A>>0]=1,be=d+20|0,!(h[h[be>>2]>>2]|0)){A=d+24|0,m=h[A>>2]|0,m|0&&_t(m),re=d,h[re>>2]=0,h[re+4>>2]=0,h[d+8>>2]=0,h[be>>2]=0,h[d+12>>2]=-1,h[d+16>>2]=0,h[A>>2]=0,Y=me;return}re=d+16|0,A=h[re>>2]|0,g=A&15;e:do if((m|0)==0&(_|0)==0)_e=d+24|0;else{oe=d+12|0,G=(g|0)==3,O=A&255,M=(g|1|0)==3,q=d+24|0,I=(g+-1|0)>>>0<3,b=(g|2|0)==3,E=$+8|0;t:for(;;){if(y=et(m|0,_|0,52)|0,Q()|0,y=y&15,(y|0)==(h[oe>>2]|0)){switch(O&15){case 0:case 2:case 3:{if(g=Qm(m,_,W)|0,g|0){ue=15;break t}if(E4(h[be>>2]|0,h[q>>2]|0,W)|0){ue=19;break t}break}default:}if(M&&(g=h[(h[be>>2]|0)+4>>2]|0,h[W>>2]=h[g>>2],h[W+4>>2]=h[g+4>>2],h[W+8>>2]=h[g+8>>2],h[W+12>>2]=h[g+12>>2],t9(26896,W)|0)){if(_4(h[(h[be>>2]|0)+4>>2]|0,y,$)|0){ue=25;break}if(g=$,(h[g>>2]|0)==(m|0)&&(h[g+4>>2]|0)==(_|0)){ue=29;break}}if(I){if(g=E0(m,_,W)|0,g|0){ue=32;break}if(S4(m,_,$,0)|0){ue=36;break}if(b&&x9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}if(M&&y9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}}if(G){if(A=S4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=45;break}if(c4(g,W)|0){if(i9($,W),n9(W,h[q>>2]|0)|0){ue=53;break}if(E4(h[be>>2]|0,h[q>>2]|0,E)|0){ue=53;break}if(y9(h[be>>2]|0,h[q>>2]|0,$,W)|0){ue=53;break}}}}do if((y|0)<(h[oe>>2]|0)){if(A=S4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=58;break t}if(!(c4(g,W)|0)){ue=73;break}if(n9(h[q>>2]|0,W)|0&&(i9($,W),x9(h[be>>2]|0,h[q>>2]|0,$,W)|0)){ue=65;break t}if(m=h9(m,_,y+1|0,$)|0,m|0){ue=67;break t}_=$,m=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,m=g9(m,_)|0,_=Q()|0),(m|0)==0&(_|0)==0){_e=q;break e}}switch(ue|0){case 15:{A=h[q>>2]|0,A|0&&_t(A),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,ue=20;break}case 19:{h[d>>2]=m,h[d+4>>2]=_,ue=20;break}case 25:{li(27634,27600,470,27611);break}case 29:{h[d>>2]=m,h[d+4>>2]=_,Y=me;return}case 32:{A=h[q>>2]|0,A|0&&_t(A),_e=d,h[_e>>2]=0,h[_e+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,Y=me;return}case 36:{li(27634,27600,493,27611);break}case 42:{h[d>>2]=m,h[d+4>>2]=_,Y=me;return}case 45:{g|0&&_t(g),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=A,ue=55;break}case 53:{h[d>>2]=m,h[d+4>>2]=_,ue=55;break}case 58:{g|0&&_t(g),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=A,ue=71;break}case 65:{h[d>>2]=m,h[d+4>>2]=_,ue=71;break}case 67:{A=h[q>>2]|0,A|0&&_t(A),_e=d,h[_e>>2]=0,h[_e+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=m,Y=me;return}}if((ue|0)==20){Y=me;return}else if((ue|0)==55){Y=me;return}else if((ue|0)==71){Y=me;return}}while(!1);A=h[_e>>2]|0,A|0&&_t(A),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[d+8>>2]=0,h[be>>2]=0,h[d+12>>2]=-1,h[re>>2]=0,h[_e>>2]=0,Y=me}function g9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+16|0,O=G,_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0;do if(_){for(;m=ht(_+4095|0,0,52)|0,g=Q()|0|A&-15728641,y=(15-_|0)*3|0,b=ht(7,0,y|0)|0,E=Q()|0,m=m|d|b,g=g|E,M=et(d|0,A|0,y|0)|0,Q()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)A=g,d=m;else{I=4;break}if((I|0)==4){m=et(m|0,g|0,45)|0,Q()|0;break}return O=(M|0)==0&(Ui(m,g)|0)!=0,O=ht((O?2:1)+M|0,0,y|0)|0,I=Q()|0|A&~E,O=O|d&~b,Ln(I|0),Y=G,O|0}while(!1);return m=m&127,m>>>0>120?(I=0,O=0,Ln(I|0),Y=G,O|0):(p4(O,0,m+1|0,0),I=h[O+4>>2]|0,O=h[O>>2]|0,Ln(I|0),Y=G,O|0)}function Qre(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;ue=Y,Y=Y+160|0,G=ue+80|0,E=ue+64|0,q=ue+112|0,oe=ue,Kre(G,d,A,m),I=G,v4(E,h[I>>2]|0,h[I+4>>2]|0,A),I=E,M=h[I>>2]|0,I=h[I+4>>2]|0,b=h[G+8>>2]|0,W=q+4|0,h[W>>2]=h[G>>2],h[W+4>>2]=h[G+4>>2],h[W+8>>2]=h[G+8>>2],h[W+12>>2]=h[G+12>>2],h[W+16>>2]=h[G+16>>2],h[W+20>>2]=h[G+20>>2],h[W+24>>2]=h[G+24>>2],h[W+28>>2]=h[G+28>>2],W=oe,h[W>>2]=M,h[W+4>>2]=I,W=oe+8|0,h[W>>2]=b,d=oe+12|0,A=q,m=d+36|0;do h[d>>2]=h[A>>2],d=d+4|0,A=A+4|0;while((d|0)<(m|0));if(q=oe+48|0,h[q>>2]=h[E>>2],h[q+4>>2]=h[E+4>>2],h[q+8>>2]=h[E+8>>2],h[q+12>>2]=h[E+12>>2],(M|0)==0&(I|0)==0)return oe=b,Y=ue,oe|0;m=oe+16|0,O=oe+24|0,G=oe+28|0,b=0,E=0,A=M,d=I;do{if(!((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<_>>>0)){$=4;break}if(I=E,E=pt(E|0,b|0,1,0)|0,b=Q()|0,I=y+(I<<3)|0,h[I>>2]=A,h[I+4>>2]=d,b4(q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0,(A|0)==0&(d|0)==0){if(Hb(m),A=m,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0){$=10;break}d9(d,A,h[G>>2]|0,q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0}I=oe,h[I>>2]=A,h[I+4>>2]=d}while(!((A|0)==0&(d|0)==0));return($|0)==4?(d=oe+40|0,A=h[d>>2]|0,A|0&&_t(A),$=oe+16|0,h[$>>2]=0,h[$+4>>2]=0,h[O>>2]=0,h[oe+36>>2]=0,h[G>>2]=-1,h[oe+32>>2]=0,h[d>>2]=0,d9(0,0,0,q),h[oe>>2]=0,h[oe+4>>2]=0,h[W>>2]=0,oe=14,Y=ue,oe|0):(($|0)==10&&(h[oe>>2]=0,h[oe+4>>2]=0,h[W>>2]=h[O>>2]),oe=h[W>>2]|0,Y=ue,oe|0)}function Jre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0;if(G=Y,Y=Y+48|0,M=G+32|0,E=G+40|0,I=G,!(h[d>>2]|0))return O=_,h[O>>2]=0,h[O+4>>2]=0,O=0,Y=G,O|0;p4(M,0,0,0),b=M,g=h[b>>2]|0,b=h[b+4>>2]|0;do if(A>>>0>15)O=I,h[O>>2]=0,h[O+4>>2]=0,h[I+8>>2]=4,h[I+12>>2]=-1,O=I+16|0,m=I+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[m>>0]=He[E>>0]|0,He[m+1>>0]=He[E+1>>0]|0,He[m+2>>0]=He[E+2>>0]|0,m=4,O=9;else{if(m=ax(m)|0,m|0){M=I,h[M>>2]=0,h[M+4>>2]=0,h[I+8>>2]=m,h[I+12>>2]=-1,M=I+16|0,O=I+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[O>>0]=He[E>>0]|0,He[O+1>>0]=He[E+1>>0]|0,He[O+2>>0]=He[E+2>>0]|0,O=9;break}if(m=ia((h[d+8>>2]|0)+1|0,32)|0,!m){O=I,h[O>>2]=0,h[O+4>>2]=0,h[I+8>>2]=13,h[I+12>>2]=-1,O=I+16|0,m=I+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[m>>0]=He[E>>0]|0,He[m+1>>0]=He[E+1>>0]|0,He[m+2>>0]=He[E+2>>0]|0,m=13,O=9;break}T4(d,m),W=I,h[W>>2]=g,h[W+4>>2]=b,b=I+8|0,h[b>>2]=0,h[I+12>>2]=A,h[I+20>>2]=d,h[I+24>>2]=m,He[I+28>>0]=0,g=I+29|0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,h[I+16>>2]=3,q=+are(m),q=q*+sre(m),y=+Ps(+ +ne[m>>3]),y=q/+Qn(+ +Zb(+y,+ +Ps(+ +ne[m+8>>3])))*6371.007180918475*6371.007180918475,g=I+12|0,m=h[g>>2]|0;e:do if((m|0)>0)do{if(p9(m+-1|0,M)|0,!(y/+ne[M>>3]>10))break e;W=h[g>>2]|0,m=W+-1|0,h[g>>2]=m}while((W|0)>1);while(!1);if(Hb(I),g=_,h[g>>2]=0,h[g+4>>2]=0,g=I,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0))do nx(m,g,A,M)|0,E=M,d=_,E=pt(h[d>>2]|0,h[d+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,d=Q()|0,W=_,h[W>>2]=E,h[W+4>>2]=d,Hb(I),W=I,m=h[W>>2]|0,g=h[W+4>>2]|0;while(!((m|0)==0&(g|0)==0));m=h[b>>2]|0}while(!1);return W=m,Y=G,W|0}function ox(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;if(!(t9(A,m)|0)||(A=ore(A)|0,_=+ne[m>>3],g=+ne[m+8>>3],g=A&g<0?g+6.283185307179586:g,q=h[d>>2]|0,(q|0)<=0))return q=0,q|0;if(G=h[d+4>>2]|0,A){A=0,O=g,m=-1,d=0;e:for(;;){for(I=d;b=+ne[G+(I<<4)>>3],g=+ne[G+(I<<4)+8>>3],d=(m+2|0)%(q|0)|0,y=+ne[G+(d<<4)>>3],E=+ne[G+(d<<4)+8>>3],b>y?(M=b,b=E):(M=y,y=b,b=g,g=E),_=_==y|_==M?_+2220446049250313e-31:_,!!(_<y|_>M);)if(m=I+1|0,(m|0)>=(q|0)){m=22;break e}else d=I,I=m,m=d;if(E=b<0?b+6.283185307179586:b,b=g<0?g+6.283185307179586:g,O=E==O|b==O?O+-2220446049250313e-31:O,M=E+(b-E)*((_-y)/(M-y)),(M<0?M+6.283185307179586:M)>O&&(A=A^1),d=I+1|0,(d|0)>=(q|0)){m=22;break}else m=I}if((m|0)==22)return A|0}else{A=0,O=g,m=-1,d=0;e:for(;;){for(I=d;b=+ne[G+(I<<4)>>3],g=+ne[G+(I<<4)+8>>3],d=(m+2|0)%(q|0)|0,y=+ne[G+(d<<4)>>3],E=+ne[G+(d<<4)+8>>3],b>y?(M=b,b=E):(M=y,y=b,b=g,g=E),_=_==y|_==M?_+2220446049250313e-31:_,!!(_<y|_>M);)if(m=I+1|0,(m|0)>=(q|0)){m=22;break e}else d=I,I=m,m=d;if(O=b==O|g==O?O+-2220446049250313e-31:O,b+(g-b)*((_-y)/(M-y))>O&&(A=A^1),d=I+1|0,(d|0)>=(q|0)){m=22;break}else m=I}if((m|0)==22)return A|0}return 0}function _9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if($=h[d>>2]|0,!$){h[A>>2]=0,h[A+4>>2]=0,h[A+8>>2]=0,h[A+12>>2]=0,h[A+16>>2]=0,h[A+20>>2]=0,h[A+24>>2]=0,h[A+28>>2]=0;return}if(oe=A+8|0,ne[oe>>3]=17976931348623157e292,ue=A+24|0,ne[ue>>3]=17976931348623157e292,ne[A>>3]=-17976931348623157e292,_e=A+16|0,ne[_e>>3]=-17976931348623157e292,!(($|0)<=0)){for(q=h[d+4>>2]|0,I=17976931348623157e292,O=-17976931348623157e292,G=0,d=-1,y=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,W=0;m=+ne[q+(W<<4)>>3],E=+ne[q+(W<<4)+8>>3],d=d+2|0,g=+ne[q+(((d|0)==($|0)?0:d)<<4)+8>>3],m<y&&(ne[oe>>3]=m,y=m),E<b&&(ne[ue>>3]=E,b=E),m>M?ne[A>>3]=m:m=M,E>_&&(ne[_e>>3]=E,_=E),I=E>0&E<I?E:I,O=E<0&E>O?E:O,G=G|+Ps(+(E-g))>3.141592653589793,d=W+1|0,(d|0)!=($|0);)re=W,M=m,W=d,d=re;G&&(ne[_e>>3]=O,ne[ue>>3]=I)}}function ax(d){return d=d|0,(d>>>0<4?0:15)|0}function T4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0;if($=h[d>>2]|0,$){if(oe=A+8|0,ne[oe>>3]=17976931348623157e292,ue=A+24|0,ne[ue>>3]=17976931348623157e292,ne[A>>3]=-17976931348623157e292,_e=A+16|0,ne[_e>>3]=-17976931348623157e292,($|0)>0){for(g=h[d+4>>2]|0,q=17976931348623157e292,W=-17976931348623157e292,_=0,m=-1,M=17976931348623157e292,I=17976931348623157e292,G=-17976931348623157e292,b=-17976931348623157e292,re=0;y=+ne[g+(re<<4)>>3],O=+ne[g+(re<<4)+8>>3],Ze=m+2|0,E=+ne[g+(((Ze|0)==($|0)?0:Ze)<<4)+8>>3],y<M&&(ne[oe>>3]=y,M=y),O<I&&(ne[ue>>3]=O,I=O),y>G?ne[A>>3]=y:y=G,O>b&&(ne[_e>>3]=O,b=O),q=O>0&O<q?O:q,W=O<0&O>W?O:W,_=_|+Ps(+(O-E))>3.141592653589793,m=re+1|0,(m|0)!=($|0);)Ze=re,G=y,re=m,m=Ze;_&&(ne[_e>>3]=W,ne[ue>>3]=q)}}else h[A>>2]=0,h[A+4>>2]=0,h[A+8>>2]=0,h[A+12>>2]=0,h[A+16>>2]=0,h[A+20>>2]=0,h[A+24>>2]=0,h[A+28>>2]=0;if(Ze=d+8|0,m=h[Ze>>2]|0,!((m|0)<=0)){Fe=d+12|0,me=0;do if(g=h[Fe>>2]|0,_=me,me=me+1|0,ue=A+(me<<5)|0,_e=h[g+(_<<3)>>2]|0,_e){if(re=A+(me<<5)+8|0,ne[re>>3]=17976931348623157e292,d=A+(me<<5)+24|0,ne[d>>3]=17976931348623157e292,ne[ue>>3]=-17976931348623157e292,be=A+(me<<5)+16|0,ne[be>>3]=-17976931348623157e292,(_e|0)>0){for($=h[g+(_<<3)+4>>2]|0,q=17976931348623157e292,W=-17976931348623157e292,g=0,_=-1,oe=0,M=17976931348623157e292,I=17976931348623157e292,O=-17976931348623157e292,b=-17976931348623157e292;y=+ne[$+(oe<<4)>>3],G=+ne[$+(oe<<4)+8>>3],_=_+2|0,E=+ne[$+(((_|0)==(_e|0)?0:_)<<4)+8>>3],y<M&&(ne[re>>3]=y,M=y),G<I&&(ne[d>>3]=G,I=G),y>O?ne[ue>>3]=y:y=O,G>b&&(ne[be>>3]=G,b=G),q=G>0&G<q?G:q,W=G<0&G>W?G:W,g=g|+Ps(+(G-E))>3.141592653589793,_=oe+1|0,(_|0)!=(_e|0);)Ee=oe,oe=_,O=y,_=Ee;g&&(ne[be>>3]=W,ne[d>>3]=q)}}else h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0,h[ue+16>>2]=0,h[ue+20>>2]=0,h[ue+24>>2]=0,h[ue+28>>2]=0,m=h[Ze>>2]|0;while((me|0)<(m|0))}}function E4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(!(ox(d,A,m)|0))return g=0,g|0;if(g=d+8|0,(h[g>>2]|0)<=0)return g=1,g|0;for(_=d+12|0,d=0;;){if(y=d,d=d+1|0,ox((h[_>>2]|0)+(y<<3)|0,A+(d<<5)|0,m)|0){d=0,_=6;break}if((d|0)>=(h[g>>2]|0)){d=1,_=6;break}}return(_|0)==6?d|0:0}function x9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(I=Y,Y=Y+16|0,E=I,b=m+8|0,!(ox(d,A,b)|0))return M=0,Y=I,M|0;M=d+8|0;e:do if((h[M>>2]|0)>0){for(y=d+12|0,g=0;;){if(O=g,g=g+1|0,ox((h[y>>2]|0)+(O<<3)|0,A+(g<<5)|0,b)|0){g=0;break}if((g|0)>=(h[M>>2]|0))break e}return Y=I,g|0}while(!1);if(Wb(d,A,m,_)|0)return O=0,Y=I,O|0;h[E>>2]=h[m>>2],h[E+4>>2]=b,g=h[M>>2]|0;e:do if((g|0)>0)for(d=d+12|0,b=0,y=g;;){if(g=h[d>>2]|0,(h[g+(b<<3)>>2]|0)>0){if(ox(E,_,h[g+(b<<3)+4>>2]|0)|0){g=0;break e}if(g=b+1|0,Wb((h[d>>2]|0)+(b<<3)|0,A+(g<<5)|0,m,_)|0){g=0;break e}y=h[M>>2]|0}else g=b+1|0;if((g|0)<(y|0))b=g;else{g=1;break}}else g=1;while(!1);return O=g,Y=I,O|0}function Wb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0;if(Ze=Y,Y=Y+176|0,re=Ze+172|0,g=Ze+168|0,be=Ze,!(c4(A,_)|0))return d=0,Y=Ze,d|0;if(lre(A,_,re,g),_c(be|0,m|0,168)|0,(h[m>>2]|0)>0){A=0;do Ee=be+8+(A<<4)+8|0,_e=+al(+ne[Ee>>3],h[g>>2]|0),ne[Ee>>3]=_e,A=A+1|0;while((A|0)<(h[m>>2]|0))}oe=+ne[_>>3],ue=+ne[_+8>>3],_e=+al(+ne[_+16>>3],h[g>>2]|0),W=+al(+ne[_+24>>3],h[g>>2]|0);e:do if((h[d>>2]|0)>0){if(_=d+4|0,g=h[be>>2]|0,(g|0)<=0){for(A=0;;)if(A=A+1|0,(A|0)>=(h[d>>2]|0)){A=0;break e}}for(m=0;;){if(A=h[_>>2]|0,q=+ne[A+(m<<4)>>3],$=+al(+ne[A+(m<<4)+8>>3],h[re>>2]|0),A=h[_>>2]|0,m=m+1|0,Ee=(m|0)%(h[d>>2]|0)|0,y=+ne[A+(Ee<<4)>>3],b=+al(+ne[A+(Ee<<4)+8>>3],h[re>>2]|0),!(q>=oe)|!(y>=oe)&&!(q<=ue)|!(y<=ue)&&!($<=W)|!(b<=W)&&!($>=_e)|!(b>=_e)){G=y-q,I=b-$,A=0;do if(ye=A,A=A+1|0,Ee=(A|0)==(g|0)?0:A,y=+ne[be+8+(ye<<4)+8>>3],b=+ne[be+8+(Ee<<4)+8>>3]-y,E=+ne[be+8+(ye<<4)>>3],M=+ne[be+8+(Ee<<4)>>3]-E,O=G*b-I*M,O!=0&&(me=$-y,Fe=q-E,M=(me*M-b*Fe)/O,!(M<0|M>1))&&(O=(G*me-I*Fe)/O,O>=0&O<=1)){A=1;break e}while((A|0)<(g|0))}if((m|0)>=(h[d>>2]|0)){A=0;break}}}else A=0;while(!1);return ye=A,Y=Ze,ye|0}function y9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(Wb(d,A,m,_)|0)return y=1,y|0;if(y=d+8|0,(h[y>>2]|0)<=0)return y=0,y|0;for(g=d+12|0,d=0;;){if(b=d,d=d+1|0,Wb((h[g>>2]|0)+(b<<3)|0,A+(d<<5)|0,m,_)|0){d=1,g=6;break}if((d|0)>=(h[y>>2]|0)){d=0,g=6;break}}return(g|0)==6?d|0:0}function ese(){return 8}function tse(){return 16}function nse(){return 168}function ise(){return 8}function rse(){return 16}function sse(){return 12}function ose(){return 8}function ase(d){return d=d|0,+(+((h[d>>2]|0)>>>0)+4294967296*+(h[d+4>>2]|0))}function lse(d){d=d|0;var A=0,m=0;return m=+ne[d>>3],A=+ne[d+8>>3],+ +ns(+(m*m+A*A))}function v9(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;I=+ne[d>>3],M=+ne[A>>3]-I,E=+ne[d+8>>3],b=+ne[A+8>>3]-E,G=+ne[m>>3],y=+ne[_>>3]-G,q=+ne[m+8>>3],O=+ne[_+8>>3]-q,y=(y*(E-q)-(I-G)*O)/(M*O-b*y),ne[g>>3]=I+M*y,ne[g+8>>3]=E+b*y}function b9(d,A){return d=d|0,A=A|0,+Ps(+(+ne[d>>3]-+ne[A>>3]))<11920928955078125e-23?(A=+Ps(+(+ne[d+8>>3]-+ne[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function cse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(y=Y,Y=Y+16|0,g=y,_=Ui(d,A)|0,(m+-1|0)>>>0>5||(_=(_|0)!=0,(m|0)==1&_))return g=-1,Y=y,g|0;do if(lx(d,A,g)|0)_=-1;else if(_){_=((h[26416+(m<<2)>>2]|0)+5-(h[g>>2]|0)|0)%5|0;break}else{_=((h[26448+(m<<2)>>2]|0)+6-(h[g>>2]|0)|0)%6|0;break}while(!1);return g=_,Y=y,g|0}function lx(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=Y,Y=Y+32|0,E=O+16|0,M=O,_=Km(d,A,E)|0,_|0)return m=_,Y=O,m|0;y=c9(d,A)|0,I=Fa(d,A)|0,tre(y,M),_=nre(y,h[E>>2]|0)|0;do if(or(y)|0){do switch(y|0){case 4:{g=0;break}case 14:{g=1;break}case 24:{g=2;break}case 38:{g=3;break}case 49:{g=4;break}case 58:{g=5;break}case 63:{g=6;break}case 72:{g=7;break}case 83:{g=8;break}case 97:{g=9;break}case 107:{g=10;break}case 117:{g=11;break}default:li(27634,27636,75,27645)}while(!1);if(b=h[26480+(g*24|0)+8>>2]|0,A=h[26480+(g*24|0)+16>>2]|0,d=h[E>>2]|0,(d|0)!=(h[M>>2]|0)&&(M=o4(y)|0,d=h[E>>2]|0,M|(d|0)==(A|0)&&(_=(_+1|0)%6|0)),(I|0)==3&(d|0)==(A|0)){_=(_+5|0)%6|0;break}(I|0)==5&(d|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[m>>2]=_,m=0,Y=O,m|0}function Ul(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0;if(be=Y,Y=Y+32|0,re=be+24|0,ue=be+20|0,$=be+8|0,W=be+16|0,q=be,M=(Ui(d,A)|0)==0,M=M?6:5,O=et(d|0,A|0,52)|0,Q()|0,O=O&15,M>>>0<=m>>>0)return _=2,Y=be,_|0;G=(O|0)==0,!G&&(oe=ht(7,0,(O^15)*3|0)|0,(oe&d|0)==0&((Q()|0)&A|0)==0)?g=m:y=4;e:do if((y|0)==4){if(g=(Ui(d,A)|0)!=0,((g?4:5)|0)<(m|0)||lx(d,A,re)|0||(y=(h[re>>2]|0)+m|0,g?g=26768+(((y|0)%5|0)<<2)|0:g=26800+(((y|0)%6|0)<<2)|0,oe=h[g>>2]|0,(oe|0)==7))return _=1,Y=be,_|0;h[ue>>2]=0,g=Is(d,A,oe,ue,$)|0;do if(!g){if(E=$,I=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<A>>>0|(E|0)==(A|0)&I>>>0<d>>>0,y=b?I:d,b=b?E:A,!G&&(G=ht(7,0,(O^15)*3|0)|0,(I&G|0)==0&(E&(Q()|0)|0)==0))g=m;else{if(E=(m+-1+M|0)%(M|0)|0,g=Ui(d,A)|0,(E|0)<0&&li(27634,27636,248,27661),M=(g|0)!=0,((M?4:5)|0)<(E|0)&&li(27634,27636,248,27661),lx(d,A,re)|0&&li(27634,27636,248,27661),g=(h[re>>2]|0)+E|0,M?g=26768+(((g|0)%5|0)<<2)|0:g=26800+(((g|0)%6|0)<<2)|0,E=h[g>>2]|0,(E|0)==7&&li(27634,27636,248,27661),h[W>>2]=0,g=Is(d,A,E,W,q)|0,g|0)break;I=q,M=h[I>>2]|0,I=h[I+4>>2]|0;do if(I>>>0<b>>>0|(I|0)==(b|0)&M>>>0<y>>>0){if(Ui(M,I)|0?y=Gb(M,I,d,A)|0:y=h[26864+((((h[W>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=Ui(M,I)|0,(y+-1|0)>>>0>5){g=-1,y=M,b=I;break}if(g=(g|0)!=0,(y|0)==1&g){g=-1,y=M,b=I;break}do if(lx(M,I,re)|0)g=-1;else if(g){g=((h[26416+(y<<2)>>2]|0)+5-(h[re>>2]|0)|0)%5|0;break}else{g=((h[26448+(y<<2)>>2]|0)+6-(h[re>>2]|0)|0)%6|0;break}while(!1);y=M,b=I}else g=m;while(!1);E=$,I=h[E>>2]|0,E=h[E+4>>2]|0}if((y|0)==(I|0)&(b|0)==(E|0)){if(M=(Ui(I,E)|0)!=0,M?d=Gb(I,E,d,A)|0:d=h[26864+((((h[ue>>2]|0)+(h[26832+(oe<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=Ui(I,E)|0,(d+-1|0)>>>0<=5&&(_e=(g|0)!=0,!((d|0)==1&_e)))do if(lx(I,E,re)|0)g=-1;else if(_e){g=((h[26416+(d<<2)>>2]|0)+5-(h[re>>2]|0)|0)%5|0;break}else{g=((h[26448+(d<<2)>>2]|0)+6-(h[re>>2]|0)|0)%6|0;break}while(!1);else g=-1;g=g+1|0,g=(g|0)==6|M&(g|0)==5?0:g}A=b,d=y;break e}while(!1);return _=g,Y=be,_|0}while(!1);return _e=ht(g|0,0,56)|0,re=Q()|0|A&-2130706433|536870912,h[_>>2]=_e|d,h[_+4>>2]=re,_=0,Y=be,_|0}function use(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return y=(Ui(d,A)|0)==0,_=Ul(d,A,0,m)|0,g=(_|0)==0,y?!g||(_=Ul(d,A,1,m+8|0)|0,_|0)||(_=Ul(d,A,2,m+16|0)|0,_|0)||(_=Ul(d,A,3,m+24|0)|0,_|0)||(_=Ul(d,A,4,m+32|0)|0,_)?(y=_,y|0):Ul(d,A,5,m+40|0)|0:!g||(_=Ul(d,A,1,m+8|0)|0,_|0)||(_=Ul(d,A,2,m+16|0)|0,_|0)||(_=Ul(d,A,3,m+24|0)|0,_|0)||(_=Ul(d,A,4,m+32|0)|0,_|0)?(y=_,y|0):(y=m+40|0,h[y>>2]=0,h[y+4>>2]=0,y=0,y|0)}function hse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0;return M=Y,Y=Y+192|0,g=M,y=M+168|0,b=et(d|0,A|0,56)|0,Q()|0,b=b&7,E=A&-2130706433|134217728,_=Km(d,E,y)|0,_|0?(E=_,Y=M,E|0):(A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Ui(d,E)|0?h4(y,A,b,1,g):f4(y,A,b,1,g),E=g+8|0,h[m>>2]=h[E>>2],h[m+4>>2]=h[E+4>>2],h[m+8>>2]=h[E+8>>2],h[m+12>>2]=h[E+12>>2],E=0,Y=M,E|0)}function w9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=Y,Y=Y+16|0,m=g,!(!0&(A&2013265920|0)==536870912)||(_=A&-2130706433|134217728,!(Vb(d,_)|0))?(_=0,Y=g,_|0):(y=et(d|0,A|0,56)|0,Q()|0,y=(Ul(d,_,y&7,m)|0)==0,_=m,_=y&((h[_>>2]|0)==(d|0)?(h[_+4>>2]|0)==(A|0):0)&1,Y=g,_|0)}function S9(){return 27680}function jb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;G=Y,Y=Y+208|0,M=G,I=G+192|0,b=Da(m,A)|0,E=I,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-m|0,h[M+4>>2]=m,h[M>>2]=m,g=2,A=m,y=m;A=A+m+y|0,h[M+(g<<2)>>2]=A,A>>>0<b>>>0;)q=y,g=g+1|0,y=A,A=q;if(y=d+b+E|0,y>>>0>d>>>0){b=y,g=1,A=1;do{do if((A&3|0)!=3)if(A=g+-1|0,(h[M+(A<<2)>>2]|0)>>>0<(b-d|0)>>>0?M4(d,m,_,g,M):$b(d,m,_,I,g,0,M),(g|0)==1){Yb(I,1),g=0;break}else{Yb(I,A),g=1;break}else M4(d,m,_,g,M),Xb(I,2),g=g+2|0;while(!1);A=h[I>>2]|1,h[I>>2]=A,d=d+m|0}while(d>>>0<y>>>0)}else g=1,A=1;for($b(d,m,_,I,g,0,M),y=I+4|0;;){if((g|0)==1&(A|0)==1)if(h[y>>2]|0)O=19;else break e;else(g|0)<2?O=19:(Yb(I,2),q=g+-2|0,h[I>>2]=h[I>>2]^7,Xb(I,1),$b(d+(0-(h[M+(q<<2)>>2]|0))+E|0,m,_,I,g+-1|0,1,M),Yb(I,1),A=h[I>>2]|1,h[I>>2]=A,d=d+E|0,$b(d,m,_,I,q,1,M),g=q);(O|0)==19&&(O=0,A=T9(I)|0,Xb(I,A),d=d+E|0,g=A+g|0,A=h[I>>2]|0)}}while(!1);Y=G}function M4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+240|0,O=G,h[O>>2]=d;e:do if((_|0)>1)for(I=0-A|0,E=d,y=_,_=1,b=d;;){if(E=E+I|0,M=y+-2|0,d=E+(0-(h[g+(M<<2)>>2]|0))|0,(ad[m&3](b,d)|0)>-1&&(ad[m&3](b,E)|0)>-1||(b=O+(_<<2)|0,(ad[m&3](d,E)|0)>-1?(h[b>>2]=d,y=y+-1|0):(h[b>>2]=E,d=E,y=M),_=_+1|0,(y|0)<=1))break e;E=d,b=h[O>>2]|0}else _=1;while(!1);M9(A,O,_),Y=G}function Xb(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;g=d+4|0,A>>>0>31?(_=h[g>>2]|0,h[d>>2]=_,h[g>>2]=0,A=A+-32|0,m=0):(m=h[g>>2]|0,_=h[d>>2]|0),h[d>>2]=m<<32-A|_>>>A,h[g>>2]=m>>>A}function $b(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;W=Y,Y=Y+240|0,G=W+232|0,q=W,$=h[_>>2]|0,h[G>>2]=$,M=h[_+4>>2]|0,I=G+4|0,h[I>>2]=M,h[q>>2]=d;e:do if(($|0)!=1|(M|0)!=0&&(O=0-A|0,E=d+(0-(h[b+(g<<2)>>2]|0))|0,(ad[m&3](E,d)|0)>=1))for(_=1,y=(y|0)==0,M=E;;){if(y&(g|0)>1){if(y=d+O|0,E=h[b+(g+-2<<2)>>2]|0,(ad[m&3](y,M)|0)>-1){E=10;break e}if((ad[m&3](y+(0-E)|0,M)|0)>-1){E=10;break e}}if(y=_+1|0,h[q+(_<<2)>>2]=M,$=T9(G)|0,Xb(G,$),g=$+g|0,!((h[G>>2]|0)!=1|(h[I>>2]|0)!=0)){_=y,d=M,E=10;break e}if(d=M+(0-(h[b+(g<<2)>>2]|0))|0,(ad[m&3](d,h[q>>2]|0)|0)<1){d=M,_=y,y=0,E=9;break}else $=M,_=y,y=1,M=d,d=$}else _=1,E=9;while(!1);(E|0)==9&&(y|0)==0&&(E=10),(E|0)==10&&(M9(A,q,_),M4(d,A,m,g,b)),Y=W}function Yb(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;g=d+4|0,A>>>0>31?(_=h[d>>2]|0,h[g>>2]=_,h[d>>2]=0,A=A+-32|0,m=0):(m=h[d>>2]|0,_=h[g>>2]|0),h[g>>2]=m>>>(32-A|0)|_<<A,h[d>>2]=m<<A}function T9(d){d=d|0;var A=0;return A=E9((h[d>>2]|0)+-1|0)|0,A?A|0:(A=E9(h[d+4>>2]|0)|0,((A|0)==0?0:A+32|0)|0)}function E9(d){d=d|0;var A=0;if(d)if(d&1)d=0;else for(A=d,d=0;d=d+1|0,!(A&2);)A=A>>>1;else d=32;return d|0}function M9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0;b=Y,Y=Y+256|0,_=b;e:do if((m|0)>=2&&(y=A+(m<<2)|0,h[y>>2]=_,d|0))for(;;){g=d>>>0<256?d:256,_c(_|0,h[A>>2]|0,g|0)|0,_=0;do E=A+(_<<2)|0,_=_+1|0,_c(h[E>>2]|0,h[A+(_<<2)>>2]|0,g|0)|0,h[E>>2]=(h[E>>2]|0)+g;while((_|0)!=(m|0));if(d=d-g|0,!d)break e;_=h[y>>2]|0}while(!1);Y=b}function du(d){return d=+d,~~+N9(+d)|0}function ar(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0;Fe=Y,Y=Y+16|0,q=Fe;do if(d>>>0<245){if(I=d>>>0<11?16:d+11&-8,d=I>>>3,G=h[6921]|0,m=G>>>d,m&3|0)return A=(m&1^1)+d|0,d=27724+(A<<1<<2)|0,m=d+8|0,_=h[m>>2]|0,g=_+8|0,y=h[g>>2]|0,(y|0)==(d|0)?h[6921]=G&~(1<<A):(h[y+12>>2]=d,h[m>>2]=y),me=A<<3,h[_+4>>2]=me|3,me=_+me+4|0,h[me>>2]=h[me>>2]|1,me=g,Y=Fe,me|0;if(O=h[6923]|0,I>>>0>O>>>0){if(m|0)return A=2<<d,A=m<<d&(A|0-A),A=(A&0-A)+-1|0,E=A>>>12&16,A=A>>>E,m=A>>>5&8,A=A>>>m,y=A>>>2&4,A=A>>>y,d=A>>>1&2,A=A>>>d,_=A>>>1&1,_=(m|E|y|d|_)+(A>>>_)|0,A=27724+(_<<1<<2)|0,d=A+8|0,y=h[d>>2]|0,E=y+8|0,m=h[E>>2]|0,(m|0)==(A|0)?(d=G&~(1<<_),h[6921]=d):(h[m+12>>2]=A,h[d>>2]=m,d=G),me=_<<3,b=me-I|0,h[y+4>>2]=I|3,g=y+I|0,h[g+4>>2]=b|1,h[y+me>>2]=b,O|0&&(_=h[6926]|0,A=O>>>3,m=27724+(A<<1<<2)|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=_,h[A+12>>2]=_,h[_+8>>2]=A,h[_+12>>2]=m),h[6923]=b,h[6926]=g,me=E,Y=Fe,me|0;if(y=h[6922]|0,y){for(m=(y&0-y)+-1|0,g=m>>>12&16,m=m>>>g,_=m>>>5&8,m=m>>>_,b=m>>>2&4,m=m>>>b,E=m>>>1&2,m=m>>>E,M=m>>>1&1,M=h[27988+((_|g|b|E|M)+(m>>>M)<<2)>>2]|0,m=M,E=M,M=(h[M+4>>2]&-8)-I|0;d=h[m+16>>2]|0,!(!d&&(d=h[m+20>>2]|0,!d));)b=(h[d+4>>2]&-8)-I|0,g=b>>>0<M>>>0,m=d,E=g?d:E,M=g?b:M;if(b=E+I|0,b>>>0>E>>>0){g=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+20|0,A=h[d>>2]|0,!A&&(d=E+16|0,A=h[d>>2]|0,!A)){m=0;break}for(;;)if(_=A+20|0,m=h[_>>2]|0,m)A=m,d=_;else if(_=A+16|0,m=h[_>>2]|0,m)A=m,d=_;else break;h[d>>2]=0,m=A}else m=h[E+8>>2]|0,h[m+12>>2]=A,h[A+8>>2]=m,m=A;while(!1);do if(g|0){if(A=h[E+28>>2]|0,d=27988+(A<<2)|0,(E|0)==(h[d>>2]|0)){if(h[d>>2]=m,!m){h[6922]=y&~(1<<A);break}}else if(me=g+16|0,h[((h[me>>2]|0)==(E|0)?me:g+20|0)>>2]=m,!m)break;h[m+24>>2]=g,A=h[E+16>>2]|0,A|0&&(h[m+16>>2]=A,h[A+24>>2]=m),A=h[E+20>>2]|0,A|0&&(h[m+20>>2]=A,h[A+24>>2]=m)}while(!1);return M>>>0<16?(me=M+I|0,h[E+4>>2]=me|3,me=E+me+4|0,h[me>>2]=h[me>>2]|1):(h[E+4>>2]=I|3,h[b+4>>2]=M|1,h[b+M>>2]=M,O|0&&(_=h[6926]|0,A=O>>>3,m=27724+(A<<1<<2)|0,A=1<<A,A&G?(d=m+8|0,A=h[d>>2]|0):(h[6921]=A|G,A=m,d=m+8|0),h[d>>2]=_,h[A+12>>2]=_,h[_+8>>2]=A,h[_+12>>2]=m),h[6923]=M,h[6926]=b),me=E+8|0,Y=Fe,me|0}else G=I}else G=I}else G=I}else if(d>>>0<=4294967231)if(d=d+11|0,I=d&-8,_=h[6922]|0,_){g=0-I|0,d=d>>>8,d?I>>>0>16777215?M=31:(G=(d+1048320|0)>>>16&8,oe=d<<G,E=(oe+520192|0)>>>16&4,oe=oe<<E,M=(oe+245760|0)>>>16&2,M=14-(E|G|M)+(oe<<M>>>15)|0,M=I>>>(M+7|0)&1|M<<1):M=0,m=h[27988+(M<<2)>>2]|0;e:do if(!m)m=0,d=0,oe=61;else for(d=0,E=I<<((M|0)==31?0:25-(M>>>1)|0),y=0;;){if(b=(h[m+4>>2]&-8)-I|0,b>>>0<g>>>0)if(b)d=m,g=b;else{d=m,g=0,oe=65;break e}if(oe=h[m+20>>2]|0,m=h[m+16+(E>>>31<<2)>>2]|0,y=(oe|0)==0|(oe|0)==(m|0)?y:oe,m)E=E<<1;else{m=y,oe=61;break}}while(!1);if((oe|0)==61){if((m|0)==0&(d|0)==0){if(d=2<<M,d=(d|0-d)&_,!d){G=I;break}G=(d&0-d)+-1|0,b=G>>>12&16,G=G>>>b,y=G>>>5&8,G=G>>>y,E=G>>>2&4,G=G>>>E,M=G>>>1&2,G=G>>>M,m=G>>>1&1,d=0,m=h[27988+((y|b|E|M|m)+(G>>>m)<<2)>>2]|0}m?oe=65:(E=d,b=g)}if((oe|0)==65)for(y=m;;)if(G=(h[y+4>>2]&-8)-I|0,m=G>>>0<g>>>0,g=m?G:g,d=m?y:d,m=h[y+16>>2]|0,m||(m=h[y+20>>2]|0),m)y=m;else{E=d,b=g;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-I|0)>>>0&&(O=E+I|0,O>>>0>E>>>0)){y=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+20|0,A=h[d>>2]|0,!A&&(d=E+16|0,A=h[d>>2]|0,!A)){A=0;break}for(;;)if(g=A+20|0,m=h[g>>2]|0,m)A=m,d=g;else if(g=A+16|0,m=h[g>>2]|0,m)A=m,d=g;else break;h[d>>2]=0}else me=h[E+8>>2]|0,h[me+12>>2]=A,h[A+8>>2]=me;while(!1);do if(y){if(d=h[E+28>>2]|0,m=27988+(d<<2)|0,(E|0)==(h[m>>2]|0)){if(h[m>>2]=A,!A){_=_&~(1<<d),h[6922]=_;break}}else if(me=y+16|0,h[((h[me>>2]|0)==(E|0)?me:y+20|0)>>2]=A,!A)break;h[A+24>>2]=y,d=h[E+16>>2]|0,d|0&&(h[A+16>>2]=d,h[d+24>>2]=A),d=h[E+20>>2]|0,d&&(h[A+20>>2]=d,h[d+24>>2]=A)}while(!1);e:do if(b>>>0<16)me=b+I|0,h[E+4>>2]=me|3,me=E+me+4|0,h[me>>2]=h[me>>2]|1;else{if(h[E+4>>2]=I|3,h[O+4>>2]=b|1,h[O+b>>2]=b,A=b>>>3,b>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=O,h[A+12>>2]=O,h[O+8>>2]=A,h[O+12>>2]=m;break}if(A=b>>>8,A?b>>>0>16777215?m=31:(be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,m=(me+245760|0)>>>16&2,m=14-(re|be|m)+(me<<m>>>15)|0,m=b>>>(m+7|0)&1|m<<1):m=0,A=27988+(m<<2)|0,h[O+28>>2]=m,d=O+16|0,h[d+4>>2]=0,h[d>>2]=0,d=1<<m,!(_&d)){h[6922]=_|d,h[A>>2]=O,h[O+24>>2]=A,h[O+12>>2]=O,h[O+8>>2]=O;break}A=h[A>>2]|0;t:do if((h[A+4>>2]&-8|0)!=(b|0)){for(_=b<<((m|0)==31?0:25-(m>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(b|0)){A=d;break t}else _=_<<1,A=d;h[m>>2]=O,h[O+24>>2]=A,h[O+12>>2]=O,h[O+8>>2]=O;break e}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=O,h[be>>2]=O,h[O+8>>2]=me,h[O+12>>2]=A,h[O+24>>2]=0}while(!1);return me=E+8|0,Y=Fe,me|0}else G=I}else G=I;else G=-1;while(!1);if(m=h[6923]|0,m>>>0>=G>>>0)return A=m-G|0,d=h[6926]|0,A>>>0>15?(me=d+G|0,h[6926]=me,h[6923]=A,h[me+4>>2]=A|1,h[d+m>>2]=A,h[d+4>>2]=G|3):(h[6923]=0,h[6926]=0,h[d+4>>2]=m|3,me=d+m+4|0,h[me>>2]=h[me>>2]|1),me=d+8|0,Y=Fe,me|0;if(b=h[6924]|0,b>>>0>G>>>0)return re=b-G|0,h[6924]=re,me=h[6927]|0,be=me+G|0,h[6927]=be,h[be+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0;if(h[7039]|0?d=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=q&-16^1431655768,d=4096),E=G+48|0,M=G+47|0,y=d+M|0,g=0-d|0,I=y&g,I>>>0<=G>>>0||(d=h[7031]|0,d|0&&(O=h[7029]|0,q=O+I|0,q>>>0<=O>>>0|q>>>0>d>>>0)))return me=0,Y=Fe,me|0;e:do if(h[7032]&4)A=0,oe=143;else{m=h[6927]|0;t:do if(m){for(_=28132;q=h[_>>2]|0,!(q>>>0<=m>>>0&&(q+(h[_+4>>2]|0)|0)>>>0>m>>>0);)if(d=h[_+8>>2]|0,d)_=d;else{oe=128;break t}if(A=y-b&g,A>>>0<2147483647)if(d=od(A|0)|0,(d|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((d|0)!=-1){b=A,y=d,oe=145;break e}}else _=d,oe=136;else A=0}else oe=128;while(!1);do if((oe|0)==128)if(m=od(0)|0,(m|0)!=-1&&(A=m,W=h[7040]|0,$=W+-1|0,A=(($&A|0)==0?0:($+A&0-W)-A|0)+I|0,W=h[7029]|0,$=A+W|0,A>>>0>G>>>0&A>>>0<2147483647)){if(q=h[7031]|0,q|0&&$>>>0<=W>>>0|$>>>0>q>>>0){A=0;break}if(d=od(A|0)|0,(d|0)==(m|0)){b=A,y=m,oe=145;break e}else _=d,oe=136}else A=0;while(!1);do if((oe|0)==136){if(m=0-A|0,!(E>>>0>A>>>0&(A>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){A=0;break}else{b=A,y=_,oe=145;break e}if(d=h[7041]|0,d=M-A+d&0-d,d>>>0>=2147483647){b=A,y=_,oe=145;break e}if((od(d|0)|0)==-1){od(m|0)|0,A=0;break}else{b=d+A|0,y=_,oe=145;break e}}while(!1);h[7032]=h[7032]|4,oe=143}while(!1);if((oe|0)==143&&I>>>0<2147483647&&(re=od(I|0)|0,$=od(0)|0,ue=$-re|0,_e=ue>>>0>(G+40|0)>>>0,!((re|0)==-1|_e^1|re>>>0<$>>>0&((re|0)!=-1&($|0)!=-1)^1))&&(b=_e?ue:A,y=re,oe=145),(oe|0)==145){A=(h[7029]|0)+b|0,h[7029]=A,A>>>0>(h[7030]|0)>>>0&&(h[7030]=A),M=h[6927]|0;e:do if(M){for(A=28132;;){if(d=h[A>>2]|0,m=h[A+4>>2]|0,(y|0)==(d+m|0)){oe=154;break}if(_=h[A+8>>2]|0,_)A=_;else break}if((oe|0)==154&&(be=A+4|0,(h[A+12>>2]&8|0)==0)&&y>>>0>M>>>0&d>>>0<=M>>>0){h[be>>2]=m+b,me=(h[6924]|0)+b|0,re=M+8|0,re=(re&7|0)==0?0:0-re&7,be=M+re|0,re=me-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[M+me+4>>2]=40,h[6928]=h[7043];break}for(y>>>0<(h[6925]|0)>>>0&&(h[6925]=y),m=y+b|0,A=28132;;){if((h[A>>2]|0)==(m|0)){oe=162;break}if(d=h[A+8>>2]|0,d)A=d;else break}if((oe|0)==162&&(h[A+12>>2]&8|0)==0){h[A>>2]=y,O=A+4|0,h[O>>2]=(h[O>>2]|0)+b,O=y+8|0,O=y+((O&7|0)==0?0:0-O&7)|0,A=m+8|0,A=m+((A&7|0)==0?0:0-A&7)|0,I=O+G|0,E=A-O-G|0,h[O+4>>2]=G|3;t:do if((M|0)==(A|0))me=(h[6924]|0)+E|0,h[6924]=me,h[6927]=I,h[I+4>>2]=me|1;else{if((h[6926]|0)==(A|0)){me=(h[6923]|0)+E|0,h[6923]=me,h[6926]=I,h[I+4>>2]=me|1,h[I+me>>2]=me;break}if(d=h[A+4>>2]|0,(d&3|0)==1){b=d&-8,_=d>>>3;n:do if(d>>>0<256)if(d=h[A+8>>2]|0,m=h[A+12>>2]|0,(m|0)==(d|0)){h[6921]=h[6921]&~(1<<_);break}else{h[d+12>>2]=m,h[m+8>>2]=d;break}else{y=h[A+24>>2]|0,d=h[A+12>>2]|0;do if((d|0)==(A|0)){if(m=A+16|0,_=m+4|0,d=h[_>>2]|0,d)m=_;else if(d=h[m>>2]|0,!d){d=0;break}for(;;)if(g=d+20|0,_=h[g>>2]|0,_)d=_,m=g;else if(g=d+16|0,_=h[g>>2]|0,_)d=_,m=g;else break;h[m>>2]=0}else me=h[A+8>>2]|0,h[me+12>>2]=d,h[d+8>>2]=me;while(!1);if(!y)break;m=h[A+28>>2]|0,_=27988+(m<<2)|0;do if((h[_>>2]|0)!=(A|0)){if(me=y+16|0,h[((h[me>>2]|0)==(A|0)?me:y+20|0)>>2]=d,!d)break n}else{if(h[_>>2]=d,d|0)break;h[6922]=h[6922]&~(1<<m);break n}while(!1);if(h[d+24>>2]=y,m=A+16|0,_=h[m>>2]|0,_|0&&(h[d+16>>2]=_,h[_+24>>2]=d),m=h[m+4>>2]|0,!m)break;h[d+20>>2]=m,h[m+24>>2]=d}while(!1);A=A+b|0,g=b+E|0}else g=E;if(A=A+4|0,h[A>>2]=h[A>>2]&-2,h[I+4>>2]=g|1,h[I+g>>2]=g,A=g>>>3,g>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=I,h[A+12>>2]=I,h[I+8>>2]=A,h[I+12>>2]=m;break}A=g>>>8;do if(!A)_=0;else{if(g>>>0>16777215){_=31;break}be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|be|_)+(me<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1}while(!1);if(A=27988+(_<<2)|0,h[I+28>>2]=_,d=I+16|0,h[d+4>>2]=0,h[d>>2]=0,d=h[6922]|0,m=1<<_,!(d&m)){h[6922]=d|m,h[A>>2]=I,h[I+24>>2]=A,h[I+12>>2]=I,h[I+8>>2]=I;break}A=h[A>>2]|0;n:do if((h[A+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(g|0)){A=d;break n}else _=_<<1,A=d;h[m>>2]=I,h[I+24>>2]=A,h[I+12>>2]=I,h[I+8>>2]=I;break t}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=I,h[be>>2]=I,h[I+8>>2]=me,h[I+12>>2]=A,h[I+24>>2]=0}while(!1);return me=O+8|0,Y=Fe,me|0}for(A=28132;d=h[A>>2]|0,!(d>>>0<=M>>>0&&(me=d+(h[A+4>>2]|0)|0,me>>>0>M>>>0));)A=h[A+8>>2]|0;g=me+-47|0,d=g+8|0,d=g+((d&7|0)==0?0:0-d&7)|0,g=M+16|0,d=d>>>0<g>>>0?M:d,A=d+8|0,m=b+-40|0,re=y+8|0,re=(re&7|0)==0?0:0-re&7,be=y+re|0,re=m-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[y+m+4>>2]=40,h[6928]=h[7043],m=d+4|0,h[m>>2]=27,h[A>>2]=h[7033],h[A+4>>2]=h[7034],h[A+8>>2]=h[7035],h[A+12>>2]=h[7036],h[7033]=y,h[7034]=b,h[7036]=0,h[7035]=A,A=d+24|0;do be=A,A=A+4|0,h[A>>2]=7;while((be+8|0)>>>0<me>>>0);if((d|0)!=(M|0)){if(y=d-M|0,h[m>>2]=h[m>>2]&-2,h[M+4>>2]=y|1,h[d>>2]=y,A=y>>>3,y>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=M,h[A+12>>2]=M,h[M+8>>2]=A,h[M+12>>2]=m;break}if(A=y>>>8,A?y>>>0>16777215?_=31:(be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|be|_)+(me<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[g>>2]=0,A=h[6922]|0,d=1<<_,!(A&d)){h[6922]=A|d,h[m>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break}A=h[m>>2]|0;t:do if((h[A+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(y|0)){A=d;break t}else _=_<<1,A=d;h[m>>2]=M,h[M+24>>2]=A,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=M,h[be>>2]=M,h[M+8>>2]=me,h[M+12>>2]=A,h[M+24>>2]=0}}else me=h[6925]|0,(me|0)==0|y>>>0<me>>>0&&(h[6925]=y),h[7033]=y,h[7034]=b,h[7036]=0,h[6930]=h[7039],h[6929]=-1,h[6934]=27724,h[6933]=27724,h[6936]=27732,h[6935]=27732,h[6938]=27740,h[6937]=27740,h[6940]=27748,h[6939]=27748,h[6942]=27756,h[6941]=27756,h[6944]=27764,h[6943]=27764,h[6946]=27772,h[6945]=27772,h[6948]=27780,h[6947]=27780,h[6950]=27788,h[6949]=27788,h[6952]=27796,h[6951]=27796,h[6954]=27804,h[6953]=27804,h[6956]=27812,h[6955]=27812,h[6958]=27820,h[6957]=27820,h[6960]=27828,h[6959]=27828,h[6962]=27836,h[6961]=27836,h[6964]=27844,h[6963]=27844,h[6966]=27852,h[6965]=27852,h[6968]=27860,h[6967]=27860,h[6970]=27868,h[6969]=27868,h[6972]=27876,h[6971]=27876,h[6974]=27884,h[6973]=27884,h[6976]=27892,h[6975]=27892,h[6978]=27900,h[6977]=27900,h[6980]=27908,h[6979]=27908,h[6982]=27916,h[6981]=27916,h[6984]=27924,h[6983]=27924,h[6986]=27932,h[6985]=27932,h[6988]=27940,h[6987]=27940,h[6990]=27948,h[6989]=27948,h[6992]=27956,h[6991]=27956,h[6994]=27964,h[6993]=27964,h[6996]=27972,h[6995]=27972,me=b+-40|0,re=y+8|0,re=(re&7|0)==0?0:0-re&7,be=y+re|0,re=me-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[y+me+4>>2]=40,h[6928]=h[7043];while(!1);if(A=h[6924]|0,A>>>0>G>>>0)return re=A-G|0,h[6924]=re,me=h[6927]|0,be=me+G|0,h[6927]=be,h[be+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0}return me=S9()|0,h[me>>2]=12,me=0,Y=Fe,me|0}function _t(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0;if(d){m=d+-8|0,g=h[6925]|0,d=h[d+-4>>2]|0,A=d&-8,M=m+A|0;do if(d&1)E=m,b=m;else{if(_=h[m>>2]|0,!(d&3)||(b=m+(0-_)|0,y=_+A|0,b>>>0<g>>>0))return;if((h[6926]|0)==(b|0)){if(d=M+4|0,A=h[d>>2]|0,(A&3|0)!=3){E=b,A=y;break}h[6923]=y,h[d>>2]=A&-2,h[b+4>>2]=y|1,h[b+y>>2]=y;return}if(m=_>>>3,_>>>0<256)if(d=h[b+8>>2]|0,A=h[b+12>>2]|0,(A|0)==(d|0)){h[6921]=h[6921]&~(1<<m),E=b,A=y;break}else{h[d+12>>2]=A,h[A+8>>2]=d,E=b,A=y;break}g=h[b+24>>2]|0,d=h[b+12>>2]|0;do if((d|0)==(b|0)){if(A=b+16|0,m=A+4|0,d=h[m>>2]|0,d)A=m;else if(d=h[A>>2]|0,!d){d=0;break}for(;;)if(_=d+20|0,m=h[_>>2]|0,m)d=m,A=_;else if(_=d+16|0,m=h[_>>2]|0,m)d=m,A=_;else break;h[A>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=d,h[d+8>>2]=E;while(!1);if(g){if(A=h[b+28>>2]|0,m=27988+(A<<2)|0,(h[m>>2]|0)==(b|0)){if(h[m>>2]=d,!d){h[6922]=h[6922]&~(1<<A),E=b,A=y;break}}else if(E=g+16|0,h[((h[E>>2]|0)==(b|0)?E:g+20|0)>>2]=d,!d){E=b,A=y;break}h[d+24>>2]=g,A=b+16|0,m=h[A>>2]|0,m|0&&(h[d+16>>2]=m,h[m+24>>2]=d),A=h[A+4>>2]|0,A?(h[d+20>>2]=A,h[A+24>>2]=d,E=b,A=y):(E=b,A=y)}else E=b,A=y}while(!1);if(!(b>>>0>=M>>>0)&&(d=M+4|0,_=h[d>>2]|0,!!(_&1))){if(_&2)h[d>>2]=_&-2,h[E+4>>2]=A|1,h[b+A>>2]=A,g=A;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+A|0,h[6924]=M,h[6927]=E,h[E+4>>2]=M|1,(E|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(M|0)){M=(h[6923]|0)+A|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}g=(_&-8)+A|0,m=_>>>3;do if(_>>>0<256)if(A=h[M+8>>2]|0,d=h[M+12>>2]|0,(d|0)==(A|0)){h[6921]=h[6921]&~(1<<m);break}else{h[A+12>>2]=d,h[d+8>>2]=A;break}else{y=h[M+24>>2]|0,d=h[M+12>>2]|0;do if((d|0)==(M|0)){if(A=M+16|0,m=A+4|0,d=h[m>>2]|0,d)A=m;else if(d=h[A>>2]|0,!d){m=0;break}for(;;)if(_=d+20|0,m=h[_>>2]|0,m)d=m,A=_;else if(_=d+16|0,m=h[_>>2]|0,m)d=m,A=_;else break;h[A>>2]=0,m=d}else m=h[M+8>>2]|0,h[m+12>>2]=d,h[d+8>>2]=m,m=d;while(!1);if(y|0){if(d=h[M+28>>2]|0,A=27988+(d<<2)|0,(h[A>>2]|0)==(M|0)){if(h[A>>2]=m,!m){h[6922]=h[6922]&~(1<<d);break}}else if(_=y+16|0,h[((h[_>>2]|0)==(M|0)?_:y+20|0)>>2]=m,!m)break;h[m+24>>2]=y,d=M+16|0,A=h[d>>2]|0,A|0&&(h[m+16>>2]=A,h[A+24>>2]=m),d=h[d+4>>2]|0,d|0&&(h[m+20>>2]=d,h[d+24>>2]=m)}}while(!1);if(h[E+4>>2]=g|1,h[b+g>>2]=g,(E|0)==(h[6926]|0)){h[6923]=g;return}}if(d=g>>>3,g>>>0<256){m=27724+(d<<1<<2)|0,A=h[6921]|0,d=1<<d,A&d?(A=m+8|0,d=h[A>>2]|0):(h[6921]=A|d,d=m,A=m+8|0),h[A>>2]=E,h[d+12>>2]=E,h[E+8>>2]=d,h[E+12>>2]=m;return}d=g>>>8,d?g>>>0>16777215?_=31:(b=(d+1048320|0)>>>16&8,M=d<<b,y=(M+520192|0)>>>16&4,M=M<<y,_=(M+245760|0)>>>16&2,_=14-(y|b|_)+(M<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1):_=0,d=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,A=h[6922]|0,m=1<<_;e:do if(!(A&m))h[6922]=A|m,h[d>>2]=E,h[E+24>>2]=d,h[E+12>>2]=E,h[E+8>>2]=E;else{d=h[d>>2]|0;t:do if((h[d+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=d+16+(_>>>31<<2)|0,A=h[m>>2]|0,!!A;)if((h[A+4>>2]&-8|0)==(g|0)){d=A;break t}else _=_<<1,d=A;h[m>>2]=E,h[E+24>>2]=d,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=d+8|0,M=h[b>>2]|0,h[M+12>>2]=E,h[b>>2]=E,h[E+8>>2]=M,h[E+12>>2]=d,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(d=28140;d=h[d>>2]|0,d;)d=d+8|0;h[6929]=-1}}}}function ia(d,A){d=d|0,A=A|0;var m=0;return d?(m=Da(A,d)|0,(A|d)>>>0>65535&&(m=((m>>>0)/(d>>>0)|0|0)==(A|0)?m:-1)):m=0,d=ar(m)|0,!d||!(h[d+-4>>2]&3)||sd(d|0,0,m|0)|0,d|0}function fse(d,A){d=d|0,A=A|0;var m=0,_=0;return d?A>>>0>4294967231?(A=S9()|0,h[A>>2]=12,A=0,A|0):(m=dse(d+-8|0,A>>>0<11?16:A+11&-8)|0,m|0?(A=m+8|0,A|0):(m=ar(A)|0,m?(_=h[d+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,_c(m|0,d|0,(_>>>0<A>>>0?_:A)|0)|0,_t(d),A=m,A|0):(A=0,A|0))):(A=ar(A)|0,A|0)}function dse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(O=d+4|0,G=h[O>>2]|0,m=G&-8,E=d+m|0,!(G&3))return A>>>0<256?(d=0,d|0):(m>>>0>=(A+4|0)>>>0&&(m-A|0)>>>0<=h[7041]<<1>>>0||(d=0),d|0);if(m>>>0>=A>>>0)return m=m-A|0,m>>>0<=15||(I=d+A|0,h[O>>2]=G&1|A|2,h[I+4>>2]=m|3,G=E+4|0,h[G>>2]=h[G>>2]|1,C9(I,m)),d|0;if((h[6927]|0)==(E|0))return I=(h[6924]|0)+m|0,m=I-A|0,_=d+A|0,I>>>0<=A>>>0?(d=0,d|0):(h[O>>2]=G&1|A|2,h[_+4>>2]=m|1,h[6927]=_,h[6924]=m,d|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+m|0,_>>>0<A>>>0?(d=0,d|0):(m=_-A|0,m>>>0>15?(I=d+A|0,_=d+_|0,h[O>>2]=G&1|A|2,h[I+4>>2]=m|1,h[_>>2]=m,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=I):(h[O>>2]=G&1|_|2,_=d+_+4|0,h[_>>2]=h[_>>2]|1,_=0,m=0),h[6923]=m,h[6926]=_,d|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+m|0,M>>>0<A>>>0))return d=0,d|0;I=M-A|0,g=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(_|0)){h[6921]=h[6921]&~(1<<g);break}else{h[_+12>>2]=m,h[m+8>>2]=_;break}else{b=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(_=E+16|0,g=_+4|0,m=h[g>>2]|0,m)_=g;else if(m=h[_>>2]|0,!m){g=0;break}for(;;)if(y=m+20|0,g=h[y>>2]|0,g)m=g,_=y;else if(y=m+16|0,g=h[y>>2]|0,g)m=g,_=y;else break;h[_>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);if(b|0){if(m=h[E+28>>2]|0,_=27988+(m<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(y=b+16|0,h[((h[y>>2]|0)==(E|0)?y:b+20|0)>>2]=g,!g)break;h[g+24>>2]=b,m=E+16|0,_=h[m>>2]|0,_|0&&(h[g+16>>2]=_,h[_+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);return I>>>0<16?(h[O>>2]=G&1|M|2,G=d+M+4|0,h[G>>2]=h[G>>2]|1,d|0):(E=d+A|0,h[O>>2]=G&1|A|2,h[E+4>>2]=I|3,G=d+M+4|0,h[G>>2]=h[G>>2]|1,C9(E,I),d|0)}function C9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;E=d+A|0,m=h[d+4>>2]|0;do if(m&1)b=d;else{if(g=h[d>>2]|0,!(m&3))return;if(b=d+(0-g)|0,A=g+A|0,(h[6926]|0)==(b|0)){if(d=E+4|0,m=h[d>>2]|0,(m&3|0)!=3)break;h[6923]=A,h[d>>2]=m&-2,h[b+4>>2]=A|1,h[E>>2]=A;return}if(_=g>>>3,g>>>0<256)if(d=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(d|0)){h[6921]=h[6921]&~(1<<_);break}else{h[d+12>>2]=m,h[m+8>>2]=d;break}y=h[b+24>>2]|0,d=h[b+12>>2]|0;do if((d|0)==(b|0)){if(m=b+16|0,_=m+4|0,d=h[_>>2]|0,d)m=_;else if(d=h[m>>2]|0,!d){d=0;break}for(;;)if(g=d+20|0,_=h[g>>2]|0,_)d=_,m=g;else if(g=d+16|0,_=h[g>>2]|0,_)d=_,m=g;else break;h[m>>2]=0}else g=h[b+8>>2]|0,h[g+12>>2]=d,h[d+8>>2]=g;while(!1);if(y){if(m=h[b+28>>2]|0,_=27988+(m<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=d,!d){h[6922]=h[6922]&~(1<<m);break}}else if(g=y+16|0,h[((h[g>>2]|0)==(b|0)?g:y+20|0)>>2]=d,!d)break;h[d+24>>2]=y,m=b+16|0,_=h[m>>2]|0,_|0&&(h[d+16>>2]=_,h[_+24>>2]=d),m=h[m+4>>2]|0,m&&(h[d+20>>2]=m,h[m+24>>2]=d)}}while(!1);if(d=E+4|0,_=h[d>>2]|0,_&2)h[d>>2]=_&-2,h[b+4>>2]=A|1,h[b+A>>2]=A,g=A;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+A|0,h[6924]=E,h[6927]=b,h[b+4>>2]=E|1,(b|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(E|0)){E=(h[6923]|0)+A|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}g=(_&-8)+A|0,m=_>>>3;do if(_>>>0<256)if(d=h[E+8>>2]|0,A=h[E+12>>2]|0,(A|0)==(d|0)){h[6921]=h[6921]&~(1<<m);break}else{h[d+12>>2]=A,h[A+8>>2]=d;break}else{y=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+16|0,m=d+4|0,A=h[m>>2]|0,A)d=m;else if(A=h[d>>2]|0,!A){m=0;break}for(;;)if(_=A+20|0,m=h[_>>2]|0,m)A=m,d=_;else if(_=A+16|0,m=h[_>>2]|0,m)A=m,d=_;else break;h[d>>2]=0,m=A}else m=h[E+8>>2]|0,h[m+12>>2]=A,h[A+8>>2]=m,m=A;while(!1);if(y|0){if(A=h[E+28>>2]|0,d=27988+(A<<2)|0,(h[d>>2]|0)==(E|0)){if(h[d>>2]=m,!m){h[6922]=h[6922]&~(1<<A);break}}else if(_=y+16|0,h[((h[_>>2]|0)==(E|0)?_:y+20|0)>>2]=m,!m)break;h[m+24>>2]=y,A=E+16|0,d=h[A>>2]|0,d|0&&(h[m+16>>2]=d,h[d+24>>2]=m),A=h[A+4>>2]|0,A|0&&(h[m+20>>2]=A,h[A+24>>2]=m)}}while(!1);if(h[b+4>>2]=g|1,h[b+g>>2]=g,(b|0)==(h[6926]|0)){h[6923]=g;return}}if(A=g>>>3,g>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=b,h[A+12>>2]=b,h[b+8>>2]=A,h[b+12>>2]=m;return}if(A=g>>>8,A?g>>>0>16777215?_=31:(y=(A+1048320|0)>>>16&8,E=A<<y,m=(E+520192|0)>>>16&4,E=E<<m,_=(E+245760|0)>>>16&2,_=14-(m|y|_)+(E<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1):_=0,A=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,d=h[6922]|0,m=1<<_,!(d&m)){h[6922]=d|m,h[A>>2]=b,h[b+24>>2]=A,h[b+12>>2]=b,h[b+8>>2]=b;return}A=h[A>>2]|0;e:do if((h[A+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(g|0)){A=d;break e}else _=_<<1,A=d;h[m>>2]=b,h[b+24>>2]=A,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);y=A+8|0,E=h[y>>2]|0,h[E+12>>2]=b,h[y>>2]=b,h[b+8>>2]=E,h[b+12>>2]=A,h[b+24>>2]=0}function pt(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,m=d+m>>>0,Ln(A+_+(m>>>0<d>>>0|0)>>>0|0),m|0|0}function Ns(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,_=A-_-(m>>>0>d>>>0|0)>>>0,Ln(_|0),d-m>>>0|0|0}function R9(d){return d=d|0,(d?31-(jh(d^d-1)|0)|0:32)|0}function C4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(O=d,M=A,I=M,b=m,q=_,E=q,!I)return y=(g|0)!=0,E?y?(h[g>>2]=d|0,h[g+4>>2]=A&0,q=0,g=0,Ln(q|0),g|0):(q=0,g=0,Ln(q|0),g|0):(y&&(h[g>>2]=(O>>>0)%(b>>>0),h[g+4>>2]=0),q=0,g=(O>>>0)/(b>>>0)>>>0,Ln(q|0),g|0);y=(E|0)==0;do if(b){if(!y){if(y=(jh(E|0)|0)-(jh(I|0)|0)|0,y>>>0<=31){G=y+1|0,E=31-y|0,A=y-31>>31,b=G,d=O>>>(G>>>0)&A|I<<E,A=I>>>(G>>>0)&A,y=0,E=O<<E;break}return g?(h[g>>2]=d|0,h[g+4>>2]=M|A&0,q=0,g=0,Ln(q|0),g|0):(q=0,g=0,Ln(q|0),g|0)}if(y=b-1|0,y&b|0){E=(jh(b|0)|0)+33-(jh(I|0)|0)|0,$=64-E|0,G=32-E|0,M=G>>31,W=E-32|0,A=W>>31,b=E,d=G-1>>31&I>>>(W>>>0)|(I<<G|O>>>(E>>>0))&A,A=A&I>>>(E>>>0),y=O<<$&M,E=(I<<$|O>>>(W>>>0))&M|O<<G&E-33>>31;break}return g|0&&(h[g>>2]=y&O,h[g+4>>2]=0),(b|0)==1?(W=M|A&0,$=d|0|0,Ln(W|0),$|0):($=R9(b|0)|0,W=I>>>($>>>0)|0,$=I<<32-$|O>>>($>>>0)|0,Ln(W|0),$|0)}else{if(y)return g|0&&(h[g>>2]=(I>>>0)%(b>>>0),h[g+4>>2]=0),W=0,$=(I>>>0)/(b>>>0)>>>0,Ln(W|0),$|0;if(!O)return g|0&&(h[g>>2]=0,h[g+4>>2]=(I>>>0)%(E>>>0)),W=0,$=(I>>>0)/(E>>>0)>>>0,Ln(W|0),$|0;if(y=E-1|0,!(y&E))return g|0&&(h[g>>2]=d|0,h[g+4>>2]=y&I|A&0),W=0,$=I>>>((R9(E|0)|0)>>>0),Ln(W|0),$|0;if(y=(jh(E|0)|0)-(jh(I|0)|0)|0,y>>>0<=30){A=y+1|0,E=31-y|0,b=A,d=I<<E|O>>>(A>>>0),A=I>>>(A>>>0),y=0,E=O<<E;break}return g?(h[g>>2]=d|0,h[g+4>>2]=M|A&0,W=0,$=0,Ln(W|0),$|0):(W=0,$=0,Ln(W|0),$|0)}while(!1);if(!b)I=E,M=0,E=0;else{G=m|0|0,O=q|_&0,I=pt(G|0,O|0,-1,-1)|0,m=Q()|0,M=E,E=0;do _=M,M=y>>>31|M<<1,y=E|y<<1,_=d<<1|_>>>31|0,q=d>>>31|A<<1|0,Ns(I|0,m|0,_|0,q|0)|0,$=Q()|0,W=$>>31|(($|0)<0?-1:0)<<1,E=W&1,d=Ns(_|0,q|0,W&G|0,((($|0)<0?-1:0)>>31|(($|0)<0?-1:0)<<1)&O|0)|0,A=Q()|0,b=b-1|0;while((b|0)!=0);I=M,M=0}return b=0,g|0&&(h[g>>2]=d,h[g+4>>2]=A),W=(y|0)>>>31|(I|b)<<1|(b<<1|y>>>31)&0|M,$=(y<<1|0)&-2|E,Ln(W|0),$|0}function id(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;return I=A>>31|((A|0)<0?-1:0)<<1,M=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,y=_>>31|((_|0)<0?-1:0)<<1,g=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=Ns(I^d|0,M^A|0,I|0,M|0)|0,b=Q()|0,d=y^I,A=g^M,Ns((C4(E,b,Ns(y^m|0,g^_|0,y|0,g|0)|0,Q()|0,0)|0)^d|0,(Q()|0)^A|0,d|0,A|0)|0}function pse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return y=d&65535,g=A&65535,m=Da(g,y)|0,_=d>>>16,d=(m>>>16)+(Da(g,_)|0)|0,g=A>>>16,A=Da(g,y)|0,Ln((d>>>16)+(Da(g,_)|0)+(((d&65535)+A|0)>>>16)|0),d+A<<16|m&65535|0|0}function lr(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return g=d,y=m,m=pse(g,y)|0,d=Q()|0,Ln((Da(A,y)|0)+(Da(_,g)|0)+d|d&0|0),m|0|0|0}function rd(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;return g=Y,Y=Y+16|0,E=g|0,b=A>>31|((A|0)<0?-1:0)<<1,y=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,I=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,d=Ns(b^d|0,y^A|0,b|0,y|0)|0,A=Q()|0,C4(d,A,Ns(I^m|0,M^_|0,I|0,M|0)|0,Q()|0,E)|0,_=Ns(h[E>>2]^b|0,h[E+4>>2]^y|0,b|0,y|0)|0,m=Q()|0,Y=g,Ln(m|0),_|0}function Xh(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return y=Y,Y=Y+16|0,g=y|0,C4(d,A,m,_,g)|0,Y=y,Ln(h[g+4>>2]|0),h[g>>2]|0|0}function P9(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Ln(A>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Ln(((A|0)<0?-1:0)|0),A>>m-32|0)}function et(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Ln(A>>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Ln(0),A>>>m-32|0)}function ht(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Ln(A<<m|(d&(1<<m)-1<<32-m)>>>32-m|0),d<<m):(Ln(d<<m-32|0),0)}function R4(d,A,m){return d=d|0,A=A|0,m=m|0,A=jh(A)|0,(A|0)==32&&(A=A+(jh(d)|0)|0),Ln(0),A|0}function I9(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+Die(+d,+A)}function Zb(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+s4(+d,+A)}function Kb(d){return d=+d,d>=0?+Hs(d+.5):+Ym(d-.5)}function _c(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if((m|0)>=8192)return Bie(d|0,A|0,m|0)|0,d|0;if(y=d|0,g=d+m|0,(d&3)==(A&3)){for(;d&3;){if(!m)return y|0;He[d>>0]=He[A>>0]|0,d=d+1|0,A=A+1|0,m=m-1|0}for(m=g&-4|0,_=m-64|0;(d|0)<=(_|0);)h[d>>2]=h[A>>2],h[d+4>>2]=h[A+4>>2],h[d+8>>2]=h[A+8>>2],h[d+12>>2]=h[A+12>>2],h[d+16>>2]=h[A+16>>2],h[d+20>>2]=h[A+20>>2],h[d+24>>2]=h[A+24>>2],h[d+28>>2]=h[A+28>>2],h[d+32>>2]=h[A+32>>2],h[d+36>>2]=h[A+36>>2],h[d+40>>2]=h[A+40>>2],h[d+44>>2]=h[A+44>>2],h[d+48>>2]=h[A+48>>2],h[d+52>>2]=h[A+52>>2],h[d+56>>2]=h[A+56>>2],h[d+60>>2]=h[A+60>>2],d=d+64|0,A=A+64|0;for(;(d|0)<(m|0);)h[d>>2]=h[A>>2],d=d+4|0,A=A+4|0}else for(m=g-4|0;(d|0)<(m|0);)He[d>>0]=He[A>>0]|0,He[d+1>>0]=He[A+1>>0]|0,He[d+2>>0]=He[A+2>>0]|0,He[d+3>>0]=He[A+3>>0]|0,d=d+4|0,A=A+4|0;for(;(d|0)<(g|0);)He[d>>0]=He[A>>0]|0,d=d+1|0,A=A+1|0;return y|0}function P4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0;if((A|0)<(d|0)&(d|0)<(A+m|0)){for(_=d,A=A+m|0,d=d+m|0;(m|0)>0;)d=d-1|0,A=A-1|0,m=m-1|0,He[d>>0]=He[A>>0]|0;d=_}else _c(d,A,m)|0;return d|0}function sd(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;if(y=d+m|0,A=A&255,(m|0)>=67){for(;d&3;)He[d>>0]=A,d=d+1|0;for(_=y&-4|0,b=A|A<<8|A<<16|A<<24,g=_-64|0;(d|0)<=(g|0);)h[d>>2]=b,h[d+4>>2]=b,h[d+8>>2]=b,h[d+12>>2]=b,h[d+16>>2]=b,h[d+20>>2]=b,h[d+24>>2]=b,h[d+28>>2]=b,h[d+32>>2]=b,h[d+36>>2]=b,h[d+40>>2]=b,h[d+44>>2]=b,h[d+48>>2]=b,h[d+52>>2]=b,h[d+56>>2]=b,h[d+60>>2]=b,d=d+64|0;for(;(d|0)<(_|0);)h[d>>2]=b,d=d+4|0}for(;(d|0)<(y|0);)He[d>>0]=A,d=d+1|0;return y-m|0}function N9(d){return d=+d,d>=0?+Hs(d+.5):+Ym(d-.5)}function od(d){d=d|0;var A=0,m=0,_=0;return _=Oie()|0,m=h[La>>2]|0,A=m+d|0,(d|0)>0&(A|0)<(m|0)|(A|0)<0?(kie(A|0)|0,Xk(12),-1):(A|0)>(_|0)&&!(Uie(A|0)|0)?(Xk(12),-1):(h[La>>2]=A,m|0)}function Ase(d,A,m){return d=d|0,A=A|0,m=m|0,ad[d&3](A|0,m|0)|0}function mse(d,A){return d=d|0,A=A|0,Fie(0),0}var ad=[mse,fre,dre,pre];return{___divdi3:id,___muldi3:lr,___remdi3:rd,___uremdi3:Xh,_areNeighborCells:Are,_bitshift64Ashr:P9,_bitshift64Lshr:et,_bitshift64Shl:ht,_calloc:ia,_cellAreaKm2:Qie,_cellAreaM2:Jie,_cellAreaRads2:Kie,_cellToBoundary:E0,_cellToCenterChild:h9,_cellToChildPos:Fre,_cellToChildren:Ere,_cellToChildrenSize:nx,_cellToLatLng:Qm,_cellToLocalIj:Xre,_cellToParent:A4,_cellToVertex:Ul,_cellToVertexes:use,_cellsToDirectedEdge:mre,_cellsToLinkedMultiPolygon:Zie,_childPosToCell:Ore,_compactCells:Mre,_constructCell:Sre,_destroyLinkedMultiPolygon:Wre,_directedEdgeToBoundary:ex,_directedEdgeToCells:xre,_edgeLengthKm:qre,_edgeLengthM:Hre,_edgeLengthRads:Vre,_emscripten_replace_memory:Gie,_free:_t,_getBaseCellNumber:c9,_getDirectedEdgeDestination:_re,_getDirectedEdgeOrigin:gre,_getHexagonAreaAvgKm2:p9,_getHexagonAreaAvgM2:kre,_getHexagonEdgeLengthAvgKm:Gre,_getHexagonEdgeLengthAvgM:zre,_getIcosahedronFaces:f9,_getIndexDigit:wre,_getNumCells:qb,_getPentagons:y4,_getRes0Cells:rre,_getResolution:d4,_greatCircleDistanceKm:rx,_greatCircleDistanceM:Ure,_greatCircleDistanceRads:Bre,_gridDisk:$k,_gridDiskDistances:Yk,_gridDistance:w4,_gridPathCells:Zre,_gridPathCellsSize:Yre,_gridRing:jie,_gridRingUnsafe:Kk,_i64Add:pt,_i64Subtract:Ns,_isPentagon:Ui,_isResClassIII:Pre,_isValidCell:Vb,_isValidDirectedEdge:s9,_isValidIndex:Tre,_isValidVertex:w9,_latLngToCell:_4,_llvm_ctlz_i64:R4,_llvm_maxnum_f64:I9,_llvm_minnum_f64:Zb,_llvm_round_f64:Kb,_localIjToCell:$re,_malloc:ar,_maxFaceCount:Lre,_maxGridDiskSize:Wie,_maxPolygonToCellsSize:$ie,_maxPolygonToCellsSizeExperimental:Jre,_memcpy:_c,_memmove:P4,_memset:sd,_originToDirectedEdges:u4,_pentagonCount:Dre,_polygonToCells:Yie,_polygonToCellsExperimental:Qre,_readInt64AsDoubleFromPointer:ase,_res0CellCount:ire,_reverseDirectedEdge:o9,_round:N9,_sbrk:od,_sizeOfCellBoundary:nse,_sizeOfCoordIJ:ose,_sizeOfGeoLoop:ise,_sizeOfGeoPolygon:rse,_sizeOfH3Index:ese,_sizeOfLatLng:tse,_sizeOfLinkedGeoPolygon:sse,_uncompactCells:Cre,_uncompactCellsSize:Rre,_vertexToLatLng:hse,dynCall_iii:Ase,establishStackSpace:Hie,stackAlloc:zie,stackRestore:qie,stackSave:Vie}})(Dt,ct,Z),jt=e.___divdi3=Ce.___divdi3,qi=e.___muldi3=Ce.___muldi3,In=e.___remdi3=Ce.___remdi3,Ur=e.___uremdi3=Ce.___uremdi3,mr=e._areNeighborCells=Ce._areNeighborCells,il=e._bitshift64Ashr=Ce._bitshift64Ashr,ta=e._bitshift64Lshr=Ce._bitshift64Lshr,rl=e._bitshift64Shl=Ce._bitshift64Shl,Ia=e._calloc=Ce._calloc,sr=e._cellAreaKm2=Ce._cellAreaKm2,Rs=e._cellAreaM2=Ce._cellAreaM2,sl=e._cellAreaRads2=Ce._cellAreaRads2,hu=e._cellToBoundary=Ce._cellToBoundary,Bb=e._cellToCenterChild=Ce._cellToCenterChild,KR=e._cellToChildPos=Ce._cellToChildPos,QR=e._cellToChildren=Ce._cellToChildren,K1=e._cellToChildrenSize=Ce._cellToChildrenSize,JR=e._cellToLatLng=Ce._cellToLatLng,Q1=e._cellToLocalIj=Ce._cellToLocalIj,e4=e._cellToParent=Ce._cellToParent,t4=e._cellToVertex=Ce._cellToVertex,Uk=e._cellToVertexes=Ce._cellToVertexes,kk=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,Gk=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,zk=e._childPosToCell=Ce._childPosToCell,te=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,Le=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,De=e._directedEdgeToCells=Ce._directedEdgeToCells,zt=e._edgeLengthKm=Ce._edgeLengthKm,Yt=e._edgeLengthM=Ce._edgeLengthM,kt=e._edgeLengthRads=Ce._edgeLengthRads,tn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,hn=e._free=Ce._free,Gn=e._getBaseCellNumber=Ce._getBaseCellNumber,Xn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,pn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Bi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,kr=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Tr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,Hi=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,so=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Xt=e._getIndexDigit=Ce._getIndexDigit,Na=e._getNumCells=Ce._getNumCells,Ai=e._getPentagons=Ce._getPentagons,ol=e._getRes0Cells=Ce._getRes0Cells,gc=e._getResolution=Ce._getResolution,qh=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,b0=e._greatCircleDistanceM=Ce._greatCircleDistanceM,Wi=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,Gr=e._gridDisk=Ce._gridDisk,Hh=e._gridDiskDistances=Ce._gridDiskDistances,er=e._gridDistance=Ce._gridDistance,Wh=e._gridPathCells=Ce._gridPathCells,w0=e._gridPathCellsSize=Ce._gridPathCellsSize,n4=e._gridRing=Ce._gridRing,r4e=e._gridRingUnsafe=Ce._gridRingUnsafe,s4e=e._i64Add=Ce._i64Add,o4e=e._i64Subtract=Ce._i64Subtract,a4e=e._isPentagon=Ce._isPentagon,l4e=e._isResClassIII=Ce._isResClassIII,c4e=e._isValidCell=Ce._isValidCell,u4e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,h4e=e._isValidIndex=Ce._isValidIndex,f4e=e._isValidVertex=Ce._isValidVertex,d4e=e._latLngToCell=Ce._latLngToCell,p4e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,A4e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,m4e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,g4e=e._llvm_round_f64=Ce._llvm_round_f64,_4e=e._localIjToCell=Ce._localIjToCell,x4e=e._malloc=Ce._malloc,y4e=e._maxFaceCount=Ce._maxFaceCount,v4e=e._maxGridDiskSize=Ce._maxGridDiskSize,b4e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,w4e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,S4e=e._memcpy=Ce._memcpy,T4e=e._memmove=Ce._memmove,E4e=e._memset=Ce._memset,M4e=e._originToDirectedEdges=Ce._originToDirectedEdges,C4e=e._pentagonCount=Ce._pentagonCount,R4e=e._polygonToCells=Ce._polygonToCells,P4e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,I4e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,N4e=e._res0CellCount=Ce._res0CellCount,L4e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,D4e=e._round=Ce._round,F4e=e._sbrk=Ce._sbrk,O4e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,B4e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,U4e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,k4e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,G4e=e._sizeOfH3Index=Ce._sizeOfH3Index,z4e=e._sizeOfLatLng=Ce._sizeOfLatLng,V4e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,q4e=e._uncompactCells=Ce._uncompactCells,H4e=e._uncompactCellsSize=Ce._uncompactCellsSize,W4e=e._vertexToLatLng=Ce._vertexToLatLng,j4e=e.establishStackSpace=Ce.establishStackSpace,Vk=e.stackAlloc=Ce.stackAlloc,Iie=e.stackRestore=Ce.stackRestore,Nie=e.stackSave=Ce.stackSave,X4e=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=C,e.setValue=v,e.getValue=w,le){Te(le)||(le=o(le));{di("memory initializer");var i4=function(Ne){Ne.byteLength&&(Ne=new Uint8Array(Ne)),j.set(Ne,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,On("memory initializer")},qk=function(){a(le,i4,function(){throw"could not load memory initializer "+le})},Hk=wt(le);if(Hk)i4(Hk.buffer);else if(e.memoryInitializerRequest){var Wk=function(){var Ne=e.memoryInitializerRequest,nt=Ne.response;if(Ne.status!==200&&Ne.status!==0){var It=wt(e.memoryInitializerRequestURL);if(It)nt=It.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ne.status+", retrying "+le),qk();return}}i4(nt)};e.memoryInitializerRequest.response?setTimeout(Wk,0):e.memoryInitializerRequest.addEventListener("load",Wk)}else qk()}}var Ub;ge=function Ne(){Ub||r4(),Ub||(ge=Ne)};function r4(Ne){if(Ne=Ne||r,Qt>0||(Ct(),Qt>0))return;function nt(){Ub||(Ub=!0,!S&&(un(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Xe()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),nt()},1)):nt()}e.run=r4;function S0(Ne){throw e.onAbort&&e.onAbort(Ne),Ne+="",l(Ne),c(Ne),S=!0,"abort("+Ne+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=S0,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return r4(),i})(typeof hi=="object"?hi:{}),wn="number",vn=wn,Q_=wn,Tn=wn,En=wn,to=wn,qt=wn,H_e=[["sizeOfH3Index",wn],["sizeOfLatLng",wn],["sizeOfCellBoundary",wn],["sizeOfGeoLoop",wn],["sizeOfGeoPolygon",wn],["sizeOfLinkedGeoPolygon",wn],["sizeOfCoordIJ",wn],["readInt64AsDoubleFromPointer",wn],["isValidCell",Q_,[Tn,En]],["isValidIndex",Q_,[Tn,En]],["latLngToCell",vn,[wn,wn,to,qt]],["cellToLatLng",vn,[Tn,En,qt]],["cellToBoundary",vn,[Tn,En,qt]],["maxGridDiskSize",vn,[wn,qt]],["gridDisk",vn,[Tn,En,wn,qt]],["gridDiskDistances",vn,[Tn,En,wn,qt,qt]],["gridRing",vn,[Tn,En,wn,qt]],["gridRingUnsafe",vn,[Tn,En,wn,qt]],["maxPolygonToCellsSize",vn,[qt,to,wn,qt]],["polygonToCells",vn,[qt,to,wn,qt]],["maxPolygonToCellsSizeExperimental",vn,[qt,to,wn,qt]],["polygonToCellsExperimental",vn,[qt,to,wn,wn,wn,qt]],["cellsToLinkedMultiPolygon",vn,[qt,wn,qt]],["destroyLinkedMultiPolygon",null,[qt]],["compactCells",vn,[qt,qt,wn,wn]],["uncompactCells",vn,[qt,wn,wn,qt,wn,to]],["uncompactCellsSize",vn,[qt,wn,wn,to,qt]],["isPentagon",Q_,[Tn,En]],["isResClassIII",Q_,[Tn,En]],["getBaseCellNumber",wn,[Tn,En]],["getResolution",wn,[Tn,En]],["getIndexDigit",wn,[Tn,En,wn]],["constructCell",vn,[wn,wn,qt,qt]],["maxFaceCount",vn,[Tn,En,qt]],["getIcosahedronFaces",vn,[Tn,En,qt]],["cellToParent",vn,[Tn,En,to,qt]],["cellToChildren",vn,[Tn,En,to,qt]],["cellToCenterChild",vn,[Tn,En,to,qt]],["cellToChildrenSize",vn,[Tn,En,to,qt]],["cellToChildPos",vn,[Tn,En,to,qt]],["childPosToCell",vn,[wn,wn,Tn,En,to,qt]],["areNeighborCells",vn,[Tn,En,Tn,En,qt]],["cellsToDirectedEdge",vn,[Tn,En,Tn,En,qt]],["getDirectedEdgeOrigin",vn,[Tn,En,qt]],["getDirectedEdgeDestination",vn,[Tn,En,qt]],["isValidDirectedEdge",Q_,[Tn,En]],["directedEdgeToCells",vn,[Tn,En,qt]],["originToDirectedEdges",vn,[Tn,En,qt]],["directedEdgeToBoundary",vn,[Tn,En,qt]],["reverseDirectedEdge",vn,[Tn,En,qt]],["gridDistance",vn,[Tn,En,Tn,En,qt]],["gridPathCells",vn,[Tn,En,Tn,En,qt]],["gridPathCellsSize",vn,[Tn,En,Tn,En,qt]],["cellToLocalIj",vn,[Tn,En,Tn,En,wn,qt]],["localIjToCell",vn,[Tn,En,qt,wn,qt]],["getHexagonAreaAvgM2",vn,[to,qt]],["getHexagonAreaAvgKm2",vn,[to,qt]],["getHexagonEdgeLengthAvgM",vn,[to,qt]],["getHexagonEdgeLengthAvgKm",vn,[to,qt]],["greatCircleDistanceM",wn,[qt,qt]],["greatCircleDistanceKm",wn,[qt,qt]],["greatCircleDistanceRads",wn,[qt,qt]],["cellAreaM2",vn,[Tn,En,qt]],["cellAreaKm2",vn,[Tn,En,qt]],["cellAreaRads2",vn,[Tn,En,qt]],["edgeLengthM",vn,[Tn,En,qt]],["edgeLengthKm",vn,[Tn,En,qt]],["edgeLengthRads",vn,[Tn,En,qt]],["getNumCells",vn,[to,qt]],["getRes0Cells",vn,[qt]],["res0CellCount",wn],["getPentagons",vn,[wn,qt]],["pentagonCount",wn],["cellToVertex",vn,[Tn,En,wn,qt]],["cellToVertexes",vn,[Tn,En,qt]],["vertexToLatLng",vn,[Tn,En,qt]],["isValidVertex",Q_,[Tn,En]]],W_e=0,j_e=1,X_e=2,$_e=3,G$=4,Y_e=5,Z_e=6,K_e=7,Q_e=8,J_e=9,e1e=10,t1e=11,n1e=12,i1e=13,r1e=14,s1e=15,o1e=16,a1e=17,l1e=18,c1e=19,ls={};ls[W_e]="Success";ls[j_e]="The operation failed but a more specific error is not available";ls[X_e]="Argument was outside of acceptable range";ls[$_e]="Latitude or longitude arguments were outside of acceptable range";ls[G$]="Resolution argument was outside of acceptable range";ls[Y_e]="Cell argument was not valid";ls[Z_e]="Directed edge argument was not valid";ls[K_e]="Undirected edge argument was not valid";ls[Q_e]="Vertex argument was not valid";ls[J_e]="Pentagon distortion was encountered";ls[e1e]="Duplicate input";ls[t1e]="Cell arguments were not neighbors";ls[n1e]="Cell arguments had incompatible resolutions";ls[i1e]="Memory allocation failed";ls[r1e]="Bounds of provided memory were insufficient";ls[s1e]="Mode or flags argument was not valid";ls[o1e]="Index argument was not valid";ls[a1e]="Base cell number was outside of acceptable range";ls[l1e]="Child indexing digits invalid";ls[c1e]="Child indexing digits refer to a deleted subsequence";var u1e=1e3,z$=1001,V$=1002,_E={};_E[u1e]="Unknown unit";_E[z$]="Array length out of bounds";_E[V$]="Got unexpected null value for H3 index";var h1e="Unknown error";function q$(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||h1e)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function H$(i,e){var t=arguments.length===2?{value:e}:{};return q$(ls,i,t)}function W$(i,e){var t=arguments.length===2?{value:e}:{};return q$(_E,i,t)}function xv(i){if(i!==0)throw H$(i)}var Ka={};H_e.forEach(function(e){Ka[e[0]]=hi.cwrap.apply(hi,e)});var J_=16;var yv=4;var e1=8,f1e=8,mE=Ka.sizeOfH3Index(),I6=Ka.sizeOfLatLng(),d1e=Ka.sizeOfCellBoundary(),p1e=Ka.sizeOfGeoPolygon(),_v=Ka.sizeOfGeoLoop(),eJe=Ka.sizeOfLinkedGeoPolygon(),tJe=Ka.sizeOfCoordIJ();function A1e(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw H$(G$,i);return i}function m1e(i){if(!i)throw W$(V$);return i}var g1e=Math.pow(2,32)-1,nJe=Math.pow(2,31)-1;function _1e(i){if(i>g1e)throw W$(z$,i);return i}var x1e=/[^0-9a-fA-F]/;function j$(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||x1e.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),J_),t=parseInt(i.substring(i.length-8),J_);return[t,e]}function U$(i){if(i>=0)return i.toString(J_);i=i&2147483647;var e=X$(8,i.toString(J_)),t=(parseInt(e[0],J_)+8).toString(J_);return e=t+e.substring(1),e}function y1e(i,e){return U$(e)+X$(8,U$(i))}function X$(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var iJe=Math.pow(2,32);function k$(i,e,t){for(var n=i.length,r=hi._calloc(n,I6),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)hi.HEAPF64.set([i[a/2][s],i[a/2][o]].map(K$),r/e1+a);return hi.HEAPU32.set([n,r],e/yv),e}function v1e(i,e){var t=i.length-1,n=hi._calloc(p1e),r=0,s=r+_v,o=s+yv;k$(i[0],n+r,e);var a;if(t>0){a=hi._calloc(t,_v);for(var l=0;l<t;l++)k$(i[l+1],a+_v*l,e)}return hi.setValue(n+s,t,"i32"),hi.setValue(n+o,a,"i32"),n}function b1e(i){var e=0,t=e+_v,n=t+yv,r=yv;hi._free(hi.getValue(i+e+r,"i8*"));var s=hi.getValue(i+t,"i32");if(s>0){for(var o=hi.getValue(i+n,"i32"),a=0;a<s;a++)hi._free(hi.getValue(o+_v*a+r,"i8*"));hi._free(o)}hi._free(i)}function $$(i,e){e===void 0&&(e=0);var t=hi.getValue(i+mE*e,"i32"),n=hi.getValue(i+mE*e+yv,"i32");return n?y1e(t,n):null}function w1e(i){return Ka.readInt64AsDoubleFromPointer(i)}function S1e(i,e){for(var t=[],n=0;n<e;n++){var r=$$(i,n);r!==null&&t.push(r)}return t}function gE(i){return M1e(hi.getValue(i,"double"))}function Y$(i){return[gE(i),gE(i+e1)]}function T1e(i){return[gE(i+e1),gE(i)]}function E1e(i,e,t){for(var n=hi.getValue(i,"i32"),r=i+e1,s=[],o=e?T1e:Y$,a=0;a<n*2;a+=2)s.push(o(r+e1*a));return t&&s.push(s[0]),s}function Z$(i,e,t){var n=hi._malloc(I6);hi.HEAPF64.set([i,e].map(K$),n/e1);var r=hi._malloc(mE);try{return xv(Ka.latLngToCell(n,t,r)),m1e($$(r))}finally{hi._free(r),hi._free(n)}}function N6(i){var e=hi._malloc(I6),t=j$(i),n=t[0],r=t[1];try{return xv(Ka.cellToLatLng(n,r,e)),Y$(e)}finally{hi._free(e)}}function L6(i,e){var t=hi._malloc(d1e),n=j$(i),r=n[0],s=n[1];try{return xv(Ka.cellToBoundary(r,s,t)),E1e(t,e,e)}finally{hi._free(t)}}function D6(i,e,t){if(A1e(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=v1e(n,t),s=hi._malloc(f1e);try{xv(Ka.maxPolygonToCellsSize(r,e,0,s));var o=_1e(w1e(s)),a=hi._calloc(o,mE);try{return xv(Ka.polygonToCells(r,e,0,a)),S1e(a,o)}finally{hi._free(a)}}finally{hi._free(s),b1e(r)}}function K$(i){return i*Math.PI/180}function M1e(i){return i*180/Math.PI}function F6(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}var C1e=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],Q$=new WeakMap,J$=new WeakMap,eY=new WeakMap,y8=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=C1e,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,object:r}=e;if(t={geometryId:n.id,worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}let{environmentIntensity:s,environmentRotation:o}=e.scene;t.environmentIntensity=s,t.environmentRotation=o.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.isInterleavedBufferAttribute?r.data.uuid:r.id,version:r.isInterleavedBufferAttribute?r.data.version:r.version}}return t}containsNode(e){let t=e.material;for(let n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=eY.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},eY.set(e,t)),t}getMaterialData(e){let t=J$.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:0}:t[n]=r.clone():t[n]=r)}J$.set(e,t)}return t}equals(e,t,n){let{object:r,material:s,geometry:o}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(r.matrixWorld)!==!0)return a.worldMatrix.copy(r.matrixWorld),!1;let l=this.getMaterialData(e.material);if(l._renderId!==n){l._renderId=n;for(let f in l){let p=l[f],x=s[f];if(f!=="_renderId"&&f!=="_equal"){if(p.equals!==void 0){if(p.equals(x)===!1)return p.copy(x),l._equal=!1,!1}else if(x.isTexture===!0){if(p.id!==x.id||p.version!==x.version)return p.id=x.id,p.version=x.version,l._equal=!1,!1}else if(p!==x)return l[f]=x,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:p}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==p)return a.bufferWidth=f,a.bufferHeight=p,l._equal=!1,!1}l._equal=!0}else if(l._equal===!1)return!1;if(a.geometryId!==o.id)return a.geometryId=o.id,!1;let c=this.getGeometryData(e.geometry);if(c._renderId!==n){c._renderId=n;let f=o.attributes,p=c.attributes,x=0,v=0;for(let C in f)x++;for(let C in p){v++;let L=p[C],D=f[C];if(D===void 0)return delete p[C],c._equal=!1,!1;let F=D.isInterleavedBufferAttribute?D.data.uuid:D.id,N=D.isInterleavedBufferAttribute?D.data.version:D.version;if(L.id!==F||L.version!==N)return L.id=F,L.version=N,c._equal=!1,!1}if(v!==x)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,P=w?w.id:null,R=w?w.version:null;if(S!==P||T!==R)return c.indexId=P,c.indexVersion=R,c._equal=!1,!1;if(c.drawRange.start!==o.drawRange.start||c.drawRange.count!==o.drawRange.count)return c.drawRange.start=o.drawRange.start,c.drawRange.count=o.drawRange.count,c._equal=!1,!1;c._equal=!0}else if(c._equal===!1)return!1;if(a.morphTargetInfluences){let f=!1;for(let p=0;p<a.morphTargetInfluences.length;p++)a.morphTargetInfluences[p]!==r.morphTargetInfluences[p]&&(a.morphTargetInfluences[p]=r.morphTargetInfluences[p],f=!0);if(f)return!1}if(a.lights){for(let f=0;f<t.length;f++)if(a.lights[f].map!==t[f].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(a.environmentIntensity!==u.environmentIntensity||a.environmentRotation.equals(u.environmentRotation)===!1)?(a.environmentIntensity=u.environmentIntensity,a.environmentRotation.copy(u.environmentRotation),!1):a.center&&a.center.equals(r.center)===!1?(a.center.copy(r.center),!1):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){let n=Q$.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},Q$.set(e,n)),n.renderId===t||(n.renderId=t,this.getLightsData(e.getLights(),n.lightsData)),n.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;let o=this.getLights(e.lightsNode,n);return this.equals(e,o,n)!==!0}},R1e=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function P1e(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4130+`).map(t=>{let n=t.match(e);if(!n)return null;let r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!R1e.some(n=>n.test(t.file)))}var Fr=class{constructor(e=null){this.isStackTrace=!0,this.stack=P1e(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(n=>{let r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(`41314131 `);return`${e}4132-${t}`}};function s7(i,e=0){let t=3735928559^e,n=1103547991^e;if(Array.isArray(i))for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}var F1=i=>s7(i),gb=i=>s7(i),zv=(...i)=>s7(i),C1e=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),J$=new WeakMap;function vK(i){return C1e.get(i)}function lM(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function bK(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;Ge(`TSL: Unsupported type: ${i}`,new Fr)}function R1e(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;Ge(`TSL: Unsupported type: ${i}`,new Fr)}function P1e(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i)||/vec4/.test(i))return 4;if(/mat2/.test(i))return 2;if(/mat3/.test(i)||/mat4/.test(i))return 4;Ge(`TSL: Unsupported type: ${i}`,new Fr)}function Qp(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function o7(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new Ut(...e):t==="vec2"?new Oe(...e):t==="vec3"?new ie(...e):t==="vec4"?new gn(...e):t==="mat2"?new w_(...e):t==="mat3"?new Sn(...e):t==="mat4"?new on(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?N1e(e[0]):null}function wK(i){let e=J$.get(i);return e===void 0&&(e={},J$.set(i,e)),e}function I1e(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function N1e(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var p1={VERTEX:"vertex",FRAGMENT:"fragment"},_n={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},L1e={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},So={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},SK=["fragment","vertex"],nM=["setup","analyze","generate"],iM=[...SK,"compute"],Fm=["x","y","z","w"],D1e={analyze:"setup",generate:"analyze"},F1e=0,$t=class i extends ko{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=_n.NONE,this.updateBeforeType=_n.NONE,this.updateAfterType=_n.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=F1e++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new Fr)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Wc.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,_n.FRAME)}onRenderUpdate(e){return this.onUpdate(e,_n.RENDER)}onObjectUpdate(e){return this.onUpdate(e,_n.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let s in r){if(s.startsWith("_")===!0)continue;let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:s}of this._getChildren(t))n.push(F1(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=zv(gb(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){let n=e.getDataFromNode(this),r;return t!==null?(n.typeFromOutput=n.typeFromOutput||{},r=n.typeFromOutput[t],r===void 0&&(r=this.generateNodeType(e,t),n.typeFromOutput[t]=r)):(r=n.type,r===void 0&&(r=this.generateNodeType(e),n.type=r)),r}generateNodeType(e,t=null){let n=e.getNodeProperties(this);return n.outputNode?n.outputNode.getNodeType(e,t):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t),r=null;if(n&&n!==this)r=n;else if(e.context.overrideNodes){let s=e.context.overrideNodes.get(this);if(s){let o=e.getDataFromNode(this);o.isOverwritten!==!0?(o.isOverwritten=!0,r=s(e).overrideNode(this,null),o.sharedNode=r):r=o.sharedNode}}return r||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){let r=e.getNodeProperties(this);for(let s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){je("Abstract function.")}updateAfter(){je("Abstract function.")}update(){je("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let c of l)c.build(e,t);this._beforeNodes=l}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let s=D1e[e.buildStage];if(s&&r.buildStages[s]!==!0){let l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);let l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(let c of Object.values(l))if(c&&c.isNode===!0){if(c.parents===!0){let u=e.getNodeProperties(c);u.parents=u.parents||[],u.parents.push(this)}c.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),u=e.getDataFromNode(this);o=u.snippet,o===void 0?u.generated===void 0?(u.generated=!0,o=this.generate(e)||"",u.snippet=o):(je("Node: Recursion detected.",this),o="/* Recursion detected. */"):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(Ge(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){let r={};for(let s in e.inputNodes[n]){let o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}if(r){let a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}};$t.captureStackTrace=!1;var $f=class extends $t{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}},cM=class extends $t{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}},dr=class extends $t{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}},y8=class extends dr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[],l=0;for(let u of s){if(l>=r){Ge(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),p=e.getTypeLength(f),x;if(l+p>r&&(Ge(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),p=r-l,f=e.getTypeFromLength(p)),l+=p,x=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(p,o);x=e.format(x,f,w)}a.push(x)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},O1e=Fm.join(""),uM=class extends $t{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(Fm.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let l=n.build(e,o);this.components.length===r&&this.components===O1e.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},v8=class extends dr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),f=[];for(let p=0;p<u;p++){let x=Fm[p];x===n[0]?(f.push(l),p+=n.length-1):f.push(c+"."+x)}return`${e.getType(s)}( ${f.join(", ")} )`}},b8=class extends dr{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);let l=e.getTypeLength(r),c=[],u=0;for(let f=0;f<l;f++){let p=Fm[f];p===t[u]?(c.push("1.0 - "+(a+"."+p)),u++):c.push(a+"."+p)}return`${e.getType(r)}( ${c.join(", ")} )`}},Kv=class extends $t{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?Qp(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Qp(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=I1e(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?o7(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){je("Abstract function.")}},eY=/float|u?int/,dc=class extends Kv{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return eY.test(n)&&eY.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},w8=class extends $t{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){je(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}},n0=null,S8=new Map;function Be(i,e){if(S8.has(i)){je(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);S8.set(i,e),i!=="assign"&&($t.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},$t.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var B1e=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),tY=i=>B1e(i).split("").sort().join("");$t.prototype.assign=function(...i){if(this.isStackNode!==!0)return n0!==null?n0.assign(this,...i):Ge("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Fr),this;{let e=S8.get("assign");return this.addToStack(e(...i))}};$t.prototype.toVarIntent=function(){return this};$t.prototype.get=function(i){return new w8(this,i)};var Vv={};function xE(i,e,t){Vv[i]=Vv[e]=Vv[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new uM(this,i),this._cache[i]=o),o},set(o){this[i].assign(Vt(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();$t.prototype["set"+n]=$t.prototype["set"+r]=$t.prototype["set"+s]=function(o){let a=tY(i);return new v8(this,a,Vt(o))},$t.prototype["flip"+n]=$t.prototype["flip"+r]=$t.prototype["flip"+s]=function(){let o=tY(i);return new b8(this,o)}}var fh=["x","y","z","w"],dh=["r","g","b","a"],ph=["s","t","p","q"];for(let i=0;i<4;i++){let e=fh[i],t=dh[i],n=ph[i];xE(e,t,n);for(let r=0;r<4;r++){e=fh[i]+fh[r],t=dh[i]+dh[r],n=ph[i]+ph[r],xE(e,t,n);for(let s=0;s<4;s++){e=fh[i]+fh[r]+fh[s],t=dh[i]+dh[r]+dh[s],n=ph[i]+ph[r]+ph[s],xE(e,t,n);for(let o=0;o<4;o++)e=fh[i]+fh[r]+fh[s]+fh[o],t=dh[i]+dh[r]+dh[s]+dh[o],n=ph[i]+ph[r]+ph[s]+ph[o],xE(e,t,n)}}}for(let i=0;i<32;i++)Vv[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new $f(this,new dc(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Vt(e))}};Object.defineProperties($t.prototype,Vv);var U1e=function(i,e=null){let t=Qp(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Vt(M8(i,e)):t==="shader"?i.isFn?i:Ae(i):i},k1e=function(i,e=null){for(let t in i)i[t]=Vt(i[t],e);return i},G1e=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Vt(i[n],e);return i},TK=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Vt(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Vt(u),u}let s,o=e,a,l;function c(u){let f;return o?f=/[a-z]/i.test(o)?o+"()":o:f=i.type,a!==void 0&&u.length<a?(Ge(`TSL: "${f}" parameter length is less than minimum required.`,new Fr),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(Ge(`TSL: "${f}" parameter length exceeds limit.`,new Fr),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...xm(c(u)))):t!==null?(t=Vt(t),s=(...u)=>r(new i(e,...xm(c(u)),t))):s=(...u)=>r(new i(e,...xm(c(u)))),s.setParameterLength=(...u)=>(u.length===1?a=l=u[0]:u.length===2&&([a,l]=u),s),s.setName=u=>(o=u,s),s},z1e=function(i,...e){return new i(...xm(e))},T8=class extends $t{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];let a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let c=null;if(t.layout){if(n){let p=t.layout.inputs;if(EK(n)){let x=n;for(let v=0;v<p.length;v++){let w=x[v];w&&w.isNode&&w.build(e)}}else{let x=n[0];for(let v of p){let w=x[v.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?V1e(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let P;return Symbol.iterator===S?P=function*(){yield void 0}:P=Reflect.get(w,S,T),P}}),f=n?q1e(n):null,p=Array.isArray(n)?n.length>0:n!==null,x=t.jsFunc,v=p||x.length>1?x(f,u):x(u);c=Vt(v)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){let c=e.getSubBuildProperty("initialized",this);if(s[c]!==!0&&(s[c]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let f=e.getDataFromNode(u,"any");f.subBuilds=f.subBuilds||new Set;for(let p of this.shaderNode.subBuilds)f.subBuilds.add(p)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function EK(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function V1e(i){let e;return wC(i),EK(i)?e=[...i]:e=i[0],e}function q1e(i){let e=0;return wC(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(let o of i)yield Vt(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof $t&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Vt(s)}return s}})}var E8=class extends $t{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new T8(this,e)}setup(){return this.call()}},H1e=[!1,!0],W1e=[0,1,2,3],j1e=[-1,-2],MK=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],a7=new Map;for(let i of H1e)a7.set(i,new dc(i));var l7=new Map;for(let i of W1e)l7.set(i,new dc(i,"uint"));var c7=new Map([...l7].map(i=>new dc(i.value,"int")));for(let i of j1e)c7.set(i,new dc(i,"int"));var vC=new Map([...c7].map(i=>new dc(i.value)));for(let i of MK)vC.set(i,new dc(i));for(let i of MK)vC.set(-i,new dc(-i));var bC={bool:a7,uint:l7,ints:c7,float:vC},nY=new Map([...a7,...vC]),M8=(i,e)=>nY.has(i)?nY.get(i):i.isNode===!0?i:new dc(i,e),Ms=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return Ge(`TSL: Invalid parameter for the type "${i}".`,new Fr),new dc(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{let s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[o7(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return kv(e.get(t[0]));if(t.length===1){let r=M8(t[0],i);return r.nodeType===i?kv(r):kv(new cM(r,i))}let n=t.map(r=>M8(r));return kv(new y8(n,i))}};function T1(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var CK=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function g1(i,e){return new E8(i,e)}var Vt=(i,e=null)=>U1e(i,e),kv=(i,e=null)=>Vt(i,e).toVarIntent(),wC=(i,e=null)=>new k1e(i,e),xm=(i,e=null)=>new G1e(i,e),Vn=(i,e=null,t=null,n=null)=>new TK(i,e,t,n),xt=(i,...e)=>new z1e(i,...e),lt=(i,e=null,t=null,n={})=>new TK(i,e,t,{...n,intent:!0}),u7=(i,e)=>new Proxy(i,{get(t,n,r){return Reflect.get(e,n,r)},set(t,n,r){return Reflect.set(e,n,r)}}),X1e=0,C8=class extends $t{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:Ge("TSL: Invalid layout type.",new Fr),t=null)),this.shaderNode=new g1(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let n={name:"fn"+X1e++,type:t,inputs:[]};for(let r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return Ge('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function Ae(i,e=null){let t=new C8(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}var Zv=i=>{n0=i},h7=()=>n0,Wt=(...i)=>n0.If(...i),$1e=(...i)=>n0.Switch(...i);function SC(i){return n0&&n0.addToStack(i),i}Be("toStack",SC);var RK=new Ms("color"),se=new Ms("float",bC.float),fe=new Ms("int",bC.ints),it=new Ms("uint",bC.uint),Pl=new Ms("bool",bC.bool),ft=new Ms("vec2"),vr=new Ms("ivec2"),f7=new Ms("uvec2"),PK=new Ms("bvec2"),pe=new Ms("vec3"),d7=new Ms("ivec3"),Om=new Ms("uvec3"),p7=new Ms("bvec3"),Lt=new Ms("vec4"),A7=new Ms("ivec4"),m7=new Ms("uvec4"),IK=new Ms("bvec4"),TC=new Ms("mat2"),io=new Ms("mat3"),e0=new Ms("mat4");Be("toColor",RK);Be("toFloat",se);Be("toInt",fe);Be("toUint",it);Be("toBool",Pl);Be("toVec2",ft);Be("toIVec2",vr);Be("toUVec2",f7);Be("toBVec2",PK);Be("toVec3",pe);Be("toIVec3",d7);Be("toUVec3",Om);Be("toBVec3",p7);Be("toVec4",Lt);Be("toIVec4",A7);Be("toUVec4",m7);Be("toBVec4",IK);Be("toMat2",TC);Be("toMat3",io);Be("toMat4",e0);var NK=Vn($f).setParameterLength(2),LK=(i,e)=>new cM(Vt(i),e),Y1e=(i,e)=>new uM(Vt(i),e);Be("element",NK);Be("convert",LK);var K1e=i=>(je("TSL: append() has been renamed to Stack().",new Fr),SC(i));Be("append",i=>(je("TSL: .append() has been renamed to .toStack().",new Fr),SC(i)));var fi=class extends $t{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Vt(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return F1(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let n=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${n}`,this)}return e.getPropertyName(t)}},Zf=(i,e,t=null)=>new fi(i,e,!1,t),Bm=(i,e,t=null)=>new fi(i,e,!0,t),Mi=xt(fi,"vec4","DiffuseColor"),dm=xt(fi,"vec3","DiffuseContribution"),R8=xt(fi,"vec3","EmissiveColor"),vh=xt(fi,"float","Roughness"),Xf=xt(fi,"float","Metalness"),hM=xt(fi,"float","Clearcoat"),x1=xt(fi,"float","ClearcoatRoughness"),El=xt(fi,"vec3","Sheen"),Xp=xt(fi,"float","SheenRoughness"),EC=xt(fi,"float","Iridescence"),fM=xt(fi,"float","IridescenceIOR"),dM=xt(fi,"float","IridescenceThickness"),pM=xt(fi,"float","AlphaT"),jp=xt(fi,"float","Anisotropy"),qv=xt(fi,"vec3","AnisotropyT"),ym=xt(fi,"vec3","AnisotropyB"),i0=xt(fi,"color","SpecularColor"),Am=xt(fi,"color","SpecularColorBlended"),mm=xt(fi,"float","SpecularF90"),AM=xt(fi,"float","Shininess"),y1=xt(fi,"output","Output"),vm=xt(fi,"float","dashSize"),Qv=xt(fi,"float","gapSize"),Z1e=xt(fi,"float","pointWidth"),Hv=xt(fi,"float","IOR"),mM=xt(fi,"float","Transmission"),g7=xt(fi,"float","Thickness"),_7=xt(fi,"float","AttenuationDistance"),x7=xt(fi,"color","AttenuationColor"),y7=xt(fi,"float","Dispersion"),P8=xt(fi,"float","AmbientOcclusion",!1,1),gM=class extends $t{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1,r=null){super("string"),this.name=e,this.shared=t,this.order=n,this.updateType=r,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},DK=(i,e=1,t=null)=>new gM(i,!1,e,t),MC=(i,e=0,t=null)=>new gM(i,!0,e,t),Q1e=MC("frame",0,_n.FRAME),Kt=MC("render",0,_n.RENDER),FK=DK("object",1,_n.OBJECT),Em=class extends Kv{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=FK}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Fr),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{let r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);let o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=l;if(n==="bool"){let u=e.getDataFromNode(this),f=u.propertyName;if(f===void 0){let p=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(p),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Ht=(i,e)=>{let t=CK(e||i);if(t===i&&(i=o7(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Em(i,t)},_M=class extends dr{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},OK=(...i)=>{let e;if(i.length===1){let t=i[0];e=new _M(null,t.length,t)}else{let t=i[0],n=i[1];e=new _M(t,n)}return Vt(e)};Be("toArray",(i,e)=>OK(Array(e).fill(i)));var I8=class extends dr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return Fm.join("").slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),c=r.getNodeType(e),u=e.getDataFromNode(this),f;if(u.initialized===!0)t!=="void"&&(f=o);else if(s){let p=e.getVarFromNode(this,null,a),x=e.getPropertyName(p);e.addLineFlowCode(`${x} = ${l}`,this);let v=n.node,S=v.node.context({assign:!0}).build(e);for(let T=0;T<v.components.length;T++){let P=v.components[T];e.addLineFlowCode(`${S}.${P} = ${x}[ ${T} ]`,this)}t!=="void"&&(f=o)}else f=`${o} = ${l}`,(t==="void"||c==="void")&&(e.addLineFlowCode(f,this),t!=="void"&&(f=o));return u.initialized=!0,e.format(f,a,t)}},BK=Vn(I8).setParameterLength(2);Be("assign",BK);var N8=class extends dr{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,c)=>{let u=c.type,f=u==="pointer",p;return f?p="&"+l.build(e):p=l.build(e,u),p};if(Array.isArray(s)){if(s.length>r.length)Ge("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(Ge("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(se(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(let l of r){let c=s[l.name];c!==void 0?t.push(o(c,l)):(Ge(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(se(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},UK=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?xm(e):wC(e[0]),new N8(Vt(i),e));Be("call",UK);var J1e={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},Or=class i extends dr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new i(e,t,n);for(let o=0;o<r.length-1;o++)s=new i(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(J1e[this.op],t)}generateNodeType(e,t=null){let n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="&&"||n==="||"||n==="^^")return"bool";if(n==="!"){let l=e.getTypeLength(o);return l>1?`bvec${l}`:"bool"}else if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){let l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t),a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;let c=r.build(e,a),u=s?s.build(e,l):null,f=e.getFunctionOperator(n);if(t!=="void"){let p=e.renderer.coordinateSystem===po;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return p?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${c} % ${u} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${u} )`,o,t);if(n==="!")return p&&e.isVector(a)?e.format(`not( ${c} )`,t):e.format(`( ${n} ${c} )`,a,t);if(n==="~")return e.format(`( ${n} ${c} )`,a,t);if(f)return e.format(`${f}( ${c}, ${u} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${u} ${n} ${c} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${c} ${n} ${u}`,o,t);{let x=`( ${c} ${n} ${u} )`;return!p&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(x=`all${x}`),e.format(x,o,t)}}else if(a!=="void")return f?e.format(`${f}( ${c}, ${u} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${u} ${n} ${c}`,o,t):e.format(`${c} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},cs=lt(Or,"+").setParameterLength(2,1/0).setName("add"),ni=lt(Or,"-").setParameterLength(2,1/0).setName("sub"),bn=lt(Or,"*").setParameterLength(2,1/0).setName("mul"),Il=lt(Or,"/").setParameterLength(2,1/0).setName("div"),CC=lt(Or,"%").setParameterLength(2).setName("mod"),kK=lt(Or,"==").setParameterLength(2).setName("equal"),GK=lt(Or,"!=").setParameterLength(2).setName("notEqual"),zK=lt(Or,"<").setParameterLength(2).setName("lessThan"),v7=lt(Or,">").setParameterLength(2).setName("greaterThan"),VK=lt(Or,"<=").setParameterLength(2).setName("lessThanEqual"),qK=lt(Or,">=").setParameterLength(2).setName("greaterThanEqual"),HK=lt(Or,"&&").setParameterLength(2,1/0).setName("and"),WK=lt(Or,"||").setParameterLength(2,1/0).setName("or"),jK=lt(Or,"!").setParameterLength(1).setName("not"),XK=lt(Or,"^^").setParameterLength(2).setName("xor"),$K=lt(Or,"&").setParameterLength(2).setName("bitAnd"),YK=lt(Or,"~").setParameterLength(1).setName("bitNot"),KK=lt(Or,"|").setParameterLength(2).setName("bitOr"),ZK=lt(Or,"^").setParameterLength(2).setName("bitXor"),QK=lt(Or,"<<").setParameterLength(2).setName("shiftLeft"),JK=lt(Or,">>").setParameterLength(2).setName("shiftRight"),eZ=Ae(([i])=>(i.addAssign(1),i)),tZ=Ae(([i])=>(i.subAssign(1),i)),nZ=Ae(([i])=>{let e=fe(i).toConst();return i.addAssign(1),e}),iZ=Ae(([i])=>{let e=fe(i).toConst();return i.subAssign(1),e});Be("add",cs);Be("sub",ni);Be("mul",bn);Be("div",Il);Be("mod",CC);Be("equal",kK);Be("notEqual",GK);Be("lessThan",zK);Be("greaterThan",v7);Be("lessThanEqual",VK);Be("greaterThanEqual",qK);Be("and",HK);Be("or",WK);Be("not",jK);Be("xor",XK);Be("bitAnd",$K);Be("bitNot",YK);Be("bitOr",KK);Be("bitXor",ZK);Be("shiftLeft",QK);Be("shiftRight",JK);Be("incrementBefore",eZ);Be("decrementBefore",tZ);Be("increment",nZ);Be("decrement",iZ);var Re=class i extends dr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let s=new i(e,t,n);for(let o=3;o<arguments.length-1;o++)s=new i(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}generateNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:n,method:r}=this,s=null;if(r===i.ONE_MINUS)s=ni(1,t);else if(r===i.RECIPROCAL)s=Il(1,t);else if(r===i.DIFFERENCE)s=Qi(ni(t,n));else if(r===i.TRANSFORM_DIRECTION){let o,a;e.isMatrix(t.getNodeType(e))?(o=t,a=n):(o=n,a=t),s=Zo(bn(o,Lt(pe(a),0)).xyz)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,c=this.cNode,u=e.renderer.coordinateSystem;if(r===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{let f=[];return r===i.CROSS?f.push(a.build(e,s),l.build(e,s)):u===po&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===po&&(r===i.MIN||r===i.MAX)?f.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===i.REFRACT?f.push(a.build(e,o),l.build(e,o),c.build(e,"float")):r===i.MIX?f.push(a.build(e,o),l.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(u===Va&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(je(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),f.push(a.build(e,o)),l!==null&&f.push(l.build(e,o)),c!==null&&f.push(c.build(e,o))),e.format(`${e.getMethod(r,s)}( ${f.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Re.ALL="all";Re.ANY="any";Re.RADIANS="radians";Re.DEGREES="degrees";Re.EXP="exp";Re.EXP2="exp2";Re.LOG="log";Re.LOG2="log2";Re.SQRT="sqrt";Re.INVERSE_SQRT="inversesqrt";Re.FLOOR="floor";Re.CEIL="ceil";Re.NORMALIZE="normalize";Re.FRACT="fract";Re.SIN="sin";Re.SINH="sinh";Re.COS="cos";Re.COSH="cosh";Re.TAN="tan";Re.TANH="tanh";Re.ASIN="asin";Re.ASINH="asinh";Re.ACOS="acos";Re.ACOSH="acosh";Re.ATAN="atan";Re.ATANH="atanh";Re.ABS="abs";Re.SIGN="sign";Re.LENGTH="length";Re.NEGATE="negate";Re.ONE_MINUS="oneMinus";Re.DFDX="dFdx";Re.DFDY="dFdy";Re.ROUND="round";Re.RECIPROCAL="reciprocal";Re.TRUNC="trunc";Re.FWIDTH="fwidth";Re.TRANSPOSE="transpose";Re.DETERMINANT="determinant";Re.INVERSE="inverse";Re.EQUALS="equals";Re.MIN="min";Re.MAX="max";Re.STEP="step";Re.REFLECT="reflect";Re.DISTANCE="distance";Re.DIFFERENCE="difference";Re.DOT="dot";Re.CROSS="cross";Re.POW="pow";Re.TRANSFORM_DIRECTION="transformDirection";Re.MIX="mix";Re.CLAMP="clamp";Re.REFRACT="refract";Re.SMOOTHSTEP="smoothstep";Re.FACEFORWARD="faceforward";var RC=se(1e-6),exe=se(1e6),xM=se(Math.PI),txe=se(Math.PI*2),nxe=se(Math.PI*2),ixe=se(Math.PI*.5),rZ=lt(Re,Re.ALL).setParameterLength(1),sZ=lt(Re,Re.ANY).setParameterLength(1),oZ=lt(Re,Re.RADIANS).setParameterLength(1),aZ=lt(Re,Re.DEGREES).setParameterLength(1),b7=lt(Re,Re.EXP).setParameterLength(1),E1=lt(Re,Re.EXP2).setParameterLength(1),PC=lt(Re,Re.LOG).setParameterLength(1),wh=lt(Re,Re.LOG2).setParameterLength(1),Ea=lt(Re,Re.SQRT).setParameterLength(1),w7=lt(Re,Re.INVERSE_SQRT).setParameterLength(1),Sh=lt(Re,Re.FLOOR).setParameterLength(1),IC=lt(Re,Re.CEIL).setParameterLength(1),Zo=lt(Re,Re.NORMALIZE).setParameterLength(1),iu=lt(Re,Re.FRACT).setParameterLength(1),wa=lt(Re,Re.SIN).setParameterLength(1),lZ=lt(Re,Re.SINH).setParameterLength(1),Jc=lt(Re,Re.COS).setParameterLength(1),cZ=lt(Re,Re.COSH).setParameterLength(1),uZ=lt(Re,Re.TAN).setParameterLength(1),hZ=lt(Re,Re.TANH).setParameterLength(1),fZ=lt(Re,Re.ASIN).setParameterLength(1),dZ=lt(Re,Re.ASINH).setParameterLength(1),S7=lt(Re,Re.ACOS).setParameterLength(1),pZ=lt(Re,Re.ACOSH).setParameterLength(1),T7=lt(Re,Re.ATAN).setParameterLength(1,2),AZ=lt(Re,Re.ATANH).setParameterLength(1),Qi=lt(Re,Re.ABS).setParameterLength(1),E7=lt(Re,Re.SIGN).setParameterLength(1),Th=lt(Re,Re.LENGTH).setParameterLength(1),M7=lt(Re,Re.NEGATE).setParameterLength(1),mZ=lt(Re,Re.ONE_MINUS).setParameterLength(1),C7=lt(Re,Re.DFDX).setParameterLength(1),R7=lt(Re,Re.DFDY).setParameterLength(1),gZ=lt(Re,Re.ROUND).setParameterLength(1),_Z=lt(Re,Re.RECIPROCAL).setParameterLength(1),P7=lt(Re,Re.TRUNC).setParameterLength(1),I7=lt(Re,Re.FWIDTH).setParameterLength(1),xZ=lt(Re,Re.TRANSPOSE).setParameterLength(1),yZ=lt(Re,Re.DETERMINANT).setParameterLength(1),vZ=lt(Re,Re.INVERSE).setParameterLength(1),Za=lt(Re,Re.MIN).setParameterLength(2,1/0),br=lt(Re,Re.MAX).setParameterLength(2,1/0),Mm=lt(Re,Re.STEP).setParameterLength(2),bZ=lt(Re,Re.REFLECT).setParameterLength(2),wZ=lt(Re,Re.DISTANCE).setParameterLength(2),SZ=lt(Re,Re.DIFFERENCE).setParameterLength(2),pc=lt(Re,Re.DOT).setParameterLength(2),Yf=lt(Re,Re.CROSS).setParameterLength(2),uc=lt(Re,Re.POW).setParameterLength(2),N7=i=>bn(i,i),TZ=i=>bn(i,i,i),L7=i=>bn(i,i,i,i),EZ=lt(Re,Re.TRANSFORM_DIRECTION).setParameterLength(2),MZ=(i,e)=>Zo(bn(e,Lt(pe(i),0)).xyz),CZ=(i,e)=>Zo(Lt(pe(i),0).mul(e).xyz),RZ=i=>bn(E7(i),uc(Qi(i),1/3)),D7=i=>pc(i,i),jn=lt(Re,Re.MIX).setParameterLength(3),ru=(i,e=0,t=1)=>new Re(Re.CLAMP,Vt(i),Vt(e),Vt(t)),NC=i=>ru(i),F7=lt(Re,Re.REFRACT).setParameterLength(3),Nl=lt(Re,Re.SMOOTHSTEP).setParameterLength(3),O7=lt(Re,Re.FACEFORWARD).setParameterLength(3),PZ=Ae(([i])=>{let n=43758.5453,r=pc(i.xy,ft(12.9898,78.233)),s=CC(r,xM);return iu(wa(s).mul(n))}),IZ=(i,e,t)=>jn(e,t,i),NZ=(i,e,t)=>Nl(e,t,i),LZ=(i,e)=>Mm(e,i),rxe=O7,sxe=w7;Be("all",rZ);Be("any",sZ);Be("radians",oZ);Be("degrees",aZ);Be("exp",b7);Be("exp2",E1);Be("log",PC);Be("log2",wh);Be("sqrt",Ea);Be("inverseSqrt",w7);Be("floor",Sh);Be("ceil",IC);Be("normalize",Zo);Be("fract",iu);Be("sin",wa);Be("sinh",lZ);Be("cos",Jc);Be("cosh",cZ);Be("tan",uZ);Be("tanh",hZ);Be("asin",fZ);Be("asinh",dZ);Be("acos",S7);Be("acosh",pZ);Be("atan",T7);Be("atanh",AZ);Be("abs",Qi);Be("sign",E7);Be("length",Th);Be("lengthSq",D7);Be("negate",M7);Be("oneMinus",mZ);Be("dFdx",C7);Be("dFdy",R7);Be("round",gZ);Be("reciprocal",_Z);Be("trunc",P7);Be("fwidth",I7);Be("min",Za);Be("max",br);Be("step",LZ);Be("reflect",bZ);Be("distance",wZ);Be("dot",pc);Be("cross",Yf);Be("pow",uc);Be("pow2",N7);Be("pow3",TZ);Be("pow4",L7);Be("transformDirection",EZ);Be("transformNormalByViewMatrix",MZ);Be("transformNormalByInverseViewMatrix",CZ);Be("mix",IZ);Be("clamp",ru);Be("refract",F7);Be("smoothstep",NZ);Be("faceForward",O7);Be("difference",SZ);Be("saturate",NC);Be("cbrt",RZ);Be("transpose",xZ);Be("determinant",yZ);Be("inverse",vZ);Be("rand",PZ);var L8=class extends $t{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}generateNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,c=t!=="void",u=c?Zf(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let v=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,v,w);return e.format(S,n,t)}e.addFlowCode(`4132+${t}`}};function o7(i,e=0){let t=3735928559^e,n=1103547991^e;if(Array.isArray(i))for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}var F1=i=>o7(i),gb=i=>o7(i),zv=(...i)=>o7(i),I1e=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),tY=new WeakMap;function wZ(i){return I1e.get(i)}function lM(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function SZ(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;Ge(`TSL: Unsupported type: ${i}`,new Fr)}function N1e(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;Ge(`TSL: Unsupported type: ${i}`,new Fr)}function L1e(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i)||/vec4/.test(i))return 4;if(/mat2/.test(i))return 2;if(/mat3/.test(i)||/mat4/.test(i))return 4;Ge(`TSL: Unsupported type: ${i}`,new Fr)}function Qp(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function a7(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new Ut(...e):t==="vec2"?new Oe(...e):t==="vec3"?new ie(...e):t==="vec4"?new gn(...e):t==="mat2"?new w_(...e):t==="mat3"?new Sn(...e):t==="mat4"?new on(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?F1e(e[0]):null}function TZ(i){let e=tY.get(i);return e===void 0&&(e={},tY.set(i,e)),e}function D1e(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function F1e(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var p1={VERTEX:"vertex",FRAGMENT:"fragment"},_n={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},O1e={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},So={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},EZ=["fragment","vertex"],nM=["setup","analyze","generate"],iM=[...EZ,"compute"],Om=["x","y","z","w"],B1e={analyze:"setup",generate:"analyze"},U1e=0,$t=class i extends Go{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=_n.NONE,this.updateBeforeType=_n.NONE,this.updateAfterType=_n.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=U1e++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new Fr)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Wc.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,_n.FRAME)}onRenderUpdate(e){return this.onUpdate(e,_n.RENDER)}onObjectUpdate(e){return this.onUpdate(e,_n.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let s in r){if(s.startsWith("_")===!0)continue;let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:s}of this._getChildren(t))n.push(F1(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=zv(gb(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){let n=e.getDataFromNode(this),r;return t!==null?(n.typeFromOutput=n.typeFromOutput||{},r=n.typeFromOutput[t],r===void 0&&(r=this.generateNodeType(e,t),n.typeFromOutput[t]=r)):(r=n.type,r===void 0&&(r=this.generateNodeType(e),n.type=r)),r}generateNodeType(e,t=null){let n=e.getNodeProperties(this);return n.outputNode?n.outputNode.getNodeType(e,t):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t),r=null;if(n&&n!==this)r=n;else if(e.context.overrideNodes){let s=e.context.overrideNodes.get(this);if(s){let o=e.getDataFromNode(this);o.isOverwritten!==!0?(o.isOverwritten=!0,r=s(e).overrideNode(this,null),o.sharedNode=r):r=o.sharedNode}}return r||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){let r=e.getNodeProperties(this);for(let s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){je("Abstract function.")}updateAfter(){je("Abstract function.")}update(){je("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let c of l)c.build(e,t);this._beforeNodes=l}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let s=B1e[e.buildStage];if(s&&r.buildStages[s]!==!0){let l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);let l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(let c of Object.values(l))if(c&&c.isNode===!0){if(c.parents===!0){let u=e.getNodeProperties(c);u.parents=u.parents||[],u.parents.push(this)}c.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),u=e.getDataFromNode(this);o=u.snippet,o===void 0?u.generated===void 0?(u.generated=!0,o=this.generate(e)||"",u.snippet=o):(je("Node: Recursion detected.",this),o="/* Recursion detected. */"):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(Ge(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){let r={};for(let s in e.inputNodes[n]){let o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}if(r){let a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}};$t.captureStackTrace=!1;var $f=class extends $t{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}},cM=class extends $t{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}},dr=class extends $t{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}},v8=class extends dr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[],l=0;for(let u of s){if(l>=r){Ge(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),p=e.getTypeLength(f),x;if(l+p>r&&(Ge(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),p=r-l,f=e.getTypeFromLength(p)),l+=p,x=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(p,o);x=e.format(x,f,w)}a.push(x)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},k1e=Om.join(""),uM=class extends $t{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(Om.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let l=n.build(e,o);this.components.length===r&&this.components===k1e.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},b8=class extends dr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),f=[];for(let p=0;p<u;p++){let x=Om[p];x===n[0]?(f.push(l),p+=n.length-1):f.push(c+"."+x)}return`${e.getType(s)}( ${f.join(", ")} )`}},w8=class extends dr{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);let l=e.getTypeLength(r),c=[],u=0;for(let f=0;f<l;f++){let p=Om[f];p===t[u]?(c.push("1.0 - "+(a+"."+p)),u++):c.push(a+"."+p)}return`${e.getType(r)}( ${c.join(", ")} )`}},Zv=class extends $t{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?Qp(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Qp(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=D1e(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?a7(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){je("Abstract function.")}},nY=/float|u?int/,dc=class extends Zv{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return nY.test(n)&&nY.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},S8=class extends $t{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){je(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}},n0=null,T8=new Map;function Be(i,e){if(T8.has(i)){je(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);T8.set(i,e),i!=="assign"&&($t.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},$t.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var G1e=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),iY=i=>G1e(i).split("").sort().join("");$t.prototype.assign=function(...i){if(this.isStackNode!==!0)return n0!==null?n0.assign(this,...i):Ge("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Fr),this;{let e=T8.get("assign");return this.addToStack(e(...i))}};$t.prototype.toVarIntent=function(){return this};$t.prototype.get=function(i){return new S8(this,i)};var Vv={};function xE(i,e,t){Vv[i]=Vv[e]=Vv[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new uM(this,i),this._cache[i]=o),o},set(o){this[i].assign(Vt(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();$t.prototype["set"+n]=$t.prototype["set"+r]=$t.prototype["set"+s]=function(o){let a=iY(i);return new b8(this,a,Vt(o))},$t.prototype["flip"+n]=$t.prototype["flip"+r]=$t.prototype["flip"+s]=function(){let o=iY(i);return new w8(this,o)}}var fh=["x","y","z","w"],dh=["r","g","b","a"],ph=["s","t","p","q"];for(let i=0;i<4;i++){let e=fh[i],t=dh[i],n=ph[i];xE(e,t,n);for(let r=0;r<4;r++){e=fh[i]+fh[r],t=dh[i]+dh[r],n=ph[i]+ph[r],xE(e,t,n);for(let s=0;s<4;s++){e=fh[i]+fh[r]+fh[s],t=dh[i]+dh[r]+dh[s],n=ph[i]+ph[r]+ph[s],xE(e,t,n);for(let o=0;o<4;o++)e=fh[i]+fh[r]+fh[s]+fh[o],t=dh[i]+dh[r]+dh[s]+dh[o],n=ph[i]+ph[r]+ph[s]+ph[o],xE(e,t,n)}}}for(let i=0;i<32;i++)Vv[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new $f(this,new dc(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Vt(e))}};Object.defineProperties($t.prototype,Vv);var z1e=function(i,e=null){let t=Qp(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Vt(C8(i,e)):t==="shader"?i.isFn?i:Ae(i):i},V1e=function(i,e=null){for(let t in i)i[t]=Vt(i[t],e);return i},q1e=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Vt(i[n],e);return i},MZ=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Vt(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Vt(u),u}let s,o=e,a,l;function c(u){let f;return o?f=/[a-z]/i.test(o)?o+"()":o:f=i.type,a!==void 0&&u.length<a?(Ge(`TSL: "${f}" parameter length is less than minimum required.`,new Fr),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(Ge(`TSL: "${f}" parameter length exceeds limit.`,new Fr),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...ym(c(u)))):t!==null?(t=Vt(t),s=(...u)=>r(new i(e,...ym(c(u)),t))):s=(...u)=>r(new i(e,...ym(c(u)))),s.setParameterLength=(...u)=>(u.length===1?a=l=u[0]:u.length===2&&([a,l]=u),s),s.setName=u=>(o=u,s),s},H1e=function(i,...e){return new i(...ym(e))},E8=class extends $t{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];let a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let c=null;if(t.layout){if(n){let p=t.layout.inputs;if(CZ(n)){let x=n;for(let v=0;v<p.length;v++){let w=x[v];w&&w.isNode&&w.build(e)}}else{let x=n[0];for(let v of p){let w=x[v.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?W1e(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let P;return Symbol.iterator===S?P=function*(){yield void 0}:P=Reflect.get(w,S,T),P}}),f=n?j1e(n):null,p=Array.isArray(n)?n.length>0:n!==null,x=t.jsFunc,v=p||x.length>1?x(f,u):x(u);c=Vt(v)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){let c=e.getSubBuildProperty("initialized",this);if(s[c]!==!0&&(s[c]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let f=e.getDataFromNode(u,"any");f.subBuilds=f.subBuilds||new Set;for(let p of this.shaderNode.subBuilds)f.subBuilds.add(p)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function CZ(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function W1e(i){let e;return wC(i),CZ(i)?e=[...i]:e=i[0],e}function j1e(i){let e=0;return wC(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(let o of i)yield Vt(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof $t&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Vt(s)}return s}})}var M8=class extends $t{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new E8(this,e)}setup(){return this.call()}},X1e=[!1,!0],$1e=[0,1,2,3],Y1e=[-1,-2],RZ=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],l7=new Map;for(let i of X1e)l7.set(i,new dc(i));var c7=new Map;for(let i of $1e)c7.set(i,new dc(i,"uint"));var u7=new Map([...c7].map(i=>new dc(i.value,"int")));for(let i of Y1e)u7.set(i,new dc(i,"int"));var vC=new Map([...u7].map(i=>new dc(i.value)));for(let i of RZ)vC.set(i,new dc(i));for(let i of RZ)vC.set(-i,new dc(-i));var bC={bool:l7,uint:c7,ints:u7,float:vC},rY=new Map([...l7,...vC]),C8=(i,e)=>rY.has(i)?rY.get(i):i.isNode===!0?i:new dc(i,e),Cs=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return Ge(`TSL: Invalid parameter for the type "${i}".`,new Fr),new dc(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{let s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[a7(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return kv(e.get(t[0]));if(t.length===1){let r=C8(t[0],i);return r.nodeType===i?kv(r):kv(new cM(r,i))}let n=t.map(r=>C8(r));return kv(new v8(n,i))}};function T1(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var PZ=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function g1(i,e){return new M8(i,e)}var Vt=(i,e=null)=>z1e(i,e),kv=(i,e=null)=>Vt(i,e).toVarIntent(),wC=(i,e=null)=>new V1e(i,e),ym=(i,e=null)=>new q1e(i,e),Vn=(i,e=null,t=null,n=null)=>new MZ(i,e,t,n),xt=(i,...e)=>new H1e(i,...e),lt=(i,e=null,t=null,n={})=>new MZ(i,e,t,{...n,intent:!0}),h7=(i,e)=>new Proxy(i,{get(t,n,r){return Reflect.get(e,n,r)},set(t,n,r){return Reflect.set(e,n,r)}}),Z1e=0,R8=class extends $t{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:Ge("TSL: Invalid layout type.",new Fr),t=null)),this.shaderNode=new g1(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let n={name:"fn"+Z1e++,type:t,inputs:[]};for(let r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return Ge('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function Ae(i,e=null){let t=new R8(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}var Kv=i=>{n0=i},f7=()=>n0,Wt=(...i)=>n0.If(...i),K1e=(...i)=>n0.Switch(...i);function SC(i){return n0&&n0.addToStack(i),i}Be("toStack",SC);var IZ=new Cs("color"),se=new Cs("float",bC.float),fe=new Cs("int",bC.ints),it=new Cs("uint",bC.uint),Pl=new Cs("bool",bC.bool),ft=new Cs("vec2"),vr=new Cs("ivec2"),d7=new Cs("uvec2"),NZ=new Cs("bvec2"),pe=new Cs("vec3"),p7=new Cs("ivec3"),Bm=new Cs("uvec3"),A7=new Cs("bvec3"),Lt=new Cs("vec4"),m7=new Cs("ivec4"),g7=new Cs("uvec4"),LZ=new Cs("bvec4"),TC=new Cs("mat2"),io=new Cs("mat3"),e0=new Cs("mat4");Be("toColor",IZ);Be("toFloat",se);Be("toInt",fe);Be("toUint",it);Be("toBool",Pl);Be("toVec2",ft);Be("toIVec2",vr);Be("toUVec2",d7);Be("toBVec2",NZ);Be("toVec3",pe);Be("toIVec3",p7);Be("toUVec3",Bm);Be("toBVec3",A7);Be("toVec4",Lt);Be("toIVec4",m7);Be("toUVec4",g7);Be("toBVec4",LZ);Be("toMat2",TC);Be("toMat3",io);Be("toMat4",e0);var DZ=Vn($f).setParameterLength(2),FZ=(i,e)=>new cM(Vt(i),e),Q1e=(i,e)=>new uM(Vt(i),e);Be("element",DZ);Be("convert",FZ);var J1e=i=>(je("TSL: append() has been renamed to Stack().",new Fr),SC(i));Be("append",i=>(je("TSL: .append() has been renamed to .toStack().",new Fr),SC(i)));var fi=class extends $t{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Vt(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return F1(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let n=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${n}`,this)}return e.getPropertyName(t)}},Kf=(i,e,t=null)=>new fi(i,e,!1,t),Um=(i,e,t=null)=>new fi(i,e,!0,t),Mi=xt(fi,"vec4","DiffuseColor"),pm=xt(fi,"vec3","DiffuseContribution"),P8=xt(fi,"vec3","EmissiveColor"),vh=xt(fi,"float","Roughness"),Xf=xt(fi,"float","Metalness"),hM=xt(fi,"float","Clearcoat"),x1=xt(fi,"float","ClearcoatRoughness"),El=xt(fi,"vec3","Sheen"),Xp=xt(fi,"float","SheenRoughness"),EC=xt(fi,"float","Iridescence"),fM=xt(fi,"float","IridescenceIOR"),dM=xt(fi,"float","IridescenceThickness"),pM=xt(fi,"float","AlphaT"),jp=xt(fi,"float","Anisotropy"),qv=xt(fi,"vec3","AnisotropyT"),vm=xt(fi,"vec3","AnisotropyB"),i0=xt(fi,"color","SpecularColor"),mm=xt(fi,"color","SpecularColorBlended"),gm=xt(fi,"float","SpecularF90"),AM=xt(fi,"float","Shininess"),y1=xt(fi,"output","Output"),bm=xt(fi,"float","dashSize"),Qv=xt(fi,"float","gapSize"),exe=xt(fi,"float","pointWidth"),Hv=xt(fi,"float","IOR"),mM=xt(fi,"float","Transmission"),_7=xt(fi,"float","Thickness"),x7=xt(fi,"float","AttenuationDistance"),y7=xt(fi,"color","AttenuationColor"),v7=xt(fi,"float","Dispersion"),I8=xt(fi,"float","AmbientOcclusion",!1,1),gM=class extends $t{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1,r=null){super("string"),this.name=e,this.shared=t,this.order=n,this.updateType=r,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},OZ=(i,e=1,t=null)=>new gM(i,!1,e,t),MC=(i,e=0,t=null)=>new gM(i,!0,e,t),txe=MC("frame",0,_n.FRAME),Zt=MC("render",0,_n.RENDER),BZ=OZ("object",1,_n.OBJECT),Mm=class extends Zv{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=BZ}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Fr),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{let r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);let o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=l;if(n==="bool"){let u=e.getDataFromNode(this),f=u.propertyName;if(f===void 0){let p=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(p),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Ht=(i,e)=>{let t=PZ(e||i);if(t===i&&(i=a7(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Mm(i,t)},_M=class extends dr{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},UZ=(...i)=>{let e;if(i.length===1){let t=i[0];e=new _M(null,t.length,t)}else{let t=i[0],n=i[1];e=new _M(t,n)}return Vt(e)};Be("toArray",(i,e)=>UZ(Array(e).fill(i)));var N8=class extends dr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return Om.join("").slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),c=r.getNodeType(e),u=e.getDataFromNode(this),f;if(u.initialized===!0)t!=="void"&&(f=o);else if(s){let p=e.getVarFromNode(this,null,a),x=e.getPropertyName(p);e.addLineFlowCode(`${x} = ${l}`,this);let v=n.node,S=v.node.context({assign:!0}).build(e);for(let T=0;T<v.components.length;T++){let P=v.components[T];e.addLineFlowCode(`${S}.${P} = ${x}[ ${T} ]`,this)}t!=="void"&&(f=o)}else f=`${o} = ${l}`,(t==="void"||c==="void")&&(e.addLineFlowCode(f,this),t!=="void"&&(f=o));return u.initialized=!0,e.format(f,a,t)}},kZ=Vn(N8).setParameterLength(2);Be("assign",kZ);var L8=class extends dr{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,c)=>{let u=c.type,f=u==="pointer",p;return f?p="&"+l.build(e):p=l.build(e,u),p};if(Array.isArray(s)){if(s.length>r.length)Ge("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(Ge("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(se(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(let l of r){let c=s[l.name];c!==void 0?t.push(o(c,l)):(Ge(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(se(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},GZ=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?ym(e):wC(e[0]),new L8(Vt(i),e));Be("call",GZ);var nxe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},Or=class i extends dr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new i(e,t,n);for(let o=0;o<r.length-1;o++)s=new i(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(nxe[this.op],t)}generateNodeType(e,t=null){let n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="&&"||n==="||"||n==="^^")return"bool";if(n==="!"){let l=e.getTypeLength(o);return l>1?`bvec${l}`:"bool"}else if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){let l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t),a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;let c=r.build(e,a),u=s?s.build(e,l):null,f=e.getFunctionOperator(n);if(t!=="void"){let p=e.renderer.coordinateSystem===po;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return p?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${c} % ${u} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${u} )`,o,t);if(n==="!")return p&&e.isVector(a)?e.format(`not( ${c} )`,t):e.format(`( ${n} ${c} )`,a,t);if(n==="~")return e.format(`( ${n} ${c} )`,a,t);if(f)return e.format(`${f}( ${c}, ${u} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${u} ${n} ${c} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${c} ${n} ${u}`,o,t);{let x=`( ${c} ${n} ${u} )`;return!p&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(x=`all${x}`),e.format(x,o,t)}}else if(a!=="void")return f?e.format(`${f}( ${c}, ${u} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${u} ${n} ${c}`,o,t):e.format(`${c} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},us=lt(Or,"+").setParameterLength(2,1/0).setName("add"),ni=lt(Or,"-").setParameterLength(2,1/0).setName("sub"),bn=lt(Or,"*").setParameterLength(2,1/0).setName("mul"),Il=lt(Or,"/").setParameterLength(2,1/0).setName("div"),CC=lt(Or,"%").setParameterLength(2).setName("mod"),zZ=lt(Or,"==").setParameterLength(2).setName("equal"),VZ=lt(Or,"!=").setParameterLength(2).setName("notEqual"),qZ=lt(Or,"<").setParameterLength(2).setName("lessThan"),b7=lt(Or,">").setParameterLength(2).setName("greaterThan"),HZ=lt(Or,"<=").setParameterLength(2).setName("lessThanEqual"),WZ=lt(Or,">=").setParameterLength(2).setName("greaterThanEqual"),jZ=lt(Or,"&&").setParameterLength(2,1/0).setName("and"),XZ=lt(Or,"||").setParameterLength(2,1/0).setName("or"),$Z=lt(Or,"!").setParameterLength(1).setName("not"),YZ=lt(Or,"^^").setParameterLength(2).setName("xor"),ZZ=lt(Or,"&").setParameterLength(2).setName("bitAnd"),KZ=lt(Or,"~").setParameterLength(1).setName("bitNot"),QZ=lt(Or,"|").setParameterLength(2).setName("bitOr"),JZ=lt(Or,"^").setParameterLength(2).setName("bitXor"),eK=lt(Or,"<<").setParameterLength(2).setName("shiftLeft"),tK=lt(Or,">>").setParameterLength(2).setName("shiftRight"),nK=Ae(([i])=>(i.addAssign(1),i)),iK=Ae(([i])=>(i.subAssign(1),i)),rK=Ae(([i])=>{let e=fe(i).toConst();return i.addAssign(1),e}),sK=Ae(([i])=>{let e=fe(i).toConst();return i.subAssign(1),e});Be("add",us);Be("sub",ni);Be("mul",bn);Be("div",Il);Be("mod",CC);Be("equal",zZ);Be("notEqual",VZ);Be("lessThan",qZ);Be("greaterThan",b7);Be("lessThanEqual",HZ);Be("greaterThanEqual",WZ);Be("and",jZ);Be("or",XZ);Be("not",$Z);Be("xor",YZ);Be("bitAnd",ZZ);Be("bitNot",KZ);Be("bitOr",QZ);Be("bitXor",JZ);Be("shiftLeft",eK);Be("shiftRight",tK);Be("incrementBefore",nK);Be("decrementBefore",iK);Be("increment",rK);Be("decrement",sK);var Re=class i extends dr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let s=new i(e,t,n);for(let o=3;o<arguments.length-1;o++)s=new i(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}generateNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:n,method:r}=this,s=null;if(r===i.ONE_MINUS)s=ni(1,t);else if(r===i.RECIPROCAL)s=Il(1,t);else if(r===i.DIFFERENCE)s=Qi(ni(t,n));else if(r===i.TRANSFORM_DIRECTION){let o,a;e.isMatrix(t.getNodeType(e))?(o=t,a=n):(o=n,a=t),s=Qo(bn(o,Lt(pe(a),0)).xyz)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,c=this.cNode,u=e.renderer.coordinateSystem;if(r===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{let f=[];return r===i.CROSS?f.push(a.build(e,s),l.build(e,s)):u===po&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===po&&(r===i.MIN||r===i.MAX)?f.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===i.REFRACT?f.push(a.build(e,o),l.build(e,o),c.build(e,"float")):r===i.MIX?f.push(a.build(e,o),l.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(u===qa&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(je(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),f.push(a.build(e,o)),l!==null&&f.push(l.build(e,o)),c!==null&&f.push(c.build(e,o))),e.format(`${e.getMethod(r,s)}( ${f.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Re.ALL="all";Re.ANY="any";Re.RADIANS="radians";Re.DEGREES="degrees";Re.EXP="exp";Re.EXP2="exp2";Re.LOG="log";Re.LOG2="log2";Re.SQRT="sqrt";Re.INVERSE_SQRT="inversesqrt";Re.FLOOR="floor";Re.CEIL="ceil";Re.NORMALIZE="normalize";Re.FRACT="fract";Re.SIN="sin";Re.SINH="sinh";Re.COS="cos";Re.COSH="cosh";Re.TAN="tan";Re.TANH="tanh";Re.ASIN="asin";Re.ASINH="asinh";Re.ACOS="acos";Re.ACOSH="acosh";Re.ATAN="atan";Re.ATANH="atanh";Re.ABS="abs";Re.SIGN="sign";Re.LENGTH="length";Re.NEGATE="negate";Re.ONE_MINUS="oneMinus";Re.DFDX="dFdx";Re.DFDY="dFdy";Re.ROUND="round";Re.RECIPROCAL="reciprocal";Re.TRUNC="trunc";Re.FWIDTH="fwidth";Re.TRANSPOSE="transpose";Re.DETERMINANT="determinant";Re.INVERSE="inverse";Re.EQUALS="equals";Re.MIN="min";Re.MAX="max";Re.STEP="step";Re.REFLECT="reflect";Re.DISTANCE="distance";Re.DIFFERENCE="difference";Re.DOT="dot";Re.CROSS="cross";Re.POW="pow";Re.TRANSFORM_DIRECTION="transformDirection";Re.MIX="mix";Re.CLAMP="clamp";Re.REFRACT="refract";Re.SMOOTHSTEP="smoothstep";Re.FACEFORWARD="faceforward";var RC=se(1e-6),ixe=se(1e6),xM=se(Math.PI),rxe=se(Math.PI*2),sxe=se(Math.PI*2),oxe=se(Math.PI*.5),oK=lt(Re,Re.ALL).setParameterLength(1),aK=lt(Re,Re.ANY).setParameterLength(1),lK=lt(Re,Re.RADIANS).setParameterLength(1),cK=lt(Re,Re.DEGREES).setParameterLength(1),w7=lt(Re,Re.EXP).setParameterLength(1),E1=lt(Re,Re.EXP2).setParameterLength(1),PC=lt(Re,Re.LOG).setParameterLength(1),wh=lt(Re,Re.LOG2).setParameterLength(1),Ma=lt(Re,Re.SQRT).setParameterLength(1),S7=lt(Re,Re.INVERSE_SQRT).setParameterLength(1),Sh=lt(Re,Re.FLOOR).setParameterLength(1),IC=lt(Re,Re.CEIL).setParameterLength(1),Qo=lt(Re,Re.NORMALIZE).setParameterLength(1),iu=lt(Re,Re.FRACT).setParameterLength(1),Sa=lt(Re,Re.SIN).setParameterLength(1),uK=lt(Re,Re.SINH).setParameterLength(1),Jc=lt(Re,Re.COS).setParameterLength(1),hK=lt(Re,Re.COSH).setParameterLength(1),fK=lt(Re,Re.TAN).setParameterLength(1),dK=lt(Re,Re.TANH).setParameterLength(1),pK=lt(Re,Re.ASIN).setParameterLength(1),AK=lt(Re,Re.ASINH).setParameterLength(1),T7=lt(Re,Re.ACOS).setParameterLength(1),mK=lt(Re,Re.ACOSH).setParameterLength(1),E7=lt(Re,Re.ATAN).setParameterLength(1,2),gK=lt(Re,Re.ATANH).setParameterLength(1),Qi=lt(Re,Re.ABS).setParameterLength(1),M7=lt(Re,Re.SIGN).setParameterLength(1),Th=lt(Re,Re.LENGTH).setParameterLength(1),C7=lt(Re,Re.NEGATE).setParameterLength(1),_K=lt(Re,Re.ONE_MINUS).setParameterLength(1),R7=lt(Re,Re.DFDX).setParameterLength(1),P7=lt(Re,Re.DFDY).setParameterLength(1),xK=lt(Re,Re.ROUND).setParameterLength(1),yK=lt(Re,Re.RECIPROCAL).setParameterLength(1),I7=lt(Re,Re.TRUNC).setParameterLength(1),N7=lt(Re,Re.FWIDTH).setParameterLength(1),vK=lt(Re,Re.TRANSPOSE).setParameterLength(1),bK=lt(Re,Re.DETERMINANT).setParameterLength(1),wK=lt(Re,Re.INVERSE).setParameterLength(1),Qa=lt(Re,Re.MIN).setParameterLength(2,1/0),br=lt(Re,Re.MAX).setParameterLength(2,1/0),Cm=lt(Re,Re.STEP).setParameterLength(2),SK=lt(Re,Re.REFLECT).setParameterLength(2),TK=lt(Re,Re.DISTANCE).setParameterLength(2),EK=lt(Re,Re.DIFFERENCE).setParameterLength(2),pc=lt(Re,Re.DOT).setParameterLength(2),Yf=lt(Re,Re.CROSS).setParameterLength(2),uc=lt(Re,Re.POW).setParameterLength(2),L7=i=>bn(i,i),MK=i=>bn(i,i,i),D7=i=>bn(i,i,i,i),CK=lt(Re,Re.TRANSFORM_DIRECTION).setParameterLength(2),RK=(i,e)=>Qo(bn(e,Lt(pe(i),0)).xyz),PK=(i,e)=>Qo(Lt(pe(i),0).mul(e).xyz),IK=i=>bn(M7(i),uc(Qi(i),1/3)),F7=i=>pc(i,i),jn=lt(Re,Re.MIX).setParameterLength(3),ru=(i,e=0,t=1)=>new Re(Re.CLAMP,Vt(i),Vt(e),Vt(t)),NC=i=>ru(i),O7=lt(Re,Re.REFRACT).setParameterLength(3),Nl=lt(Re,Re.SMOOTHSTEP).setParameterLength(3),B7=lt(Re,Re.FACEFORWARD).setParameterLength(3),NK=Ae(([i])=>{let n=43758.5453,r=pc(i.xy,ft(12.9898,78.233)),s=CC(r,xM);return iu(Sa(s).mul(n))}),LK=(i,e,t)=>jn(e,t,i),DK=(i,e,t)=>Nl(e,t,i),FK=(i,e)=>Cm(e,i),axe=B7,lxe=S7;Be("all",oK);Be("any",aK);Be("radians",lK);Be("degrees",cK);Be("exp",w7);Be("exp2",E1);Be("log",PC);Be("log2",wh);Be("sqrt",Ma);Be("inverseSqrt",S7);Be("floor",Sh);Be("ceil",IC);Be("normalize",Qo);Be("fract",iu);Be("sin",Sa);Be("sinh",uK);Be("cos",Jc);Be("cosh",hK);Be("tan",fK);Be("tanh",dK);Be("asin",pK);Be("asinh",AK);Be("acos",T7);Be("acosh",mK);Be("atan",E7);Be("atanh",gK);Be("abs",Qi);Be("sign",M7);Be("length",Th);Be("lengthSq",F7);Be("negate",C7);Be("oneMinus",_K);Be("dFdx",R7);Be("dFdy",P7);Be("round",xK);Be("reciprocal",yK);Be("trunc",I7);Be("fwidth",N7);Be("min",Qa);Be("max",br);Be("step",FK);Be("reflect",SK);Be("distance",TK);Be("dot",pc);Be("cross",Yf);Be("pow",uc);Be("pow2",L7);Be("pow3",MK);Be("pow4",D7);Be("transformDirection",CK);Be("transformNormalByViewMatrix",RK);Be("transformNormalByInverseViewMatrix",PK);Be("mix",LK);Be("clamp",ru);Be("refract",O7);Be("smoothstep",DK);Be("faceForward",B7);Be("difference",EK);Be("saturate",NC);Be("cbrt",IK);Be("transpose",vK);Be("determinant",bK);Be("inverse",wK);Be("rand",NK);var D8=class extends $t{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}generateNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,c=t!=="void",u=c?Kf(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let v=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,v,w);return e.format(S,n,t)}e.addFlowCode(`41334133 ${e.tab}if ( ${f} ) {41344134 41354135 `).addFlowTab();let x=o.build(e,n);if(x&&(c?x=u+" = "+x+";":(x="return "+x+";",l===null&&(je("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),x="// "+x))),e.removeFlowTab().addFlowCode(e.tab+" "+x+`
@@ -4142,30 +4142,30 @@ ${e.tab}if ( ${f} ) {
41424142 41434143 `)}else e.addFlowCode(`41444144 4145-`);return e.format(u,n,t)}},Ko=Vn(L8).setParameterLength(2,3);Be("select",Ko);var Jv=class extends $t{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},Qf=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new Jv(t,e)},DZ=i=>Qf(i,{uniformFlow:!0}),B7=(i,e)=>Qf(i,{nodeName:e});function FZ(i,e,t=null){return Qf(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function OZ(i,e=null){return Qf(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function BZ(i,e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),B7(i,e)}Be("context",Qf);Be("label",BZ);Be("uniformFlow",DZ);Be("setName",B7);Be("builtinShadowContext",(i,e,t)=>FZ(e,t,i));Be("builtinAOContext",(i,e)=>OZ(e,i));var v1=class extends $t{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],n=this.getShared(t);if(this!==n)return n.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let r=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,r=!0}let s=t.getBaseStack();r?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0,a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);let c=this.getNodeType(e);if(c=="void")return this.isIntent(e)!==!0&&Ge('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),p=e.getVarFromNode(this,n,u,void 0,l),x=e.getPropertyName(p),v=x;if(l)if(o)v=a?`const ${x}`:`let ${x}`;else{let w=t.getArrayCount(e);v=`const ${e.getVar(p.type,x,w)}`}return e.addLineFlowCode(`${v} = ${f}`,this),x}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},U7=Vn(v1),UZ=(i,e=null)=>U7(i,e).toStack(),kZ=(i,e=null)=>U7(i,e,!0).toStack(),GZ=i=>U7(i).setIntent(!0).toStack();Be("toVar",UZ);Be("toConst",kZ);Be("toVarIntent",GZ);var D8=class extends $t{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},bm=(i,e,t=null)=>new D8(Vt(i),e,t),F8=class extends $t{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=bm(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=bm(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(p1.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(p1.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let s=this.getNodeType(e),o=e.getPropertyName(r,p1.VERTEX);if(e.shaderStage===p1.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(p1.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},a0=Vn(F8).setParameterLength(1,2),zZ=i=>a0(i);Be("toVarying",a0);Be("toVertexStage",zZ);var VZ=Ae(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return jn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),qZ=Ae(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return jn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),k7="WorkingColorSpace",oxe="OutputColorSpace",eb=class extends dr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===k7?sn.workingColorSpace:t===oxe?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),s=t;return sn.enabled===!1||n===r||!n||!r||(sn.getTransfer(n)===Bt&&(s=Lt(VZ(s.rgb),s.a)),sn.getPrimaries(n)!==sn.getPrimaries(r)&&(s=Lt(io(sn._getMatrix(new Sn,n,r)).mul(s.rgb),s.a)),sn.getTransfer(r)===Bt&&(s=Lt(qZ(s.rgb),s.a))),s}},HZ=(i,e)=>new eb(Vt(i),k7,e),LC=(i,e)=>new eb(Vt(i),e,k7),axe=(i,e,t)=>new eb(Vt(i),e,t);Be("workingToColorSpace",HZ);Be("colorSpaceToWorking",LC);var lxe=class extends $f{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},yM=class extends $t{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=_n.OBJECT}setGroup(e){return this.group=e,this}element(e){return new lxe(this,Vt(e))}setNodeType(e){let t=Ht(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},cxe=(i,e,t)=>new yM(i,e,t),O8=class extends yM{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Kt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},WZ=(i,e,t=null)=>new O8(i,e,t),B8=class extends dr{static get type(){return"ToneMappingNode"}constructor(e,t=XZ,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return zv(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===ks)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Lt(s(t.rgb,this.exposureNode),t.a):(Ge("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},jZ=(i,e,t)=>new B8(i,Vt(e),Vt(t)),XZ=WZ("toneMappingExposure","float");Be("toneMapping",(i,e,t)=>jZ(e,t,i));var iY=new WeakMap;function rY(i,e){let t=iY.get(i);return t===void 0&&(t=new Mf(i,e),iY.set(i,t)),t}var yh=class extends Kv{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=Vd,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset,a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=rY(r.array,s):a=rY(r,s);let l=new mo(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.context.nodeName;n!==void 0&&delete e.context.nodeName;let r=e.getBufferAttributeFromNode(this,t,n),s=e.getPropertyName(r),o=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=s,o=s;else{let a;n&&(a=n+"Varying"),o=a0(this,a).build(e,t)}return o}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function DC(i,e=null,t=0,n=0,r=Vd,s=!1){return e==="mat3"||e===null&&i.itemSize===9?io(new yh(i,"vec3",9,0).setUsage(r).setInstanced(s),new yh(i,"vec3",9,3).setUsage(r).setInstanced(s),new yh(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?e0(new yh(i,"vec4",16,0).setUsage(r).setInstanced(s),new yh(i,"vec4",16,4).setUsage(r).setInstanced(s),new yh(i,"vec4",16,8).setUsage(r).setInstanced(s),new yh(i,"vec4",16,12).setUsage(r).setInstanced(s)):new yh(i,e,t,n).setUsage(r)}var G7=(i,e=null,t=0,n=0)=>DC(i,e,t,n),uxe=(i,e=null,t=0,n=0)=>DC(i,e,t,n,kA),FC=(i,e=null,t=0,n=0)=>DC(i,e,t,n,Vd,!0),z7=(i,e=null,t=0,n=0)=>DC(i,e,t,n,kA,!0);Be("toAttribute",i=>G7(i.value));var Es=class i extends $t{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t=this.getNodeType(e),n=this.scope,r;if(n===i.VERTEX)r=e.getVertexIndex();else if(n===i.INSTANCE)r=e.getInstanceIndex();else if(n===i.DRAW)r=e.getDrawIndex();else if(n===i.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===i.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===i.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=a0(this).build(e,t),s}};Es.VERTEX="vertex";Es.INSTANCE="instance";Es.SUBGROUP="subgroup";Es.INVOCATION_LOCAL="invocationLocal";Es.INVOCATION_SUBGROUP="invocationSubgroup";Es.DRAW="draw";var $Z=xt(Es,Es.VERTEX),nu=xt(Es,Es.INSTANCE),hxe=xt(Es,Es.SUBGROUP),fxe=xt(Es,Es.INVOCATION_SUBGROUP),dxe=xt(Es,Es.INVOCATION_LOCAL),YZ=xt(Es,Es.DRAW),U8=class extends $t{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=_n.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Fr),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Ht(this.count,"uint").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n==="compute"){let r=this.computeNode.build(e,"void");if(r!==""&&e.addLineFlowCode(r,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,"uint"),o=nu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }4145+`);return e.format(u,n,t)}},Ko=Vn(D8).setParameterLength(2,3);Be("select",Ko);var Jv=class extends $t{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},Qf=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new Jv(t,e)},OK=i=>Qf(i,{uniformFlow:!0}),U7=(i,e)=>Qf(i,{nodeName:e});function BK(i,e,t=null){return Qf(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function UK(i,e=null){return Qf(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function kK(i,e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),U7(i,e)}Be("context",Qf);Be("label",kK);Be("uniformFlow",OK);Be("setName",U7);Be("builtinShadowContext",(i,e,t)=>BK(e,t,i));Be("builtinAOContext",(i,e)=>UK(e,i));var v1=class extends $t{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],n=this.getShared(t);if(this!==n)return n.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let r=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,r=!0}let s=t.getBaseStack();r?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0,a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);let c=this.getNodeType(e);if(c=="void")return this.isIntent(e)!==!0&&Ge('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),p=e.getVarFromNode(this,n,u,void 0,l),x=e.getPropertyName(p),v=x;if(l)if(o)v=a?`const ${x}`:`let ${x}`;else{let w=t.getArrayCount(e);v=`const ${e.getVar(p.type,x,w)}`}return e.addLineFlowCode(`${v} = ${f}`,this),x}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},k7=Vn(v1),GK=(i,e=null)=>k7(i,e).toStack(),zK=(i,e=null)=>k7(i,e,!0).toStack(),VK=i=>k7(i).setIntent(!0).toStack();Be("toVar",GK);Be("toConst",zK);Be("toVarIntent",VK);var F8=class extends $t{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},wm=(i,e,t=null)=>new F8(Vt(i),e,t),O8=class extends $t{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=wm(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=wm(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(p1.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(p1.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let s=this.getNodeType(e),o=e.getPropertyName(r,p1.VERTEX);if(e.shaderStage===p1.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(p1.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},a0=Vn(O8).setParameterLength(1,2),qK=i=>a0(i);Be("toVarying",a0);Be("toVertexStage",qK);var HK=Ae(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return jn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),WK=Ae(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return jn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),G7="WorkingColorSpace",cxe="OutputColorSpace",eb=class extends dr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===G7?sn.workingColorSpace:t===cxe?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),s=t;return sn.enabled===!1||n===r||!n||!r||(sn.getTransfer(n)===Bt&&(s=Lt(HK(s.rgb),s.a)),sn.getPrimaries(n)!==sn.getPrimaries(r)&&(s=Lt(io(sn._getMatrix(new Sn,n,r)).mul(s.rgb),s.a)),sn.getTransfer(r)===Bt&&(s=Lt(WK(s.rgb),s.a))),s}},jK=(i,e)=>new eb(Vt(i),G7,e),LC=(i,e)=>new eb(Vt(i),e,G7),uxe=(i,e,t)=>new eb(Vt(i),e,t);Be("workingToColorSpace",jK);Be("colorSpaceToWorking",LC);var hxe=class extends $f{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},yM=class extends $t{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=_n.OBJECT}setGroup(e){return this.group=e,this}element(e){return new hxe(this,Vt(e))}setNodeType(e){let t=Ht(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},fxe=(i,e,t)=>new yM(i,e,t),B8=class extends yM{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Zt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},XK=(i,e,t=null)=>new B8(i,e,t),U8=class extends dr{static get type(){return"ToneMappingNode"}constructor(e,t=YK,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return zv(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===ks)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Lt(s(t.rgb,this.exposureNode),t.a):(Ge("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},$K=(i,e,t)=>new U8(i,Vt(e),Vt(t)),YK=XK("toneMappingExposure","float");Be("toneMapping",(i,e,t)=>$K(e,t,i));var sY=new WeakMap;function oY(i,e){let t=sY.get(i);return t===void 0&&(t=new Mf(i,e),sY.set(i,t)),t}var yh=class extends Zv{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=Vd,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset,a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=oY(r.array,s):a=oY(r,s);let l=new mo(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.context.nodeName;n!==void 0&&delete e.context.nodeName;let r=e.getBufferAttributeFromNode(this,t,n),s=e.getPropertyName(r),o=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=s,o=s;else{let a;n&&(a=n+"Varying"),o=a0(this,a).build(e,t)}return o}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function DC(i,e=null,t=0,n=0,r=Vd,s=!1){return e==="mat3"||e===null&&i.itemSize===9?io(new yh(i,"vec3",9,0).setUsage(r).setInstanced(s),new yh(i,"vec3",9,3).setUsage(r).setInstanced(s),new yh(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?e0(new yh(i,"vec4",16,0).setUsage(r).setInstanced(s),new yh(i,"vec4",16,4).setUsage(r).setInstanced(s),new yh(i,"vec4",16,8).setUsage(r).setInstanced(s),new yh(i,"vec4",16,12).setUsage(r).setInstanced(s)):new yh(i,e,t,n).setUsage(r)}var z7=(i,e=null,t=0,n=0)=>DC(i,e,t,n),dxe=(i,e=null,t=0,n=0)=>DC(i,e,t,n,GA),FC=(i,e=null,t=0,n=0)=>DC(i,e,t,n,Vd,!0),V7=(i,e=null,t=0,n=0)=>DC(i,e,t,n,GA,!0);Be("toAttribute",i=>z7(i.value));var Ms=class i extends $t{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t=this.getNodeType(e),n=this.scope,r;if(n===i.VERTEX)r=e.getVertexIndex();else if(n===i.INSTANCE)r=e.getInstanceIndex();else if(n===i.DRAW)r=e.getDrawIndex();else if(n===i.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===i.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===i.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=a0(this).build(e,t),s}};Ms.VERTEX="vertex";Ms.INSTANCE="instance";Ms.SUBGROUP="subgroup";Ms.INVOCATION_LOCAL="invocationLocal";Ms.INVOCATION_SUBGROUP="invocationSubgroup";Ms.DRAW="draw";var ZK=xt(Ms,Ms.VERTEX),nu=xt(Ms,Ms.INSTANCE),pxe=xt(Ms,Ms.SUBGROUP),Axe=xt(Ms,Ms.INVOCATION_SUBGROUP),mxe=xt(Ms,Ms.INVOCATION_LOCAL),KK=xt(Ms,Ms.DRAW),k8=class extends $t{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=_n.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Fr),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Ht(this.count,"uint").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n==="compute"){let r=this.computeNode.build(e,"void");if(r!==""&&e.addLineFlowCode(r,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,"uint"),o=nu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }41464146 4147-${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},V7=(i,e=[64])=>{(e.length===0||e.length>3)&&Ge("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Fr);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&Ge(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new Fr)}for(;e.length<3;)e.push(1);return new U8(Vt(i),e)},KZ=(i,e,t)=>{let n=V7(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Be("compute",KZ);Be("computeKernel",V7);var k8=class extends $t{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},b1=i=>new k8(Vt(i));function ZZ(i,e=!0){return je('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),b1(i).setParent(e)}Be("cache",ZZ);Be("isolate",b1);var G8=class extends $t{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},QZ=Vn(G8).setParameterLength(2);Be("bypass",QZ);var q7=Ae(([i,e,t,n=se(0),r=se(1),s=Pl(!1)])=>{let o=i.sub(e).div(t.sub(e));return T1(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function JZ(i,e,t,n=se(0),r=se(1)){return q7(i,e,t,n,r,!0)}Be("remap",q7);Be("remapClamp",JZ);var w1=class extends $t{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}},Cl=Vn(w1).setParameterLength(1,2),eQ=i=>(i?Ko(i,Cl("discard")):Cl("discard")).toStack(),pxe=()=>Cl("return").toStack();Be("discard",eQ);var H7=Ae(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),tQ=Ae(([i])=>i.a.equal(0).select(Lt(0),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),z8=class extends dr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Lt(t.rgb,t.a.clamp(0,1)),t=tQ(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ks,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||zo;return n!==ks&&(t=t.toneMapping(n)),r!==zo&&r!==sn.workingColorSpace&&(t=t.workingToColorSpace(r)),t=H7(t),t}},W7=(i,e=null,t=null)=>new z8(Vt(i),e,t);Be("renderOutput",W7);var V8=class extends dr{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length),o="";o+="// #"+r+`#4147+${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},q7=(i,e=[64])=>{(e.length===0||e.length>3)&&Ge("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Fr);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&Ge(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new Fr)}for(;e.length<3;)e.push(1);return new k8(Vt(i),e)},QK=(i,e,t)=>{let n=q7(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Be("compute",QK);Be("computeKernel",q7);var G8=class extends $t{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},b1=i=>new G8(Vt(i));function JK(i,e=!0){return je('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),b1(i).setParent(e)}Be("cache",JK);Be("isolate",b1);var z8=class extends $t{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},eQ=Vn(z8).setParameterLength(2);Be("bypass",eQ);var H7=Ae(([i,e,t,n=se(0),r=se(1),s=Pl(!1)])=>{let o=i.sub(e).div(t.sub(e));return T1(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function tQ(i,e,t,n=se(0),r=se(1)){return H7(i,e,t,n,r,!0)}Be("remap",H7);Be("remapClamp",tQ);var w1=class extends $t{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}},Cl=Vn(w1).setParameterLength(1,2),nQ=i=>(i?Ko(i,Cl("discard")):Cl("discard")).toStack(),gxe=()=>Cl("return").toStack();Be("discard",nQ);var W7=Ae(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),iQ=Ae(([i])=>i.a.equal(0).select(Lt(0),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),V8=class extends dr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Lt(t.rgb,t.a.clamp(0,1)),t=iQ(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ks,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Vo;return n!==ks&&(t=t.toneMapping(n)),r!==Vo&&r!==sn.workingColorSpace&&(t=t.workingToColorSpace(r)),t=W7(t),t}},j7=(i,e=null,t=null)=>new V8(Vt(i),e,t);Be("renderOutput",j7);var q8=class extends dr{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length),o="";o+="// #"+r+`#41484148 `,o+=e.flow.code.replace(/^\t/mg,"")+`41494149 `,o+="/* ... */ "+n+` /* ... */41504150 `,o+="// #"+s+`#4151-`,pA(o)}return n}},nQ=(i,e=null)=>new V8(Vt(i),e).toStack();Be("debug",nQ);var vM=class extends ko{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},q8=class extends $t{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=_n.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==vM&&Kn('TSL: ".toInspector()" is only available with WebGPU.'),t}};function iQ(i,e="",t=null){return i=Vt(i),i.before(new q8(i,e,t))}Be("toInspector",iQ);function Axe(i){je("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var bM=class extends $t{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):a0(this).build(e,n)}else return je(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},Rl=(i,e=null)=>new bM(i,e),Ri=(i=0)=>Rl("uv"+(i>0?i:""),"vec2"),H8=class extends $t{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}},Cm=Vn(H8).setParameterLength(1,2),W8=class extends Em{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=_n.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}},j7=Vn(W8).setParameterLength(1),wM=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},X7=new vs,Ac=class extends Em{static get type(){return"TextureNode"}constructor(e=X7,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=_n.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===pi?"uvec4":this.value.type===Ir?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ri(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Ht(this.value.matrix)),this._matrixUniform.mul(pe(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Ht(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(fe(Cm(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new wM("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=Ae(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?_n.OBJECT:_n.NONE,l})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(Df.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===T_||l===th||l===UA||l===Hc?a=this.compareNode:(o=this.compareNode,Kn('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,c,u,f){let p=this.value,x;return s?x=e.generateTextureBias(p,t,n,s,o,u):l?x=e.generateTextureGrad(p,t,n,l,o,u):c?a?x=e.generateTextureGatherCompare(p,t,n,a,o,u,f):x=e.generateTextureGather(p,t,n,c,o,u,f):a?x=e.generateTextureCompare(p,t,n,a,o,u):this.sampler===!1?x=e.generateTextureLoad(p,t,n,r,o,u):r?x=e.generateTextureLevel(p,t,n,r,o,u):x=e.generateTexture(p,t,n,o,u),x}generate(e,t){let n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{let o=e.getDataFromNode(this),a=this.getNodeType(e),l=o.propertyName;if(l===void 0){let{uvNode:u,levelNode:f,biasNode:p,compareNode:x,compareStepNode:v,depthNode:w,gradNode:S,gatherNode:T,offsetNode:P}=r,R=this.generateUV(e,u),C=f?f.build(e,"float"):null,L=p?p.build(e,"float"):null,D=w?w.build(e,"int"):null,F=x?x.build(e,"float"):null,N=v?v.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,z=T?T.build(e,"int"):null,V=P?this.generateOffset(e,P):null,H=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;z&&(a="vec4");let K=D;K===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(K="0");let J=e.getVarFromNode(this);l=e.getPropertyName(J);let j=this.generateSnippet(e,s,R,C,L,K,F,B,z,V,H);if(N!==null){let Z=n.compareFunction;Z===UA||Z===Hc?j=Mm(Cl(j,a),Cl(N,"float")).build(e,a):j=Mm(Cl(N,"float"),Cl(j,a)).build(e,a)}e.addLineFlowCode(`${l} = ${j}`,this),o.snippet=j,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=LC(Cl(c,a),n.colorSpace).setup(e).build(e,a)),e.format(c,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Vt(e).mul(j7(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===xi||n.magFilter===xi)&&(je("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Vt(t)}level(e){let t=this.clone();return t.levelNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}size(e){return Cm(this,e)}bias(e){let t=this.clone();return t.biasNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}grad(e,t){let n=this.clone();return n.gradNode=[Vt(e),Vt(t)],n.referenceNode=this.getBase(),Vt(n)}gather(e=0){let t=this.clone();return t.gatherNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}depth(e){let t=this.clone();return t.depthNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}offset(e){let t=this.clone();return t.offsetNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},mxe=Vn(Ac).setParameterLength(1,4).setName("texture"),ai=(i=X7,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Vt(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Vt(e)),t!==null&&(r.levelNode=Vt(t)),n!==null&&(r.biasNode=Vt(n))):r=mxe(i,e,t,n),r},gxe=(i=X7)=>ai(i),Qr=(...i)=>ai(...i).setSampler(!1),_xe=(i,e,t)=>ai(i,e).level(t),xxe=i=>(i.isNode===!0?i:ai(i)).convert("sampler"),yxe=i=>(i.isNode===!0?i:ai(i)).convert("samplerComparison"),tb=class extends Em{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}},O1=(i,e,t)=>new tb(i,e,t),j8=class extends $f{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(e),r=this.node.getPaddedType();return e.format(t,r,n)}},X8=class extends tb{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Qp(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=_n.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){let s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new j8(this,Vt(e))}},wo=(i,e)=>new X8(i,e),$8=class extends $t{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},Jf=Vn($8).setParameterLength(1),vv,bv,To=class i extends $t{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===i.DPR?"float":this.scope===i.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=_n.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=_n.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?bv.copy(t.viewport):(e.getViewport(bv),bv.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(vv.width=t.width,vv.height=t.height):e.getDrawingBufferSize(vv)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Ht(vv||(vv=new Oe)):e===i.VIEWPORT?t=Ht(bv||(bv=new gn)):e===i.DPR?t=Ht(1):t=ft(Um.div(Rm)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Rm).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};To.COORDINATE="coordinate";To.VIEWPORT="viewport";To.SIZE="size";To.UV="uv";To.DPR="dpr";var $7=xt(To,To.DPR),tu=xt(To,To.UV),Rm=xt(To,To.SIZE),Um=xt(To,To.COORDINATE),S1=xt(To,To.VIEWPORT),Y7=S1.zw,rQ=Um.sub(S1.xy),vxe=rQ.div(Y7),bxe=Ae(()=>(je('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Fr),Rm),"vec2").once()(),F6=null,yE=null,O6=null,vE=null,B6=null,bE=null,U6=null,wE=null,k6=null,SE=null,G6=null,TE=null,z6=null,EE=null,l0=Ht(0,"uint").setName("u_cameraIndex").setGroup(MC("cameraIndex")).toVarying("v_cameraIndex"),$p=Ht("float").setName("cameraNear").setGroup(Kt).onRenderUpdate(({camera:i})=>i.near),Yp=Ht("float").setName("cameraFar").setGroup(Kt).onRenderUpdate(({camera:i})=>i.far),Ta=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);yE===null?yE=wo(t).setGroup(Kt).setName("cameraProjectionMatrices"):yE.array=t,e=yE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else F6===null&&(F6=Ht(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=F6;return e}).once()(),sQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);vE===null?vE=wo(t).setGroup(Kt).setName("cameraProjectionMatricesInverse"):vE.array=t,e=vE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else O6===null&&(O6=Ht(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Kt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=O6;return e}).once()(),c0=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);bE===null?bE=wo(t).setGroup(Kt).setName("cameraViewMatrices"):bE.array=t,e=bE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else B6===null&&(B6=Ht(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=B6;return e}).once()(),_b=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);wE===null?wE=wo(t).setGroup(Kt).setName("cameraWorldMatrices"):wE.array=t,e=wE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else U6===null&&(U6=Ht(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=U6;return e}).once()(),wxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);SE===null?SE=wo(t).setGroup(Kt).setName("cameraNormalMatrices"):SE.array=t,e=SE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else k6===null&&(k6=Ht(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Kt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=k6;return e}).once()(),oQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new ie);TE===null?TE=wo(t).setGroup(Kt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{let s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):TE.array=t,e=TE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else G6===null&&(G6=Ht(new ie).setName("cameraPosition").setGroup(Kt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=G6;return e}).once()(),Sxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);EE===null?EE=wo(t,"vec4").setGroup(Kt).setName("cameraViewports"):EE.array=t,e=EE.element(l0)}else z6===null&&(z6=Lt(0,0,Rm.x,Rm.y).toConst("cameraViewport")),e=z6;return e}).once()(),sY=new qa,us=class i extends $t{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=_n.OBJECT,this.uniformNode=new Em(null)}generateNodeType(){let e=this.scope;if(e===i.WORLD_MATRIX)return"mat4";if(e===i.POSITION||e===i.VIEW_POSITION||e===i.DIRECTION||e===i.SCALE)return"vec3";if(e===i.RADIUS)return"float"}update(e){let t=this.object3d,n=this.uniformNode,r=this.scope;if(r===i.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===i.POSITION)n.value=n.value||new ie,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new ie,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new ie,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new ie,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===i.RADIUS){let s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),sY.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=sY.radius}}generate(e){let t=this.scope;return t===i.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===i.POSITION||t===i.VIEW_POSITION||t===i.DIRECTION||t===i.SCALE?this.uniformNode.nodeType="vec3":t===i.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};us.WORLD_MATRIX="worldMatrix";us.POSITION="position";us.SCALE="scale";us.VIEW_POSITION="viewPosition";us.DIRECTION="direction";us.RADIUS="radius";var Txe=Vn(us,us.DIRECTION).setParameterLength(1),Exe=Vn(us,us.WORLD_MATRIX).setParameterLength(1),Mxe=Vn(us,us.POSITION).setParameterLength(1),Cxe=Vn(us,us.SCALE).setParameterLength(1),Rxe=Vn(us,us.VIEW_POSITION).setParameterLength(1),Pxe=Vn(us,us.RADIUS).setParameterLength(1),Qa=class extends us{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},Ixe=xt(Qa,Qa.DIRECTION),hc=xt(Qa,Qa.WORLD_MATRIX),Nxe=xt(Qa,Qa.POSITION),Lxe=xt(Qa,Qa.SCALE),Dxe=xt(Qa,Qa.VIEW_POSITION),Fxe=xt(Qa,Qa.RADIUS),aQ=Ht(new Sn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),Oxe=Ht(new on).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Rh=Ae(i=>i.context.modelViewMatrix||lQ).once()().toVar("modelViewMatrix"),lQ=c0.mul(hc),Y8=Ae(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ht("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),K8=Ae(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Ht("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),cQ=Ae(i=>i.shaderStage!=="fragment"?(Kn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),$o=Rl("position","vec3"),hr=$o.toVarying("positionLocal"),Pm=$o.toVarying("positionPrevious"),Eh=Ae(i=>hc.mul(hr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),K7=Ae(()=>hr.transformDirection(hc).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),Jr=Ae(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=sQ.mul(cQ);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),zi=Ae(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=Jr.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),Z8=class extends $t{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";let{material:t}=e;return t.side===ui?"false":e.getFrontFacing()}},uQ=xt(Z8),Z7=se(uQ).mul(2).sub(1),km=Ae(([i],{material:e})=>{let t=e.side;return t===ui?i=i.mul(-1):t===ir&&(i=i.mul(Z7)),i}),Bxe=i=>(Kn('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),km(i)),OC=Rl("normal","vec3"),Jo=Ae(i=>i.geometry.hasAttribute("normal")===!1?(je('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):OC,"vec3").once()().toVar("normalLocal"),hQ=Jr.dFdx().cross(Jr.dFdy()).normalize().toVar("normalFlat"),M1=Ae(i=>{let e;return i.isFlatShading()?e=hQ:e=J7(Jo).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),fQ=Ae(i=>{let e=M1.transformNormalByInverseViewMatrix(c0);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),oi=Ae(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=M1,i.isFlatShading()!==!0&&(e=km(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),u0=oi.transformNormalByInverseViewMatrix(c0).toVar("normalWorld"),Kp=Ae(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=oi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Q7=Ae(([i,e=hc])=>io(e).inverse().transpose().mul(i).normalize());Be("transformNormal",Q7);var J7=Ae(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):aQ.mul(i).transformNormalByViewMatrix(c0)}),Uxe=Ae(()=>(je('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),oi)).once(["NORMAL","VERTEX"])(),kxe=Ae(()=>(je('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),u0)).once(["NORMAL","VERTEX"])(),Gxe=Ae(()=>(je('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Kp)).once(["NORMAL","VERTEX"])(),V6=new on,dQ=Ht(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),rM=Ht(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),SM=Ht(new on).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){let n=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&i.envMap===null?e.environmentRotation:i.envMapRotation;return n?V6.makeRotationFromEuler(n).transpose():V6.identity(),V6}),pQ=zi.negate().reflect(oi),AQ=zi.negate().refract(oi,dQ),mQ=pQ.transformDirection(_b).toVar("reflectVector"),gQ=AQ.transformDirection(_b).toVar("refractVector"),_Q=new Uu,Q8=class extends Ac{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return e.mapping===gl?mQ:e.mapping===Ql?gQ:(Ge('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pe(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===Va?pe(t.x,t.y.negate(),t.z):t:(t=SM.mul(t),(e.renderer.coordinateSystem===Va||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},eU=Vn(Q8).setParameterLength(1,4).setName("cubeTexture"),Sa=(i=_Q,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Vt(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Vt(e)),t!==null&&(r.levelNode=Vt(t)),n!==null&&(r.biasNode=Vt(n))):r=eU(i,e,t,n),r},zxe=(i=_Q)=>eU(i),J8=class extends $f{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(e),r=this.getNodeType(e);return e.format(t,n,r)}},C1=class extends $t{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=_n.OBJECT}element(e){return new J8(this,Vt(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=O1(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=wo(null,e),t.updateType=_n.OBJECT):e==="texture"?t=ai(null):e==="cubeTexture"?t=Sa(null):t=Ht(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},tr=(i,e,t)=>new C1(i,e,t),xQ=(i,e,t,n)=>new C1(i,e,n,t),eF=class extends C1{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},Wf=(i,e,t=null)=>new eF(i,e,t),yQ=Ri(),Vxe=Jr.dFdx(),qxe=Jr.dFdy(),vQ=yQ.dFdx(),bQ=yQ.dFdy(),wQ=oi,SQ=qxe.cross(wQ),TQ=wQ.cross(Vxe),tF=SQ.mul(vQ.x).add(TQ.mul(bQ.x)),nF=SQ.mul(vQ.y).add(TQ.mul(bQ.y)),oY=tF.dot(tF).max(nF.dot(nF)),EQ=oY.equal(0).select(0,oY.inverseSqrt()),Hxe=tF.mul(EQ).toVar("tangentViewFrame"),Wxe=nF.mul(EQ).toVar("bitangentViewFrame"),BC=Rl("tangent","vec4"),r0=BC.xyz.toVar("tangentLocal"),UC=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Rh.mul(Lt(r0,0)).xyz.toVarying("v_tangentView").normalize():e=Hxe,i.isFlatShading()!==!0&&(e=km(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),MQ=UC.transformDirection(_b).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),kC=Ae(([i,e],t)=>{let n=i.mul(BC.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),jxe=kC(OC.cross(BC),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),Xxe=kC(Jo.cross(r0),"v_bitangentLocal").normalize().toVar("bitangentLocal"),CQ=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=kC(oi.cross(UC),"v_bitangentView").normalize():e=Wxe,i.isFlatShading()!==!0&&(e=km(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),$xe=kC(u0.cross(MQ),"v_bitangentWorld").normalize().toVar("bitangentWorld"),gm=io(UC,CQ,oi).toVar("TBNViewMatrix"),RQ=zi.mul(gm),Yxe=(i,e)=>i.sub(RQ.mul(e)),PQ=Ae(()=>{let i=ym.cross(zi);return i=i.cross(ym).normalize(),i=jn(i,oi,jp.mul(vh.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),tU=i=>Vt(i).mul(.5).add(.5),IQ=i=>Vt(i).mul(2).sub(1),iF=i=>pe(i,Ea(NC(se(1).sub(pc(i,i))))),Kxe=i=>(Kn('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),tU(i)),Zxe=i=>(Kn('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),IQ(i)),rF=class extends dr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=_l,this.unpackNormalMode=g2}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===_l?r===XT?s=iF(s.xy):r===ZN?s=iF(s.yw):r!==g2&&Ge(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==g2&&Ge(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=km(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===jT?o=J7(s):t===_l?o=gm.mul(s).normalize():(Ge(`NodeMaterial: Unsupported normal map type: ${t}`),o=oi),o}},sF=Vn(rF).setParameterLength(1,2),Qxe=Ae(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ri()),forceUVContext:!0}),n=se(t(r=>r));return ft(se(t(r=>r.add(r.dFdx()))).sub(n),se(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),Jxe=Ae(i=>{let{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(Z7),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),oF=class extends dr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return oi;let t=this.scaleNode!==null?this.scaleNode:1,n=Qxe({textureNode:this.textureNode,bumpScale:t});return Jxe({surf_pos:Jr,surf_norm:oi,dHdxy:n})}},nU=Vn(oF).setParameterLength(1,2),aY=new Map,ot=class i extends $t{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=aY.get(e);return n===void 0&&(n=Wf(e,t),aY.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){let t=e.context.material,n=this.scope,r=null;if(n===i.COLOR){let s=t.color!==void 0?this.getColor(n):pe();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===i.OPACITY){let s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===i.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=se(1);else if(n===i.SPECULAR_INTENSITY){let s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===i.SPECULAR_COLOR){let s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===i.ROUGHNESS){let s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.METALNESS){let s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===i.EMISSIVE){let s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===i.NORMAL)t.normalMap?(r=sF(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==ws||t.normalMap.format==eh||t.normalMap.format==Ju)&&(r.unpackNormalMode=XT)):t.bumpMap?r=nU(this.getTexture("bump").r,this.getFloat("bumpScale")):r=oi;else if(n===i.CLEARCOAT){let s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_ROUGHNESS){let s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=sF(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=oi;else if(n===i.SHEEN){let s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===i.SHEEN_ROUGHNESS){let s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===i.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){let s=this.getTexture(n);r=TC(A1.x,A1.y,A1.y.negate(),A1.x).mul(s.rg.mul(2).sub(ft(1)).normalize().mul(s.b))}else r=A1;else if(n===i.IRIDESCENCE_THICKNESS){let s=tr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=tr("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===i.TRANSMISSION){let s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.THICKNESS){let s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.IOR)r=this.getFloat(n);else if(n===i.LIGHT_MAP)t.lightMap?r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity")):r=pe(0);else if(n===i.AO)t.aoMap?r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):r=se(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):se(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};ot.ALPHA_TEST="alphaTest";ot.COLOR="color";ot.OPACITY="opacity";ot.SHININESS="shininess";ot.SPECULAR="specular";ot.SPECULAR_STRENGTH="specularStrength";ot.SPECULAR_INTENSITY="specularIntensity";ot.SPECULAR_COLOR="specularColor";ot.REFLECTIVITY="reflectivity";ot.ROUGHNESS="roughness";ot.METALNESS="metalness";ot.NORMAL="normal";ot.CLEARCOAT="clearcoat";ot.CLEARCOAT_ROUGHNESS="clearcoatRoughness";ot.CLEARCOAT_NORMAL="clearcoatNormal";ot.EMISSIVE="emissive";ot.ROTATION="rotation";ot.SHEEN="sheen";ot.SHEEN_ROUGHNESS="sheenRoughness";ot.ANISOTROPY="anisotropy";ot.IRIDESCENCE="iridescence";ot.IRIDESCENCE_IOR="iridescenceIOR";ot.IRIDESCENCE_THICKNESS="iridescenceThickness";ot.IOR="ior";ot.TRANSMISSION="transmission";ot.THICKNESS="thickness";ot.ATTENUATION_DISTANCE="attenuationDistance";ot.ATTENUATION_COLOR="attenuationColor";ot.LINE_SCALE="scale";ot.LINE_DASH_SIZE="dashSize";ot.LINE_GAP_SIZE="gapSize";ot.LINE_WIDTH="linewidth";ot.LINE_DASH_OFFSET="dashOffset";ot.POINT_SIZE="size";ot.DISPERSION="dispersion";ot.LIGHT_MAP="light";ot.AO="ao";var NQ=xt(ot,ot.ALPHA_TEST),LQ=xt(ot,ot.COLOR),DQ=xt(ot,ot.SHININESS),FQ=xt(ot,ot.EMISSIVE),iU=xt(ot,ot.OPACITY),OQ=xt(ot,ot.SPECULAR),aF=xt(ot,ot.SPECULAR_INTENSITY),BQ=xt(ot,ot.SPECULAR_COLOR),Wv=xt(ot,ot.SPECULAR_STRENGTH),sM=xt(ot,ot.REFLECTIVITY),UQ=xt(ot,ot.ROUGHNESS),kQ=xt(ot,ot.METALNESS),GQ=xt(ot,ot.NORMAL),zQ=xt(ot,ot.CLEARCOAT),VQ=xt(ot,ot.CLEARCOAT_ROUGHNESS),qQ=xt(ot,ot.CLEARCOAT_NORMAL),HQ=xt(ot,ot.ROTATION),WQ=xt(ot,ot.SHEEN),jQ=xt(ot,ot.SHEEN_ROUGHNESS),XQ=xt(ot,ot.ANISOTROPY),$Q=xt(ot,ot.IRIDESCENCE),YQ=xt(ot,ot.IRIDESCENCE_IOR),KQ=xt(ot,ot.IRIDESCENCE_THICKNESS),ZQ=xt(ot,ot.TRANSMISSION),QQ=xt(ot,ot.THICKNESS),JQ=xt(ot,ot.IOR),eJ=xt(ot,ot.ATTENUATION_DISTANCE),tJ=xt(ot,ot.ATTENUATION_COLOR),rU=xt(ot,ot.LINE_SCALE),sU=xt(ot,ot.LINE_DASH_SIZE),oU=xt(ot,ot.LINE_GAP_SIZE),TM=xt(ot,ot.LINE_WIDTH),aU=xt(ot,ot.LINE_DASH_OFFSET),nJ=xt(ot,ot.POINT_SIZE),iJ=xt(ot,ot.DISPERSION),lU=xt(ot,ot.LIGHT_MAP),rJ=xt(ot,ot.AO),A1=Ht(new Oe).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),sJ=Ae(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Ma=class i extends $t{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=_n.OBJECT:e===i.MATERIAL?this.updateType=_n.RENDER:e===i.FRAME?this.updateType=_n.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=_n.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=_n.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=_n.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};Ma.OBJECT="object";Ma.MATERIAL="material";Ma.FRAME="frame";Ma.BEFORE_OBJECT="beforeObject";Ma.BEFORE_MATERIAL="beforeMaterial";Ma.BEFORE_FRAME="beforeFrame";var B1=(i,e)=>new Ma(i,e).toStack(),xb=i=>B1(Ma.OBJECT,i),eye=i=>B1(Ma.MATERIAL,i),oJ=i=>B1(Ma.FRAME,i),tye=i=>B1(Ma.BEFORE_OBJECT,i),nye=i=>B1(Ma.BEFORE_MATERIAL,i),iye=i=>B1(Ma.BEFORE_FRAME,i),lF=class extends $f{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},rye=Vn(lF).setParameterLength(2),cF=class extends tb{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStructTypeNode?(r="struct",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=vK(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=So.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return rye(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(So.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=G7(this.value),this._varying=a0(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},t0=(i,e=null,t=0)=>new cF(i,e,t),uF=new WeakMap,lY=new WeakMap,hF=new WeakMap;function aJ(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=t0(e,"mat4",n).element(nu);else if(n*16*4<=i.getUniformBufferLimit())t=O1(e.array,"mat4",n).element(nu);else{let o=uF.get(e);o||(o=new Gu(e.array,16,1),uF.set(e,o));let a=e.usage===kA?z7:FC,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=e0(...l)}return t}function sye(i,e,t){let n=hF.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:aJ(t,r)},hF.set(i,n)}return n.node}var cU=Bm("vec3","vInstanceColor"),lJ=Ae(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=aJ(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=uF.get(i));let a=null,l=null;if(e)if(r)a=t0(e,"vec3",Math.max(e.count,1)).element(nu);else{let u=lY.get(e);u||(u=new Al(e.array,3),lY.set(e,u)),l=u;let f=e.usage===kA?z7:FC;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&oJ(()=>{o!==null&&(o.clearUpdateRanges(),o.updateRanges.push(...i.updateRanges),i.version!==o.version&&(o.version=i.version)),e&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...e.updateRanges),e.version!==l.version&&(l.version=e.version))});let c=s.mul(hr).xyz;if(hr.assign(c),t.needsPreviousData()){let u=t.object;xb(({object:p})=>{hF.get(p).previousInstanceMatrix.array.set(i.array)});let f=sye(u,i,t);Pm.assign(f.mul(Pm).xyz)}if(t.hasGeometryAttribute("normal")){let u=Q7(Jo,s);Jo.assign(u)}a!==null&&cU.assign(a)},"void"),cJ=Ae(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;lJ(e,t)},"void"),oye=Ae(([i,e])=>{let t=fe(Cm(Qr(i),0).x).toConst(),n=fe(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return Qr(i,vr(r,s))}),aye=Ae(([i,e])=>{let t=fe(Cm(Qr(i),0).x).toConst(),n=fe(e).mod(t).toConst(),r=fe(e).div(t).toConst();return Qr(i,vr(n,r)).x}),uU=Bm("vec4","vBatchColor"),uJ=Ae(([i],e)=>{let t=e.getDrawIndex()===null?nu:YZ,n=aye(i._indirectTexture,fe(t)),r=i._matricesTexture,s=fe(Cm(Qr(r),0).x).toConst(),o=se(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=e0(Qr(r,vr(a,l)),Qr(r,vr(a.add(1),l)),Qr(r,vr(a.add(2),l)),Qr(r,vr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let v=oye(u,n);uU.assign(v)}let f=io(c);hr.assign(c.mul(hr));let p=Jo.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),x=f.mul(p).xyz;Jo.assign(x),e.hasGeometryAttribute("tangent")&&r0.mulAssign(f)},"void"),EM=new WeakMap,MM=new WeakMap;function hU(i,e,t,n,r,s){let o=i.element(r.x),a=i.element(r.y),l=i.element(r.z),c=i.element(r.w),u=t.mul(e),f=cs(o.mul(s.x).mul(u),a.mul(s.y).mul(u),l.mul(s.z).mul(u),c.mul(s.w).mul(u));return n.mul(f).xyz}function hJ(i,e,t,n,r,s,o){let a=i.element(s.x),l=i.element(s.y),c=i.element(s.z),u=i.element(s.w),f=cs(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let p=f.transformDirection(e).xyz,x=f.transformDirection(t).xyz;return{skinNormal:p,skinTangent:x}}function fJ(i,e,t,n,r){let s=i.skeleton,o=MM.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:O1(a,"mat4",s.bones.length)},MM.set(s,o)}return hU(o.node,Pm,e,t,n,r)}var dJ=Ae(([i],e)=>{let t=Rl("skinIndex","uvec4"),n=Rl("skinWeight","vec4"),r=tr("bindMatrix","mat4"),s=tr("bindMatrixInverse","mat4"),o=xQ("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(xb(({object:l,frameId:c})=>{let u=l.skeleton;if(EM.get(u)!==c){EM.set(u,c);let f=MM.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=fJ(i,r,s,t,n);Pm.assign(l)}let a=hU(o,hr,r,s,t,n);if(hr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=hJ(o,Jo,r0,r,s,t,n);Jo.assign(l),e.hasGeometryAttribute("tangent")&&r0.assign(c)}},"void"),lye=Ae(([i,e=null],t)=>{let n=t0(new Al(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(nu).toVar(),r=t0(new Al(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(nu).toVar(),s=t0(new Al(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(nu).toVar(),o=Ht(i.bindMatrix,"mat4"),a=Ht(i.bindMatrixInverse,"mat4"),l=O1(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(xb(({frameId:f})=>{if(EM.get(c)!==f){EM.set(c,f);let p=MM.get(c);p!==void 0&&p.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=fJ(i,o,a,r,s);Pm.assign(f)}let u=hU(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:p}=hJ(l,Jo,r0,o,a,r,s);Jo.assign(f),t.hasGeometryAttribute("tangent")&&r0.assign(p)}return u}),fF=class extends $t{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let a=0,l=this.params.length-1;a<l;a++){let c=this.params[a],u=c.isNode!==!0&&c.name||this.getVarName(a),f=c.isNode!==!0&&c.type||"int";n[u]=Cl(u,f)}let r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;let o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){let a=Ae(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){let l=n[o],c=!1,u=null,f=null,p=null,x=null,v=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,x="bool",f=l.build(e,x)):(x="int",p=this.getVarName(o),u="0",f=l.build(e,x),v="<"):(x=l.type||"int",p=l.name||this.getVarName(o),u=l.start,f=l.end,v=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(x,u):u&&u.isNode&&(u=u.build(e,x)),typeof f=="number"?f=e.generateConst(x,f):f&&f.isNode&&(f=f.build(e,x)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",v=">="):f!==void 0&&u===void 0&&(u="0",v="<"),v===void 0&&(Number(u)>Number(f)?v=">=":v="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},P=T.start,R=T.end,C,L=()=>v.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":C=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":C=p+" "+L()+" "+e.generateConst(x,w);break;case"string":C=p+" "+w;break;default:w.isNode?C=p+" "+L()+" "+w.build(e):(Ge("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),C="break /* invalid update */")}else x==="int"||x==="uint"?w=v.includes("<")?"++":"--":w=L()+" 1.",C=p+" "+w;let D=e.getVar(x,p)+" = "+P,F=p+" "+v+" "+R;S=`for ( ${D}; ${F}; ${C} )`}e.addFlowCode((o===0?`4151+`,AA(o)}return n}},rQ=(i,e=null)=>new q8(Vt(i),e).toStack();Be("debug",rQ);var vM=class extends Go{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},H8=class extends $t{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=_n.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==vM&&Zn('TSL: ".toInspector()" is only available with WebGPU.'),t}};function sQ(i,e="",t=null){return i=Vt(i),i.before(new H8(i,e,t))}Be("toInspector",sQ);function _xe(i){je("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var bM=class extends $t{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):a0(this).build(e,n)}else return je(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},Rl=(i,e=null)=>new bM(i,e),Ri=(i=0)=>Rl("uv"+(i>0?i:""),"vec2"),W8=class extends $t{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}},Rm=Vn(W8).setParameterLength(1,2),j8=class extends Mm{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=_n.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}},X7=Vn(j8).setParameterLength(1),wM=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},$7=new bs,Ac=class extends Mm{static get type(){return"TextureNode"}constructor(e=$7,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=_n.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===pi?"uvec4":this.value.type===Ir?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ri(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Ht(this.value.matrix)),this._matrixUniform.mul(pe(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Ht(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(fe(Rm(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new wM("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=Ae(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?_n.OBJECT:_n.NONE,l})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(Df.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===T_||l===th||l===kA||l===Hc?a=this.compareNode:(o=this.compareNode,Zn('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,c,u,f){let p=this.value,x;return s?x=e.generateTextureBias(p,t,n,s,o,u):l?x=e.generateTextureGrad(p,t,n,l,o,u):c?a?x=e.generateTextureGatherCompare(p,t,n,a,o,u,f):x=e.generateTextureGather(p,t,n,c,o,u,f):a?x=e.generateTextureCompare(p,t,n,a,o,u):this.sampler===!1?x=e.generateTextureLoad(p,t,n,r,o,u):r?x=e.generateTextureLevel(p,t,n,r,o,u):x=e.generateTexture(p,t,n,o,u),x}generate(e,t){let n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{let o=e.getDataFromNode(this),a=this.getNodeType(e),l=o.propertyName;if(l===void 0){let{uvNode:u,levelNode:f,biasNode:p,compareNode:x,compareStepNode:v,depthNode:w,gradNode:S,gatherNode:T,offsetNode:P}=r,R=this.generateUV(e,u),C=f?f.build(e,"float"):null,L=p?p.build(e,"float"):null,D=w?w.build(e,"int"):null,F=x?x.build(e,"float"):null,N=v?v.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,z=T?T.build(e,"int"):null,V=P?this.generateOffset(e,P):null,H=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;z&&(a="vec4");let Z=D;Z===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(Z="0");let J=e.getVarFromNode(this);l=e.getPropertyName(J);let j=this.generateSnippet(e,s,R,C,L,Z,F,B,z,V,H);if(N!==null){let K=n.compareFunction;K===kA||K===Hc?j=Cm(Cl(j,a),Cl(N,"float")).build(e,a):j=Cm(Cl(N,"float"),Cl(j,a)).build(e,a)}e.addLineFlowCode(`${l} = ${j}`,this),o.snippet=j,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=LC(Cl(c,a),n.colorSpace).setup(e).build(e,a)),e.format(c,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Vt(e).mul(X7(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===xi||n.magFilter===xi)&&(je("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Vt(t)}level(e){let t=this.clone();return t.levelNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}size(e){return Rm(this,e)}bias(e){let t=this.clone();return t.biasNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}grad(e,t){let n=this.clone();return n.gradNode=[Vt(e),Vt(t)],n.referenceNode=this.getBase(),Vt(n)}gather(e=0){let t=this.clone();return t.gatherNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}depth(e){let t=this.clone();return t.depthNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}offset(e){let t=this.clone();return t.offsetNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},xxe=Vn(Ac).setParameterLength(1,4).setName("texture"),ai=(i=$7,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Vt(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Vt(e)),t!==null&&(r.levelNode=Vt(t)),n!==null&&(r.biasNode=Vt(n))):r=xxe(i,e,t,n),r},yxe=(i=$7)=>ai(i),Qr=(...i)=>ai(...i).setSampler(!1),vxe=(i,e,t)=>ai(i,e).level(t),bxe=i=>(i.isNode===!0?i:ai(i)).convert("sampler"),wxe=i=>(i.isNode===!0?i:ai(i)).convert("samplerComparison"),tb=class extends Mm{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}},O1=(i,e,t)=>new tb(i,e,t),X8=class extends $f{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(e),r=this.node.getPaddedType();return e.format(t,r,n)}},$8=class extends tb{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Qp(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=_n.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){let s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new X8(this,Vt(e))}},wo=(i,e)=>new $8(i,e),Y8=class extends $t{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},Jf=Vn(Y8).setParameterLength(1),vv,bv,To=class i extends $t{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===i.DPR?"float":this.scope===i.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=_n.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=_n.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?bv.copy(t.viewport):(e.getViewport(bv),bv.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(vv.width=t.width,vv.height=t.height):e.getDrawingBufferSize(vv)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Ht(vv||(vv=new Oe)):e===i.VIEWPORT?t=Ht(bv||(bv=new gn)):e===i.DPR?t=Ht(1):t=ft(km.div(Pm)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Pm).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};To.COORDINATE="coordinate";To.VIEWPORT="viewport";To.SIZE="size";To.UV="uv";To.DPR="dpr";var Y7=xt(To,To.DPR),tu=xt(To,To.UV),Pm=xt(To,To.SIZE),km=xt(To,To.COORDINATE),S1=xt(To,To.VIEWPORT),Z7=S1.zw,oQ=km.sub(S1.xy),Sxe=oQ.div(Z7),Txe=Ae(()=>(je('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Fr),Pm),"vec2").once()(),O6=null,yE=null,B6=null,vE=null,U6=null,bE=null,k6=null,wE=null,G6=null,SE=null,z6=null,TE=null,V6=null,EE=null,l0=Ht(0,"uint").setName("u_cameraIndex").setGroup(MC("cameraIndex")).toVarying("v_cameraIndex"),$p=Ht("float").setName("cameraNear").setGroup(Zt).onRenderUpdate(({camera:i})=>i.near),Yp=Ht("float").setName("cameraFar").setGroup(Zt).onRenderUpdate(({camera:i})=>i.far),Ea=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);yE===null?yE=wo(t).setGroup(Zt).setName("cameraProjectionMatrices"):yE.array=t,e=yE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else O6===null&&(O6=Ht(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=O6;return e}).once()(),aQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);vE===null?vE=wo(t).setGroup(Zt).setName("cameraProjectionMatricesInverse"):vE.array=t,e=vE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else B6===null&&(B6=Ht(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=B6;return e}).once()(),c0=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);bE===null?bE=wo(t).setGroup(Zt).setName("cameraViewMatrices"):bE.array=t,e=bE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else U6===null&&(U6=Ht(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=U6;return e}).once()(),_b=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);wE===null?wE=wo(t).setGroup(Zt).setName("cameraWorldMatrices"):wE.array=t,e=wE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else k6===null&&(k6=Ht(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=k6;return e}).once()(),Exe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);SE===null?SE=wo(t).setGroup(Zt).setName("cameraNormalMatrices"):SE.array=t,e=SE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else G6===null&&(G6=Ht(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=G6;return e}).once()(),lQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new ie);TE===null?TE=wo(t).setGroup(Zt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{let s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):TE.array=t,e=TE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else z6===null&&(z6=Ht(new ie).setName("cameraPosition").setGroup(Zt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=z6;return e}).once()(),Mxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);EE===null?EE=wo(t,"vec4").setGroup(Zt).setName("cameraViewports"):EE.array=t,e=EE.element(l0)}else V6===null&&(V6=Lt(0,0,Pm.x,Pm.y).toConst("cameraViewport")),e=V6;return e}).once()(),aY=new Ha,hs=class i extends $t{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=_n.OBJECT,this.uniformNode=new Mm(null)}generateNodeType(){let e=this.scope;if(e===i.WORLD_MATRIX)return"mat4";if(e===i.POSITION||e===i.VIEW_POSITION||e===i.DIRECTION||e===i.SCALE)return"vec3";if(e===i.RADIUS)return"float"}update(e){let t=this.object3d,n=this.uniformNode,r=this.scope;if(r===i.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===i.POSITION)n.value=n.value||new ie,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new ie,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new ie,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new ie,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===i.RADIUS){let s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),aY.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=aY.radius}}generate(e){let t=this.scope;return t===i.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===i.POSITION||t===i.VIEW_POSITION||t===i.DIRECTION||t===i.SCALE?this.uniformNode.nodeType="vec3":t===i.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};hs.WORLD_MATRIX="worldMatrix";hs.POSITION="position";hs.SCALE="scale";hs.VIEW_POSITION="viewPosition";hs.DIRECTION="direction";hs.RADIUS="radius";var Cxe=Vn(hs,hs.DIRECTION).setParameterLength(1),Rxe=Vn(hs,hs.WORLD_MATRIX).setParameterLength(1),Pxe=Vn(hs,hs.POSITION).setParameterLength(1),Ixe=Vn(hs,hs.SCALE).setParameterLength(1),Nxe=Vn(hs,hs.VIEW_POSITION).setParameterLength(1),Lxe=Vn(hs,hs.RADIUS).setParameterLength(1),Ja=class extends hs{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},Dxe=xt(Ja,Ja.DIRECTION),hc=xt(Ja,Ja.WORLD_MATRIX),Fxe=xt(Ja,Ja.POSITION),Oxe=xt(Ja,Ja.SCALE),Bxe=xt(Ja,Ja.VIEW_POSITION),Uxe=xt(Ja,Ja.RADIUS),cQ=Ht(new Sn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),kxe=Ht(new on).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Rh=Ae(i=>i.context.modelViewMatrix||uQ).once()().toVar("modelViewMatrix"),uQ=c0.mul(hc),Z8=Ae(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ht("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),K8=Ae(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Ht("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),hQ=Ae(i=>i.shaderStage!=="fragment"?(Zn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Yo=Rl("position","vec3"),hr=Yo.toVarying("positionLocal"),Im=Yo.toVarying("positionPrevious"),Eh=Ae(i=>hc.mul(hr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),K7=Ae(()=>hr.transformDirection(hc).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),Jr=Ae(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=aQ.mul(hQ);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),zi=Ae(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=Jr.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),Q8=class extends $t{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";let{material:t}=e;return t.side===ui?"false":e.getFrontFacing()}},fQ=xt(Q8),Q7=se(fQ).mul(2).sub(1),Gm=Ae(([i],{material:e})=>{let t=e.side;return t===ui?i=i.mul(-1):t===ir&&(i=i.mul(Q7)),i}),Gxe=i=>(Zn('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),Gm(i)),OC=Rl("normal","vec3"),ea=Ae(i=>i.geometry.hasAttribute("normal")===!1?(je('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):OC,"vec3").once()().toVar("normalLocal"),dQ=Jr.dFdx().cross(Jr.dFdy()).normalize().toVar("normalFlat"),M1=Ae(i=>{let e;return i.isFlatShading()?e=dQ:e=eU(ea).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),pQ=Ae(i=>{let e=M1.transformNormalByInverseViewMatrix(c0);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),oi=Ae(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=M1,i.isFlatShading()!==!0&&(e=Gm(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),u0=oi.transformNormalByInverseViewMatrix(c0).toVar("normalWorld"),Zp=Ae(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=oi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),J7=Ae(([i,e=hc])=>io(e).inverse().transpose().mul(i).normalize());Be("transformNormal",J7);var eU=Ae(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):cQ.mul(i).transformNormalByViewMatrix(c0)}),zxe=Ae(()=>(je('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),oi)).once(["NORMAL","VERTEX"])(),Vxe=Ae(()=>(je('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),u0)).once(["NORMAL","VERTEX"])(),qxe=Ae(()=>(je('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Zp)).once(["NORMAL","VERTEX"])(),q6=new on,AQ=Ht(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),rM=Ht(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),SM=Ht(new on).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){let n=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&i.envMap===null?e.environmentRotation:i.envMapRotation;return n?q6.makeRotationFromEuler(n).transpose():q6.identity(),q6}),mQ=zi.negate().reflect(oi),gQ=zi.negate().refract(oi,AQ),_Q=mQ.transformDirection(_b).toVar("reflectVector"),xQ=gQ.transformDirection(_b).toVar("refractVector"),yQ=new Uu,J8=class extends Ac{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return e.mapping===gl?_Q:e.mapping===Ql?xQ:(Ge('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pe(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===qa?pe(t.x,t.y.negate(),t.z):t:(t=SM.mul(t),(e.renderer.coordinateSystem===qa||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},tU=Vn(J8).setParameterLength(1,4).setName("cubeTexture"),Ta=(i=yQ,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Vt(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Vt(e)),t!==null&&(r.levelNode=Vt(t)),n!==null&&(r.biasNode=Vt(n))):r=tU(i,e,t,n),r},Hxe=(i=yQ)=>tU(i),eF=class extends $f{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(e),r=this.getNodeType(e);return e.format(t,n,r)}},C1=class extends $t{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=_n.OBJECT}element(e){return new eF(this,Vt(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=O1(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=wo(null,e),t.updateType=_n.OBJECT):e==="texture"?t=ai(null):e==="cubeTexture"?t=Ta(null):t=Ht(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},tr=(i,e,t)=>new C1(i,e,t),vQ=(i,e,t,n)=>new C1(i,e,n,t),tF=class extends C1{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},Wf=(i,e,t=null)=>new tF(i,e,t),bQ=Ri(),Wxe=Jr.dFdx(),jxe=Jr.dFdy(),wQ=bQ.dFdx(),SQ=bQ.dFdy(),TQ=oi,EQ=jxe.cross(TQ),MQ=TQ.cross(Wxe),nF=EQ.mul(wQ.x).add(MQ.mul(SQ.x)),iF=EQ.mul(wQ.y).add(MQ.mul(SQ.y)),lY=nF.dot(nF).max(iF.dot(iF)),CQ=lY.equal(0).select(0,lY.inverseSqrt()),Xxe=nF.mul(CQ).toVar("tangentViewFrame"),$xe=iF.mul(CQ).toVar("bitangentViewFrame"),BC=Rl("tangent","vec4"),r0=BC.xyz.toVar("tangentLocal"),UC=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Rh.mul(Lt(r0,0)).xyz.toVarying("v_tangentView").normalize():e=Xxe,i.isFlatShading()!==!0&&(e=Gm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),RQ=UC.transformDirection(_b).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),kC=Ae(([i,e],t)=>{let n=i.mul(BC.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),Yxe=kC(OC.cross(BC),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),Zxe=kC(ea.cross(r0),"v_bitangentLocal").normalize().toVar("bitangentLocal"),PQ=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=kC(oi.cross(UC),"v_bitangentView").normalize():e=$xe,i.isFlatShading()!==!0&&(e=Gm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),Kxe=kC(u0.cross(RQ),"v_bitangentWorld").normalize().toVar("bitangentWorld"),_m=io(UC,PQ,oi).toVar("TBNViewMatrix"),IQ=zi.mul(_m),Qxe=(i,e)=>i.sub(IQ.mul(e)),NQ=Ae(()=>{let i=vm.cross(zi);return i=i.cross(vm).normalize(),i=jn(i,oi,jp.mul(vh.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),nU=i=>Vt(i).mul(.5).add(.5),LQ=i=>Vt(i).mul(2).sub(1),rF=i=>pe(i,Ma(NC(se(1).sub(pc(i,i))))),Jxe=i=>(Zn('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),nU(i)),eye=i=>(Zn('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),LQ(i)),sF=class extends dr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=_l,this.unpackNormalMode=g2}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===_l?r===XT?s=rF(s.xy):r===QN?s=rF(s.yw):r!==g2&&Ge(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==g2&&Ge(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=Gm(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===jT?o=eU(s):t===_l?o=_m.mul(s).normalize():(Ge(`NodeMaterial: Unsupported normal map type: ${t}`),o=oi),o}},oF=Vn(sF).setParameterLength(1,2),tye=Ae(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ri()),forceUVContext:!0}),n=se(t(r=>r));return ft(se(t(r=>r.add(r.dFdx()))).sub(n),se(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),nye=Ae(i=>{let{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(Q7),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),aF=class extends dr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return oi;let t=this.scaleNode!==null?this.scaleNode:1,n=tye({textureNode:this.textureNode,bumpScale:t});return nye({surf_pos:Jr,surf_norm:oi,dHdxy:n})}},iU=Vn(aF).setParameterLength(1,2),cY=new Map,ot=class i extends $t{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=cY.get(e);return n===void 0&&(n=Wf(e,t),cY.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){let t=e.context.material,n=this.scope,r=null;if(n===i.COLOR){let s=t.color!==void 0?this.getColor(n):pe();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===i.OPACITY){let s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===i.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=se(1);else if(n===i.SPECULAR_INTENSITY){let s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===i.SPECULAR_COLOR){let s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===i.ROUGHNESS){let s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.METALNESS){let s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===i.EMISSIVE){let s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===i.NORMAL)t.normalMap?(r=oF(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ss||t.normalMap.format==eh||t.normalMap.format==Ju)&&(r.unpackNormalMode=XT)):t.bumpMap?r=iU(this.getTexture("bump").r,this.getFloat("bumpScale")):r=oi;else if(n===i.CLEARCOAT){let s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_ROUGHNESS){let s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=oF(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=oi;else if(n===i.SHEEN){let s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===i.SHEEN_ROUGHNESS){let s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===i.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){let s=this.getTexture(n);r=TC(A1.x,A1.y,A1.y.negate(),A1.x).mul(s.rg.mul(2).sub(ft(1)).normalize().mul(s.b))}else r=A1;else if(n===i.IRIDESCENCE_THICKNESS){let s=tr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=tr("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===i.TRANSMISSION){let s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.THICKNESS){let s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.IOR)r=this.getFloat(n);else if(n===i.LIGHT_MAP)t.lightMap?r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity")):r=pe(0);else if(n===i.AO)t.aoMap?r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):r=se(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):se(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};ot.ALPHA_TEST="alphaTest";ot.COLOR="color";ot.OPACITY="opacity";ot.SHININESS="shininess";ot.SPECULAR="specular";ot.SPECULAR_STRENGTH="specularStrength";ot.SPECULAR_INTENSITY="specularIntensity";ot.SPECULAR_COLOR="specularColor";ot.REFLECTIVITY="reflectivity";ot.ROUGHNESS="roughness";ot.METALNESS="metalness";ot.NORMAL="normal";ot.CLEARCOAT="clearcoat";ot.CLEARCOAT_ROUGHNESS="clearcoatRoughness";ot.CLEARCOAT_NORMAL="clearcoatNormal";ot.EMISSIVE="emissive";ot.ROTATION="rotation";ot.SHEEN="sheen";ot.SHEEN_ROUGHNESS="sheenRoughness";ot.ANISOTROPY="anisotropy";ot.IRIDESCENCE="iridescence";ot.IRIDESCENCE_IOR="iridescenceIOR";ot.IRIDESCENCE_THICKNESS="iridescenceThickness";ot.IOR="ior";ot.TRANSMISSION="transmission";ot.THICKNESS="thickness";ot.ATTENUATION_DISTANCE="attenuationDistance";ot.ATTENUATION_COLOR="attenuationColor";ot.LINE_SCALE="scale";ot.LINE_DASH_SIZE="dashSize";ot.LINE_GAP_SIZE="gapSize";ot.LINE_WIDTH="linewidth";ot.LINE_DASH_OFFSET="dashOffset";ot.POINT_SIZE="size";ot.DISPERSION="dispersion";ot.LIGHT_MAP="light";ot.AO="ao";var DQ=xt(ot,ot.ALPHA_TEST),FQ=xt(ot,ot.COLOR),OQ=xt(ot,ot.SHININESS),BQ=xt(ot,ot.EMISSIVE),rU=xt(ot,ot.OPACITY),UQ=xt(ot,ot.SPECULAR),lF=xt(ot,ot.SPECULAR_INTENSITY),kQ=xt(ot,ot.SPECULAR_COLOR),Wv=xt(ot,ot.SPECULAR_STRENGTH),sM=xt(ot,ot.REFLECTIVITY),GQ=xt(ot,ot.ROUGHNESS),zQ=xt(ot,ot.METALNESS),VQ=xt(ot,ot.NORMAL),qQ=xt(ot,ot.CLEARCOAT),HQ=xt(ot,ot.CLEARCOAT_ROUGHNESS),WQ=xt(ot,ot.CLEARCOAT_NORMAL),jQ=xt(ot,ot.ROTATION),XQ=xt(ot,ot.SHEEN),$Q=xt(ot,ot.SHEEN_ROUGHNESS),YQ=xt(ot,ot.ANISOTROPY),ZQ=xt(ot,ot.IRIDESCENCE),KQ=xt(ot,ot.IRIDESCENCE_IOR),QQ=xt(ot,ot.IRIDESCENCE_THICKNESS),JQ=xt(ot,ot.TRANSMISSION),eJ=xt(ot,ot.THICKNESS),tJ=xt(ot,ot.IOR),nJ=xt(ot,ot.ATTENUATION_DISTANCE),iJ=xt(ot,ot.ATTENUATION_COLOR),sU=xt(ot,ot.LINE_SCALE),oU=xt(ot,ot.LINE_DASH_SIZE),aU=xt(ot,ot.LINE_GAP_SIZE),TM=xt(ot,ot.LINE_WIDTH),lU=xt(ot,ot.LINE_DASH_OFFSET),rJ=xt(ot,ot.POINT_SIZE),sJ=xt(ot,ot.DISPERSION),cU=xt(ot,ot.LIGHT_MAP),oJ=xt(ot,ot.AO),A1=Ht(new Oe).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),aJ=Ae(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Ca=class i extends $t{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=_n.OBJECT:e===i.MATERIAL?this.updateType=_n.RENDER:e===i.FRAME?this.updateType=_n.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=_n.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=_n.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=_n.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};Ca.OBJECT="object";Ca.MATERIAL="material";Ca.FRAME="frame";Ca.BEFORE_OBJECT="beforeObject";Ca.BEFORE_MATERIAL="beforeMaterial";Ca.BEFORE_FRAME="beforeFrame";var B1=(i,e)=>new Ca(i,e).toStack(),xb=i=>B1(Ca.OBJECT,i),iye=i=>B1(Ca.MATERIAL,i),lJ=i=>B1(Ca.FRAME,i),rye=i=>B1(Ca.BEFORE_OBJECT,i),sye=i=>B1(Ca.BEFORE_MATERIAL,i),oye=i=>B1(Ca.BEFORE_FRAME,i),cF=class extends $f{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},aye=Vn(cF).setParameterLength(2),uF=class extends tb{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStructTypeNode?(r="struct",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=wZ(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=So.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return aye(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(So.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=z7(this.value),this._varying=a0(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},t0=(i,e=null,t=0)=>new uF(i,e,t),hF=new WeakMap,uY=new WeakMap,fF=new WeakMap;function cJ(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=t0(e,"mat4",n).element(nu);else if(n*16*4<=i.getUniformBufferLimit())t=O1(e.array,"mat4",n).element(nu);else{let o=hF.get(e);o||(o=new Gu(e.array,16,1),hF.set(e,o));let a=e.usage===GA?V7:FC,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=e0(...l)}return t}function lye(i,e,t){let n=fF.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:cJ(t,r)},fF.set(i,n)}return n.node}var uU=Um("vec3","vInstanceColor"),uJ=Ae(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=cJ(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=hF.get(i));let a=null,l=null;if(e)if(r)a=t0(e,"vec3",Math.max(e.count,1)).element(nu);else{let u=uY.get(e);u||(u=new Al(e.array,3),uY.set(e,u)),l=u;let f=e.usage===GA?V7:FC;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&lJ(()=>{o!==null&&(o.clearUpdateRanges(),o.updateRanges.push(...i.updateRanges),i.version!==o.version&&(o.version=i.version)),e&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...e.updateRanges),e.version!==l.version&&(l.version=e.version))});let c=s.mul(hr).xyz;if(hr.assign(c),t.needsPreviousData()){let u=t.object;xb(({object:p})=>{fF.get(p).previousInstanceMatrix.array.set(i.array)});let f=lye(u,i,t);Im.assign(f.mul(Im).xyz)}if(t.hasGeometryAttribute("normal")){let u=J7(ea,s);ea.assign(u)}a!==null&&uU.assign(a)},"void"),hJ=Ae(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;uJ(e,t)},"void"),cye=Ae(([i,e])=>{let t=fe(Rm(Qr(i),0).x).toConst(),n=fe(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return Qr(i,vr(r,s))}),uye=Ae(([i,e])=>{let t=fe(Rm(Qr(i),0).x).toConst(),n=fe(e).mod(t).toConst(),r=fe(e).div(t).toConst();return Qr(i,vr(n,r)).x}),hU=Um("vec4","vBatchColor"),fJ=Ae(([i],e)=>{let t=e.getDrawIndex()===null?nu:KK,n=uye(i._indirectTexture,fe(t)),r=i._matricesTexture,s=fe(Rm(Qr(r),0).x).toConst(),o=se(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=e0(Qr(r,vr(a,l)),Qr(r,vr(a.add(1),l)),Qr(r,vr(a.add(2),l)),Qr(r,vr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let v=cye(u,n);hU.assign(v)}let f=io(c);hr.assign(c.mul(hr));let p=ea.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),x=f.mul(p).xyz;ea.assign(x),e.hasGeometryAttribute("tangent")&&r0.mulAssign(f)},"void"),EM=new WeakMap,MM=new WeakMap;function fU(i,e,t,n,r,s){let o=i.element(r.x),a=i.element(r.y),l=i.element(r.z),c=i.element(r.w),u=t.mul(e),f=us(o.mul(s.x).mul(u),a.mul(s.y).mul(u),l.mul(s.z).mul(u),c.mul(s.w).mul(u));return n.mul(f).xyz}function dJ(i,e,t,n,r,s,o){let a=i.element(s.x),l=i.element(s.y),c=i.element(s.z),u=i.element(s.w),f=us(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let p=f.transformDirection(e).xyz,x=f.transformDirection(t).xyz;return{skinNormal:p,skinTangent:x}}function pJ(i,e,t,n,r){let s=i.skeleton,o=MM.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:O1(a,"mat4",s.bones.length)},MM.set(s,o)}return fU(o.node,Im,e,t,n,r)}var AJ=Ae(([i],e)=>{let t=Rl("skinIndex","uvec4"),n=Rl("skinWeight","vec4"),r=tr("bindMatrix","mat4"),s=tr("bindMatrixInverse","mat4"),o=vQ("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(xb(({object:l,frameId:c})=>{let u=l.skeleton;if(EM.get(u)!==c){EM.set(u,c);let f=MM.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=pJ(i,r,s,t,n);Im.assign(l)}let a=fU(o,hr,r,s,t,n);if(hr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=dJ(o,ea,r0,r,s,t,n);ea.assign(l),e.hasGeometryAttribute("tangent")&&r0.assign(c)}},"void"),hye=Ae(([i,e=null],t)=>{let n=t0(new Al(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(nu).toVar(),r=t0(new Al(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(nu).toVar(),s=t0(new Al(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(nu).toVar(),o=Ht(i.bindMatrix,"mat4"),a=Ht(i.bindMatrixInverse,"mat4"),l=O1(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(xb(({frameId:f})=>{if(EM.get(c)!==f){EM.set(c,f);let p=MM.get(c);p!==void 0&&p.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=pJ(i,o,a,r,s);Im.assign(f)}let u=fU(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:p}=dJ(l,ea,r0,o,a,r,s);ea.assign(f),t.hasGeometryAttribute("tangent")&&r0.assign(p)}return u}),dF=class extends $t{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let a=0,l=this.params.length-1;a<l;a++){let c=this.params[a],u=c.isNode!==!0&&c.name||this.getVarName(a),f=c.isNode!==!0&&c.type||"int";n[u]=Cl(u,f)}let r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;let o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){let a=Ae(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){let l=n[o],c=!1,u=null,f=null,p=null,x=null,v=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,x="bool",f=l.build(e,x)):(x="int",p=this.getVarName(o),u="0",f=l.build(e,x),v="<"):(x=l.type||"int",p=l.name||this.getVarName(o),u=l.start,f=l.end,v=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(x,u):u&&u.isNode&&(u=u.build(e,x)),typeof f=="number"?f=e.generateConst(x,f):f&&f.isNode&&(f=f.build(e,x)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",v=">="):f!==void 0&&u===void 0&&(u="0",v="<"),v===void 0&&(Number(u)>Number(f)?v=">=":v="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},P=T.start,R=T.end,C,L=()=>v.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":C=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":C=p+" "+L()+" "+e.generateConst(x,w);break;case"string":C=p+" "+w;break;default:w.isNode?C=p+" "+L()+" "+w.build(e):(Ge("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),C="break /* invalid update */")}else x==="int"||x==="uint"?w=v.includes("<")?"++":"--":w=L()+" 1.",C=p+" "+w;let D=e.getVar(x,p)+" = "+P,F=p+" "+v+" "+R;S=`for ( ${D}; ${F}; ${C} )`}e.addFlowCode((o===0?`41524152 `:"")+e.tab+S+` {41534153 41544154 `).addFlowTab()}let s=r.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode(`41554155 `+e.tab+s);for(let o=0,a=this.params.length-1;o<a;o++)e.addFlowCode((o===0?"":e.tab)+`}41564156 4157-`).removeFlowTab();e.addFlowTab()}},Ci=(...i)=>new fF(xm(i,"int")).toStack(),cye=()=>Cl("continue").toStack(),pJ=()=>Cl("break").toStack(),q6=new WeakMap,bl=new gn,cY=new WeakMap,uY=Ae(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=fe($Z).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return Qr(i,vr(l,a)).depth(r).xyz.mul(e)});function uye(i){let e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0,o=q6.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),q6.delete(i),i.removeEventListener("dispose",T)};o!==void 0&&o.texture.dispose();let a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],c=i.morphAttributes.color||[],u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let f=i.attributes.position.count*u,p=1,x=4096;f>x&&(p=Math.ceil(f/x),f=x);let v=new Float32Array(f*p*4*s),w=new AA(v,f,p,s);w.type=Yi,w.needsUpdate=!0;let S=u*4;for(let P=0;P<s;P++){let R=a[P],C=l[P],L=c[P],D=f*p*4*P;for(let F=0;F<R.count;F++){let N=F*S;e===!0&&(bl.fromBufferAttribute(R,F),v[D+N+0]=bl.x,v[D+N+1]=bl.y,v[D+N+2]=bl.z,v[D+N+3]=0),t===!0&&(bl.fromBufferAttribute(C,F),v[D+N+4]=bl.x,v[D+N+5]=bl.y,v[D+N+6]=bl.z,v[D+N+7]=0),n===!0&&(bl.fromBufferAttribute(L,F),v[D+N+8]=bl.x,v[D+N+9]=bl.y,v[D+N+10]=bl.z,v[D+N+11]=L.itemSize===4?bl.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,p)},q6.set(i,o),i.addEventListener("dispose",T)}return o}var AJ=Ae(([i])=>{let{geometry:e}=i,t=e.morphAttributes.position!==void 0,n=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=r!==void 0?r.length:0;if(s===0)return;let o=cY.get(i);(o===void 0||o.count!==s)&&(o={base:Ht(1),influences:i.morphTargetInfluences?wo(i.morphTargetInfluences,"float"):null,count:s},cY.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=uye(e);t===!0&&hr.mulAssign(a),n===!0&&Jo.mulAssign(a);let p=fe(f.width);Ci(s,({i:x})=>{let v=se(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?v.assign(Qr(i.morphTexture,vr(fe(x).add(1),fe(nu))).r):v.assign(l.element(x).toVar()),Wt(v.notEqual(0),()=>{t===!0&&hr.addAssign(uY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(0)})),n===!0&&Jo.addAssign(uY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(1)}))})}),xb(({object:x})=>{let{base:v,influences:w}=o;x.geometry.morphTargetsRelative?v.value=1:v.value=1-x.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=x.morphTargetInfluences,w.update())})},"void"),s0=class extends $t{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},dF=class extends s0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},pF=class extends Jv{static get type(){return"LightingContextNode"}constructor(e,t=null,n=[],r=null,s=null){super(e),this.lightingModel=t,this.materialLightings=n,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:n}=this,r=pe().toVar("directDiffuse"),s=pe().toVar("directSpecular"),o=pe().toVar("indirectDiffuse"),a=pe().toVar("indirectSpecular"),l={directDiffuse:r,directSpecular:s,indirectDiffuse:o,indirectSpecular:a};return{radiance:pe().toVar("radiance"),irradiance:pe().toVar("irradiance"),iblIrradiance:pe().toVar("iblIrradiance"),ambientOcclusion:se(1).toVar("ambientOcclusion"),reflectedLight:l,materialLightings:e,backdrop:t,backdropAlpha:n}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},mJ=Vn(pF),AF=class extends s0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},om=new Oe,R1=class extends Ac{static get type(){return"ViewportTextureNode"}constructor(e=tu,t=null,n=null){let r=null;n===null?(r=new xA,r.minFilter=go,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=_n.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;s===null?t.getDrawingBufferSize(om):s.getDrawingBufferSize?s.getDrawingBufferSize(om):om.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==om.width||o.image.height!==om.height)&&(o.image.width=om.width,o.image.height=om.height,o.needsUpdate=!0);let a=o.generateMipmaps;o.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(o),o.generateMipmaps=a}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},hye=Vn(R1).setParameterLength(0,3),fU=Vn(R1,null,null,{generateMipmaps:!0}).setParameterLength(0,3),fye=fU(),gJ=(i=tu,e=null)=>fye.sample(i,e),H6=null,mF=class extends R1{static get type(){return"ViewportDepthTextureNode"}constructor(e=tu,t=null,n=null){n===null&&(H6===null&&(H6=new ss),n=H6),super(e,t,n)}},dU=Vn(mF).setParameterLength(0,3),su=class i extends $t{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===i.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,n=this.valueNode,r=null;if(t===i.DEPTH_BASE)n!==null&&(r=yJ().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=pU(Jr.z,$p,Yp):r=wm(Jr.z,$p,Yp);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=GC(n,$p,Yp);r=wm(s,$p,Yp)}else r=n;else r=wm(Jr.z,$p,Yp);return r}};su.DEPTH_BASE="depthBase";su.DEPTH="depth";su.LINEAR_DEPTH="linearDepth";var wm=(i,e,t)=>i.add(e).div(e.sub(t)),dye=(i,e,t)=>i.add(t).div(t.sub(e)),_J=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),pU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),xJ=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),GC=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),zC=(i,e,t)=>{e=e.max(1e-6).toVar();let n=wh(i.negate().div(e)),r=wh(t.div(e));return n.div(r)},pye=(i,e,t)=>{let n=i.mul(PC(t.div(e)));return se(Math.E).pow(n).mul(e).negate()},yJ=Vn(su,su.DEPTH_BASE),AU=xt(su,su.DEPTH),CM=Vn(su,su.LINEAR_DEPTH).setParameterLength(0,1),Aye=CM(dU());AU.assign=i=>yJ(i);var Ph=class i extends $t{static get type(){return"ClippingNode"}constructor(e=i.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===i.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===i.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return Ae(()=>{let n=se().toVar("distanceToPlane"),r=se().toVar("distanceToGradient"),s=se(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=wo(t).setGroup(Kt);Ci(o,({i:c})=>{let u=l.element(c);n.assign(Jr.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(Nl(r.negate(),r,n))})}let a=e.length;if(a>0){let l=wo(e).setGroup(Kt),c=se(1).toVar("intersectionClipOpacity");Ci(a,({i:u})=>{let f=l.element(u);n.assign(Jr.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(Nl(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Mi.a.mulAssign(s),Mi.a.equal(0).discard()})()}setupDefault(e,t){return Ae(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=wo(t).setGroup(Kt);Ci(n,({i:o})=>{let a=s.element(o);Jr.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=wo(e).setGroup(Kt),o=Pl(!0).toVar("clipped");Ci(r,({i:a})=>{let l=s.element(a);o.assign(Jr.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),Ae(()=>{let r=wo(e).setGroup(Kt),s=Jf(t.getClipDistance());Ci(n,({i:o})=>{let a=r.element(o),l=Jr.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Ph.ALPHA_TO_COVERAGE="alphaToCoverage";Ph.DEFAULT="default";Ph.HARDWARE="hardware";var mye=()=>new Ph,gye=()=>new Ph(Ph.ALPHA_TO_COVERAGE),_ye=()=>new Ph(Ph.HARDWARE),xye=.05,hY=Ae(([i])=>iu(bn(1e4,wa(bn(17,i.x).add(bn(.1,i.y)))).mul(cs(.1,Qi(wa(bn(13,i.y).add(i.x))))))),fY=Ae(([i])=>hY(ft(hY(i.xy),i.z))),yye=Ae(([i])=>{let e=br(Th(C7(i.xyz)),Th(R7(i.xyz))),t=se(1).div(se(xye).mul(e)).toVar("pixScale"),n=ft(E1(Sh(wh(t))),E1(IC(wh(t)))),r=ft(fY(Sh(n.x.mul(i.xyz))),fY(Sh(n.y.mul(i.xyz)))),s=iu(wh(t)),o=cs(bn(s.oneMinus(),r.x),bn(s,r.y)),a=Za(s,s.oneMinus()),l=pe(o.mul(o).div(bn(2,a).mul(ni(1,a))),o.sub(bn(.5,a)).div(ni(1,a)),ni(1,ni(1,o).mul(ni(1,o)).div(bn(2,a).mul(ni(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return ru(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),gF=class extends bM{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new gn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},vJ=(i=0)=>new gF(i),pr=class extends bs{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(F1(t.slice(0,-4)),n.getCacheKey());return this.type+gb(e)}build(e){this.setup(e)}setupObserver(e){return new x8(e)}setup(e){e.context.setupNormal=()=>bm(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();e.addStack();let r=this.setupVertex(e),s=bm(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o,a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);let c=Lt(l,Mi.a).max(0);o=this.setupOutput(e,c),y1.assign(o);let u=this.outputNode!==null;if(u&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){let f=t.getMRT(),p=this.mrtNode;f!==null?(u&&y1.assign(o),o=f,p!==null&&(o=f.merge(p))):p!==null&&(o=p)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=l.convert(e.getOutputType())),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=gye():e.stack.addToStack(mye())}return r}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(_ye()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=zC(Jr.z,$p,Yp):r=wm(Jr.z,$p,Yp))}r!==null&&AU.assign(r).toStack()}setupPositionView(){return Rh.mul(hr).xyz}setupModelViewProjection(){return Ta.mul(Jr)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),sJ}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&AJ(t),t.isSkinnedMesh===!0&&dJ(t),this.displacementMap){let r=Wf("displacementMap","texture"),s=Wf("displacementScale","float"),o=Wf("displacementBias","float");hr.addAssign(Jo.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&uJ(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&cJ(t),this.positionNode!==null&&hr.assign(bm(this.positionNode,"POSITION","vec3")),hr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&Pl(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):LQ;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(vJ())),t.instanceColor&&(r=cU.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=uU.mul(r)),Mi.assign(r);let s=this.opacityNode?se(this.opacityNode):iU;Mi.a.assign(Mi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?se(this.alphaTestNode):NQ,this.alphaToCoverage===!0?(Mi.a=Nl(o,o.add(I7(Mi.a)),Mi.a),Mi.a.lessThanEqual(0).discard()):Mi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Mi.a.lessThan(yye(hr)).discard(),e.isOpaque()&&Mi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Mi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):GQ}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Wf("envMap","cubeTexture"):Wf("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new AF(lU)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);return r&&r.isLightingNode&&t.push(r),e.context.ambientOcclusion&&t.push(new dF(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=rJ),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(P8.assign(t),e.context.ambientOcclusion=P8)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,o=this.lights===!0||this.lightsNode!==null,a=this.lights===!0?this.setupMaterialLightings(e):[],l=o?this.lightsNode||e.lightsNode:null,c=this.setupOutgoingLight(e);if(l&&(a.length>0||l.getScope().hasLights)){let u=this.setupLightingModel(e)||null;c=mJ(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?jn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(R8.assign(pe(s||FQ)),c=c.add(R8)),c}setupFog(e,t){let n=e.fogNode;return n&&(y1.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return H7(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=bs.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},vye=new kc,_F=class extends pr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(vye),this.setValues(e)}},bye=new ky,xF=class extends pr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(bye),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?se(this.offsetNode):aU,t=this.dashScaleNode?se(this.dashScaleNode):rU,n=this.dashSizeNode?se(this.dashSizeNode):sU,r=this.gapSizeNode?se(this.gapSizeNode):oU;vm.assign(n),Qv.assign(r);let s=a0(Rl("lineDistance").mul(t));(e?s.add(e):s).mod(vm.add(Qv)).greaterThan(vm).discard()}};var oM=Bm("vec3","worldStart"),yF=Bm("vec3","worldEnd"),bJ=Bm("float","lineDistance"),fm=Bm("vec4","worldPos"),dY=Ae(({start:i,end:e})=>{let t=Ta.element(2).element(2),n=Ta.element(3).element(2);return t.greaterThan(0).select(n.negate().div(t.add(1)),n.mul(-.5).div(t)).sub(i.z).div(e.z.sub(i.z))},{start:"vec4",end:"vec4",return:"float"}),wye=Ae(({p1:i,p2:e,p3:t,p4:n})=>{let r=i.sub(t),s=n.sub(t),o=e.sub(i),a=r.dot(s),l=s.dot(o),c=r.dot(o),u=s.dot(s),p=o.dot(o).mul(u).sub(l.mul(l)),v=a.mul(l).sub(c.mul(u)).div(p).clamp(),w=a.add(l.mul(v)).div(u).clamp();return ft(v,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),oJe=Ae(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=Rl("instanceStart"),r=Rl("instanceEnd"),s=Lt(Rh.mul(Lt(n,1))).toVar("start"),o=Lt(Rh.mul(Lt(r,1))).toVar("end"),a,l;e&&(a=se(Rl("instanceDistanceStart")).toVar("distanceStart"),l=se(Rl("instanceDistanceEnd")).toVar("distanceEnd")),t&&(oM.assign(s.xyz),yF.assign(o.xyz));let c=S1.z.div(S1.w),u=Ta.element(2).element(3).equal(-1);if(Wt(u,()=>{Wt(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=dY({start:s,end:o});o.assign(Lt(jn(s.xyz,o.xyz,T),o.w)),e&&l.assign(jn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=dY({start:o,end:s});s.assign(Lt(jn(o.xyz,s.xyz,T),s.w)),e&&a.assign(jn(l,a,T))})}),e){let T=i.dashScaleNode?se(i.dashScaleNode):rU,P=i.offsetNode?se(i.offsetNode):aU,R=$o.y.lessThan(.5).select(T.mul(a),T.mul(l));R=R.add(P),bJ.assign(R)}let f=Ta.mul(s),p=Ta.mul(o),x=f.xyz.div(f.w),v=p.xyz.div(p.w),w=v.xy.sub(x.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Lt().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),P=jn(s.xyz,o.xyz,.5).normalize(),R=T.cross(P).normalize(),C=T.cross(R);fm.assign($o.y.lessThan(.5).select(s,o));let L=TM.mul(.5);fm.addAssign(Lt($o.x.lessThan(0).select(R.mul(L),R.mul(L).negate()),0)),e||(fm.addAssign(Lt($o.y.lessThan(.5).select(T.mul(L).negate(),T.mul(L)),0)),fm.addAssign(Lt(C.mul(L),0)),Wt($o.y.greaterThan(1).or($o.y.lessThan(0)),()=>{fm.subAssign(Lt(C.mul(2).mul(L),0))})),S.assign(Ta.mul(fm));let D=pe().toVar();D.assign($o.y.lessThan(.5).select(x,v)),S.z.assign(D.z.mul(S.w))}else{let T=ft(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign($o.x.lessThan(0).select(T.negate(),T)),Wt($o.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf($o.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(TM)),T.assign(T.div(S1.w.div($7))),S.assign($o.y.lessThan(.5).select(f,p)),T.assign(T.mul(S.w)),S.assign(S.add(Lt(T,0,0)))}return S})(),aJe=Ae(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ri();if(n){let a=i.dashSizeNode?se(i.dashSizeNode):sU,l=i.gapSizeNode?se(i.gapSizeNode):oU;vm.assign(a),Qv.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),bJ.mod(vm.add(Qv)).greaterThan(vm).discard()}let o=se(1).toVar("alpha");if(r){let a=fm.xyz.normalize().mul(1e5),l=yF.sub(oM),c=wye({p1:oM,p2:yF,p3:pe(0,0,0),p4:a}),u=oM.add(l.mul(c.x)),f=a.mul(c.y),v=u.sub(f).length().div(TM);if(!n)if(t&&e.currentSamples>0){let w=v.fwidth();o.assign(Nl(w.negate().add(.5),w.add(.5),v).oneMinus())}else v.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),c=a.mul(a).add(l.mul(l)),u=se(c.fwidth()).toVar("dlen");Wt(s.y.abs().greaterThan(1),()=>{o.assign(Nl(u.oneMinus(),u.add(1),c).oneMinus())})}else Wt(s.y.abs().greaterThan(1),()=>{let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));a.mul(a).add(l.mul(l)).greaterThan(1).discard()});return o})();var Sye=new By,vF=class extends pr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Sye),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?se(this.opacityNode):iU;Mi.assign(LC(Lt(tU(oi),e),Wr))}},mU=Ae(([i=K7])=>{let e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return ft(e,t)}),bF=Ae(([i=Ri()])=>{let e=i.x.sub(.5).mul(Math.PI*2),t=i.y.sub(.5).mul(Math.PI),n=t.cos(),r=n.mul(e.cos()),s=t.sin(),o=n.mul(e.sin());return pe(r,s,o)}),RM=class extends la{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Uu(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Gc(5,5,5),o=mU(K7),a=new pr;a.colorNode=ai(t,o,0),a.side=ui,a.blending=Xr;let l=new Hn(s,a),c=new Hd;c.add(l),t.minFilter===go&&(t.minFilter=vi);let u=new y_(1,10,this),f=e.getMRT();return e.setMRT(null),u.update(e,c),e.setMRT(f),t.minFilter=n,t.generateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},jv=new WeakMap,wF=class extends dr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Sa(null);let t=new Uu;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=_n.RENDER}updateBefore(e){let{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){let o=s.mapping;if(o===ep||o===tp){if(jv.has(s)){let a=jv.get(s);pY(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(Tye(a)){let l=new RM(a.height);l.fromEquirectangularTexture(t,s),pY(l.texture,s.mapping),this._cubeTexture=l.texture,jv.set(s,l.texture),s.addEventListener("dispose",wJ)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function Tye(i){return i==null?!1:i.height>0}function wJ(i){let e=i.target;e.removeEventListener("dispose",wJ);let t=jv.get(e);t!==void 0&&(jv.delete(e),t.dispose())}function pY(i,e){e===ep?i.mapping=gl:e===tp&&(i.mapping=Ql)}var SJ=Vn(wF).setParameterLength(1),nb=class extends s0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=SJ(this.envNode)}},SF=class extends s0{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=se(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},P1=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},PM=class extends P1{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Lt(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Lt(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Mi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case RA:r.rgb.assign(jn(r.rgb,r.rgb.mul(s.rgb),Wv.mul(sM)));break;case qT:r.rgb.assign(jn(r.rgb,s.rgb,Wv.mul(sM)));break;case HT:r.rgb.addAssign(s.rgb.mul(Wv.mul(sM)));break;default:je("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},Eye=new Us,TF=class extends pr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Eye),this.setValues(e)}setupNormal(){return km(M1)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new SF(lU)),t}setupOutgoingLight(){return Mi.rgb}setupLightingModel(){return new PM}},I1=Ae(({f0:i,f90:e,dotVH:t})=>{let n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),Im=Ae(i=>i.diffuseColor.mul(1/Math.PI)),Mye=()=>se(.25),Cye=Ae(({dotNH:i})=>AM.mul(se(.5)).add(1).mul(se(1/Math.PI)).mul(i.pow(AM))),Rye=Ae(({lightDirection:i})=>{let e=i.add(zi).normalize(),t=oi.dot(e).clamp(),n=zi.dot(e).clamp(),r=I1({f0:i0,f90:1,dotVH:n}),s=Mye(),o=Cye({dotNH:t});return r.mul(s).mul(o)}),IM=class extends PM{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=oi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(Im({diffuseColor:Mi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(Rye({lightDirection:e})).mul(Wv))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Im({diffuseColor:Mi}))),r.indirectDiffuse.mulAssign(t)}},Pye=new pa,EF=class extends pr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Pye),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightingModel(){return new IM(!1)}},Iye=new SA,MF=class extends pr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(Iye),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightingModel(){return new IM}setupVariants(){let e=(this.shininessNode?se(this.shininessNode):DQ).max(1e-4);AM.assign(e);let t=this.specularNode||OQ;i0.assign(t)}},TJ=Ae(i=>{if(i.geometry.hasAttribute("normal")===!1)return se(0);let e=M1.dFdx().abs().max(M1.dFdy().abs());return e.x.max(e.y).max(e.z)}),gU=Ae(i=>{let{roughness:e}=i,t=TJ(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),EJ=Ae(({alpha:i,dotNL:e,dotNV:t})=>{let n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return Il(.5,r.add(s).max(RC))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),Nye=Ae(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{let l=a.mul(pe(i.mul(t),e.mul(n),o).length()),c=o.mul(pe(i.mul(r),e.mul(s),a).length());return Il(.5,l.add(c).max(RC))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),MJ=Ae(({alpha:i,dotNH:e})=>{let t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),Lye=se(1/Math.PI),Dye=Ae(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{let s=i.mul(e),o=pe(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return Lye.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),_U=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=oi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(zi).normalize(),u=s.dot(i).clamp(),f=s.dot(zi).clamp(),p=s.dot(c).clamp(),x=zi.dot(c).clamp(),v=I1({f0:e,f90:t,dotVH:x}),w,S;if(T1(o)&&(v=EC.mix(v,r)),T1(a)){let T=qv.dot(i),P=qv.dot(zi),R=qv.dot(c),C=ym.dot(i),L=ym.dot(zi),D=ym.dot(c);w=Nye({alphaT:pM,alphaB:l,dotTV:P,dotBV:L,dotTL:T,dotBL:C,dotNV:f,dotNL:u}),S=Dye({alphaT:pM,alphaB:l,dotNH:p,dotTH:R,dotBH:D})}else w=EJ({alpha:l,dotNL:u,dotNV:f}),S=MJ({alpha:l,dotNH:p});return v.mul(w).mul(S)}),Fye=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Ah=null,ib=Ae(({roughness:i,dotNV:e})=>{Ah===null&&(Ah=new _A(Fye,16,16,ws,Li),Ah.name="DFG_LUT",Ah.minFilter=vi,Ah.magFilter=vi,Ah.wrapS=Uo,Ah.wrapT=Uo,Ah.generateMipmaps=!1,Ah.needsUpdate=!0);let t=ft(i,e);return ai(Ah,t).rg}),Oye=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=_U({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=oi.dot(i).clamp(),c=oi.dot(zi).clamp(),u=ib({roughness:n,dotNV:c}),f=ib({roughness:n,dotNV:l}),p=e.mul(u.x).add(t.mul(u.y)),x=e.mul(f.x).add(t.mul(f.y)),v=u.x.add(u.y),w=f.x.add(f.y),S=se(1).sub(v),T=se(1).sub(w),P=e.add(e.oneMinus().mul(.047619)),R=p.mul(x).mul(P).div(se(1).sub(S.mul(T).mul(P).mul(P)).add(RC)),C=S.mul(T),L=R.mul(C);return a.add(L)}),CJ=Ae(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=ib({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),CF=Ae(({f:i,f90:e,dotVH:t})=>{let n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(pe(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),Bye=Ae(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=se(1).div(t),s=e.pow2().oneMinus().max(.0078125);return se(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),Uye=Ae(({dotNV:i,dotNL:e})=>se(1).div(se(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),kye=Ae(({lightDirection:i})=>{let e=i.add(zi).normalize(),t=oi.dot(i).clamp(),n=oi.dot(zi).clamp(),r=oi.dot(e).clamp(),s=Bye({roughness:Xp,dotNH:r}),o=Uye({dotNV:n,dotNL:t});return El.mul(s).mul(o)}),AY=Ae(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=ft(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),Gye=Ae(({f:i})=>{let e=i.length();return br(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),ME=Ae(({v1:i,v2:e})=>{let t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,br(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),W6=Ae(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{let l=s.sub(r).toVar(),c=a.sub(r).toVar(),u=l.cross(c),f=pe().toVar();return Wt(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let p=e.sub(i.mul(e.dot(i))).normalize(),x=i.cross(p).negate(),v=n.mul(io(p,x,i).transpose()).toVar(),w=v.mul(r.sub(t)).normalize().toVar(),S=v.mul(s.sub(t)).normalize().toVar(),T=v.mul(o.sub(t)).normalize().toVar(),P=v.mul(a.sub(t)).normalize().toVar(),R=pe(0).toVar();R.addAssign(ME({v1:w,v2:S})),R.addAssign(ME({v1:S,v2:T})),R.addAssign(ME({v1:T,v2:P})),R.addAssign(ME({v1:P,v2:w})),f.assign(pe(Gye({f:R})))}),f}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]});var VC=1/6,RJ=i=>bn(VC,bn(i,bn(i,i.negate().add(3)).sub(3)).add(1)),RF=i=>bn(VC,bn(i,bn(i,bn(3,i).sub(6))).add(4)),PJ=i=>bn(VC,bn(i,bn(i,bn(-3,i).add(3)).add(3)).add(1)),PF=i=>bn(VC,uc(i,3)),mY=i=>RJ(i).add(RF(i)),gY=i=>PJ(i).add(PF(i)),_Y=i=>cs(-1,RF(i).div(RJ(i).add(RF(i)))),xY=i=>cs(1,PF(i).div(PJ(i).add(PF(i)))),yY=(i,e,t)=>{let n=i.uvNode,r=bn(n,e.zw).add(.5),s=Sh(r),o=iu(r),a=mY(o.x),l=gY(o.x),c=_Y(o.x),u=xY(o.x),f=_Y(o.y),p=xY(o.y),x=ft(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),v=ft(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=ft(s.x.add(c),s.y.add(p)).sub(.5).mul(e.xy),S=ft(s.x.add(u),s.y.add(p)).sub(.5).mul(e.xy),T=mY(o.y).mul(cs(a.mul(i.sample(x).level(t)),l.mul(i.sample(v).level(t)))),P=gY(o.y).mul(cs(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(P)},xU=Ae(([i,e])=>{let t=ft(i.size(fe(e))),n=ft(i.size(fe(e.add(1)))),r=Il(1,t),s=Il(1,n),o=yY(i,Lt(r,t),Sh(e)),a=yY(i,Lt(s,n),IC(e));return iu(e).mix(o,a)}),zye=Ae(([i,e])=>{let t=e.mul(j7(i));return xU(i,t)}),vY=Ae(([i,e,t,n,r])=>{let s=pe(F7(e.negate(),Zo(i),Il(1,n))),o=pe(Th(r[0].xyz),Th(r[1].xyz),Th(r[2].xyz));return Zo(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),Vye=Ae(([i,e])=>i.mul(ru(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),qye=fU(),Hye=gJ(),bY=Ae(([i,e,t],{material:n})=>{let s=(n.side===ui?qye:Hye).sample(i),o=wh(Rm.x).mul(Vye(e,t));return xU(s,o)}),wY=Ae(([i,e,t])=>(Wt(t.notEqual(0),()=>{let n=PC(e).negate().div(t);return b7(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Wye=Ae(([i,e,t,n,r,s,o,a,l,c,u,f,p,x,v])=>{let w,S;if(v){w=Lt().toVar(),S=pe().toVar();let L=u.sub(1).mul(v.mul(.025)),D=pe(u.sub(L),u,u.add(L));Ci({start:0,end:3},({i:F})=>{let N=D.element(F),B=vY(i,e,f,N,a),z=o.add(B),V=c.mul(l.mul(Lt(z,1))),H=ft(V.xy.div(V.w)).toVar();H.addAssign(1),H.divAssign(2),H.assign(ft(H.x,H.y.oneMinus()));let K=bY(H,t,N);w.element(F).assign(K.element(F)),w.a.addAssign(K.a),S.element(F).assign(n.element(F).mul(wY(Th(B),p,x).element(F)))}),w.a.divAssign(3)}else{let L=vY(i,e,f,u,a),D=o.add(L),F=c.mul(l.mul(Lt(D,1))),N=ft(F.xy.div(F.w)).toVar();N.addAssign(1),N.divAssign(2),N.assign(ft(N.x,N.y.oneMinus())),w=bY(N,t,u),S=n.mul(wY(Th(L),p,x))}let T=S.rgb.mul(w.rgb),P=i.dot(e).clamp(),R=pe(CJ({dotNV:P,specularColor:r,specularF90:s,roughness:t})),C=S.r.add(S.g,S.b).div(3);return Lt(R.oneMinus().mul(T),w.a.oneMinus().mul(C).oneMinus())}),jye=io(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Xye=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},SY=(i,e)=>i.sub(e).div(i.add(e)).pow2(),$ye=(i,e)=>{let t=i.mul(2*Math.PI*1e-9),n=pe(54856e-17,44201e-17,52481e-17),r=pe(1681e3,1795300,2208400),s=pe(43278e5,93046e5,66121e5),o=se(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp()),a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=pe(a.x.add(o),a.y,a.z).div(10685e-11),jye.mul(a)},TY=Ae(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=jn(i,e,Nl(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Wt(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=SY(s,i),u=I1({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),p=s.lessThan(i).select(Math.PI,0),x=se(Math.PI).sub(p),v=Xye(r.clamp(0,.9999)),w=SY(v,s.toVec3()),S=I1({f0:w,f90:1,dotVH:l}),T=pe(v.x.lessThan(s).select(Math.PI,0),v.y.lessThan(s).select(Math.PI,0),v.z.lessThan(s).select(Math.PI,0)),P=s.mul(n,l,2),R=pe(x).add(T),C=u.mul(S).clamp(1e-5,.9999),L=C.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(C)),N=u.add(D).toVar(),B=D.sub(f).toVar();return Ci({start:1,end:2,condition:"<=",name:"m"},({m:z})=>{B.mulAssign(L);let V=$ye(se(z).mul(P),se(z).mul(R)).mul(2);N.addAssign(B.mul(V))}),N.max(pe(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),wv=Ae(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=se(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=se(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),Sv=pe(.04),CE=se(1),NM=class extends P1{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=pe().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pe().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pe().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=pe().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pe().toVar("sheenSpecularIndirect")),this.iridescence===!0){let t=oi.dot(zi).clamp(),n=TY({outsideIOR:se(1),eta2:fM,cosTheta1:t,thinFilmThickness:dM,baseF0:i0}),r=TY({outsideIOR:se(1),eta2:fM,cosTheta1:t,thinFilmThickness:dM,baseF0:Mi.rgb});this.iridescenceFresnel=jn(n,r,Xf),this.iridescenceF0Dielectric=CF({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=CF({f:r,f90:1,dotVH:t}),this.iridescenceF0=jn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Xf)}if(this.transmission===!0){let t=Eh,n=oQ.sub(Eh).normalize(),r=u0,s=e.context;s.backdrop=Wye(r,n,vh,dm,Am,mm,t,hc,c0,Ta,Hv,g7,x7,_7,this.dispersion?y7:null),s.backdropAlpha=mM,Mi.a.mulAssign(jn(1,s.backdrop.a,mM))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=oi.dot(zi).clamp(),a=ib({roughness:vh,dotNV:o}),l=s?EC.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),p=l.add(l.oneMinus().mul(.047619)),x=c.mul(p).div(f.mul(p).oneMinus());e.addAssign(c),t.addAssign(x.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=oi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(kye({lightDirection:e})));let o=wv({normal:oi,viewDir:zi,roughness:Xp}),a=wv({normal:oi,viewDir:e,roughness:Xp}),l=El.r.max(El.g).max(El.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=Kp.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(_U({lightDirection:e,f0:Sv,f90:CE,roughness:x1,normalView:Kp})))}n.directDiffuse.addAssign(s.mul(Im({diffuseColor:dm}))),n.directSpecular.addAssign(s.mul(Oye({lightDirection:e,f0:Am,f90:1,roughness:vh,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){let l=t.add(n).sub(r),c=t.sub(n).sub(r),u=t.sub(n).add(r),f=t.add(n).add(r),p=oi,x=zi,v=Jr.toVar(),w=AY({N:p,V:x,roughness:vh}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),P=io(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),R=Am.mul(T.x).add(mm.sub(Am).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(R).mul(W6({N:p,V:x,P:v,mInv:P,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(dm).mul(W6({N:p,V:x,P:v,mInv:io(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let C=Kp,L=AY({N:C,V:x,roughness:x1}),D=o.sample(L),F=a.sample(L),N=io(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Sv.mul(F.x).add(CE.sub(Sv).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(W6({N:C,V:x,P:v,mInv:N,p0:l,p1:c,p2:u,p3:f})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:n}=e.context,r=t.mul(Im({diffuseColor:dm})).toVar();if(this.sheen===!0){let s=wv({normal:oi,viewDir:zi,roughness:Xp}),o=El.r.max(El.g).max(El.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){let{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(El,wv({normal:oi,viewDir:zi,roughness:Xp}))),this.clearcoat===!0){let S=Kp.dot(zi).clamp(),T=CJ({dotNV:S,specularColor:Sv,specularF90:CE,roughness:x1});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(T))}let s=pe().toVar("singleScatteringDielectric"),o=pe().toVar("multiScatteringDielectric"),a=pe().toVar("singleScatteringMetallic"),l=pe().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,mm,i0,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,mm,Mi.rgb,this.iridescenceF0Metallic);let c=jn(s,a,Xf),u=jn(o,l,Xf),f=s.add(o),p=dm.mul(f.oneMinus()),x=n.mul(1/Math.PI),v=t.mul(c).add(u.mul(x)).toVar(),w=p.mul(x).toVar();if(this.sheen===!0){let S=wv({normal:oi,viewDir:zi,roughness:Xp}),T=El.r.max(El.g).max(El.b).mul(S).oneMinus();v.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(v),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=oi.dot(zi).clamp().add(t),o=vh.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let n=Kp.dot(zi).clamp(),r=I1({dotVH:n,f0:Sv,f90:CE}),s=t.mul(hM.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(hM));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},EY=se(1),IF=se(-2),RE=se(.8),j6=se(-1),PE=se(.4),X6=se(2),IE=se(.305),$6=se(3),MY=se(.21),Yye=se(4),CY=se(4),Kye=se(16),Zye=Ae(([i])=>{let e=pe(Qi(i)).toVar(),t=se(-1).toVar();return Wt(e.x.greaterThan(e.z),()=>{Wt(e.x.greaterThan(e.y),()=>{t.assign(Ko(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(Ko(i.y.greaterThan(0),1,4))})}).Else(()=>{Wt(e.z.greaterThan(e.y),()=>{t.assign(Ko(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(Ko(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),Qye=Ae(([i,e])=>{let t=ft().toVar();return Wt(e.equal(0),()=>{t.assign(ft(i.z,i.y).div(Qi(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(ft(i.x.negate(),i.z.negate()).div(Qi(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(ft(i.x.negate(),i.y).div(Qi(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(ft(i.z.negate(),i.y).div(Qi(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(ft(i.x.negate(),i.z).div(Qi(i.y)))}).Else(()=>{t.assign(ft(i.x,i.y).div(Qi(i.z)))}),bn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),Jye=Ae(([i])=>{let e=se(0).toVar();return Wt(i.greaterThanEqual(RE),()=>{e.assign(EY.sub(i).mul(j6.sub(IF)).div(EY.sub(RE)).add(IF))}).ElseIf(i.greaterThanEqual(PE),()=>{e.assign(RE.sub(i).mul(X6.sub(j6)).div(RE.sub(PE)).add(j6))}).ElseIf(i.greaterThanEqual(IE),()=>{e.assign(PE.sub(i).mul($6.sub(X6)).div(PE.sub(IE)).add(X6))}).ElseIf(i.greaterThanEqual(MY),()=>{e.assign(IE.sub(i).mul(Yye.sub($6)).div(IE.sub(MY)).add($6))}).Else(()=>{e.assign(se(-2).mul(wh(bn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),IJ=Ae(([i,e])=>{let t=i.toVar();t.assign(bn(2,t).sub(1));let n=pe(t,1).toVar();return Wt(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),NJ=Ae(([i,e,t,n,r,s])=>{let o=se(t),a=pe(e),l=ru(Jye(o),IF,s),c=iu(l),u=Sh(l),f=pe(rb(i,a,u,n,r,s)).toVar();return Wt(c.notEqual(0),()=>{let p=pe(rb(i,a,u.add(1),n,r,s)).toVar();f.assign(jn(f,p,c))}),f}),rb=Ae(([i,e,t,n,r,s])=>{let o=se(t).toVar(),a=pe(e),l=se(Zye(a)).toVar(),c=se(br(CY.sub(o),0)).toVar();o.assign(br(o,CY));let u=se(E1(o)).toVar(),f=ft(Qye(a,l).mul(u.sub(2)).add(1)).toVar();return Wt(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(bn(3,Kye))),f.y.addAssign(bn(4,E1(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(ft(),ft())}),Y6=Ae(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=Jc(n),c=t.mul(l).add(r.cross(t).mul(wa(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return rb(i,c,e,s,o,a)}),LJ=Ae(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})=>{let p=pe(Ko(e,t,Yf(t,n))).toVar();Wt(p.equal(pe(0)),()=>{p.assign(pe(n.z,0,n.x.negate()))}),p.assign(Zo(p));let x=pe().toVar();return x.addAssign(r.element(0).mul(Y6({theta:0,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Ci({start:fe(1),end:i},({i:v})=>{Wt(v.greaterThanEqual(s),()=>{pJ()});let w=se(o.mul(se(v))).toVar();x.addAssign(r.element(v).mul(Y6({theta:w.mul(-1),axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),x.addAssign(r.element(v).mul(Y6({theta:w,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Lt(x,1)}),e2e=Ae(([i])=>{let e=it(i).toVar();return e.assign(e.shiftLeft(it(16)).bitOr(e.shiftRight(it(16)))),e.assign(e.bitAnd(it(1431655765)).shiftLeft(it(1)).bitOr(e.bitAnd(it(2863311530)).shiftRight(it(1)))),e.assign(e.bitAnd(it(858993459)).shiftLeft(it(2)).bitOr(e.bitAnd(it(3435973836)).shiftRight(it(2)))),e.assign(e.bitAnd(it(252645135)).shiftLeft(it(4)).bitOr(e.bitAnd(it(4042322160)).shiftRight(it(4)))),e.assign(e.bitAnd(it(16711935)).shiftLeft(it(8)).bitOr(e.bitAnd(it(4278255360)).shiftRight(it(8)))),se(e).mul(23283064365386963e-26)}),t2e=Ae(([i,e])=>ft(se(i).div(se(e)),e2e(i))),n2e=Ae(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=Yf(e,r).toConst(),o=Ea(i.x).toConst(),a=bn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Jc(a)).toConst(),c=o.mul(wa(a)).toVar(),u=bn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ea(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ea(br(0,l.mul(l).add(c.mul(c)).oneMinus()))));return Zo(pe(n.mul(f.x),n.mul(f.y),br(0,f.z)))}),DJ=Ae(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=pe(n).toVar(),c=pe(0).toVar(),u=se(0).toVar();return Wt(i.lessThan(.001),()=>{c.assign(rb(t,l,e,s,o,a))}).Else(()=>{let f=Ko(Qi(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),p=Zo(Yf(f,l)).toVar(),x=Yf(l,p).toVar();Ci({start:it(0),end:r},({i:v})=>{let w=t2e(v,r),S=n2e(w,pe(0,0,1),i),T=Zo(p.mul(S.x).add(x.mul(S.y)).add(l.mul(S.z))),P=Zo(T.mul(pc(l,T).mul(2)).sub(l)),R=br(pc(l,P),0);Wt(R.greaterThan(0),()=>{let C=rb(t,P,e,s,o,a);c.addAssign(C.mul(R)),u.addAssign(R)})}),Wt(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Lt(c,1)}),Jp=4,RY=[.125,.215,.35,.446,.526,.582],pm=20,i2e=512,Tv=new Vc(-1,1,1,-1,0,1),r2e=new Rr(90,1),PY=new Ut,K6=null,Z6=0,Q6=0,s2e=new ie,LM=new WeakMap,o2e=[3,1,5,0,4,2],J6=IJ(Ri(),Rl("faceIndex")).normalize(),qC=pe(J6.x,J6.y,J6.z),NF=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=s2e,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');K6=this._renderer.getRenderTarget(),Z6=this._renderer.getActiveCubeFace(),Q6=this._renderer.getActiveMipmapLevel();let c=l||this._allocateTarget(!0);return this._init(c),this._sceneToCubeUV(e,n,r,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return Kn('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return Kn('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return Kn('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=NY(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=LY(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===gl||e.mapping===Ql?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(K6,Z6,Q6),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),K6=this._renderer.getRenderTarget(),Z6=this._renderer.getActiveCubeFace(),Q6=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget(!1);return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize;return IY(t,n,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=IY(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=a2e(t)),this._blurMaterial=l2e(t,e.width,e.height),this._ggxMaterial=c2e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Zn,e);await this._renderer.compile(t,Tv)}_sceneToCubeUV(e,t,n,r,s){let o=r2e;o.near=t,o.far=n;let a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],c=this._renderer,u=c.autoClear;c.getClearColor(PY),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Gc,new Us({name:"PMREM.Background",side:ui,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,p=f.material,x=!1,v=e.background;v?v.isColor&&(p.color.copy(v),e.background=null,x=!0):(p.color.copy(PY),x=!0),c.setRenderTarget(r),c.clear(),x&&c.render(f,o);for(let w=0;w<6;w++){let S=w%3;S===0?(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[w],s.y,s.z)):S===1?(o.up.set(0,0,a[w]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[w],s.z)):(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[w]));let T=this._cubeSize;this._setViewport(r,S*T,w>2?T:0,T,T),c.render(e,o)}c.autoClear=u,e.background=v}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===gl||e.mapping===Ql;r?this._cubemapMaterial===null&&(this._cubemapMaterial=NY(e)):this._equirectMaterial===null&&(this._equirectMaterial=LY(e));let s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let o=this._lodMeshes[0];o.material=s;let a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,Tv)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=LM.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),p=0+c*1.25,x=f*p,{_lodMax:v}=this,w=this._sizeLods[n],S=3*w*(n>v-Jp?n-v+Jp:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Tv),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Tv)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Ge("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let p=LM.get(c),x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*pm-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):pm;S>pm&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${pm}`);let T=[],P=0;for(let F=0;F<pm;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?P+=B:F<S&&(P+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/P;e.texture.frame=(e.texture.frame||0)+1,p.envMap.value=e.texture,p.samples.value=S,p.weights.array=T,p.latitudinal.value=o==="latitudinal"?1:0,a&&(p.poleAxis.value=a);let{_lodMax:R}=this;p.dTheta.value=v,p.mipInt.value=R-n;let C=this._sizeLods[r],L=3*C*(r>R-Jp?r-R+Jp:0),D=4*(this._cubeSize-C);this._setViewport(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,Tv)}_setViewport(e,t,n,r,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-n,r,s),e.scissor.set(t,e.height-s-n,r,s)):(e.viewport.set(t,n,r,s),e.scissor.set(t,n,r,s))}};function a2e(i){let e=[],t=[],n=[],r=i,s=i-Jp+1+RY.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Jp?l=RY[o-i+Jp-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],x=6,v=6,w=3,S=2,T=1,P=new Float32Array(w*v*x),R=new Float32Array(S*v*x),C=new Float32Array(T*v*x);for(let D=0;D<x;D++){let F=D%3*2/3-1,N=D>2?0:-1,B=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0],z=o2e[D];P.set(B,w*v*z),R.set(p,S*v*z);let V=[z,z,z,z,z,z];C.set(V,T*v*z)}let L=new Zn;L.setAttribute("position",new Ni(P,w)),L.setAttribute("uv",new Ni(R,S)),L.setAttribute("faceIndex",new Ni(C,T)),n.push(new Hn(L,null)),r>Jp&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function IY(i,e,t){let n={magFilter:vi,minFilter:vi,generateMipmaps:!1,type:Li,format:xr,colorSpace:Gd,depthBuffer:t},r=new la(i,e,n);return r.texture.mapping=Hu,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function HC(i){let e=new pr;return e.depthTest=!1,e.depthWrite=!1,e.blending=Xr,e.name=`PMREM_${i}`,e}function l2e(i,e,t){let n=wo(new Array(pm).fill(0)),r=Ht(new ie(0,1,0)),s=Ht(0),o=se(pm),a=Ht(0),l=Ht(1),c=ai(),u=Ht(0),f=se(1/e),p=se(1/t),x=se(i),v={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:qC,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:x},w=HC("blur");return w.fragmentNode=LJ({...v,latitudinal:a.equal(1)}),LM.set(w,v),w}function c2e(i,e,t){let n=ai(),r=Ht(0),s=Ht(0),o=se(1/e),a=se(1/t),l=se(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=HC("ggx");return u.fragmentNode=DJ({...c,N_immutable:qC,GGX_SAMPLES:it(i2e)}),LM.set(u,c),u}function NY(i){let e=HC("cubemap");return e.fragmentNode=Sa(i,qC),e}function LY(i){let e=HC("equirect");return e.fragmentNode=ai(i,mU(qC),0),e}var DY=new WeakMap;function u2e(i){let e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function h2e(i,e,t){let n=f2e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(d2e(o))r=t.fromCubemap(i,r);else return null;else if(p2e(o))r=t.fromEquirectangular(i,r);else return null;if(r.pmremVersion=i.pmremVersion,n.has(i)===!1){let a=()=>{i.removeEventListener("dispose",a);let l=n.get(i);l!==void 0&&(l.dispose(),n.delete(i))};i.addEventListener("dispose",a)}n.set(i,r)}return r.texture}function f2e(i){let e=DY.get(i);return e===void 0&&(e=new WeakMap,DY.set(i,e)),e}var LF=class extends dr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new vs;r.isRenderTargetTexture=!0,this._texture=ai(r),this._width=Ht(0),this._height=Ht(0),this._maxMip=Ht(0),this.updateBeforeType=_n.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=u2e(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0||r.mapping===Hu?t=r:t=h2e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new NF(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?SM.mul(pe(t.x,t.y.negate(),t.z)):SM.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),NJ(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function d2e(i){if(i==null)return!1;let e=0,t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function p2e(i){return i==null?!1:i.height>0}var yU=Vn(LF).setParameterLength(1,3),FY=new WeakMap,DF=class extends s0{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){let f=n.isTextureNode?n.value:t[n.property],p=this._getPMREMNodeCache(e.renderer),x=p.get(f);x===void 0&&(x=yU(f),p.set(f,x)),n=x}let s=t.useAnisotropy===!0||t.anisotropy>0?PQ:oi,o=n.context(OY(vh,s)).mul(rM),a=n.context(A2e(u0)).mul(Math.PI).mul(rM),l=b1(o),c=b1(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(OY(x1,Kp)).mul(rM),p=b1(f);u.addAssign(p)}}_getPMREMNodeCache(e){let t=FY.get(e);return t===void 0&&(t=new WeakMap,FY.set(e,t)),t}},OY=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=zi.negate().reflect(e),t=L7(i).mix(t,e).normalize(),t=t.transformDirection(_b)),t),getTextureLevel:()=>i}},A2e=i=>({getUV:()=>i,getTextureLevel:()=>se(1)}),m2e=new x_,DM=class extends pr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(m2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new DF(t):null}setupLightingModel(){return new NM}setupSpecular(){let e=jn(pe(.04),Mi.rgb,Xf);i0.assign(pe(.04)),Am.assign(e),mm.assign(1)}setupVariants(){let e=this.metalnessNode?se(this.metalnessNode):kQ;Xf.assign(e);let t=this.roughnessNode?se(this.roughnessNode):UQ;t=gU({roughness:t}),vh.assign(t),this.setupSpecular(),dm.assign(Mi.rgb.mul(e.oneMinus()))}},g2e=new Fy,FF=class extends DM{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(g2e),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?se(this.iorNode):JQ;Hv.assign(e),i0.assign(Za(N7(Hv.sub(1).div(Hv.add(1))).mul(BQ),pe(1)).mul(aF)),Am.assign(jn(i0,Mi.rgb,Xf)),mm.assign(jn(aF,1,Xf))}setupLightingModel(){return new NM(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?se(this.clearcoatNode):zQ,n=this.clearcoatRoughnessNode?se(this.clearcoatRoughnessNode):VQ;hM.assign(t),x1.assign(gU({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):WQ,n=this.sheenRoughnessNode?se(this.sheenRoughnessNode):jQ;El.assign(t),Xp.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?se(this.iridescenceNode):$Q,n=this.iridescenceIORNode?se(this.iridescenceIORNode):YQ,r=this.iridescenceThicknessNode?se(this.iridescenceThicknessNode):KQ;EC.assign(t),fM.assign(n),dM.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?ft(this.anisotropyNode):XQ).toVar();jp.assign(t.length()),Wt(jp.equal(0),()=>{t.assign(ft(1,0))}).Else(()=>{t.divAssign(ft(jp)),jp.assign(jp.saturate())}),pM.assign(jp.pow2().mix(vh.pow2(),1)),qv.assign(gm[0].mul(t.x).add(gm[1].mul(t.y))),ym.assign(gm[1].mul(t.x).sub(gm[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?se(this.transmissionNode):ZQ,n=this.thicknessNode?se(this.thicknessNode):QQ,r=this.attenuationDistanceNode?se(this.attenuationDistanceNode):eJ,s=this.attenuationColorNode?pe(this.attenuationColorNode):tJ;if(mM.assign(t),g7.assign(n),_7.assign(r),x7.assign(s),this.useDispersion){let o=this.dispersionNode?se(this.dispersionNode):iJ;y7.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):qQ}setup(e){e.context.setupClearcoatNormal=()=>bm(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var _2e=Ae(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=ft(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Wf("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return jn(pe(.7),pe(1),Nl(se(.7).sub(s.x),se(.7).add(s.x),r.x))}}),OF=class extends P1{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=_2e({normal:OC,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Im({diffuseColor:Mi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Im({diffuseColor:Mi}))),r.indirectDiffuse.mulAssign(t)}},x2e=new Oy,BF=class extends pr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(x2e),this.setValues(e)}setupLightingModel(){return new OF}},FJ=Ae(()=>{let i=pe(zi.z,0,zi.x.negate()).normalize(),e=zi.cross(i);return ft(i.dot(oi),e.dot(oi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),y2e=new Uy,UF=class extends pr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(y2e),this.setValues(e)}setupVariants(e){let t=FJ,n;e.material.matcap?n=Wf("matcap","texture").context({getUV:()=>t}):n=pe(jn(.2,.8,t.y)),Mi.rgb.mulAssign(n.rgb)}},kF=class extends dr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){let s=t.cos(),o=t.sin();return TC(s,o,o.negate(),s).mul(n)}else{let s=t,o=e0(Lt(1,0,0,0),Lt(0,Jc(s.x),wa(s.x).negate(),0),Lt(0,wa(s.x),Jc(s.x),0),Lt(0,0,0,1)),a=e0(Lt(Jc(s.y),0,wa(s.y),0),Lt(0,1,0,0),Lt(wa(s.y).negate(),0,Jc(s.y),0),Lt(0,0,0,1)),l=e0(Lt(Jc(s.z),wa(s.z).negate(),0,0),Lt(wa(s.z),Jc(s.z),0,0),Lt(0,0,1,0),Lt(0,0,0,1));return o.mul(a).mul(l).mul(Lt(n,1)).xyz}}},yb=Vn(kF).setParameterLength(2),v2e=new Wd,FM=class extends pr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(v2e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Rh.mul(pe(r||0)),c=ft(hc[0].xyz.length(),hc[1].xyz.length());o!==null&&(c=c.mul(ft(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=$o.xy;if(t.center&&t.center.isVector2===!0){let x=cxe("center","vec2",t);u=u.sub(x.sub(.5))}u=u.mul(c);let f=se(s||HQ),p=yb(u,f);return Lt(l.xy.add(p),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},b2e=new Xd,w2e=new Oe,GF=class extends FM{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(b2e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Rh.mul(pe(e||hr)).xyz}setupVertexSprite(e){let{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this,l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let c=o!==null?ft(o):nJ;c=c.mul($7),n.isPerspectiveCamera&&a===!0&&(c=c.mul(S2e.div(Jr.z.negate()))),s&&s.isNode&&(c=c.mul(ft(s)));let u=$o.xy;if(r&&r.isNode){let f=se(r);u=yb(u,f)}return u=u.mul(c),u=u.div(Y7.div(2)),u=u.mul(l.w),l=l.add(Lt(u,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},S2e=Ht(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(w2e);this.value=.5*e.y}),zF=class extends P1{constructor(){super(),this.shadowNode=se(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Mi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Mi.rgb)}},T2e=new Dy,VF=class extends pr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(T2e),this.setValues(e)}setupLightingModel(){return new zF}},lJe=Zf("vec3"),cJe=Zf("vec3"),uJe=Zf("vec3");var qF=class{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Ih=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){let s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},E2e=0,BY=new WeakMap;function M2e(i){let e=Object.keys(i),t=BY.get(i.constructor);if(t===void 0){t=[];let n=Object.getPrototypeOf(i);for(;n;){let r=Object.getOwnPropertyDescriptors(n);for(let s in r){let o=r[s];o&&typeof o.get=="function"&&t.push(s)}n=Object.getPrototypeOf(n)}BY.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var HF=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=E2e++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=c,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=n._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(let o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),a!==void 0&&(a.isInterleavedBufferAttribute?s[o.name]=a.data.uuid:s[o.name]=a.id)),a===void 0)continue;n.push(a);let l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null,c=1;if(n.isInstancedBufferGeometry===!0?c=n.instanceCount:e.count!==void 0&&(c=Math.max(0,e.count)),c===0)return null;if(o.instanceCount=c,e.isBatchedMesh===!0)return o;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let f=s.start*u,p=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),p=Math.min(p,(r.start+r.count)*u));let x=n.attributes.position,v=1/0;l?v=a.count:x!=null&&(v=x.count),f=Math.max(f,0),p=Math.min(p,v);let w=p-f;return w<0||w===1/0?null:(o.vertexCount=w,o.firstVertex=f,o)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let n of Object.keys(e.attributes).sort()){let r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(let n of Object.keys(e.morphAttributes).sort()){let r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){let a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:n}=this,r=t.customProgramCacheKey();for(let s of M2e(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let o=t[s],a;if(o!==null){let l=typeof o;l==="number"?s==="side"?a=String(o):a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",F1(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let n=this.geometry.getAttribute(t);if(n===void 0)return!0;let r=n.isInterleavedBufferAttribute?n.data.uuid:n.id;if(e[t]!==r)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=zv(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=zv(e,1)),e=zv(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}},mh=[],WF=class{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){let c=this.getChainMap(l);mh[0]=e,mh[1]=t,mh[2]=o,mh[3]=s;let u=c.get(mh);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(mh,u)):(u.camera=r,u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,s,o,a,l)):u.version=t.version)),mh[0]=null,mh[1]=null,mh[2]=null,mh[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ih)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let p=this.getChainMap(f),x=new HF(e,t,n,r,s,o,a,l,c,u);return x.onDispose=()=>{this.pipelines.delete(x),this.bindings.deleteForRender(x),this.nodes.delete(x),p.delete(x.getChainArray())},x}},Nh=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},fc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Zp=16,C2e=211,R2e=212,jF=class extends Nh{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let n=this.get(e);if(n.version===void 0)t===fc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===fc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===fc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===fc.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),n.version=this._getBufferAttribute(e).version;else{let r=this._getBufferAttribute(e);(n.version<r.version||r.usage===kA)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function OJ(i){return i.index!==null?i.index.version:i.attributes.position.version}function BJ(i){return i.index!==null?i.index.id:i.attributes.position.id}function UY(i){let e=[],t=i.index,n=i.attributes.position;if(t!==null){let s=t.array;for(let o=0,a=s.length;o<a;o+=3){let l=s[o+0],c=s[o+1],u=s[o+2];e.push(l,c,c,u,u,l)}}else{let s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){let l=o+0,c=o+1,u=o+2;e.push(l,c,c,u,u,l)}}let r=new(n.count>=65535?gA:mA)(e,1);return r.version=OJ(i),r.__id=BJ(i),r}var XF=class extends Nh{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(let l of o)this.attributes.delete(l);let a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,fc.STORAGE):this.updateAttribute(s,fc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,fc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,fc.INDIRECT)}updateAttribute(e,t){let n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:n}=e,r=t.index;if(n.wireframe===!0){let s=this.wireframes,o=s.get(t);o===void 0?(o=UY(t),s.set(t,o)):(o.version!==OJ(t)||o.__id!==BJ(t))&&(this.attributes.delete(o),o=UY(t),s.set(t,o)),r=o}return r}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}},$F=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):Ge("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let n=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:n,type:t}),this.memory[t]++,this.memory.total+=n,this.memory[t+"Size"]+=n}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Wu||e.type===Gi?t=1:e.type===ju||e.type===Ha||e.type===Li?t=2:(e.type===Ir||e.type===pi||e.type===Yi)&&(t=4);let n=4;e.format===S_||e.format===Lf||e.format===Xu||e.format===xs||e.format===Qs?n=1:e.format===ws||e.format===$u?n=2:(e.format===Nf||e.format===m2)&&(n=3);let r=t*n;e.type===PA||e.type===IA?r=2:(e.type===Go||e.type===NA||e.type===LA)&&(r=4);let s=e.width||1,o=e.height||1,a=e.isCubeTexture?6:e.depth||1,l=s*o*a*r,c=e.mipmaps;if(c&&c.length>0){let u=0;for(let f=0;f<c.length;f++){let p=c[f];if(p.data)u+=p.data.byteLength;else{let x=p.width||Math.max(1,s>>f),v=p.height||Math.max(1,o>>f);u+=x*v*a*r}}l+=u}else e.generateMipmaps&&(l=l*1.333);return Math.round(l)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},OM=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},YF=class extends OM{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},KF=class extends OM{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},P2e=0,Xv=class{constructor(e,t,n,r=null,s=null){this.id=P2e++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},ZF=class extends Nh{constructor(e,t,n){super(),this.backend=e,this.nodes=t,this.info=n,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let o=this.nodes.getForCompute(e),a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new Xv(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a),this.info.createProgram(a));let l=this._getComputeCacheKey(e,a),c=this.caches.get(l);c===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),c=this._getComputePipeline(e,a,l,t)),c.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=c}return r.pipeline}getForRender(e,t=null){let{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let o=e.getNodeBuilderState(),a=e.material?e.material.name:"",l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new Xv(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l),this.info.createProgram(l));let c=this.programs.fragment.get(o.fragmentShader);c===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),c=new Xv(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,c),n.createProgram(c),this.info.createProgram(c));let u=this._getRenderCacheKey(e,l,c),f=this.caches.get(u);f===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),f=this._getRenderPipeline(e,l,c,u,t)):e.pipeline=f,f.usedTimes++,l.usedTimes++,c.usedTimes++,r.pipeline=f}return r.pipeline}isReady(e){let n=this.get(e).pipeline;if(n===void 0)return!1;let r=this.backend.get(n);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new KF(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new YF(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,n=e.stage;this.programs[n].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},QF=class extends Nh{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),n=this.get(e);return n.initialized!==!0&&(this._createBindings(t),n.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,n=this.get(e);return(n.initialized!==!0||n.bindings!==t)&&(n.bindings!==void 0&&this._destroyBindings(n.bindings),this._createBindings(t),n.initialized=!0,n.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let n=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(n),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let n=this.get(t);if(n.bindGroup===void 0){for(let r of t.bindings)if(r.isUniformBuffer)this.backend.createUniformBuffer(r),this.info.createUniformBuffer(r);else if(r.isSampledTexture)this.textures.updateTexture(r.texture);else if(r.isSampler)this.textures.updateSampler(r);else if(r.isStorageBuffer){let s=r.attribute,o=s.isIndirectStorageBufferAttribute?fc.INDIRECT:fc.STORAGE;this.attributes.update(s,o)}this.backend.createBindings(t,e,0),n.bindGroup=t,n.usedTimes=1}else n.usedTimes++}}_destroyBindings(e){for(let t of e){let n=this.get(t);if(n.usedTimes--,n.usedTimes===0){for(let r of t.bindings)r.isUniformBuffer?(this.backend.destroyUniformBuffer(r),this.info.destroyUniformBuffer(r),r.release()):r.isSampler&&(r.isSampledTexture!==!0&&this.backend.destroySampler(r),r.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:n}=this,r=!1,s=!0,o=0,a=0;for(let l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){let u=l.attribute,f=u.isIndirectStorageBufferAttribute?fc.INDIRECT:fc.STORAGE,p=n.get(l);this.attributes.update(u,f),p.attribute!==u&&(p.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,p=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==p.generation&&(l.generation=p.generation,r=!0),p.bindGroups.add(e)),n.get(f).externalTexture!==void 0||p.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let v=this.get(f);l.store===!0?v.needsMipmap=!0:this.textures.needsMipmaps(f)&&v.needsMipmap===!0&&(this.backend.generateMipmaps(f),v.needsMipmap=!1)}}else if(l.isSampler&&l.update()){let f=this.textures.updateSampler(l);l.samplerKey!==f&&(l.samplerKey=f,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}},I2e=Object.freeze([]);function N2e(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function kY(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function GY(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===ir&&i.forceSinglePass===!1}var JF=class{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(GY(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(GY(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,n){this.opaque.length>1&&this.opaque.sort(e||N2e),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||kY),this.transparent.length>1&&this.transparent.sort(t||kY),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:I2e);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}this._lastOcclusionObject=null}},t1=[],eO=class{constructor(e){this.lighting=e,this.lists=new Ih}get(e,t){let n=this.lists;t1[0]=e,t1[1]=t;let r=n.get(t1);return r===void 0&&(r=new JF(this.lighting,e,t),n.set(t1,r)),t1[0]=null,t1[1]=null,r}dispose(){this.lists=new Ih}},L2e=0,tO=class{constructor(){this.id=L2e++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new gn,this.scissor=!1,this.scissorValue=new gn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return UJ(this)}};function UJ(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return gb(r)}var nO=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{let l=e.texture.format,c=e.texture.type;r=`${e.textures.length}:${l}:${c}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:"default",o=r+"-"+s+"-"+n,a=this._renderContexts[o];return a===void 0&&(a=new tO,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}},D2e=new ie,iO=class extends Nh{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,c=a.height>>t,u=e.depthTexture||s[t],f=e.depthBuffer===!0||e.stencilBuffer===!0,p=!1,x=u!==void 0&&u.image!==void 0&&u.image.depth>1,v=a.depth>1&&(e.useArrayDepthTexture||e.multiview||x);u===void 0&&f&&(u=new ss,u.format=e.stencilBuffer?Qs:xs,u.type=e.stencilBuffer?Go:pi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=v),(n.width!==a.width||a.height!==n.height)&&(p=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=v?a.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(p=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);let w={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let S=0;S<o.length;S++){let T=o[S];p&&(T.needsUpdate=!0),this.updateTexture(T,w)}u&&this.updateTexture(u,w)}n.initialized!==!0&&(n.initialized=!0,this.info.memory.renderTargets++,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){let n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;let r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let c=this.renderer.getRenderTarget();c?e.type=c.texture.type:e.type=Gi}if(e.isHTMLTexture&&e.image){let c=this.renderer.domElement;if("requestPaint"in c){if(c.hasAttribute("layoutsubtree")||c.setAttribute("layoutsubtree","true"),e.image.parentNode!==c&&c.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;c.onpaint=f=>{let p=f&&f.changedElements;for(let x of u)(!p||p.includes(x.image))&&(x.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){let c=e.image;if(c===void 0)je("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)je("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let p of e.images)f.push(p);t.images=f}else t.image=c;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&sn.enabled===!0&&sn.getTransfer(e.colorSpace)!==Bt&&je("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=D2e){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),e.isHTMLTexture?(t.width=n.offsetWidth||1,t.height=n.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(let r of t.bindGroups){let s=this.backend.get(r);s.groups=void 0,s.versions=void 0;for(let o of r.bindings)o.isSampler&&o.texture===e&&(o.isSampledTexture!==!0&&this.backend.destroySampler(o),o.reset(),o.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},sb=class extends Ut{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},BM=class extends Jv{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(r=>{r.isOverrideContextNode===!0&&e.push(r.value.overrideNodes)});let t=new Map(e.flatMap(r=>Array.from(r.entries()))),n=super.getFlowContextData();return n.overrideNodes=t,n}};function kJ(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new BM(new Map([[i,e]]),t)}Be("overrideNode",(i,e,t)=>kJ(e,t,i));function GJ(i,e=null){let t=new Map;for(let[n,r]of i){let s=r!==null?typeof r=="function"?r:()=>r:null;t.set(n,s)}return new BM(t,e)}Be("overrideNodes",(i,e)=>GJ(e,i));var UM=class extends fi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),s;return r!==null?s=r.getMemberType(e,t):(Ge(`TSL: Member "${t}" not found in struct "${n}".`,new Fr),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},F2e=(i,e)=>new UM(i,e),rO=class extends $t{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return Ge("TSL: Invalid node added to stack.",new Fr),this;if(t===-1)if(this._currentNode){let n=this._nodeDataLibrary.get(this._currentNode);n===void 0&&(n={delta:0},this._nodeDataLibrary.set(this._currentNode,n)),n.delta++,t=this.nodes.indexOf(this._currentNode)+n.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new g1(t);return this._currentCond=Ko(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new g1(t),r=Ko(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new g1(e),this}Switch(e){return this._expressionNode=Vt(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Vt(e[a])));else Ge("TSL: Invalid parameter length. Case() requires at least two parameters.",new Fr);let n=e[e.length-1],r=new g1(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=Ko(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}build(e,...t){let n=h7(),r=e.buildStage;Zv(this),e.setActiveStack(this);for(let o=0;o<this.nodes.length;o++){let a=this.nodes[o],l=this._currentNode;if(this._currentNode=a,!(a.isVarNode&&a.isIntent(e)&&a.isAssign(e)!==!0)){if(r==="setup")a.build(e);else if(r==="analyze")a.build(e,this);else if(r==="generate"){let c=e.getDataFromNode(a,"any").stages,u=c&&c[e.shaderStage];if(a.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;a.build(e,"void")}this._currentNode=l}}let s;if(this.outputNode){let o=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(s=o)}else s=super.build(e,...t);return Zv(n),e.removeActiveStack(this),s}},aM=Vn(rO).setParameterLength(0,1);function O2e(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var sO=class extends $t{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=O2e(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=R1e(r),o=P1e(r);e=Math.max(e,o);let l=t%e%o;l!==0&&(t+=o-l),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},oO=class extends $t{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},B2e=(i,e=null)=>{let t=new sO(i,e);return u7((...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};let o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new oO(t,s)},t)},kM=class extends $t{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let o=this.members,a=[];for(let l=0;l<o.length;l++){let c="m"+l,u=o[l].getNodeType(e);a.push({name:c,type:u,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){let a=r[o].build(e,t.membersLayout[o].type);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}},U2e=Vn(kM),GM=class{constructor(e=rs){this.blending=e,this.blendSrc=Ud,this.blendDst=kd,this.blendEquation=Bs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},k2e=new GM(Xr),G2e=new GM(Zy);function zJ(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var aO=class extends kM{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:G2e},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||k2e}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=VJ(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(let o in t){let a=zJ(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},VJ=Vn(aO),Nm=class extends dr{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n="";if(this.inputType!==null){let r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},qJ=lt(Nm).setParameterLength(2),z2e=i=>new Nm(i,"int","float"),HJ=i=>new Nm(i,"uint","float"),V2e=i=>new Nm(i,"float","int"),q2e=i=>new Nm(i,"float","uint"),NE={},ou=class i extends Re{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(qJ(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return it;case"int":return fe;case"uvec2":return f7;case"uvec3":return Om;case"uvec4":return m7;case"ivec2":return vr;case"ivec3":return d7;case"ivec4":return A7}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return Ae(([s])=>{let o=it(0);this._resolveElementType(s,o,t);let a=se(o.bitAnd(M7(o))),c=HJ(a).shiftRight(23).sub(127);return n(c)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return Ae(([s])=>{Wt(s.equal(it(0)),()=>it(32));let o=it(0),a=it(0);return this._resolveElementType(s,o,t),Wt(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),Wt(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),Wt(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),Wt(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),Wt(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return Ae(([s])=>{let o=it(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(it(1)).bitAnd(it(1431655765)))),o.assign(o.bitAnd(it(858993459)).add(o.shiftRight(it(2)).bitAnd(it(858993459))));let a=o.add(o.shiftRight(it(4))).bitAnd(it(252645135)).mul(it(16843009)).shiftRight(it(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){let s=this._returnDataNode(t);return Ae(([a])=>{if(n===1)return s(r(a));{let l=s(0),c=["x","y","z","w"];for(let u=0;u<n;u++){let f=c[u];l[f].assign(r(a[f]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);let s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,c=`${t}_${s}`,u=NE[l];if(u===void 0){switch(t){case i.COUNT_LEADING_ZEROS:{u=this._createLeadingZerosBaseLayout(l,o);break}case i.COUNT_TRAILING_ZEROS:{u=this._createTrailingZerosBaseLayout(l,o);break}case i.COUNT_ONE_BITS:{u=this._createOneBitsBaseLayout(l,o);break}}NE[l]=u}let f=NE[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),NE[c]=f),Ae(()=>f(n))()}};ou.COUNT_TRAILING_ZEROS="countTrailingZeros";ou.COUNT_LEADING_ZEROS="countLeadingZeros";ou.COUNT_ONE_BITS="countOneBits";var H2e=lt(ou,ou.COUNT_TRAILING_ZEROS).setParameterLength(1),W2e=lt(ou,ou.COUNT_LEADING_ZEROS).setParameterLength(1),j2e=lt(ou,ou.COUNT_ONE_BITS).setParameterLength(1),X2e=Ae(([i])=>{let e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),lO=(i,e)=>uc(bn(4,i.mul(ni(1,i))),e),$2e=(i,e)=>i.lessThan(.5)?lO(i.mul(2),e).div(2):ni(1,lO(bn(ni(1,i),2),e).div(2)),Y2e=(i,e,t)=>uc(Il(uc(i,e),cs(uc(i,e),uc(ni(1,i),t))),1/e),K2e=(i,e)=>wa(xM.mul(e.mul(i).sub(1))).div(xM.mul(e.mul(i).sub(1))),ob=class extends dr{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},Z2e=lt(ob,"snorm").setParameterLength(1),Q2e=lt(ob,"unorm").setParameterLength(1),J2e=lt(ob,"float16").setParameterLength(1),ab=class extends dr{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},eve=lt(ab,"snorm").setParameterLength(1),tve=lt(ab,"unorm").setParameterLength(1),nve=lt(ab,"float16").setParameterLength(1),Hf=Ae(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),ive=Ae(([i])=>pe(Hf(i.z.add(Hf(i.y.mul(1)))),Hf(i.z.add(Hf(i.x.mul(1)))),Hf(i.y.add(Hf(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),rve=Ae(([i,e,t])=>{let n=pe(i).toVar(),r=se(1.4).toVar(),s=se(0).toVar(),o=pe(n).toVar();return Ci({start:se(0),end:se(3),type:"float",condition:"<="},()=>{let a=pe(ive(o.mul(2))).toVar();n.addAssign(a.add(t.mul(se(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=se(Hf(n.z.add(Hf(n.x.add(Hf(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]}),cO=class extends $t{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,s=-1;for(let o of this.functionNodes){let l=o.shaderNode.layout;if(l===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");let c=l.inputs;if(t.length===c.length){let u=0;for(let f=0;f<t.length;f++){let p=t[f],x=c[f];p.getNodeType(e)===x.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},sve=Vn(cO),Eo=i=>(...e)=>sve(i,...e),U1=Ht(0).setGroup(Kt).onRenderUpdate(i=>i.time),ove=Ht(0).setGroup(Kt).onRenderUpdate(i=>i.deltaTime),WJ=Ht(0,"uint").setGroup(Kt).onRenderUpdate(i=>i.frameId),ave=(i=U1)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),lve=(i=U1)=>i.fract().round(),cve=(i=U1)=>i.add(.5).fract().mul(2).sub(1).abs(),uve=(i=U1)=>i.fract();function hve(i,e=null){return Qf(e,{getUV:typeof i=="function"?i:()=>i})}var fve=Ae(([i,e,t=ft(.5)])=>yb(i.sub(t),e).add(t)),dve=Ae(([i,e,t=ft(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),pve=Ae(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=hc.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=hc;let r=c0.mul(n);return T1(e)&&(r[0][0]=hc[0].length(),r[0][1]=0,r[0][2]=0),T1(t)&&(r[1][0]=0,r[1][1]=hc[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ta.mul(r).mul(hr)}),Ave=Ae(([i=null])=>{let e=CM();return CM(dU(i)).sub(e).lessThan(0).select(tu,i)}),mve=Ae(([i,e=Ri(),t=se(0)])=>{let n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),c=ft(o,a);return e.add(c).mul(l)}),jJ=Ae(([i,e=null,t=null,n=se(1),r=hr,s=Jo])=>{let o=s.abs().normalize();o=o.div(o.dot(pe(1)));let a=r.yz.mul(n),l=r.zx.mul(n),c=r.xy.mul(n),u=i.value,f=e!==null?e.value:u,p=t!==null?t.value:u,x=ai(u,a).mul(o.x),v=ai(f,l).mul(o.y),w=ai(p,c).mul(o.z);return cs(x,v,w)}),gve=(...i)=>jJ(...i),n1=new oa,am=new ie,i1=new ie,e8=new ie,Ev=new on,LE=new ie(0,0,-1),gh=new gn,Mv=new ie,DE=new ie,Cv=new gn,FE=new Oe,zM=new la,_ve=tu.flipX();zM.depthTexture=new ss(1,1);var OE=!1,uO=class i extends Ac{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||zM.texture,_ve),this._reflectorBaseNode=e.reflector||new hO(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new i({defaultTexture:zM.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},hO=class extends $t{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new $i,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(Kn('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?_n.RENDER:_n.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(FE),e.setSize(Math.round(FE.width*n),Math.round(FE.height*n))}setup(e){return this._updateResolution(zM,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new la(0,0,{type:Li,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=$N,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new ss),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&OE)return!1;OE=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(FE),this._updateResolution(l,r),i1.setFromMatrixPosition(o.matrixWorld),e8.setFromMatrixPosition(n.matrixWorld),Ev.extractRotation(o.matrixWorld),am.set(0,0,1),am.applyMatrix4(Ev),Mv.subVectors(i1,e8);let c=Mv.dot(am)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){OE=!1;return}u=!0}Mv.reflect(am).negate(),Mv.add(i1),Ev.extractRotation(n.matrixWorld),LE.set(0,0,-1),LE.applyMatrix4(Ev),LE.add(e8),DE.subVectors(i1,LE),DE.reflect(am).negate(),DE.add(i1),a.coordinateSystem=n.coordinateSystem,a.position.copy(Mv),a.up.set(0,1,0),a.up.applyMatrix4(Ev),a.up.reflect(am),a.lookAt(DE),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),n1.setFromNormalAndCoplanarPoint(am,i1),n1.applyMatrix4(a.matrixWorldInverse),gh.set(n1.normal.x,n1.normal.y,n1.normal.z,n1.constant);let f=a.projectionMatrix;Cv.x=(Math.sign(gh.x)+f.elements[8])/f.elements[0],Cv.y=(Math.sign(gh.y)+f.elements[9])/f.elements[5],Cv.z=-1,Cv.w=(1+f.elements[10])/f.elements[14],gh.multiplyScalar(1/gh.dot(Cv));let p=0;f.elements[2]=gh.x,f.elements[6]=gh.y,f.elements[10]=r.coordinateSystem===Va?gh.z-p:gh.z+1-p,f.elements[14]=gh.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let x=r.getRenderTarget(),v=r.getMRT(),w=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;let S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(v),r.setRenderTarget(x),r.autoClear=w,s.visible=!0,OE=!1,this.forceUpdate=!1}get resolution(){return Kn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Kn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},xve=i=>new uO(i),t8=new Vc(-1,1,1,-1,0,1),fO=class extends Zn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new kn(t,2))}},yve=new fO,lb=class extends Hn{constructor(e=null){super(yve,e),this.camera=t8,this.isQuadMesh=!0}async renderAsync(e){Kn('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,t8)}render(e){e.render(this,t8)}},vve=new Oe,dO=class extends Ac{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Li}){let s=new la(t,n,r);super(s.texture,Ri()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new lb(new pr),this.updateBeforeType=_n.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let n=Math.floor(e*this._resolutionScale),r=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let r=e.getDrawingBufferSize(vve),s=Math.floor(r.width*this._resolutionScale),o=Math.floor(r.height*this._resolutionScale);(s!==this.renderTarget.width||o!==this.renderTarget.height)&&(this.renderTarget.setSize(s,o),this.textureNeedsUpdate=!0)}let n="RTT";this.node.name&&(n=this.node.name+" [ "+n+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=n,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new Ac(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},XJ=(i,...e)=>new dO(Vt(i),...e),bve=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():XJ(i,...e),m1=Ae(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===Va?(i=ft(i.x,i.y.oneMinus()).mul(2).sub(1),r=Lt(pe(i,e),1)):r=Lt(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Lt(t.mul(r));return s.xyz.div(s.w)}),wve=Ae(([i,e])=>{let t=e.mul(Lt(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return ft(n.x,n.y.oneMinus())}),Sve=Ae(([i,e,t])=>{let n=Cm(Qr(e)),r=vr(i.mul(n)).toVar(),s=Qr(e,r).toVar(),o=Qr(e,r.sub(vr(2,0))).toVar(),a=Qr(e,r.sub(vr(1,0))).toVar(),l=Qr(e,r.add(vr(1,0))).toVar(),c=Qr(e,r.add(vr(2,0))).toVar(),u=Qr(e,r.add(vr(0,2))).toVar(),f=Qr(e,r.add(vr(0,1))).toVar(),p=Qr(e,r.sub(vr(0,1))).toVar(),x=Qr(e,r.sub(vr(0,2))).toVar(),v=Qi(ni(se(2).mul(a).sub(o),s)).toVar(),w=Qi(ni(se(2).mul(l).sub(c),s)).toVar(),S=Qi(ni(se(2).mul(f).sub(u),s)).toVar(),T=Qi(ni(se(2).mul(p).sub(x),s)).toVar(),P=m1(i,s,t).toVar(),R=v.lessThan(w).select(P.sub(m1(i.sub(ft(se(1).div(n.x),0)),a,t)),P.negate().add(m1(i.add(ft(se(1).div(n.x),0)),l,t))),C=S.lessThan(T).select(P.sub(m1(i.add(ft(0,se(1).div(n.y))),f,t)),P.negate().add(m1(i.sub(ft(0,se(1).div(n.y))),p,t)));return Zo(Yf(R,C))}),vU=Ae(([i])=>iu(se(52.9829189).mul(iu(pc(i,ft(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),eu=Ae(([i,e,t])=>{let n=se(2.399963229728653),r=Ea(se(i).add(.5).div(se(e))),s=se(i).mul(n).add(t);return ft(Jc(s),wa(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),pO=class extends $t{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Ri())}sample(e){return this.callback(e)}},Tve=(i,e=null)=>new pO(i,Vt(e)),Lm=class extends Al{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},AO=class extends Ni{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},Eve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=lM("float")):(t=bK(e),n=lM(e));let r=new AO(i,t,n);return t0(r,e,i)},Mve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=lM("float")):(t=bK(e),n=lM(e));let r=new Lm(i,t,n);return t0(r,e,r.count)},mO=class extends $t{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},Cve=xt(mO),n8=new on,$J=Ht(0).setGroup(Kt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),gO=Ht(1).setGroup(Kt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),YJ=Ht(new on).setGroup(Kt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==p2||i.backgroundNode&&i.backgroundNode.isNode?n8.makeRotationFromEuler(i.backgroundRotation).transpose():n8.identity(),n8}),VM=class extends Ac{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=So.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,n,r,s,o,a,l,c){let u=this.value;return e.generateStorageTextureLoad(u,t,n,r,o,c)}toReadWrite(){return this.setAccess(So.READ_WRITE)}toReadOnly(){return this.setAccess(So.READ_ONLY)}toWriteOnly(){return this.setAccess(So.WRITE_ONLY)}store(e,t){let n=this.clone();return n.referenceNode=this.getBase(),n.uvNode=e,n.storeNode=t,t!==null&&n.toStack(),n}generateStore(e){let t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),c=s?s.build(e,"int"):null,u=e.generateTextureStore(this.value,o,a,c,l);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},KJ=Vn(VM).setParameterLength(1,3),Rve=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=KJ(i,e,t),t!==null&&n.toStack()),n},_O=class extends VM{static get type(){return"StorageTexture3DNode"}constructor(e,t,n=null){super(e,t,n),this.isStorageTexture3DNode=!0}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}},Pve=Vn(_O).setParameterLength(1,3),Ive=Ae(({texture:i,uv:e})=>{let n=pe().toVar();return Wt(e.x.lessThan(1e-4),()=>{n.assign(pe(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(pe(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(pe(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(pe(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(pe(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(pe(0,0,-1))}).Else(()=>{let s=i.sample(e.add(pe(-.01,0,0))).r.sub(i.sample(e.add(pe(.01,0,0))).r),o=i.sample(e.add(pe(0,-.01,0))).r.sub(i.sample(e.add(pe(0,.01,0))).r),a=i.sample(e.add(pe(0,0,-.01))).r.sub(i.sample(e.add(pe(0,0,.01))).r);n.assign(pe(s,o,a))}),n.normalize()}),xO=class extends Ac{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return Ive({texture:this,uv:e})}},bU=Vn(xO).setParameterLength(1,3),Nve=(...i)=>bU(...i).setSampler(!1),Lve=(i,e,t)=>bU(i,e).level(t),yO=class extends C1{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},Dve=(i,e,t)=>new yO(i,e,t),zY=new WeakMap,vO=class extends dr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=_n.OBJECT,this.updateAfterType=_n.OBJECT,this.previousModelWorldMatrix=Ht(new on),this.previousProjectionMatrix=Ht(new on).setGroup(Kt),this.previousCameraViewMatrix=Ht(new on)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=VY(n);this.previousModelWorldMatrix.value.copy(r);let s=ZJ(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new on,s.previousCameraViewMatrix=new on,s.currentProjectionMatrix=new on,s.currentCameraViewMatrix=new on,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){VY(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ta:Ht(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Rh).mul(hr),r=this.previousProjectionMatrix.mul(t).mul(Pm),s=n.xy.div(n.w),o=r.xy.div(r.w);return ni(s,o)}};function ZJ(i){let e=zY.get(i);return e===void 0&&(e={},zY.set(i,e)),e}function VY(i,e=0){let t=ZJ(i),n=t[e];return n===void 0&&(t[e]=n=new on,t[e].copy(i.matrixWorld)),n}var Fve=xt(vO),Ove=Ae(([i,e])=>Za(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Bve=Ae(([i,e])=>Za(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Uve=Ae(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),kve=Ae(([i,e])=>jn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Mm(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Gve=Ae(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Lt(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),zve=Ae(([i])=>wU(i.rgb)),Vve=Ae(([i,e=se(1)])=>e.mix(wU(i.rgb),i.rgb).max(0)),qve=Ae(([i,e=se(0)])=>{let t=cs(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return jn(i.rgb,n,r).max(0)}),Hve=Ae(([i,e=se(1)])=>{let t=pe(.57735,.57735,.57735),n=e.cos();return pe(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(pc(t,i.rgb).mul(n.oneMinus()))))).max(0)}),wU=(i,e=pe(sn.getLuminanceCoefficients(new ie)))=>pc(i,e),Wve=Ae(([i,e=pe(1),t=pe(0),n=pe(1),r=se(1),s=pe(sn.getLuminanceCoefficients(new ie,Gd))])=>{let o=i.rgb.dot(pe(s)),a=br(i.rgb.mul(e).add(t),0),l=a.pow(n);return Wt(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),Wt(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),Wt(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Lt(a.rgb,i.a)}),jve=Ae(([i,e])=>i.mul(e).floor().div(e)),BE=null,bO=class extends R1{static get type(){return"ViewportSharedTextureNode"}constructor(e=tu,t=null){BE===null&&(BE=new xA),super(e,t,BE)}getTextureForReference(){return BE}updateReference(){return this}},Xve=Vn(bO).setParameterLength(0,2),UE=new Oe,qM=class extends Ac{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},HM=class extends qM{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},Lh=class i extends dr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._width=1,this._height=1;let s=new la(this._width,this._height,{type:Li,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new ss,o.isRenderTargetTexture=!0,o.name="depth",s.depthTexture=o),this.renderTarget=s,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:s.texture},o!==null&&(this._textures.depth=o),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Ht(0),this._cameraFar=Ht(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=_n.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return je("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return je("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new HM(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new HM(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=GC(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=wm(s,n,r)}return t}async compileAsync(e){let t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=Yi),this.scope===i.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,s=t.getOutputRenderTarget();s&&s.isXRRenderTarget===!0?(r=t.xr.getCamera(),t.xr.updateCamera(r),UE.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(UE)),this.setSize(UE.width,UE.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,p=t.contextNode,x=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let w in this._previousTextures)this.toggleTexture(w);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:Qf({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let v=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=v,n.overrideMaterial=x,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=p,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._resolutionScale),r=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new gn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r))}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new gn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Lh.COLOR="color";Lh.DEPTH="depth";var $ve=(i,e,t)=>new Lh(Lh.COLOR,i,e,t),Yve=(i,e)=>new qM(i,e),Kve=(i,e,t)=>new Lh(Lh.DEPTH,i,e,t),wO=class extends Lh{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Lh.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,f)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){let p=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,p,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new pr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=ui;let t=Jo.negate(),n=Ta.mul(Rh),r=se(1),s=n.mul(Lt(hr,1)),o=n.mul(Lt(hr.add(t),1)),a=Zo(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Lt(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},Zve=(i,e,t=new Ut(0,0,0),n=.003,r=1)=>new wO(i,e,Vt(t),Vt(n),Vt(r)),QJ=Ae(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),JJ=Ae(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),eee=Ae(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);let t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Qve=Ae(([i])=>{let e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),tee=Ae(([i,e])=>{let t=io(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=io(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=Qve(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Jve=io(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),ebe=io(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),tbe=Ae(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return se(15.5).mul(n.mul(t)).sub(bn(40.14,n.mul(e))).add(bn(31.96,n).sub(bn(6.868,t.mul(e))).add(bn(.4298,t).add(bn(.1191,e).sub(.00232))))}),nee=Ae(([i,e])=>{let t=pe(i).toVar(),n=io(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=io(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=se(-12.47393),o=se(4.026069);return t.mulAssign(e),t.assign(ebe.mul(t)),t.assign(n.mul(t)),t.assign(br(t,1e-10)),t.assign(wh(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(ru(t,0,1)),t.assign(tbe(t)),t.assign(r.mul(t)),t.assign(uc(br(pe(0),t),pe(2.2))),t.assign(Jve.mul(t)),t.assign(ru(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),iee=Ae(([i,e])=>{let t=se(.76),n=se(.15);i=i.mul(e);let r=Za(i.r,Za(i.g,i.b)),s=Ko(r.lessThan(.08),r.sub(bn(6.25,r.mul(r))),.04);i.subAssign(s);let o=br(i.r,br(i.g,i.b));Wt(o.lessThan(t),()=>i);let a=ni(1,t),l=ni(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ni(1,Il(1,n.mul(o.sub(l)).add(1)));return jn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Zi=class extends $t{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let r of t)r.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},WC=Vn(Zi).setParameterLength(1,3),nbe=(i,e)=>WC(i,e,"js"),ibe=(i,e)=>WC(i,e,"wgsl"),rbe=(i,e)=>WC(i,e,"glsl"),WM=class extends Zi{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);let a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+`4158-`,t==="property"?a:e.format(`${a}()`,s,t)}},ree=(i,e=[],t="")=>{let n=new WM(i,e,t);return u7((...s)=>n.call(...s),n)},sbe=(i,e)=>ree(i,e,"glsl"),obe=(i,e)=>ree(i,e,"wgsl");function SU(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Jr.z).negate()}var see=Ae(([i,e],t)=>{let n=SU(t);return Nl(i,e,n)}),oee=Ae(([i],e)=>{let t=SU(e);return i.mul(i,t,t).negate().exp().oneMinus()}),abe=Ae(([i,e],t)=>{let n=SU(t),s=e.sub(Eh.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),SO=Ae(([i,e])=>Lt(e.toFloat().mix(y1.rgb,i.toVec3()),y1.a)),lm=null,cm=null,TO=class extends $t{static get type(){return"RangeNode"}constructor(e=se(),t=se()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(Qp(t.value)),s=e.getTypeLength(Qp(n.value));return r>s?r:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new wM('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(Qp(o)),c=e.getTypeLength(Qp(a));lm=lm||new gn,cm=cm||new gn,lm.setScalar(0),cm.setScalar(0),l===1?lm.setScalar(o):o.isColor?lm.set(o.r,o.g,o.b,1):lm.set(o.x,o.y,o.z||0,o.w||0),c===1?cm.setScalar(a):a.isColor?cm.set(a.r,a.g,a.b,1):cm.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,p=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=lm.getComponent(S),P=cm.getComponent(S);p[w]=Wc.lerp(T,P,Math.random())}let x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=O1(p,"vec4",t.count).element(nu).convert(x);else{let w=new Al(p,4);e.geometry.setAttribute("__range"+this.id,w),n=FC(w).convert(x)}}else n=se(0);return n}},lbe=Vn(TO).setParameterLength(2),EO=class extends $t{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(je(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},vb=(i,e)=>new EO(i,e),cbe=vb("numWorkgroups","uvec3"),ube=vb("workgroupId","uvec3"),hbe=vb("globalId","uvec3"),fbe=vb("localId","uvec3"),dbe=vb("subgroupSize","uint"),MO=class extends $t{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4159-`):e.addLineFlowCode(`${t}Barrier()`,this)}},TU=Vn(MO),pbe=()=>TU("workgroup").toStack(),Abe=()=>TU("storage").toStack(),mbe=()=>TU("texture").toStack(),CO=class extends $f{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.isContextAssign();if(n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},RO=class extends $t{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Fr),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new CO(this,e)}generate(e){let t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},gbe=(i,e)=>new RO("Workgroup",i,e),hs=class extends $t{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,c=[];c.push(`&${a.build(e,o)}`),l!==null&&c.push(l.build(e,o));let u=`${e.getMethod(r,s)}( ${c.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=Cl(u,s).toConst()),t.constNode.build(e)}};hs.ATOMIC_LOAD="atomicLoad";hs.ATOMIC_STORE="atomicStore";hs.ATOMIC_ADD="atomicAdd";hs.ATOMIC_SUB="atomicSub";hs.ATOMIC_MAX="atomicMax";hs.ATOMIC_MIN="atomicMin";hs.ATOMIC_AND="atomicAnd";hs.ATOMIC_OR="atomicOr";hs.ATOMIC_XOR="atomicXor";var _be=Vn(hs),Fh=(i,e,t)=>_be(i,e,t).toStack(),xbe=i=>Fh(hs.ATOMIC_LOAD,i,null),ybe=(i,e)=>Fh(hs.ATOMIC_STORE,i,e),vbe=(i,e)=>Fh(hs.ATOMIC_ADD,i,e),bbe=(i,e)=>Fh(hs.ATOMIC_SUB,i,e),wbe=(i,e)=>Fh(hs.ATOMIC_MAX,i,e),Sbe=(i,e)=>Fh(hs.ATOMIC_MIN,i,e),Tbe=(i,e)=>Fh(hs.ATOMIC_AND,i,e),Ebe=(i,e)=>Fh(hs.ATOMIC_OR,i,e),Mbe=(i,e)=>Fh(hs.ATOMIC_XOR,i,e),Ft=class i extends dr{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}generateNodeType(e){let t=this.method;return t===i.SUBGROUP_ELECT?"bool":t===i.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===i.SUBGROUP_BROADCAST||n===i.SUBGROUP_SHUFFLE||n===i.QUAD_BROADCAST){let u=a.getNodeType(e);l.push(o.build(e,r),a.build(e,u==="float"?"int":r))}else n===i.SUBGROUP_SHUFFLE_XOR||n===i.SUBGROUP_SHUFFLE_DOWN||n===i.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));let c=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${c}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ft.SUBGROUP_ELECT="subgroupElect";Ft.SUBGROUP_BALLOT="subgroupBallot";Ft.SUBGROUP_ADD="subgroupAdd";Ft.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ft.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ft.SUBGROUP_MUL="subgroupMul";Ft.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ft.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ft.SUBGROUP_AND="subgroupAnd";Ft.SUBGROUP_OR="subgroupOr";Ft.SUBGROUP_XOR="subgroupXor";Ft.SUBGROUP_MIN="subgroupMin";Ft.SUBGROUP_MAX="subgroupMax";Ft.SUBGROUP_ALL="subgroupAll";Ft.SUBGROUP_ANY="subgroupAny";Ft.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ft.QUAD_SWAP_X="quadSwapX";Ft.QUAD_SWAP_Y="quadSwapY";Ft.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ft.SUBGROUP_BROADCAST="subgroupBroadcast";Ft.SUBGROUP_SHUFFLE="subgroupShuffle";Ft.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ft.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ft.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ft.QUAD_BROADCAST="quadBroadcast";var Cbe=lt(Ft,Ft.SUBGROUP_ELECT).setParameterLength(0),Rbe=lt(Ft,Ft.SUBGROUP_BALLOT).setParameterLength(1),Pbe=lt(Ft,Ft.SUBGROUP_ADD).setParameterLength(1),Ibe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),Nbe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),Lbe=lt(Ft,Ft.SUBGROUP_MUL).setParameterLength(1),Dbe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),Fbe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),Obe=lt(Ft,Ft.SUBGROUP_AND).setParameterLength(1),Bbe=lt(Ft,Ft.SUBGROUP_OR).setParameterLength(1),Ube=lt(Ft,Ft.SUBGROUP_XOR).setParameterLength(1),kbe=lt(Ft,Ft.SUBGROUP_MIN).setParameterLength(1),Gbe=lt(Ft,Ft.SUBGROUP_MAX).setParameterLength(1),zbe=lt(Ft,Ft.SUBGROUP_ALL).setParameterLength(0),Vbe=lt(Ft,Ft.SUBGROUP_ANY).setParameterLength(0),qbe=lt(Ft,Ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),Hbe=lt(Ft,Ft.QUAD_SWAP_X).setParameterLength(1),Wbe=lt(Ft,Ft.QUAD_SWAP_Y).setParameterLength(1),jbe=lt(Ft,Ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),Xbe=lt(Ft,Ft.SUBGROUP_BROADCAST).setParameterLength(2),$be=lt(Ft,Ft.SUBGROUP_SHUFFLE).setParameterLength(2),Ybe=lt(Ft,Ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),Kbe=lt(Ft,Ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),Zbe=lt(Ft,Ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),Qbe=lt(Ft,Ft.QUAD_BROADCAST).setParameterLength(1),kE;function jC(i){kE=kE||new WeakMap;let e=kE.get(i);return e===void 0&&kE.set(i,e={}),e}function XC(i){let e=jC(i);return e.shadowMatrix||(e.shadowMatrix=Ht("mat4").setGroup(Kt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function aee(i,e=Eh){let t=XC(i).mul(e);return t.xyz.div(t.w)}function EU(i){let e=jC(i);return e.position||(e.position=Ht(new ie).setGroup(Kt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function lee(i){let e=jC(i);return e.targetPosition||(e.targetPosition=Ht(new ie).setGroup(Kt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function MU(i){let e=jC(i);return e.viewPosition||(e.viewPosition=Ht(new ie).setGroup(Kt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new ie,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var CU=i=>c0.transformDirection(EU(i).sub(lee(i))),Jbe=Zf("vec3","totalDiffuse"),ewe=Zf("vec3","totalSpecular"),twe=Zf("vec3","outgoingLight"),nwe=i=>i.sort((e,t)=>e.id-t.id),iwe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},i8=new WeakMap,Rv=[],cb=class extends $t{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Jbe,this.totalSpecularNode=ewe,this.outgoingLightNode=twe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Rv.push(r.id),Rv.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Rv.push(s,o)}}let t=gb(Rv);return Rv.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let n=this.setupLightsNode(e);t.lightNodes=n;let r=[];for(let s of n)r.push(s.getHash());t.lightNodesHash="lights-"+r.join(",")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),n=[],r=t.lightNodes||null,s=e.context.materialLightings,o=nwe([...s,...this._lights]),a=e.renderer.library;for(let l of o)if(l.isNode)n.push(l);else{let c=null;if(r!==null&&(c=iwe(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){je(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}i8.has(l)===!1&&i8.set(l,new u(l)),c=i8.get(l)}n.push(c)}return n}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){let{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;let c=e.addStack();o.nodes=c.nodes,s.start(e);let{backdrop:u,backdropAlpha:f}=r,{directDiffuse:p,directSpecular:x,indirectDiffuse:v,indirectSpecular:w}=r.reflectedLight,S=p.add(v);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(x.add(w)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},rwe=(i=[])=>new cb().setLights(i),PO=class extends $t{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=_n.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){RU.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Eh)}},RU=Zf("vec3","shadowPositionWorld");function swe(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new Ut),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function owe(i,e){return e=swe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function awe(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function lwe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function cwe(i,e){return e=lwe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function uwe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function hwe(i,e,t){return t=owe(i,t),t=cwe(e,t),t}function fwe(i,e,t){awe(i,t),uwe(e,t)}var jM=new WeakMap,cee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=ai(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),uee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let p=ai(i,u);return i.isArrayTexture&&(p=p.depth(n)),p.compare(f)},s=tr("mapSize","vec2",t).setGroup(Kt),o=tr("radius","float",t).setGroup(Kt),a=ft(1).div(s),l=o.mul(a.x),c=vU(Um.xy).mul(6.28318530718);return cs(r(e.xy.add(eu(0,5,c).mul(l)),e.z),r(e.xy.add(eu(1,5,c).mul(l)),e.z),r(e.xy.add(eu(2,5,c).mul(l)),e.z),r(e.xy.add(eu(3,5,c).mul(l)),e.z),r(e.xy.add(eu(4,5,c).mul(l)),e.z)).mul(1/5)}),hee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=tr("mapSize","vec2",t).setGroup(Kt),s=ft(1).div(r),o=e.xy,a=iu(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=x=>{let v=ai(i,o).offset(x).gather();return i.isArrayTexture&&(v=v.depth(n)),v.compare(e.z)},c=l(vr(-1,1)).toConst(),u=l(vr(1,1)).toConst(),f=l(vr(-1,-1)).toConst(),p=l(vr(1,-1)).toConst();return cs(jn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),jn(c.w,u.z,a.x).add(c.z).add(u.w),jn(f.x,p.y,a.x).add(f.y).add(p.x),jn(f.w,p.z,a.x).add(f.z).add(p.w).mul(a.y.oneMinus())).mul(1/9)}),fee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=ai(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=br(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Mm(s,e.z):Mm(e.z,s),l=se(1).toVar();return Wt(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=ru(ni(u,.3).div(.65)),l.assign(br(a,u))}),l}),dee=i=>{let e=jM.get(i);return e===void 0&&(e=new pr,e.colorNode=Lt(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=Xr,e.fog=!1,jM.set(i,e)),e},pee=i=>{let e=jM.get(i);e!==void 0&&(e.dispose(),jM.delete(i))},qY=new Ih,r1=[],Aee=(i,e,t,n)=>{r1[0]=i,r1[1]=e;let r=qY.get(r1);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,p,x)=>{(s.castShadow===!0||s.receiveShadow&&t===Zl)&&(n&&(wK(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,p,x),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,qY.set(r1,r)),r1[0]=null,r1[1]=null,r},dwe=Ae(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=se(0).toVar("meanVertical"),o=se(0).toVar("squareMeanVertical"),a=i.lessThanEqual(se(1)).select(se(0),se(2).div(i.sub(1))),l=i.lessThanEqual(se(1)).select(se(0),se(-1));Ci({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(cs(Um.xy,ft(0,f).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),p=p.x,s.addAssign(p),o.addAssign(p.mul(p))}),s.divAssign(i),o.divAssign(i);let c=Ea(o.sub(s.mul(s)).max(0));return ft(s,c)}),pwe=Ae(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=se(0).toVar("meanHorizontal"),o=se(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(se(1)).select(se(0),se(2).div(i.sub(1))),l=i.lessThanEqual(se(1)).select(se(0),se(-1));Ci({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(cs(Um.xy,ft(f,0).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),s.addAssign(p.x),o.addAssign(cs(p.y.mul(p.y),p.x.mul(p.x)))}),s.divAssign(i),o.divAssign(i);let c=Ea(o.sub(s.mul(s)).max(0));return ft(s,c)}),Awe=[cee,uee,hee,fee],r8,GE=new lb,XM=class extends PO{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){let a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,se(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||tr("bias","float",n).setGroup(Kt),o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{let l=o.w;o=o.xy.div(l);let c=tr("near","float",n.camera).setGroup(Kt),u=tr("far","float",n.camera).setGroup(Kt);a=zC(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return Awe[e]}setupRenderTarget(e,t){let n=new ss(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Hc:th;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,c=t.hasCompatibility(Df.TEXTURE_COMPARE);if((l===Jd||l===GT)&&c?(o.minFilter=vi,o.magFilter=vi):(o.minFilter=xi,o.magFilter=xi),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Zl&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ws,type:Li,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ws,type:Li,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ws,type:Li,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ws,type:Li,depthBuffer:!1}));let D=ai(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let F=ai(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(F=F.depth(this.depthLayer));let N=tr("blurSamples","float",s).setGroup(Kt),B=tr("radius","float",s).setGroup(Kt),z=tr("mapSize","vec2",s).setGroup(Kt),V=this.vsmMaterialVertical||(this.vsmMaterialVertical=new pr);V.fragmentNode=dwe({samples:N,radius:B,size:z,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMVertical",V=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new pr),V.fragmentNode=pwe({samples:N,radius:B,size:z,shadowPass:F,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMHorizontal"}let u=tr("intensity","float",s).setGroup(Kt),f=tr("normalBias","float",s).setGroup(Kt),p=XC(r),x=u0.mul(f),v;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?v=p.mul(RU.add(x)):v=Ht("mat4").onObjectUpdate(({object:F},N)=>N.value.multiplyMatrices(p.value,F.matrixWorld)).mul(hr).add(p.mul(Lt(x,0)));let w=this.setupShadowCoord(e,v),S=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(S===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let T=l===Zl&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,P=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),R;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?R=Sa(a.texture,w.xyz):(R=ai(a.texture,w),o.isArrayTexture&&(R=R.depth(this.depthLayer))));let C;R?C=jn(1,P.rgb.mix(R,1),u.mul(R.a)).toVar():C=jn(1,P,u).toVar(),this.shadowMap=a,this.shadow.map=a;let L=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return R&&C.toInspector(`${L} / Color`,()=>this.shadowMap.texture.isCubeTexture?Sa(this.shadowMap.texture,bF()):ai(this.shadowMap.texture)),C.toInspector(`${L} / Depth`,()=>{let D=tr("near","float",this.shadow.camera),F=tr("far","float",this.shadow.camera),N;this.shadowMap.texture.isCubeTexture?N=Sa(this.shadowMap.depthTexture,bF()).r:N=ai(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=GC(N,D,F):B=_J(N,D,F),B=wm(B,D,F),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return Ae(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let u=r.camera.layers.mask;(r.camera.layers.mask&4294967294)===0&&(r.camera.layers.mask=a.layers.mask);let f=s.getRenderObjectFunction(),p=s.getMRT(),x=p?p.has("velocity"):!1;r8=hwe(s,o,r8),o.overrideMaterial=dee(n),s.setRenderObjectFunction(Aee(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Zl&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,fwe(s,o,r8)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),GE.material=this.vsmMaterialVertical,GE.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),GE.material=this.vsmMaterialHorizontal,GE.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,pee(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},mee=(i,e)=>new XM(i,e),mwe=new Ut,HY=new on,Pv=new ie,s8=new ie,gwe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,-1,0),new ie(0,1,0),new ie(0,0,1),new ie(0,0,-1)],_we=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,-1),new ie(0,0,1),new ie(0,-1,0),new ie(0,-1,0)],xwe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1)],ywe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1),new ie(0,-1,0),new ie(0,-1,0)],gee=Ae(({depthTexture:i,bd3D:e,dp:t})=>Sa(i,e).compare(t)),_ee=Ae(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=tr("radius","float",n).setGroup(Kt),s=tr("mapSize","vec2",n).setGroup(Kt),o=r.div(s.x),a=Qi(e),l=Zo(Yf(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=Yf(e,l),u=vU(Um.xy).mul(6.28318530718),f=eu(0,5,u),p=eu(1,5,u),x=eu(2,5,u),v=eu(3,5,u),w=eu(4,5,u);return Sa(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Sa(i,e.add(l.mul(p.x).add(c.mul(p.y)).mul(o))).compare(t)).add(Sa(i,e.add(l.mul(x.x).add(c.mul(x.y)).mul(o))).compare(t)).add(Sa(i,e.add(l.mul(v.x).add(c.mul(v.y)).mul(o))).compare(t)).add(Sa(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),vwe=Ae(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{let s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Ht("float").setGroup(Kt).onRenderUpdate(()=>n.camera.near),c=Ht("float").setGroup(Kt).onRenderUpdate(()=>n.camera.far),u=tr("bias","float",n).setGroup(Kt),f=se(1).toVar();return Wt(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let p;r.renderer.reversedDepthBuffer?(p=xJ(a.negate(),l,c),p.subAssign(u)):r.renderer.logarithmicDepthBuffer?(p=zC(a.negate(),l,c),p.addAssign(u)):(p=pU(a.negate(),l,c),p.addAssign(u));let x=s.normalize();f.assign(i({depthTexture:e,bd3D:x,dp:p,shadow:n}))}),f}),IO=class extends XM{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===jN?gee:_ee}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return vwe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new p_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Hc:th;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,c=s.coordinateSystem===Va,u=c?gwe:xwe,f=c?_we:ywe;n.setSize(t.mapSize.width,t.mapSize.width);let p=s.autoClear,x=s.getClearColor(mwe),v=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let w=0;w<6;w++){s.setRenderTarget(n,w),s.clear();let S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),Pv.setFromMatrixPosition(r.matrixWorld),a.position.copy(Pv),s8.copy(a.position),s8.add(u[w]),a.up.copy(f[w]),a.lookAt(s8),a.updateMatrixWorld(),l.makeTranslation(-Pv.x,-Pv.y,-Pv.z),HY.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(HY,a.coordinateSystem,a.reversedDepth);let T=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${w+1}`,s.render(o,a),o.name=T}s.autoClear=p,s.setClearColor(x,v)}},xee=(i,e)=>new IO(i,e),Kf=class extends s0{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new Ut,this.colorNode=e&&e.colorNode||Ht(this.color).setGroup(Kt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=_n.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return MU(this.light).sub(e.context.positionView||Jr)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return mee(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){let r=this.light.shadow.shadowNode,s;r!==void 0?s=Vt(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},PU=Ae(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{let n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),yee=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=PU({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},NO=class extends Kf{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Ht(0).setGroup(Kt),this.decayExponentNode=Ht(2).setGroup(Kt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return xee(this.light)}setupDirect(e){return yee({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},bwe=Ae(([i=Ri()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),wwe=Ae(([i=Ri()],{renderer:e,material:t})=>{let n=D7(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=se(n.fwidth()).toVar();r=Nl(s.oneMinus(),s.add(1),n).oneMinus()}else r=Ko(n.greaterThan(1),0,1);return r}),$v=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Pl(i).toVar();return Ko(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),$M=Ae(([i,e])=>{let t=Pl(e).toVar(),n=se(i).toVar();return Ko(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),ls=Ae(([i])=>{let e=se(i).toVar();return fe(Sh(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),fr=Ae(([i,e])=>{let t=se(i).toVar();return e.assign(ls(t)),t.sub(se(e))}),Swe=Ae(([i,e,t,n,r,s])=>{let o=se(s).toVar(),a=se(r).toVar(),l=se(n).toVar(),c=se(t).toVar(),u=se(e).toVar(),f=se(i).toVar(),p=se(ni(1,a)).toVar();return ni(1,o).mul(f.mul(p).add(u.mul(a))).add(o.mul(c.mul(p).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Twe=Ae(([i,e,t,n,r,s])=>{let o=se(s).toVar(),a=se(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),p=se(ni(1,a)).toVar();return ni(1,o).mul(f.mul(p).add(u.mul(a))).add(o.mul(c.mul(p).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),vee=Eo([Swe,Twe]),Ewe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=se(u).toVar(),p=se(c).toVar(),x=se(l).toVar(),v=se(a).toVar(),w=se(o).toVar(),S=se(s).toVar(),T=se(r).toVar(),P=se(n).toVar(),R=se(t).toVar(),C=se(e).toVar(),L=se(i).toVar(),D=se(ni(1,x)).toVar(),F=se(ni(1,p)).toVar();return se(ni(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(R.mul(D).add(P.mul(x))))).add(f.mul(F.mul(T.mul(D).add(S.mul(x))).add(p.mul(w.mul(D).add(v.mul(x))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Mwe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=se(u).toVar(),p=se(c).toVar(),x=se(l).toVar(),v=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),P=pe(n).toVar(),R=pe(t).toVar(),C=pe(e).toVar(),L=pe(i).toVar(),D=se(ni(1,x)).toVar(),F=se(ni(1,p)).toVar();return se(ni(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(R.mul(D).add(P.mul(x))))).add(f.mul(F.mul(T.mul(D).add(S.mul(x))).add(p.mul(w.mul(D).add(v.mul(x))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),bee=Eo([Ewe,Mwe]),Cwe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=it(i).toVar(),o=it(s.bitAnd(it(7))).toVar(),a=se($v(o.lessThan(it(4)),r,n)).toVar(),l=se(bn(2,$v(o.lessThan(it(4)),n,r))).toVar();return $M(a,Pl(o.bitAnd(it(1)))).add($M(l,Pl(o.bitAnd(it(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Rwe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=it(i).toVar(),l=it(a.bitAnd(it(15))).toVar(),c=se($v(l.lessThan(it(8)),o,s)).toVar(),u=se($v(l.lessThan(it(4)),s,$v(l.equal(it(12)).or(l.equal(it(14))),o,r))).toVar();return $M(c,Pl(l.bitAnd(it(1)))).add($M(u,Pl(l.bitAnd(it(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),no=Eo([Cwe,Rwe]),Pwe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Om(i).toVar();return pe(no(s.x,r,n),no(s.y,r,n),no(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Iwe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=Om(i).toVar();return pe(no(a.x,o,s,r),no(a.y,o,s,r),no(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),lc=Eo([Pwe,Iwe]),Nwe=Ae(([i])=>{let e=se(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Lwe=Ae(([i])=>{let e=se(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Dwe=Ae(([i])=>{let e=pe(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),wee=Eo([Nwe,Dwe]),Fwe=Ae(([i])=>{let e=pe(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),See=Eo([Lwe,Fwe]),Ml=Ae(([i,e])=>{let t=fe(e).toVar(),n=it(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(fe(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Tee=Ae(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Ml(t,fe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Ml(i,fe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Ml(e,fe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Ml(t,fe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Ml(i,fe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Ml(e,fe(4))),e.addAssign(i)}),bb=Ae(([i,e,t])=>{let n=it(t).toVar(),r=it(e).toVar(),s=it(i).toVar();return n.bitXorAssign(r),n.subAssign(Ml(r,fe(14))),s.bitXorAssign(n),s.subAssign(Ml(n,fe(11))),r.bitXorAssign(s),r.subAssign(Ml(s,fe(25))),n.bitXorAssign(r),n.subAssign(Ml(r,fe(16))),s.bitXorAssign(n),s.subAssign(Ml(n,fe(4))),r.bitXorAssign(s),r.subAssign(Ml(s,fe(14))),n.bitXorAssign(r),n.subAssign(Ml(r,fe(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Qo=Ae(([i])=>{let e=it(i).toVar();return se(e).div(se(it(fe(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),Mh=Ae(([i])=>{let e=se(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),Owe=Ae(([i])=>{let e=fe(i).toVar(),t=it(it(1)).toVar(),n=it(it(fe(3735928559)).add(t.shiftLeft(it(2))).add(it(13))).toVar();return bb(n.add(it(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),Bwe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(it(2)).toVar(),s=it().toVar(),o=it().toVar(),a=it().toVar();return s.assign(o.assign(a.assign(it(fe(3735928559)).add(r.shiftLeft(it(2))).add(it(13))))),s.addAssign(it(n)),o.addAssign(it(t)),bb(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Uwe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(it(3)).toVar(),a=it().toVar(),l=it().toVar(),c=it().toVar();return a.assign(l.assign(c.assign(it(fe(3735928559)).add(o.shiftLeft(it(2))).add(it(13))))),a.addAssign(it(s)),l.addAssign(it(r)),c.addAssign(it(n)),bb(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),kwe=Ae(([i,e,t,n])=>{let r=fe(n).toVar(),s=fe(t).toVar(),o=fe(e).toVar(),a=fe(i).toVar(),l=it(it(4)).toVar(),c=it().toVar(),u=it().toVar(),f=it().toVar();return c.assign(u.assign(f.assign(it(fe(3735928559)).add(l.shiftLeft(it(2))).add(it(13))))),c.addAssign(it(a)),u.addAssign(it(o)),f.addAssign(it(s)),Tee(c,u,f),c.addAssign(it(r)),bb(c,u,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),Gwe=Ae(([i,e,t,n,r])=>{let s=fe(r).toVar(),o=fe(n).toVar(),a=fe(t).toVar(),l=fe(e).toVar(),c=fe(i).toVar(),u=it(it(5)).toVar(),f=it().toVar(),p=it().toVar(),x=it().toVar();return f.assign(p.assign(x.assign(it(fe(3735928559)).add(u.shiftLeft(it(2))).add(it(13))))),f.addAssign(it(c)),p.addAssign(it(l)),x.addAssign(it(a)),Tee(f,p,x),f.addAssign(it(o)),p.addAssign(it(s)),bb(f,p,x)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Fi=Eo([Owe,Bwe,Uwe,kwe,Gwe]),zwe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(Fi(n,t)).toVar(),s=Om().toVar();return s.x.assign(r.bitAnd(fe(255))),s.y.assign(r.shiftRight(fe(8)).bitAnd(fe(255))),s.z.assign(r.shiftRight(fe(16)).bitAnd(fe(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Vwe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(Fi(s,r,n)).toVar(),a=Om().toVar();return a.x.assign(o.bitAnd(fe(255))),a.y.assign(o.shiftRight(fe(8)).bitAnd(fe(255))),a.z.assign(o.shiftRight(fe(16)).bitAnd(fe(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),cc=Eo([zwe,Vwe]),qwe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(fr(e.x,t)).toVar(),s=se(fr(e.y,n)).toVar(),o=se(Mh(r)).toVar(),a=se(Mh(s)).toVar(),l=se(vee(no(Fi(t,n),r,s),no(Fi(t.add(fe(1)),n),r.sub(1),s),no(Fi(t,n.add(fe(1))),r,s.sub(1)),no(Fi(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return wee(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),Hwe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(fr(e.x,t)).toVar(),o=se(fr(e.y,n)).toVar(),a=se(fr(e.z,r)).toVar(),l=se(Mh(s)).toVar(),c=se(Mh(o)).toVar(),u=se(Mh(a)).toVar(),f=se(bee(no(Fi(t,n,r),s,o,a),no(Fi(t.add(fe(1)),n,r),s.sub(1),o,a),no(Fi(t,n.add(fe(1)),r),s,o.sub(1),a),no(Fi(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),no(Fi(t,n,r.add(fe(1))),s,o,a.sub(1)),no(Fi(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),no(Fi(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),no(Fi(t.add(fe(1)),n.add(fe(1)),r.add(fe(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return See(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),IU=Eo([qwe,Hwe]),Wwe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(fr(e.x,t)).toVar(),s=se(fr(e.y,n)).toVar(),o=se(Mh(r)).toVar(),a=se(Mh(s)).toVar(),l=pe(vee(lc(cc(t,n),r,s),lc(cc(t.add(fe(1)),n),r.sub(1),s),lc(cc(t,n.add(fe(1))),r,s.sub(1)),lc(cc(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return wee(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),jwe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(fr(e.x,t)).toVar(),o=se(fr(e.y,n)).toVar(),a=se(fr(e.z,r)).toVar(),l=se(Mh(s)).toVar(),c=se(Mh(o)).toVar(),u=se(Mh(a)).toVar(),f=pe(bee(lc(cc(t,n,r),s,o,a),lc(cc(t.add(fe(1)),n,r),s.sub(1),o,a),lc(cc(t,n.add(fe(1)),r),s,o.sub(1),a),lc(cc(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),lc(cc(t,n,r.add(fe(1))),s,o,a.sub(1)),lc(cc(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),lc(cc(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),lc(cc(t.add(fe(1)),n.add(fe(1)),r.add(fe(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return See(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),wb=Eo([Wwe,jwe]),Xwe=Ae(([i])=>{let e=se(i).toVar(),t=fe(ls(e)).toVar();return Qo(Fi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),$we=Ae(([i])=>{let e=ft(i).toVar(),t=fe(ls(e.x)).toVar(),n=fe(ls(e.y)).toVar();return Qo(Fi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Ywe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(ls(e.x)).toVar(),n=fe(ls(e.y)).toVar(),r=fe(ls(e.z)).toVar();return Qo(Fi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Kwe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(ls(e.x)).toVar(),n=fe(ls(e.y)).toVar(),r=fe(ls(e.z)).toVar(),s=fe(ls(e.w)).toVar();return Qo(Fi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Zwe=Eo([Xwe,$we,Ywe,Kwe]),Qwe=Ae(([i])=>{let e=se(i).toVar(),t=fe(ls(e)).toVar();return pe(Qo(Fi(t,fe(0))),Qo(Fi(t,fe(1))),Qo(Fi(t,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),Jwe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(ls(e.x)).toVar(),n=fe(ls(e.y)).toVar();return pe(Qo(Fi(t,n,fe(0))),Qo(Fi(t,n,fe(1))),Qo(Fi(t,n,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),eSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(ls(e.x)).toVar(),n=fe(ls(e.y)).toVar(),r=fe(ls(e.z)).toVar();return pe(Qo(Fi(t,n,r,fe(0))),Qo(Fi(t,n,r,fe(1))),Qo(Fi(t,n,r,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),tSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(ls(e.x)).toVar(),n=fe(ls(e.y)).toVar(),r=fe(ls(e.z)).toVar(),s=fe(ls(e.w)).toVar();return pe(Qo(Fi(t,n,r,s,fe(0))),Qo(Fi(t,n,r,s,fe(1))),Qo(Fi(t,n,r,s,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),$C=Eo([Qwe,Jwe,eSe,tSe]),YM=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=se(0).toVar(),c=se(1).toVar();return Ci(o,()=>{l.addAssign(c.mul(IU(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),YC=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=se(1).toVar();return Ci(o,()=>{l.addAssign(c.mul(wb(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),nSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar();return ft(YM(a,o,s,r),YM(a.add(pe(fe(19),fe(193),fe(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),iSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(YC(a,o,s,r)).toVar(),c=se(YM(a.add(pe(fe(19),fe(193),fe(17))),o,s,r)).toVar();return Lt(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),rSe=Ae(([i,e,t,n,r,s,o])=>{let a=fe(o).toVar(),l=se(s).toVar(),c=fe(r).toVar(),u=fe(n).toVar(),f=fe(t).toVar(),p=fe(e).toVar(),x=ft(i).toVar(),v=pe($C(ft(p.add(u),f.add(c)))).toVar(),w=ft(v.x,v.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=ft(ft(se(p),se(f)).add(w)).toVar(),T=ft(S.sub(x)).toVar();return Wt(a.equal(fe(2)),()=>Qi(T.x).add(Qi(T.y))),Wt(a.equal(fe(3)),()=>br(Qi(T.x),Qi(T.y))),pc(T,T)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),sSe=Ae(([i,e,t,n,r,s,o,a,l])=>{let c=fe(l).toVar(),u=se(a).toVar(),f=fe(o).toVar(),p=fe(s).toVar(),x=fe(r).toVar(),v=fe(n).toVar(),w=fe(t).toVar(),S=fe(e).toVar(),T=pe(i).toVar(),P=pe($C(pe(S.add(x),w.add(p),v.add(f)))).toVar();P.subAssign(.5),P.mulAssign(u),P.addAssign(.5);let R=pe(pe(se(S),se(w),se(v)).add(P)).toVar(),C=pe(R.sub(T)).toVar();return Wt(c.equal(fe(2)),()=>Qi(C.x).add(Qi(C.y)).add(Qi(C.z))),Wt(c.equal(fe(3)),()=>br(Qi(C.x),Qi(C.y),Qi(C.z))),pc(C,C)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),k1=Eo([rSe,sSe]),oSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(fr(s.x,o),fr(s.y,a)).toVar(),c=se(1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(l,u,f,o,a,r,n)).toVar();c.assign(Za(c,p))})}),Wt(n.equal(fe(0)),()=>{c.assign(Ea(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),aSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(fr(s.x,o),fr(s.y,a)).toVar(),c=ft(1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(l,u,f,o,a,r,n)).toVar();Wt(p.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(p)}).ElseIf(p.lessThan(c.y),()=>{c.y.assign(p)})})}),Wt(n.equal(fe(0)),()=>{c.assign(Ea(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),lSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(fr(s.x,o),fr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(l,u,f,o,a,r,n)).toVar();Wt(p.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(p)}).ElseIf(p.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(p)}).ElseIf(p.lessThan(c.z),()=>{c.z.assign(p)})})}),Wt(n.equal(fe(0)),()=>{c.assign(Ea(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=se(1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(c,f,p,x,o,a,l,r,n)).toVar();u.assign(Za(u,v))})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ea(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),uSe=Eo([oSe,cSe]),hSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=ft(1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(c,f,p,x,o,a,l,r,n)).toVar();Wt(v.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(v)}).ElseIf(v.lessThan(u.y),()=>{u.y.assign(v)})})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ea(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),fSe=Eo([aSe,hSe]),dSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(c,f,p,x,o,a,l,r,n)).toVar();Wt(v.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(v)}).ElseIf(v.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(v)}).ElseIf(v.lessThan(u.z),()=>{u.z.assign(v)})})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ea(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),NU=Eo([lSe,dSe]),pSe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=fe(i).toVar(),p=ft(e).toVar(),x=ft(t).toVar(),v=ft(n).toVar(),w=se(r).toVar(),S=se(s).toVar(),T=se(o).toVar(),P=Pl(a).toVar(),R=fe(l).toVar(),C=se(c).toVar(),L=se(u).toVar(),D=p.mul(x).add(v),F=se(0).toVar();return Wt(f.equal(fe(0)),()=>{F.assign(wb(D))}),Wt(f.equal(fe(1)),()=>{F.assign($C(D))}),Wt(f.equal(fe(2)),()=>{F.assign(NU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(YC(pe(D,0),R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(ru(F,S,T))}),F}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),ASe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=fe(i).toVar(),p=pe(e).toVar(),x=pe(t).toVar(),v=pe(n).toVar(),w=se(r).toVar(),S=se(s).toVar(),T=se(o).toVar(),P=Pl(a).toVar(),R=fe(l).toVar(),C=se(c).toVar(),L=se(u).toVar(),D=p.mul(x).add(v),F=se(0).toVar();return Wt(f.equal(fe(0)),()=>{F.assign(wb(D))}),Wt(f.equal(fe(1)),()=>{F.assign($C(D))}),Wt(f.equal(fe(2)),()=>{F.assign(NU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(YC(D,R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(ru(F,S,T))}),F}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),mSe=Ae(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return Wt(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(Sh(r)).mul(6).toVar();let s=fe(P7(r)),o=r.sub(se(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());Wt(s.equal(fe(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(fe(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(fe(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(fe(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(fe(4)),()=>{n.assign(pe(c,a,t))}).Else(()=>{n.assign(pe(t,a,l))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),gSe=Ae(([i])=>{let e=pe(i).toVar(),t=se(e.x).toVar(),n=se(e.y).toVar(),r=se(e.z).toVar(),s=se(Za(t,Za(n,r))).toVar(),o=se(br(t,br(n,r))).toVar(),a=se(o.sub(s)).toVar(),l=se().toVar(),c=se().toVar(),u=se().toVar();return u.assign(o),Wt(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),Wt(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Wt(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(cs(2,r.sub(t).div(a)))}).Else(()=>{l.assign(cs(4,t.sub(n).div(a)))}),l.mulAssign(1/6),Wt(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),_Se=Ae(([i])=>{let e=pe(i).toVar(),t=p7(v7(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(uc(br(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return jn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Eee=(i,e)=>{i=se(i),e=se(e);let t=ft(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Nl(i.sub(t),i.add(t),e)},Mee=(i,e,t,n)=>jn(i,e,t[n].clamp()),xSe=(i,e,t=Ri())=>Mee(i,e,t,"x"),ySe=(i,e,t=Ri())=>Mee(i,e,t,"y"),vSe=(i,e,t,n,r=Ri())=>{let s=r.x.clamp(),o=r.y.clamp(),a=jn(i,e,s),l=jn(t,n,s);return jn(a,l,o)},Cee=(i,e,t,n,r)=>jn(i,e,Eee(t,n[r])),bSe=(i,e,t,n=Ri())=>Cee(i,e,t,n,"x"),wSe=(i,e,t,n=Ri())=>Cee(i,e,t,n,"y"),SSe=(i=1,e=0,t=Ri())=>t.mul(i).add(e),TSe=(i,e=1)=>(i=se(i),i.abs().pow(e).mul(i.sign())),ESe=(i,e=1,t=.5)=>se(i).sub(t).mul(e).add(t),MSe=(i=Ri(),e=1,t=0)=>IU(i.convert("vec2|vec3")).mul(e).add(t),CSe=(i=Ri(),e=1,t=0)=>wb(i.convert("vec2|vec3")).mul(e).add(t),RSe=(i=Ri(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(wb(i),IU(i.add(ft(19,73)))).mul(e).add(t)),PSe=(i,e=Ri(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>pSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),ISe=(i,e=Ri(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>ASe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),NSe=(i=Ri(),e=1)=>uSe(i.convert("vec2|vec3"),e,fe(1)),LSe=(i=Ri(),e=1)=>fSe(i.convert("vec2|vec3"),e,fe(1)),DSe=(i=Ri(),e=1)=>NU(i.convert("vec2|vec3"),e,fe(1)),FSe=(i=Ri())=>Zwe(i.convert("vec2|vec3")),OSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>YM(i,fe(e),t,n).mul(r),BSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>nSe(i,fe(e),t,n).mul(r),USe=(i=Ri(),e=3,t=2,n=.5,r=1)=>YC(i,fe(e),t,n).mul(r),kSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>iSe(i,fe(e),t,n).mul(r),GSe=(i,e=se(0))=>cs(i,e),zSe=(i,e=se(0))=>ni(i,e),VSe=(i,e=se(1))=>bn(i,e),qSe=(i,e=se(1))=>Il(i,e),HSe=(i,e=se(1))=>CC(i,e),WSe=(i,e=se(1))=>uc(i,e),jSe=(i=se(0),e=se(1))=>T7(i,e),XSe=()=>U1,$Se=()=>WJ,YSe=(i,e=se(1))=>ni(e,i),KSe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),ZSe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),QSe=(i,e,t,n)=>i.equal(e).mix(t,n),JSe=(i,e=null)=>{if(typeof e=="string"){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},eTe=(i,e=ft(.5,.5),t=ft(1,1),n=se(0),r=ft(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){let o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=ft(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},tTe=(i,e)=>{i=ft(i),e=se(e);let t=e.mul(Math.PI/180);return yb(i,t)},nTe=(i,e,t)=>{i=pe(i),e=se(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=se(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},iTe=(i,e)=>(i=pe(i),e=se(e),nU(i,e)),rTe=Ae(([i,e,t])=>{let n=Zo(i).toVar(),r=ni(se(.5).mul(e.sub(t)),Eh).div(n).toVar(),s=ni(se(-.5).mul(e.sub(t)),Eh).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(se(0)).select(r.x,s.x),o.y=n.y.greaterThan(se(0)).select(r.y,s.y),o.z=n.z.greaterThan(se(0)).select(r.z,s.z);let a=Za(o.x,o.y,o.z).toVar();return Eh.add(n.mul(a)).toVar().sub(t)}),Ree=Ae(([i,e])=>{let t=i.x,n=i.y,r=i.z,s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(bn(t,t).sub(bn(n,n)))),s}),U=Object.freeze({__proto__:null,BRDF_GGX:_U,BRDF_Lambert:Im,BasicPointShadowFilter:gee,BasicShadowFilter:cee,Break:pJ,Const:kZ,Continue:cye,DFGLUT:ib,D_GGX:MJ,Discard:eQ,EPSILON:RC,F_Schlick:I1,Fn:Ae,HALF_PI:ixe,INFINITY:exe,If:Wt,Loop:Ci,NodeAccess:So,NodeShaderStage:p1,NodeType:L1e,NodeUpdateType:_n,OnBeforeFrameUpdate:iye,OnBeforeMaterialUpdate:nye,OnBeforeObjectUpdate:tye,OnFrameUpdate:oJ,OnMaterialUpdate:eye,OnObjectUpdate:xb,PCFShadowFilter:uee,PCFSoftShadowFilter:hee,PI:xM,PI2:txe,PointShadowFilter:_ee,Return:pxe,Schlick_to_F0:CF,ShaderNode:g1,Stack:SC,Switch:$1e,TBNViewMatrix:gm,TWO_PI:nxe,VSMShadowFilter:fee,V_GGX_SmithCorrelated:EJ,Var:UZ,VarIntent:GZ,abs:Qi,acesFilmicToneMapping:tee,acos:S7,acosh:pZ,add:cs,addMethodChaining:Be,addNodeElement:Axe,agxToneMapping:nee,all:rZ,alphaT:pM,ambientOcclusion:P8,and:HK,anisotropy:jp,anisotropyB:ym,anisotropyT:qv,any:sZ,append:K1e,array:OK,asin:fZ,asinh:dZ,assign:BK,atan:T7,atanh:AZ,atomicAdd:vbe,atomicAnd:Tbe,atomicFunc:Fh,atomicLoad:xbe,atomicMax:wbe,atomicMin:Sbe,atomicOr:Ebe,atomicStore:ybe,atomicSub:bbe,atomicXor:Mbe,attenuationColor:x7,attenuationDistance:_7,attribute:Rl,attributeArray:Eve,backgroundBlurriness:$J,backgroundIntensity:gO,backgroundRotation:YJ,batch:uJ,batchColor:uU,bentNormalView:PQ,billboarding:pve,bitAnd:$K,bitNot:YK,bitOr:KK,bitXor:ZK,bitangentGeometry:jxe,bitangentLocal:Xxe,bitangentView:CQ,bitangentWorld:$xe,bitcast:qJ,blendBurn:Ove,blendColor:Gve,blendDodge:Bve,blendOverlay:kve,blendScreen:Uve,blur:LJ,bool:Pl,buffer:O1,bufferAttribute:G7,builtin:Jf,builtinAOContext:OZ,builtinShadowContext:FZ,bumpMap:nU,bvec2:PK,bvec3:p7,bvec4:IK,bypass:QZ,cache:ZZ,call:UK,cameraFar:Yp,cameraIndex:l0,cameraNear:$p,cameraNormalMatrix:wxe,cameraPosition:oQ,cameraProjectionMatrix:Ta,cameraProjectionMatrixInverse:sQ,cameraViewMatrix:c0,cameraViewport:Sxe,cameraWorldMatrix:_b,cbrt:RZ,cdl:Wve,ceil:IC,checker:bwe,cineonToneMapping:eee,clamp:ru,clearcoat:hM,clearcoatNormalView:Kp,clearcoatRoughness:x1,clipSpace:cQ,code:WC,color:RK,colorSpaceToWorking:LC,colorToDirection:Zxe,compute:KZ,computeKernel:V7,computeSkinning:lye,context:Qf,convert:LK,convertColorSpace:axe,convertToTexture:bve,cos:Jc,cosh:cZ,countLeadingZeros:W2e,countOneBits:j2e,countTrailingZeros:H2e,cross:Yf,cubeTexture:Sa,cubeTextureBase:eU,dFdx:C7,dFdy:R7,dashSize:vm,debug:nQ,decrement:iZ,decrementBefore:tZ,defaultBuildStages:nM,defaultShaderStages:SK,defined:T1,degrees:aZ,deltaTime:ove,densityFogFactor:oee,depth:AU,depthPass:Kve,determinant:yZ,difference:SZ,diffuseColor:Mi,diffuseContribution:dm,directPointLight:yee,directionToColor:Kxe,directionToFaceDirection:Bxe,dispersion:y7,disposeShadowMaterial:pee,distance:wZ,div:Il,dot:pc,drawIndex:YZ,dynamicBufferAttribute:uxe,element:NK,emissive:R8,equal:kK,equirectDirection:bF,equirectUV:mU,exp:b7,exp2:E1,exponentialHeightFogFactor:abe,expression:Cl,faceDirection:Z7,faceForward:O7,faceforward:rxe,float:se,floatBitsToInt:z2e,floatBitsToUint:HJ,floor:Sh,fog:SO,fract:iu,frameGroup:Q1e,frameId:WJ,frontFacing:uQ,fwidth:I7,gain:$2e,gapSize:Qv,getConstNodeType:CK,getCurrentStack:h7,getDirection:IJ,getDistanceAttenuation:PU,getGeometryRoughness:TJ,getNormalFromDepth:Sve,getParallaxCorrectNormal:rTe,getRoughness:gU,getScreenPosition:wve,getShIrradianceAt:Ree,getShadowMaterial:dee,getShadowRenderObjectFunction:Aee,getTextureIndex:zJ,getViewPosition:m1,ggxConvolution:DJ,globalId:hbe,glsl:rbe,glslFn:sbe,grayscale:zve,greaterThan:v7,greaterThanEqual:qK,hash:X2e,highpModelNormalViewMatrix:K8,highpModelViewMatrix:Y8,hue:Hve,increment:nZ,incrementBefore:eZ,inspector:iQ,instance:lJ,instanceColor:cU,instanceIndex:nu,instancedArray:Mve,instancedBufferAttribute:FC,instancedDynamicBufferAttribute:z7,instancedMesh:cJ,int:fe,intBitsToFloat:V2e,interleavedGradientNoise:vU,inverse:vZ,inverseSqrt:w7,inversesqrt:sxe,invocationLocalIndex:dxe,invocationSubgroupIndex:fxe,ior:Hv,iridescence:EC,iridescenceIOR:fM,iridescenceThickness:dM,isolate:b1,ivec2:vr,ivec3:d7,ivec4:A7,js:nbe,label:BZ,length:Th,lengthSq:D7,lessThan:zK,lessThanEqual:VK,lightPosition:EU,lightProjectionUV:aee,lightShadowMatrix:XC,lightTargetDirection:CU,lightTargetPosition:lee,lightViewPosition:MU,lightingContext:mJ,lights:rwe,linearDepth:CM,linearToneMapping:QJ,localId:fbe,log:PC,log2:wh,logarithmicDepthToViewZ:pye,luminance:wU,mat2:TC,mat3:io,mat4:e0,matcapUV:FJ,materialAO:rJ,materialAlphaTest:NQ,materialAnisotropy:XQ,materialAnisotropyVector:A1,materialAttenuationColor:tJ,materialAttenuationDistance:eJ,materialClearcoat:zQ,materialClearcoatNormal:qQ,materialClearcoatRoughness:VQ,materialColor:LQ,materialDispersion:iJ,materialEmissive:FQ,materialEnvIntensity:rM,materialEnvRotation:SM,materialIOR:JQ,materialIridescence:$Q,materialIridescenceIOR:YQ,materialIridescenceThickness:KQ,materialLightMap:lU,materialLineDashOffset:aU,materialLineDashSize:sU,materialLineGapSize:oU,materialLineScale:rU,materialLineWidth:TM,materialMetalness:kQ,materialNormal:GQ,materialOpacity:iU,materialPointSize:nJ,materialReference:Wf,materialReflectivity:sM,materialRefractionRatio:dQ,materialRotation:HQ,materialRoughness:UQ,materialSheen:WQ,materialSheenRoughness:jQ,materialShininess:DQ,materialSpecular:OQ,materialSpecularColor:BQ,materialSpecularIntensity:aF,materialSpecularStrength:Wv,materialThickness:QQ,materialTransmission:ZQ,max:br,maxMipLevel:j7,mediumpModelViewMatrix:lQ,metalness:Xf,min:Za,mix:jn,mixElement:IZ,mod:CC,modelDirection:Ixe,modelNormalMatrix:aQ,modelPosition:Nxe,modelRadius:Fxe,modelScale:Lxe,modelViewMatrix:Rh,modelViewPosition:Dxe,modelViewProjection:sJ,modelWorldMatrix:hc,modelWorldMatrixInverse:Oxe,morphReference:AJ,mrt:VJ,mul:bn,mx_aastep:Eee,mx_add:GSe,mx_atan2:jSe,mx_cell_noise_float:FSe,mx_contrast:ESe,mx_divide:qSe,mx_fractal_noise_float:OSe,mx_fractal_noise_vec2:BSe,mx_fractal_noise_vec3:USe,mx_fractal_noise_vec4:kSe,mx_frame:$Se,mx_heighttonormal:iTe,mx_hsvtorgb:mSe,mx_ifequal:QSe,mx_ifgreater:KSe,mx_ifgreatereq:ZSe,mx_invert:YSe,mx_modulo:HSe,mx_multiply:VSe,mx_noise_float:MSe,mx_noise_vec3:CSe,mx_noise_vec4:RSe,mx_place2d:eTe,mx_power:WSe,mx_ramp4:vSe,mx_ramplr:xSe,mx_ramptb:ySe,mx_rgbtohsv:gSe,mx_rotate2d:tTe,mx_rotate3d:nTe,mx_safepower:TSe,mx_separate:JSe,mx_splitlr:bSe,mx_splittb:wSe,mx_srgb_texture_to_lin_rec709:_Se,mx_subtract:zSe,mx_timer:XSe,mx_transform_uv:SSe,mx_unifiednoise2d:PSe,mx_unifiednoise3d:ISe,mx_worley_noise_float:NSe,mx_worley_noise_vec2:LSe,mx_worley_noise_vec3:DSe,negate:M7,negateOnBackSide:km,neutralToneMapping:iee,nodeArray:xm,nodeImmutable:xt,nodeObject:Vt,nodeObjectIntent:kv,nodeObjects:wC,nodeProxy:Vn,nodeProxyConstructor:u7,nodeProxyIntent:lt,normalFlat:hQ,normalGeometry:OC,normalLocal:Jo,normalMap:sF,normalView:oi,normalViewGeometry:M1,normalWorld:u0,normalWorldGeometry:fQ,normalize:Zo,not:jK,notEqual:GK,numWorkgroups:cbe,objectDirection:Txe,objectGroup:FK,objectPosition:Mxe,objectRadius:Pxe,objectScale:Cxe,objectViewPosition:Rxe,objectWorldMatrix:Exe,oneMinus:mZ,or:WK,orthographicDepthToViewZ:_J,oscSawtooth:uve,oscSine:ave,oscSquare:lve,oscTriangle:cve,output:y1,outputStruct:U2e,overloadingFn:Eo,overrideNode:kJ,overrideNodes:GJ,packHalf2x16:J2e,packNormalToRGB:tU,packSnorm2x16:Z2e,packUnorm2x16:Q2e,parabola:lO,parallaxDirection:RQ,parallaxUV:Yxe,parameter:F2e,pass:$ve,passTexture:Yve,pcurve:Y2e,perspectiveDepthToViewZ:GC,pmremTexture:yU,pointShadow:xee,pointUV:Cve,pointWidth:Z1e,positionGeometry:$o,positionLocal:hr,positionPrevious:Pm,positionView:Jr,positionViewDirection:zi,positionWorld:Eh,positionWorldDirection:K7,posterize:jve,pow:uc,pow2:N7,pow3:TZ,pow4:L7,premultiplyAlpha:H7,property:Zf,quadBroadcast:Qbe,quadSwapDiagonal:jbe,quadSwapX:Hbe,quadSwapY:Wbe,radians:oZ,rand:PZ,range:lbe,rangeFogFactor:see,reciprocal:_Z,reference:tr,referenceBuffer:xQ,reflect:bZ,reflectVector:mQ,reflectView:pQ,reflector:xve,refract:F7,refractVector:gQ,refractView:AQ,reinhardToneMapping:JJ,remap:q7,remapClamp:JZ,renderGroup:Kt,renderOutput:W7,rendererReference:WZ,replaceDefaultUV:hve,rotate:yb,rotateUV:fve,roughness:vh,round:gZ,rtt:XJ,sRGBTransferEOTF:VZ,sRGBTransferOETF:qZ,sample:Tve,sampler:xxe,samplerComparison:yxe,saturate:NC,saturation:Vve,screenCoordinate:Um,screenDPR:$7,screenSize:Rm,screenUV:tu,select:Ko,setCurrentStack:Zv,setName:B7,shaderStages:iM,shadow:mee,shadowPositionWorld:RU,shapeCircle:wwe,sharedUniformGroup:MC,sheen:El,sheenRoughness:Xp,shiftLeft:QK,shiftRight:JK,shininess:AM,sign:E7,sin:wa,sinc:K2e,sinh:lZ,skinning:dJ,smoothstep:Nl,smoothstepElement:NZ,specularColor:i0,specularColorBlended:Am,specularF90:mm,spherizeUV:dve,split:Y1e,spritesheetUV:mve,sqrt:Ea,stack:aM,step:Mm,stepElement:LZ,storage:t0,storageBarrier:Abe,storageTexture:KJ,storageTexture3D:Pve,struct:B2e,sub:ni,subBuild:bm,subgroupAdd:Pbe,subgroupAll:zbe,subgroupAnd:Obe,subgroupAny:Vbe,subgroupBallot:Rbe,subgroupBroadcast:Xbe,subgroupBroadcastFirst:qbe,subgroupElect:Cbe,subgroupExclusiveAdd:Nbe,subgroupExclusiveMul:Fbe,subgroupInclusiveAdd:Ibe,subgroupInclusiveMul:Dbe,subgroupIndex:hxe,subgroupMax:Gbe,subgroupMin:kbe,subgroupMul:Lbe,subgroupOr:Bbe,subgroupShuffle:$be,subgroupShuffleDown:Zbe,subgroupShuffleUp:Kbe,subgroupShuffleXor:Ybe,subgroupSize:dbe,subgroupXor:Ube,tan:uZ,tangentGeometry:BC,tangentLocal:r0,tangentView:UC,tangentWorld:MQ,tanh:hZ,texture:ai,texture3D:bU,texture3DLevel:Lve,texture3DLoad:Nve,textureBarrier:mbe,textureBicubic:zye,textureBicubicLevel:xU,textureCubeUV:NJ,textureLevel:_xe,textureLoad:Qr,textureSize:Cm,textureStore:Rve,thickness:g7,time:U1,toneMapping:jZ,toneMappingExposure:XZ,toonOutlinePass:Zve,transformDirection:EZ,transformNormal:Q7,transformNormalByInverseViewMatrix:CZ,transformNormalByViewMatrix:MZ,transformNormalToView:J7,transformedClearcoatNormalView:Gxe,transformedNormalView:Uxe,transformedNormalWorld:kxe,transmission:mM,transpose:xZ,triNoise3D:rve,triplanarTexture:gve,triplanarTextures:jJ,trunc:P7,uint:it,uintBitsToFloat:q2e,uniform:Ht,uniformArray:wo,uniformCubeTexture:zxe,uniformFlow:DZ,uniformGroup:DK,uniformTexture:gxe,unpackHalf2x16:nve,unpackNormal:iF,unpackRGBToNormal:IQ,unpackSnorm2x16:eve,unpackUnorm2x16:tve,unpremultiplyAlpha:tQ,userData:Dve,uv:Ri,uvec2:f7,uvec3:Om,uvec4:m7,varying:a0,varyingProperty:Bm,vec2:ft,vec3:pe,vec4:Lt,vectorComponents:Fm,velocity:Fve,vertexColor:vJ,vertexIndex:$Z,vertexStage:zZ,vibrance:qve,viewZToLogarithmicDepth:zC,viewZToOrthographicDepth:wm,viewZToPerspectiveDepth:pU,viewZToReversedOrthographicDepth:dye,viewZToReversedPerspectiveDepth:xJ,viewport:S1,viewportCoordinate:rQ,viewportDepthTexture:dU,viewportLinearDepth:Aye,viewportMipTexture:fU,viewportOpaqueMipTexture:gJ,viewportResolution:bxe,viewportSafeUV:Ave,viewportSharedTexture:Xve,viewportSize:Y7,viewportTexture:hye,viewportUV:vxe,vogelDiskSample:eu,wgsl:ibe,wgslFn:obe,workgroupArray:gbe,workgroupBarrier:pbe,workgroupId:ube,workingToColorSpace:HZ,xor:XK}),Zc=new sb,LO=class extends Nh{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){let r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,o=!1;if(s===null)r._clearColor.getRGB(Zc),Zc.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Zc),Zc.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Zc.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let R=function(){s.removeEventListener("dispose",R),u.material.dispose(),u.geometry.dispose()},p=Lt(c).mul(gO).context({getUV:()=>YJ.mul(fQ),getTextureLevel:()=>$J}),x=Ta.element(3).element(3).equal(1),v=Il(1,Ta.element(1).element(1)).mul(3),w=x.select(hr.mul(v),hr),S=Rh.mul(Lt(w,0)),T=Ta.mul(Lt(S.xyz,1));T=T.setZ(T.w);let P=new pr;P.name="Background.material",P.side=ui,P.depthTest=!1,P.depthWrite=!1,P.allowOverride=!1,P.fog=!1,P.lights=!1,P.vertexNode=T,P.colorNode=p,l.backgroundMeshNode=p,l.backgroundMesh=u=new Hn(new da(1,32,32),P),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",R)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Lt(c).mul(gO),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else Ge("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?Zc.set(0,0,0,1):a==="alpha-blend"&&Zc.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Zc.r,l.g=Zc.g,l.b=Zc.b,l.a=Zc.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}},sTe=0,ub=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=sTe++}},DO=class{constructor(e,t,n,r,s,o,a,l,c,u,f=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=f,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=c,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new ub(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},KM=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},FO=class{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},ZM=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},OO=class extends ZM{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},BO=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},oTe=0,Yv=class{constructor(e=null){this.id=oTe++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},UO=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Dh=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},kO=class extends Dh{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},GO=class extends Dh{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},zO=class extends Dh{constructor(e,t=new ie){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},VO=class extends Dh{constructor(e,t=new gn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},qO=class extends Dh{constructor(e,t=new Ut){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},HO=class extends Dh{constructor(e,t=new w_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},WO=class extends Dh{constructor(e,t=new Sn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},jO=class extends Dh{constructor(e,t=new on){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},XO=class extends kO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},$O=class extends GO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},YO=class extends zO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},KO=class extends VO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},ZO=class extends qO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},QO=class extends HO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},JO=class extends WO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},eB=class extends jO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},aTe=0,WY=new WeakMap,jY=new WeakMap,lTe=new WeakMap,cTe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),zE=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),Pee=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(Pee(i.subBuildsCache[e]))return!0}return!1},QM=class{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=aM(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new Yv,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:aTe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===rs&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new la(e,t,n)}createCubeRenderTarget(e,t){return new RM(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4",n=this.renderer.getRenderTarget();if(n!==null){let r=n.textures[e].type,s=n.textures[e].format,o="vec";r===Ir?o="ivec":r===pi&&(o="uvec"),s===Lf||s===Xu?r===Ir?t="int":r===pi?t="uint":t="float":s===ws||s===$u?t=`${o}2`:s===Nf||s===m2?t=`${o}3`:t=`${o}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let n=t[0].groupNode,r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((f,p)=>f.nodeUniform.node.id-p.nodeUniform.node.id);for(let f of u.uniforms)o+=f.nodeUniform.node.id}else o+=u.nodeUniform.id;let a=this.renderer._currentRenderContext||this.renderer,l=WY.get(a);l===void 0&&(l=new Map,WY.set(a,l));let c=F1(o);s=l.get(c),s===void 0&&(s=new ub(e,t),l.set(c,s))}else s=new ub(e,t);return s}getBindGroupArray(e,t){let n=this.bindings[t],r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){let t={},n=this.bindings;for(let r of iM)for(let s in n[r]){let o=n[r][s],a=t[s]||(t[s]=[]);for(let l of o)a.includes(l)===!1&&a.push(l)}e=[];for(let r in t){let s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let n=e[t];this.bindingsIndexes[n.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==_n.NONE||n!==_n.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==_n.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==_n.NONE&&this.updateBeforeNodes.push(e),n!==_n.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===vi||e.magFilter===np||e.magFilter===Jl||e.magFilter===go||e.minFilter===vi||e.minFilter===np||e.minFilter===Jl||e.minFilter===go}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new Yv(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){je("Abstract function.")}getInstanceIndex(){je("Abstract function.")}getDrawIndex(){je("Abstract function.")}getFrontFacing(){je("Abstract function.")}getFragCoord(){je("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let s in r)if(Pee(r[s]))return!0}return!1}generateTexture(){je("Abstract function.")}generateTextureLod(){je("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){let o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){let r=[];for(let s of t){let{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new Ut:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new ie:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new gn)),e==="float")return zE(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${zE(t.r)}, ${zE(t.g)}, ${zE(t.b)} )`;let n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let n=this.attributes;for(let s of n)if(s.name===e)return s;let r=new KM(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?"float":t===Ir?"int":t===pi?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=vK(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return cTe.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let n=t.array,r=e.itemSize,s=e.normalized,o;return!(e instanceof f_)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){let t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=aM(this.stack);let e=h7();return this.stacks.push(e),Zv(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,Zv(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];if(this.subBuildLayers.length===0)return s;let o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){let n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t,n=null){let r=this.getDataFromNode(e,"vertex"),s=r.bufferAttribute;if(s===void 0){let o=this.uniforms.index++;n===null&&(n="nodeAttribute"+o),s=new KM(n,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){let s=this.getDataFromNode(e,r,this.globalCache),o=s.structType;if(o===void 0){let a=this.structs.index++;n===null&&(n="StructType"+a),o=new UO(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){let n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){let s=this.getDataFromNode(e,n,this.globalCache),o=s.uniform;if(o===void 0){let a=this.uniforms.index++;o=new FO(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){let o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds),l=o[a];if(l===void 0){let c=s?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),f=this.vars[c]||(this.vars[c]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+f,this.vars[c]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));let p=e.getArrayCount(this);l=new ZM(t,n,s,p),s||u.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){let o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds),l=o[a];if(l===void 0){let c=this.varyings,u=c.length;t===null&&(t="nodeVarying"+u),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new OO(t,n,r,s),c.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){let t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=e.name,s=r,o=this.getPropertyName(e),a=1;for(;n[o]!==void 0;)s=r+"_"+a++,e.name=s,o=this.getPropertyName(e);s!==r&&je(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){let r=this.getDataFromNode(e),s=r.code;if(s===void 0){let o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new BO("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e),s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(let a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){let r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;4160-`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,n=jY.get(t);n===void 0&&(n=new WeakMap,jY.set(t,n));let r=n.get(e);if(r===void 0){r=new WM;let s=this.currentFunctionNode;this.currentFunctionNode=r,r.code=this.buildFunctionCode(e),this.currentFunctionNode=s,n.set(e,r)}return r}flowShaderNode(e){let t=e.layout,n={[Symbol.iterator](){let o=0,a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(let o of t.inputs)n[o.name]=new UM(o.type,o.name);e.layout=null;let r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){let r=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){let n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,c={code:""};this.flow=c,this.vars={},this.declarations={},this.cache=new Yv,this.stack=aM();for(let u of nM)this.setBuildStage(u),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),c}getFunctionOperator(){return null}buildFunctionCode(){je("Abstract function.")}flowChildNode(e,t=null){let n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){let s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);let c={...this.context};delete c.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=c;let u=null;if(this.buildStage==="generate"){let f=this.flowChildNode(t,n);r!==null&&(f.code+=`${this.tab+r} = ${f.result};4157+`).removeFlowTab();e.addFlowTab()}},Ci=(...i)=>new dF(ym(i,"int")).toStack(),fye=()=>Cl("continue").toStack(),mJ=()=>Cl("break").toStack(),H6=new WeakMap,bl=new gn,hY=new WeakMap,fY=Ae(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=fe(ZK).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return Qr(i,vr(l,a)).depth(r).xyz.mul(e)});function dye(i){let e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0,o=H6.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),H6.delete(i),i.removeEventListener("dispose",T)};o!==void 0&&o.texture.dispose();let a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],c=i.morphAttributes.color||[],u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let f=i.attributes.position.count*u,p=1,x=4096;f>x&&(p=Math.ceil(f/x),f=x);let v=new Float32Array(f*p*4*s),w=new mA(v,f,p,s);w.type=Yi,w.needsUpdate=!0;let S=u*4;for(let P=0;P<s;P++){let R=a[P],C=l[P],L=c[P],D=f*p*4*P;for(let F=0;F<R.count;F++){let N=F*S;e===!0&&(bl.fromBufferAttribute(R,F),v[D+N+0]=bl.x,v[D+N+1]=bl.y,v[D+N+2]=bl.z,v[D+N+3]=0),t===!0&&(bl.fromBufferAttribute(C,F),v[D+N+4]=bl.x,v[D+N+5]=bl.y,v[D+N+6]=bl.z,v[D+N+7]=0),n===!0&&(bl.fromBufferAttribute(L,F),v[D+N+8]=bl.x,v[D+N+9]=bl.y,v[D+N+10]=bl.z,v[D+N+11]=L.itemSize===4?bl.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,p)},H6.set(i,o),i.addEventListener("dispose",T)}return o}var gJ=Ae(([i])=>{let{geometry:e}=i,t=e.morphAttributes.position!==void 0,n=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=r!==void 0?r.length:0;if(s===0)return;let o=hY.get(i);(o===void 0||o.count!==s)&&(o={base:Ht(1),influences:i.morphTargetInfluences?wo(i.morphTargetInfluences,"float"):null,count:s},hY.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=dye(e);t===!0&&hr.mulAssign(a),n===!0&&ea.mulAssign(a);let p=fe(f.width);Ci(s,({i:x})=>{let v=se(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?v.assign(Qr(i.morphTexture,vr(fe(x).add(1),fe(nu))).r):v.assign(l.element(x).toVar()),Wt(v.notEqual(0),()=>{t===!0&&hr.addAssign(fY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(0)})),n===!0&&ea.addAssign(fY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(1)}))})}),xb(({object:x})=>{let{base:v,influences:w}=o;x.geometry.morphTargetsRelative?v.value=1:v.value=1-x.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=x.morphTargetInfluences,w.update())})},"void"),s0=class extends $t{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},pF=class extends s0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},AF=class extends Jv{static get type(){return"LightingContextNode"}constructor(e,t=null,n=[],r=null,s=null){super(e),this.lightingModel=t,this.materialLightings=n,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:n}=this,r=pe().toVar("directDiffuse"),s=pe().toVar("directSpecular"),o=pe().toVar("indirectDiffuse"),a=pe().toVar("indirectSpecular"),l={directDiffuse:r,directSpecular:s,indirectDiffuse:o,indirectSpecular:a};return{radiance:pe().toVar("radiance"),irradiance:pe().toVar("irradiance"),iblIrradiance:pe().toVar("iblIrradiance"),ambientOcclusion:se(1).toVar("ambientOcclusion"),reflectedLight:l,materialLightings:e,backdrop:t,backdropAlpha:n}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},_J=Vn(AF),mF=class extends s0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},am=new Oe,R1=class extends Ac{static get type(){return"ViewportTextureNode"}constructor(e=tu,t=null,n=null){let r=null;n===null?(r=new yA,r.minFilter=go,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=_n.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;s===null?t.getDrawingBufferSize(am):s.getDrawingBufferSize?s.getDrawingBufferSize(am):am.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==am.width||o.image.height!==am.height)&&(o.image.width=am.width,o.image.height=am.height,o.needsUpdate=!0);let a=o.generateMipmaps;o.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(o),o.generateMipmaps=a}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},pye=Vn(R1).setParameterLength(0,3),dU=Vn(R1,null,null,{generateMipmaps:!0}).setParameterLength(0,3),Aye=dU(),xJ=(i=tu,e=null)=>Aye.sample(i,e),W6=null,gF=class extends R1{static get type(){return"ViewportDepthTextureNode"}constructor(e=tu,t=null,n=null){n===null&&(W6===null&&(W6=new os),n=W6),super(e,t,n)}},pU=Vn(gF).setParameterLength(0,3),su=class i extends $t{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===i.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,n=this.valueNode,r=null;if(t===i.DEPTH_BASE)n!==null&&(r=bJ().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=AU(Jr.z,$p,Yp):r=Sm(Jr.z,$p,Yp);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=GC(n,$p,Yp);r=Sm(s,$p,Yp)}else r=n;else r=Sm(Jr.z,$p,Yp);return r}};su.DEPTH_BASE="depthBase";su.DEPTH="depth";su.LINEAR_DEPTH="linearDepth";var Sm=(i,e,t)=>i.add(e).div(e.sub(t)),mye=(i,e,t)=>i.add(t).div(t.sub(e)),yJ=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),AU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),vJ=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),GC=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),zC=(i,e,t)=>{e=e.max(1e-6).toVar();let n=wh(i.negate().div(e)),r=wh(t.div(e));return n.div(r)},gye=(i,e,t)=>{let n=i.mul(PC(t.div(e)));return se(Math.E).pow(n).mul(e).negate()},bJ=Vn(su,su.DEPTH_BASE),mU=xt(su,su.DEPTH),CM=Vn(su,su.LINEAR_DEPTH).setParameterLength(0,1),_ye=CM(pU());mU.assign=i=>bJ(i);var Ph=class i extends $t{static get type(){return"ClippingNode"}constructor(e=i.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===i.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===i.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return Ae(()=>{let n=se().toVar("distanceToPlane"),r=se().toVar("distanceToGradient"),s=se(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=wo(t).setGroup(Zt);Ci(o,({i:c})=>{let u=l.element(c);n.assign(Jr.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(Nl(r.negate(),r,n))})}let a=e.length;if(a>0){let l=wo(e).setGroup(Zt),c=se(1).toVar("intersectionClipOpacity");Ci(a,({i:u})=>{let f=l.element(u);n.assign(Jr.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(Nl(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Mi.a.mulAssign(s),Mi.a.equal(0).discard()})()}setupDefault(e,t){return Ae(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=wo(t).setGroup(Zt);Ci(n,({i:o})=>{let a=s.element(o);Jr.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=wo(e).setGroup(Zt),o=Pl(!0).toVar("clipped");Ci(r,({i:a})=>{let l=s.element(a);o.assign(Jr.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),Ae(()=>{let r=wo(e).setGroup(Zt),s=Jf(t.getClipDistance());Ci(n,({i:o})=>{let a=r.element(o),l=Jr.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Ph.ALPHA_TO_COVERAGE="alphaToCoverage";Ph.DEFAULT="default";Ph.HARDWARE="hardware";var xye=()=>new Ph,yye=()=>new Ph(Ph.ALPHA_TO_COVERAGE),vye=()=>new Ph(Ph.HARDWARE),bye=.05,dY=Ae(([i])=>iu(bn(1e4,Sa(bn(17,i.x).add(bn(.1,i.y)))).mul(us(.1,Qi(Sa(bn(13,i.y).add(i.x))))))),pY=Ae(([i])=>dY(ft(dY(i.xy),i.z))),wye=Ae(([i])=>{let e=br(Th(R7(i.xyz)),Th(P7(i.xyz))),t=se(1).div(se(bye).mul(e)).toVar("pixScale"),n=ft(E1(Sh(wh(t))),E1(IC(wh(t)))),r=ft(pY(Sh(n.x.mul(i.xyz))),pY(Sh(n.y.mul(i.xyz)))),s=iu(wh(t)),o=us(bn(s.oneMinus(),r.x),bn(s,r.y)),a=Qa(s,s.oneMinus()),l=pe(o.mul(o).div(bn(2,a).mul(ni(1,a))),o.sub(bn(.5,a)).div(ni(1,a)),ni(1,ni(1,o).mul(ni(1,o)).div(bn(2,a).mul(ni(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return ru(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),_F=class extends bM{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new gn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},wJ=(i=0)=>new _F(i),pr=class extends ws{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(F1(t.slice(0,-4)),n.getCacheKey());return this.type+gb(e)}build(e){this.setup(e)}setupObserver(e){return new y8(e)}setup(e){e.context.setupNormal=()=>wm(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();e.addStack();let r=this.setupVertex(e),s=wm(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o,a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);let c=Lt(l,Mi.a).max(0);o=this.setupOutput(e,c),y1.assign(o);let u=this.outputNode!==null;if(u&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){let f=t.getMRT(),p=this.mrtNode;f!==null?(u&&y1.assign(o),o=f,p!==null&&(o=f.merge(p))):p!==null&&(o=p)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=l.convert(e.getOutputType())),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=yye():e.stack.addToStack(xye())}return r}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(vye()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=zC(Jr.z,$p,Yp):r=Sm(Jr.z,$p,Yp))}r!==null&&mU.assign(r).toStack()}setupPositionView(){return Rh.mul(hr).xyz}setupModelViewProjection(){return Ea.mul(Jr)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),aJ}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&gJ(t),t.isSkinnedMesh===!0&&AJ(t),this.displacementMap){let r=Wf("displacementMap","texture"),s=Wf("displacementScale","float"),o=Wf("displacementBias","float");hr.addAssign(ea.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&fJ(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&hJ(t),this.positionNode!==null&&hr.assign(wm(this.positionNode,"POSITION","vec3")),hr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&Pl(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):FQ;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(wJ())),t.instanceColor&&(r=uU.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=hU.mul(r)),Mi.assign(r);let s=this.opacityNode?se(this.opacityNode):rU;Mi.a.assign(Mi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?se(this.alphaTestNode):DQ,this.alphaToCoverage===!0?(Mi.a=Nl(o,o.add(N7(Mi.a)),Mi.a),Mi.a.lessThanEqual(0).discard()):Mi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Mi.a.lessThan(wye(hr)).discard(),e.isOpaque()&&Mi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Mi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):VQ}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Wf("envMap","cubeTexture"):Wf("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new mF(cU)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);return r&&r.isLightingNode&&t.push(r),e.context.ambientOcclusion&&t.push(new pF(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=oJ),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(I8.assign(t),e.context.ambientOcclusion=I8)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,o=this.lights===!0||this.lightsNode!==null,a=this.lights===!0?this.setupMaterialLightings(e):[],l=o?this.lightsNode||e.lightsNode:null,c=this.setupOutgoingLight(e);if(l&&(a.length>0||l.getScope().hasLights)){let u=this.setupLightingModel(e)||null;c=_J(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?jn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(P8.assign(pe(s||BQ)),c=c.add(P8)),c}setupFog(e,t){let n=e.fogNode;return n&&(y1.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return W7(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=ws.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},Sye=new kc,xF=class extends pr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Sye),this.setValues(e)}},Tye=new ky,yF=class extends pr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Tye),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?se(this.offsetNode):lU,t=this.dashScaleNode?se(this.dashScaleNode):sU,n=this.dashSizeNode?se(this.dashSizeNode):oU,r=this.gapSizeNode?se(this.gapSizeNode):aU;bm.assign(n),Qv.assign(r);let s=a0(Rl("lineDistance").mul(t));(e?s.add(e):s).mod(bm.add(Qv)).greaterThan(bm).discard()}};var oM=Um("vec3","worldStart"),vF=Um("vec3","worldEnd"),SJ=Um("float","lineDistance"),dm=Um("vec4","worldPos"),AY=Ae(({start:i,end:e})=>{let t=Ea.element(2).element(2),n=Ea.element(3).element(2);return t.greaterThan(0).select(n.negate().div(t.add(1)),n.mul(-.5).div(t)).sub(i.z).div(e.z.sub(i.z))},{start:"vec4",end:"vec4",return:"float"}),Eye=Ae(({p1:i,p2:e,p3:t,p4:n})=>{let r=i.sub(t),s=n.sub(t),o=e.sub(i),a=r.dot(s),l=s.dot(o),c=r.dot(o),u=s.dot(s),p=o.dot(o).mul(u).sub(l.mul(l)),v=a.mul(l).sub(c.mul(u)).div(p).clamp(),w=a.add(l.mul(v)).div(u).clamp();return ft(v,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),uJe=Ae(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=Rl("instanceStart"),r=Rl("instanceEnd"),s=Lt(Rh.mul(Lt(n,1))).toVar("start"),o=Lt(Rh.mul(Lt(r,1))).toVar("end"),a,l;e&&(a=se(Rl("instanceDistanceStart")).toVar("distanceStart"),l=se(Rl("instanceDistanceEnd")).toVar("distanceEnd")),t&&(oM.assign(s.xyz),vF.assign(o.xyz));let c=S1.z.div(S1.w),u=Ea.element(2).element(3).equal(-1);if(Wt(u,()=>{Wt(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=AY({start:s,end:o});o.assign(Lt(jn(s.xyz,o.xyz,T),o.w)),e&&l.assign(jn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=AY({start:o,end:s});s.assign(Lt(jn(o.xyz,s.xyz,T),s.w)),e&&a.assign(jn(l,a,T))})}),e){let T=i.dashScaleNode?se(i.dashScaleNode):sU,P=i.offsetNode?se(i.offsetNode):lU,R=Yo.y.lessThan(.5).select(T.mul(a),T.mul(l));R=R.add(P),SJ.assign(R)}let f=Ea.mul(s),p=Ea.mul(o),x=f.xyz.div(f.w),v=p.xyz.div(p.w),w=v.xy.sub(x.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Lt().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),P=jn(s.xyz,o.xyz,.5).normalize(),R=T.cross(P).normalize(),C=T.cross(R);dm.assign(Yo.y.lessThan(.5).select(s,o));let L=TM.mul(.5);dm.addAssign(Lt(Yo.x.lessThan(0).select(R.mul(L),R.mul(L).negate()),0)),e||(dm.addAssign(Lt(Yo.y.lessThan(.5).select(T.mul(L).negate(),T.mul(L)),0)),dm.addAssign(Lt(C.mul(L),0)),Wt(Yo.y.greaterThan(1).or(Yo.y.lessThan(0)),()=>{dm.subAssign(Lt(C.mul(2).mul(L),0))})),S.assign(Ea.mul(dm));let D=pe().toVar();D.assign(Yo.y.lessThan(.5).select(x,v)),S.z.assign(D.z.mul(S.w))}else{let T=ft(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(Yo.x.lessThan(0).select(T.negate(),T)),Wt(Yo.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(Yo.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(TM)),T.assign(T.div(S1.w.div(Y7))),S.assign(Yo.y.lessThan(.5).select(f,p)),T.assign(T.mul(S.w)),S.assign(S.add(Lt(T,0,0)))}return S})(),hJe=Ae(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ri();if(n){let a=i.dashSizeNode?se(i.dashSizeNode):oU,l=i.gapSizeNode?se(i.gapSizeNode):aU;bm.assign(a),Qv.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),SJ.mod(bm.add(Qv)).greaterThan(bm).discard()}let o=se(1).toVar("alpha");if(r){let a=dm.xyz.normalize().mul(1e5),l=vF.sub(oM),c=Eye({p1:oM,p2:vF,p3:pe(0,0,0),p4:a}),u=oM.add(l.mul(c.x)),f=a.mul(c.y),v=u.sub(f).length().div(TM);if(!n)if(t&&e.currentSamples>0){let w=v.fwidth();o.assign(Nl(w.negate().add(.5),w.add(.5),v).oneMinus())}else v.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),c=a.mul(a).add(l.mul(l)),u=se(c.fwidth()).toVar("dlen");Wt(s.y.abs().greaterThan(1),()=>{o.assign(Nl(u.oneMinus(),u.add(1),c).oneMinus())})}else Wt(s.y.abs().greaterThan(1),()=>{let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));a.mul(a).add(l.mul(l)).greaterThan(1).discard()});return o})();var Mye=new By,bF=class extends pr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Mye),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?se(this.opacityNode):rU;Mi.assign(LC(Lt(nU(oi),e),Wr))}},gU=Ae(([i=K7])=>{let e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return ft(e,t)}),wF=Ae(([i=Ri()])=>{let e=i.x.sub(.5).mul(Math.PI*2),t=i.y.sub(.5).mul(Math.PI),n=t.cos(),r=n.mul(e.cos()),s=t.sin(),o=n.mul(e.sin());return pe(r,s,o)}),RM=class extends ca{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Uu(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Gc(5,5,5),o=gU(K7),a=new pr;a.colorNode=ai(t,o,0),a.side=ui,a.blending=Xr;let l=new Hn(s,a),c=new Hd;c.add(l),t.minFilter===go&&(t.minFilter=vi);let u=new y_(1,10,this),f=e.getMRT();return e.setMRT(null),u.update(e,c),e.setMRT(f),t.minFilter=n,t.generateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},jv=new WeakMap,SF=class extends dr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ta(null);let t=new Uu;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=_n.RENDER}updateBefore(e){let{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){let o=s.mapping;if(o===ep||o===tp){if(jv.has(s)){let a=jv.get(s);mY(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(Cye(a)){let l=new RM(a.height);l.fromEquirectangularTexture(t,s),mY(l.texture,s.mapping),this._cubeTexture=l.texture,jv.set(s,l.texture),s.addEventListener("dispose",TJ)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function Cye(i){return i==null?!1:i.height>0}function TJ(i){let e=i.target;e.removeEventListener("dispose",TJ);let t=jv.get(e);t!==void 0&&(jv.delete(e),t.dispose())}function mY(i,e){e===ep?i.mapping=gl:e===tp&&(i.mapping=Ql)}var EJ=Vn(SF).setParameterLength(1),nb=class extends s0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=EJ(this.envNode)}},TF=class extends s0{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=se(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},P1=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},PM=class extends P1{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Lt(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Lt(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Mi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case PA:r.rgb.assign(jn(r.rgb,r.rgb.mul(s.rgb),Wv.mul(sM)));break;case qT:r.rgb.assign(jn(r.rgb,s.rgb,Wv.mul(sM)));break;case HT:r.rgb.addAssign(s.rgb.mul(Wv.mul(sM)));break;default:je("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},Rye=new Us,EF=class extends pr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Rye),this.setValues(e)}setupNormal(){return Gm(M1)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new TF(cU)),t}setupOutgoingLight(){return Mi.rgb}setupLightingModel(){return new PM}},I1=Ae(({f0:i,f90:e,dotVH:t})=>{let n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),Nm=Ae(i=>i.diffuseColor.mul(1/Math.PI)),Pye=()=>se(.25),Iye=Ae(({dotNH:i})=>AM.mul(se(.5)).add(1).mul(se(1/Math.PI)).mul(i.pow(AM))),Nye=Ae(({lightDirection:i})=>{let e=i.add(zi).normalize(),t=oi.dot(e).clamp(),n=zi.dot(e).clamp(),r=I1({f0:i0,f90:1,dotVH:n}),s=Pye(),o=Iye({dotNH:t});return r.mul(s).mul(o)}),IM=class extends PM{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=oi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(Nm({diffuseColor:Mi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(Nye({lightDirection:e})).mul(Wv))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Nm({diffuseColor:Mi}))),r.indirectDiffuse.mulAssign(t)}},Lye=new Aa,MF=class extends pr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Lye),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightingModel(){return new IM(!1)}},Dye=new TA,CF=class extends pr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(Dye),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightingModel(){return new IM}setupVariants(){let e=(this.shininessNode?se(this.shininessNode):OQ).max(1e-4);AM.assign(e);let t=this.specularNode||UQ;i0.assign(t)}},MJ=Ae(i=>{if(i.geometry.hasAttribute("normal")===!1)return se(0);let e=M1.dFdx().abs().max(M1.dFdy().abs());return e.x.max(e.y).max(e.z)}),_U=Ae(i=>{let{roughness:e}=i,t=MJ(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),CJ=Ae(({alpha:i,dotNL:e,dotNV:t})=>{let n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return Il(.5,r.add(s).max(RC))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),Fye=Ae(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{let l=a.mul(pe(i.mul(t),e.mul(n),o).length()),c=o.mul(pe(i.mul(r),e.mul(s),a).length());return Il(.5,l.add(c).max(RC))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),RJ=Ae(({alpha:i,dotNH:e})=>{let t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),Oye=se(1/Math.PI),Bye=Ae(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{let s=i.mul(e),o=pe(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return Oye.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),xU=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=oi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(zi).normalize(),u=s.dot(i).clamp(),f=s.dot(zi).clamp(),p=s.dot(c).clamp(),x=zi.dot(c).clamp(),v=I1({f0:e,f90:t,dotVH:x}),w,S;if(T1(o)&&(v=EC.mix(v,r)),T1(a)){let T=qv.dot(i),P=qv.dot(zi),R=qv.dot(c),C=vm.dot(i),L=vm.dot(zi),D=vm.dot(c);w=Fye({alphaT:pM,alphaB:l,dotTV:P,dotBV:L,dotTL:T,dotBL:C,dotNV:f,dotNL:u}),S=Bye({alphaT:pM,alphaB:l,dotNH:p,dotTH:R,dotBH:D})}else w=CJ({alpha:l,dotNL:u,dotNV:f}),S=RJ({alpha:l,dotNH:p});return v.mul(w).mul(S)}),Uye=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Ah=null,ib=Ae(({roughness:i,dotNV:e})=>{Ah===null&&(Ah=new xA(Uye,16,16,Ss,Li),Ah.name="DFG_LUT",Ah.minFilter=vi,Ah.magFilter=vi,Ah.wrapS=ko,Ah.wrapT=ko,Ah.generateMipmaps=!1,Ah.needsUpdate=!0);let t=ft(i,e);return ai(Ah,t).rg}),kye=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=xU({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=oi.dot(i).clamp(),c=oi.dot(zi).clamp(),u=ib({roughness:n,dotNV:c}),f=ib({roughness:n,dotNV:l}),p=e.mul(u.x).add(t.mul(u.y)),x=e.mul(f.x).add(t.mul(f.y)),v=u.x.add(u.y),w=f.x.add(f.y),S=se(1).sub(v),T=se(1).sub(w),P=e.add(e.oneMinus().mul(.047619)),R=p.mul(x).mul(P).div(se(1).sub(S.mul(T).mul(P).mul(P)).add(RC)),C=S.mul(T),L=R.mul(C);return a.add(L)}),PJ=Ae(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=ib({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),RF=Ae(({f:i,f90:e,dotVH:t})=>{let n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(pe(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),Gye=Ae(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=se(1).div(t),s=e.pow2().oneMinus().max(.0078125);return se(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),zye=Ae(({dotNV:i,dotNL:e})=>se(1).div(se(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),Vye=Ae(({lightDirection:i})=>{let e=i.add(zi).normalize(),t=oi.dot(i).clamp(),n=oi.dot(zi).clamp(),r=oi.dot(e).clamp(),s=Gye({roughness:Xp,dotNH:r}),o=zye({dotNV:n,dotNL:t});return El.mul(s).mul(o)}),gY=Ae(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=ft(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),qye=Ae(({f:i})=>{let e=i.length();return br(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),ME=Ae(({v1:i,v2:e})=>{let t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,br(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),j6=Ae(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{let l=s.sub(r).toVar(),c=a.sub(r).toVar(),u=l.cross(c),f=pe().toVar();return Wt(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let p=e.sub(i.mul(e.dot(i))).normalize(),x=i.cross(p).negate(),v=n.mul(io(p,x,i).transpose()).toVar(),w=v.mul(r.sub(t)).normalize().toVar(),S=v.mul(s.sub(t)).normalize().toVar(),T=v.mul(o.sub(t)).normalize().toVar(),P=v.mul(a.sub(t)).normalize().toVar(),R=pe(0).toVar();R.addAssign(ME({v1:w,v2:S})),R.addAssign(ME({v1:S,v2:T})),R.addAssign(ME({v1:T,v2:P})),R.addAssign(ME({v1:P,v2:w})),f.assign(pe(qye({f:R})))}),f}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]});var VC=1/6,IJ=i=>bn(VC,bn(i,bn(i,i.negate().add(3)).sub(3)).add(1)),PF=i=>bn(VC,bn(i,bn(i,bn(3,i).sub(6))).add(4)),NJ=i=>bn(VC,bn(i,bn(i,bn(-3,i).add(3)).add(3)).add(1)),IF=i=>bn(VC,uc(i,3)),_Y=i=>IJ(i).add(PF(i)),xY=i=>NJ(i).add(IF(i)),yY=i=>us(-1,PF(i).div(IJ(i).add(PF(i)))),vY=i=>us(1,IF(i).div(NJ(i).add(IF(i)))),bY=(i,e,t)=>{let n=i.uvNode,r=bn(n,e.zw).add(.5),s=Sh(r),o=iu(r),a=_Y(o.x),l=xY(o.x),c=yY(o.x),u=vY(o.x),f=yY(o.y),p=vY(o.y),x=ft(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),v=ft(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=ft(s.x.add(c),s.y.add(p)).sub(.5).mul(e.xy),S=ft(s.x.add(u),s.y.add(p)).sub(.5).mul(e.xy),T=_Y(o.y).mul(us(a.mul(i.sample(x).level(t)),l.mul(i.sample(v).level(t)))),P=xY(o.y).mul(us(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(P)},yU=Ae(([i,e])=>{let t=ft(i.size(fe(e))),n=ft(i.size(fe(e.add(1)))),r=Il(1,t),s=Il(1,n),o=bY(i,Lt(r,t),Sh(e)),a=bY(i,Lt(s,n),IC(e));return iu(e).mix(o,a)}),Hye=Ae(([i,e])=>{let t=e.mul(X7(i));return yU(i,t)}),wY=Ae(([i,e,t,n,r])=>{let s=pe(O7(e.negate(),Qo(i),Il(1,n))),o=pe(Th(r[0].xyz),Th(r[1].xyz),Th(r[2].xyz));return Qo(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),Wye=Ae(([i,e])=>i.mul(ru(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),jye=dU(),Xye=xJ(),SY=Ae(([i,e,t],{material:n})=>{let s=(n.side===ui?jye:Xye).sample(i),o=wh(Pm.x).mul(Wye(e,t));return yU(s,o)}),TY=Ae(([i,e,t])=>(Wt(t.notEqual(0),()=>{let n=PC(e).negate().div(t);return w7(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),$ye=Ae(([i,e,t,n,r,s,o,a,l,c,u,f,p,x,v])=>{let w,S;if(v){w=Lt().toVar(),S=pe().toVar();let L=u.sub(1).mul(v.mul(.025)),D=pe(u.sub(L),u,u.add(L));Ci({start:0,end:3},({i:F})=>{let N=D.element(F),B=wY(i,e,f,N,a),z=o.add(B),V=c.mul(l.mul(Lt(z,1))),H=ft(V.xy.div(V.w)).toVar();H.addAssign(1),H.divAssign(2),H.assign(ft(H.x,H.y.oneMinus()));let Z=SY(H,t,N);w.element(F).assign(Z.element(F)),w.a.addAssign(Z.a),S.element(F).assign(n.element(F).mul(TY(Th(B),p,x).element(F)))}),w.a.divAssign(3)}else{let L=wY(i,e,f,u,a),D=o.add(L),F=c.mul(l.mul(Lt(D,1))),N=ft(F.xy.div(F.w)).toVar();N.addAssign(1),N.divAssign(2),N.assign(ft(N.x,N.y.oneMinus())),w=SY(N,t,u),S=n.mul(TY(Th(L),p,x))}let T=S.rgb.mul(w.rgb),P=i.dot(e).clamp(),R=pe(PJ({dotNV:P,specularColor:r,specularF90:s,roughness:t})),C=S.r.add(S.g,S.b).div(3);return Lt(R.oneMinus().mul(T),w.a.oneMinus().mul(C).oneMinus())}),Yye=io(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Zye=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},EY=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Kye=(i,e)=>{let t=i.mul(2*Math.PI*1e-9),n=pe(54856e-17,44201e-17,52481e-17),r=pe(1681e3,1795300,2208400),s=pe(43278e5,93046e5,66121e5),o=se(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp()),a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=pe(a.x.add(o),a.y,a.z).div(10685e-11),Yye.mul(a)},MY=Ae(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=jn(i,e,Nl(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Wt(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=EY(s,i),u=I1({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),p=s.lessThan(i).select(Math.PI,0),x=se(Math.PI).sub(p),v=Zye(r.clamp(0,.9999)),w=EY(v,s.toVec3()),S=I1({f0:w,f90:1,dotVH:l}),T=pe(v.x.lessThan(s).select(Math.PI,0),v.y.lessThan(s).select(Math.PI,0),v.z.lessThan(s).select(Math.PI,0)),P=s.mul(n,l,2),R=pe(x).add(T),C=u.mul(S).clamp(1e-5,.9999),L=C.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(C)),N=u.add(D).toVar(),B=D.sub(f).toVar();return Ci({start:1,end:2,condition:"<=",name:"m"},({m:z})=>{B.mulAssign(L);let V=Kye(se(z).mul(P),se(z).mul(R)).mul(2);N.addAssign(B.mul(V))}),N.max(pe(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),wv=Ae(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=se(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=se(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),Sv=pe(.04),CE=se(1),NM=class extends P1{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=pe().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pe().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pe().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=pe().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pe().toVar("sheenSpecularIndirect")),this.iridescence===!0){let t=oi.dot(zi).clamp(),n=MY({outsideIOR:se(1),eta2:fM,cosTheta1:t,thinFilmThickness:dM,baseF0:i0}),r=MY({outsideIOR:se(1),eta2:fM,cosTheta1:t,thinFilmThickness:dM,baseF0:Mi.rgb});this.iridescenceFresnel=jn(n,r,Xf),this.iridescenceF0Dielectric=RF({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=RF({f:r,f90:1,dotVH:t}),this.iridescenceF0=jn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Xf)}if(this.transmission===!0){let t=Eh,n=lQ.sub(Eh).normalize(),r=u0,s=e.context;s.backdrop=$ye(r,n,vh,pm,mm,gm,t,hc,c0,Ea,Hv,_7,y7,x7,this.dispersion?v7:null),s.backdropAlpha=mM,Mi.a.mulAssign(jn(1,s.backdrop.a,mM))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=oi.dot(zi).clamp(),a=ib({roughness:vh,dotNV:o}),l=s?EC.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),p=l.add(l.oneMinus().mul(.047619)),x=c.mul(p).div(f.mul(p).oneMinus());e.addAssign(c),t.addAssign(x.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=oi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(Vye({lightDirection:e})));let o=wv({normal:oi,viewDir:zi,roughness:Xp}),a=wv({normal:oi,viewDir:e,roughness:Xp}),l=El.r.max(El.g).max(El.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=Zp.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(xU({lightDirection:e,f0:Sv,f90:CE,roughness:x1,normalView:Zp})))}n.directDiffuse.addAssign(s.mul(Nm({diffuseColor:pm}))),n.directSpecular.addAssign(s.mul(kye({lightDirection:e,f0:mm,f90:1,roughness:vh,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){let l=t.add(n).sub(r),c=t.sub(n).sub(r),u=t.sub(n).add(r),f=t.add(n).add(r),p=oi,x=zi,v=Jr.toVar(),w=gY({N:p,V:x,roughness:vh}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),P=io(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),R=mm.mul(T.x).add(gm.sub(mm).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(R).mul(j6({N:p,V:x,P:v,mInv:P,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(pm).mul(j6({N:p,V:x,P:v,mInv:io(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let C=Zp,L=gY({N:C,V:x,roughness:x1}),D=o.sample(L),F=a.sample(L),N=io(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Sv.mul(F.x).add(CE.sub(Sv).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(j6({N:C,V:x,P:v,mInv:N,p0:l,p1:c,p2:u,p3:f})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:n}=e.context,r=t.mul(Nm({diffuseColor:pm})).toVar();if(this.sheen===!0){let s=wv({normal:oi,viewDir:zi,roughness:Xp}),o=El.r.max(El.g).max(El.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){let{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(El,wv({normal:oi,viewDir:zi,roughness:Xp}))),this.clearcoat===!0){let S=Zp.dot(zi).clamp(),T=PJ({dotNV:S,specularColor:Sv,specularF90:CE,roughness:x1});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(T))}let s=pe().toVar("singleScatteringDielectric"),o=pe().toVar("multiScatteringDielectric"),a=pe().toVar("singleScatteringMetallic"),l=pe().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,gm,i0,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,gm,Mi.rgb,this.iridescenceF0Metallic);let c=jn(s,a,Xf),u=jn(o,l,Xf),f=s.add(o),p=pm.mul(f.oneMinus()),x=n.mul(1/Math.PI),v=t.mul(c).add(u.mul(x)).toVar(),w=p.mul(x).toVar();if(this.sheen===!0){let S=wv({normal:oi,viewDir:zi,roughness:Xp}),T=El.r.max(El.g).max(El.b).mul(S).oneMinus();v.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(v),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=oi.dot(zi).clamp().add(t),o=vh.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let n=Zp.dot(zi).clamp(),r=I1({dotVH:n,f0:Sv,f90:CE}),s=t.mul(hM.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(hM));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},CY=se(1),NF=se(-2),RE=se(.8),X6=se(-1),PE=se(.4),$6=se(2),IE=se(.305),Y6=se(3),RY=se(.21),Qye=se(4),PY=se(4),Jye=se(16),e2e=Ae(([i])=>{let e=pe(Qi(i)).toVar(),t=se(-1).toVar();return Wt(e.x.greaterThan(e.z),()=>{Wt(e.x.greaterThan(e.y),()=>{t.assign(Ko(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(Ko(i.y.greaterThan(0),1,4))})}).Else(()=>{Wt(e.z.greaterThan(e.y),()=>{t.assign(Ko(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(Ko(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),t2e=Ae(([i,e])=>{let t=ft().toVar();return Wt(e.equal(0),()=>{t.assign(ft(i.z,i.y).div(Qi(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(ft(i.x.negate(),i.z.negate()).div(Qi(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(ft(i.x.negate(),i.y).div(Qi(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(ft(i.z.negate(),i.y).div(Qi(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(ft(i.x.negate(),i.z).div(Qi(i.y)))}).Else(()=>{t.assign(ft(i.x,i.y).div(Qi(i.z)))}),bn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),n2e=Ae(([i])=>{let e=se(0).toVar();return Wt(i.greaterThanEqual(RE),()=>{e.assign(CY.sub(i).mul(X6.sub(NF)).div(CY.sub(RE)).add(NF))}).ElseIf(i.greaterThanEqual(PE),()=>{e.assign(RE.sub(i).mul($6.sub(X6)).div(RE.sub(PE)).add(X6))}).ElseIf(i.greaterThanEqual(IE),()=>{e.assign(PE.sub(i).mul(Y6.sub($6)).div(PE.sub(IE)).add($6))}).ElseIf(i.greaterThanEqual(RY),()=>{e.assign(IE.sub(i).mul(Qye.sub(Y6)).div(IE.sub(RY)).add(Y6))}).Else(()=>{e.assign(se(-2).mul(wh(bn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),LJ=Ae(([i,e])=>{let t=i.toVar();t.assign(bn(2,t).sub(1));let n=pe(t,1).toVar();return Wt(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),DJ=Ae(([i,e,t,n,r,s])=>{let o=se(t),a=pe(e),l=ru(n2e(o),NF,s),c=iu(l),u=Sh(l),f=pe(rb(i,a,u,n,r,s)).toVar();return Wt(c.notEqual(0),()=>{let p=pe(rb(i,a,u.add(1),n,r,s)).toVar();f.assign(jn(f,p,c))}),f}),rb=Ae(([i,e,t,n,r,s])=>{let o=se(t).toVar(),a=pe(e),l=se(e2e(a)).toVar(),c=se(br(PY.sub(o),0)).toVar();o.assign(br(o,PY));let u=se(E1(o)).toVar(),f=ft(t2e(a,l).mul(u.sub(2)).add(1)).toVar();return Wt(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(bn(3,Jye))),f.y.addAssign(bn(4,E1(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(ft(),ft())}),Z6=Ae(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=Jc(n),c=t.mul(l).add(r.cross(t).mul(Sa(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return rb(i,c,e,s,o,a)}),FJ=Ae(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})=>{let p=pe(Ko(e,t,Yf(t,n))).toVar();Wt(p.equal(pe(0)),()=>{p.assign(pe(n.z,0,n.x.negate()))}),p.assign(Qo(p));let x=pe().toVar();return x.addAssign(r.element(0).mul(Z6({theta:0,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Ci({start:fe(1),end:i},({i:v})=>{Wt(v.greaterThanEqual(s),()=>{mJ()});let w=se(o.mul(se(v))).toVar();x.addAssign(r.element(v).mul(Z6({theta:w.mul(-1),axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),x.addAssign(r.element(v).mul(Z6({theta:w,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Lt(x,1)}),i2e=Ae(([i])=>{let e=it(i).toVar();return e.assign(e.shiftLeft(it(16)).bitOr(e.shiftRight(it(16)))),e.assign(e.bitAnd(it(1431655765)).shiftLeft(it(1)).bitOr(e.bitAnd(it(2863311530)).shiftRight(it(1)))),e.assign(e.bitAnd(it(858993459)).shiftLeft(it(2)).bitOr(e.bitAnd(it(3435973836)).shiftRight(it(2)))),e.assign(e.bitAnd(it(252645135)).shiftLeft(it(4)).bitOr(e.bitAnd(it(4042322160)).shiftRight(it(4)))),e.assign(e.bitAnd(it(16711935)).shiftLeft(it(8)).bitOr(e.bitAnd(it(4278255360)).shiftRight(it(8)))),se(e).mul(23283064365386963e-26)}),r2e=Ae(([i,e])=>ft(se(i).div(se(e)),i2e(i))),s2e=Ae(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=Yf(e,r).toConst(),o=Ma(i.x).toConst(),a=bn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Jc(a)).toConst(),c=o.mul(Sa(a)).toVar(),u=bn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ma(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ma(br(0,l.mul(l).add(c.mul(c)).oneMinus()))));return Qo(pe(n.mul(f.x),n.mul(f.y),br(0,f.z)))}),OJ=Ae(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=pe(n).toVar(),c=pe(0).toVar(),u=se(0).toVar();return Wt(i.lessThan(.001),()=>{c.assign(rb(t,l,e,s,o,a))}).Else(()=>{let f=Ko(Qi(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),p=Qo(Yf(f,l)).toVar(),x=Yf(l,p).toVar();Ci({start:it(0),end:r},({i:v})=>{let w=r2e(v,r),S=s2e(w,pe(0,0,1),i),T=Qo(p.mul(S.x).add(x.mul(S.y)).add(l.mul(S.z))),P=Qo(T.mul(pc(l,T).mul(2)).sub(l)),R=br(pc(l,P),0);Wt(R.greaterThan(0),()=>{let C=rb(t,P,e,s,o,a);c.addAssign(C.mul(R)),u.addAssign(R)})}),Wt(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Lt(c,1)}),Jp=4,IY=[.125,.215,.35,.446,.526,.582],Am=20,o2e=512,Tv=new Vc(-1,1,1,-1,0,1),a2e=new Rr(90,1),NY=new Ut,K6=null,Q6=0,J6=0,l2e=new ie,LM=new WeakMap,c2e=[3,1,5,0,4,2],e8=LJ(Ri(),Rl("faceIndex")).normalize(),qC=pe(e8.x,e8.y,e8.z),LF=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=l2e,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');K6=this._renderer.getRenderTarget(),Q6=this._renderer.getActiveCubeFace(),J6=this._renderer.getActiveMipmapLevel();let c=l||this._allocateTarget(!0);return this._init(c),this._sceneToCubeUV(e,n,r,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return Zn('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return Zn('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return Zn('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=DY(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=FY(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===gl||e.mapping===Ql?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(K6,Q6,J6),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),K6=this._renderer.getRenderTarget(),Q6=this._renderer.getActiveCubeFace(),J6=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget(!1);return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize;return LY(t,n,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=LY(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=u2e(t)),this._blurMaterial=h2e(t,e.width,e.height),this._ggxMaterial=f2e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Kn,e);await this._renderer.compile(t,Tv)}_sceneToCubeUV(e,t,n,r,s){let o=a2e;o.near=t,o.far=n;let a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],c=this._renderer,u=c.autoClear;c.getClearColor(NY),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Gc,new Us({name:"PMREM.Background",side:ui,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,p=f.material,x=!1,v=e.background;v?v.isColor&&(p.color.copy(v),e.background=null,x=!0):(p.color.copy(NY),x=!0),c.setRenderTarget(r),c.clear(),x&&c.render(f,o);for(let w=0;w<6;w++){let S=w%3;S===0?(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[w],s.y,s.z)):S===1?(o.up.set(0,0,a[w]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[w],s.z)):(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[w]));let T=this._cubeSize;this._setViewport(r,S*T,w>2?T:0,T,T),c.render(e,o)}c.autoClear=u,e.background=v}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===gl||e.mapping===Ql;r?this._cubemapMaterial===null&&(this._cubemapMaterial=DY(e)):this._equirectMaterial===null&&(this._equirectMaterial=FY(e));let s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let o=this._lodMeshes[0];o.material=s;let a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,Tv)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=LM.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),p=0+c*1.25,x=f*p,{_lodMax:v}=this,w=this._sizeLods[n],S=3*w*(n>v-Jp?n-v+Jp:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Tv),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Tv)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Ge("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let p=LM.get(c),x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*Am-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):Am;S>Am&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Am}`);let T=[],P=0;for(let F=0;F<Am;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?P+=B:F<S&&(P+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/P;e.texture.frame=(e.texture.frame||0)+1,p.envMap.value=e.texture,p.samples.value=S,p.weights.array=T,p.latitudinal.value=o==="latitudinal"?1:0,a&&(p.poleAxis.value=a);let{_lodMax:R}=this;p.dTheta.value=v,p.mipInt.value=R-n;let C=this._sizeLods[r],L=3*C*(r>R-Jp?r-R+Jp:0),D=4*(this._cubeSize-C);this._setViewport(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,Tv)}_setViewport(e,t,n,r,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-n,r,s),e.scissor.set(t,e.height-s-n,r,s)):(e.viewport.set(t,n,r,s),e.scissor.set(t,n,r,s))}};function u2e(i){let e=[],t=[],n=[],r=i,s=i-Jp+1+IY.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Jp?l=IY[o-i+Jp-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],x=6,v=6,w=3,S=2,T=1,P=new Float32Array(w*v*x),R=new Float32Array(S*v*x),C=new Float32Array(T*v*x);for(let D=0;D<x;D++){let F=D%3*2/3-1,N=D>2?0:-1,B=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0],z=c2e[D];P.set(B,w*v*z),R.set(p,S*v*z);let V=[z,z,z,z,z,z];C.set(V,T*v*z)}let L=new Kn;L.setAttribute("position",new Ni(P,w)),L.setAttribute("uv",new Ni(R,S)),L.setAttribute("faceIndex",new Ni(C,T)),n.push(new Hn(L,null)),r>Jp&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function LY(i,e,t){let n={magFilter:vi,minFilter:vi,generateMipmaps:!1,type:Li,format:xr,colorSpace:Gd,depthBuffer:t},r=new ca(i,e,n);return r.texture.mapping=Hu,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function HC(i){let e=new pr;return e.depthTest=!1,e.depthWrite=!1,e.blending=Xr,e.name=`PMREM_${i}`,e}function h2e(i,e,t){let n=wo(new Array(Am).fill(0)),r=Ht(new ie(0,1,0)),s=Ht(0),o=se(Am),a=Ht(0),l=Ht(1),c=ai(),u=Ht(0),f=se(1/e),p=se(1/t),x=se(i),v={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:qC,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:x},w=HC("blur");return w.fragmentNode=FJ({...v,latitudinal:a.equal(1)}),LM.set(w,v),w}function f2e(i,e,t){let n=ai(),r=Ht(0),s=Ht(0),o=se(1/e),a=se(1/t),l=se(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=HC("ggx");return u.fragmentNode=OJ({...c,N_immutable:qC,GGX_SAMPLES:it(o2e)}),LM.set(u,c),u}function DY(i){let e=HC("cubemap");return e.fragmentNode=Ta(i,qC),e}function FY(i){let e=HC("equirect");return e.fragmentNode=ai(i,gU(qC),0),e}var OY=new WeakMap;function d2e(i){let e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function p2e(i,e,t){let n=A2e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(m2e(o))r=t.fromCubemap(i,r);else return null;else if(g2e(o))r=t.fromEquirectangular(i,r);else return null;if(r.pmremVersion=i.pmremVersion,n.has(i)===!1){let a=()=>{i.removeEventListener("dispose",a);let l=n.get(i);l!==void 0&&(l.dispose(),n.delete(i))};i.addEventListener("dispose",a)}n.set(i,r)}return r.texture}function A2e(i){let e=OY.get(i);return e===void 0&&(e=new WeakMap,OY.set(i,e)),e}var DF=class extends dr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new bs;r.isRenderTargetTexture=!0,this._texture=ai(r),this._width=Ht(0),this._height=Ht(0),this._maxMip=Ht(0),this.updateBeforeType=_n.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=d2e(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0||r.mapping===Hu?t=r:t=p2e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new LF(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?SM.mul(pe(t.x,t.y.negate(),t.z)):SM.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),DJ(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function m2e(i){if(i==null)return!1;let e=0,t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function g2e(i){return i==null?!1:i.height>0}var vU=Vn(DF).setParameterLength(1,3),BY=new WeakMap,FF=class extends s0{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){let f=n.isTextureNode?n.value:t[n.property],p=this._getPMREMNodeCache(e.renderer),x=p.get(f);x===void 0&&(x=vU(f),p.set(f,x)),n=x}let s=t.useAnisotropy===!0||t.anisotropy>0?NQ:oi,o=n.context(UY(vh,s)).mul(rM),a=n.context(_2e(u0)).mul(Math.PI).mul(rM),l=b1(o),c=b1(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(UY(x1,Zp)).mul(rM),p=b1(f);u.addAssign(p)}}_getPMREMNodeCache(e){let t=BY.get(e);return t===void 0&&(t=new WeakMap,BY.set(e,t)),t}},UY=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=zi.negate().reflect(e),t=D7(i).mix(t,e).normalize(),t=t.transformDirection(_b)),t),getTextureLevel:()=>i}},_2e=i=>({getUV:()=>i,getTextureLevel:()=>se(1)}),x2e=new x_,DM=class extends pr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(x2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new FF(t):null}setupLightingModel(){return new NM}setupSpecular(){let e=jn(pe(.04),Mi.rgb,Xf);i0.assign(pe(.04)),mm.assign(e),gm.assign(1)}setupVariants(){let e=this.metalnessNode?se(this.metalnessNode):zQ;Xf.assign(e);let t=this.roughnessNode?se(this.roughnessNode):GQ;t=_U({roughness:t}),vh.assign(t),this.setupSpecular(),pm.assign(Mi.rgb.mul(e.oneMinus()))}},y2e=new Fy,OF=class extends DM{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(y2e),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?se(this.iorNode):tJ;Hv.assign(e),i0.assign(Qa(L7(Hv.sub(1).div(Hv.add(1))).mul(kQ),pe(1)).mul(lF)),mm.assign(jn(i0,Mi.rgb,Xf)),gm.assign(jn(lF,1,Xf))}setupLightingModel(){return new NM(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?se(this.clearcoatNode):qQ,n=this.clearcoatRoughnessNode?se(this.clearcoatRoughnessNode):HQ;hM.assign(t),x1.assign(_U({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):XQ,n=this.sheenRoughnessNode?se(this.sheenRoughnessNode):$Q;El.assign(t),Xp.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?se(this.iridescenceNode):ZQ,n=this.iridescenceIORNode?se(this.iridescenceIORNode):KQ,r=this.iridescenceThicknessNode?se(this.iridescenceThicknessNode):QQ;EC.assign(t),fM.assign(n),dM.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?ft(this.anisotropyNode):YQ).toVar();jp.assign(t.length()),Wt(jp.equal(0),()=>{t.assign(ft(1,0))}).Else(()=>{t.divAssign(ft(jp)),jp.assign(jp.saturate())}),pM.assign(jp.pow2().mix(vh.pow2(),1)),qv.assign(_m[0].mul(t.x).add(_m[1].mul(t.y))),vm.assign(_m[1].mul(t.x).sub(_m[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?se(this.transmissionNode):JQ,n=this.thicknessNode?se(this.thicknessNode):eJ,r=this.attenuationDistanceNode?se(this.attenuationDistanceNode):nJ,s=this.attenuationColorNode?pe(this.attenuationColorNode):iJ;if(mM.assign(t),_7.assign(n),x7.assign(r),y7.assign(s),this.useDispersion){let o=this.dispersionNode?se(this.dispersionNode):sJ;v7.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):WQ}setup(e){e.context.setupClearcoatNormal=()=>wm(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var v2e=Ae(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=ft(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Wf("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return jn(pe(.7),pe(1),Nl(se(.7).sub(s.x),se(.7).add(s.x),r.x))}}),BF=class extends P1{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=v2e({normal:OC,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Nm({diffuseColor:Mi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Nm({diffuseColor:Mi}))),r.indirectDiffuse.mulAssign(t)}},b2e=new Oy,UF=class extends pr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(b2e),this.setValues(e)}setupLightingModel(){return new BF}},BJ=Ae(()=>{let i=pe(zi.z,0,zi.x.negate()).normalize(),e=zi.cross(i);return ft(i.dot(oi),e.dot(oi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),w2e=new Uy,kF=class extends pr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(w2e),this.setValues(e)}setupVariants(e){let t=BJ,n;e.material.matcap?n=Wf("matcap","texture").context({getUV:()=>t}):n=pe(jn(.2,.8,t.y)),Mi.rgb.mulAssign(n.rgb)}},GF=class extends dr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){let s=t.cos(),o=t.sin();return TC(s,o,o.negate(),s).mul(n)}else{let s=t,o=e0(Lt(1,0,0,0),Lt(0,Jc(s.x),Sa(s.x).negate(),0),Lt(0,Sa(s.x),Jc(s.x),0),Lt(0,0,0,1)),a=e0(Lt(Jc(s.y),0,Sa(s.y),0),Lt(0,1,0,0),Lt(Sa(s.y).negate(),0,Jc(s.y),0),Lt(0,0,0,1)),l=e0(Lt(Jc(s.z),Sa(s.z).negate(),0,0),Lt(Sa(s.z),Jc(s.z),0,0),Lt(0,0,1,0),Lt(0,0,0,1));return o.mul(a).mul(l).mul(Lt(n,1)).xyz}}},yb=Vn(GF).setParameterLength(2),S2e=new Wd,FM=class extends pr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(S2e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Rh.mul(pe(r||0)),c=ft(hc[0].xyz.length(),hc[1].xyz.length());o!==null&&(c=c.mul(ft(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=Yo.xy;if(t.center&&t.center.isVector2===!0){let x=fxe("center","vec2",t);u=u.sub(x.sub(.5))}u=u.mul(c);let f=se(s||jQ),p=yb(u,f);return Lt(l.xy.add(p),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},T2e=new Xd,E2e=new Oe,zF=class extends FM{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(T2e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Rh.mul(pe(e||hr)).xyz}setupVertexSprite(e){let{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this,l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let c=o!==null?ft(o):rJ;c=c.mul(Y7),n.isPerspectiveCamera&&a===!0&&(c=c.mul(M2e.div(Jr.z.negate()))),s&&s.isNode&&(c=c.mul(ft(s)));let u=Yo.xy;if(r&&r.isNode){let f=se(r);u=yb(u,f)}return u=u.mul(c),u=u.div(Z7.div(2)),u=u.mul(l.w),l=l.add(Lt(u,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},M2e=Ht(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(E2e);this.value=.5*e.y}),VF=class extends P1{constructor(){super(),this.shadowNode=se(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Mi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Mi.rgb)}},C2e=new Dy,qF=class extends pr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(C2e),this.setValues(e)}setupLightingModel(){return new VF}},fJe=Kf("vec3"),dJe=Kf("vec3"),pJe=Kf("vec3");var HF=class{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Ih=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){let s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},R2e=0,kY=new WeakMap;function P2e(i){let e=Object.keys(i),t=kY.get(i.constructor);if(t===void 0){t=[];let n=Object.getPrototypeOf(i);for(;n;){let r=Object.getOwnPropertyDescriptors(n);for(let s in r){let o=r[s];o&&typeof o.get=="function"&&t.push(s)}n=Object.getPrototypeOf(n)}kY.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var WF=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=R2e++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=c,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=n._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(let o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),a!==void 0&&(a.isInterleavedBufferAttribute?s[o.name]=a.data.uuid:s[o.name]=a.id)),a===void 0)continue;n.push(a);let l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null,c=1;if(n.isInstancedBufferGeometry===!0?c=n.instanceCount:e.count!==void 0&&(c=Math.max(0,e.count)),c===0)return null;if(o.instanceCount=c,e.isBatchedMesh===!0)return o;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let f=s.start*u,p=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),p=Math.min(p,(r.start+r.count)*u));let x=n.attributes.position,v=1/0;l?v=a.count:x!=null&&(v=x.count),f=Math.max(f,0),p=Math.min(p,v);let w=p-f;return w<0||w===1/0?null:(o.vertexCount=w,o.firstVertex=f,o)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let n of Object.keys(e.attributes).sort()){let r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(let n of Object.keys(e.morphAttributes).sort()){let r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){let a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:n}=this,r=t.customProgramCacheKey();for(let s of P2e(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let o=t[s],a;if(o!==null){let l=typeof o;l==="number"?s==="side"?a=String(o):a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",F1(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let n=this.geometry.getAttribute(t);if(n===void 0)return!0;let r=n.isInterleavedBufferAttribute?n.data.uuid:n.id;if(e[t]!==r)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=zv(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=zv(e,1)),e=zv(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}},mh=[],jF=class{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){let c=this.getChainMap(l);mh[0]=e,mh[1]=t,mh[2]=o,mh[3]=s;let u=c.get(mh);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(mh,u)):(u.camera=r,u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,s,o,a,l)):u.version=t.version)),mh[0]=null,mh[1]=null,mh[2]=null,mh[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ih)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let p=this.getChainMap(f),x=new WF(e,t,n,r,s,o,a,l,c,u);return x.onDispose=()=>{this.pipelines.delete(x),this.bindings.deleteForRender(x),this.nodes.delete(x),p.delete(x.getChainArray())},x}},Nh=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},fc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Kp=16,I2e=211,N2e=212,XF=class extends Nh{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let n=this.get(e);if(n.version===void 0)t===fc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===fc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===fc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===fc.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),n.version=this._getBufferAttribute(e).version;else{let r=this._getBufferAttribute(e);(n.version<r.version||r.usage===GA)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function UJ(i){return i.index!==null?i.index.version:i.attributes.position.version}function kJ(i){return i.index!==null?i.index.id:i.attributes.position.id}function GY(i){let e=[],t=i.index,n=i.attributes.position;if(t!==null){let s=t.array;for(let o=0,a=s.length;o<a;o+=3){let l=s[o+0],c=s[o+1],u=s[o+2];e.push(l,c,c,u,u,l)}}else{let s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){let l=o+0,c=o+1,u=o+2;e.push(l,c,c,u,u,l)}}let r=new(n.count>=65535?_A:gA)(e,1);return r.version=UJ(i),r.__id=kJ(i),r}var $F=class extends Nh{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(let l of o)this.attributes.delete(l);let a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,fc.STORAGE):this.updateAttribute(s,fc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,fc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,fc.INDIRECT)}updateAttribute(e,t){let n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:n}=e,r=t.index;if(n.wireframe===!0){let s=this.wireframes,o=s.get(t);o===void 0?(o=GY(t),s.set(t,o)):(o.version!==UJ(t)||o.__id!==kJ(t))&&(this.attributes.delete(o),o=GY(t),s.set(t,o)),r=o}return r}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}},YF=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):Ge("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let n=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:n,type:t}),this.memory[t]++,this.memory.total+=n,this.memory[t+"Size"]+=n}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===Wu||e.type===Gi?t=1:e.type===ju||e.type===Wa||e.type===Li?t=2:(e.type===Ir||e.type===pi||e.type===Yi)&&(t=4);let n=4;e.format===S_||e.format===Lf||e.format===Xu||e.format===ys||e.format===Qs?n=1:e.format===Ss||e.format===$u?n=2:(e.format===Nf||e.format===m2)&&(n=3);let r=t*n;e.type===IA||e.type===NA?r=2:(e.type===zo||e.type===LA||e.type===DA)&&(r=4);let s=e.width||1,o=e.height||1,a=e.isCubeTexture?6:e.depth||1,l=s*o*a*r,c=e.mipmaps;if(c&&c.length>0){let u=0;for(let f=0;f<c.length;f++){let p=c[f];if(p.data)u+=p.data.byteLength;else{let x=p.width||Math.max(1,s>>f),v=p.height||Math.max(1,o>>f);u+=x*v*a*r}}l+=u}else e.generateMipmaps&&(l=l*1.333);return Math.round(l)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},OM=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},ZF=class extends OM{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},KF=class extends OM{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},L2e=0,Xv=class{constructor(e,t,n,r=null,s=null){this.id=L2e++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},QF=class extends Nh{constructor(e,t,n){super(),this.backend=e,this.nodes=t,this.info=n,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let o=this.nodes.getForCompute(e),a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new Xv(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a),this.info.createProgram(a));let l=this._getComputeCacheKey(e,a),c=this.caches.get(l);c===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),c=this._getComputePipeline(e,a,l,t)),c.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=c}return r.pipeline}getForRender(e,t=null){let{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let o=e.getNodeBuilderState(),a=e.material?e.material.name:"",l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new Xv(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l),this.info.createProgram(l));let c=this.programs.fragment.get(o.fragmentShader);c===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),c=new Xv(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,c),n.createProgram(c),this.info.createProgram(c));let u=this._getRenderCacheKey(e,l,c),f=this.caches.get(u);f===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),f=this._getRenderPipeline(e,l,c,u,t)):e.pipeline=f,f.usedTimes++,l.usedTimes++,c.usedTimes++,r.pipeline=f}return r.pipeline}isReady(e){let n=this.get(e).pipeline;if(n===void 0)return!1;let r=this.backend.get(n);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new KF(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new ZF(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,n=e.stage;this.programs[n].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},JF=class extends Nh{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),n=this.get(e);return n.initialized!==!0&&(this._createBindings(t),n.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,n=this.get(e);return(n.initialized!==!0||n.bindings!==t)&&(n.bindings!==void 0&&this._destroyBindings(n.bindings),this._createBindings(t),n.initialized=!0,n.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let n=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(n),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let n=this.get(t);if(n.bindGroup===void 0){for(let r of t.bindings)if(r.isUniformBuffer)this.backend.createUniformBuffer(r),this.info.createUniformBuffer(r);else if(r.isSampledTexture)this.textures.updateTexture(r.texture);else if(r.isSampler)this.textures.updateSampler(r);else if(r.isStorageBuffer){let s=r.attribute,o=s.isIndirectStorageBufferAttribute?fc.INDIRECT:fc.STORAGE;this.attributes.update(s,o)}this.backend.createBindings(t,e,0),n.bindGroup=t,n.usedTimes=1}else n.usedTimes++}}_destroyBindings(e){for(let t of e){let n=this.get(t);if(n.usedTimes--,n.usedTimes===0){for(let r of t.bindings)r.isUniformBuffer?(this.backend.destroyUniformBuffer(r),this.info.destroyUniformBuffer(r),r.release()):r.isSampler&&(r.isSampledTexture!==!0&&this.backend.destroySampler(r),r.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:n}=this,r=!1,s=!0,o=0,a=0;for(let l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){let u=l.attribute,f=u.isIndirectStorageBufferAttribute?fc.INDIRECT:fc.STORAGE,p=n.get(l);this.attributes.update(u,f),p.attribute!==u&&(p.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,p=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==p.generation&&(l.generation=p.generation,r=!0),p.bindGroups.add(e)),n.get(f).externalTexture!==void 0||p.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let v=this.get(f);l.store===!0?v.needsMipmap=!0:this.textures.needsMipmaps(f)&&v.needsMipmap===!0&&(this.backend.generateMipmaps(f),v.needsMipmap=!1)}}else if(l.isSampler&&l.update()){let f=this.textures.updateSampler(l);l.samplerKey!==f&&(l.samplerKey=f,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}},D2e=Object.freeze([]);function F2e(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function zY(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function VY(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===ir&&i.forceSinglePass===!1}var eO=class{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(VY(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(VY(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,n){this.opaque.length>1&&this.opaque.sort(e||F2e),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||zY),this.transparent.length>1&&this.transparent.sort(t||zY),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:D2e);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}this._lastOcclusionObject=null}},t1=[],tO=class{constructor(e){this.lighting=e,this.lists=new Ih}get(e,t){let n=this.lists;t1[0]=e,t1[1]=t;let r=n.get(t1);return r===void 0&&(r=new eO(this.lighting,e,t),n.set(t1,r)),t1[0]=null,t1[1]=null,r}dispose(){this.lists=new Ih}},O2e=0,nO=class{constructor(){this.id=O2e++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new gn,this.scissor=!1,this.scissorValue=new gn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return GJ(this)}};function GJ(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return gb(r)}var iO=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{let l=e.texture.format,c=e.texture.type;r=`${e.textures.length}:${l}:${c}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:"default",o=r+"-"+s+"-"+n,a=this._renderContexts[o];return a===void 0&&(a=new nO,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}},B2e=new ie,rO=class extends Nh{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,c=a.height>>t,u=e.depthTexture||s[t],f=e.depthBuffer===!0||e.stencilBuffer===!0,p=!1,x=u!==void 0&&u.image!==void 0&&u.image.depth>1,v=a.depth>1&&(e.useArrayDepthTexture||e.multiview||x);u===void 0&&f&&(u=new os,u.format=e.stencilBuffer?Qs:ys,u.type=e.stencilBuffer?zo:pi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=v),(n.width!==a.width||a.height!==n.height)&&(p=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=v?a.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(p=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);let w={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let S=0;S<o.length;S++){let T=o[S];p&&(T.needsUpdate=!0),this.updateTexture(T,w)}u&&this.updateTexture(u,w)}n.initialized!==!0&&(n.initialized=!0,this.info.memory.renderTargets++,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){let n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;let r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let c=this.renderer.getRenderTarget();c?e.type=c.texture.type:e.type=Gi}if(e.isHTMLTexture&&e.image){let c=this.renderer.domElement;if("requestPaint"in c){if(c.hasAttribute("layoutsubtree")||c.setAttribute("layoutsubtree","true"),e.image.parentNode!==c&&c.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;c.onpaint=f=>{let p=f&&f.changedElements;for(let x of u)(!p||p.includes(x.image))&&(x.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){let c=e.image;if(c===void 0)je("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)je("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let p of e.images)f.push(p);t.images=f}else t.image=c;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&sn.enabled===!0&&sn.getTransfer(e.colorSpace)!==Bt&&je("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=B2e){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),e.isHTMLTexture?(t.width=n.offsetWidth||1,t.height=n.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(let r of t.bindGroups){let s=this.backend.get(r);s.groups=void 0,s.versions=void 0;for(let o of r.bindings)o.isSampler&&o.texture===e&&(o.isSampledTexture!==!0&&this.backend.destroySampler(o),o.reset(),o.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},sb=class extends Ut{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},BM=class extends Jv{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(r=>{r.isOverrideContextNode===!0&&e.push(r.value.overrideNodes)});let t=new Map(e.flatMap(r=>Array.from(r.entries()))),n=super.getFlowContextData();return n.overrideNodes=t,n}};function zJ(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new BM(new Map([[i,e]]),t)}Be("overrideNode",(i,e,t)=>zJ(e,t,i));function VJ(i,e=null){let t=new Map;for(let[n,r]of i){let s=r!==null?typeof r=="function"?r:()=>r:null;t.set(n,s)}return new BM(t,e)}Be("overrideNodes",(i,e)=>VJ(e,i));var UM=class extends fi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),s;return r!==null?s=r.getMemberType(e,t):(Ge(`TSL: Member "${t}" not found in struct "${n}".`,new Fr),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},U2e=(i,e)=>new UM(i,e),sO=class extends $t{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return Ge("TSL: Invalid node added to stack.",new Fr),this;if(t===-1)if(this._currentNode){let n=this._nodeDataLibrary.get(this._currentNode);n===void 0&&(n={delta:0},this._nodeDataLibrary.set(this._currentNode,n)),n.delta++,t=this.nodes.indexOf(this._currentNode)+n.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new g1(t);return this._currentCond=Ko(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new g1(t),r=Ko(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new g1(e),this}Switch(e){return this._expressionNode=Vt(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Vt(e[a])));else Ge("TSL: Invalid parameter length. Case() requires at least two parameters.",new Fr);let n=e[e.length-1],r=new g1(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=Ko(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}build(e,...t){let n=f7(),r=e.buildStage;Kv(this),e.setActiveStack(this);for(let o=0;o<this.nodes.length;o++){let a=this.nodes[o],l=this._currentNode;if(this._currentNode=a,!(a.isVarNode&&a.isIntent(e)&&a.isAssign(e)!==!0)){if(r==="setup")a.build(e);else if(r==="analyze")a.build(e,this);else if(r==="generate"){let c=e.getDataFromNode(a,"any").stages,u=c&&c[e.shaderStage];if(a.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;a.build(e,"void")}this._currentNode=l}}let s;if(this.outputNode){let o=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(s=o)}else s=super.build(e,...t);return Kv(n),e.removeActiveStack(this),s}},aM=Vn(sO).setParameterLength(0,1);function k2e(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var oO=class extends $t{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=k2e(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=N1e(r),o=L1e(r);e=Math.max(e,o);let l=t%e%o;l!==0&&(t+=o-l),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},aO=class extends $t{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},G2e=(i,e=null)=>{let t=new oO(i,e);return h7((...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};let o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new aO(t,s)},t)},kM=class extends $t{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let o=this.members,a=[];for(let l=0;l<o.length;l++){let c="m"+l,u=o[l].getNodeType(e);a.push({name:c,type:u,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){let a=r[o].build(e,t.membersLayout[o].type);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}},z2e=Vn(kM),GM=class{constructor(e=ss){this.blending=e,this.blendSrc=Ud,this.blendDst=kd,this.blendEquation=Bs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},V2e=new GM(Xr),q2e=new GM(Ky);function qJ(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var lO=class extends kM{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:q2e},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||V2e}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=HJ(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(let o in t){let a=qJ(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},HJ=Vn(lO),Lm=class extends dr{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n="";if(this.inputType!==null){let r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},WJ=lt(Lm).setParameterLength(2),H2e=i=>new Lm(i,"int","float"),jJ=i=>new Lm(i,"uint","float"),W2e=i=>new Lm(i,"float","int"),j2e=i=>new Lm(i,"float","uint"),NE={},ou=class i extends Re{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(WJ(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return it;case"int":return fe;case"uvec2":return d7;case"uvec3":return Bm;case"uvec4":return g7;case"ivec2":return vr;case"ivec3":return p7;case"ivec4":return m7}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return Ae(([s])=>{let o=it(0);this._resolveElementType(s,o,t);let a=se(o.bitAnd(C7(o))),c=jJ(a).shiftRight(23).sub(127);return n(c)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return Ae(([s])=>{Wt(s.equal(it(0)),()=>it(32));let o=it(0),a=it(0);return this._resolveElementType(s,o,t),Wt(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),Wt(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),Wt(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),Wt(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),Wt(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return Ae(([s])=>{let o=it(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(it(1)).bitAnd(it(1431655765)))),o.assign(o.bitAnd(it(858993459)).add(o.shiftRight(it(2)).bitAnd(it(858993459))));let a=o.add(o.shiftRight(it(4))).bitAnd(it(252645135)).mul(it(16843009)).shiftRight(it(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){let s=this._returnDataNode(t);return Ae(([a])=>{if(n===1)return s(r(a));{let l=s(0),c=["x","y","z","w"];for(let u=0;u<n;u++){let f=c[u];l[f].assign(r(a[f]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);let s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,c=`${t}_${s}`,u=NE[l];if(u===void 0){switch(t){case i.COUNT_LEADING_ZEROS:{u=this._createLeadingZerosBaseLayout(l,o);break}case i.COUNT_TRAILING_ZEROS:{u=this._createTrailingZerosBaseLayout(l,o);break}case i.COUNT_ONE_BITS:{u=this._createOneBitsBaseLayout(l,o);break}}NE[l]=u}let f=NE[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),NE[c]=f),Ae(()=>f(n))()}};ou.COUNT_TRAILING_ZEROS="countTrailingZeros";ou.COUNT_LEADING_ZEROS="countLeadingZeros";ou.COUNT_ONE_BITS="countOneBits";var X2e=lt(ou,ou.COUNT_TRAILING_ZEROS).setParameterLength(1),$2e=lt(ou,ou.COUNT_LEADING_ZEROS).setParameterLength(1),Y2e=lt(ou,ou.COUNT_ONE_BITS).setParameterLength(1),Z2e=Ae(([i])=>{let e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),cO=(i,e)=>uc(bn(4,i.mul(ni(1,i))),e),K2e=(i,e)=>i.lessThan(.5)?cO(i.mul(2),e).div(2):ni(1,cO(bn(ni(1,i),2),e).div(2)),Q2e=(i,e,t)=>uc(Il(uc(i,e),us(uc(i,e),uc(ni(1,i),t))),1/e),J2e=(i,e)=>Sa(xM.mul(e.mul(i).sub(1))).div(xM.mul(e.mul(i).sub(1))),ob=class extends dr{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},eve=lt(ob,"snorm").setParameterLength(1),tve=lt(ob,"unorm").setParameterLength(1),nve=lt(ob,"float16").setParameterLength(1),ab=class extends dr{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},ive=lt(ab,"snorm").setParameterLength(1),rve=lt(ab,"unorm").setParameterLength(1),sve=lt(ab,"float16").setParameterLength(1),Hf=Ae(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),ove=Ae(([i])=>pe(Hf(i.z.add(Hf(i.y.mul(1)))),Hf(i.z.add(Hf(i.x.mul(1)))),Hf(i.y.add(Hf(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),ave=Ae(([i,e,t])=>{let n=pe(i).toVar(),r=se(1.4).toVar(),s=se(0).toVar(),o=pe(n).toVar();return Ci({start:se(0),end:se(3),type:"float",condition:"<="},()=>{let a=pe(ove(o.mul(2))).toVar();n.addAssign(a.add(t.mul(se(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=se(Hf(n.z.add(Hf(n.x.add(Hf(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]}),uO=class extends $t{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,s=-1;for(let o of this.functionNodes){let l=o.shaderNode.layout;if(l===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");let c=l.inputs;if(t.length===c.length){let u=0;for(let f=0;f<t.length;f++){let p=t[f],x=c[f];p.getNodeType(e)===x.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},lve=Vn(uO),Eo=i=>(...e)=>lve(i,...e),U1=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.time),cve=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.deltaTime),XJ=Ht(0,"uint").setGroup(Zt).onRenderUpdate(i=>i.frameId),uve=(i=U1)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),hve=(i=U1)=>i.fract().round(),fve=(i=U1)=>i.add(.5).fract().mul(2).sub(1).abs(),dve=(i=U1)=>i.fract();function pve(i,e=null){return Qf(e,{getUV:typeof i=="function"?i:()=>i})}var Ave=Ae(([i,e,t=ft(.5)])=>yb(i.sub(t),e).add(t)),mve=Ae(([i,e,t=ft(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),gve=Ae(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=hc.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=hc;let r=c0.mul(n);return T1(e)&&(r[0][0]=hc[0].length(),r[0][1]=0,r[0][2]=0),T1(t)&&(r[1][0]=0,r[1][1]=hc[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ea.mul(r).mul(hr)}),_ve=Ae(([i=null])=>{let e=CM();return CM(pU(i)).sub(e).lessThan(0).select(tu,i)}),xve=Ae(([i,e=Ri(),t=se(0)])=>{let n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),c=ft(o,a);return e.add(c).mul(l)}),$J=Ae(([i,e=null,t=null,n=se(1),r=hr,s=ea])=>{let o=s.abs().normalize();o=o.div(o.dot(pe(1)));let a=r.yz.mul(n),l=r.zx.mul(n),c=r.xy.mul(n),u=i.value,f=e!==null?e.value:u,p=t!==null?t.value:u,x=ai(u,a).mul(o.x),v=ai(f,l).mul(o.y),w=ai(p,c).mul(o.z);return us(x,v,w)}),yve=(...i)=>$J(...i),n1=new aa,lm=new ie,i1=new ie,t8=new ie,Ev=new on,LE=new ie(0,0,-1),gh=new gn,Mv=new ie,DE=new ie,Cv=new gn,FE=new Oe,zM=new ca,vve=tu.flipX();zM.depthTexture=new os(1,1);var OE=!1,hO=class i extends Ac{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||zM.texture,vve),this._reflectorBaseNode=e.reflector||new fO(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new i({defaultTexture:zM.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},fO=class extends $t{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new $i,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(Zn('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?_n.RENDER:_n.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(FE),e.setSize(Math.round(FE.width*n),Math.round(FE.height*n))}setup(e){return this._updateResolution(zM,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new ca(0,0,{type:Li,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=YN,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new os),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&OE)return!1;OE=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(FE),this._updateResolution(l,r),i1.setFromMatrixPosition(o.matrixWorld),t8.setFromMatrixPosition(n.matrixWorld),Ev.extractRotation(o.matrixWorld),lm.set(0,0,1),lm.applyMatrix4(Ev),Mv.subVectors(i1,t8);let c=Mv.dot(lm)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){OE=!1;return}u=!0}Mv.reflect(lm).negate(),Mv.add(i1),Ev.extractRotation(n.matrixWorld),LE.set(0,0,-1),LE.applyMatrix4(Ev),LE.add(t8),DE.subVectors(i1,LE),DE.reflect(lm).negate(),DE.add(i1),a.coordinateSystem=n.coordinateSystem,a.position.copy(Mv),a.up.set(0,1,0),a.up.applyMatrix4(Ev),a.up.reflect(lm),a.lookAt(DE),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),n1.setFromNormalAndCoplanarPoint(lm,i1),n1.applyMatrix4(a.matrixWorldInverse),gh.set(n1.normal.x,n1.normal.y,n1.normal.z,n1.constant);let f=a.projectionMatrix;Cv.x=(Math.sign(gh.x)+f.elements[8])/f.elements[0],Cv.y=(Math.sign(gh.y)+f.elements[9])/f.elements[5],Cv.z=-1,Cv.w=(1+f.elements[10])/f.elements[14],gh.multiplyScalar(1/gh.dot(Cv));let p=0;f.elements[2]=gh.x,f.elements[6]=gh.y,f.elements[10]=r.coordinateSystem===qa?gh.z-p:gh.z+1-p,f.elements[14]=gh.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let x=r.getRenderTarget(),v=r.getMRT(),w=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;let S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(v),r.setRenderTarget(x),r.autoClear=w,s.visible=!0,OE=!1,this.forceUpdate=!1}get resolution(){return Zn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Zn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},bve=i=>new hO(i),n8=new Vc(-1,1,1,-1,0,1),dO=class extends Kn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new kn(t,2))}},wve=new dO,lb=class extends Hn{constructor(e=null){super(wve,e),this.camera=n8,this.isQuadMesh=!0}async renderAsync(e){Zn('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,n8)}render(e){e.render(this,n8)}},Sve=new Oe,pO=class extends Ac{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Li}){let s=new ca(t,n,r);super(s.texture,Ri()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new lb(new pr),this.updateBeforeType=_n.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let n=Math.floor(e*this._resolutionScale),r=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let r=e.getDrawingBufferSize(Sve),s=Math.floor(r.width*this._resolutionScale),o=Math.floor(r.height*this._resolutionScale);(s!==this.renderTarget.width||o!==this.renderTarget.height)&&(this.renderTarget.setSize(s,o),this.textureNeedsUpdate=!0)}let n="RTT";this.node.name&&(n=this.node.name+" [ "+n+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=n,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new Ac(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},YJ=(i,...e)=>new pO(Vt(i),...e),Tve=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():YJ(i,...e),m1=Ae(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===qa?(i=ft(i.x,i.y.oneMinus()).mul(2).sub(1),r=Lt(pe(i,e),1)):r=Lt(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Lt(t.mul(r));return s.xyz.div(s.w)}),Eve=Ae(([i,e])=>{let t=e.mul(Lt(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return ft(n.x,n.y.oneMinus())}),Mve=Ae(([i,e,t])=>{let n=Rm(Qr(e)),r=vr(i.mul(n)).toVar(),s=Qr(e,r).toVar(),o=Qr(e,r.sub(vr(2,0))).toVar(),a=Qr(e,r.sub(vr(1,0))).toVar(),l=Qr(e,r.add(vr(1,0))).toVar(),c=Qr(e,r.add(vr(2,0))).toVar(),u=Qr(e,r.add(vr(0,2))).toVar(),f=Qr(e,r.add(vr(0,1))).toVar(),p=Qr(e,r.sub(vr(0,1))).toVar(),x=Qr(e,r.sub(vr(0,2))).toVar(),v=Qi(ni(se(2).mul(a).sub(o),s)).toVar(),w=Qi(ni(se(2).mul(l).sub(c),s)).toVar(),S=Qi(ni(se(2).mul(f).sub(u),s)).toVar(),T=Qi(ni(se(2).mul(p).sub(x),s)).toVar(),P=m1(i,s,t).toVar(),R=v.lessThan(w).select(P.sub(m1(i.sub(ft(se(1).div(n.x),0)),a,t)),P.negate().add(m1(i.add(ft(se(1).div(n.x),0)),l,t))),C=S.lessThan(T).select(P.sub(m1(i.add(ft(0,se(1).div(n.y))),f,t)),P.negate().add(m1(i.sub(ft(0,se(1).div(n.y))),p,t)));return Qo(Yf(R,C))}),bU=Ae(([i])=>iu(se(52.9829189).mul(iu(pc(i,ft(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),eu=Ae(([i,e,t])=>{let n=se(2.399963229728653),r=Ma(se(i).add(.5).div(se(e))),s=se(i).mul(n).add(t);return ft(Jc(s),Sa(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),AO=class extends $t{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Ri())}sample(e){return this.callback(e)}},Cve=(i,e=null)=>new AO(i,Vt(e)),Dm=class extends Al{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},mO=class extends Ni{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},Rve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=lM("float")):(t=SZ(e),n=lM(e));let r=new mO(i,t,n);return t0(r,e,i)},Pve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=lM("float")):(t=SZ(e),n=lM(e));let r=new Dm(i,t,n);return t0(r,e,r.count)},gO=class extends $t{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},Ive=xt(gO),i8=new on,ZJ=Ht(0).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),_O=Ht(1).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),KJ=Ht(new on).setGroup(Zt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==p2||i.backgroundNode&&i.backgroundNode.isNode?i8.makeRotationFromEuler(i.backgroundRotation).transpose():i8.identity(),i8}),VM=class extends Ac{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=So.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,n,r,s,o,a,l,c){let u=this.value;return e.generateStorageTextureLoad(u,t,n,r,o,c)}toReadWrite(){return this.setAccess(So.READ_WRITE)}toReadOnly(){return this.setAccess(So.READ_ONLY)}toWriteOnly(){return this.setAccess(So.WRITE_ONLY)}store(e,t){let n=this.clone();return n.referenceNode=this.getBase(),n.uvNode=e,n.storeNode=t,t!==null&&n.toStack(),n}generateStore(e){let t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),c=s?s.build(e,"int"):null,u=e.generateTextureStore(this.value,o,a,c,l);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},QJ=Vn(VM).setParameterLength(1,3),Nve=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=QJ(i,e,t),t!==null&&n.toStack()),n},xO=class extends VM{static get type(){return"StorageTexture3DNode"}constructor(e,t,n=null){super(e,t,n),this.isStorageTexture3DNode=!0}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}},Lve=Vn(xO).setParameterLength(1,3),Dve=Ae(({texture:i,uv:e})=>{let n=pe().toVar();return Wt(e.x.lessThan(1e-4),()=>{n.assign(pe(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(pe(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(pe(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(pe(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(pe(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(pe(0,0,-1))}).Else(()=>{let s=i.sample(e.add(pe(-.01,0,0))).r.sub(i.sample(e.add(pe(.01,0,0))).r),o=i.sample(e.add(pe(0,-.01,0))).r.sub(i.sample(e.add(pe(0,.01,0))).r),a=i.sample(e.add(pe(0,0,-.01))).r.sub(i.sample(e.add(pe(0,0,.01))).r);n.assign(pe(s,o,a))}),n.normalize()}),yO=class extends Ac{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return Dve({texture:this,uv:e})}},wU=Vn(yO).setParameterLength(1,3),Fve=(...i)=>wU(...i).setSampler(!1),Ove=(i,e,t)=>wU(i,e).level(t),vO=class extends C1{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},Bve=(i,e,t)=>new vO(i,e,t),qY=new WeakMap,bO=class extends dr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=_n.OBJECT,this.updateAfterType=_n.OBJECT,this.previousModelWorldMatrix=Ht(new on),this.previousProjectionMatrix=Ht(new on).setGroup(Zt),this.previousCameraViewMatrix=Ht(new on)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=HY(n);this.previousModelWorldMatrix.value.copy(r);let s=JJ(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new on,s.previousCameraViewMatrix=new on,s.currentProjectionMatrix=new on,s.currentCameraViewMatrix=new on,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){HY(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ea:Ht(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Rh).mul(hr),r=this.previousProjectionMatrix.mul(t).mul(Im),s=n.xy.div(n.w),o=r.xy.div(r.w);return ni(s,o)}};function JJ(i){let e=qY.get(i);return e===void 0&&(e={},qY.set(i,e)),e}function HY(i,e=0){let t=JJ(i),n=t[e];return n===void 0&&(t[e]=n=new on,t[e].copy(i.matrixWorld)),n}var Uve=xt(bO),kve=Ae(([i,e])=>Qa(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Gve=Ae(([i,e])=>Qa(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),zve=Ae(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Vve=Ae(([i,e])=>jn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Cm(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),qve=Ae(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Lt(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Hve=Ae(([i])=>SU(i.rgb)),Wve=Ae(([i,e=se(1)])=>e.mix(SU(i.rgb),i.rgb).max(0)),jve=Ae(([i,e=se(0)])=>{let t=us(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return jn(i.rgb,n,r).max(0)}),Xve=Ae(([i,e=se(1)])=>{let t=pe(.57735,.57735,.57735),n=e.cos();return pe(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(pc(t,i.rgb).mul(n.oneMinus()))))).max(0)}),SU=(i,e=pe(sn.getLuminanceCoefficients(new ie)))=>pc(i,e),$ve=Ae(([i,e=pe(1),t=pe(0),n=pe(1),r=se(1),s=pe(sn.getLuminanceCoefficients(new ie,Gd))])=>{let o=i.rgb.dot(pe(s)),a=br(i.rgb.mul(e).add(t),0),l=a.pow(n);return Wt(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),Wt(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),Wt(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Lt(a.rgb,i.a)}),Yve=Ae(([i,e])=>i.mul(e).floor().div(e)),BE=null,wO=class extends R1{static get type(){return"ViewportSharedTextureNode"}constructor(e=tu,t=null){BE===null&&(BE=new yA),super(e,t,BE)}getTextureForReference(){return BE}updateReference(){return this}},Zve=Vn(wO).setParameterLength(0,2),UE=new Oe,qM=class extends Ac{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},HM=class extends qM{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},Lh=class i extends dr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._width=1,this._height=1;let s=new ca(this._width,this._height,{type:Li,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new os,o.isRenderTargetTexture=!0,o.name="depth",s.depthTexture=o),this.renderTarget=s,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:s.texture},o!==null&&(this._textures.depth=o),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Ht(0),this._cameraFar=Ht(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=_n.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return je("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return je("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new HM(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new HM(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=GC(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=Sm(s,n,r)}return t}async compileAsync(e){let t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=Yi),this.scope===i.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,s=t.getOutputRenderTarget();s&&s.isXRRenderTarget===!0?(r=t.xr.getCamera(),t.xr.updateCamera(r),UE.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(UE)),this.setSize(UE.width,UE.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,p=t.contextNode,x=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let w in this._previousTextures)this.toggleTexture(w);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:Qf({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let v=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=v,n.overrideMaterial=x,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=p,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._resolutionScale),r=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new gn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r))}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new gn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Lh.COLOR="color";Lh.DEPTH="depth";var Kve=(i,e,t)=>new Lh(Lh.COLOR,i,e,t),Qve=(i,e)=>new qM(i,e),Jve=(i,e,t)=>new Lh(Lh.DEPTH,i,e,t),SO=class extends Lh{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Lh.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,f)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){let p=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,p,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new pr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=ui;let t=ea.negate(),n=Ea.mul(Rh),r=se(1),s=n.mul(Lt(hr,1)),o=n.mul(Lt(hr.add(t),1)),a=Qo(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Lt(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},ebe=(i,e,t=new Ut(0,0,0),n=.003,r=1)=>new SO(i,e,Vt(t),Vt(n),Vt(r)),eee=Ae(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),tee=Ae(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),nee=Ae(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);let t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),tbe=Ae(([i])=>{let e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),iee=Ae(([i,e])=>{let t=io(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=io(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=tbe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),nbe=io(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),ibe=io(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),rbe=Ae(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return se(15.5).mul(n.mul(t)).sub(bn(40.14,n.mul(e))).add(bn(31.96,n).sub(bn(6.868,t.mul(e))).add(bn(.4298,t).add(bn(.1191,e).sub(.00232))))}),ree=Ae(([i,e])=>{let t=pe(i).toVar(),n=io(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=io(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=se(-12.47393),o=se(4.026069);return t.mulAssign(e),t.assign(ibe.mul(t)),t.assign(n.mul(t)),t.assign(br(t,1e-10)),t.assign(wh(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(ru(t,0,1)),t.assign(rbe(t)),t.assign(r.mul(t)),t.assign(uc(br(pe(0),t),pe(2.2))),t.assign(nbe.mul(t)),t.assign(ru(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),see=Ae(([i,e])=>{let t=se(.76),n=se(.15);i=i.mul(e);let r=Qa(i.r,Qa(i.g,i.b)),s=Ko(r.lessThan(.08),r.sub(bn(6.25,r.mul(r))),.04);i.subAssign(s);let o=br(i.r,br(i.g,i.b));Wt(o.lessThan(t),()=>i);let a=ni(1,t),l=ni(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ni(1,Il(1,n.mul(o.sub(l)).add(1)));return jn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ki=class extends $t{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let r of t)r.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},WC=Vn(Ki).setParameterLength(1,3),sbe=(i,e)=>WC(i,e,"js"),obe=(i,e)=>WC(i,e,"wgsl"),abe=(i,e)=>WC(i,e,"glsl"),WM=class extends Ki{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);let a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+`4158+`,t==="property"?a:e.format(`${a}()`,s,t)}},oee=(i,e=[],t="")=>{let n=new WM(i,e,t);return h7((...s)=>n.call(...s),n)},lbe=(i,e)=>oee(i,e,"glsl"),cbe=(i,e)=>oee(i,e,"wgsl");function TU(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Jr.z).negate()}var aee=Ae(([i,e],t)=>{let n=TU(t);return Nl(i,e,n)}),lee=Ae(([i],e)=>{let t=TU(e);return i.mul(i,t,t).negate().exp().oneMinus()}),ube=Ae(([i,e],t)=>{let n=TU(t),s=e.sub(Eh.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),TO=Ae(([i,e])=>Lt(e.toFloat().mix(y1.rgb,i.toVec3()),y1.a)),cm=null,um=null,EO=class extends $t{static get type(){return"RangeNode"}constructor(e=se(),t=se()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(Qp(t.value)),s=e.getTypeLength(Qp(n.value));return r>s?r:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new wM('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(Qp(o)),c=e.getTypeLength(Qp(a));cm=cm||new gn,um=um||new gn,cm.setScalar(0),um.setScalar(0),l===1?cm.setScalar(o):o.isColor?cm.set(o.r,o.g,o.b,1):cm.set(o.x,o.y,o.z||0,o.w||0),c===1?um.setScalar(a):a.isColor?um.set(a.r,a.g,a.b,1):um.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,p=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=cm.getComponent(S),P=um.getComponent(S);p[w]=Wc.lerp(T,P,Math.random())}let x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=O1(p,"vec4",t.count).element(nu).convert(x);else{let w=new Al(p,4);e.geometry.setAttribute("__range"+this.id,w),n=FC(w).convert(x)}}else n=se(0);return n}},hbe=Vn(EO).setParameterLength(2),MO=class extends $t{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(je(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},vb=(i,e)=>new MO(i,e),fbe=vb("numWorkgroups","uvec3"),dbe=vb("workgroupId","uvec3"),pbe=vb("globalId","uvec3"),Abe=vb("localId","uvec3"),mbe=vb("subgroupSize","uint"),CO=class extends $t{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4159+`):e.addLineFlowCode(`${t}Barrier()`,this)}},EU=Vn(CO),gbe=()=>EU("workgroup").toStack(),_be=()=>EU("storage").toStack(),xbe=()=>EU("texture").toStack(),RO=class extends $f{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.isContextAssign();if(n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},PO=class extends $t{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Fr),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new RO(this,e)}generate(e){let t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},ybe=(i,e)=>new PO("Workgroup",i,e),fs=class extends $t{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,c=[];c.push(`&${a.build(e,o)}`),l!==null&&c.push(l.build(e,o));let u=`${e.getMethod(r,s)}( ${c.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=Cl(u,s).toConst()),t.constNode.build(e)}};fs.ATOMIC_LOAD="atomicLoad";fs.ATOMIC_STORE="atomicStore";fs.ATOMIC_ADD="atomicAdd";fs.ATOMIC_SUB="atomicSub";fs.ATOMIC_MAX="atomicMax";fs.ATOMIC_MIN="atomicMin";fs.ATOMIC_AND="atomicAnd";fs.ATOMIC_OR="atomicOr";fs.ATOMIC_XOR="atomicXor";var vbe=Vn(fs),Fh=(i,e,t)=>vbe(i,e,t).toStack(),bbe=i=>Fh(fs.ATOMIC_LOAD,i,null),wbe=(i,e)=>Fh(fs.ATOMIC_STORE,i,e),Sbe=(i,e)=>Fh(fs.ATOMIC_ADD,i,e),Tbe=(i,e)=>Fh(fs.ATOMIC_SUB,i,e),Ebe=(i,e)=>Fh(fs.ATOMIC_MAX,i,e),Mbe=(i,e)=>Fh(fs.ATOMIC_MIN,i,e),Cbe=(i,e)=>Fh(fs.ATOMIC_AND,i,e),Rbe=(i,e)=>Fh(fs.ATOMIC_OR,i,e),Pbe=(i,e)=>Fh(fs.ATOMIC_XOR,i,e),Ft=class i extends dr{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}generateNodeType(e){let t=this.method;return t===i.SUBGROUP_ELECT?"bool":t===i.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===i.SUBGROUP_BROADCAST||n===i.SUBGROUP_SHUFFLE||n===i.QUAD_BROADCAST){let u=a.getNodeType(e);l.push(o.build(e,r),a.build(e,u==="float"?"int":r))}else n===i.SUBGROUP_SHUFFLE_XOR||n===i.SUBGROUP_SHUFFLE_DOWN||n===i.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));let c=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${c}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ft.SUBGROUP_ELECT="subgroupElect";Ft.SUBGROUP_BALLOT="subgroupBallot";Ft.SUBGROUP_ADD="subgroupAdd";Ft.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ft.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ft.SUBGROUP_MUL="subgroupMul";Ft.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ft.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ft.SUBGROUP_AND="subgroupAnd";Ft.SUBGROUP_OR="subgroupOr";Ft.SUBGROUP_XOR="subgroupXor";Ft.SUBGROUP_MIN="subgroupMin";Ft.SUBGROUP_MAX="subgroupMax";Ft.SUBGROUP_ALL="subgroupAll";Ft.SUBGROUP_ANY="subgroupAny";Ft.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ft.QUAD_SWAP_X="quadSwapX";Ft.QUAD_SWAP_Y="quadSwapY";Ft.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ft.SUBGROUP_BROADCAST="subgroupBroadcast";Ft.SUBGROUP_SHUFFLE="subgroupShuffle";Ft.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ft.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ft.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ft.QUAD_BROADCAST="quadBroadcast";var Ibe=lt(Ft,Ft.SUBGROUP_ELECT).setParameterLength(0),Nbe=lt(Ft,Ft.SUBGROUP_BALLOT).setParameterLength(1),Lbe=lt(Ft,Ft.SUBGROUP_ADD).setParameterLength(1),Dbe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),Fbe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),Obe=lt(Ft,Ft.SUBGROUP_MUL).setParameterLength(1),Bbe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),Ube=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),kbe=lt(Ft,Ft.SUBGROUP_AND).setParameterLength(1),Gbe=lt(Ft,Ft.SUBGROUP_OR).setParameterLength(1),zbe=lt(Ft,Ft.SUBGROUP_XOR).setParameterLength(1),Vbe=lt(Ft,Ft.SUBGROUP_MIN).setParameterLength(1),qbe=lt(Ft,Ft.SUBGROUP_MAX).setParameterLength(1),Hbe=lt(Ft,Ft.SUBGROUP_ALL).setParameterLength(0),Wbe=lt(Ft,Ft.SUBGROUP_ANY).setParameterLength(0),jbe=lt(Ft,Ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),Xbe=lt(Ft,Ft.QUAD_SWAP_X).setParameterLength(1),$be=lt(Ft,Ft.QUAD_SWAP_Y).setParameterLength(1),Ybe=lt(Ft,Ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),Zbe=lt(Ft,Ft.SUBGROUP_BROADCAST).setParameterLength(2),Kbe=lt(Ft,Ft.SUBGROUP_SHUFFLE).setParameterLength(2),Qbe=lt(Ft,Ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),Jbe=lt(Ft,Ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),ewe=lt(Ft,Ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),twe=lt(Ft,Ft.QUAD_BROADCAST).setParameterLength(1),kE;function jC(i){kE=kE||new WeakMap;let e=kE.get(i);return e===void 0&&kE.set(i,e={}),e}function XC(i){let e=jC(i);return e.shadowMatrix||(e.shadowMatrix=Ht("mat4").setGroup(Zt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function cee(i,e=Eh){let t=XC(i).mul(e);return t.xyz.div(t.w)}function MU(i){let e=jC(i);return e.position||(e.position=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function uee(i){let e=jC(i);return e.targetPosition||(e.targetPosition=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function CU(i){let e=jC(i);return e.viewPosition||(e.viewPosition=Ht(new ie).setGroup(Zt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new ie,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var RU=i=>c0.transformDirection(MU(i).sub(uee(i))),nwe=Kf("vec3","totalDiffuse"),iwe=Kf("vec3","totalSpecular"),rwe=Kf("vec3","outgoingLight"),swe=i=>i.sort((e,t)=>e.id-t.id),owe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},r8=new WeakMap,Rv=[],cb=class extends $t{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=nwe,this.totalSpecularNode=iwe,this.outgoingLightNode=rwe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Rv.push(r.id),Rv.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Rv.push(s,o)}}let t=gb(Rv);return Rv.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let n=this.setupLightsNode(e);t.lightNodes=n;let r=[];for(let s of n)r.push(s.getHash());t.lightNodesHash="lights-"+r.join(",")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),n=[],r=t.lightNodes||null,s=e.context.materialLightings,o=swe([...s,...this._lights]),a=e.renderer.library;for(let l of o)if(l.isNode)n.push(l);else{let c=null;if(r!==null&&(c=owe(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){je(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}r8.has(l)===!1&&r8.set(l,new u(l)),c=r8.get(l)}n.push(c)}return n}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){let{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;let c=e.addStack();o.nodes=c.nodes,s.start(e);let{backdrop:u,backdropAlpha:f}=r,{directDiffuse:p,directSpecular:x,indirectDiffuse:v,indirectSpecular:w}=r.reflectedLight,S=p.add(v);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(x.add(w)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},awe=(i=[])=>new cb().setLights(i),IO=class extends $t{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=_n.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){PU.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Eh)}},PU=Kf("vec3","shadowPositionWorld");function lwe(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new Ut),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function cwe(i,e){return e=lwe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function uwe(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function hwe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function fwe(i,e){return e=hwe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function dwe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function pwe(i,e,t){return t=cwe(i,t),t=fwe(e,t),t}function Awe(i,e,t){uwe(i,t),dwe(e,t)}var jM=new WeakMap,hee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=ai(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),fee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let p=ai(i,u);return i.isArrayTexture&&(p=p.depth(n)),p.compare(f)},s=tr("mapSize","vec2",t).setGroup(Zt),o=tr("radius","float",t).setGroup(Zt),a=ft(1).div(s),l=o.mul(a.x),c=bU(km.xy).mul(6.28318530718);return us(r(e.xy.add(eu(0,5,c).mul(l)),e.z),r(e.xy.add(eu(1,5,c).mul(l)),e.z),r(e.xy.add(eu(2,5,c).mul(l)),e.z),r(e.xy.add(eu(3,5,c).mul(l)),e.z),r(e.xy.add(eu(4,5,c).mul(l)),e.z)).mul(1/5)}),dee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=tr("mapSize","vec2",t).setGroup(Zt),s=ft(1).div(r),o=e.xy,a=iu(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=x=>{let v=ai(i,o).offset(x).gather();return i.isArrayTexture&&(v=v.depth(n)),v.compare(e.z)},c=l(vr(-1,1)).toConst(),u=l(vr(1,1)).toConst(),f=l(vr(-1,-1)).toConst(),p=l(vr(1,-1)).toConst();return us(jn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),jn(c.w,u.z,a.x).add(c.z).add(u.w),jn(f.x,p.y,a.x).add(f.y).add(p.x),jn(f.w,p.z,a.x).add(f.z).add(p.w).mul(a.y.oneMinus())).mul(1/9)}),pee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=ai(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=br(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Cm(s,e.z):Cm(e.z,s),l=se(1).toVar();return Wt(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=ru(ni(u,.3).div(.65)),l.assign(br(a,u))}),l}),Aee=i=>{let e=jM.get(i);return e===void 0&&(e=new pr,e.colorNode=Lt(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=Xr,e.fog=!1,jM.set(i,e)),e},mee=i=>{let e=jM.get(i);e!==void 0&&(e.dispose(),jM.delete(i))},WY=new Ih,r1=[],gee=(i,e,t,n)=>{r1[0]=i,r1[1]=e;let r=WY.get(r1);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,p,x)=>{(s.castShadow===!0||s.receiveShadow&&t===Kl)&&(n&&(TZ(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,p,x),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,WY.set(r1,r)),r1[0]=null,r1[1]=null,r},mwe=Ae(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=se(0).toVar("meanVertical"),o=se(0).toVar("squareMeanVertical"),a=i.lessThanEqual(se(1)).select(se(0),se(2).div(i.sub(1))),l=i.lessThanEqual(se(1)).select(se(0),se(-1));Ci({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(us(km.xy,ft(0,f).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),p=p.x,s.addAssign(p),o.addAssign(p.mul(p))}),s.divAssign(i),o.divAssign(i);let c=Ma(o.sub(s.mul(s)).max(0));return ft(s,c)}),gwe=Ae(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=se(0).toVar("meanHorizontal"),o=se(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(se(1)).select(se(0),se(2).div(i.sub(1))),l=i.lessThanEqual(se(1)).select(se(0),se(-1));Ci({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(us(km.xy,ft(f,0).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),s.addAssign(p.x),o.addAssign(us(p.y.mul(p.y),p.x.mul(p.x)))}),s.divAssign(i),o.divAssign(i);let c=Ma(o.sub(s.mul(s)).max(0));return ft(s,c)}),_we=[hee,fee,dee,pee],s8,GE=new lb,XM=class extends IO{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){let a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,se(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||tr("bias","float",n).setGroup(Zt),o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{let l=o.w;o=o.xy.div(l);let c=tr("near","float",n.camera).setGroup(Zt),u=tr("far","float",n.camera).setGroup(Zt);a=zC(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return _we[e]}setupRenderTarget(e,t){let n=new os(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Hc:th;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,c=t.hasCompatibility(Df.TEXTURE_COMPARE);if((l===Jd||l===GT)&&c?(o.minFilter=vi,o.magFilter=vi):(o.minFilter=xi,o.magFilter=xi),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Kl&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ss,type:Li,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ss,type:Li,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ss,type:Li,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ss,type:Li,depthBuffer:!1}));let D=ai(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let F=ai(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(F=F.depth(this.depthLayer));let N=tr("blurSamples","float",s).setGroup(Zt),B=tr("radius","float",s).setGroup(Zt),z=tr("mapSize","vec2",s).setGroup(Zt),V=this.vsmMaterialVertical||(this.vsmMaterialVertical=new pr);V.fragmentNode=mwe({samples:N,radius:B,size:z,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMVertical",V=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new pr),V.fragmentNode=gwe({samples:N,radius:B,size:z,shadowPass:F,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMHorizontal"}let u=tr("intensity","float",s).setGroup(Zt),f=tr("normalBias","float",s).setGroup(Zt),p=XC(r),x=u0.mul(f),v;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?v=p.mul(PU.add(x)):v=Ht("mat4").onObjectUpdate(({object:F},N)=>N.value.multiplyMatrices(p.value,F.matrixWorld)).mul(hr).add(p.mul(Lt(x,0)));let w=this.setupShadowCoord(e,v),S=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(S===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let T=l===Kl&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,P=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),R;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?R=Ta(a.texture,w.xyz):(R=ai(a.texture,w),o.isArrayTexture&&(R=R.depth(this.depthLayer))));let C;R?C=jn(1,P.rgb.mix(R,1),u.mul(R.a)).toVar():C=jn(1,P,u).toVar(),this.shadowMap=a,this.shadow.map=a;let L=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return R&&C.toInspector(`${L} / Color`,()=>this.shadowMap.texture.isCubeTexture?Ta(this.shadowMap.texture,wF()):ai(this.shadowMap.texture)),C.toInspector(`${L} / Depth`,()=>{let D=tr("near","float",this.shadow.camera),F=tr("far","float",this.shadow.camera),N;this.shadowMap.texture.isCubeTexture?N=Ta(this.shadowMap.depthTexture,wF()).r:N=ai(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=GC(N,D,F):B=yJ(N,D,F),B=Sm(B,D,F),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return Ae(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let u=r.camera.layers.mask;(r.camera.layers.mask&4294967294)===0&&(r.camera.layers.mask=a.layers.mask);let f=s.getRenderObjectFunction(),p=s.getMRT(),x=p?p.has("velocity"):!1;s8=pwe(s,o,s8),o.overrideMaterial=Aee(n),s.setRenderObjectFunction(gee(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Kl&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,Awe(s,o,s8)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),GE.material=this.vsmMaterialVertical,GE.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),GE.material=this.vsmMaterialHorizontal,GE.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,mee(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},_ee=(i,e)=>new XM(i,e),xwe=new Ut,jY=new on,Pv=new ie,o8=new ie,ywe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,-1,0),new ie(0,1,0),new ie(0,0,1),new ie(0,0,-1)],vwe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,-1),new ie(0,0,1),new ie(0,-1,0),new ie(0,-1,0)],bwe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1)],wwe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1),new ie(0,-1,0),new ie(0,-1,0)],xee=Ae(({depthTexture:i,bd3D:e,dp:t})=>Ta(i,e).compare(t)),yee=Ae(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=tr("radius","float",n).setGroup(Zt),s=tr("mapSize","vec2",n).setGroup(Zt),o=r.div(s.x),a=Qi(e),l=Qo(Yf(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=Yf(e,l),u=bU(km.xy).mul(6.28318530718),f=eu(0,5,u),p=eu(1,5,u),x=eu(2,5,u),v=eu(3,5,u),w=eu(4,5,u);return Ta(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Ta(i,e.add(l.mul(p.x).add(c.mul(p.y)).mul(o))).compare(t)).add(Ta(i,e.add(l.mul(x.x).add(c.mul(x.y)).mul(o))).compare(t)).add(Ta(i,e.add(l.mul(v.x).add(c.mul(v.y)).mul(o))).compare(t)).add(Ta(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),Swe=Ae(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{let s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Ht("float").setGroup(Zt).onRenderUpdate(()=>n.camera.near),c=Ht("float").setGroup(Zt).onRenderUpdate(()=>n.camera.far),u=tr("bias","float",n).setGroup(Zt),f=se(1).toVar();return Wt(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let p;r.renderer.reversedDepthBuffer?(p=vJ(a.negate(),l,c),p.subAssign(u)):r.renderer.logarithmicDepthBuffer?(p=zC(a.negate(),l,c),p.addAssign(u)):(p=AU(a.negate(),l,c),p.addAssign(u));let x=s.normalize();f.assign(i({depthTexture:e,bd3D:x,dp:p,shadow:n}))}),f}),NO=class extends XM{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===XN?xee:yee}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return Swe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new p_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Hc:th;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,c=s.coordinateSystem===qa,u=c?ywe:bwe,f=c?vwe:wwe;n.setSize(t.mapSize.width,t.mapSize.width);let p=s.autoClear,x=s.getClearColor(xwe),v=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let w=0;w<6;w++){s.setRenderTarget(n,w),s.clear();let S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),Pv.setFromMatrixPosition(r.matrixWorld),a.position.copy(Pv),o8.copy(a.position),o8.add(u[w]),a.up.copy(f[w]),a.lookAt(o8),a.updateMatrixWorld(),l.makeTranslation(-Pv.x,-Pv.y,-Pv.z),jY.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(jY,a.coordinateSystem,a.reversedDepth);let T=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${w+1}`,s.render(o,a),o.name=T}s.autoClear=p,s.setClearColor(x,v)}},vee=(i,e)=>new NO(i,e),Zf=class extends s0{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new Ut,this.colorNode=e&&e.colorNode||Ht(this.color).setGroup(Zt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=_n.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return CU(this.light).sub(e.context.positionView||Jr)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return _ee(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){let r=this.light.shadow.shadowNode,s;r!==void 0?s=Vt(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},IU=Ae(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{let n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),bee=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=IU({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},LO=class extends Zf{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Ht(0).setGroup(Zt),this.decayExponentNode=Ht(2).setGroup(Zt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return vee(this.light)}setupDirect(e){return bee({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},Twe=Ae(([i=Ri()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),Ewe=Ae(([i=Ri()],{renderer:e,material:t})=>{let n=F7(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=se(n.fwidth()).toVar();r=Nl(s.oneMinus(),s.add(1),n).oneMinus()}else r=Ko(n.greaterThan(1),0,1);return r}),$v=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Pl(i).toVar();return Ko(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),$M=Ae(([i,e])=>{let t=Pl(e).toVar(),n=se(i).toVar();return Ko(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),cs=Ae(([i])=>{let e=se(i).toVar();return fe(Sh(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),fr=Ae(([i,e])=>{let t=se(i).toVar();return e.assign(cs(t)),t.sub(se(e))}),Mwe=Ae(([i,e,t,n,r,s])=>{let o=se(s).toVar(),a=se(r).toVar(),l=se(n).toVar(),c=se(t).toVar(),u=se(e).toVar(),f=se(i).toVar(),p=se(ni(1,a)).toVar();return ni(1,o).mul(f.mul(p).add(u.mul(a))).add(o.mul(c.mul(p).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),Cwe=Ae(([i,e,t,n,r,s])=>{let o=se(s).toVar(),a=se(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),p=se(ni(1,a)).toVar();return ni(1,o).mul(f.mul(p).add(u.mul(a))).add(o.mul(c.mul(p).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),wee=Eo([Mwe,Cwe]),Rwe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=se(u).toVar(),p=se(c).toVar(),x=se(l).toVar(),v=se(a).toVar(),w=se(o).toVar(),S=se(s).toVar(),T=se(r).toVar(),P=se(n).toVar(),R=se(t).toVar(),C=se(e).toVar(),L=se(i).toVar(),D=se(ni(1,x)).toVar(),F=se(ni(1,p)).toVar();return se(ni(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(R.mul(D).add(P.mul(x))))).add(f.mul(F.mul(T.mul(D).add(S.mul(x))).add(p.mul(w.mul(D).add(v.mul(x))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Pwe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=se(u).toVar(),p=se(c).toVar(),x=se(l).toVar(),v=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),P=pe(n).toVar(),R=pe(t).toVar(),C=pe(e).toVar(),L=pe(i).toVar(),D=se(ni(1,x)).toVar(),F=se(ni(1,p)).toVar();return se(ni(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(R.mul(D).add(P.mul(x))))).add(f.mul(F.mul(T.mul(D).add(S.mul(x))).add(p.mul(w.mul(D).add(v.mul(x))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),See=Eo([Rwe,Pwe]),Iwe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=it(i).toVar(),o=it(s.bitAnd(it(7))).toVar(),a=se($v(o.lessThan(it(4)),r,n)).toVar(),l=se(bn(2,$v(o.lessThan(it(4)),n,r))).toVar();return $M(a,Pl(o.bitAnd(it(1)))).add($M(l,Pl(o.bitAnd(it(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Nwe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=it(i).toVar(),l=it(a.bitAnd(it(15))).toVar(),c=se($v(l.lessThan(it(8)),o,s)).toVar(),u=se($v(l.lessThan(it(4)),s,$v(l.equal(it(12)).or(l.equal(it(14))),o,r))).toVar();return $M(c,Pl(l.bitAnd(it(1)))).add($M(u,Pl(l.bitAnd(it(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),no=Eo([Iwe,Nwe]),Lwe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Bm(i).toVar();return pe(no(s.x,r,n),no(s.y,r,n),no(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),Dwe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=Bm(i).toVar();return pe(no(a.x,o,s,r),no(a.y,o,s,r),no(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),lc=Eo([Lwe,Dwe]),Fwe=Ae(([i])=>{let e=se(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Owe=Ae(([i])=>{let e=se(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Bwe=Ae(([i])=>{let e=pe(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Tee=Eo([Fwe,Bwe]),Uwe=Ae(([i])=>{let e=pe(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Eee=Eo([Owe,Uwe]),Ml=Ae(([i,e])=>{let t=fe(e).toVar(),n=it(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(fe(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Mee=Ae(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Ml(t,fe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Ml(i,fe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Ml(e,fe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Ml(t,fe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Ml(i,fe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Ml(e,fe(4))),e.addAssign(i)}),bb=Ae(([i,e,t])=>{let n=it(t).toVar(),r=it(e).toVar(),s=it(i).toVar();return n.bitXorAssign(r),n.subAssign(Ml(r,fe(14))),s.bitXorAssign(n),s.subAssign(Ml(n,fe(11))),r.bitXorAssign(s),r.subAssign(Ml(s,fe(25))),n.bitXorAssign(r),n.subAssign(Ml(r,fe(16))),s.bitXorAssign(n),s.subAssign(Ml(n,fe(4))),r.bitXorAssign(s),r.subAssign(Ml(s,fe(14))),n.bitXorAssign(r),n.subAssign(Ml(r,fe(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Jo=Ae(([i])=>{let e=it(i).toVar();return se(e).div(se(it(fe(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),Mh=Ae(([i])=>{let e=se(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),kwe=Ae(([i])=>{let e=fe(i).toVar(),t=it(it(1)).toVar(),n=it(it(fe(3735928559)).add(t.shiftLeft(it(2))).add(it(13))).toVar();return bb(n.add(it(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),Gwe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(it(2)).toVar(),s=it().toVar(),o=it().toVar(),a=it().toVar();return s.assign(o.assign(a.assign(it(fe(3735928559)).add(r.shiftLeft(it(2))).add(it(13))))),s.addAssign(it(n)),o.addAssign(it(t)),bb(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),zwe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(it(3)).toVar(),a=it().toVar(),l=it().toVar(),c=it().toVar();return a.assign(l.assign(c.assign(it(fe(3735928559)).add(o.shiftLeft(it(2))).add(it(13))))),a.addAssign(it(s)),l.addAssign(it(r)),c.addAssign(it(n)),bb(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Vwe=Ae(([i,e,t,n])=>{let r=fe(n).toVar(),s=fe(t).toVar(),o=fe(e).toVar(),a=fe(i).toVar(),l=it(it(4)).toVar(),c=it().toVar(),u=it().toVar(),f=it().toVar();return c.assign(u.assign(f.assign(it(fe(3735928559)).add(l.shiftLeft(it(2))).add(it(13))))),c.addAssign(it(a)),u.addAssign(it(o)),f.addAssign(it(s)),Mee(c,u,f),c.addAssign(it(r)),bb(c,u,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),qwe=Ae(([i,e,t,n,r])=>{let s=fe(r).toVar(),o=fe(n).toVar(),a=fe(t).toVar(),l=fe(e).toVar(),c=fe(i).toVar(),u=it(it(5)).toVar(),f=it().toVar(),p=it().toVar(),x=it().toVar();return f.assign(p.assign(x.assign(it(fe(3735928559)).add(u.shiftLeft(it(2))).add(it(13))))),f.addAssign(it(c)),p.addAssign(it(l)),x.addAssign(it(a)),Mee(f,p,x),f.addAssign(it(o)),p.addAssign(it(s)),bb(f,p,x)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Fi=Eo([kwe,Gwe,zwe,Vwe,qwe]),Hwe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(Fi(n,t)).toVar(),s=Bm().toVar();return s.x.assign(r.bitAnd(fe(255))),s.y.assign(r.shiftRight(fe(8)).bitAnd(fe(255))),s.z.assign(r.shiftRight(fe(16)).bitAnd(fe(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Wwe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(Fi(s,r,n)).toVar(),a=Bm().toVar();return a.x.assign(o.bitAnd(fe(255))),a.y.assign(o.shiftRight(fe(8)).bitAnd(fe(255))),a.z.assign(o.shiftRight(fe(16)).bitAnd(fe(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),cc=Eo([Hwe,Wwe]),jwe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(fr(e.x,t)).toVar(),s=se(fr(e.y,n)).toVar(),o=se(Mh(r)).toVar(),a=se(Mh(s)).toVar(),l=se(wee(no(Fi(t,n),r,s),no(Fi(t.add(fe(1)),n),r.sub(1),s),no(Fi(t,n.add(fe(1))),r,s.sub(1)),no(Fi(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Tee(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),Xwe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(fr(e.x,t)).toVar(),o=se(fr(e.y,n)).toVar(),a=se(fr(e.z,r)).toVar(),l=se(Mh(s)).toVar(),c=se(Mh(o)).toVar(),u=se(Mh(a)).toVar(),f=se(See(no(Fi(t,n,r),s,o,a),no(Fi(t.add(fe(1)),n,r),s.sub(1),o,a),no(Fi(t,n.add(fe(1)),r),s,o.sub(1),a),no(Fi(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),no(Fi(t,n,r.add(fe(1))),s,o,a.sub(1)),no(Fi(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),no(Fi(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),no(Fi(t.add(fe(1)),n.add(fe(1)),r.add(fe(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Eee(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),NU=Eo([jwe,Xwe]),$we=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(fr(e.x,t)).toVar(),s=se(fr(e.y,n)).toVar(),o=se(Mh(r)).toVar(),a=se(Mh(s)).toVar(),l=pe(wee(lc(cc(t,n),r,s),lc(cc(t.add(fe(1)),n),r.sub(1),s),lc(cc(t,n.add(fe(1))),r,s.sub(1)),lc(cc(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Tee(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Ywe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(fr(e.x,t)).toVar(),o=se(fr(e.y,n)).toVar(),a=se(fr(e.z,r)).toVar(),l=se(Mh(s)).toVar(),c=se(Mh(o)).toVar(),u=se(Mh(a)).toVar(),f=pe(See(lc(cc(t,n,r),s,o,a),lc(cc(t.add(fe(1)),n,r),s.sub(1),o,a),lc(cc(t,n.add(fe(1)),r),s,o.sub(1),a),lc(cc(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),lc(cc(t,n,r.add(fe(1))),s,o,a.sub(1)),lc(cc(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),lc(cc(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),lc(cc(t.add(fe(1)),n.add(fe(1)),r.add(fe(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Eee(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),wb=Eo([$we,Ywe]),Zwe=Ae(([i])=>{let e=se(i).toVar(),t=fe(cs(e)).toVar();return Jo(Fi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Kwe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar();return Jo(Fi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Qwe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar(),r=fe(cs(e.z)).toVar();return Jo(Fi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),Jwe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar(),r=fe(cs(e.z)).toVar(),s=fe(cs(e.w)).toVar();return Jo(Fi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),eSe=Eo([Zwe,Kwe,Qwe,Jwe]),tSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(cs(e)).toVar();return pe(Jo(Fi(t,fe(0))),Jo(Fi(t,fe(1))),Jo(Fi(t,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),nSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar();return pe(Jo(Fi(t,n,fe(0))),Jo(Fi(t,n,fe(1))),Jo(Fi(t,n,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),iSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar(),r=fe(cs(e.z)).toVar();return pe(Jo(Fi(t,n,r,fe(0))),Jo(Fi(t,n,r,fe(1))),Jo(Fi(t,n,r,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),rSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar(),r=fe(cs(e.z)).toVar(),s=fe(cs(e.w)).toVar();return pe(Jo(Fi(t,n,r,s,fe(0))),Jo(Fi(t,n,r,s,fe(1))),Jo(Fi(t,n,r,s,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),$C=Eo([tSe,nSe,iSe,rSe]),YM=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=se(0).toVar(),c=se(1).toVar();return Ci(o,()=>{l.addAssign(c.mul(NU(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),YC=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=se(1).toVar();return Ci(o,()=>{l.addAssign(c.mul(wb(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),sSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar();return ft(YM(a,o,s,r),YM(a.add(pe(fe(19),fe(193),fe(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),oSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(YC(a,o,s,r)).toVar(),c=se(YM(a.add(pe(fe(19),fe(193),fe(17))),o,s,r)).toVar();return Lt(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),aSe=Ae(([i,e,t,n,r,s,o])=>{let a=fe(o).toVar(),l=se(s).toVar(),c=fe(r).toVar(),u=fe(n).toVar(),f=fe(t).toVar(),p=fe(e).toVar(),x=ft(i).toVar(),v=pe($C(ft(p.add(u),f.add(c)))).toVar(),w=ft(v.x,v.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=ft(ft(se(p),se(f)).add(w)).toVar(),T=ft(S.sub(x)).toVar();return Wt(a.equal(fe(2)),()=>Qi(T.x).add(Qi(T.y))),Wt(a.equal(fe(3)),()=>br(Qi(T.x),Qi(T.y))),pc(T,T)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),lSe=Ae(([i,e,t,n,r,s,o,a,l])=>{let c=fe(l).toVar(),u=se(a).toVar(),f=fe(o).toVar(),p=fe(s).toVar(),x=fe(r).toVar(),v=fe(n).toVar(),w=fe(t).toVar(),S=fe(e).toVar(),T=pe(i).toVar(),P=pe($C(pe(S.add(x),w.add(p),v.add(f)))).toVar();P.subAssign(.5),P.mulAssign(u),P.addAssign(.5);let R=pe(pe(se(S),se(w),se(v)).add(P)).toVar(),C=pe(R.sub(T)).toVar();return Wt(c.equal(fe(2)),()=>Qi(C.x).add(Qi(C.y)).add(Qi(C.z))),Wt(c.equal(fe(3)),()=>br(Qi(C.x),Qi(C.y),Qi(C.z))),pc(C,C)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),k1=Eo([aSe,lSe]),cSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(fr(s.x,o),fr(s.y,a)).toVar(),c=se(1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(l,u,f,o,a,r,n)).toVar();c.assign(Qa(c,p))})}),Wt(n.equal(fe(0)),()=>{c.assign(Ma(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),uSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(fr(s.x,o),fr(s.y,a)).toVar(),c=ft(1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(l,u,f,o,a,r,n)).toVar();Wt(p.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(p)}).ElseIf(p.lessThan(c.y),()=>{c.y.assign(p)})})}),Wt(n.equal(fe(0)),()=>{c.assign(Ma(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),hSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(fr(s.x,o),fr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(l,u,f,o,a,r,n)).toVar();Wt(p.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(p)}).ElseIf(p.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(p)}).ElseIf(p.lessThan(c.z),()=>{c.z.assign(p)})})}),Wt(n.equal(fe(0)),()=>{c.assign(Ma(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),fSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=se(1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(c,f,p,x,o,a,l,r,n)).toVar();u.assign(Qa(u,v))})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ma(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),dSe=Eo([cSe,fSe]),pSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=ft(1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(c,f,p,x,o,a,l,r,n)).toVar();Wt(v.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(v)}).ElseIf(v.lessThan(u.y),()=>{u.y.assign(v)})})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ma(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),ASe=Eo([uSe,pSe]),mSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(c,f,p,x,o,a,l,r,n)).toVar();Wt(v.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(v)}).ElseIf(v.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(v)}).ElseIf(v.lessThan(u.z),()=>{u.z.assign(v)})})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ma(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),LU=Eo([hSe,mSe]),gSe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=fe(i).toVar(),p=ft(e).toVar(),x=ft(t).toVar(),v=ft(n).toVar(),w=se(r).toVar(),S=se(s).toVar(),T=se(o).toVar(),P=Pl(a).toVar(),R=fe(l).toVar(),C=se(c).toVar(),L=se(u).toVar(),D=p.mul(x).add(v),F=se(0).toVar();return Wt(f.equal(fe(0)),()=>{F.assign(wb(D))}),Wt(f.equal(fe(1)),()=>{F.assign($C(D))}),Wt(f.equal(fe(2)),()=>{F.assign(LU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(YC(pe(D,0),R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(ru(F,S,T))}),F}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),_Se=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=fe(i).toVar(),p=pe(e).toVar(),x=pe(t).toVar(),v=pe(n).toVar(),w=se(r).toVar(),S=se(s).toVar(),T=se(o).toVar(),P=Pl(a).toVar(),R=fe(l).toVar(),C=se(c).toVar(),L=se(u).toVar(),D=p.mul(x).add(v),F=se(0).toVar();return Wt(f.equal(fe(0)),()=>{F.assign(wb(D))}),Wt(f.equal(fe(1)),()=>{F.assign($C(D))}),Wt(f.equal(fe(2)),()=>{F.assign(LU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(YC(D,R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(ru(F,S,T))}),F}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),xSe=Ae(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return Wt(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(Sh(r)).mul(6).toVar();let s=fe(I7(r)),o=r.sub(se(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());Wt(s.equal(fe(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(fe(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(fe(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(fe(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(fe(4)),()=>{n.assign(pe(c,a,t))}).Else(()=>{n.assign(pe(t,a,l))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),ySe=Ae(([i])=>{let e=pe(i).toVar(),t=se(e.x).toVar(),n=se(e.y).toVar(),r=se(e.z).toVar(),s=se(Qa(t,Qa(n,r))).toVar(),o=se(br(t,br(n,r))).toVar(),a=se(o.sub(s)).toVar(),l=se().toVar(),c=se().toVar(),u=se().toVar();return u.assign(o),Wt(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),Wt(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Wt(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(us(2,r.sub(t).div(a)))}).Else(()=>{l.assign(us(4,t.sub(n).div(a)))}),l.mulAssign(1/6),Wt(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),vSe=Ae(([i])=>{let e=pe(i).toVar(),t=A7(b7(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(uc(br(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return jn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Cee=(i,e)=>{i=se(i),e=se(e);let t=ft(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Nl(i.sub(t),i.add(t),e)},Ree=(i,e,t,n)=>jn(i,e,t[n].clamp()),bSe=(i,e,t=Ri())=>Ree(i,e,t,"x"),wSe=(i,e,t=Ri())=>Ree(i,e,t,"y"),SSe=(i,e,t,n,r=Ri())=>{let s=r.x.clamp(),o=r.y.clamp(),a=jn(i,e,s),l=jn(t,n,s);return jn(a,l,o)},Pee=(i,e,t,n,r)=>jn(i,e,Cee(t,n[r])),TSe=(i,e,t,n=Ri())=>Pee(i,e,t,n,"x"),ESe=(i,e,t,n=Ri())=>Pee(i,e,t,n,"y"),MSe=(i=1,e=0,t=Ri())=>t.mul(i).add(e),CSe=(i,e=1)=>(i=se(i),i.abs().pow(e).mul(i.sign())),RSe=(i,e=1,t=.5)=>se(i).sub(t).mul(e).add(t),PSe=(i=Ri(),e=1,t=0)=>NU(i.convert("vec2|vec3")).mul(e).add(t),ISe=(i=Ri(),e=1,t=0)=>wb(i.convert("vec2|vec3")).mul(e).add(t),NSe=(i=Ri(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(wb(i),NU(i.add(ft(19,73)))).mul(e).add(t)),LSe=(i,e=Ri(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>gSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),DSe=(i,e=Ri(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>_Se(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),FSe=(i=Ri(),e=1)=>dSe(i.convert("vec2|vec3"),e,fe(1)),OSe=(i=Ri(),e=1)=>ASe(i.convert("vec2|vec3"),e,fe(1)),BSe=(i=Ri(),e=1)=>LU(i.convert("vec2|vec3"),e,fe(1)),USe=(i=Ri())=>eSe(i.convert("vec2|vec3")),kSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>YM(i,fe(e),t,n).mul(r),GSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>sSe(i,fe(e),t,n).mul(r),zSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>YC(i,fe(e),t,n).mul(r),VSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>oSe(i,fe(e),t,n).mul(r),qSe=(i,e=se(0))=>us(i,e),HSe=(i,e=se(0))=>ni(i,e),WSe=(i,e=se(1))=>bn(i,e),jSe=(i,e=se(1))=>Il(i,e),XSe=(i,e=se(1))=>CC(i,e),$Se=(i,e=se(1))=>uc(i,e),YSe=(i=se(0),e=se(1))=>E7(i,e),ZSe=()=>U1,KSe=()=>XJ,QSe=(i,e=se(1))=>ni(e,i),JSe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),eTe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),tTe=(i,e,t,n)=>i.equal(e).mix(t,n),nTe=(i,e=null)=>{if(typeof e=="string"){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},iTe=(i,e=ft(.5,.5),t=ft(1,1),n=se(0),r=ft(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){let o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=ft(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},rTe=(i,e)=>{i=ft(i),e=se(e);let t=e.mul(Math.PI/180);return yb(i,t)},sTe=(i,e,t)=>{i=pe(i),e=se(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=se(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},oTe=(i,e)=>(i=pe(i),e=se(e),iU(i,e)),aTe=Ae(([i,e,t])=>{let n=Qo(i).toVar(),r=ni(se(.5).mul(e.sub(t)),Eh).div(n).toVar(),s=ni(se(-.5).mul(e.sub(t)),Eh).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(se(0)).select(r.x,s.x),o.y=n.y.greaterThan(se(0)).select(r.y,s.y),o.z=n.z.greaterThan(se(0)).select(r.z,s.z);let a=Qa(o.x,o.y,o.z).toVar();return Eh.add(n.mul(a)).toVar().sub(t)}),Iee=Ae(([i,e])=>{let t=i.x,n=i.y,r=i.z,s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(bn(t,t).sub(bn(n,n)))),s}),U=Object.freeze({__proto__:null,BRDF_GGX:xU,BRDF_Lambert:Nm,BasicPointShadowFilter:xee,BasicShadowFilter:hee,Break:mJ,Const:zK,Continue:fye,DFGLUT:ib,D_GGX:RJ,Discard:nQ,EPSILON:RC,F_Schlick:I1,Fn:Ae,HALF_PI:oxe,INFINITY:ixe,If:Wt,Loop:Ci,NodeAccess:So,NodeShaderStage:p1,NodeType:O1e,NodeUpdateType:_n,OnBeforeFrameUpdate:oye,OnBeforeMaterialUpdate:sye,OnBeforeObjectUpdate:rye,OnFrameUpdate:lJ,OnMaterialUpdate:iye,OnObjectUpdate:xb,PCFShadowFilter:fee,PCFSoftShadowFilter:dee,PI:xM,PI2:rxe,PointShadowFilter:yee,Return:gxe,Schlick_to_F0:RF,ShaderNode:g1,Stack:SC,Switch:K1e,TBNViewMatrix:_m,TWO_PI:sxe,VSMShadowFilter:pee,V_GGX_SmithCorrelated:CJ,Var:GK,VarIntent:VK,abs:Qi,acesFilmicToneMapping:iee,acos:T7,acosh:mK,add:us,addMethodChaining:Be,addNodeElement:_xe,agxToneMapping:ree,all:oK,alphaT:pM,ambientOcclusion:I8,and:jZ,anisotropy:jp,anisotropyB:vm,anisotropyT:qv,any:aK,append:J1e,array:UZ,asin:pK,asinh:AK,assign:kZ,atan:E7,atanh:gK,atomicAdd:Sbe,atomicAnd:Cbe,atomicFunc:Fh,atomicLoad:bbe,atomicMax:Ebe,atomicMin:Mbe,atomicOr:Rbe,atomicStore:wbe,atomicSub:Tbe,atomicXor:Pbe,attenuationColor:y7,attenuationDistance:x7,attribute:Rl,attributeArray:Rve,backgroundBlurriness:ZJ,backgroundIntensity:_O,backgroundRotation:KJ,batch:fJ,batchColor:hU,bentNormalView:NQ,billboarding:gve,bitAnd:ZZ,bitNot:KZ,bitOr:QZ,bitXor:JZ,bitangentGeometry:Yxe,bitangentLocal:Zxe,bitangentView:PQ,bitangentWorld:Kxe,bitcast:WJ,blendBurn:kve,blendColor:qve,blendDodge:Gve,blendOverlay:Vve,blendScreen:zve,blur:FJ,bool:Pl,buffer:O1,bufferAttribute:z7,builtin:Jf,builtinAOContext:UK,builtinShadowContext:BK,bumpMap:iU,bvec2:NZ,bvec3:A7,bvec4:LZ,bypass:eQ,cache:JK,call:GZ,cameraFar:Yp,cameraIndex:l0,cameraNear:$p,cameraNormalMatrix:Exe,cameraPosition:lQ,cameraProjectionMatrix:Ea,cameraProjectionMatrixInverse:aQ,cameraViewMatrix:c0,cameraViewport:Mxe,cameraWorldMatrix:_b,cbrt:IK,cdl:$ve,ceil:IC,checker:Twe,cineonToneMapping:nee,clamp:ru,clearcoat:hM,clearcoatNormalView:Zp,clearcoatRoughness:x1,clipSpace:hQ,code:WC,color:IZ,colorSpaceToWorking:LC,colorToDirection:eye,compute:QK,computeKernel:q7,computeSkinning:hye,context:Qf,convert:FZ,convertColorSpace:uxe,convertToTexture:Tve,cos:Jc,cosh:hK,countLeadingZeros:$2e,countOneBits:Y2e,countTrailingZeros:X2e,cross:Yf,cubeTexture:Ta,cubeTextureBase:tU,dFdx:R7,dFdy:P7,dashSize:bm,debug:rQ,decrement:sK,decrementBefore:iK,defaultBuildStages:nM,defaultShaderStages:EZ,defined:T1,degrees:cK,deltaTime:cve,densityFogFactor:lee,depth:mU,depthPass:Jve,determinant:bK,difference:EK,diffuseColor:Mi,diffuseContribution:pm,directPointLight:bee,directionToColor:Jxe,directionToFaceDirection:Gxe,dispersion:v7,disposeShadowMaterial:mee,distance:TK,div:Il,dot:pc,drawIndex:KK,dynamicBufferAttribute:dxe,element:DZ,emissive:P8,equal:zZ,equirectDirection:wF,equirectUV:gU,exp:w7,exp2:E1,exponentialHeightFogFactor:ube,expression:Cl,faceDirection:Q7,faceForward:B7,faceforward:axe,float:se,floatBitsToInt:H2e,floatBitsToUint:jJ,floor:Sh,fog:TO,fract:iu,frameGroup:txe,frameId:XJ,frontFacing:fQ,fwidth:N7,gain:K2e,gapSize:Qv,getConstNodeType:PZ,getCurrentStack:f7,getDirection:LJ,getDistanceAttenuation:IU,getGeometryRoughness:MJ,getNormalFromDepth:Mve,getParallaxCorrectNormal:aTe,getRoughness:_U,getScreenPosition:Eve,getShIrradianceAt:Iee,getShadowMaterial:Aee,getShadowRenderObjectFunction:gee,getTextureIndex:qJ,getViewPosition:m1,ggxConvolution:OJ,globalId:pbe,glsl:abe,glslFn:lbe,grayscale:Hve,greaterThan:b7,greaterThanEqual:WZ,hash:Z2e,highpModelNormalViewMatrix:K8,highpModelViewMatrix:Z8,hue:Xve,increment:rK,incrementBefore:nK,inspector:sQ,instance:uJ,instanceColor:uU,instanceIndex:nu,instancedArray:Pve,instancedBufferAttribute:FC,instancedDynamicBufferAttribute:V7,instancedMesh:hJ,int:fe,intBitsToFloat:W2e,interleavedGradientNoise:bU,inverse:wK,inverseSqrt:S7,inversesqrt:lxe,invocationLocalIndex:mxe,invocationSubgroupIndex:Axe,ior:Hv,iridescence:EC,iridescenceIOR:fM,iridescenceThickness:dM,isolate:b1,ivec2:vr,ivec3:p7,ivec4:m7,js:sbe,label:kK,length:Th,lengthSq:F7,lessThan:qZ,lessThanEqual:HZ,lightPosition:MU,lightProjectionUV:cee,lightShadowMatrix:XC,lightTargetDirection:RU,lightTargetPosition:uee,lightViewPosition:CU,lightingContext:_J,lights:awe,linearDepth:CM,linearToneMapping:eee,localId:Abe,log:PC,log2:wh,logarithmicDepthToViewZ:gye,luminance:SU,mat2:TC,mat3:io,mat4:e0,matcapUV:BJ,materialAO:oJ,materialAlphaTest:DQ,materialAnisotropy:YQ,materialAnisotropyVector:A1,materialAttenuationColor:iJ,materialAttenuationDistance:nJ,materialClearcoat:qQ,materialClearcoatNormal:WQ,materialClearcoatRoughness:HQ,materialColor:FQ,materialDispersion:sJ,materialEmissive:BQ,materialEnvIntensity:rM,materialEnvRotation:SM,materialIOR:tJ,materialIridescence:ZQ,materialIridescenceIOR:KQ,materialIridescenceThickness:QQ,materialLightMap:cU,materialLineDashOffset:lU,materialLineDashSize:oU,materialLineGapSize:aU,materialLineScale:sU,materialLineWidth:TM,materialMetalness:zQ,materialNormal:VQ,materialOpacity:rU,materialPointSize:rJ,materialReference:Wf,materialReflectivity:sM,materialRefractionRatio:AQ,materialRotation:jQ,materialRoughness:GQ,materialSheen:XQ,materialSheenRoughness:$Q,materialShininess:OQ,materialSpecular:UQ,materialSpecularColor:kQ,materialSpecularIntensity:lF,materialSpecularStrength:Wv,materialThickness:eJ,materialTransmission:JQ,max:br,maxMipLevel:X7,mediumpModelViewMatrix:uQ,metalness:Xf,min:Qa,mix:jn,mixElement:LK,mod:CC,modelDirection:Dxe,modelNormalMatrix:cQ,modelPosition:Fxe,modelRadius:Uxe,modelScale:Oxe,modelViewMatrix:Rh,modelViewPosition:Bxe,modelViewProjection:aJ,modelWorldMatrix:hc,modelWorldMatrixInverse:kxe,morphReference:gJ,mrt:HJ,mul:bn,mx_aastep:Cee,mx_add:qSe,mx_atan2:YSe,mx_cell_noise_float:USe,mx_contrast:RSe,mx_divide:jSe,mx_fractal_noise_float:kSe,mx_fractal_noise_vec2:GSe,mx_fractal_noise_vec3:zSe,mx_fractal_noise_vec4:VSe,mx_frame:KSe,mx_heighttonormal:oTe,mx_hsvtorgb:xSe,mx_ifequal:tTe,mx_ifgreater:JSe,mx_ifgreatereq:eTe,mx_invert:QSe,mx_modulo:XSe,mx_multiply:WSe,mx_noise_float:PSe,mx_noise_vec3:ISe,mx_noise_vec4:NSe,mx_place2d:iTe,mx_power:$Se,mx_ramp4:SSe,mx_ramplr:bSe,mx_ramptb:wSe,mx_rgbtohsv:ySe,mx_rotate2d:rTe,mx_rotate3d:sTe,mx_safepower:CSe,mx_separate:nTe,mx_splitlr:TSe,mx_splittb:ESe,mx_srgb_texture_to_lin_rec709:vSe,mx_subtract:HSe,mx_timer:ZSe,mx_transform_uv:MSe,mx_unifiednoise2d:LSe,mx_unifiednoise3d:DSe,mx_worley_noise_float:FSe,mx_worley_noise_vec2:OSe,mx_worley_noise_vec3:BSe,negate:C7,negateOnBackSide:Gm,neutralToneMapping:see,nodeArray:ym,nodeImmutable:xt,nodeObject:Vt,nodeObjectIntent:kv,nodeObjects:wC,nodeProxy:Vn,nodeProxyConstructor:h7,nodeProxyIntent:lt,normalFlat:dQ,normalGeometry:OC,normalLocal:ea,normalMap:oF,normalView:oi,normalViewGeometry:M1,normalWorld:u0,normalWorldGeometry:pQ,normalize:Qo,not:$Z,notEqual:VZ,numWorkgroups:fbe,objectDirection:Cxe,objectGroup:BZ,objectPosition:Pxe,objectRadius:Lxe,objectScale:Ixe,objectViewPosition:Nxe,objectWorldMatrix:Rxe,oneMinus:_K,or:XZ,orthographicDepthToViewZ:yJ,oscSawtooth:dve,oscSine:uve,oscSquare:hve,oscTriangle:fve,output:y1,outputStruct:z2e,overloadingFn:Eo,overrideNode:zJ,overrideNodes:VJ,packHalf2x16:nve,packNormalToRGB:nU,packSnorm2x16:eve,packUnorm2x16:tve,parabola:cO,parallaxDirection:IQ,parallaxUV:Qxe,parameter:U2e,pass:Kve,passTexture:Qve,pcurve:Q2e,perspectiveDepthToViewZ:GC,pmremTexture:vU,pointShadow:vee,pointUV:Ive,pointWidth:exe,positionGeometry:Yo,positionLocal:hr,positionPrevious:Im,positionView:Jr,positionViewDirection:zi,positionWorld:Eh,positionWorldDirection:K7,posterize:Yve,pow:uc,pow2:L7,pow3:MK,pow4:D7,premultiplyAlpha:W7,property:Kf,quadBroadcast:twe,quadSwapDiagonal:Ybe,quadSwapX:Xbe,quadSwapY:$be,radians:lK,rand:NK,range:hbe,rangeFogFactor:aee,reciprocal:yK,reference:tr,referenceBuffer:vQ,reflect:SK,reflectVector:_Q,reflectView:mQ,reflector:bve,refract:O7,refractVector:xQ,refractView:gQ,reinhardToneMapping:tee,remap:H7,remapClamp:tQ,renderGroup:Zt,renderOutput:j7,rendererReference:XK,replaceDefaultUV:pve,rotate:yb,rotateUV:Ave,roughness:vh,round:xK,rtt:YJ,sRGBTransferEOTF:HK,sRGBTransferOETF:WK,sample:Cve,sampler:bxe,samplerComparison:wxe,saturate:NC,saturation:Wve,screenCoordinate:km,screenDPR:Y7,screenSize:Pm,screenUV:tu,select:Ko,setCurrentStack:Kv,setName:U7,shaderStages:iM,shadow:_ee,shadowPositionWorld:PU,shapeCircle:Ewe,sharedUniformGroup:MC,sheen:El,sheenRoughness:Xp,shiftLeft:eK,shiftRight:tK,shininess:AM,sign:M7,sin:Sa,sinc:J2e,sinh:uK,skinning:AJ,smoothstep:Nl,smoothstepElement:DK,specularColor:i0,specularColorBlended:mm,specularF90:gm,spherizeUV:mve,split:Q1e,spritesheetUV:xve,sqrt:Ma,stack:aM,step:Cm,stepElement:FK,storage:t0,storageBarrier:_be,storageTexture:QJ,storageTexture3D:Lve,struct:G2e,sub:ni,subBuild:wm,subgroupAdd:Lbe,subgroupAll:Hbe,subgroupAnd:kbe,subgroupAny:Wbe,subgroupBallot:Nbe,subgroupBroadcast:Zbe,subgroupBroadcastFirst:jbe,subgroupElect:Ibe,subgroupExclusiveAdd:Fbe,subgroupExclusiveMul:Ube,subgroupInclusiveAdd:Dbe,subgroupInclusiveMul:Bbe,subgroupIndex:pxe,subgroupMax:qbe,subgroupMin:Vbe,subgroupMul:Obe,subgroupOr:Gbe,subgroupShuffle:Kbe,subgroupShuffleDown:ewe,subgroupShuffleUp:Jbe,subgroupShuffleXor:Qbe,subgroupSize:mbe,subgroupXor:zbe,tan:fK,tangentGeometry:BC,tangentLocal:r0,tangentView:UC,tangentWorld:RQ,tanh:dK,texture:ai,texture3D:wU,texture3DLevel:Ove,texture3DLoad:Fve,textureBarrier:xbe,textureBicubic:Hye,textureBicubicLevel:yU,textureCubeUV:DJ,textureLevel:vxe,textureLoad:Qr,textureSize:Rm,textureStore:Nve,thickness:_7,time:U1,toneMapping:$K,toneMappingExposure:YK,toonOutlinePass:ebe,transformDirection:CK,transformNormal:J7,transformNormalByInverseViewMatrix:PK,transformNormalByViewMatrix:RK,transformNormalToView:eU,transformedClearcoatNormalView:qxe,transformedNormalView:zxe,transformedNormalWorld:Vxe,transmission:mM,transpose:vK,triNoise3D:ave,triplanarTexture:yve,triplanarTextures:$J,trunc:I7,uint:it,uintBitsToFloat:j2e,uniform:Ht,uniformArray:wo,uniformCubeTexture:Hxe,uniformFlow:OK,uniformGroup:OZ,uniformTexture:yxe,unpackHalf2x16:sve,unpackNormal:rF,unpackRGBToNormal:LQ,unpackSnorm2x16:ive,unpackUnorm2x16:rve,unpremultiplyAlpha:iQ,userData:Bve,uv:Ri,uvec2:d7,uvec3:Bm,uvec4:g7,varying:a0,varyingProperty:Um,vec2:ft,vec3:pe,vec4:Lt,vectorComponents:Om,velocity:Uve,vertexColor:wJ,vertexIndex:ZK,vertexStage:qK,vibrance:jve,viewZToLogarithmicDepth:zC,viewZToOrthographicDepth:Sm,viewZToPerspectiveDepth:AU,viewZToReversedOrthographicDepth:mye,viewZToReversedPerspectiveDepth:vJ,viewport:S1,viewportCoordinate:oQ,viewportDepthTexture:pU,viewportLinearDepth:_ye,viewportMipTexture:dU,viewportOpaqueMipTexture:xJ,viewportResolution:Txe,viewportSafeUV:_ve,viewportSharedTexture:Zve,viewportSize:Z7,viewportTexture:pye,viewportUV:Sxe,vogelDiskSample:eu,wgsl:obe,wgslFn:cbe,workgroupArray:ybe,workgroupBarrier:gbe,workgroupId:dbe,workingToColorSpace:jK,xor:YZ}),Kc=new sb,DO=class extends Nh{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){let r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,o=!1;if(s===null)r._clearColor.getRGB(Kc),Kc.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Kc),Kc.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Kc.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let R=function(){s.removeEventListener("dispose",R),u.material.dispose(),u.geometry.dispose()},p=Lt(c).mul(_O).context({getUV:()=>KJ.mul(pQ),getTextureLevel:()=>ZJ}),x=Ea.element(3).element(3).equal(1),v=Il(1,Ea.element(1).element(1)).mul(3),w=x.select(hr.mul(v),hr),S=Rh.mul(Lt(w,0)),T=Ea.mul(Lt(S.xyz,1));T=T.setZ(T.w);let P=new pr;P.name="Background.material",P.side=ui,P.depthTest=!1,P.depthWrite=!1,P.allowOverride=!1,P.fog=!1,P.lights=!1,P.vertexNode=T,P.colorNode=p,l.backgroundMeshNode=p,l.backgroundMesh=u=new Hn(new pa(1,32,32),P),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",R)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Lt(c).mul(_O),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else Ge("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?Kc.set(0,0,0,1):a==="alpha-blend"&&Kc.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Kc.r,l.g=Kc.g,l.b=Kc.b,l.a=Kc.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}},lTe=0,ub=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=lTe++}},FO=class{constructor(e,t,n,r,s,o,a,l,c,u,f=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=f,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=c,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new ub(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},ZM=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},OO=class{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},KM=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},BO=class extends KM{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},UO=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},cTe=0,Yv=class{constructor(e=null){this.id=cTe++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},kO=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Dh=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},GO=class extends Dh{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},zO=class extends Dh{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},VO=class extends Dh{constructor(e,t=new ie){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},qO=class extends Dh{constructor(e,t=new gn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},HO=class extends Dh{constructor(e,t=new Ut){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},WO=class extends Dh{constructor(e,t=new w_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},jO=class extends Dh{constructor(e,t=new Sn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},XO=class extends Dh{constructor(e,t=new on){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},$O=class extends GO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},YO=class extends zO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},ZO=class extends VO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},KO=class extends qO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},QO=class extends HO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},JO=class extends WO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},eB=class extends jO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},tB=class extends XO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},uTe=0,XY=new WeakMap,$Y=new WeakMap,hTe=new WeakMap,fTe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),zE=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),Nee=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(Nee(i.subBuildsCache[e]))return!0}return!1},QM=class{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=aM(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new Yv,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:uTe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===ss&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new ca(e,t,n)}createCubeRenderTarget(e,t){return new RM(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4",n=this.renderer.getRenderTarget();if(n!==null){let r=n.textures[e].type,s=n.textures[e].format,o="vec";r===Ir?o="ivec":r===pi&&(o="uvec"),s===Lf||s===Xu?r===Ir?t="int":r===pi?t="uint":t="float":s===Ss||s===$u?t=`${o}2`:s===Nf||s===m2?t=`${o}3`:t=`${o}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let n=t[0].groupNode,r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((f,p)=>f.nodeUniform.node.id-p.nodeUniform.node.id);for(let f of u.uniforms)o+=f.nodeUniform.node.id}else o+=u.nodeUniform.id;let a=this.renderer._currentRenderContext||this.renderer,l=XY.get(a);l===void 0&&(l=new Map,XY.set(a,l));let c=F1(o);s=l.get(c),s===void 0&&(s=new ub(e,t),l.set(c,s))}else s=new ub(e,t);return s}getBindGroupArray(e,t){let n=this.bindings[t],r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){let t={},n=this.bindings;for(let r of iM)for(let s in n[r]){let o=n[r][s],a=t[s]||(t[s]=[]);for(let l of o)a.includes(l)===!1&&a.push(l)}e=[];for(let r in t){let s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let n=e[t];this.bindingsIndexes[n.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==_n.NONE||n!==_n.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==_n.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==_n.NONE&&this.updateBeforeNodes.push(e),n!==_n.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===vi||e.magFilter===np||e.magFilter===Jl||e.magFilter===go||e.minFilter===vi||e.minFilter===np||e.minFilter===Jl||e.minFilter===go}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new Yv(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){je("Abstract function.")}getInstanceIndex(){je("Abstract function.")}getDrawIndex(){je("Abstract function.")}getFrontFacing(){je("Abstract function.")}getFragCoord(){je("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let s in r)if(Nee(r[s]))return!0}return!1}generateTexture(){je("Abstract function.")}generateTextureLod(){je("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){let o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){let r=[];for(let s of t){let{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new Ut:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new ie:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new gn)),e==="float")return zE(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${zE(t.r)}, ${zE(t.g)}, ${zE(t.b)} )`;let n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let n=this.attributes;for(let s of n)if(s.name===e)return s;let r=new ZM(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?"float":t===Ir?"int":t===pi?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=wZ(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return fTe.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let n=t.array,r=e.itemSize,s=e.normalized,o;return!(e instanceof f_)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){let t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=aM(this.stack);let e=f7();return this.stacks.push(e),Kv(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,Kv(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];if(this.subBuildLayers.length===0)return s;let o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){let n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t,n=null){let r=this.getDataFromNode(e,"vertex"),s=r.bufferAttribute;if(s===void 0){let o=this.uniforms.index++;n===null&&(n="nodeAttribute"+o),s=new ZM(n,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){let s=this.getDataFromNode(e,r,this.globalCache),o=s.structType;if(o===void 0){let a=this.structs.index++;n===null&&(n="StructType"+a),o=new kO(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){let n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){let s=this.getDataFromNode(e,n,this.globalCache),o=s.uniform;if(o===void 0){let a=this.uniforms.index++;o=new OO(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){let o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds),l=o[a];if(l===void 0){let c=s?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),f=this.vars[c]||(this.vars[c]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+f,this.vars[c]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));let p=e.getArrayCount(this);l=new KM(t,n,s,p),s||u.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){let o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds),l=o[a];if(l===void 0){let c=this.varyings,u=c.length;t===null&&(t="nodeVarying"+u),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new BO(t,n,r,s),c.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){let t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=e.name,s=r,o=this.getPropertyName(e),a=1;for(;n[o]!==void 0;)s=r+"_"+a++,e.name=s,o=this.getPropertyName(e);s!==r&&je(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){let r=this.getDataFromNode(e),s=r.code;if(s===void 0){let o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new UO("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e),s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(let a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){let r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;4160+`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,n=$Y.get(t);n===void 0&&(n=new WeakMap,$Y.set(t,n));let r=n.get(e);if(r===void 0){r=new WM;let s=this.currentFunctionNode;this.currentFunctionNode=r,r.code=this.buildFunctionCode(e),this.currentFunctionNode=s,n.set(e,r)}return r}flowShaderNode(e){let t=e.layout,n={[Symbol.iterator](){let o=0,a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(let o of t.inputs)n[o.name]=new UM(o.type,o.name);e.layout=null;let r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){let r=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){let n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,c={code:""};this.flow=c,this.vars={},this.declarations={},this.cache=new Yv,this.stack=aM();for(let u of nM)this.setBuildStage(u),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),c}getFunctionOperator(){return null}buildFunctionCode(){je("Abstract function.")}flowChildNode(e,t=null){let n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){let s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);let c={...this.context};delete c.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=c;let u=null;if(this.buildStage==="generate"){let f=this.flowChildNode(t,n);r!==null&&(f.code+=`${this.tab+r} = ${f.result};41614161 `),this.flowCode[e]=this.flowCode[e]+f.code,u=f}else u=t.build(this);return this.setShaderStage(a),this.cache=o,this.tab=s,this.context=l,u}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){je("Abstract function.")}getVaryings(){je("Abstract function.")}getVar(e,t,n=null){return`${n!==null?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e,t=!1){let n=[],r=this.vars[e];if(r!==void 0)for(let s of r)n.push(`${this.getVar(s.type,s.name,s.count)};`);return n.join(t?`41624162 `:`41634163 `)}getUniforms(){je("Abstract function.")}getCodes(e){let t=this.codes[e],n="";if(t!==void 0)for(let r of t)n+=r.code+`4164-`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){je("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){let s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}prebuild(){let{object:e,renderer:t,material:n}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:Ge('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:Ge('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(Ge(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new pr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of nM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of iM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of nM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of iM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await dL()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=lTe.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let n=this.getSharedDataFromNode(e),r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new XO(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new $O(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new YO(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new KO(e);else if(t==="color")r=new ZO(e);else if(t==="mat2")r=new QO(e);else if(t==="mat3")r=new JO(e);else if(t==="mat4")r=new eB(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;let r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${"185"} - Node System4165-`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||wK(this.object).useVelocity===!0}},JM=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){let t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){let s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===_n.RENDER){let r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){let s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===_n.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===_n.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===_n.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===_n.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===_n.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},hb=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};hb.isNodeFunctionInput=!0;var tB=class extends Kf{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},nB=class extends Kf{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:CU(this.light),lightColor:e}}},iB=class extends Kf{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=EU(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Ht(new Ut).setGroup(Kt)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=u0.dot(r).mul(.5).add(.5),a=jn(n,t,o);e.context.irradiance.addAssign(a)}},fb=class extends Kf{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Ht(0).setGroup(Kt),this.penumbraCosNode=Ht(0).setGroup(Kt),this.cutoffDistanceNode=Ht(0).setGroup(Kt),this.decayExponentNode=Ht(0).setGroup(Kt),this.colorNode=Ht(this.color).setGroup(Kt)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:n,penumbraCosNode:r}=this;return Nl(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=aee(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){let{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(CU(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=PU({lightDistance:u,cutoffDistance:n,decayExponent:r}),p=t.mul(c).mul(f),x,v;return s.colorNode?(v=this.getLightCoord(e),x=s.colorNode(v)):s.map&&(v=this.getLightCoord(e),x=ai(s.map,v.xy).onRenderUpdate(()=>s.map)),x&&(p=v.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(x),p)),{lightColor:p,lightDirection:a}}},rB=class extends fb{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let n=this.light.iesMap,r=null;if(n&&n.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=ai(n,ft(s,0),0),r=this._iesTextureNode.r}else r=super.getSpotAttenuation(e,t);return r}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},sB=class extends Kf{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new ie);this.lightProbe=wo(t)}update(e){let{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){let t=Ree(u0,this.lightProbe);e.context.irradiance.addAssign(t)}},uTe=Ae(([i,e])=>{let t=i.abs().sub(e);return Th(br(t,0)).add(Za(br(t.x,t.y),0))}),oB=class extends fb{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=se(0),n=this.penumbraCosNode,r=XC(this.light).mul(e.context.positionWorld||Eh);return Wt(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=uTe(s.xy.sub(ft(.5)),ft(.5)),a=Il(-1,ni(1,S7(n)).sub(1));t.assign(NC(o.mul(-2).mul(a)))}),t}},o8=new on,VE=new on,Iv=null,aB=class extends Kf{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Ht(new ie).setGroup(Kt),this.halfWidth=Ht(new ie).setGroup(Kt),this.updateType=_n.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;VE.identity(),o8.copy(t.matrixWorld),o8.premultiply(n),VE.extractRotation(o8),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(VE),this.halfHeight.value.applyMatrix4(VE)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=ai(Iv.LTC_FLOAT_1),n=ai(Iv.LTC_FLOAT_2)):(t=ai(Iv.LTC_HALF_1),n=ai(Iv.LTC_HALF_2));let{colorNode:r,light:s}=this,o=MU(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Iv=e}},eC=class{parseFunction(){je("Abstract function.")}},db=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){je("Abstract function.")}};db.isNodeFunction=!0;var hTe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,fTe=/[a-z_0-9]+/ig,XY="#pragma main",dTe=i=>{i=i.trim();let e=i.indexOf(XY),t=e!==-1?i.slice(e+XY.length):i,n=t.match(hTe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=fTe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let v=s[l][0]==="const";v===!0&&l++;let w=s[l][0];w==="in"||w==="out"||w==="inout"?l++:w="";let S=s[l++][0],T=Number.parseInt(s[l][0]);Number.isNaN(T)===!1?l++:T=null;let P=s[l++][0];a.push(new hb(S,P,T,w,v))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],p=n[1]!==void 0?n[1]:"",x=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:p,inputsCode:r,blockCode:c,headerCode:x}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},lB=class extends db{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=dTe(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t,n=this.blockCode;if(n!==""){let{type:r,inputsCode:s,headerCode:o,precision:a}=this,l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}},cB=class extends eC{parseFunction(e){return new lB(e)}},sc=[],Gf=[],$Y=Ht(0,"int").setGroup(Kt),uB=class extends Nh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new JM,this.nodeBuilderCache=new Map,this.callHashCache=new Ih,this.groupsData=new Ih,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===_n.OBJECT)return!0;sc[0]=t,sc[1]=e;let n=this.groupsData.get(sc);return n===void 0&&this.groupsData.set(sc,n={}),sc[0]=null,sc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new pr),t?await l.buildAsync():l.build(),Ge("TSL: "+c)}return l};if(t)return a().then(l=>(r=this._createNodeBuilderState(l),s.set(o,r),r.usedTimes++,n.nodeBuilderState=r,r));{let l=this._createNodeBuilder(e,e.material);try{l.build()}catch(c){l=this._createNodeBuilder(e,new pr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new Fr(c.stack)),Ge("TSL: "+c,u)}r=this._createNodeBuilderState(l),s.set(o,r)}}r.usedTimes++,n.nodeBuilderState=r}return r}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let n=this.getForRenderCacheKey(e),r=this.nodeBuilderCache.get(n);return r!==void 0?(r.usedTimes++,t.nodeBuilderState=r,r):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),n=t.nodeBuilderState;if(n===void 0||t.version!==e.version){let r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n,t.version=e.version}return n}_createNodeBuilderState(e){return new DO(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){sc[0]=e,sc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(sc)||{};if(r.callId!==n){if(Gf.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Gf.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Gf.push(t.getCacheKey(!0)),Gf.push(this.renderer.shadowMap.enabled?1:0),Gf.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Gf.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Gf.push(s.getCacheKey()),r.callId=n,r.cacheKey=gb(Gf),this.callHashCache.set(sc,r),Gf.length=0}return sc[0]=null,sc[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),n=e.background;if(n){let r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){let s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===ep||n.mapping===tp||n.mapping===Hu){if(e.backgroundBlurriness>0||n.mapping===Hu)return yU(n);{let o;return n.isCubeTexture===!0?o=Sa(n):o=ai(n),SJ(o)}}else{if(n.isTexture===!0)return ai(n,tu.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&Ge("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){let t=this.get(e),n=e.fog;if(n){if(t.fog!==n){let r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){let s=tr("color","color",n).setGroup(Kt),o=tr("density","float",n).setGroup(Kt);return SO(s,oee(o))}else if(n.isFog){let s=tr("color","color",n).setGroup(Kt),o=tr("near","float",n).setGroup(Kt),a=tr("far","float",n).setGroup(Kt);return SO(s,see(o,a))}else Ge("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),n=e.environment;if(n){if(t.environment!==n){let r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Sa(n);if(n.isTexture===!0)return ai(n);Ge("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){let o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,n;return e.isArrayTexture?this.backend.isWebGLBackend?n=ai(e,tu).depth(Jf("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,tu).depth($Y).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,tu).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){$Y.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){let t=e.getNodeBuilderState();for(let n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){let t=this.getNodeFrame(),n=this.getForCompute(e);for(let r of n.updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(let r of n.updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new JM,this.nodeBuilderCache=new Map,this.cacheLib={}}},a8=new oa,tC=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new on,this.viewNormalMatrix=new Sn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,n){let r=e.length;for(let s=0;s<r;s++){a8.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=a8.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=a8.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let r=t.clippingPlanes,s=r.length,o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new gn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new i(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}},hB=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},zp=[],fB=class{constructor(){this.bundles=new Ih}get(e,t,n){let r=this.bundles;zp[0]=e,zp[1]=t,zp[2]=n;let s=r.get(zp);return s===void 0&&(s=new hB(e,t,n),r.set(zp,s)),zp[0]=null,zp[1]=null,zp[2]=null,s}dispose(){this.bundles=new Ih}},nC=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(let r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){je(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){je(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);n.set(t,e)}},pTe=new cb,YY=new WeakMap,dB=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new cb().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return pTe;let t=YY.get(e);return t===void 0&&(t=this.createNode(),YY.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},_m=class extends la{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},KY=new ie,ZY=new ie,QY=new WeakMap,pB=class extends ko{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Rr,this._cameraL.viewport=new gn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Rr,this._cameraR.viewport=new gn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new v_,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=yTe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=gTe.bind(this),this._onSessionEnd=_Te.bind(this),this._onInputSourcesChange=xTe.bind(this),this._onAnimationFrame=vTe.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&je("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&je("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let n=this._renderer.getOutputRenderTarget();if(n===null||n.isXRRenderTarget!==!0)return;let r=this.getBinding();if(r===null||typeof r.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:o}=t.get(e.texture);if(!(s===void 0||o===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(o,s);try{r.foveateBoundTexture(o,this.getFoveation())}catch(a){Kn(`XRManager: Unable to foveate bound XR post-processing texture. ${a.name}: ${a.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(Kn("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),n=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=n,e.updateRenderState({layers:[n]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new la(n.textureWidth,n.textureHeight,{depth:2,minFilter:vi,magFilter:vi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Kn("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let n=e.backend,r=e._textures,s=n.get?n.get(t):null;s&&(s.descriptors=void 0);let o=a=>{a!=null&&(n.delete&&n.delete(a),r.delete&&r.delete(a))};for(let a=0;a<t.textures.length;a++)o(t.textures[a]);o(t.depthTexture),o(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),n={colorTexture:null,viewDescriptors:[],viewports:[]};for(let r=0;r<e.length;r++){let s=t.getViewSubImage(this._glProjLayer,e[r]);n.colorTexture===null&&(n.colorTexture=s.colorTexture),n.viewports.push(s.viewport),s.getViewDescriptor&&n.viewDescriptors.push(s.getViewDescriptor())}return n}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){let c=new wA(e,t),u=new _m(s,o,{format:xr,type:Gi,depthTexture:new ss(s,o,l.stencil?Go:pi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?Qs:xs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new Us({color:16777215,side:Ao});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let p=new Hn(c,f);p.position.copy(n),p.quaternion.copy(r);let x={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:p,material:f,rendercall:a,renderTarget:u};if(this._layers.push(x),this._session!==null){x.plane.material=new Us({color:16777215,side:Ao}),x.plane.material.blending=If,x.plane.material.blendEquation=Bs,x.plane.material.blendSrc=qc,x.plane.material.blendDst=qc,x.xrlayer=this._createXRLayer(x);let v=this._session.renderState.layers;v.unshift(x.xrlayer),this._session.updateRenderState({layers:v})}else u.isXRRenderTarget=!1;return p}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new yA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new _m(o,a,{format:xr,type:Gi,depthTexture:new ss(o,a,c.stencil?Go:pi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?Qs:xs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let p=new Us({color:16777215,side:ui});p.map=f.texture,p.map.offset.y=1,p.map.repeat.y=-1;let x=new Hn(u,p);x.position.copy(r),x.quaternion.copy(s);let v={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:x,material:p,rendercall:l,renderTarget:f};if(this._layers.push(v),this._session!==null){v.plane.material=new Us({color:16777215,side:ui}),v.plane.material.blending=If,v.plane.material.blendEquation=Bs,v.plane.material.blendSrc=qc,v.plane.material.blendDst=qc,v.xrlayer=this._createXRLayer(v);let w=this._session.renderState.layers;w.unshift(v.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return x}renderLayers(){let e=new ie,t=new ys,n=this._renderer,r=this.isPresenting;this.isPresenting=!1;let s=new Oe;n.getSize(s);let o=n.getRenderTarget();for(let a of this._layers){a.renderTarget.isXRRenderTarget=this._session!==null,a.renderTarget._hasExternalTextures=a.renderTarget.isXRRenderTarget;let l=n.contextNode,c;if(a.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){a.xrlayer.transform=new XRRigidTransform(a.plane.getWorldPosition(e),a.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(a.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(a.renderTarget,u.colorTexture,void 0),n._setXRLayerSize(a.renderTarget.width,a.renderTarget.height),c=QY.get(l),c===void 0&&(c=l.context({getOutput:f=>W7(f,n.toneMapping,n.outputColorSpace)}),QY.set(l,c))}else c=l;n.contextNode=c,n.setRenderTarget(a.renderTarget),a.rendercall(),n.contextNode=l}n.setRenderTarget(o),n._setXRLayerSize(s.x,s.y),this.isPresenting=r}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let n=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let r=null,s=null,o=null,a=n.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(o=t.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,r=t.stencil?Qs:xs,s=t.stencil?Go:pi);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(l.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let c=this._glBinding.createProjectionLayer(l),u=[c];this._glProjLayer=c,t.setPixelRatio(1),t._setXRLayerSize(c.textureWidth,c.textureHeight);let f=this._useMultiview?2:1,p=new ss(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new _m(c.textureWidth,c.textureHeight,{format:xr,type:Gi,colorSpace:t.outputColorSpace,depthTexture:p,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let x of this._layers)x.plane.material=new Us({color:16777215,side:x.type==="cylinder"?ui:Ao}),x.plane.material.blending=If,x.plane.material.blendEquation=Bs,x.plane.material.blendSrc=qc,x.plane.material.blendDst=qc,x.xrlayer=this._createXRLayer(x),u.unshift(x.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,n,r);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new _m(s.framebufferWidth,s.framebufferHeight,{format:xr,type:Gi,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){let t=this._session;if(t===null)return;let n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;let l=e.parent,c=s.cameras;JY(s,l);for(let u=0;u<c.length;u++)JY(c[u],l);c.length===2?ATe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),mTe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new qd,this._controllers[e]=t),t}};function ATe(i,e,t){KY.setFromMatrixPosition(e.matrixWorld),ZY.setFromMatrixPosition(t.matrixWorld);let n=KY.distanceTo(ZY),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],f=(s[8]+1)/s[0],p=o*u,x=o*f,v=n/(-u+f),w=v*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(v),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{let S=o+v,T=a+v,P=p-w,R=x+(n-w),C=l*a/T*S,L=c*a/T*S;i.projectionMatrix.makePerspective(P,R,C,L,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function JY(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function mTe(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Ef*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function gTe(i){let e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;let t=this._controllers[e];if(t!==void 0){let n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function _Te(){let i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){let n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let t of this._layers)t.renderTarget=new _m(t.pixelwidth,t.pixelheight,{format:xr,type:Gi,depthTexture:new ss(t.pixelwidth,t.pixelheight,t.stencilBuffer?Go:pi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?Qs:xs),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function xTe(i){let e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){let r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){let r=i.added[n],s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}let o=e[s];o&&o.connect(r)}}function yTe(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function vTe(i,e){if(e===void 0)return;let t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){let l=a.views,c=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&c===null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let p=0;p<l.length;p++){let x=l[p],v;if(c!==null)v=c.viewports[p];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,x);v=S.viewport,p===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else v=s.getViewport(x);let w=this._cameras[p];w===void 0&&(w=new Rr,w.layers.enable(p),w.viewport=new gn,w.matrixWorldAutoUpdate=!1,this._cameras[p]=w),w.matrix.fromArray(x.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(x.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(v.x,v.y,v.width,v.height),p===0&&(t.matrix.copy(w.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(w)}c!==null&&c.colorTexture!==null&&r.setXRRenderTargetTextures(this._xrRenderTarget,c.colorTexture,c.viewDescriptors),n.setOutputRenderTarget(this._xrRenderTarget);let f=n._getFrameBufferTarget();n.xr.foveateBoundTexture(f)}for(let l=0;l<this._controllers.length;l++){let c=this._controllerInputSources[l],u=this._controllers[l];c!==null&&u!==void 0&&u.update(c,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}var AB=class extends ko{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new gn(0,0,this._width,this._height),this._scissor=new gn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new xA,this.depthTexture=new ss}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){let a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}},eK=new Hd,s1=new Oe,l8=new gn,qE=new Kl,HE=new xy,o1=new on,zf=new gn,bTe={[Ao]:ui,[ui]:Ao,[ir]:ir},mB=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:c=0,getFallback:u=null,outputBufferType:f=Li,multiview:p=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Wr,this.toneMapping=ks,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new $F,this.contextNode=Qf(),this.library=new nC,this.lighting=new dB,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new AB(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new vM,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let x=this.alpha===!0?0:1;this._clearColor=new sb(0,0,0,x),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=f,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:Jd},this.xr=new pB(this,p),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(v,w,S)=>{await this.compileAsync(S,w,v);let P=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,R=this._renderLists.get(v,w),C=this._renderContexts.get(P,this._mrt),L=v.overrideMaterial||S.material,D=this._objects.get(S,L,v,w,R.lightsNode,C,C.clippingContext),{fragmentShader:F,vertexShader:N}=D.getNodeBuilderState();return{fragmentShader:F,vertexShader:N}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new uB(this,n),this._animation=new qF(this,this._nodes,this.info),this._attributes=new jF(n,this.info),this._background=new LO(this,this._nodes),this._geometries=new XF(this._attributes,this.info),this._textures=new iO(this,n,this.info),this._pipelines=new ZF(n,this._nodes,this.info),this._bindings=new QF(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new WF(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new eO(this.lighting),this._bundles=new fB,this._renderContexts=new nO(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,c=this._compilationPromises;n===null&&(n=e);let u=e.isScene===!0?e:n.isScene===!0?n:eK,p=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,x=this._renderContexts.get(p,this._mrt),v=this._activeMipmapLevel,w=[];this._currentRenderContext=x,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),x.depth=this.depth,x.stencil=this.stencil,x.clippingContext||(x.clippingContext=new tC),x.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,p);let S=t.isArrayCamera?HE:qE;t.isArrayCamera?S.setFromArrayCamera(t):(o1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(o1,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,x.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),p!==null){this._textures.updateRenderTarget(p,v);let D=this._textures.get(p);x.textures=D.textures,x.depthTexture=D.depthTexture}else x.textures=null,x.depthTexture=null;n!==e?this._background.update(n,T,x):this._background.update(u,T,x);let P=T.opaque,R=T.transparent,C=T.transparentDoublePass,L=T.lightsNode;this.opaque===!0&&P.length>0&&this._renderObjects(P,t,u,L),this.transparent===!0&&R.length>0&&this._renderTransparents(R,C,t,u,L),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let F=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);F.drawRange=D.object.geometry.drawRange,F.group=D.group,await this._nodes.getForRenderAsync(F),this._nodes.updateBefore(F),this._geometries.updateForRender(F),this._nodes.updateForRender(F),this._bindings.updateForRender(F);let N=[];this._pipelines.getForRender(F,N),N.length>0&&await Promise.all(N),this._nodes.updateAfter(F),await dL()}}async renderAsync(e,t){Kn('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){Ge("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=Y8,t.modelNormalViewMatrix=K8):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===Y8&&e.modelNormalViewMatrix===K8}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Kn('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:4164+`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){je("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){let s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}prebuild(){let{object:e,renderer:t,material:n}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:Ge('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:Ge('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(Ge(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new pr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of nM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of iM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of nM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of iM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await pL()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=hTe.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let n=this.getSharedDataFromNode(e),r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new $O(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new YO(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new ZO(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new KO(e);else if(t==="color")r=new QO(e);else if(t==="mat2")r=new JO(e);else if(t==="mat3")r=new eB(e);else if(t==="mat4")r=new tB(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;let r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${"185"} - Node System4165+`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||TZ(this.object).useVelocity===!0}},JM=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){let t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){let s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===_n.RENDER){let r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){let s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===_n.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===_n.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===_n.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===_n.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===_n.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},hb=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};hb.isNodeFunctionInput=!0;var nB=class extends Zf{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},iB=class extends Zf{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:RU(this.light),lightColor:e}}},rB=class extends Zf{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=MU(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Ht(new Ut).setGroup(Zt)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=u0.dot(r).mul(.5).add(.5),a=jn(n,t,o);e.context.irradiance.addAssign(a)}},fb=class extends Zf{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Ht(0).setGroup(Zt),this.penumbraCosNode=Ht(0).setGroup(Zt),this.cutoffDistanceNode=Ht(0).setGroup(Zt),this.decayExponentNode=Ht(0).setGroup(Zt),this.colorNode=Ht(this.color).setGroup(Zt)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:n,penumbraCosNode:r}=this;return Nl(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=cee(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){let{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(RU(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=IU({lightDistance:u,cutoffDistance:n,decayExponent:r}),p=t.mul(c).mul(f),x,v;return s.colorNode?(v=this.getLightCoord(e),x=s.colorNode(v)):s.map&&(v=this.getLightCoord(e),x=ai(s.map,v.xy).onRenderUpdate(()=>s.map)),x&&(p=v.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(x),p)),{lightColor:p,lightDirection:a}}},sB=class extends fb{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let n=this.light.iesMap,r=null;if(n&&n.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=ai(n,ft(s,0),0),r=this._iesTextureNode.r}else r=super.getSpotAttenuation(e,t);return r}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},oB=class extends Zf{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new ie);this.lightProbe=wo(t)}update(e){let{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){let t=Iee(u0,this.lightProbe);e.context.irradiance.addAssign(t)}},dTe=Ae(([i,e])=>{let t=i.abs().sub(e);return Th(br(t,0)).add(Qa(br(t.x,t.y),0))}),aB=class extends fb{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=se(0),n=this.penumbraCosNode,r=XC(this.light).mul(e.context.positionWorld||Eh);return Wt(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=dTe(s.xy.sub(ft(.5)),ft(.5)),a=Il(-1,ni(1,T7(n)).sub(1));t.assign(NC(o.mul(-2).mul(a)))}),t}},a8=new on,VE=new on,Iv=null,lB=class extends Zf{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Ht(new ie).setGroup(Zt),this.halfWidth=Ht(new ie).setGroup(Zt),this.updateType=_n.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;VE.identity(),a8.copy(t.matrixWorld),a8.premultiply(n),VE.extractRotation(a8),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(VE),this.halfHeight.value.applyMatrix4(VE)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=ai(Iv.LTC_FLOAT_1),n=ai(Iv.LTC_FLOAT_2)):(t=ai(Iv.LTC_HALF_1),n=ai(Iv.LTC_HALF_2));let{colorNode:r,light:s}=this,o=CU(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Iv=e}},eC=class{parseFunction(){je("Abstract function.")}},db=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){je("Abstract function.")}};db.isNodeFunction=!0;var pTe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,ATe=/[a-z_0-9]+/ig,YY="#pragma main",mTe=i=>{i=i.trim();let e=i.indexOf(YY),t=e!==-1?i.slice(e+YY.length):i,n=t.match(pTe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=ATe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let v=s[l][0]==="const";v===!0&&l++;let w=s[l][0];w==="in"||w==="out"||w==="inout"?l++:w="";let S=s[l++][0],T=Number.parseInt(s[l][0]);Number.isNaN(T)===!1?l++:T=null;let P=s[l++][0];a.push(new hb(S,P,T,w,v))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],p=n[1]!==void 0?n[1]:"",x=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:p,inputsCode:r,blockCode:c,headerCode:x}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},cB=class extends db{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=mTe(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t,n=this.blockCode;if(n!==""){let{type:r,inputsCode:s,headerCode:o,precision:a}=this,l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}},uB=class extends eC{parseFunction(e){return new cB(e)}},sc=[],Gf=[],ZY=Ht(0,"int").setGroup(Zt),hB=class extends Nh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new JM,this.nodeBuilderCache=new Map,this.callHashCache=new Ih,this.groupsData=new Ih,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===_n.OBJECT)return!0;sc[0]=t,sc[1]=e;let n=this.groupsData.get(sc);return n===void 0&&this.groupsData.set(sc,n={}),sc[0]=null,sc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new pr),t?await l.buildAsync():l.build(),Ge("TSL: "+c)}return l};if(t)return a().then(l=>(r=this._createNodeBuilderState(l),s.set(o,r),r.usedTimes++,n.nodeBuilderState=r,r));{let l=this._createNodeBuilder(e,e.material);try{l.build()}catch(c){l=this._createNodeBuilder(e,new pr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new Fr(c.stack)),Ge("TSL: "+c,u)}r=this._createNodeBuilderState(l),s.set(o,r)}}r.usedTimes++,n.nodeBuilderState=r}return r}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let n=this.getForRenderCacheKey(e),r=this.nodeBuilderCache.get(n);return r!==void 0?(r.usedTimes++,t.nodeBuilderState=r,r):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),n=t.nodeBuilderState;if(n===void 0||t.version!==e.version){let r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n,t.version=e.version}return n}_createNodeBuilderState(e){return new FO(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){sc[0]=e,sc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(sc)||{};if(r.callId!==n){if(Gf.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Gf.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Gf.push(t.getCacheKey(!0)),Gf.push(this.renderer.shadowMap.enabled?1:0),Gf.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Gf.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Gf.push(s.getCacheKey()),r.callId=n,r.cacheKey=gb(Gf),this.callHashCache.set(sc,r),Gf.length=0}return sc[0]=null,sc[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),n=e.background;if(n){let r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){let s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===ep||n.mapping===tp||n.mapping===Hu){if(e.backgroundBlurriness>0||n.mapping===Hu)return vU(n);{let o;return n.isCubeTexture===!0?o=Ta(n):o=ai(n),EJ(o)}}else{if(n.isTexture===!0)return ai(n,tu.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&Ge("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){let t=this.get(e),n=e.fog;if(n){if(t.fog!==n){let r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){let s=tr("color","color",n).setGroup(Zt),o=tr("density","float",n).setGroup(Zt);return TO(s,lee(o))}else if(n.isFog){let s=tr("color","color",n).setGroup(Zt),o=tr("near","float",n).setGroup(Zt),a=tr("far","float",n).setGroup(Zt);return TO(s,aee(o,a))}else Ge("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),n=e.environment;if(n){if(t.environment!==n){let r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Ta(n);if(n.isTexture===!0)return ai(n);Ge("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){let o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,n;return e.isArrayTexture?this.backend.isWebGLBackend?n=ai(e,tu).depth(Jf("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,tu).depth(ZY).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,tu).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){ZY.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){let t=e.getNodeBuilderState();for(let n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){let t=this.getNodeFrame(),n=this.getForCompute(e);for(let r of n.updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(let r of n.updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new JM,this.nodeBuilderCache=new Map,this.cacheLib={}}},l8=new aa,tC=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new on,this.viewNormalMatrix=new Sn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,n){let r=e.length;for(let s=0;s<r;s++){l8.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=l8.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=l8.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let r=t.clippingPlanes,s=r.length,o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new gn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new i(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}},fB=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},zp=[],dB=class{constructor(){this.bundles=new Ih}get(e,t,n){let r=this.bundles;zp[0]=e,zp[1]=t,zp[2]=n;let s=r.get(zp);return s===void 0&&(s=new fB(e,t,n),r.set(zp,s)),zp[0]=null,zp[1]=null,zp[2]=null,s}dispose(){this.bundles=new Ih}},nC=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(let r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){je(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){je(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);n.set(t,e)}},gTe=new cb,KY=new WeakMap,pB=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new cb().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return gTe;let t=KY.get(e);return t===void 0&&(t=this.createNode(),KY.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},xm=class extends ca{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},QY=new ie,JY=new ie,eZ=new WeakMap,AB=class extends Go{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Rr,this._cameraL.viewport=new gn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Rr,this._cameraR.viewport=new gn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new v_,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=wTe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=yTe.bind(this),this._onSessionEnd=vTe.bind(this),this._onInputSourcesChange=bTe.bind(this),this._onAnimationFrame=STe.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&je("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&je("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let n=this._renderer.getOutputRenderTarget();if(n===null||n.isXRRenderTarget!==!0)return;let r=this.getBinding();if(r===null||typeof r.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:o}=t.get(e.texture);if(!(s===void 0||o===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(o,s);try{r.foveateBoundTexture(o,this.getFoveation())}catch(a){Zn(`XRManager: Unable to foveate bound XR post-processing texture. ${a.name}: ${a.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(Zn("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),n=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=n,e.updateRenderState({layers:[n]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new ca(n.textureWidth,n.textureHeight,{depth:2,minFilter:vi,magFilter:vi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Zn("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let n=e.backend,r=e._textures,s=n.get?n.get(t):null;s&&(s.descriptors=void 0);let o=a=>{a!=null&&(n.delete&&n.delete(a),r.delete&&r.delete(a))};for(let a=0;a<t.textures.length;a++)o(t.textures[a]);o(t.depthTexture),o(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),n={colorTexture:null,viewDescriptors:[],viewports:[]};for(let r=0;r<e.length;r++){let s=t.getViewSubImage(this._glProjLayer,e[r]);n.colorTexture===null&&(n.colorTexture=s.colorTexture),n.viewports.push(s.viewport),s.getViewDescriptor&&n.viewDescriptors.push(s.getViewDescriptor())}return n}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){let c=new SA(e,t),u=new xm(s,o,{format:xr,type:Gi,depthTexture:new os(s,o,l.stencil?zo:pi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?Qs:ys),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new Us({color:16777215,side:Ao});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let p=new Hn(c,f);p.position.copy(n),p.quaternion.copy(r);let x={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:p,material:f,rendercall:a,renderTarget:u};if(this._layers.push(x),this._session!==null){x.plane.material=new Us({color:16777215,side:Ao}),x.plane.material.blending=If,x.plane.material.blendEquation=Bs,x.plane.material.blendSrc=qc,x.plane.material.blendDst=qc,x.xrlayer=this._createXRLayer(x);let v=this._session.renderState.layers;v.unshift(x.xrlayer),this._session.updateRenderState({layers:v})}else u.isXRRenderTarget=!1;return p}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new vA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new xm(o,a,{format:xr,type:Gi,depthTexture:new os(o,a,c.stencil?zo:pi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?Qs:ys),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let p=new Us({color:16777215,side:ui});p.map=f.texture,p.map.offset.y=1,p.map.repeat.y=-1;let x=new Hn(u,p);x.position.copy(r),x.quaternion.copy(s);let v={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:x,material:p,rendercall:l,renderTarget:f};if(this._layers.push(v),this._session!==null){v.plane.material=new Us({color:16777215,side:ui}),v.plane.material.blending=If,v.plane.material.blendEquation=Bs,v.plane.material.blendSrc=qc,v.plane.material.blendDst=qc,v.xrlayer=this._createXRLayer(v);let w=this._session.renderState.layers;w.unshift(v.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return x}renderLayers(){let e=new ie,t=new vs,n=this._renderer,r=this.isPresenting;this.isPresenting=!1;let s=new Oe;n.getSize(s);let o=n.getRenderTarget();for(let a of this._layers){a.renderTarget.isXRRenderTarget=this._session!==null,a.renderTarget._hasExternalTextures=a.renderTarget.isXRRenderTarget;let l=n.contextNode,c;if(a.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){a.xrlayer.transform=new XRRigidTransform(a.plane.getWorldPosition(e),a.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(a.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(a.renderTarget,u.colorTexture,void 0),n._setXRLayerSize(a.renderTarget.width,a.renderTarget.height),c=eZ.get(l),c===void 0&&(c=l.context({getOutput:f=>j7(f,n.toneMapping,n.outputColorSpace)}),eZ.set(l,c))}else c=l;n.contextNode=c,n.setRenderTarget(a.renderTarget),a.rendercall(),n.contextNode=l}n.setRenderTarget(o),n._setXRLayerSize(s.x,s.y),this.isPresenting=r}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let n=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let r=null,s=null,o=null,a=n.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(o=t.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,r=t.stencil?Qs:ys,s=t.stencil?zo:pi);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(l.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let c=this._glBinding.createProjectionLayer(l),u=[c];this._glProjLayer=c,t.setPixelRatio(1),t._setXRLayerSize(c.textureWidth,c.textureHeight);let f=this._useMultiview?2:1,p=new os(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new xm(c.textureWidth,c.textureHeight,{format:xr,type:Gi,colorSpace:t.outputColorSpace,depthTexture:p,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let x of this._layers)x.plane.material=new Us({color:16777215,side:x.type==="cylinder"?ui:Ao}),x.plane.material.blending=If,x.plane.material.blendEquation=Bs,x.plane.material.blendSrc=qc,x.plane.material.blendDst=qc,x.xrlayer=this._createXRLayer(x),u.unshift(x.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,n,r);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new xm(s.framebufferWidth,s.framebufferHeight,{format:xr,type:Gi,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){let t=this._session;if(t===null)return;let n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;let l=e.parent,c=s.cameras;tZ(s,l);for(let u=0;u<c.length;u++)tZ(c[u],l);c.length===2?_Te(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),xTe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new qd,this._controllers[e]=t),t}};function _Te(i,e,t){QY.setFromMatrixPosition(e.matrixWorld),JY.setFromMatrixPosition(t.matrixWorld);let n=QY.distanceTo(JY),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],f=(s[8]+1)/s[0],p=o*u,x=o*f,v=n/(-u+f),w=v*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(v),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{let S=o+v,T=a+v,P=p-w,R=x+(n-w),C=l*a/T*S,L=c*a/T*S;i.projectionMatrix.makePerspective(P,R,C,L,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function tZ(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function xTe(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Ef*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function yTe(i){let e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;let t=this._controllers[e];if(t!==void 0){let n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function vTe(){let i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){let n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let t of this._layers)t.renderTarget=new xm(t.pixelwidth,t.pixelheight,{format:xr,type:Gi,depthTexture:new os(t.pixelwidth,t.pixelheight,t.stencilBuffer?zo:pi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?Qs:ys),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function bTe(i){let e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){let r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){let r=i.added[n],s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}let o=e[s];o&&o.connect(r)}}function wTe(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function STe(i,e){if(e===void 0)return;let t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){let l=a.views,c=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&c===null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let p=0;p<l.length;p++){let x=l[p],v;if(c!==null)v=c.viewports[p];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,x);v=S.viewport,p===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else v=s.getViewport(x);let w=this._cameras[p];w===void 0&&(w=new Rr,w.layers.enable(p),w.viewport=new gn,w.matrixWorldAutoUpdate=!1,this._cameras[p]=w),w.matrix.fromArray(x.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(x.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(v.x,v.y,v.width,v.height),p===0&&(t.matrix.copy(w.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(w)}c!==null&&c.colorTexture!==null&&r.setXRRenderTargetTextures(this._xrRenderTarget,c.colorTexture,c.viewDescriptors),n.setOutputRenderTarget(this._xrRenderTarget);let f=n._getFrameBufferTarget();n.xr.foveateBoundTexture(f)}for(let l=0;l<this._controllers.length;l++){let c=this._controllerInputSources[l],u=this._controllers[l];c!==null&&u!==void 0&&u.update(c,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}var mB=class extends Go{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new gn(0,0,this._width,this._height),this._scissor=new gn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new yA,this.depthTexture=new os}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){let a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}},nZ=new Hd,s1=new Oe,c8=new gn,qE=new Zl,HE=new xy,o1=new on,zf=new gn,TTe={[Ao]:ui,[ui]:Ao,[ir]:ir},gB=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:c=0,getFallback:u=null,outputBufferType:f=Li,multiview:p=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Wr,this.toneMapping=ks,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new YF,this.contextNode=Qf(),this.library=new nC,this.lighting=new pB,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new mB(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new vM,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let x=this.alpha===!0?0:1;this._clearColor=new sb(0,0,0,x),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=f,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:Jd},this.xr=new AB(this,p),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(v,w,S)=>{await this.compileAsync(S,w,v);let P=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,R=this._renderLists.get(v,w),C=this._renderContexts.get(P,this._mrt),L=v.overrideMaterial||S.material,D=this._objects.get(S,L,v,w,R.lightsNode,C,C.clippingContext),{fragmentShader:F,vertexShader:N}=D.getNodeBuilderState();return{fragmentShader:F,vertexShader:N}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new hB(this,n),this._animation=new HF(this,this._nodes,this.info),this._attributes=new XF(n,this.info),this._background=new DO(this,this._nodes),this._geometries=new $F(this._attributes,this.info),this._textures=new rO(this,n,this.info),this._pipelines=new QF(n,this._nodes,this.info),this._bindings=new JF(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new jF(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new tO(this.lighting),this._bundles=new dB,this._renderContexts=new iO(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,c=this._compilationPromises;n===null&&(n=e);let u=e.isScene===!0?e:n.isScene===!0?n:nZ,p=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,x=this._renderContexts.get(p,this._mrt),v=this._activeMipmapLevel,w=[];this._currentRenderContext=x,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),x.depth=this.depth,x.stencil=this.stencil,x.clippingContext||(x.clippingContext=new tC),x.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,p);let S=t.isArrayCamera?HE:qE;t.isArrayCamera?S.setFromArrayCamera(t):(o1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(o1,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,x.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),p!==null){this._textures.updateRenderTarget(p,v);let D=this._textures.get(p);x.textures=D.textures,x.depthTexture=D.depthTexture}else x.textures=null,x.depthTexture=null;n!==e?this._background.update(n,T,x):this._background.update(u,T,x);let P=T.opaque,R=T.transparent,C=T.transparentDoublePass,L=T.lightsNode;this.opaque===!0&&P.length>0&&this._renderObjects(P,t,u,L),this.transparent===!0&&R.length>0&&this._renderTransparents(R,C,t,u,L),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let F=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);F.drawRange=D.object.geometry.drawRange,F.group=D.group,await this._nodes.getForRenderAsync(F),this._nodes.updateBefore(F),this._geometries.updateForRender(F),this._nodes.updateForRender(F),this._bindings.updateForRender(F);let N=[];this._pipelines.getForRender(F,N),N.length>0&&await Promise.all(N),this._nodes.updateAfter(F),await pL()}}async renderAsync(e,t){Zn('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){Ge("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=Z8,t.modelNormalViewMatrix=K8):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===Z8&&e.modelNormalViewMatrix===K8}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Zn('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:41664166 41674167 Message: ${e.message}`;e.reason&&(t+=`4168-Reason: ${e.reason}`),Ge(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),Ge(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,n){let{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s,a),c=this.backend.get(l);if(this._bundleNeedsUpdate(r,c)){this.backend.beginBundle(a),this._currentRenderBundle=l;let{transparentDoublePass:f,transparent:p,opaque:x}=o;this.opaque===!0&&x.length>0&&this._renderObjects(x,s,t,n),this.transparent===!0&&p.length>0&&this._renderTransparents(p,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let p=0,x=f.length;p<x;p++){let v=f[p];this._nodes.needsRefresh(v)&&(this._nodes.updateBefore(v),this._geometries.updateForRender(v),this._nodes.updateForRender(v),this._bindings.updateForRender(v),this._nodes.updateAfter(v))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let n=this._activeCubeFace;try{for(let r=0;r<t.texture.image.depth;r++)this._nodes.setOutputLayerIndex(r),this._activeCubeFace=r,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=n}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,n=e!==ks,r=t!==sn.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(s1),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new la(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:xr,colorSpace:sn.workingColorSpace,generateMipmaps:!1,minFilter:vi,magFilter:vi,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let S=()=>{c.removeEventListener("dispose",S),u.dispose(),this._frameBufferTargets.delete(c)};c.addEventListener("dispose",S),this._frameBufferTargets.set(c,u)}let f=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,f!==null?u.setSize(f.width,f.height,f.depth):u.setSize(s,o,1);let p=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,x=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,v=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(p),u.scissor.copy(x),u.viewport.multiplyScalar(v),u.scissor.multiplyScalar(v),u.scissorTest=w,u.multiview=f!==null?f.multiview:!1,u.useArrayDepthTexture=f!==null?f.useArrayDepthTexture:!1,u.resolveDepthBuffer=f!==null?f.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=f!==null?f._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;let r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,c=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:eK,f=this._renderTarget||this._outputRenderTarget,p=this._activeCubeFace,x=this._activeMipmapLevel,v;if(r!==null?(v=r,this.setRenderTarget(v)):v=f,v!==null&&v.depthBuffer===!0){let K=this._textures.get(v);K.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),K.depthInitialized=!0)}let w=this._renderContexts.get(v,this._mrt,this._callDepth);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(w),this.inspector.beginRender(this.backend.getTimestampUID(w),e,t,v),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,P=S._scissor,R=S._pixelRatio;v!==null&&(T=v.viewport,P=v.scissor,R=1),this.getDrawingBufferSize(s1),l8.set(0,0,s1.width,s1.height);let C=T.minDepth===void 0?0:T.minDepth,L=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(R).floor(),w.viewportValue.width>>=x,w.viewportValue.height>>=x,w.viewportValue.minDepth=C,w.viewportValue.maxDepth=L,w.viewport=w.viewportValue.equals(l8)===!1,w.scissorValue.copy(P).multiplyScalar(R).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(l8)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new tC),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,v);let D=t.isArrayCamera?HE:qE;t.isArrayCamera?D.setFromArrayCamera(t):(o1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(o1,t.coordinateSystem,t.reversedDepth));let F=this._renderLists.get(e,t);if(F.begin(),this._projectObject(e,t,0,F,w.clippingContext),F.finish(),this.sortObjects===!0&&F.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),v!==null){this._textures.updateRenderTarget(v,x);let K=this._textures.get(v);w.textures=K.textures,w.depthTexture=K.depthTexture,w.width=K.width,w.height=K.height,w.renderTarget=v,w.depth=v.depthBuffer,w.stencil=v.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=s1.width,w.height=s1.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=x,w.height>>=x,w.activeCubeFace=p,w.activeMipmapLevel=x,w.occlusionQueryCount=F.occlusionQueryCount,w.scissorValue.max(zf.set(0,0,0,0)),w.scissorValue.x+w.scissorValue.width>w.width&&(w.scissorValue.width=Math.max(w.width-w.scissorValue.x,0)),w.scissorValue.y+w.scissorValue.height>w.height&&(w.scissorValue.height=Math.max(w.height-w.scissorValue.y,0)),this._background.update(u,F,w),w.camera=t,this.backend.beginRender(w);let{bundles:N,lightsNode:B,transparentDoublePass:z,transparent:V,opaque:H}=F;return N.length>0&&this._renderBundles(N,u,B),this.opaque===!0&&H.length>0&&this._renderObjects(H,t,u,B),this.transparent===!0&&V.length>0&&this._renderTransparents(V,z,t,u,B),this.backend.finishRender(w),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=c,this.lighting.finishRender(e),this._callDepth--,r!==null&&(this.setRenderTarget(f,p,x),this._renderOutput(v)),u.onAfterRender(this,e,t,v),this.inspector.finishRender(this.backend.getTimestampUID(w)),w}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),n=this._quadCache.get(e.texture),r;if(n===void 0){r=new lb(new pr),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){Kn('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){Kn('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Kn('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Kn('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==ks,t=this.currentColorSpace!==sn.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:ks}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:sn.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return je("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,c=Array.isArray(e)?e:[e];if(c[0]===void 0||c[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of c){if(o.has(u)===!1){let x=()=>{u.removeEventListener("dispose",x),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",x);let v=u.onInitFunction;v!==null&&v.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),p=o.getForCompute(u,f);s.compute(e,u,f,p,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return Kn('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){Kn('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=zf.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=zf.copy(t).floor();else{Ge("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=zf.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){let l=t.isArrayCamera?HE:qE;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&zf.setFromMatrixPosition(e.matrixWorld).applyMatrix4(o1);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,zf.z,null,s)}}else if(e.isLineLoop)Ge("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let l=t.isArrayCamera?HE:qE;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),zf.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(o1)),Array.isArray(u)){let f=c.groups;for(let p=0,x=f.length;p<x;p++){let v=f[p],w=u[v.materialIndex];w&&w.visible&&r.push(e,c,w,n,zf.z,v,s)}}else u.visible&&r.push(e,c,u,n,zf.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let l=r;r=this._renderLists.get(e,t);let c=this._bundles.get(e,t,this._currentRenderContext),u=this.backend.get(c);if(this._bundleNeedsUpdate(e,u)){r.begin(),u.renderObjects===void 0?u.renderObjects=[]:u.renderObjects.length=0;let p=e.children;for(let x=0,v=p.length;x<v;x++)this._projectObject(p[x],t,n,r,s);r.finish()}l.pushBundle({bundleGroup:e,camera:t,renderList:r});return}let a=e.children;for(let l=0,c=a.length;l<c;l++)this._projectObject(a[l],t,n,r,s)}_renderBundles(e,t,n){for(let r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(let{material:o}of t)o.side=ui;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=Ao;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=ir}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){let{object:l,geometry:c,material:u,group:f,clippingContext:p}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,p,s)}}_getShadowNodes(e){let t=e.version,n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){let r=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,l=null,c=null,u=null;if(r||s||o||a){let f,p;if(o?(f=e.castShadowNode.rgb,p=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&Kn("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),p=se(1)),r&&(p=p.mul(tr("map","texture",e).a)),s&&(p=p.mul(e.colorNode.a)),c=Lt(f,p),a){let x=e.maskShadowNode||e.maskNode;c=Ae(([v])=>(x.not().discard(),v))(c)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:c,depthNode:u,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let n=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;n=!0}let r=this.coordinateSystem;if(e.coordinateSystem!==r){if(e.coordinateSystem=r,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=r;n=!0}if(n===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,n,r,s,o,a,l=null,c=null){let u=!1,f,p,x,v,w,S,T,P=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let R=t.overrideMaterial;if(u=!0,f=R.isNodeMaterial?R.colorNode:null,p=R.isNodeMaterial?R.depthNode:null,x=R.isNodeMaterial?R.positionNode:null,v=t.overrideMaterial.side,w=R.displacementMap,S=R.displacementScale,T=R.displacementBias,s.positionNode&&s.positionNode.isNode&&(R.positionNode=s.positionNode),R.alphaTest=s.alphaTest,R.alphaMap=s.alphaMap,R.displacementMap=s.displacementMap,R.displacementScale=s.displacementScale,R.displacementBias=s.displacementBias,R.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,R.isShadowPassMaterial){let{colorNode:C,depthNode:L,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===Zl?R.side=s.shadowSide!==null?s.shadowSide:s.side:R.side=s.shadowSide!==null?s.shadowSide:bTe[s.side],C!==null&&(R.colorNode=C),L!==null&&(R.depthNode=L),D!==null&&(R.positionNode=D)}s=R}s.transparent===!0&&s.side===ir&&s.forceSinglePass===!1?(s.side=ui,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=Ao,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=ir):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=p,t.overrideMaterial.positionNode=x,t.overrideMaterial.side=v,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=P,e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(c);u&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._pipelines.isReady(c)&&(this.backend.draw(c,this.info),u&&this._nodes.updateAfter(c))}_createObjectPipeline(e,t,n,r,s,o,a,l){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:n,camera:r,lightsNode:s,group:o,clippingContext:a,passId:l,renderContext:this._currentRenderContext});return}let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},iC=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function Iee(i){return i+(Zp-i%Zp)%Zp}var rC=class extends iC{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return Iee(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},sC=class extends rC{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},wTe=0,oC=class extends sC{constructor(e,t){super("UniformBuffer_"+wTe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return Iee(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},gB=class extends sC{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let n=this._updateRangeCache.get(t);n===void 0&&(n={start:0,count:0},this._updateRangeCache.set(t,n)),n.start=e.offset,n.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(n)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let n=0,r=this.uniforms.length;n<r;n++){let s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%Zp,c=l%o,u=l+c;t+=c,u!==0&&Zp-u<a&&(t+=Zp-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/Zp)*Zp}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);Ge("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){let a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+3]!==r.w){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){let o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){let o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;return TTe(n,r,s)===!1&&(this.buffer.set(r,s),STe(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function STe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function TTe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var ETe=0,aC=class extends gB{constructor(e,t){super(e),this.id=ETe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},lC=class extends iC{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},MTe=0,_B=class extends lC{constructor(e,t){super(e,t),this.id=MTe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},N1=class extends _B{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},cC=class extends N1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},pb=class extends N1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},tK={bitcast_int_uint:new Zi("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Zi("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Zi(`4168+Reason: ${e.reason}`),Ge(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),Ge(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,n){let{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s,a),c=this.backend.get(l);if(this._bundleNeedsUpdate(r,c)){this.backend.beginBundle(a),this._currentRenderBundle=l;let{transparentDoublePass:f,transparent:p,opaque:x}=o;this.opaque===!0&&x.length>0&&this._renderObjects(x,s,t,n),this.transparent===!0&&p.length>0&&this._renderTransparents(p,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let p=0,x=f.length;p<x;p++){let v=f[p];this._nodes.needsRefresh(v)&&(this._nodes.updateBefore(v),this._geometries.updateForRender(v),this._nodes.updateForRender(v),this._bindings.updateForRender(v),this._nodes.updateAfter(v))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let n=this._activeCubeFace;try{for(let r=0;r<t.texture.image.depth;r++)this._nodes.setOutputLayerIndex(r),this._activeCubeFace=r,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=n}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,n=e!==ks,r=t!==sn.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(s1),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new ca(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:xr,colorSpace:sn.workingColorSpace,generateMipmaps:!1,minFilter:vi,magFilter:vi,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let S=()=>{c.removeEventListener("dispose",S),u.dispose(),this._frameBufferTargets.delete(c)};c.addEventListener("dispose",S),this._frameBufferTargets.set(c,u)}let f=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,f!==null?u.setSize(f.width,f.height,f.depth):u.setSize(s,o,1);let p=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,x=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,v=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(p),u.scissor.copy(x),u.viewport.multiplyScalar(v),u.scissor.multiplyScalar(v),u.scissorTest=w,u.multiview=f!==null?f.multiview:!1,u.useArrayDepthTexture=f!==null?f.useArrayDepthTexture:!1,u.resolveDepthBuffer=f!==null?f.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=f!==null?f._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;let r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,c=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:nZ,f=this._renderTarget||this._outputRenderTarget,p=this._activeCubeFace,x=this._activeMipmapLevel,v;if(r!==null?(v=r,this.setRenderTarget(v)):v=f,v!==null&&v.depthBuffer===!0){let Z=this._textures.get(v);Z.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),Z.depthInitialized=!0)}let w=this._renderContexts.get(v,this._mrt,this._callDepth);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(w),this.inspector.beginRender(this.backend.getTimestampUID(w),e,t,v),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,P=S._scissor,R=S._pixelRatio;v!==null&&(T=v.viewport,P=v.scissor,R=1),this.getDrawingBufferSize(s1),c8.set(0,0,s1.width,s1.height);let C=T.minDepth===void 0?0:T.minDepth,L=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(R).floor(),w.viewportValue.width>>=x,w.viewportValue.height>>=x,w.viewportValue.minDepth=C,w.viewportValue.maxDepth=L,w.viewport=w.viewportValue.equals(c8)===!1,w.scissorValue.copy(P).multiplyScalar(R).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(c8)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new tC),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,v);let D=t.isArrayCamera?HE:qE;t.isArrayCamera?D.setFromArrayCamera(t):(o1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(o1,t.coordinateSystem,t.reversedDepth));let F=this._renderLists.get(e,t);if(F.begin(),this._projectObject(e,t,0,F,w.clippingContext),F.finish(),this.sortObjects===!0&&F.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),v!==null){this._textures.updateRenderTarget(v,x);let Z=this._textures.get(v);w.textures=Z.textures,w.depthTexture=Z.depthTexture,w.width=Z.width,w.height=Z.height,w.renderTarget=v,w.depth=v.depthBuffer,w.stencil=v.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=s1.width,w.height=s1.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=x,w.height>>=x,w.activeCubeFace=p,w.activeMipmapLevel=x,w.occlusionQueryCount=F.occlusionQueryCount,w.scissorValue.max(zf.set(0,0,0,0)),w.scissorValue.x+w.scissorValue.width>w.width&&(w.scissorValue.width=Math.max(w.width-w.scissorValue.x,0)),w.scissorValue.y+w.scissorValue.height>w.height&&(w.scissorValue.height=Math.max(w.height-w.scissorValue.y,0)),this._background.update(u,F,w),w.camera=t,this.backend.beginRender(w);let{bundles:N,lightsNode:B,transparentDoublePass:z,transparent:V,opaque:H}=F;return N.length>0&&this._renderBundles(N,u,B),this.opaque===!0&&H.length>0&&this._renderObjects(H,t,u,B),this.transparent===!0&&V.length>0&&this._renderTransparents(V,z,t,u,B),this.backend.finishRender(w),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=c,this.lighting.finishRender(e),this._callDepth--,r!==null&&(this.setRenderTarget(f,p,x),this._renderOutput(v)),u.onAfterRender(this,e,t,v),this.inspector.finishRender(this.backend.getTimestampUID(w)),w}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),n=this._quadCache.get(e.texture),r;if(n===void 0){r=new lb(new pr),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){Zn('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){Zn('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Zn('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Zn('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==ks,t=this.currentColorSpace!==sn.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:ks}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:sn.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return je("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,c=Array.isArray(e)?e:[e];if(c[0]===void 0||c[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of c){if(o.has(u)===!1){let x=()=>{u.removeEventListener("dispose",x),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",x);let v=u.onInitFunction;v!==null&&v.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),p=o.getForCompute(u,f);s.compute(e,u,f,p,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return Zn('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){Zn('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=zf.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=zf.copy(t).floor();else{Ge("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=zf.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){let l=t.isArrayCamera?HE:qE;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&zf.setFromMatrixPosition(e.matrixWorld).applyMatrix4(o1);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,zf.z,null,s)}}else if(e.isLineLoop)Ge("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let l=t.isArrayCamera?HE:qE;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),zf.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(o1)),Array.isArray(u)){let f=c.groups;for(let p=0,x=f.length;p<x;p++){let v=f[p],w=u[v.materialIndex];w&&w.visible&&r.push(e,c,w,n,zf.z,v,s)}}else u.visible&&r.push(e,c,u,n,zf.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let l=r;r=this._renderLists.get(e,t);let c=this._bundles.get(e,t,this._currentRenderContext),u=this.backend.get(c);if(this._bundleNeedsUpdate(e,u)){r.begin(),u.renderObjects===void 0?u.renderObjects=[]:u.renderObjects.length=0;let p=e.children;for(let x=0,v=p.length;x<v;x++)this._projectObject(p[x],t,n,r,s);r.finish()}l.pushBundle({bundleGroup:e,camera:t,renderList:r});return}let a=e.children;for(let l=0,c=a.length;l<c;l++)this._projectObject(a[l],t,n,r,s)}_renderBundles(e,t,n){for(let r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(let{material:o}of t)o.side=ui;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=Ao;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=ir}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){let{object:l,geometry:c,material:u,group:f,clippingContext:p}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,p,s)}}_getShadowNodes(e){let t=e.version,n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){let r=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,l=null,c=null,u=null;if(r||s||o||a){let f,p;if(o?(f=e.castShadowNode.rgb,p=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&Zn("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),p=se(1)),r&&(p=p.mul(tr("map","texture",e).a)),s&&(p=p.mul(e.colorNode.a)),c=Lt(f,p),a){let x=e.maskShadowNode||e.maskNode;c=Ae(([v])=>(x.not().discard(),v))(c)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:c,depthNode:u,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let n=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;n=!0}let r=this.coordinateSystem;if(e.coordinateSystem!==r){if(e.coordinateSystem=r,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=r;n=!0}if(n===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,n,r,s,o,a,l=null,c=null){let u=!1,f,p,x,v,w,S,T,P=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let R=t.overrideMaterial;if(u=!0,f=R.isNodeMaterial?R.colorNode:null,p=R.isNodeMaterial?R.depthNode:null,x=R.isNodeMaterial?R.positionNode:null,v=t.overrideMaterial.side,w=R.displacementMap,S=R.displacementScale,T=R.displacementBias,s.positionNode&&s.positionNode.isNode&&(R.positionNode=s.positionNode),R.alphaTest=s.alphaTest,R.alphaMap=s.alphaMap,R.displacementMap=s.displacementMap,R.displacementScale=s.displacementScale,R.displacementBias=s.displacementBias,R.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,R.isShadowPassMaterial){let{colorNode:C,depthNode:L,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===Kl?R.side=s.shadowSide!==null?s.shadowSide:s.side:R.side=s.shadowSide!==null?s.shadowSide:TTe[s.side],C!==null&&(R.colorNode=C),L!==null&&(R.depthNode=L),D!==null&&(R.positionNode=D)}s=R}s.transparent===!0&&s.side===ir&&s.forceSinglePass===!1?(s.side=ui,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=Ao,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=ir):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=p,t.overrideMaterial.positionNode=x,t.overrideMaterial.side=v,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=P,e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(c);u&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._pipelines.isReady(c)&&(this.backend.draw(c,this.info),u&&this._nodes.updateAfter(c))}_createObjectPipeline(e,t,n,r,s,o,a,l){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:n,camera:r,lightsNode:s,group:o,clippingContext:a,passId:l,renderContext:this._currentRenderContext});return}let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},iC=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function Lee(i){return i+(Kp-i%Kp)%Kp}var rC=class extends iC{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return Lee(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},sC=class extends rC{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},ETe=0,oC=class extends sC{constructor(e,t){super("UniformBuffer_"+ETe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return Lee(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},_B=class extends sC{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let n=this._updateRangeCache.get(t);n===void 0&&(n={start:0,count:0},this._updateRangeCache.set(t,n)),n.start=e.offset,n.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(n)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let n=0,r=this.uniforms.length;n<r;n++){let s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%Kp,c=l%o,u=l+c;t+=c,u!==0&&Kp-u<a&&(t+=Kp-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/Kp)*Kp}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);Ge("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){let a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+3]!==r.w){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){let o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){let o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;return CTe(n,r,s)===!1&&(this.buffer.set(r,s),MTe(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function MTe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function CTe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var RTe=0,aC=class extends _B{constructor(e,t){super(e),this.id=RTe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},lC=class extends iC{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},PTe=0,xB=class extends lC{constructor(e,t){super(e,t),this.id=PTe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},N1=class extends xB{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},cC=class extends N1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},pb=class extends N1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},iZ={bitcast_int_uint:new Ki("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Ki("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Ki(`41694169 vec4 tsl_textureGather( const int comp, sampler2D map, vec2 coord, ivec2 offset, bool flipY ) {41704170 if ( flipY ) offset.y = - offset.y;41714171 vec2 size = vec2( textureSize( map, 0 ) );
@@ -4179,7 +4179,7 @@ vec4 tsl_textureGather( const int comp, sampler2D map, vec2 coord, ivec2 offset,
41794179 );41804180 return flipY ? ret.wzyx : ret;41814181 }4182-`),textureGatherArray:new Zi(`4182+`),textureGatherArray:new Ki(`41834183 vec4 tsl_textureGather_array( const int comp, sampler2DArray map, vec3 coord, ivec2 offset, bool flipY ) {41844184 if ( flipY ) offset.y = - offset.y;41854185 vec2 size = vec2( textureSize( map, 0 ).xy );
@@ -4193,7 +4193,7 @@ vec4 tsl_textureGather_array( const int comp, sampler2DArray map, vec3 coord, iv
41934193 );41944194 return flipY ? ret.wzyx : ret;41954195 }4196-`),textureGatherCompare:new Zi(`4196+`),textureGatherCompare:new Ki(`41974197 vec4 tsl_textureGatherCompare( sampler2DShadow map, vec2 coord, ivec2 offset, float ref, bool flipY ) {41984198 if ( flipY ) offset.y = - offset.y;41994199 vec2 size = vec2( textureSize( map, 0 ) );
@@ -4207,7 +4207,7 @@ vec4 tsl_textureGatherCompare( sampler2DShadow map, vec2 coord, ivec2 offset, fl
42074207 );42084208 return flipY ? ret.wzyx : ret;42094209 }4210-`),textureGatherCompareArray:new Zi(`4210+`),textureGatherCompareArray:new Ki(`42114211 vec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2 offset, float ref, bool flipY ) {42124212 if ( flipY ) offset.y = - offset.y;42134213 vec2 size = vec2( textureSize( map, 0 ).xy );
@@ -4221,7 +4221,7 @@ vec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2
42214221 );42224222 return flipY ? ret.wzyx : ret;42234223 }4224-`)},CTe={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},nK={low:"lowp",medium:"mediump",high:"highp"},iK={swizzleAssign:!0,storageBuffer:!1},rK={perspective:"smooth",linear:"noperspective"},sK={centroid:"centroid"},oK=`4224+`)},ITe={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},rZ={low:"lowp",medium:"mediump",high:"highp"},sZ={swizzleAssign:!0,storageBuffer:!1},oZ={perspective:"smooth",linear:"noperspective"},aZ={centroid:"centroid"},lZ=`42254225 precision highp float;42264226 precision highp int;42274227 precision highp sampler2D;
@@ -4242,17 +4242,17 @@ precision highp isampler2DArray;
42424242 precision highp sampler2DShadow;42434243 precision highp sampler2DArrayShadow;42444244 precision highp samplerCubeShadow;4245-`,xB=class extends QM{constructor(e,t){super(e,t,new cB),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==zo}_include(e){let t=tK[e];return t.build(this),this.addInclude(t),t}getMethod(e){return tK[e]!==void 0&&this._include(e),CTe[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {4245+`,yB=class extends QM{constructor(e,t){super(e,t,new uB),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Vo}_include(e){let t=iZ[e];return t.build(this),this.addInclude(t),t}getMethod(e){return iZ[e]!==void 0&&this._include(e),ITe[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {42464246 42474247 ${n.vars}42484248 42494249 ${n.code}42504250 return ${n.result};42514251 4252-}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int"),a=o?Xu:Lf;s===2?a=o?$u:ws:s===3?a=o?m2:Nf:s===4&&(a=o?ip:xr);let l={Float32Array:Yi,Uint8Array:Gi,Uint16Array:Ha,Uint32Array:pi,Int8Array:Wu,Int16Array:ju,Int32Array:Ir,Uint8ClampedArray:Gi},c=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s)))),u=Math.ceil(r/s/c);c*u*s<r&&u++;let f=c*u*s,p=new n.constructor(f);p.set(n,0),t.array=p;let x=new _A(t.array,c,u,a,l[t.array.constructor.name]||Yi);x.needsUpdate=!0,x.isPBOTexture=!0;let v=new Ac(x,null,null);v.setPrecision("high"),t.pboNode=v,t.pbo=v.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){let u=this.renderer.backend.get(r);u.pbo=r.pbo}let s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);let a=n.build(this,"uint"),l=this.getDataFromNode(e),c=l.propertyName;if(c===void 0){let u=this.getVarFromNode(e);c=this.getPropertyName(u);let f=this.getDataFromNode(t),p=f.propertySizeName;p===void 0&&(p=c+"Size",this.getVarFromNode(t,p,"uint"),this.addLineFlowCode(`${p} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=p);let{itemSize:x}=r,v="."+Fm.join("").slice(0,x),w=`ivec2(${a} % ${p}, ${a} / ${p})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===pi?T="uvec4":r.pbo.type===Ir&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${v}`,e),l.propertyName=c}return c}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), int( ${r} ) )`:o?a=`texelFetchOffset( ${t}, ${n}, int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ${n}, int( ${r} ) )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;Ge(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o,a){return e.isDepthTexture&&(r="0"),o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherArray"),`tsl_textureGather_array( ${r}, ${t}, vec3( ${n}, ${s} ), ${o}, ${a} )`):(this._include("textureGather"),`tsl_textureGather( ${r}, ${t}, ${n}, ${o}, ${a} )`)}generateTextureGatherCompare(e,t,n,r,s,o,a){return o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${n}, ${s} ), ${o}, ${r}, ${a} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${n}, ${o}, ${r}, ${a} )`)}getUniforms(e){let t=this.uniforms[e],n=[],r={};for(let o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){let c=o.node,u=c.value,f="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===pi?f="u":u.type===Ir&&(f="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${f}sampler3D ${o.name};`:u.compareFunction&&c.compareNode!==null?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${f}sampler2DArray ${o.name};`:a=`${f}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){let c=o.node,u=this.getType(c.bufferType),f=c.bufferCount,p=f>0?f:"";a=`${c.name} {4252+}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int"),a=o?Xu:Lf;s===2?a=o?$u:Ss:s===3?a=o?m2:Nf:s===4&&(a=o?ip:xr);let l={Float32Array:Yi,Uint8Array:Gi,Uint16Array:Wa,Uint32Array:pi,Int8Array:Wu,Int16Array:ju,Int32Array:Ir,Uint8ClampedArray:Gi},c=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s)))),u=Math.ceil(r/s/c);c*u*s<r&&u++;let f=c*u*s,p=new n.constructor(f);p.set(n,0),t.array=p;let x=new xA(t.array,c,u,a,l[t.array.constructor.name]||Yi);x.needsUpdate=!0,x.isPBOTexture=!0;let v=new Ac(x,null,null);v.setPrecision("high"),t.pboNode=v,t.pbo=v.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){let u=this.renderer.backend.get(r);u.pbo=r.pbo}let s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);let a=n.build(this,"uint"),l=this.getDataFromNode(e),c=l.propertyName;if(c===void 0){let u=this.getVarFromNode(e);c=this.getPropertyName(u);let f=this.getDataFromNode(t),p=f.propertySizeName;p===void 0&&(p=c+"Size",this.getVarFromNode(t,p,"uint"),this.addLineFlowCode(`${p} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=p);let{itemSize:x}=r,v="."+Om.join("").slice(0,x),w=`ivec2(${a} % ${p}, ${a} / ${p})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===pi?T="uvec4":r.pbo.type===Ir&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${v}`,e),l.propertyName=c}return c}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), int( ${r} ) )`:o?a=`texelFetchOffset( ${t}, ${n}, int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ${n}, int( ${r} ) )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;Ge(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o,a){return e.isDepthTexture&&(r="0"),o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherArray"),`tsl_textureGather_array( ${r}, ${t}, vec3( ${n}, ${s} ), ${o}, ${a} )`):(this._include("textureGather"),`tsl_textureGather( ${r}, ${t}, ${n}, ${o}, ${a} )`)}generateTextureGatherCompare(e,t,n,r,s,o,a){return o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${n}, ${s} ), ${o}, ${r}, ${a} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${n}, ${o}, ${r}, ${a} )`)}getUniforms(e){let t=this.uniforms[e],n=[],r={};for(let o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){let c=o.node,u=c.value,f="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===pi?f="u":u.type===Ir&&(f="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${f}sampler3D ${o.name};`:u.compareFunction&&c.compareNode!==null?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${f}sampler2DArray ${o.name};`:a=`${f}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){let c=o.node,u=this.getType(c.bufferType),f=c.bufferCount,p=f>0?f:"";a=`${c.name} {42534253 ${u} ${o.name}[${p}];42544254 };4255-`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let p of u.uniforms){let x=p.getType(),v=this.getVectorType(x),w=p.nodeUniform.node.precision,S=`${v} ${p.name};`;w!==null&&(S=nK[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=nK[c]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(let o in r){let a=r[o];s+=this._getGLSLUniformStruct(o,a.join(`4255+`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let p of u.uniforms){let x=p.getType(),v=this.getVectorType(x),w=p.nodeUniform.node.precision,S=`${v} ${p.name};`;w!==null&&(S=rZ[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=rZ[c]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(let o in r){let a=r[o];s+=this._getGLSLUniformStruct(o,a.join(`42564256 `))+`42574257 `}return s+=n.join(`42584258 `),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Ir){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);let r=n.array;r instanceof Uint32Array||r instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){let n=this.getAttributesArray(),r=0;for(let s of n)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};
@@ -4265,14 +4265,14 @@ ${n.code}
42654265 `)+`42664266 42674267 `+t.join(`4268-`)}getVaryings(e){let t="",n=this.varyings;if(e==="vertex"||e==="compute")for(let r of n){e==="compute"&&(r.needsInterpolation=!0);let s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){let o=rK[r.interpolationType]||r.interpolationType,a=sK[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};4268+`)}getVaryings(e){let t="",n=this.varyings;if(e==="vertex"||e==="compute")for(let r of n){e==="compute"&&(r.needsInterpolation=!0);let s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){let o=oZ[r.interpolationType]||r.interpolationType,a=aZ[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};42694269 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}out ${s} ${r.name};42704270 `}else t+=`${s} ${r.name};4271-`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=rK[r.interpolationType]||r.interpolationType,a=sK[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};4271+`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=oZ[r.interpolationType]||r.interpolationType,a=aZ[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};42724272 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}in ${s} ${r.name};42734273 `}}}for(let r of this.builtins[e])t+=`${r};42744274 `;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((n,r)=>n*r,1)}u`}getSubgroupSize(){Ge("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){Ge("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){Ge("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){let r=this.extensions[n]||(this.extensions[n]=new Map);r.has(e)===!1&&r.set(e,{name:e,behavior:t})}getExtensions(e){let t=[];if(e==="vertex"){let r=this.renderer.backend.extensions;this.object.isBatchedMesh&&r.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}let n=this.extensions[e];if(n!==void 0)for(let{name:r,behavior:s}of n.values())t.push(`#extension ${r} : ${s}`);return t.join(`4275-`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=iK[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){let r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}iK[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s};4275+`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=sZ[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){let r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}sZ[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s};42764276 `)}return t}_getGLSLUniformStruct(e,t){return`42774277 layout( std140 ) uniform ${e} {42784278 ${t}
@@ -4284,7 +4284,7 @@ ${this.getSignature()}
42844284 ${e.extensions}42854285 42864286 // precision4287-${oK}4287+${lZ}42884288 42894289 // structs42904290 ${e.structs}
@@ -4323,7 +4323,7 @@ ${this.getSignature()}
43234323 ${e.extensions}43244324 43254325 // precision4326-${oK}4326+${lZ}43274327 43284328 // structs43294329 ${e.structs}
@@ -4354,7 +4354,7 @@ void main() {
43544354 `,a===s&&t!=="compute"&&(n+=`// result43554355 `,t==="vertex"?(n+="gl_Position = ",n+=`${this.format(l.result,s.getNodeType(this),"vec4")};`):t==="fragment"&&(a.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${this.format(l.result,s.getNodeType(this),this.getOutputType())};`)))}let o=e[t];if(o.extensions=this.getExtensions(t),o.uniforms=this.getUniforms(t),o.attributes=this.getAttributes(t),o.varyings=this.getVaryings(t),o.vars=this.getVars(t,!0),o.structs=this.getStructs(t),o.codes=this.getCodes(t),o.transforms=this.getTransforms(t),o.flow=n,t==="vertex"){let a=this.renderer.backend.extensions;this.object.isBatchedMesh&&a.has("WEBGL_multi_draw")===!1&&(o.uniforms+=`43564356 uniform uint nodeUniformDrawId;4357-`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache),a=o.uniformGPU;if(a===void 0){let l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture")a=new N1(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new cC(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new pb(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),p=f.buffer;p===void 0&&(e.name=`NodeBuffer_${e.id}`,p=new oC(e,l),p.name=e.name,f.buffer=p),u.push(p),a=p}else{let f=this.uniformGroups[c];f===void 0?(f=new aC(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let p=a.name;f.uniforms.some(v=>v.name===p)||f.addUniform(a)}o.uniformGPU=a}return s}},c8=null,a1=null,uC=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[ec.RENDER]:null,[ec.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),n=this.renderer.info.frame,r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?ec.COMPUTE:ec.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){Kn("WebGPURenderer: Timestamp tracking is disabled.");return}let t=this.timestampQueryPool[e];if(!t)return;let n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return c8=c8||new Oe,this.renderer.getDrawingBufferSize(c8)}setScissorTest(){}getClearColor(){let e=this.renderer;return a1=a1||new sb,e.getClearColor(a1),a1.getRGB(a1),a1}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:$T(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},RTe=0,yB=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},vB=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a),c=l.bufferGPU;c===void 0&&(c=this._createBuffer(r,t,s,o),l.bufferGPU=c,l.bufferType=t,l.version=a.version);let u;if(s instanceof Float32Array)u=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)u=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=r.HALF_FLOAT:u=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=r.SHORT;else if(s instanceof Uint32Array)u=r.UNSIGNED_INT;else if(s instanceof Int32Array)u=r.INT;else if(s instanceof Int8Array)u=r.BYTE;else if(s instanceof Uint8Array)u=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let f={bufferGPU:c,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===r.INT||u===r.UNSIGNED_INT||e.gpuType===Ir,id:RTe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let p=this._createBuffer(r,t,s,o);f=new yB(f,p)}n.set(e,f)}updateAttribute(e){let t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let c=0,u=l.length;c<u;c++){let f=l[c];n.bufferSubData(a,f.start*r.BYTES_PER_ELEMENT,r,f.start,f.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){let t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,{gl:o}=s,a=e.isInterleavedBufferAttribute?e.data:e,l=s.get(a),{bufferGPU:c}=l,u=r===-1?l.byteLength-n:r,f;if(t===null)f=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");let p=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",p),t.removeEventListener("dispose",p)};t.addEventListener("release",p),t.addEventListener("dispose",p),f=new Uint8Array(new ArrayBuffer(u)),t.buffer=f.buffer}else f=new Uint8Array(t);return o.bindBuffer(o.COPY_READ_BUFFER,c),o.getBufferSubData(o.COPY_READ_BUFFER,n,f),o.bindBuffer(o.COPY_READ_BUFFER,null),o.bindBuffer(o.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:f.buffer}_createBuffer(e,t,n,r){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}},Nv,Vf,bB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;Nv={[Bs]:e.FUNC_ADD,[Qy]:e.FUNC_SUBTRACT,[Jy]:e.FUNC_REVERSE_SUBTRACT},Vf={[qc]:e.ZERO,[e2]:e.ONE,[t2]:e.SRC_COLOR,[Ud]:e.SRC_ALPHA,[a2]:e.SRC_ALPHA_SATURATE,[s2]:e.DST_COLOR,[i2]:e.DST_ALPHA,[n2]:e.ONE_MINUS_SRC_COLOR,[kd]:e.ONE_MINUS_SRC_ALPHA,[o2]:e.ONE_MINUS_DST_COLOR,[r2]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new gn().fromArray(t),this.currentViewport=new gn().fromArray(n),this._tempVec4=new gn}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==UT?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===Ky?t.cullFace(t.BACK):e===kT?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){let r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){Kn("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){let a=e[o],l=null;if(t!==null){let c=t.getBlendMode(a.name);c.blending===Zy?l=n:c.blending!==Xr&&(l=c)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,c=t.premultipliedAlpha;if(s===If){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,p=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Nv[l],Nv[p]),r.blendFuncSeparateiOES(e,Vf[o],Vf[a],Vf[u],Vf[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case rs:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case zu:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Vu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qu:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case rs:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case zu:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Vu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qu:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){let{gl:c}=this;if(e===Xr){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==If){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==Bs||this.currentBlendEquationAlpha!==Bs)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=Bs,this.currentBlendEquationAlpha=Bs),l)switch(e){case rs:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case zu:c.blendFunc(c.ONE,c.ONE);break;case Vu:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case qu:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:Ge("WebGLState: Invalid blending: ",e);break}else switch(e){case rs:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case zu:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Vu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case qu:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(c.blendEquationSeparate(Nv[t],Nv[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Vf[n],Vf[r],Vf[o],Vf[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=b2[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case aA:t.depthFunc(t.NEVER);break;case lA:t.depthFunc(t.ALWAYS);break;case cA:t.depthFunc(t.LESS);break;case Bu:t.depthFunc(t.LEQUAL);break;case uA:t.depthFunc(t.EQUAL);break;case hA:t.depthFunc(t.GEQUAL);break;case fA:t.depthFunc(t.GREATER);break;case dA:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){let{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){let{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){let{gl:r}=this;e.side===ir?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===ui;t&&(s=!s),this.setFlipSided(s),e.blending===rs&&e.transparent===!1?this.setBlending(Xr):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){let{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:n}=this,r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));let o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){let{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){let{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){let{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}getParameter(e){let{gl:t,parameters:n}=this;return n[e]!==void 0?n[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:n,parameters:r}=this;r[e]!==t&&(n.pixelStorei(e,t),r[e]=t)}},wB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=zo){let{gl:n,extensions:r}=this,s,o=sn.getTransfer(t);if(e===Gi)return n.UNSIGNED_BYTE;if(e===PA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===IA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===NA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===LA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Wu)return n.BYTE;if(e===ju)return n.SHORT;if(e===Ha)return n.UNSIGNED_SHORT;if(e===Ir)return n.INT;if(e===pi)return n.UNSIGNED_INT;if(e===Yi)return n.FLOAT;if(e===Li)return n.HALF_FLOAT;if(e===S_)return n.ALPHA;if(e===Nf)return n.RGB;if(e===xr)return n.RGBA;if(e===xs)return n.DEPTH_COMPONENT;if(e===Qs)return n.DEPTH_STENCIL;if(e===Lf)return n.RED;if(e===Xu)return n.RED_INTEGER;if(e===ws)return n.RG;if(e===$u)return n.RG_INTEGER;if(e===ip)return n.RGBA_INTEGER;if(e===Yu||e===Ku||e===Zu||e===Qu)if(o===Bt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Yu)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Ku)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Zu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Yu)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Ku)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Zu)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Qu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===DA||e===FA||e===OA||e===BA)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===DA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===FA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===OA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===BA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===rp||e===sp||e===op||e===ap||e===lp||e===Ju||e===cp)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===rp||e===sp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===op)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===ap)return s.COMPRESSED_R11_EAC;if(e===lp)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Ju)return s.COMPRESSED_RG11_EAC;if(e===cp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===up||e===hp||e===fp||e===dp||e===pp||e===Ap||e===mp||e===gp||e===_p||e===xp||e===yp||e===vp||e===bp||e===wp)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===up)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===hp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===Ap)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Sp||e===Tp||e===Ep)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Sp)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===Tp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===Ep)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===Mp||e===Cp||e===eh||e===Rp)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Mp)return s.COMPRESSED_RED_RGTC1_EXT;if(e===Cp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===eh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Rp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===Go?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){let o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}},aK=!1,WE,u8,lK,SB=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,aK===!1&&(this._init(),aK=!0)}_init(){let e=this.gl;WE={[Sf]:e.REPEAT,[Uo]:e.CLAMP_TO_EDGE,[Tf]:e.MIRRORED_REPEAT},u8={[xi]:e.NEAREST,[A2]:e.NEAREST_MIPMAP_NEAREST,[Jl]:e.NEAREST_MIPMAP_LINEAR,[vi]:e.LINEAR,[np]:e.LINEAR_MIPMAP_NEAREST,[go]:e.LINEAR_MIPMAP_LINEAR},lK={[_2]:e.NEVER,[v2]:e.ALWAYS,[T_]:e.LESS,[th]:e.LEQUAL,[x2]:e.EQUAL,[Hc]:e.GEQUAL,[UA]:e.GREATER,[y2]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s,o=!1){let{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];je("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||je("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.BYTE&&(u=a.R8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.R16_EXT),n===a.SHORT&&c&&(u=c.R16_SNORM_EXT)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.BYTE&&(u=a.RG8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RG16_EXT),n===a.SHORT&&c&&(u=c.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){let f=o?zd:sn.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===Bt?a.SRGB8:a.RGB8),n===a.BYTE&&(u=a.RGB8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGB16_EXT),n===a.SHORT&&c&&(u=c.RGB16_SNORM_EXT),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){let f=o?zd:sn.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===Bt?a.SRGB8_ALPHA8:a.RGBA8),n===a.BYTE&&(u=a.RGBA8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGBA16_EXT),n===a.SHORT&&c&&(u=c.RGBA16_SNORM_EXT),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){let{gl:n,extensions:r,backend:s}=this,{state:o}=this.backend,a=sn.getPrimaries(sn.workingColorSpace),l=t.colorSpace===zo?null:sn.getPrimaries(t.colorSpace),c=t.colorSpace===zo||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;o.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),o.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),o.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),o.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,c),n.texParameteri(e,n.TEXTURE_WRAP_S,WE[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,WE[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,WE[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,u8[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===vi&&u?go:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,u8[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,lK[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===xi||t.minFilter!==Jl&&t.minFilter!==go||t.type===Yi&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let p=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,p.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e),o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){let{gl:n,backend:r}=this,s,o,a,l,c;if(e.isExternalTexture===!0)s=e.sourceTexture,o=this.getGLTextureType(e);else{let{levels:u,width:f,height:p,depth:x}=t;a=r.utils.convert(e.format,e.colorSpace),l=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,a,l,e.normalized,e.colorSpace,e.isVideoTexture),s=n.createTexture(),o=this.getGLTextureType(e),r.state.bindTexture(o,s),this.setTextureParameters(o,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,u,c,f,p,x):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,p,x):e.isVideoTexture||n.texStorage2D(o,u,c,f,p)}r.set(e,{textureGPU:s,glTextureType:o,glFormat:a,glType:l,glInternalFormat:c})}copyBufferToTexture(e,t){let{gl:n,backend:r}=this,{state:s}=r,{textureGPU:o,glTextureType:a,glFormat:l,glType:c}=r.get(t),{width:u,height:f}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,o),s.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,u,f,l,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){let{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:c,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){let f=e.mipmaps,p=t.image;for(let x=0;x<f.length;x++){let v=f[x];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,v.width,v.height,p.depth,l,v.data):je("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,v.width,v.height,p.depth,l,c,v.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,x,0,0,v.width,v.height,l,v.data):je("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,p=e.mipmaps;for(let x=0;x<6;x++){let v=jE(f[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,r,s,l,c,v);for(let w=0;w<p.length;w++){let S=p[w],T=jE(S.images[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,w+1,0,0,T.width,T.height,l,c,T)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let f=t.image;if(e.layerUpdates.size>0){let p=w2(f.width,f.height,e.format,e.type);for(let x of e.layerUpdates){let v=f.data.subarray(x*p/f.data.BYTES_PER_ELEMENT,(x+1)*p/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,x,f.width,f.height,1,l,c,v)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isData3DTexture){let f=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,l,c,t.image);else if(e.isHTMLTexture)typeof n.texElementImage2D=="function"&&(n.texElementImage2D.length===3?n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,t.image):n.texElementImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t.image));else{let f=e.mipmaps;if(f.length>0)for(let p=0,x=f.length;p<x;p++){let v=f[p],w=jE(v);n.texSubImage2D(a,p,0,0,v.width,v.height,l,c,w)}else{let p=jE(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,p)}}}generateMipmaps(e){let{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:n}=this;if(e){let r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(let s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&e.isExternalTexture!==!0&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let{gl:a,backend:l}=this,{state:c}=this.backend,{textureGPU:u,glTextureType:f,glType:p,glFormat:x}=l.get(t);c.bindTexture(f,u);let v,w,S,T,P,R,C,L,D,F=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)v=n.max.x-n.min.x,w=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,T=n.min.x,P=n.min.y,R=n.isBox3?n.min.z:0;else{let j=Math.pow(2,-s);v=Math.floor(F.width*j),w=Math.floor(F.height*j),e.isDataArrayTexture||e.isArrayTexture?S=F.depth:e.isData3DTexture?S=Math.floor(F.depth*j):S=1,T=0,P=0,R=0}r!==null?(C=r.x,L=r.y,D=r.z):(C=0,L=0,D=0),c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);let N=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),z=c.getParameter(a.UNPACK_SKIP_PIXELS),V=c.getParameter(a.UNPACK_SKIP_ROWS),H=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,F.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,F.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,P),c.pixelStorei(a.UNPACK_SKIP_IMAGES,R);let K=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,J=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let j=l.get(e),Z=l.get(t),ee=l.get(j.renderTarget),ae=l.get(Z.renderTarget),ce=ee.framebuffers[j.cacheKey],de=ae.framebuffers[Z.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Ie=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,de);for(let Qe=0;Qe<S;Qe++)K&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,j.textureGPU,s,R+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,P,v,w,C,L,v,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Ie)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let j=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let Z=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,ee=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let ae=0;ae<S;ae++)K?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,j.textureGPU,s,R+ae):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,j.textureGPU,s),J?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+ae):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,P,v,w,C,L,v,w,a.COLOR_BUFFER_BIT,a.NEAREST):J?a.copyTexSubImage3D(f,o,C,L,D+ae,T,P,v,w):a.copyTexSubImage2D(f,o,C,L,T,P,v,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,Z),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,ee)}else J?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,C,L,D,v,w,S,x,p,F.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,C,L,D,v,w,S,x,F.data):a.texSubImage3D(f,o,C,L,D,v,w,S,x,p,F):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,C,L,v,w,x,p,F.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,C,L,F.width,F.height,x,F.data):a.texSubImage2D(a.TEXTURE_2D,o,C,L,v,w,x,p,F);c.pixelStorei(a.UNPACK_ROW_LENGTH,N),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,z),c.pixelStorei(a.UNPACK_SKIP_ROWS,V),c.pixelStorei(a.UNPACK_SKIP_IMAGES,H),o===0&&t.generateMipmaps&&a.generateMipmap(f),c.unbindTexture()}copyFramebufferToTexture(e,t,n){let{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:c,w:u}=n,f=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,p=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let x=a!==0||l!==0,v,w;if(e.isDepthTexture===!0?(v=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(v|=r.STENCIL_BUFFER_BIT)):(v=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),x){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],P=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,P);let R=p-l-u;r.blitFramebuffer(a,R,a+c,R+u,a,R,a+c,R+u,v,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,R,c,u),s.unbindTexture()}else{let S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,w,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,c,u,0,0,c,u,v,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,p-u-l,c,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){let{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:c,width:u,height:f}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!c){let p=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,p,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(p=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,p,u,f)):s.renderbufferStorage(s.RENDERBUFFER,p,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&c&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,u,f):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){let{backend:a,gl:l}=this,{textureGPU:c,glFormat:u,glType:f}=this.backend.get(e),p=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,p);let x=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,x,c,0);let v=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,P=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,P),l.bufferData(l.PIXEL_PACK_BUFFER,T,l.STREAM_READ),l.readPixels(t,n,r,s,u,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();let R=new v(T/v.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,P),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,R),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(p),R}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:n}=this,r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function jE(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}var TB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},EB=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){let n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},cK={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"},MB=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){let{gl:r,mode:s,type:o,index:a,object:l,info:c}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),c.update(l,t,n))}renderMultiDraw(e,t,n){let{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;let l=r.get("WEBGL_multi_draw");if(l===null)for(let c=0;c<n;c++)this.render(e[c],t[c]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let c=0;for(let u=0;u<n;u++)c+=t[u];a.update(o,c,1)}}},hC=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(je(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},CB=class extends hC{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){je("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return Kn(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){Ge("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){Ge("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){let l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;let t={},n=[];for(let[s,o]of e){let a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);let c=await o;this.timestamps.set(s,c),t[l]+=c}let r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return Ge("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1,s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}let u=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(u)/1e6)}catch(l){Ge("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},fC=class extends uC{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();let a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new TB(this),this.capabilities=new EB(this),this.attributeUtils=new vB(this),this.textureUtils=new SB(this),this.bufferRenderer=new MB(this),this.state=new bB(this),this.utils=new wB(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(je("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return po}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){let r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){let s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&je("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new CB(this.gl,e,2048));let n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery(ec.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();let o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){let c=a[l];c.generateMipmaps&&this.generateMipmaps(c)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.viewport(0,0,l,c)}if(s.scissor)this.updateScissor(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.scissor(0,0,l,c)}}this.prepareTimestampBuffer(ec.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let l=0;for(let c=0;c<n.length;c++){let u=n[c];u!==null&&o.getQueryParameter(u,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(u,o.QUERY_RESULT)===0&&s.add(r[c]),n[c]=null,o.deleteQuery(u),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){let{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let c=0;if(e&&(c|=a.COLOR_BUFFER_BIT),t&&(c|=a.DEPTH_BUFFER_BIT),n&&(c|=a.STENCIL_BUFFER_BIT),c!==0){let u;r.clearColorValue?u=r.clearColorValue:u=this.getClearColor();let f=l.getClearDepth(),p=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(c);else{if(s&&this._setFramebuffer(r),e)for(let x=0;x<r.textures.length;x++)x===0?a.clearBufferfv(a.COLOR,x,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,x,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,p):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[p]),s&&o&&this._resolveRenderTarget(r),s&&this._currentContext!==null&&this._currentContext!==r&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(ec.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){let{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:l,transformBuffers:c,attributes:u}=this.get(r),f=this._getVaoKey(u),p=this.vaoCache[f];p===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(p),o.useProgram(l),this._bindUniforms(n);let x=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,x),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(Kn("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(Kn("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let v=0;v<c.length;v++){let w=c[v];w.pbo&&this.has(w.pbo)&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){let{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(ec.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,n,r,s,o){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){let{gl:a}=this,l=a.getUniformLocation(o,"nodeUniformDrawId"),c=e._multiDrawStarts,u=e._multiDrawCounts,f=e._multiDrawCount;for(let p=0;p<f;p++)a.uniform1ui(l,p),t.render(c[p],u[p])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(n,r,s):t.render(n,r)}draw(e){let{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:c}=this,u=this.get(s),f=e.getDrawParameters();if(f===null)return;this._bindUniforms(e.getBindings());let p=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,p,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let x=e.getAttributes(),v=this.get(x),w=v.vaoGPU;if(w===void 0){let F=this._getVaoKey(x);w=this.vaoCache[F],w===void 0&&(w=this._createVao(x),this.vaoCache[F]=w,v.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let P=u.lastOcclusionObject;if(P!==t&&P!==void 0){if(P!==null&&P.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let F=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,F),u.occlusionQueries[u.occlusionQueryIndex]=F,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let R=this.bufferRenderer;t.isPoints?R.mode=l.POINTS:t.isLineSegments?R.mode=l.LINES:t.isLine?R.mode=l.LINE_STRIP:t.isLineLoop?R.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),R.mode=l.LINES):R.mode=l.TRIANGLES;let{vertexCount:C,instanceCount:L}=f,{firstVertex:D}=f;if(R.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let F=this.get(S);R.index=S.count,R.type=F.type}else R.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let F=this.get(e.camera),N=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(F.indexesGPU===void 0||F.indexesGPU.length!==N.length){let j=new Uint32Array([0,0,0,0]),Z=[];for(let ee=0,ae=N.length;ee<ae;ee++){let ce=l.createBuffer();j[0]=ee,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,j,l.STATIC_DRAW),Z.push(ce)}F.indexesGPU=Z}let z=0;e:for(let j of e.getBindings())for(let Z of j.bindings){if(Z===B)break e;(Z.isUniformsGroup||Z.isUniformBuffer)&&z++}let V=this.renderer.getPixelRatio(),H=this._currentContext.renderTarget,K=this._isRenderCameraDepthArray(this._currentContext),J=this._currentContext.activeCubeFace;if(K){let j=this.get(H.depthTexture);if(j.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){j.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:Z}=H;for(let ee=0,ae=N.length;ee<ae;ee++)this.renderer._activeCubeFace=ee,this._currentContext.activeCubeFace=ee,this._setFramebuffer(this._currentContext),this.clear(!1,!0,Z,this._currentContext,!1,!1);this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J}}for(let j=0,Z=N.length;j<Z;j++){let ee=N[j];if(t.layers.test(ee.layers)){K&&(this.renderer._activeCubeFace=j,this._currentContext.activeCubeFace=j,this._setFramebuffer(this._currentContext));let ae=ee.viewport;if(ae!==void 0){let ce=ae.x*V,de=ae.y*V,ve=ae.width*V,Ie=ae.height*V;c.viewport(Math.floor(ce),Math.floor(e.context.height-Ie-de),Math.floor(ve),Math.floor(Ie))}c.bindBufferBase(l.UNIFORM_BUFFER,z,F.indexesGPU[j]),this._draw(t,R,D,C,L,a)}this._currentContext.activeCubeFace=J,this.renderer._activeCubeFace=J}}else this._draw(t,R,D,C,L,a)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new xB(e,t)}createProgram(e){let t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,c),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:c}),t!==null&&this.parallel){let u=new Promise(f=>{let p=this.parallel,x=()=>{n.getProgramParameter(a,p.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(x)};x()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`4357+`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache),a=o.uniformGPU;if(a===void 0){let l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture")a=new N1(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new cC(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new pb(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),p=f.buffer;p===void 0&&(e.name=`NodeBuffer_${e.id}`,p=new oC(e,l),p.name=e.name,f.buffer=p),u.push(p),a=p}else{let f=this.uniformGroups[c];f===void 0?(f=new aC(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let p=a.name;f.uniforms.some(v=>v.name===p)||f.addUniform(a)}o.uniformGPU=a}return s}},u8=null,a1=null,uC=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[ec.RENDER]:null,[ec.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),n=this.renderer.info.frame,r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?ec.COMPUTE:ec.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){Zn("WebGPURenderer: Timestamp tracking is disabled.");return}let t=this.timestampQueryPool[e];if(!t)return;let n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return u8=u8||new Oe,this.renderer.getDrawingBufferSize(u8)}setScissorTest(){}getClearColor(){let e=this.renderer;return a1=a1||new sb,e.getClearColor(a1),a1.getRGB(a1),a1}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:$T(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},NTe=0,vB=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},bB=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a),c=l.bufferGPU;c===void 0&&(c=this._createBuffer(r,t,s,o),l.bufferGPU=c,l.bufferType=t,l.version=a.version);let u;if(s instanceof Float32Array)u=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)u=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=r.HALF_FLOAT:u=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=r.SHORT;else if(s instanceof Uint32Array)u=r.UNSIGNED_INT;else if(s instanceof Int32Array)u=r.INT;else if(s instanceof Int8Array)u=r.BYTE;else if(s instanceof Uint8Array)u=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let f={bufferGPU:c,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===r.INT||u===r.UNSIGNED_INT||e.gpuType===Ir,id:NTe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let p=this._createBuffer(r,t,s,o);f=new vB(f,p)}n.set(e,f)}updateAttribute(e){let t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let c=0,u=l.length;c<u;c++){let f=l[c];n.bufferSubData(a,f.start*r.BYTES_PER_ELEMENT,r,f.start,f.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){let t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,{gl:o}=s,a=e.isInterleavedBufferAttribute?e.data:e,l=s.get(a),{bufferGPU:c}=l,u=r===-1?l.byteLength-n:r,f;if(t===null)f=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");let p=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",p),t.removeEventListener("dispose",p)};t.addEventListener("release",p),t.addEventListener("dispose",p),f=new Uint8Array(new ArrayBuffer(u)),t.buffer=f.buffer}else f=new Uint8Array(t);return o.bindBuffer(o.COPY_READ_BUFFER,c),o.getBufferSubData(o.COPY_READ_BUFFER,n,f),o.bindBuffer(o.COPY_READ_BUFFER,null),o.bindBuffer(o.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:f.buffer}_createBuffer(e,t,n,r){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}},Nv,Vf,wB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;Nv={[Bs]:e.FUNC_ADD,[Qy]:e.FUNC_SUBTRACT,[Jy]:e.FUNC_REVERSE_SUBTRACT},Vf={[qc]:e.ZERO,[e2]:e.ONE,[t2]:e.SRC_COLOR,[Ud]:e.SRC_ALPHA,[a2]:e.SRC_ALPHA_SATURATE,[s2]:e.DST_COLOR,[i2]:e.DST_ALPHA,[n2]:e.ONE_MINUS_SRC_COLOR,[kd]:e.ONE_MINUS_SRC_ALPHA,[o2]:e.ONE_MINUS_DST_COLOR,[r2]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new gn().fromArray(t),this.currentViewport=new gn().fromArray(n),this._tempVec4=new gn}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==UT?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===Zy?t.cullFace(t.BACK):e===kT?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){let r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){Zn("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){let a=e[o],l=null;if(t!==null){let c=t.getBlendMode(a.name);c.blending===Ky?l=n:c.blending!==Xr&&(l=c)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,c=t.premultipliedAlpha;if(s===If){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,p=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Nv[l],Nv[p]),r.blendFuncSeparateiOES(e,Vf[o],Vf[a],Vf[u],Vf[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case ss:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case zu:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Vu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qu:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case ss:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case zu:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Vu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qu:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){let{gl:c}=this;if(e===Xr){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==If){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==Bs||this.currentBlendEquationAlpha!==Bs)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=Bs,this.currentBlendEquationAlpha=Bs),l)switch(e){case ss:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case zu:c.blendFunc(c.ONE,c.ONE);break;case Vu:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case qu:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:Ge("WebGLState: Invalid blending: ",e);break}else switch(e){case ss:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case zu:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Vu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case qu:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(c.blendEquationSeparate(Nv[t],Nv[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Vf[n],Vf[r],Vf[o],Vf[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=b2[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case lA:t.depthFunc(t.NEVER);break;case cA:t.depthFunc(t.ALWAYS);break;case uA:t.depthFunc(t.LESS);break;case Bu:t.depthFunc(t.LEQUAL);break;case hA:t.depthFunc(t.EQUAL);break;case fA:t.depthFunc(t.GEQUAL);break;case dA:t.depthFunc(t.GREATER);break;case pA:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){let{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){let{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){let{gl:r}=this;e.side===ir?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===ui;t&&(s=!s),this.setFlipSided(s),e.blending===ss&&e.transparent===!1?this.setBlending(Xr):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){let{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:n}=this,r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));let o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){let{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){let{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){let{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}getParameter(e){let{gl:t,parameters:n}=this;return n[e]!==void 0?n[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:n,parameters:r}=this;r[e]!==t&&(n.pixelStorei(e,t),r[e]=t)}},SB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=Vo){let{gl:n,extensions:r}=this,s,o=sn.getTransfer(t);if(e===Gi)return n.UNSIGNED_BYTE;if(e===IA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===NA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===LA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===DA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Wu)return n.BYTE;if(e===ju)return n.SHORT;if(e===Wa)return n.UNSIGNED_SHORT;if(e===Ir)return n.INT;if(e===pi)return n.UNSIGNED_INT;if(e===Yi)return n.FLOAT;if(e===Li)return n.HALF_FLOAT;if(e===S_)return n.ALPHA;if(e===Nf)return n.RGB;if(e===xr)return n.RGBA;if(e===ys)return n.DEPTH_COMPONENT;if(e===Qs)return n.DEPTH_STENCIL;if(e===Lf)return n.RED;if(e===Xu)return n.RED_INTEGER;if(e===Ss)return n.RG;if(e===$u)return n.RG_INTEGER;if(e===ip)return n.RGBA_INTEGER;if(e===Yu||e===Zu||e===Ku||e===Qu)if(o===Bt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Yu)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Zu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Ku)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Yu)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Zu)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Ku)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Qu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===FA||e===OA||e===BA||e===UA)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===FA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===OA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===BA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===UA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===rp||e===sp||e===op||e===ap||e===lp||e===Ju||e===cp)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===rp||e===sp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===op)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===ap)return s.COMPRESSED_R11_EAC;if(e===lp)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Ju)return s.COMPRESSED_RG11_EAC;if(e===cp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===up||e===hp||e===fp||e===dp||e===pp||e===Ap||e===mp||e===gp||e===_p||e===xp||e===yp||e===vp||e===bp||e===wp)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===up)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===hp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===Ap)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Sp||e===Tp||e===Ep)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Sp)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===Tp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===Ep)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===Mp||e===Cp||e===eh||e===Rp)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Mp)return s.COMPRESSED_RED_RGTC1_EXT;if(e===Cp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===eh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Rp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===zo?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){let o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}},cZ=!1,WE,h8,uZ,TB=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,cZ===!1&&(this._init(),cZ=!0)}_init(){let e=this.gl;WE={[Sf]:e.REPEAT,[ko]:e.CLAMP_TO_EDGE,[Tf]:e.MIRRORED_REPEAT},h8={[xi]:e.NEAREST,[A2]:e.NEAREST_MIPMAP_NEAREST,[Jl]:e.NEAREST_MIPMAP_LINEAR,[vi]:e.LINEAR,[np]:e.LINEAR_MIPMAP_NEAREST,[go]:e.LINEAR_MIPMAP_LINEAR},uZ={[_2]:e.NEVER,[v2]:e.ALWAYS,[T_]:e.LESS,[th]:e.LEQUAL,[x2]:e.EQUAL,[Hc]:e.GEQUAL,[kA]:e.GREATER,[y2]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s,o=!1){let{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];je("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||je("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.BYTE&&(u=a.R8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.R16_EXT),n===a.SHORT&&c&&(u=c.R16_SNORM_EXT)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.BYTE&&(u=a.RG8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RG16_EXT),n===a.SHORT&&c&&(u=c.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){let f=o?zd:sn.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===Bt?a.SRGB8:a.RGB8),n===a.BYTE&&(u=a.RGB8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGB16_EXT),n===a.SHORT&&c&&(u=c.RGB16_SNORM_EXT),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){let f=o?zd:sn.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===Bt?a.SRGB8_ALPHA8:a.RGBA8),n===a.BYTE&&(u=a.RGBA8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGBA16_EXT),n===a.SHORT&&c&&(u=c.RGBA16_SNORM_EXT),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){let{gl:n,extensions:r,backend:s}=this,{state:o}=this.backend,a=sn.getPrimaries(sn.workingColorSpace),l=t.colorSpace===Vo?null:sn.getPrimaries(t.colorSpace),c=t.colorSpace===Vo||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;o.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),o.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),o.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),o.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,c),n.texParameteri(e,n.TEXTURE_WRAP_S,WE[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,WE[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,WE[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,h8[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===vi&&u?go:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,h8[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,uZ[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===xi||t.minFilter!==Jl&&t.minFilter!==go||t.type===Yi&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let p=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,p.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e),o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){let{gl:n,backend:r}=this,s,o,a,l,c;if(e.isExternalTexture===!0)s=e.sourceTexture,o=this.getGLTextureType(e);else{let{levels:u,width:f,height:p,depth:x}=t;a=r.utils.convert(e.format,e.colorSpace),l=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,a,l,e.normalized,e.colorSpace,e.isVideoTexture),s=n.createTexture(),o=this.getGLTextureType(e),r.state.bindTexture(o,s),this.setTextureParameters(o,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,u,c,f,p,x):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,p,x):e.isVideoTexture||n.texStorage2D(o,u,c,f,p)}r.set(e,{textureGPU:s,glTextureType:o,glFormat:a,glType:l,glInternalFormat:c})}copyBufferToTexture(e,t){let{gl:n,backend:r}=this,{state:s}=r,{textureGPU:o,glTextureType:a,glFormat:l,glType:c}=r.get(t),{width:u,height:f}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,o),s.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,u,f,l,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){let{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:c,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){let f=e.mipmaps,p=t.image;for(let x=0;x<f.length;x++){let v=f[x];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,v.width,v.height,p.depth,l,v.data):je("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,v.width,v.height,p.depth,l,c,v.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,x,0,0,v.width,v.height,l,v.data):je("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,p=e.mipmaps;for(let x=0;x<6;x++){let v=jE(f[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,r,s,l,c,v);for(let w=0;w<p.length;w++){let S=p[w],T=jE(S.images[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,w+1,0,0,T.width,T.height,l,c,T)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let f=t.image;if(e.layerUpdates.size>0){let p=w2(f.width,f.height,e.format,e.type);for(let x of e.layerUpdates){let v=f.data.subarray(x*p/f.data.BYTES_PER_ELEMENT,(x+1)*p/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,x,f.width,f.height,1,l,c,v)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isData3DTexture){let f=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,l,c,t.image);else if(e.isHTMLTexture)typeof n.texElementImage2D=="function"&&(n.texElementImage2D.length===3?n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,t.image):n.texElementImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t.image));else{let f=e.mipmaps;if(f.length>0)for(let p=0,x=f.length;p<x;p++){let v=f[p],w=jE(v);n.texSubImage2D(a,p,0,0,v.width,v.height,l,c,w)}else{let p=jE(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,p)}}}generateMipmaps(e){let{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:n}=this;if(e){let r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(let s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&e.isExternalTexture!==!0&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let{gl:a,backend:l}=this,{state:c}=this.backend,{textureGPU:u,glTextureType:f,glType:p,glFormat:x}=l.get(t);c.bindTexture(f,u);let v,w,S,T,P,R,C,L,D,F=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)v=n.max.x-n.min.x,w=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,T=n.min.x,P=n.min.y,R=n.isBox3?n.min.z:0;else{let j=Math.pow(2,-s);v=Math.floor(F.width*j),w=Math.floor(F.height*j),e.isDataArrayTexture||e.isArrayTexture?S=F.depth:e.isData3DTexture?S=Math.floor(F.depth*j):S=1,T=0,P=0,R=0}r!==null?(C=r.x,L=r.y,D=r.z):(C=0,L=0,D=0),c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);let N=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),z=c.getParameter(a.UNPACK_SKIP_PIXELS),V=c.getParameter(a.UNPACK_SKIP_ROWS),H=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,F.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,F.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,P),c.pixelStorei(a.UNPACK_SKIP_IMAGES,R);let Z=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,J=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let j=l.get(e),K=l.get(t),ee=l.get(j.renderTarget),ae=l.get(K.renderTarget),ce=ee.framebuffers[j.cacheKey],de=ae.framebuffers[K.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Ie=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,de);for(let Qe=0;Qe<S;Qe++)Z&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,j.textureGPU,s,R+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,P,v,w,C,L,v,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Ie)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let j=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let K=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,ee=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let ae=0;ae<S;ae++)Z?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,j.textureGPU,s,R+ae):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,j.textureGPU,s),J?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+ae):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,P,v,w,C,L,v,w,a.COLOR_BUFFER_BIT,a.NEAREST):J?a.copyTexSubImage3D(f,o,C,L,D+ae,T,P,v,w):a.copyTexSubImage2D(f,o,C,L,T,P,v,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,K),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,ee)}else J?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,C,L,D,v,w,S,x,p,F.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,C,L,D,v,w,S,x,F.data):a.texSubImage3D(f,o,C,L,D,v,w,S,x,p,F):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,C,L,v,w,x,p,F.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,C,L,F.width,F.height,x,F.data):a.texSubImage2D(a.TEXTURE_2D,o,C,L,v,w,x,p,F);c.pixelStorei(a.UNPACK_ROW_LENGTH,N),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,z),c.pixelStorei(a.UNPACK_SKIP_ROWS,V),c.pixelStorei(a.UNPACK_SKIP_IMAGES,H),o===0&&t.generateMipmaps&&a.generateMipmap(f),c.unbindTexture()}copyFramebufferToTexture(e,t,n){let{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:c,w:u}=n,f=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,p=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let x=a!==0||l!==0,v,w;if(e.isDepthTexture===!0?(v=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(v|=r.STENCIL_BUFFER_BIT)):(v=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),x){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],P=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,P);let R=p-l-u;r.blitFramebuffer(a,R,a+c,R+u,a,R,a+c,R+u,v,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,R,c,u),s.unbindTexture()}else{let S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,w,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,c,u,0,0,c,u,v,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,p-u-l,c,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){let{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:c,width:u,height:f}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!c){let p=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,p,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(p=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,p,u,f)):s.renderbufferStorage(s.RENDERBUFFER,p,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&c&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,u,f):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){let{backend:a,gl:l}=this,{textureGPU:c,glFormat:u,glType:f}=this.backend.get(e),p=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,p);let x=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,x,c,0);let v=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,P=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,P),l.bufferData(l.PIXEL_PACK_BUFFER,T,l.STREAM_READ),l.readPixels(t,n,r,s,u,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();let R=new v(T/v.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,P),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,R),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(p),R}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:n}=this,r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function jE(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}var EB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},MB=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){let n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},hZ={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"},CB=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){let{gl:r,mode:s,type:o,index:a,object:l,info:c}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),c.update(l,t,n))}renderMultiDraw(e,t,n){let{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;let l=r.get("WEBGL_multi_draw");if(l===null)for(let c=0;c<n;c++)this.render(e[c],t[c]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let c=0;for(let u=0;u<n;u++)c+=t[u];a.update(o,c,1)}}},hC=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(je(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},RB=class extends hC{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){je("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return Zn(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){Ge("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){Ge("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){let l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;let t={},n=[];for(let[s,o]of e){let a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);let c=await o;this.timestamps.set(s,c),t[l]+=c}let r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return Ge("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1,s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}let u=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(u)/1e6)}catch(l){Ge("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},fC=class extends uC{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();let a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new EB(this),this.capabilities=new MB(this),this.attributeUtils=new bB(this),this.textureUtils=new TB(this),this.bufferRenderer=new CB(this),this.state=new wB(this),this.utils=new SB(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(je("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return po}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){let r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){let s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&je("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new RB(this.gl,e,2048));let n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery(ec.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();let o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){let c=a[l];c.generateMipmaps&&this.generateMipmaps(c)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.viewport(0,0,l,c)}if(s.scissor)this.updateScissor(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.scissor(0,0,l,c)}}this.prepareTimestampBuffer(ec.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let l=0;for(let c=0;c<n.length;c++){let u=n[c];u!==null&&o.getQueryParameter(u,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(u,o.QUERY_RESULT)===0&&s.add(r[c]),n[c]=null,o.deleteQuery(u),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){let{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let c=0;if(e&&(c|=a.COLOR_BUFFER_BIT),t&&(c|=a.DEPTH_BUFFER_BIT),n&&(c|=a.STENCIL_BUFFER_BIT),c!==0){let u;r.clearColorValue?u=r.clearColorValue:u=this.getClearColor();let f=l.getClearDepth(),p=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(c);else{if(s&&this._setFramebuffer(r),e)for(let x=0;x<r.textures.length;x++)x===0?a.clearBufferfv(a.COLOR,x,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,x,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,p):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[p]),s&&o&&this._resolveRenderTarget(r),s&&this._currentContext!==null&&this._currentContext!==r&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(ec.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){let{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:l,transformBuffers:c,attributes:u}=this.get(r),f=this._getVaoKey(u),p=this.vaoCache[f];p===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(p),o.useProgram(l),this._bindUniforms(n);let x=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,x),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(Zn("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(Zn("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let v=0;v<c.length;v++){let w=c[v];w.pbo&&this.has(w.pbo)&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){let{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(ec.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,n,r,s,o){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){let{gl:a}=this,l=a.getUniformLocation(o,"nodeUniformDrawId"),c=e._multiDrawStarts,u=e._multiDrawCounts,f=e._multiDrawCount;for(let p=0;p<f;p++)a.uniform1ui(l,p),t.render(c[p],u[p])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(n,r,s):t.render(n,r)}draw(e){let{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:c}=this,u=this.get(s),f=e.getDrawParameters();if(f===null)return;this._bindUniforms(e.getBindings());let p=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,p,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let x=e.getAttributes(),v=this.get(x),w=v.vaoGPU;if(w===void 0){let F=this._getVaoKey(x);w=this.vaoCache[F],w===void 0&&(w=this._createVao(x),this.vaoCache[F]=w,v.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let P=u.lastOcclusionObject;if(P!==t&&P!==void 0){if(P!==null&&P.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let F=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,F),u.occlusionQueries[u.occlusionQueryIndex]=F,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let R=this.bufferRenderer;t.isPoints?R.mode=l.POINTS:t.isLineSegments?R.mode=l.LINES:t.isLine?R.mode=l.LINE_STRIP:t.isLineLoop?R.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),R.mode=l.LINES):R.mode=l.TRIANGLES;let{vertexCount:C,instanceCount:L}=f,{firstVertex:D}=f;if(R.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let F=this.get(S);R.index=S.count,R.type=F.type}else R.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let F=this.get(e.camera),N=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(F.indexesGPU===void 0||F.indexesGPU.length!==N.length){let j=new Uint32Array([0,0,0,0]),K=[];for(let ee=0,ae=N.length;ee<ae;ee++){let ce=l.createBuffer();j[0]=ee,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,j,l.STATIC_DRAW),K.push(ce)}F.indexesGPU=K}let z=0;e:for(let j of e.getBindings())for(let K of j.bindings){if(K===B)break e;(K.isUniformsGroup||K.isUniformBuffer)&&z++}let V=this.renderer.getPixelRatio(),H=this._currentContext.renderTarget,Z=this._isRenderCameraDepthArray(this._currentContext),J=this._currentContext.activeCubeFace;if(Z){let j=this.get(H.depthTexture);if(j.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){j.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:K}=H;for(let ee=0,ae=N.length;ee<ae;ee++)this.renderer._activeCubeFace=ee,this._currentContext.activeCubeFace=ee,this._setFramebuffer(this._currentContext),this.clear(!1,!0,K,this._currentContext,!1,!1);this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J}}for(let j=0,K=N.length;j<K;j++){let ee=N[j];if(t.layers.test(ee.layers)){Z&&(this.renderer._activeCubeFace=j,this._currentContext.activeCubeFace=j,this._setFramebuffer(this._currentContext));let ae=ee.viewport;if(ae!==void 0){let ce=ae.x*V,de=ae.y*V,ve=ae.width*V,Ie=ae.height*V;c.viewport(Math.floor(ce),Math.floor(e.context.height-Ie-de),Math.floor(ve),Math.floor(Ie))}c.bindBufferBase(l.UNIFORM_BUFFER,z,F.indexesGPU[j]),this._draw(t,R,D,C,L,a)}this._currentContext.activeCubeFace=J,this.renderer._activeCubeFace=J}}else this._draw(t,R,D,C,L,a)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new yB(e,t)}createProgram(e){let t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,c),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:c}),t!==null&&this.parallel){let u=new Promise(f=>{let p=this.parallel,x=()=>{n.getProgramParameter(a,p.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(x)};x()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`43584358 `),r=[],s=Math.max(t-6,0),o=Math.min(t+6,n.length);for(let a=s;a<o;a++){let l=a+1;r.push(`${l===t?">":" "} ${l}: ${n[a]}`)}return r.join(`43594359 `)}_getShaderErrors(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),o=(e.getShaderInfoLog(t)||"").trim();if(r&&o==="")return"";let a=/ERROR: 0:(\d+)/.exec(o);if(a){let l=parseInt(a[1]);return n.toUpperCase()+`43604360
@@ -4366,7 +4366,7 @@ Program Info Log: `+o+`
43664366 `+a+`43674367 `+l)}else o!==""&&je("WebGLProgram: Program Info Log:",o)}}_completeCompile(e,t){let{state:n,gl:r}=this,s=this.get(t),{programGPU:o,fragmentShader:a,vertexShader:l}=s;r.getProgramParameter(o,r.LINK_STATUS)===!1&&this._logProgramError(o,a,l),n.useProgram(o);let c=e.getBindings();this._setupBindings(c,o),this.set(t,{programGPU:o,pipeline:o})}createComputePipeline(e,t){let{state:n,gl:r}=this,s={stage:"fragment",code:`#version 300 es43684368 precision highp float;4369-void main() {}`};this.createProgram(s);let{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU,u=o.transforms,f=[],p=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),p.push(T.attributeNode)}r.attachShader(a,l),r.attachShader(a,c),r.transformFeedbackVaryings(a,f,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,c),n.useProgram(a),this._setupBindings(t,a);let x=o.attributes,v=[],w=[];for(let S=0;S<x.length;S++){let T=x[S].node.attribute;v.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<p.length;S++){let T=p[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let P=this.get(T);w.push(P)}this.set(e,{programGPU:a,transformBuffers:w,attributes:v})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(let s of t){this.set(s,{textures:r,uniformBuffers:n});for(let o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let n of e.bindings){let r=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let s=n.buffer,o=r.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,o);let a=n.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,o),a.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let l=E_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let p=a[u],x=p.start*c,v=p.count*c,w=x*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,x,v)}}this.set(n,r)}else if(n.isSampledTexture){let{textureGPU:s,glTextureType:o}=this.get(n.texture);r.textureGPU=s,r.glTextureType=o,this.set(n,r)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let a=E_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let p=o[u],x=o[u+1],v=p.start+p.count;if(x!==void 0&&x.start===v)continue;let w=c*l,S=(v-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),x!==void 0&&(c=x.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let n=this.gl,r=e.buffer;t.bufferGPU=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,t.bufferGPU),n.bufferData(n.UNIFORM_BUFFER,r.byteLength,n.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(cK).filter(r=>cK[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===Df.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:n}=this,r=null;if(e.textures!==null){let s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:c}=s,u=s.isCubeRenderTarget===!0,f=s.isRenderTarget3D===!0,p=s.depth>1,x=s.isXRRenderTarget===!0,v=x===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),P=this.extensions.get("OVR_multiview2"),R=this._useMultisampledExtension(s),C=UJ(e),L;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),L=o.cubeFramebuffers[C]):x&&v===!1?L=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),L=o.framebuffers[C]),L===void 0){L=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,L);let D=e.textures,F=[];if(u){o.cubeFramebuffers[C]=L;let{textureGPU:B}=this.get(D[0]),z=this.renderer._activeCubeFace,V=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+z,B,V)}else{o.framebuffers[C]=L;for(let B=0;B<D.length;B++){let z=D[B],V=this.get(z);V.renderTarget=e.renderTarget,V.cacheKey=C;let H=t.COLOR_ATTACHMENT0+B;if(s.multiview)P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,H,V.textureGPU,0,a,0,2);else if(f||p){let K=this.renderer._activeCubeFace,J=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,H,V.textureGPU,J,K)}else if(R)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,H,t.TEXTURE_2D,V.textureGPU,0,a);else{let K=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,H,t.TEXTURE_2D,V.textureGPU,K)}}}let N=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,R),o.xrDepthRenderbuffer=B,F.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,N,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){F.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=C,s.multiview)P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2);else if(v&&R)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let z=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,N,B.textureGPU,0,z)}else if(e.depthTexture.isCubeTexture){let z=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_CUBE_MAP_POSITIVE_X+z,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=F}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.renderer._activeCubeFace,N=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,N.textureGPU,0,F)}if((x||R||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.get(e.textures[0]);s.multiview?P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,F.textureGPU,0,a,0,2):R?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0);let N=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,N,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2):R?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&R===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let F=[],N=e.textures;for(let B=0;B<N.length;B++){F[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,F[B]),D.push(t.COLOR_ATTACHMENT0+B);let z=e.textures[B],V=this.get(z);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,V.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,F[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=F,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;let B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;D.push(B)}o.invalidationArray=D}r=o.msaaFrameBuffer}else r=L;n.drawBuffers(e,L)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){let r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){let{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){let s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;let{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){let o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){let n=this.gl,r=0,s=0;for(let o of e)for(let a of o.bindings)if(a.isUniformsGroup||a.isUniformBuffer){let l=r++,c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,l)}else if(a.isSampledTexture){let l=s++,c=n.getUniformLocation(t,a.name);n.uniform1i(c,l)}}_bindUniforms(e){let{gl:t,state:n}=this,r=0,s=0;for(let o of e)for(let a of o.bindings){let l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){let c=r++;n.bindBufferBase(t.UNIFORM_BUFFER,c,l.bufferGPU)}else if(a.isSampledTexture){let c=s++;n.bindTexture(l.glTextureType,l.textureGPU,t.TEXTURE0+c)}}}_resolveRenderTarget(e){let{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){let s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){let o=s.framebuffers[e.getCacheKey()],a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));let l=s.msaaFrameBuffer,c=s.msaaRenderbuffers,u=e.textures,f=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),f)for(let p=0;p<u.length;p++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,null,0);for(let p=0;p<u.length;p++){if(f){let{textureGPU:x}=this.get(u[p]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[p]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0)}if(e.scissor){let{x,y:v,width:w,height:S}=e.scissorValue,T=e.height-S-v;t.blitFramebuffer(x,T,x+w,T+S,x,T,x+w,T+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(f)for(let p=0;p<u.length;p++){let{textureGPU:x}=this.get(u[p]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,c[p]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,x,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){let o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}},Gv={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Ch=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},vo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},ba={Store:"store"},Ei={Load:"load",Clear:"clear"},uK={CCW:"ccw",CW:"cw"},hK={None:"none",Back:"back"},dC={Uint16:"uint16",Uint32:"uint32"},he={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},h8={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},ac={Linear:"linear",Nearest:"nearest"},si={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},um={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},fK={None:0,All:15},Vp={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},f8={Storage:"storage",ReadOnlyStorage:"read-only-storage"},d8={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},dK={NonFiltering:"non-filtering",Comparison:"comparison"},hm={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},pK={TwoD:"2d",ThreeD:"3d"},bo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},PTe={All:"all"},XE={Vertex:"vertex",Instance:"instance"},pC={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},AK={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},RB=class extends lC{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},PB=class extends rC{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},ITe=0,IB=class extends PB{constructor(e,t){super("StorageBuffer_"+ITe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:So.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},p8=[null],NB=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=he.Depth32FloatStencil8:t=he.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=he.Depth32Float:t=he.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return Gv.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Gv.LineList;if(e.isLine)return Gv.LineStrip;if(e.isMesh)return Gv.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Gi)return he.BGRA8Unorm;if(t===Li)return he.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function bh(i,e){p8[0]=e,i.queue.submit(p8),p8[0]=null}var AC=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},o0=class{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}},Dm=class{constructor(){this.label=""}reset(){this.label=""}},mC=class{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},Sm=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},Tm=class{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},gC=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new LB,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},LB=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},_C=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},Ab=class{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},mb=class{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}},qp=new AC,Hp=new o0,$E=new Dm,A8=new mC,m8=new Tm,l1=new gC,Lv=new Sm,YE=new _C,c1=new Ab,Zr=new mb,DB=class extends Nh{constructor(e){super(),this.device=e;let t=`4369+void main() {}`};this.createProgram(s);let{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU,u=o.transforms,f=[],p=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),p.push(T.attributeNode)}r.attachShader(a,l),r.attachShader(a,c),r.transformFeedbackVaryings(a,f,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,c),n.useProgram(a),this._setupBindings(t,a);let x=o.attributes,v=[],w=[];for(let S=0;S<x.length;S++){let T=x[S].node.attribute;v.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<p.length;S++){let T=p[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let P=this.get(T);w.push(P)}this.set(e,{programGPU:a,transformBuffers:w,attributes:v})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(let s of t){this.set(s,{textures:r,uniformBuffers:n});for(let o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let n of e.bindings){let r=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let s=n.buffer,o=r.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,o);let a=n.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,o),a.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let l=E_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let p=a[u],x=p.start*c,v=p.count*c,w=x*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,x,v)}}this.set(n,r)}else if(n.isSampledTexture){let{textureGPU:s,glTextureType:o}=this.get(n.texture);r.textureGPU=s,r.glTextureType=o,this.set(n,r)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let a=E_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let p=o[u],x=o[u+1],v=p.start+p.count;if(x!==void 0&&x.start===v)continue;let w=c*l,S=(v-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),x!==void 0&&(c=x.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let n=this.gl,r=e.buffer;t.bufferGPU=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,t.bufferGPU),n.bufferData(n.UNIFORM_BUFFER,r.byteLength,n.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(hZ).filter(r=>hZ[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===Df.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:n}=this,r=null;if(e.textures!==null){let s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:c}=s,u=s.isCubeRenderTarget===!0,f=s.isRenderTarget3D===!0,p=s.depth>1,x=s.isXRRenderTarget===!0,v=x===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),P=this.extensions.get("OVR_multiview2"),R=this._useMultisampledExtension(s),C=GJ(e),L;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),L=o.cubeFramebuffers[C]):x&&v===!1?L=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),L=o.framebuffers[C]),L===void 0){L=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,L);let D=e.textures,F=[];if(u){o.cubeFramebuffers[C]=L;let{textureGPU:B}=this.get(D[0]),z=this.renderer._activeCubeFace,V=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+z,B,V)}else{o.framebuffers[C]=L;for(let B=0;B<D.length;B++){let z=D[B],V=this.get(z);V.renderTarget=e.renderTarget,V.cacheKey=C;let H=t.COLOR_ATTACHMENT0+B;if(s.multiview)P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,H,V.textureGPU,0,a,0,2);else if(f||p){let Z=this.renderer._activeCubeFace,J=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,H,V.textureGPU,J,Z)}else if(R)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,H,t.TEXTURE_2D,V.textureGPU,0,a);else{let Z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,H,t.TEXTURE_2D,V.textureGPU,Z)}}}let N=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,R),o.xrDepthRenderbuffer=B,F.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,N,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){F.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=C,s.multiview)P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2);else if(v&&R)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let z=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,N,B.textureGPU,0,z)}else if(e.depthTexture.isCubeTexture){let z=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_CUBE_MAP_POSITIVE_X+z,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=F}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.renderer._activeCubeFace,N=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,N.textureGPU,0,F)}if((x||R||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.get(e.textures[0]);s.multiview?P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,F.textureGPU,0,a,0,2):R?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0);let N=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,N,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2):R?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&R===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let F=[],N=e.textures;for(let B=0;B<N.length;B++){F[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,F[B]),D.push(t.COLOR_ATTACHMENT0+B);let z=e.textures[B],V=this.get(z);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,V.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,F[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=F,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;let B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;D.push(B)}o.invalidationArray=D}r=o.msaaFrameBuffer}else r=L;n.drawBuffers(e,L)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){let r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){let{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){let s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;let{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){let o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){let n=this.gl,r=0,s=0;for(let o of e)for(let a of o.bindings)if(a.isUniformsGroup||a.isUniformBuffer){let l=r++,c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,l)}else if(a.isSampledTexture){let l=s++,c=n.getUniformLocation(t,a.name);n.uniform1i(c,l)}}_bindUniforms(e){let{gl:t,state:n}=this,r=0,s=0;for(let o of e)for(let a of o.bindings){let l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){let c=r++;n.bindBufferBase(t.UNIFORM_BUFFER,c,l.bufferGPU)}else if(a.isSampledTexture){let c=s++;n.bindTexture(l.glTextureType,l.textureGPU,t.TEXTURE0+c)}}}_resolveRenderTarget(e){let{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){let s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){let o=s.framebuffers[e.getCacheKey()],a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));let l=s.msaaFrameBuffer,c=s.msaaRenderbuffers,u=e.textures,f=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),f)for(let p=0;p<u.length;p++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,null,0);for(let p=0;p<u.length;p++){if(f){let{textureGPU:x}=this.get(u[p]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[p]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0)}if(e.scissor){let{x,y:v,width:w,height:S}=e.scissorValue,T=e.height-S-v;t.blitFramebuffer(x,T,x+w,T+S,x,T,x+w,T+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(f)for(let p=0;p<u.length;p++){let{textureGPU:x}=this.get(u[p]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,c[p]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,x,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){let o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}},Gv={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Ch=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},vo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},wa={Store:"store"},Ei={Load:"load",Clear:"clear"},fZ={CCW:"ccw",CW:"cw"},dZ={None:"none",Back:"back"},dC={Uint16:"uint16",Uint32:"uint32"},he={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},f8={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},ac={Linear:"linear",Nearest:"nearest"},si={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},hm={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},pZ={None:0,All:15},Vp={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},d8={Storage:"storage",ReadOnlyStorage:"read-only-storage"},p8={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},AZ={NonFiltering:"non-filtering",Comparison:"comparison"},fm={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},mZ={TwoD:"2d",ThreeD:"3d"},bo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},LTe={All:"all"},XE={Vertex:"vertex",Instance:"instance"},pC={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},gZ={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},PB=class extends lC{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},IB=class extends rC{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},DTe=0,NB=class extends IB{constructor(e,t){super("StorageBuffer_"+DTe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:So.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},A8=[null],LB=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=he.Depth32FloatStencil8:t=he.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=he.Depth32Float:t=he.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return Gv.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Gv.LineList;if(e.isLine)return Gv.LineStrip;if(e.isMesh)return Gv.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Gi)return he.BGRA8Unorm;if(t===Li)return he.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function bh(i,e){A8[0]=e,i.queue.submit(A8),A8[0]=null}var AC=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},o0=class{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}},Fm=class{constructor(){this.label=""}reset(){this.label=""}},mC=class{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},Tm=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},Em=class{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},gC=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new DB,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},DB=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},_C=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},Ab=class{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},mb=class{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}},qp=new AC,Hp=new o0,$E=new Fm,m8=new mC,g8=new Em,l1=new gC,Lv=new Tm,YE=new _C,c1=new Ab,Kr=new mb,FB=class extends Nh{constructor(e){super(),this.device=e;let t=`43704370 struct VarysStruct {43714371 @builtin( position ) Position: vec4f,43724372 @location( 0 ) vTex : vec2f,
@@ -4440,7 +4440,7 @@ fn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> {
44404440 return textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );44414441 44424442 }4443-`;this.mipmapSampler=e.createSampler({minFilter:ac.Linear}),this.flipYSampler=e.createSampler({minFilter:ac.Nearest}),Hp.size=4,Hp.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(Hp),Hp.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),Hp.size=4,Hp.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(Hp),Hp.reset(),this.transferPipelines={},YE.label="mipmap",YE.code=t,this.mipmapShaderModule=e.createShaderModule(YE),YE.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(l1.label=`mipmap-${e}-${t}`,l1.vertex={module:this.mipmapShaderModule},l1.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},l1.layout="auto",r=this.device.createRenderPipeline(l1),l1.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;c1.size.width=s,c1.size.height=o,c1.format=r,c1.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(c1);c1.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder($E),f=(p,x,v,w,S,T)=>{let P=p.getBindGroupLayout(0);Zr.dimension=x.textureBindingViewDimension||"2d-array",Zr.mipLevelCount=1;let R=x.createView(Zr);Zr.reset(),qp.layout=P,qp.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:R},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let C=this.device.createBindGroup(qp);qp.reset(),Zr.dimension="2d",Zr.mipLevelCount=1,Zr.baseArrayLayer=S,Zr.arrayLayerCount=1;let L=w.createView(Zr);Zr.reset(),Lv.view=L,Lv.loadOp=Ei.Clear,Lv.storeOp=ba.Store,m8.colorAttachments.push(Lv);let D=u.beginRenderPass(m8);m8.reset(),Lv.reset(),D.setPipeline(p),D.setBindGroup(0,C),D.draw(3,1,0,v),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),bh(this.device,u.finish()),a.destroy()}generateMipmaps(e,t=null){let n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t;s===null&&($E.label="mipmapEncoder",s=this.device.createCommandEncoder($E),$E.reset()),this._mipmapRunBundles(s,r),t===null&&bh(this.device,s.finish()),n.layers=r}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){Zr.dimension=t,Zr.baseMipLevel=o-1,Zr.mipLevelCount=1;let l=e.createView(Zr);Zr.reset(),qp.layout=r,qp.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(qp);qp.reset(),Zr.dimension="2d",Zr.baseMipLevel=o,Zr.mipLevelCount=1,Zr.baseArrayLayer=a,Zr.arrayLayerCount=1;let u=e.createView(Zr);Zr.reset();let f=new Sm;f.view=u,f.loadOp=Ei.Clear,f.storeOp=ba.Store;let p=new Tm;p.colorAttachments.push(f),A8.colorFormats=[e.format];let x=this.device.createRenderBundleEncoder(A8);A8.reset(),x.setPipeline(n),x.setBindGroup(0,c),x.draw(3,1,0,a),s.push({renderBundles:[x.finish()],passDescriptor:p})}return s}_mipmapRunBundles(e,t){let n=t.length;for(let r=0;r<n;r++){let s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}},FB=class{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},L1=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}},OB=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},BB=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},UB=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},kB=class extends L1{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},xC=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},KE=new o0,NTe=new Dm,Wo=new FB,Yo=new L1,ZE=new OB,jf=new BB,QE=new UB,u1=new kB,Wp=new Ab,Xo=new xC,LTe={[_2]:"never",[T_]:"less",[x2]:"equal",[th]:"less-equal",[UA]:"greater",[Hc]:"greater-equal",[v2]:"always",[y2]:"not-equal"},DTe=[0,1,3,2,4,5];function mK(i,e,t,n,r,s,o,a,l,c){Yo.texture=e,Yo.mipLevel=t,Yo.origin.z=n,jf.offset=n*s,jf.bytesPerRow=o,jf.rowsPerImage=a,Xo.width=l,Xo.height=c,i.queue.writeTexture(Yo,r.data,jf,Xo),Yo.reset(),jf.reset(),Xo.reset()}var GB=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,n=e.texture,r=e.textureNode,s=n.minFilter+"-"+n.magFilter+"-"+n.wrapS+"-"+n.wrapT+"-"+(n.wrapR||"0")+"-"+n.anisotropy+"-"+(n.isDepthTexture===!0?1:0)+"-"+(n.compareFunction!==null&&r.compareNode!==null?n.compareFunction:0),o=this._samplerCache.get(s);if(o===void 0){Wo.addressModeU=this._convertAddressMode(n.wrapS),Wo.addressModeV=this._convertAddressMode(n.wrapT),Wo.addressModeW=this._convertAddressMode(n.wrapR),Wo.magFilter=this._convertFilterMode(n.magFilter),Wo.minFilter=this._convertFilterMode(n.minFilter),Wo.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(Wo.magFilter=ac.Nearest,Wo.minFilter=ac.Nearest,Wo.mipmapFilter=ac.Nearest),Wo.magFilter===ac.Linear&&Wo.minFilter===ac.Linear&&Wo.mipmapFilter===ac.Linear&&(Wo.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Df.TEXTURE_COMPARE)&&(Wo.compare=LTe[n.compareFunction]);let l=t.device.createSampler(Wo);Wo.reset(),o={sampler:l,usedTimes:0},this._samplerCache.set(s,o)}let a=t.get(e);return a.sampler!==o.sampler&&(this._releaseSampler(a),a.samplerKey=s,a.sampler=o.sampler,o.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,n=zB(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){let n=this.backend,r=n.get(e);if(r.initialized){if(r.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let c=this._getDimension(e),u=e.internalFormat||t.format||zB(e,n.device);r.format=u;let{samples:f,primarySamples:p,isMSAA:x}=n.utils.getTextureSampleData(e),v=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(v|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==he.RGB9E5UFloat&&(v|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new Ab;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=p,w.dimension=c,w.format=u,w.usage=v,u===void 0){je("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=bo.Cube);try{r.texture=n.device.createTexture(w)}catch{je("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(x){let S=Object.assign({},w);S.label=S.label+"-msaa",S.sampleCount=f,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=w}destroyTexture(e,t=!1){let n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){let n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),Wp.label="colorBuffer",Wp.size.width=n,Wp.size.height=r,Wp.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Wp.format=e.utils.getPreferredCanvasFormat(),Wp.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(Wp),Wp.reset(),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){let n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;let c=n.get(l).texture,u,f;if(t?(u=Qs,f=n.renderer.reversedDepthBuffer===!0?Yi:Go):e&&(u=xs,f=n.renderer.reversedDepthBuffer===!0?Yi:pi),c!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===u&&l.type===f&&l.samples===a)return c;this.destroyTexture(l)}return l.name="depthBuffer",l.format=u,l.type=f,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){let n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let o of e.layerUpdates)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);e.clearLayerUpdates()}else for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(e.isHTMLTexture){let o=this.backend.device,a=this.backend.renderer.domElement,l=e.image;if(typeof o.queue.copyElementImageToTexture!="function")return;if(!n.hasPaintCallback){n.hasPaintCallback=!0,a.requestPaint();return}let c=s.size.width,u=s.size.height;o.queue.copyElementImageToTexture.length===2?o.queue.copyElementImageToTexture({source:l},{destination:{texture:n.texture},width:c,height:u}):o.queue.copyElementImageToTexture(l,c,u,{texture:n.texture}),e.flipY&&this._flipY(n.texture,s)}else if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){let a=this.backend.device,l=this.backend.get(e),c=l.texture,u=l.textureDescriptorGPU.format,f=this._getBytesPerTexel(u),p=r*f;p=Math.ceil(p/256)*256,KE.size=(s-1)*p+r*f,KE.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let x=a.createBuffer(KE);KE.reset();let v=a.createCommandEncoder(NTe);Yo.texture=c,Yo.origin.x=t,Yo.origin.y=n,Yo.origin.z=o,ZE.buffer=x,ZE.bytesPerRow=p,Xo.width=r,Xo.height=s,v.copyTextureToBuffer(Yo,ZE,Xo),Yo.reset(),ZE.reset(),Xo.reset();let w=this._getTypedArrayType(u);bh(a,v.finish()),await x.mapAsync(GPUMapMode.READ);let S=x.getMappedRange().slice();return x.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new vs;n.minFilter=xi,n.magFilter=xi,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let n=new Uu;n.minFilter=xi,n.magFilter=xi,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){let r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){let a=r[o],l=e.flipY===!0?DTe[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let c=0;c<s.length;c++){let f=s[c].images[o];f.isDataTexture?this._copyBufferToTexture(f.image,t,n,l,e.flipY,0,c+1):this._copyImageToTexture(f,t,n,l,e.flipY,e.premultiplyAlpha,c+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){let l=this.backend.device,c=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;QE.source=e,QE.flipY=s,u1.texture=t,u1.mipLevel=a,u1.origin.z=r,u1.premultipliedAlpha=o,Xo.width=c,Xo.height=u;try{l.queue.copyExternalImageToTexture(QE,u1,Xo)}catch{}finally{QE.reset(),u1.reset(),Xo.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new DB(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){let l=this.backend.device,c=e.data,u=this._getBytesPerTexel(n.format),f=e.width*u;Yo.texture=t,Yo.mipLevel=a,Yo.origin.z=r,jf.offset=e.width*e.height*u*o,jf.bytesPerRow=f,Xo.width=e.width,Xo.height=e.height,l.queue.writeTexture(Yo,c,jf,Xo),Yo.reset(),jf.reset(),Xo.reset(),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n,r=null){let s=this.backend.device,o=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1,l=r&&r.size>0?r:null;for(let c=0;c<e.length;c++){let u=e[c],f=u.width,p=u.height,x=a?n.size.depthOrArrayLayers:1,v=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(p/o.height),S=v*w,T=Math.ceil(f/o.width)*o.width,P=w*o.height;if(l!==null)for(let R of l)mK(s,t,c,R,u,S,v,w,T,P);else for(let R=0;R<x;R++)mK(s,t,c,R,u,S,v,w,T,P)}}_getBlockData(e){if(e===he.BC1RGBAUnorm||e===he.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.BC2RGBAUnorm||e===he.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.BC3RGBAUnorm||e===he.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.BC4RUnorm||e===he.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===he.BC5RGUnorm||e===he.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===he.BC6HRGBUFloat||e===he.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===he.BC7RGBAUnorm||e===he.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.ETC2RGB8Unorm||e===he.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.ETC2RGB8A1Unorm||e===he.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.ETC2RGBA8Unorm||e===he.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===he.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===he.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===he.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===he.ASTC4x4Unorm||e===he.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.ASTC5x4Unorm||e===he.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===he.ASTC5x5Unorm||e===he.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===he.ASTC6x5Unorm||e===he.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===he.ASTC6x6Unorm||e===he.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===he.ASTC8x5Unorm||e===he.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===he.ASTC8x6Unorm||e===he.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===he.ASTC8x8Unorm||e===he.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===he.ASTC10x5Unorm||e===he.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===he.ASTC10x6Unorm||e===he.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===he.ASTC10x8Unorm||e===he.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===he.ASTC10x10Unorm||e===he.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===he.ASTC12x10Unorm||e===he.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===he.ASTC12x12Unorm||e===he.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=h8.ClampToEdge;return e===Sf?t=h8.Repeat:e===Tf&&(t=h8.MirrorRepeat),t}_convertFilterMode(e){let t=ac.Linear;return(e===xi||e===A2||e===Jl)&&(t=ac.Nearest),t}_convertMipmapFilterMode(e){return e===Jl||e===go?ac.Linear:ac.Nearest}_getBytesPerTexel(e){if(e===he.R8Unorm||e===he.R8Snorm||e===he.R8Uint||e===he.R8Sint)return 1;if(e===he.R16Uint||e===he.R16Sint||e===he.R16Float||e===he.RG8Unorm||e===he.RG8Snorm||e===he.RG8Uint||e===he.RG8Sint||e===he.R16Unorm||e===he.R16Snorm)return 2;if(e===he.R32Uint||e===he.R32Sint||e===he.R32Float||e===he.RG16Uint||e===he.RG16Sint||e===he.RG16Float||e===he.RGBA8Unorm||e===he.RGBA8UnormSRGB||e===he.RGBA8Snorm||e===he.RGBA8Uint||e===he.RGBA8Sint||e===he.BGRA8Unorm||e===he.BGRA8UnormSRGB||e===he.RG16Unorm||e===he.RG16Snorm||e===he.RGB9E5UFloat||e===he.RGB10A2Unorm||e===he.RG11B10UFloat||e===he.Depth32Float||e===he.Depth24Plus||e===he.Depth24PlusStencil8||e===he.Depth32FloatStencil8)return 4;if(e===he.RG32Uint||e===he.RG32Sint||e===he.RG32Float||e===he.RGBA16Uint||e===he.RGBA16Sint||e===he.RGBA16Float||e===he.RGBA16Unorm||e===he.RGBA16Snorm)return 8;if(e===he.RGBA32Uint||e===he.RGBA32Sint||e===he.RGBA32Float)return 16}_getTypedArrayType(e){if(e===he.R8Uint)return Uint8Array;if(e===he.R8Sint)return Int8Array;if(e===he.R8Unorm)return Uint8Array;if(e===he.R8Snorm)return Int8Array;if(e===he.RG8Uint)return Uint8Array;if(e===he.RG8Sint)return Int8Array;if(e===he.RG8Unorm)return Uint8Array;if(e===he.RG8Snorm)return Int8Array;if(e===he.RGBA8Uint)return Uint8Array;if(e===he.RGBA8Sint)return Int8Array;if(e===he.RGBA8Unorm||e===he.RGBA8UnormSRGB)return Uint8Array;if(e===he.RGBA8Snorm)return Int8Array;if(e===he.R16Uint)return Uint16Array;if(e===he.R16Sint)return Int16Array;if(e===he.RG16Uint)return Uint16Array;if(e===he.RG16Sint)return Int16Array;if(e===he.RGBA16Uint)return Uint16Array;if(e===he.RGBA16Sint)return Int16Array;if(e===he.R16Float||e===he.RG16Float||e===he.RGBA16Float||e===he.R16Unorm)return Uint16Array;if(e===he.R16Snorm)return Int16Array;if(e===he.RG16Unorm)return Uint16Array;if(e===he.RG16Snorm)return Int16Array;if(e===he.RGBA16Unorm)return Uint16Array;if(e===he.RGBA16Snorm)return Int16Array;if(e===he.R32Uint)return Uint32Array;if(e===he.R32Sint)return Int32Array;if(e===he.R32Float)return Float32Array;if(e===he.RG32Uint)return Uint32Array;if(e===he.RG32Sint)return Int32Array;if(e===he.RG32Float)return Float32Array;if(e===he.RGBA32Uint)return Uint32Array;if(e===he.RGBA32Sint)return Int32Array;if(e===he.RGBA32Float)return Float32Array;if(e===he.BGRA8Unorm||e===he.BGRA8UnormSRGB)return Uint8Array;if(e===he.RGB10A2Unorm||e===he.RGB9E5UFloat||e===he.RG11B10UFloat)return Uint32Array;if(e===he.Depth32Float)return Float32Array;if(e===he.Depth24Plus||e===he.Depth24PlusStencil8)return Uint32Array;if(e===he.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=pK.ThreeD:t=pK.TwoD,t}};function zB(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=sn.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(pC.TextureFormatsTier1),l===!1&&je("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Yu:case Ku:a=o===Bt?he.BC1RGBAUnormSRGB:he.BC1RGBAUnorm;break;case Zu:a=o===Bt?he.BC2RGBAUnormSRGB:he.BC2RGBAUnorm;break;case Qu:a=o===Bt?he.BC3RGBAUnormSRGB:he.BC3RGBAUnorm;break;case Mp:a=he.BC4RUnorm;break;case Cp:a=he.BC4RSnorm;break;case eh:a=he.BC5RGUnorm;break;case Rp:a=he.BC5RGSnorm;break;case Sp:a=o===Bt?he.BC7RGBAUnormSRGB:he.BC7RGBAUnorm;break;case Tp:a=he.BC6HRGBFloat;break;case Ep:a=he.BC6HRGBUFloat;break;case sp:case rp:a=o===Bt?he.ETC2RGB8UnormSRGB:he.ETC2RGB8Unorm;break;case op:a=o===Bt?he.ETC2RGBA8UnormSRGB:he.ETC2RGBA8Unorm;break;case ap:a=he.EACR11Unorm;break;case lp:a=he.EACR11Snorm;break;case Ju:a=he.EACRG11Unorm;break;case cp:a=he.EACRG11Snorm;break;case up:a=o===Bt?he.ASTC4x4UnormSRGB:he.ASTC4x4Unorm;break;case hp:a=o===Bt?he.ASTC5x4UnormSRGB:he.ASTC5x4Unorm;break;case fp:a=o===Bt?he.ASTC5x5UnormSRGB:he.ASTC5x5Unorm;break;case dp:a=o===Bt?he.ASTC6x5UnormSRGB:he.ASTC6x5Unorm;break;case pp:a=o===Bt?he.ASTC6x6UnormSRGB:he.ASTC6x6Unorm;break;case Ap:a=o===Bt?he.ASTC8x5UnormSRGB:he.ASTC8x5Unorm;break;case mp:a=o===Bt?he.ASTC8x6UnormSRGB:he.ASTC8x6Unorm;break;case gp:a=o===Bt?he.ASTC8x8UnormSRGB:he.ASTC8x8Unorm;break;case _p:a=o===Bt?he.ASTC10x5UnormSRGB:he.ASTC10x5Unorm;break;case xp:a=o===Bt?he.ASTC10x6UnormSRGB:he.ASTC10x6Unorm;break;case yp:a=o===Bt?he.ASTC10x8UnormSRGB:he.ASTC10x8Unorm;break;case vp:a=o===Bt?he.ASTC10x10UnormSRGB:he.ASTC10x10Unorm;break;case bp:a=o===Bt?he.ASTC12x10UnormSRGB:he.ASTC12x10Unorm;break;case wp:a=o===Bt?he.ASTC12x12UnormSRGB:he.ASTC12x12Unorm;break;case xr:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case xr:switch(n){case Wu:a=he.RGBA8Snorm;break;case ju:a=l?he.RGBA16Snorm:he.RGBA16Sint;break;case Ha:a=l?he.RGBA16Unorm:he.RGBA16Uint;break;case pi:a=he.RGBA32Uint;break;case Ir:a=he.RGBA32Sint;break;case Gi:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;case Li:a=he.RGBA16Float;break;case Yi:a=he.RGBA32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Nf:switch(n){case NA:a=he.RGB9E5UFloat;break;case LA:a=he.RG11B10UFloat;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Lf:switch(n){case Wu:a=he.R8Snorm;break;case ju:a=l?he.R16Snorm:he.R16Sint;break;case Ha:a=l?he.R16Unorm:he.R16Uint;break;case pi:a=he.R32Uint;break;case Ir:a=he.R32Sint;break;case Gi:a=he.R8Unorm;break;case Li:a=he.R16Float;break;case Yi:a=he.R32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case ws:switch(n){case Wu:a=he.RG8Snorm;break;case ju:a=l?he.RG16Snorm:he.RG16Sint;break;case Ha:a=l?he.RG16Unorm:he.RG16Uint;break;case pi:a=he.RG32Uint;break;case Ir:a=he.RG32Sint;break;case Gi:a=he.RG8Unorm;break;case Li:a=he.RG16Float;break;case Yi:a=he.RG32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case xs:switch(n){case Ha:a=he.Depth16Unorm;break;case pi:a=he.Depth24Plus;break;case Yi:a=he.Depth32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case Qs:switch(n){case Go:a=he.Depth24PlusStencil8;break;case Yi:e&&e.features.has(pC.Depth32FloatStencil8)===!1&&Ge('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=he.Depth32FloatStencil8;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case Xu:switch(n){case Ir:a=he.R32Sint;break;case pi:a=he.R32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case $u:switch(n){case Ir:a=he.RG32Sint;break;case pi:a=he.RG32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case ip:switch(n){case Ir:a=he.RGBA32Sint;break;case pi:a=he.RGBA32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}return a}var FTe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,OTe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,gK={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},BTe=i=>{i=i.trim();let e=i.match(FTe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=OTe.exec(t))!==null;)n.push({name:r[1],type:r[2]});let s=[];for(let u=0;u<n.length;u++){let{name:f,type:p}=n[u],x=p;x.startsWith("ptr")?x="pointer":(x.startsWith("texture")&&(x=p.split("<")[0]),x=gK[x]),s.push(new hb(x,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:gK[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},VB=class extends db{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=BTe(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){let t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},qB=class extends eC{parseFunction(e){return new VB(e)}},UTe={[So.READ_ONLY]:"read",[So.WRITE_ONLY]:"write",[So.READ_WRITE]:"read_write"},_K={[Sf]:"repeat",[Uo]:"clamp",[Tf]:"mirror"},g8={vertex:Ch.VERTEX,fragment:Ch.FRAGMENT,compute:Ch.COMPUTE},xK={instance:!0,swizzleAssign:!1,storageBuffer:!0},kTe={"^^":"tsl_xor"},GTe={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},yK={},Dv={tsl_xor:new Zi("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Zi("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Zi("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Zi("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Zi("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Zi("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Zi("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Zi("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new Zi("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new Zi("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Zi("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new Zi("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Zi(`4443+`;this.mipmapSampler=e.createSampler({minFilter:ac.Linear}),this.flipYSampler=e.createSampler({minFilter:ac.Nearest}),Hp.size=4,Hp.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(Hp),Hp.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),Hp.size=4,Hp.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(Hp),Hp.reset(),this.transferPipelines={},YE.label="mipmap",YE.code=t,this.mipmapShaderModule=e.createShaderModule(YE),YE.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(l1.label=`mipmap-${e}-${t}`,l1.vertex={module:this.mipmapShaderModule},l1.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},l1.layout="auto",r=this.device.createRenderPipeline(l1),l1.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;c1.size.width=s,c1.size.height=o,c1.format=r,c1.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(c1);c1.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder($E),f=(p,x,v,w,S,T)=>{let P=p.getBindGroupLayout(0);Kr.dimension=x.textureBindingViewDimension||"2d-array",Kr.mipLevelCount=1;let R=x.createView(Kr);Kr.reset(),qp.layout=P,qp.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:R},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let C=this.device.createBindGroup(qp);qp.reset(),Kr.dimension="2d",Kr.mipLevelCount=1,Kr.baseArrayLayer=S,Kr.arrayLayerCount=1;let L=w.createView(Kr);Kr.reset(),Lv.view=L,Lv.loadOp=Ei.Clear,Lv.storeOp=wa.Store,g8.colorAttachments.push(Lv);let D=u.beginRenderPass(g8);g8.reset(),Lv.reset(),D.setPipeline(p),D.setBindGroup(0,C),D.draw(3,1,0,v),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),bh(this.device,u.finish()),a.destroy()}generateMipmaps(e,t=null){let n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t;s===null&&($E.label="mipmapEncoder",s=this.device.createCommandEncoder($E),$E.reset()),this._mipmapRunBundles(s,r),t===null&&bh(this.device,s.finish()),n.layers=r}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){Kr.dimension=t,Kr.baseMipLevel=o-1,Kr.mipLevelCount=1;let l=e.createView(Kr);Kr.reset(),qp.layout=r,qp.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(qp);qp.reset(),Kr.dimension="2d",Kr.baseMipLevel=o,Kr.mipLevelCount=1,Kr.baseArrayLayer=a,Kr.arrayLayerCount=1;let u=e.createView(Kr);Kr.reset();let f=new Tm;f.view=u,f.loadOp=Ei.Clear,f.storeOp=wa.Store;let p=new Em;p.colorAttachments.push(f),m8.colorFormats=[e.format];let x=this.device.createRenderBundleEncoder(m8);m8.reset(),x.setPipeline(n),x.setBindGroup(0,c),x.draw(3,1,0,a),s.push({renderBundles:[x.finish()],passDescriptor:p})}return s}_mipmapRunBundles(e,t){let n=t.length;for(let r=0;r<n;r++){let s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}},OB=class{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},L1=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}},BB=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},UB=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},kB=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},GB=class extends L1{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},xC=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},ZE=new o0,FTe=new Fm,jo=new OB,Zo=new L1,KE=new BB,jf=new UB,QE=new kB,u1=new GB,Wp=new Ab,$o=new xC,OTe={[_2]:"never",[T_]:"less",[x2]:"equal",[th]:"less-equal",[kA]:"greater",[Hc]:"greater-equal",[v2]:"always",[y2]:"not-equal"},BTe=[0,1,3,2,4,5];function _Z(i,e,t,n,r,s,o,a,l,c){Zo.texture=e,Zo.mipLevel=t,Zo.origin.z=n,jf.offset=n*s,jf.bytesPerRow=o,jf.rowsPerImage=a,$o.width=l,$o.height=c,i.queue.writeTexture(Zo,r.data,jf,$o),Zo.reset(),jf.reset(),$o.reset()}var zB=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,n=e.texture,r=e.textureNode,s=n.minFilter+"-"+n.magFilter+"-"+n.wrapS+"-"+n.wrapT+"-"+(n.wrapR||"0")+"-"+n.anisotropy+"-"+(n.isDepthTexture===!0?1:0)+"-"+(n.compareFunction!==null&&r.compareNode!==null?n.compareFunction:0),o=this._samplerCache.get(s);if(o===void 0){jo.addressModeU=this._convertAddressMode(n.wrapS),jo.addressModeV=this._convertAddressMode(n.wrapT),jo.addressModeW=this._convertAddressMode(n.wrapR),jo.magFilter=this._convertFilterMode(n.magFilter),jo.minFilter=this._convertFilterMode(n.minFilter),jo.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(jo.magFilter=ac.Nearest,jo.minFilter=ac.Nearest,jo.mipmapFilter=ac.Nearest),jo.magFilter===ac.Linear&&jo.minFilter===ac.Linear&&jo.mipmapFilter===ac.Linear&&(jo.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Df.TEXTURE_COMPARE)&&(jo.compare=OTe[n.compareFunction]);let l=t.device.createSampler(jo);jo.reset(),o={sampler:l,usedTimes:0},this._samplerCache.set(s,o)}let a=t.get(e);return a.sampler!==o.sampler&&(this._releaseSampler(a),a.samplerKey=s,a.sampler=o.sampler,o.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,n=VB(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){let n=this.backend,r=n.get(e);if(r.initialized){if(r.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let c=this._getDimension(e),u=e.internalFormat||t.format||VB(e,n.device);r.format=u;let{samples:f,primarySamples:p,isMSAA:x}=n.utils.getTextureSampleData(e),v=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(v|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==he.RGB9E5UFloat&&(v|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new Ab;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=p,w.dimension=c,w.format=u,w.usage=v,u===void 0){je("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=bo.Cube);try{r.texture=n.device.createTexture(w)}catch{je("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(x){let S=Object.assign({},w);S.label=S.label+"-msaa",S.sampleCount=f,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=w}destroyTexture(e,t=!1){let n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){let n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),Wp.label="colorBuffer",Wp.size.width=n,Wp.size.height=r,Wp.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Wp.format=e.utils.getPreferredCanvasFormat(),Wp.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(Wp),Wp.reset(),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){let n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;let c=n.get(l).texture,u,f;if(t?(u=Qs,f=n.renderer.reversedDepthBuffer===!0?Yi:zo):e&&(u=ys,f=n.renderer.reversedDepthBuffer===!0?Yi:pi),c!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===u&&l.type===f&&l.samples===a)return c;this.destroyTexture(l)}return l.name="depthBuffer",l.format=u,l.type=f,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){let n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let o of e.layerUpdates)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);e.clearLayerUpdates()}else for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(e.isHTMLTexture){let o=this.backend.device,a=this.backend.renderer.domElement,l=e.image;if(typeof o.queue.copyElementImageToTexture!="function")return;if(!n.hasPaintCallback){n.hasPaintCallback=!0,a.requestPaint();return}let c=s.size.width,u=s.size.height;o.queue.copyElementImageToTexture.length===2?o.queue.copyElementImageToTexture({source:l},{destination:{texture:n.texture},width:c,height:u}):o.queue.copyElementImageToTexture(l,c,u,{texture:n.texture}),e.flipY&&this._flipY(n.texture,s)}else if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){let a=this.backend.device,l=this.backend.get(e),c=l.texture,u=l.textureDescriptorGPU.format,f=this._getBytesPerTexel(u),p=r*f;p=Math.ceil(p/256)*256,ZE.size=(s-1)*p+r*f,ZE.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let x=a.createBuffer(ZE);ZE.reset();let v=a.createCommandEncoder(FTe);Zo.texture=c,Zo.origin.x=t,Zo.origin.y=n,Zo.origin.z=o,KE.buffer=x,KE.bytesPerRow=p,$o.width=r,$o.height=s,v.copyTextureToBuffer(Zo,KE,$o),Zo.reset(),KE.reset(),$o.reset();let w=this._getTypedArrayType(u);bh(a,v.finish()),await x.mapAsync(GPUMapMode.READ);let S=x.getMappedRange().slice();return x.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new bs;n.minFilter=xi,n.magFilter=xi,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let n=new Uu;n.minFilter=xi,n.magFilter=xi,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){let r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){let a=r[o],l=e.flipY===!0?BTe[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let c=0;c<s.length;c++){let f=s[c].images[o];f.isDataTexture?this._copyBufferToTexture(f.image,t,n,l,e.flipY,0,c+1):this._copyImageToTexture(f,t,n,l,e.flipY,e.premultiplyAlpha,c+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){let l=this.backend.device,c=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;QE.source=e,QE.flipY=s,u1.texture=t,u1.mipLevel=a,u1.origin.z=r,u1.premultipliedAlpha=o,$o.width=c,$o.height=u;try{l.queue.copyExternalImageToTexture(QE,u1,$o)}catch{}finally{QE.reset(),u1.reset(),$o.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new FB(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){let l=this.backend.device,c=e.data,u=this._getBytesPerTexel(n.format),f=e.width*u;Zo.texture=t,Zo.mipLevel=a,Zo.origin.z=r,jf.offset=e.width*e.height*u*o,jf.bytesPerRow=f,$o.width=e.width,$o.height=e.height,l.queue.writeTexture(Zo,c,jf,$o),Zo.reset(),jf.reset(),$o.reset(),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n,r=null){let s=this.backend.device,o=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1,l=r&&r.size>0?r:null;for(let c=0;c<e.length;c++){let u=e[c],f=u.width,p=u.height,x=a?n.size.depthOrArrayLayers:1,v=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(p/o.height),S=v*w,T=Math.ceil(f/o.width)*o.width,P=w*o.height;if(l!==null)for(let R of l)_Z(s,t,c,R,u,S,v,w,T,P);else for(let R=0;R<x;R++)_Z(s,t,c,R,u,S,v,w,T,P)}}_getBlockData(e){if(e===he.BC1RGBAUnorm||e===he.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.BC2RGBAUnorm||e===he.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.BC3RGBAUnorm||e===he.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.BC4RUnorm||e===he.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===he.BC5RGUnorm||e===he.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===he.BC6HRGBUFloat||e===he.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===he.BC7RGBAUnorm||e===he.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.ETC2RGB8Unorm||e===he.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.ETC2RGB8A1Unorm||e===he.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.ETC2RGBA8Unorm||e===he.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===he.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===he.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===he.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===he.ASTC4x4Unorm||e===he.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.ASTC5x4Unorm||e===he.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===he.ASTC5x5Unorm||e===he.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===he.ASTC6x5Unorm||e===he.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===he.ASTC6x6Unorm||e===he.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===he.ASTC8x5Unorm||e===he.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===he.ASTC8x6Unorm||e===he.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===he.ASTC8x8Unorm||e===he.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===he.ASTC10x5Unorm||e===he.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===he.ASTC10x6Unorm||e===he.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===he.ASTC10x8Unorm||e===he.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===he.ASTC10x10Unorm||e===he.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===he.ASTC12x10Unorm||e===he.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===he.ASTC12x12Unorm||e===he.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=f8.ClampToEdge;return e===Sf?t=f8.Repeat:e===Tf&&(t=f8.MirrorRepeat),t}_convertFilterMode(e){let t=ac.Linear;return(e===xi||e===A2||e===Jl)&&(t=ac.Nearest),t}_convertMipmapFilterMode(e){return e===Jl||e===go?ac.Linear:ac.Nearest}_getBytesPerTexel(e){if(e===he.R8Unorm||e===he.R8Snorm||e===he.R8Uint||e===he.R8Sint)return 1;if(e===he.R16Uint||e===he.R16Sint||e===he.R16Float||e===he.RG8Unorm||e===he.RG8Snorm||e===he.RG8Uint||e===he.RG8Sint||e===he.R16Unorm||e===he.R16Snorm)return 2;if(e===he.R32Uint||e===he.R32Sint||e===he.R32Float||e===he.RG16Uint||e===he.RG16Sint||e===he.RG16Float||e===he.RGBA8Unorm||e===he.RGBA8UnormSRGB||e===he.RGBA8Snorm||e===he.RGBA8Uint||e===he.RGBA8Sint||e===he.BGRA8Unorm||e===he.BGRA8UnormSRGB||e===he.RG16Unorm||e===he.RG16Snorm||e===he.RGB9E5UFloat||e===he.RGB10A2Unorm||e===he.RG11B10UFloat||e===he.Depth32Float||e===he.Depth24Plus||e===he.Depth24PlusStencil8||e===he.Depth32FloatStencil8)return 4;if(e===he.RG32Uint||e===he.RG32Sint||e===he.RG32Float||e===he.RGBA16Uint||e===he.RGBA16Sint||e===he.RGBA16Float||e===he.RGBA16Unorm||e===he.RGBA16Snorm)return 8;if(e===he.RGBA32Uint||e===he.RGBA32Sint||e===he.RGBA32Float)return 16}_getTypedArrayType(e){if(e===he.R8Uint)return Uint8Array;if(e===he.R8Sint)return Int8Array;if(e===he.R8Unorm)return Uint8Array;if(e===he.R8Snorm)return Int8Array;if(e===he.RG8Uint)return Uint8Array;if(e===he.RG8Sint)return Int8Array;if(e===he.RG8Unorm)return Uint8Array;if(e===he.RG8Snorm)return Int8Array;if(e===he.RGBA8Uint)return Uint8Array;if(e===he.RGBA8Sint)return Int8Array;if(e===he.RGBA8Unorm||e===he.RGBA8UnormSRGB)return Uint8Array;if(e===he.RGBA8Snorm)return Int8Array;if(e===he.R16Uint)return Uint16Array;if(e===he.R16Sint)return Int16Array;if(e===he.RG16Uint)return Uint16Array;if(e===he.RG16Sint)return Int16Array;if(e===he.RGBA16Uint)return Uint16Array;if(e===he.RGBA16Sint)return Int16Array;if(e===he.R16Float||e===he.RG16Float||e===he.RGBA16Float||e===he.R16Unorm)return Uint16Array;if(e===he.R16Snorm)return Int16Array;if(e===he.RG16Unorm)return Uint16Array;if(e===he.RG16Snorm)return Int16Array;if(e===he.RGBA16Unorm)return Uint16Array;if(e===he.RGBA16Snorm)return Int16Array;if(e===he.R32Uint)return Uint32Array;if(e===he.R32Sint)return Int32Array;if(e===he.R32Float)return Float32Array;if(e===he.RG32Uint)return Uint32Array;if(e===he.RG32Sint)return Int32Array;if(e===he.RG32Float)return Float32Array;if(e===he.RGBA32Uint)return Uint32Array;if(e===he.RGBA32Sint)return Int32Array;if(e===he.RGBA32Float)return Float32Array;if(e===he.BGRA8Unorm||e===he.BGRA8UnormSRGB)return Uint8Array;if(e===he.RGB10A2Unorm||e===he.RGB9E5UFloat||e===he.RG11B10UFloat)return Uint32Array;if(e===he.Depth32Float)return Float32Array;if(e===he.Depth24Plus||e===he.Depth24PlusStencil8)return Uint32Array;if(e===he.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=mZ.ThreeD:t=mZ.TwoD,t}};function VB(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=sn.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(pC.TextureFormatsTier1),l===!1&&je("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Yu:case Zu:a=o===Bt?he.BC1RGBAUnormSRGB:he.BC1RGBAUnorm;break;case Ku:a=o===Bt?he.BC2RGBAUnormSRGB:he.BC2RGBAUnorm;break;case Qu:a=o===Bt?he.BC3RGBAUnormSRGB:he.BC3RGBAUnorm;break;case Mp:a=he.BC4RUnorm;break;case Cp:a=he.BC4RSnorm;break;case eh:a=he.BC5RGUnorm;break;case Rp:a=he.BC5RGSnorm;break;case Sp:a=o===Bt?he.BC7RGBAUnormSRGB:he.BC7RGBAUnorm;break;case Tp:a=he.BC6HRGBFloat;break;case Ep:a=he.BC6HRGBUFloat;break;case sp:case rp:a=o===Bt?he.ETC2RGB8UnormSRGB:he.ETC2RGB8Unorm;break;case op:a=o===Bt?he.ETC2RGBA8UnormSRGB:he.ETC2RGBA8Unorm;break;case ap:a=he.EACR11Unorm;break;case lp:a=he.EACR11Snorm;break;case Ju:a=he.EACRG11Unorm;break;case cp:a=he.EACRG11Snorm;break;case up:a=o===Bt?he.ASTC4x4UnormSRGB:he.ASTC4x4Unorm;break;case hp:a=o===Bt?he.ASTC5x4UnormSRGB:he.ASTC5x4Unorm;break;case fp:a=o===Bt?he.ASTC5x5UnormSRGB:he.ASTC5x5Unorm;break;case dp:a=o===Bt?he.ASTC6x5UnormSRGB:he.ASTC6x5Unorm;break;case pp:a=o===Bt?he.ASTC6x6UnormSRGB:he.ASTC6x6Unorm;break;case Ap:a=o===Bt?he.ASTC8x5UnormSRGB:he.ASTC8x5Unorm;break;case mp:a=o===Bt?he.ASTC8x6UnormSRGB:he.ASTC8x6Unorm;break;case gp:a=o===Bt?he.ASTC8x8UnormSRGB:he.ASTC8x8Unorm;break;case _p:a=o===Bt?he.ASTC10x5UnormSRGB:he.ASTC10x5Unorm;break;case xp:a=o===Bt?he.ASTC10x6UnormSRGB:he.ASTC10x6Unorm;break;case yp:a=o===Bt?he.ASTC10x8UnormSRGB:he.ASTC10x8Unorm;break;case vp:a=o===Bt?he.ASTC10x10UnormSRGB:he.ASTC10x10Unorm;break;case bp:a=o===Bt?he.ASTC12x10UnormSRGB:he.ASTC12x10Unorm;break;case wp:a=o===Bt?he.ASTC12x12UnormSRGB:he.ASTC12x12Unorm;break;case xr:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case xr:switch(n){case Wu:a=he.RGBA8Snorm;break;case ju:a=l?he.RGBA16Snorm:he.RGBA16Sint;break;case Wa:a=l?he.RGBA16Unorm:he.RGBA16Uint;break;case pi:a=he.RGBA32Uint;break;case Ir:a=he.RGBA32Sint;break;case Gi:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;case Li:a=he.RGBA16Float;break;case Yi:a=he.RGBA32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Nf:switch(n){case LA:a=he.RGB9E5UFloat;break;case DA:a=he.RG11B10UFloat;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Lf:switch(n){case Wu:a=he.R8Snorm;break;case ju:a=l?he.R16Snorm:he.R16Sint;break;case Wa:a=l?he.R16Unorm:he.R16Uint;break;case pi:a=he.R32Uint;break;case Ir:a=he.R32Sint;break;case Gi:a=he.R8Unorm;break;case Li:a=he.R16Float;break;case Yi:a=he.R32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Ss:switch(n){case Wu:a=he.RG8Snorm;break;case ju:a=l?he.RG16Snorm:he.RG16Sint;break;case Wa:a=l?he.RG16Unorm:he.RG16Uint;break;case pi:a=he.RG32Uint;break;case Ir:a=he.RG32Sint;break;case Gi:a=he.RG8Unorm;break;case Li:a=he.RG16Float;break;case Yi:a=he.RG32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case ys:switch(n){case Wa:a=he.Depth16Unorm;break;case pi:a=he.Depth24Plus;break;case Yi:a=he.Depth32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case Qs:switch(n){case zo:a=he.Depth24PlusStencil8;break;case Yi:e&&e.features.has(pC.Depth32FloatStencil8)===!1&&Ge('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=he.Depth32FloatStencil8;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case Xu:switch(n){case Ir:a=he.R32Sint;break;case pi:a=he.R32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case $u:switch(n){case Ir:a=he.RG32Sint;break;case pi:a=he.RG32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case ip:switch(n){case Ir:a=he.RGBA32Sint;break;case pi:a=he.RGBA32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}return a}var UTe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,kTe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,xZ={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},GTe=i=>{i=i.trim();let e=i.match(UTe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=kTe.exec(t))!==null;)n.push({name:r[1],type:r[2]});let s=[];for(let u=0;u<n.length;u++){let{name:f,type:p}=n[u],x=p;x.startsWith("ptr")?x="pointer":(x.startsWith("texture")&&(x=p.split("<")[0]),x=xZ[x]),s.push(new hb(x,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:xZ[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},qB=class extends db{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=GTe(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){let t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},HB=class extends eC{parseFunction(e){return new qB(e)}},zTe={[So.READ_ONLY]:"read",[So.WRITE_ONLY]:"write",[So.READ_WRITE]:"read_write"},yZ={[Sf]:"repeat",[ko]:"clamp",[Tf]:"mirror"},_8={vertex:Ch.VERTEX,fragment:Ch.FRAGMENT,compute:Ch.COMPUTE},vZ={instance:!0,swizzleAssign:!1,storageBuffer:!0},VTe={"^^":"tsl_xor"},qTe={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},bZ={},Dv={tsl_xor:new Ki("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Ki("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Ki("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Ki("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Ki("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Ki("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Ki("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Ki("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new Ki("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new Ki("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Ki("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new Ki("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Ki(`44444444 fn tsl_inverse_mat2( m : mat2x2<f32> ) -> mat2x2<f32> {44454445 44464446 let det = m[ 0 ][ 0 ] * m[ 1 ][ 1 ] - m[ 0 ][ 1 ] * m[ 1 ][ 0 ];
@@ -4451,7 +4451,7 @@ fn tsl_inverse_mat2( m : mat2x2<f32> ) -> mat2x2<f32> {
44514451 ) * ( 1.0 / det );44524452 44534453 }4454-`),inverse_mat3:new Zi(`4454+`),inverse_mat3:new Ki(`44554455 fn tsl_inverse_mat3( m : mat3x3<f32> ) -> mat3x3<f32> {44564456 44574457 let a00 = m[ 0 ][ 0 ]; let a01 = m[ 0 ][ 1 ]; let a02 = m[ 0 ][ 2 ];
@@ -4471,7 +4471,7 @@ fn tsl_inverse_mat3( m : mat3x3<f32> ) -> mat3x3<f32> {
44714471 ) * ( 1.0 / det );44724472 44734473 }4474-`),inverse_mat4:new Zi(`4474+`),inverse_mat4:new Ki(`44754475 fn tsl_inverse_mat4( m : mat4x4<f32> ) -> mat4x4<f32> {44764476 44774477 let a00 = m[ 0 ][ 0 ]; let a01 = m[ 0 ][ 1 ]; let a02 = m[ 0 ][ 2 ]; let a03 = m[ 0 ][ 3 ];
@@ -4514,7 +4514,7 @@ fn tsl_inverse_mat4( m : mat4x4<f32> ) -> mat4x4<f32> {
45144514 ) * ( 1.0 / det );45154515 45164516 }4517-`),biquadraticTexture:new Zi(`4517+`),biquadraticTexture:new Ki(`45184518 fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {45194519 45204520 let res = vec2f( iRes );
@@ -4536,7 +4536,7 @@ fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, l
45364536 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );45374537 45384538 }4539-`),biquadraticTextureArray:new Zi(`4539+`),biquadraticTextureArray:new Ki(`45404540 fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f {45414541 45424542 let res = vec2f( iRes );
@@ -4558,17 +4558,17 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
45584558 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );45594559 45604560 }4561-`)},zTe={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},Nee="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Nee+=`diagnostic( off, derivative_uniformity );4562-`);var HB=class extends QM{constructor(e,t){super(e,t,new qB),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){let t=`tsl_coord_${_K[e.wrapS]}S_${_K[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=yK[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {4561+`)},HTe={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},Dee="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Dee+=`diagnostic( off, derivative_uniformity );4562+`);var WB=class extends QM{constructor(e,t){super(e,t,new HB),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){let t=`tsl_coord_${yZ[e.wrapS]}S_${yZ[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=bZ[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {45634563 45644564 return ${s}(4565-`,a=(l,c)=>{l===Sf?(r.push(Dv.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===Uo?(r.push(Dv.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Tf?(r.push(Dv.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,je(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,4565+`,a=(l,c)=>{l===Sf?(r.push(Dv.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===ko?(r.push(Dv.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Tf?(r.push(Dv.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,je(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,45664566 `,a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(o+=`,45674567 `,a(e.wrapR,"z")),o+=`45684568 );45694569 45704570 }4571-`,yK[t]=n=new Zi(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){let r=this.getDataFromNode(e,this.shaderStage,this.cache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a,{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),c=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",c||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new v1(new w1(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new v1(new w1(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new v1(new w1("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);let x=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${x}( ${o} ) )`}let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),c=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u=c==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${c}<f32>(${s}) / ${c}<f32>( ${l} )`);let f=`${c}<f32>( 0 )`,p=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${p} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(Df.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===Yi||this.isSampleCompare(e)===!1&&e.minFilter===xi&&e.magFilter===xi||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;Ge(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;Ge(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o){let a=e.isDepthTexture===!0?"":`${r}, `;return s?o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s} )`:o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n})`}generateTextureGatherCompare(e,t,n,r,s,o){return s?o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r})`:o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r})`}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;Ge(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=kTe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(je("WebGPURenderer: Atomic operations are only supported in compute shaders."),So.READ_WRITE):So.READ_ONLY:e.access}getStorageAccess(e,t){return UTe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a,l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let f=null,p=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new pb(s.name,s.node,l,p):f=new N1(s.name,s.node,l,p):t==="cubeTexture"||t==="cubeDepthTexture"?f=new cC(s.name,s.node,l,p):t==="texture3D"&&(f=new pb(s.name,s.node,l,p)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(g8[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let v=new RB(`${s.name}_sampler`,s.node,l);v.setVisibility(g8[n]),u.push(v,f),a=[v,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),p=f.buffer;if(p===void 0){let x=t==="buffer"?oC:IB;p=new x(e,l),f.buffer=p}p.setVisibility(p.getVisibility()|g8[n]),u.push(p),a=p,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new aC(c,l),f.setVisibility(Ch.VERTEX|Ch.FRAGMENT|Ch.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let p=a.name;f.uniforms.some(v=>v.name===p)||f.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){let s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {4571+`,bZ[t]=n=new Ki(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){let r=this.getDataFromNode(e,this.shaderStage,this.cache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a,{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),c=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",c||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new v1(new w1(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new v1(new w1(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new v1(new w1("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);let x=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${x}( ${o} ) )`}let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),c=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u=c==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${c}<f32>(${s}) / ${c}<f32>( ${l} )`);let f=`${c}<f32>( 0 )`,p=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${p} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(Df.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===Yi||this.isSampleCompare(e)===!1&&e.minFilter===xi&&e.magFilter===xi||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;Ge(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;Ge(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o){let a=e.isDepthTexture===!0?"":`${r}, `;return s?o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s} )`:o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n})`}generateTextureGatherCompare(e,t,n,r,s,o){return s?o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r})`:o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r})`}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;Ge(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=VTe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(je("WebGPURenderer: Atomic operations are only supported in compute shaders."),So.READ_WRITE):So.READ_ONLY:e.access}getStorageAccess(e,t){return zTe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a,l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let f=null,p=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new pb(s.name,s.node,l,p):f=new N1(s.name,s.node,l,p):t==="cubeTexture"||t==="cubeDepthTexture"?f=new cC(s.name,s.node,l,p):t==="texture3D"&&(f=new pb(s.name,s.node,l,p)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(_8[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let v=new PB(`${s.name}_sampler`,s.node,l);v.setVisibility(_8[n]),u.push(v,f),a=[v,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),p=f.buffer;if(p===void 0){let x=t==="buffer"?oC:NB;p=new x(e,l),f.buffer=p}p.setVisibility(p.getVisibility()|_8[n]),u.push(p),a=p,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new aC(c,l),f.setVisibility(Ch.VERTEX|Ch.FRAGMENT|Ch.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let p=a.name;f.uniforms.some(v=>v.name===p)||f.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){let s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {45724572 ${n.vars}45734573 ${n.code}45744574 `;return n.result&&(s+=` return ${n.result};
@@ -4590,7 +4590,7 @@ ${n.code}
45904590 ${r.join(`45914591 `)}45924592 `}getVaryings(e){let t=[];if(e==="vertex"&&this.getBuiltin("position","builtinClipSpace","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){let s=this.varyings,o=this.vars[e],a=0;for(let l=0;l<s.length;l++){let c=s[l];if(c.needsInterpolation){let u=`@location( ${a++} )`;if(c.interpolationType){let f=c.interpolationSampling!==null?`, ${c.interpolationSampling} )`:" )";u+=` @interpolate( ${c.interpolationType}${f}`}else/^(int|uint|ivec|uvec)/.test(c.type)&&(u+=" @interpolate(flat, either)");t.push(`${u} ${c.name} : ${this.getType(c.type)}`)}else e==="vertex"&&o.includes(c)===!1&&o.push(c)}}let n=this.getBuiltins(e);n&&t.push(n);let r=t.join(`,4593- `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){let t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){let t=this.renderer.backend,n=this.uniforms[e],r=[],s=[],o=[],a={};for(let c of n){let u=c.groupNode.name,f=this.bindingsIndexes[u];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){let p=c.node,x=p.value;(x.isCubeTexture===!0||this.isUnfilterable(x)===!1&&p.isStorageTextureNode!==!0||p.gatherNode!==null)&&(this.isSampleCompare(x)&&p.compareNode!==null?r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler_comparison;`):r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler;`));let w,S="",{primarySamples:T}=t.utils.getTextureSampleData(x);if(T>1&&(S="_multisampled"),x.isCubeTexture===!0&&x.isDepthTexture===!0)w="texture_depth_cube";else if(x.isCubeTexture===!0)w="texture_cube<f32>";else if(x.isDepthTexture===!0)t.compatibilityMode&&x.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${x.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let P=zB(x,t.device),R=this.getStorageAccess(c.node,e),C=c.node.value.is3DTexture,L=c.node.value.isArrayTexture;w=`texture_storage_${C?"3d":`2d${L?"_array":""}`}<${P}, ${R}>`}else if(x.isArrayTexture===!0||x.isDataArrayTexture===!0||x.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(x.is3DTexture===!0||x.isData3DTexture===!0)w="texture_3d<f32>";else{let P=this.getComponentTypeFromTexture(x).charAt(0);w=`texture${S}_2d<${P}32>`}r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name} : ${w};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){let p=c.node,x=this.getType(p.getNodeType(this)),v=p.bufferCount,w=v>0&&c.type==="buffer"?", "+v:"",S=p.isStorageBufferNode?`storage, ${this.getStorageAccess(p,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${x};`);else{let P=` value : array< ${p.isAtomic?`atomic<${x}>`:`${x}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,P,S,f.binding++,f.group))}}else{let p=c.groupNode.name;if(a[p]===void 0){let x=this.uniformGroups[p];if(x!==void 0){let v=[];for(let S of x.uniforms){let T=S.getType(),P=this.getType(this.getVectorType(T));v.push(` ${S.name} : ${P}`)}let w=this.uniformGroupsBindings[p];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[p]=w),a[p]={index:w.index,id:w.id,snippets:v}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,4593+ `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){let t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){let t=this.renderer.backend,n=this.uniforms[e],r=[],s=[],o=[],a={};for(let c of n){let u=c.groupNode.name,f=this.bindingsIndexes[u];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){let p=c.node,x=p.value;(x.isCubeTexture===!0||this.isUnfilterable(x)===!1&&p.isStorageTextureNode!==!0||p.gatherNode!==null)&&(this.isSampleCompare(x)&&p.compareNode!==null?r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler_comparison;`):r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler;`));let w,S="",{primarySamples:T}=t.utils.getTextureSampleData(x);if(T>1&&(S="_multisampled"),x.isCubeTexture===!0&&x.isDepthTexture===!0)w="texture_depth_cube";else if(x.isCubeTexture===!0)w="texture_cube<f32>";else if(x.isDepthTexture===!0)t.compatibilityMode&&x.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${x.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let P=VB(x,t.device),R=this.getStorageAccess(c.node,e),C=c.node.value.is3DTexture,L=c.node.value.isArrayTexture;w=`texture_storage_${C?"3d":`2d${L?"_array":""}`}<${P}, ${R}>`}else if(x.isArrayTexture===!0||x.isDataArrayTexture===!0||x.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(x.is3DTexture===!0||x.isData3DTexture===!0)w="texture_3d<f32>";else{let P=this.getComponentTypeFromTexture(x).charAt(0);w=`texture${S}_2d<${P}32>`}r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name} : ${w};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){let p=c.node,x=this.getType(p.getNodeType(this)),v=p.bufferCount,w=v>0&&c.type==="buffer"?", "+v:"",S=p.isStorageBufferNode?`storage, ${this.getStorageAccess(p,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${x};`);else{let P=` value : array< ${p.isAtomic?`atomic<${x}>`:`${x}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,P,S,f.binding++,f.group))}}else{let p=c.groupNode.name;if(a[p]===void 0){let x=this.uniformGroups[p];if(x!==void 0){let v=[];for(let S of x.uniforms){let T=S.getType(),P=this.getType(this.getVectorType(T));v.push(` ${S.name} : ${P}`)}let w=this.uniformGroupsBindings[p];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[p]=w),a[p]={index:w.index,id:w.id,snippets:v}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,45944594 `),"uniform",u.index,u.id))}return[...r,...s,...o].join(`45954595 `)}buildCode(){let e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(let t in e){this.shaderStage=t;let n=this.allowGlobalVariables,r=e[t];r.uniforms=this.getUniforms(t),r.attributes=this.getAttributes(t),r.varyings=this.getVaryings(t),r.structs=this.getStructs(t),r.vars=this.getVars(t,n),r.codes=this.getCodes(t),r.directives=this.getDirectives(t),r.scopedArrays=this.getScopedArrays(t);let s=`// code45964596
@@ -4603,7 +4603,7 @@ ${n.code}
46034603 `+v),r.returnType="OutputStruct",r.structs+=this._getWGSLStruct("OutputStruct",x),r.structs+=`46044604 var<private> output : OutputStruct;`,s+=`output.color = ${this.format(f.result,a.getNodeType(this),this.getOutputType())};46054605 4606- return output;`}}}r.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return GTe[e]||e}isAvailable(e){let t=xK[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),xK[e]=t),t}_getWGSLMethod(e){return Dv[e]!==void 0&&this._include(e),zTe[e]}_include(e){let t=Dv[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}4606+ return output;`}}}r.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return qTe[e]||e}isAvailable(e){let t=vZ[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),vZ[e]=t),t}_getWGSLMethod(e){return Dv[e]!==void 0&&this._include(e),HTe[e]}_include(e){let t=Dv[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}46074607 // directives46084608 ${e.directives}46094609
@@ -4634,7 +4634,7 @@ fn main( ${e.attributes} ) -> VaryingsStruct {
46344634 }46354635 `}_getWGSLFragmentCode(e){return`${this.getSignature()}46364636 // global4637-${Nee}4637+${Dee}46384638 46394639 // structs46404640 ${e.structs}
@@ -4697,10 +4697,10 @@ struct ${e} {
46974697 ${t}46984698 };`}_getWGSLStructBinding(e,t,n,r=0,s=0){let o=e+"Struct";return`${this._getWGSLStruct(o,t)}46994699 @binding( ${r} ) @group( ${s} )4700-var<${n}> ${e} : ${o};`}},jo=new o0,_8=new Dm,Lee=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&Lee.set(Float16Array,["float16"]);var VTe=new Map([[f_,["float16"]]]),qTe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),WB=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this._getBufferAttribute(e),r=this.backend,s=r.get(n),o=s.buffer;if(o===void 0){let a=r.device,l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let p=0;p<l.length;p++)l[p]===65535&&(l[p]=4294967295)}n.array=l;let c;if((n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3)c=4;else if(n.itemSize>1&&n.itemSize*l.BYTES_PER_ELEMENT%4!==0){let p=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((p+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let p=n.itemSize,x=new l.constructor(n.count*c);for(let v=0;v<n.count;v++)x.set(l.subarray(v*p,v*p+p),v*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=x),l=x,s._itemSize=p,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;jo.label=n.name,jo.size=f,jo.usage=t,jo.mappedAtCreation=!0,o=a.createBuffer(jo),jo.reset(),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){let t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer,a=t.array,l=s._itemSize,c=s._paddedItemSize;if(c!==void 0){a=new a.constructor(t.count*c);for(let f=0;f<t.count;f++)a.set(t.array.subarray(f*l,f*l+l),f*c);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=a)}let u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(o,0,a,0);else{let f=E_(a),p=f?1:a.BYTES_PER_ELEMENT;for(let x=0,v=u.length;x<v;x++){let w=u[x],S,T;if(c!==void 0){let R=Math.floor(w.start/l),C=Math.ceil((w.start+w.count)/l)-R;S=R*c*p,T=C*c*p}else S=w.start*p,T=w.count*p;let P=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,P,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){let s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s),l=n.get(a);if(l===void 0){let f,p;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,p=s.data.isInstancedInterleavedBuffer?XE.Instance:XE.Vertex):(f=s.itemSize*o,p=s.isInstancedBufferAttribute?XE.Instance:XE.Vertex,s.itemSize>1&&f%4!==0&&(f=Math.floor((f+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(f=4),l={arrayStride:f,attributes:[],stepMode:p},n.set(a,l)}let c=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:u,format:c})}return Array.from(n.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,o=s.device,l=s.get(this._getBufferAttribute(e)).buffer,c=r===-1?l.size-n:r,u;if(t!==null&&t.isReadbackBuffer){let x=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,x.readBufferGPU===void 0){jo.label=`${t.name}_readback`,jo.size=t.maxByteLength,jo.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(jo),jo.reset();let v=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",v),t.removeEventListener("dispose",w)};t.addEventListener("release",v),t.addEventListener("dispose",w),x.readBufferGPU=u}else u=x.readBufferGPU}else jo.label=`${e.name}_readback`,jo.size=c,jo.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(jo),jo.reset();_8.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(_8);_8.reset(),f.copyBufferToBuffer(l,n,u,0,c);let p=f.finish();if(bh(o,p),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let v=u.getMappedRange(0,c).slice();return u.destroy(),v}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let x=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(x)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=qTe.get(r);else{let l=(VTe.get(s)||Lee.get(r))[n?1:0];if(l){let c=r.BYTES_PER_ELEMENT*t,f=Math.floor((c+3)/4)*4/r.BYTES_PER_ELEMENT;if(f%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${f}`}}return o||Ge("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},wl=new AC,Fv=new o0,h1=new mb,jB=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},XB=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;let s=this._createLayoutEntries(e),o=F1(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new jB(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){let{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e),l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){let t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{let a=E_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let p=o[u],x=o[u+1],v=p.start+p.count;if(x!==void 0&&x.start===v)continue;let w=c*l,S=(v-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),x!==void 0&&(c=x.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];Fv.label="bindingCameraIndex_"+o,Fv.size=16,Fv.usage=s;let a=r.createBuffer(Fv);Fv.reset(),r.queue.writeBuffer(a,0,e,0),wl.label="bindGroupCameraIndex_"+o,wl.layout=t,wl.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(wl);return wl.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;wl.label="bindGroup_"+e.name,wl.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);wl.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;wl.entries.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){let l=n.get(a.texture),c;if(l.externalTexture!==void 0)c=r.importExternalTexture({source:l.externalTexture});else{let u=a.store?1:l.texture.mipLevelCount,f=a.store?a.mipLevel:0,p=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(p+=`-${l.texture.depthOrArrayLayers}`),p+=`-${u}-${f}`,c=l[p],c===void 0){let x=PTe.All,v;a.isSampledCubeTexture?v=bo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?v=bo.TwoDArray:a.isSampledTexture3D?v=bo.ThreeD:v=bo.TwoD,h1.aspect=x,h1.dimension=v,h1.mipLevelCount=u,h1.baseMipLevel=f,c=l[p]=l.texture.createView(h1),h1.reset()}}wl.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);wl.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(wl);return wl.reset(),o}_createLayoutEntries(e){let t=[],n=0;for(let r of e.bindings){let s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){let a={};r.isStorageBuffer&&(r.visibility&Ch.COMPUTE&&(r.access===So.READ_WRITE||r.access===So.WRITE_ONLY)?a.type=f8.Storage:a.type=f8.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){let a={};a.format=this.backend.get(r.texture).texture.format;let l=r.access;l===So.READ_WRITE?a.access=d8.ReadWrite:l===So.WRITE_ONLY?a.access=d8.WriteOnly:a.access=d8.ReadOnly,r.texture.isArrayTexture?a.viewDimension=bo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=bo.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){let a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=hm.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=hm.UnfilterableFloat:a.sampleType=hm.Depth;else{let c=r.texture.type;c===Ir?a.sampleType=hm.SInt:c===pi?a.sampleType=hm.UInt:c===Yi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=hm.Float:a.sampleType=hm.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=bo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=bo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=bo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Df.TEXTURE_COMPARE)?a.type=dK.Comparison:a.type=dK.NonFiltering),o.sampler=a}else Ge(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){let{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},$B=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},YB=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},KB=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Ov=new YB,f1=new KB,d1=new mC,Sl=new gC,ZB=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,c=this.backend,u=c.device,f=c.utils,p=c.get(o),x=[];for(let j of e.getBindings()){let Z=c.get(j),{layoutGPU:ee}=Z.layout;x.push(ee)}let v=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==Xr&&(r.blending!==rs||r.transparent!==!1)&&(w=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});let T=this._getColorWriteMask(r),P=[];if(e.context.textures!==null){let j=e.context.textures,Z=e.context.mrt;for(let ee=0;ee<j.length;ee++){let ae=j[ee],ce=f.getTextureFormatGPU(ae),de;if(Z!==null)if(this.backend.compatibilityMode!==!0){let ve=Z.getBlendMode(ae.name);ve.blending===Zy?de=w:ve.blending!==Xr&&(de=this._getBlending(ve))}else Kn("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),de=w;else de=w;P.push({format:ce,blend:de,writeMask:T})}}else{let j=f.getCurrentColorFormat(e.context);P.push({format:j,blend:w,writeMask:T})}let R=c.get(a).module,C=c.get(l).module,L=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),F=f.getCurrentDepthStencilFormat(e.context),N=this._getSampleCount(e.context);f1.bindGroupLayouts=x;let B=u.createPipelineLayout(f1);f1.reset(),Sl.label=`renderPipeline_${r.name||r.type}_${r.id}`,Sl.vertex=Object.assign({},R,{buffers:v}),Sl.fragment=Object.assign({},C,{targets:P}),Sl.primitive=L,Sl.multisample.count=N,Sl.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&N>1,Sl.layout=B;let z={},V=e.context.depth,H=e.context.stencil;(V===!0||H===!0)&&(V===!0&&(z.format=F,z.depthWriteEnabled=r.depthWrite,z.depthCompare=D),H===!0&&(z.stencilFront=S,z.stencilBack=S,z.stencilReadMask=r.stencilFuncMask,z.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&L.topology===Gv.TriangleList&&(z.depthBias=r.polygonOffsetUnits,z.depthBiasSlopeScale=r.polygonOffsetFactor,z.depthBiasClamp=0),Sl.depthStencil=z),u.pushErrorScope("validation");let K=[{program:a,module:R.module},{program:l,module:C.module}],J=Sl.label;if(t===null)p.pipeline=u.createRenderPipeline(Sl),Sl.reset(),u.popErrorScope().then(j=>{j!==null&&(p.error=!0,Ge(`WebGPURenderer: Render pipeline creation failed (${J}): ${j.message}`),this._reportShaderDiagnostics(K,J))});else{let j=new Promise(async Z=>{try{let ee=null,ae=null;try{ae=u.createRenderPipelineAsync(Sl)}catch(de){ee=de}if(Sl.reset(),ae!==null)try{p.pipeline=await ae}catch(de){ee=de}let ce=await u.popErrorScope();if(ce!==null||ee!==null){p.error=!0;let de=ce&&ce.message||ee&&ee.message||"unknown";Ge(`WebGPURenderer: Async render pipeline creation failed (${J}): ${de}`),await this._reportShaderDiagnostics(K,J)}}finally{Z()}});t.push(j)}}createBundleEncoder(e,t="renderBundleEncoder"){let n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e);d1.label=t,d1.colorFormats=a,d1.depthStencilFormat=o,d1.sampleCount=l;let c=s.createRenderBundleEncoder(d1);return d1.reset(),c}createComputePipeline(e,t){let n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(let f of t){let p=n.get(f),{layoutGPU:x}=p.layout;a.push(x)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),f1.bindGroupLayouts=a;let u=r.createPipelineLayout(f1);f1.reset(),Ov.label=c,Ov.compute=s,Ov.layout=u,o.pipeline=r.createComputePipeline(Ov),Ov.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,Ge(`WebGPURenderer: Compute pipeline creation failed (${c}): ${f.message}`),this._reportShaderDiagnostics([{program:l,module:s.module}],c))})}async _reportShaderDiagnostics(e,t){for(let{program:n,module:r}of e){let s=await r.getCompilationInfo();if(s.messages.length===0)continue;let o=n.code.split(`4700+var<${n}> ${e} : ${o};`}},Xo=new o0,x8=new Fm,Fee=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&Fee.set(Float16Array,["float16"]);var WTe=new Map([[f_,["float16"]]]),jTe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),jB=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this._getBufferAttribute(e),r=this.backend,s=r.get(n),o=s.buffer;if(o===void 0){let a=r.device,l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let p=0;p<l.length;p++)l[p]===65535&&(l[p]=4294967295)}n.array=l;let c;if((n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3)c=4;else if(n.itemSize>1&&n.itemSize*l.BYTES_PER_ELEMENT%4!==0){let p=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((p+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let p=n.itemSize,x=new l.constructor(n.count*c);for(let v=0;v<n.count;v++)x.set(l.subarray(v*p,v*p+p),v*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=x),l=x,s._itemSize=p,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;Xo.label=n.name,Xo.size=f,Xo.usage=t,Xo.mappedAtCreation=!0,o=a.createBuffer(Xo),Xo.reset(),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){let t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer,a=t.array,l=s._itemSize,c=s._paddedItemSize;if(c!==void 0){a=new a.constructor(t.count*c);for(let f=0;f<t.count;f++)a.set(t.array.subarray(f*l,f*l+l),f*c);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=a)}let u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(o,0,a,0);else{let f=E_(a),p=f?1:a.BYTES_PER_ELEMENT;for(let x=0,v=u.length;x<v;x++){let w=u[x],S,T;if(c!==void 0){let R=Math.floor(w.start/l),C=Math.ceil((w.start+w.count)/l)-R;S=R*c*p,T=C*c*p}else S=w.start*p,T=w.count*p;let P=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,P,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){let s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s),l=n.get(a);if(l===void 0){let f,p;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,p=s.data.isInstancedInterleavedBuffer?XE.Instance:XE.Vertex):(f=s.itemSize*o,p=s.isInstancedBufferAttribute?XE.Instance:XE.Vertex,s.itemSize>1&&f%4!==0&&(f=Math.floor((f+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(f=4),l={arrayStride:f,attributes:[],stepMode:p},n.set(a,l)}let c=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:u,format:c})}return Array.from(n.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,o=s.device,l=s.get(this._getBufferAttribute(e)).buffer,c=r===-1?l.size-n:r,u;if(t!==null&&t.isReadbackBuffer){let x=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,x.readBufferGPU===void 0){Xo.label=`${t.name}_readback`,Xo.size=t.maxByteLength,Xo.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Xo),Xo.reset();let v=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",v),t.removeEventListener("dispose",w)};t.addEventListener("release",v),t.addEventListener("dispose",w),x.readBufferGPU=u}else u=x.readBufferGPU}else Xo.label=`${e.name}_readback`,Xo.size=c,Xo.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Xo),Xo.reset();x8.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(x8);x8.reset(),f.copyBufferToBuffer(l,n,u,0,c);let p=f.finish();if(bh(o,p),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let v=u.getMappedRange(0,c).slice();return u.destroy(),v}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let x=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(x)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=jTe.get(r);else{let l=(WTe.get(s)||Fee.get(r))[n?1:0];if(l){let c=r.BYTES_PER_ELEMENT*t,f=Math.floor((c+3)/4)*4/r.BYTES_PER_ELEMENT;if(f%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${f}`}}return o||Ge("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},wl=new AC,Fv=new o0,h1=new mb,XB=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},$B=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;let s=this._createLayoutEntries(e),o=F1(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new XB(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){let{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e),l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){let t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{let a=E_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let p=o[u],x=o[u+1],v=p.start+p.count;if(x!==void 0&&x.start===v)continue;let w=c*l,S=(v-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),x!==void 0&&(c=x.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];Fv.label="bindingCameraIndex_"+o,Fv.size=16,Fv.usage=s;let a=r.createBuffer(Fv);Fv.reset(),r.queue.writeBuffer(a,0,e,0),wl.label="bindGroupCameraIndex_"+o,wl.layout=t,wl.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(wl);return wl.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;wl.label="bindGroup_"+e.name,wl.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);wl.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;wl.entries.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){let l=n.get(a.texture),c;if(l.externalTexture!==void 0)c=r.importExternalTexture({source:l.externalTexture});else{let u=a.store?1:l.texture.mipLevelCount,f=a.store?a.mipLevel:0,p=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(p+=`-${l.texture.depthOrArrayLayers}`),p+=`-${u}-${f}`,c=l[p],c===void 0){let x=LTe.All,v;a.isSampledCubeTexture?v=bo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?v=bo.TwoDArray:a.isSampledTexture3D?v=bo.ThreeD:v=bo.TwoD,h1.aspect=x,h1.dimension=v,h1.mipLevelCount=u,h1.baseMipLevel=f,c=l[p]=l.texture.createView(h1),h1.reset()}}wl.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);wl.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(wl);return wl.reset(),o}_createLayoutEntries(e){let t=[],n=0;for(let r of e.bindings){let s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){let a={};r.isStorageBuffer&&(r.visibility&Ch.COMPUTE&&(r.access===So.READ_WRITE||r.access===So.WRITE_ONLY)?a.type=d8.Storage:a.type=d8.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){let a={};a.format=this.backend.get(r.texture).texture.format;let l=r.access;l===So.READ_WRITE?a.access=p8.ReadWrite:l===So.WRITE_ONLY?a.access=p8.WriteOnly:a.access=p8.ReadOnly,r.texture.isArrayTexture?a.viewDimension=bo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=bo.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){let a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=fm.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=fm.UnfilterableFloat:a.sampleType=fm.Depth;else{let c=r.texture.type;c===Ir?a.sampleType=fm.SInt:c===pi?a.sampleType=fm.UInt:c===Yi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=fm.Float:a.sampleType=fm.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=bo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=bo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=bo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Df.TEXTURE_COMPARE)?a.type=AZ.Comparison:a.type=AZ.NonFiltering),o.sampler=a}else Ge(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){let{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},YB=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},ZB=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},KB=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Ov=new ZB,f1=new KB,d1=new mC,Sl=new gC,QB=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,c=this.backend,u=c.device,f=c.utils,p=c.get(o),x=[];for(let j of e.getBindings()){let K=c.get(j),{layoutGPU:ee}=K.layout;x.push(ee)}let v=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==Xr&&(r.blending!==ss||r.transparent!==!1)&&(w=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});let T=this._getColorWriteMask(r),P=[];if(e.context.textures!==null){let j=e.context.textures,K=e.context.mrt;for(let ee=0;ee<j.length;ee++){let ae=j[ee],ce=f.getTextureFormatGPU(ae),de;if(K!==null)if(this.backend.compatibilityMode!==!0){let ve=K.getBlendMode(ae.name);ve.blending===Ky?de=w:ve.blending!==Xr&&(de=this._getBlending(ve))}else Zn("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),de=w;else de=w;P.push({format:ce,blend:de,writeMask:T})}}else{let j=f.getCurrentColorFormat(e.context);P.push({format:j,blend:w,writeMask:T})}let R=c.get(a).module,C=c.get(l).module,L=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),F=f.getCurrentDepthStencilFormat(e.context),N=this._getSampleCount(e.context);f1.bindGroupLayouts=x;let B=u.createPipelineLayout(f1);f1.reset(),Sl.label=`renderPipeline_${r.name||r.type}_${r.id}`,Sl.vertex=Object.assign({},R,{buffers:v}),Sl.fragment=Object.assign({},C,{targets:P}),Sl.primitive=L,Sl.multisample.count=N,Sl.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&N>1,Sl.layout=B;let z={},V=e.context.depth,H=e.context.stencil;(V===!0||H===!0)&&(V===!0&&(z.format=F,z.depthWriteEnabled=r.depthWrite,z.depthCompare=D),H===!0&&(z.stencilFront=S,z.stencilBack=S,z.stencilReadMask=r.stencilFuncMask,z.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&L.topology===Gv.TriangleList&&(z.depthBias=r.polygonOffsetUnits,z.depthBiasSlopeScale=r.polygonOffsetFactor,z.depthBiasClamp=0),Sl.depthStencil=z),u.pushErrorScope("validation");let Z=[{program:a,module:R.module},{program:l,module:C.module}],J=Sl.label;if(t===null)p.pipeline=u.createRenderPipeline(Sl),Sl.reset(),u.popErrorScope().then(j=>{j!==null&&(p.error=!0,Ge(`WebGPURenderer: Render pipeline creation failed (${J}): ${j.message}`),this._reportShaderDiagnostics(Z,J))});else{let j=new Promise(async K=>{try{let ee=null,ae=null;try{ae=u.createRenderPipelineAsync(Sl)}catch(de){ee=de}if(Sl.reset(),ae!==null)try{p.pipeline=await ae}catch(de){ee=de}let ce=await u.popErrorScope();if(ce!==null||ee!==null){p.error=!0;let de=ce&&ce.message||ee&&ee.message||"unknown";Ge(`WebGPURenderer: Async render pipeline creation failed (${J}): ${de}`),await this._reportShaderDiagnostics(Z,J)}}finally{K()}});t.push(j)}}createBundleEncoder(e,t="renderBundleEncoder"){let n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e);d1.label=t,d1.colorFormats=a,d1.depthStencilFormat=o,d1.sampleCount=l;let c=s.createRenderBundleEncoder(d1);return d1.reset(),c}createComputePipeline(e,t){let n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(let f of t){let p=n.get(f),{layoutGPU:x}=p.layout;a.push(x)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),f1.bindGroupLayouts=a;let u=r.createPipelineLayout(f1);f1.reset(),Ov.label=c,Ov.compute=s,Ov.layout=u,o.pipeline=r.createComputePipeline(Ov),Ov.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,Ge(`WebGPURenderer: Compute pipeline creation failed (${c}): ${f.message}`),this._reportShaderDiagnostics([{program:l,module:s.module}],c))})}async _reportShaderDiagnostics(e,t){for(let{program:n,module:r}of e){let s=await r.getCompilationInfo();if(s.messages.length===0)continue;let o=n.code.split(`47014701 `);for(let a of s.messages){let l=a.lineNum>0?` at line ${a.lineNum}${a.linePos>0?`:${a.linePos}`:""}`:"",c=`WebGPURenderer [${t} / ${n.stage} ${a.type}]${l}: ${a.message}`,u="";a.lineNum>0&&a.lineNum<=o.length&&(u=`47024702 ${o[a.lineNum-1]}`,a.linePos>0&&(u+=`4703- ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?Ge:je)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===If){let l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,c=e.blendDstAlpha!==null?e.blendDstAlpha:o,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(u)}}else{let l=e.premultipliedAlpha,c=(u,f,p,x)=>{t={srcFactor:u,dstFactor:f,operation:um.Add},n={srcFactor:p,dstFactor:x,operation:um.Add}};if(l)switch(r){case rs:c(si.One,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case zu:c(si.One,si.One,si.One,si.One);break;case Vu:c(si.Zero,si.OneMinusSrc,si.Zero,si.One);break;case qu:c(si.Dst,si.OneMinusSrcAlpha,si.Zero,si.One);break}else switch(r){case rs:c(si.SrcAlpha,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case zu:c(si.SrcAlpha,si.One,si.One,si.One);break;case Vu:Ge(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case qu:Ge(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};Ge("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case qc:t=si.Zero;break;case e2:t=si.One;break;case t2:t=si.Src;break;case n2:t=si.OneMinusSrc;break;case Ud:t=si.SrcAlpha;break;case kd:t=si.OneMinusSrcAlpha;break;case s2:t=si.Dst;break;case o2:t=si.OneMinusDst;break;case i2:t=si.DstAlpha;break;case r2:t=si.OneMinusDstAlpha;break;case a2:t=si.SrcAlphaSaturated;break;case C2e:t=si.Constant;break;case R2e:t=si.OneMinusConstant;break;default:Ge("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case sL:t=vo.Never;break;case gy:t=vo.Always;break;case oL:t=vo.Less;break;case lL:t=vo.LessEqual;break;case aL:t=vo.Equal;break;case hL:t=vo.GreaterEqual;break;case cL:t=vo.Greater;break;case uL:t=vo.NotEqual;break;default:Ge("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case yf:t=Vp.Keep;break;case QN:t=Vp.Zero;break;case JN:t=Vp.Replace;break;case rL:t=Vp.Invert;break;case eL:t=Vp.IncrementClamp;break;case tL:t=Vp.DecrementClamp;break;case nL:t=Vp.IncrementWrap;break;case iL:t=Vp.DecrementWrap;break;default:Ge("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Bs:t=um.Add;break;case Qy:t=um.Subtract;break;case Jy:t=um.ReverseSubtract;break;case zT:t=um.Min;break;case VT:t=um.Max;break;default:Ge("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){let r={},s=this.backend.utils;r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?dC.Uint16:dC.Uint32);let o=n.side===ui;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?uK.CW:uK.CCW,r.cullMode=n.side===ir?hK.None:hK.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?fK.All:fK.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=vo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?b2[e.depthFunc]:e.depthFunc;switch(n){case aA:t=vo.Never;break;case lA:t=vo.Always;break;case cA:t=vo.Less;break;case Bu:t=vo.LessEqual;break;case uA:t=vo.Equal;break;case hA:t=vo.GreaterEqual;break;case fA:t=vo.Greater;break;case dA:t=vo.NotEqual;break;default:Ge("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},yC=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},_h=new o0,HTe=new Dm,Bv=new yC,QB=class extends hC{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Bv.label=`queryset_global_timestamp_${t}`,Bv.type="timestamp",Bv.count=this.maxQueries,this.querySet=this.device.createQuerySet(Bv),Bv.reset();let r=this.maxQueries*8;_h.label=`buffer_timestamp_resolve_${t}`,_h.size=r,_h.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(_h),_h.reset(),_h.label=`buffer_timestamp_result_${t}`,_h.size=r,_h.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(_h),_h.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Kn(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let r=this.device.createCommandEncoder(HTe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(bh(this.device,s),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;let o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(let[u,f]of e){let p=u.match(/^(.*):f(\d+)$/),x=parseInt(p[2]);l.includes(x)===!1&&l.push(x),a[x]===void 0&&(a[x]=0);let v=o[f],w=o[f+1],S=Number(w-v)/1e6;this.timestamps.set(u,S),a[x]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return Ge("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){Ge("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){Ge("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},JB=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},_1=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},e7=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},Qc={r:0,g:0,b:0,a:1},Tl=new o0,va=new Dm,JE=new JB,Uv=new yC,eM=new _C,tM=new e7,oc=new L1,xh=new L1,ur=new mb,qf=new xC,t7=class extends uC{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new NB(this),this.attributeUtils=new WB(this),this.bindingUtils=new XB(this),this.capabilities=new $B(this),this.pipelineUtils=new ZB(this),this.textureUtils=new GB(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Df.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,n;if(t.device===void 0){let r={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");let o=Object.values(pC),a=[];for(let c of o)s.features.has(c)&&a.push(c);let l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;let s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),n.onuncapturederror=r=>{let s=r.error,o=s&&s.constructor?s.constructor.name:"GPUError",a=s&&s.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:o,message:a,originalEvent:r})},this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(pC.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,n=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:n,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),n=t.context;if(n===void 0){let r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${"185"} webgpu`);let s=r.alpha?"premultiplied":"opaque",o=r.outputType===Li?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return Va}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples,s=n.descriptor;if(s===void 0||n.samples!==r){if(s=new Tm,s.colorAttachments.push(new Sm),e.depth===!0||e.stencil===!0){let l=new _1;l.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=l}let a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}let o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let n=0;n<t.length;n++)if(this.get(t[n]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let n=[],r=e.camera;if(t.xrViewDescriptors&&r!==null&&r.isArrayCamera===!0)for(let s=0;s<t.xrViewDescriptors.length;s++)n.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else n.push({view:t.texture.createView({dimension:bo.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return n}_getRenderPassDescriptor(e,t={}){let n=e.renderTarget,r=this.get(n),s=this._hasExternalTexture(e),o=r.descriptors;(o===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples||s)&&(o={},r.descriptors=o);let a=e.getCacheKey(),l=o[a];if(l===void 0||s){let u=e.textures,f=[],p,x=this._isRenderCameraDepthArray(e);for(let w=0;w<u.length;w++){let S=this.get(u[w]);if(S.externalTexture===!0){f.push(...this._createExternalTextureViews(e,S));continue}if(ur.label=`colorAttachment_${w}`,ur.baseMipLevel=e.activeMipmapLevel,ur.mipLevelCount=1,ur.baseArrayLayer=e.activeCubeFace,ur.arrayLayerCount=1,ur.dimension=bo.TwoD,n.isRenderTarget3D)p=e.activeCubeFace,ur.baseArrayLayer=0,ur.dimension=bo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(x===!0){let T=e.camera.cameras;for(let P=0;P<T.length;P++){ur.baseArrayLayer=P,ur.arrayLayerCount=1,ur.dimension=bo.TwoD;let R=S.texture.createView(ur);f.push({view:R,resolveTarget:void 0,depthSlice:void 0})}}else ur.dimension=bo.TwoDArray;if(x!==!0){let T=S.texture.createView(ur),P,R;S.msaaTexture!==void 0?(P=S.msaaTexture.createView(),R=T):(P=T,R=void 0),f.push({view:P,resolveTarget:R,depthSlice:p})}ur.reset()}let v=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Sm;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,v.push(T)}if(l={textureViews:f,colorAttachments:v,descriptor:new Tm},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(ur.dimension=bo.TwoD,ur.arrayLayerCount=1,ur.baseArrayLayer=e.activeCubeFace);let S=new _1;S.view=w.texture.createView(ur),l.depthStencilAttachment=S,ur.reset()}o[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}let c=l.descriptor;c.reset();for(let u=0;u<l.colorAttachments.length;u++){let f=l.colorAttachments[u],p={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(p=t.clearValue),f.loadOp=t.loadOp||Ei.Load,f.storeOp=t.storeOp||ba.Store,f.clearValue=p,c.colorAttachments.push(f)}return l.depthStencilAttachment&&(c.depthStencilAttachment=l.depthStencilAttachment),c}beginRender(e){let t=this.get(e),n=this.device,r=e.occlusionQueryCount,s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,Uv.label=`occlusionQuerySet_${e.id}`,Uv.type="occlusion",Uv.count=r,s=n.createQuerySet(Uv),Uv.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Ei.Load}),this.initTimestampQuery(ec.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;let a=o.depthStencilAttachment;if(e.textures!==null){let c=o.colorAttachments;for(let u=0;u<c.length;u++){let f=c[u];e.clearColor?(u===0?f.clearValue=e.clearColorValue:(Qc.r=0,Qc.g=0,Qc.b=0,Qc.a=1,f.clearValue=Qc),f.loadOp=Ei.Clear):f.loadOp=Ei.Load,f.storeOp=ba.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Ei.Clear):c.loadOp=Ei.Load,c.storeOp=ba.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Ei.Clear):a.depthLoadOp=Ei.Load,a.depthStoreOp=ba.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Ei.Clear):a.stencilLoadOp=Ei.Load,a.stencilStoreOp=ba.Store),va.label="renderContext_"+e.id;let l=n.createCommandEncoder(va);if(va.reset(),this._isRenderCameraDepthArray(e)===!0){let c=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==c.length?this._createArrayCameraLayerDescriptors(e,t,o,c):this._updateArrayCameraLayerDescriptors(e,t,c),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u<c.length;u++){let f=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+u),p={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(p)}t.currentPass=null}else{let c=l.beginRenderPass(o);t.currentPass=c,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,n,r){let s=n.depthStencilAttachment;t.layerDescriptors=[];let o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){let l=n.colorAttachments[0],c=new Sm;c.view=n.colorAttachments[a].view,c.depthSlice=l.depthSlice,c.resolveTarget=l.resolveTarget,c.loadOp=l.loadOp,c.storeOp=l.storeOp,c.clearValue=l.clearValue;let u=new Tm;if(u.label=n.label,u.occlusionQuerySet=n.occlusionQuerySet,u.timestampWrites=n.timestampWrites,u.colorAttachments.push(c),n.depthStencilAttachment){let f=a;o.viewCache[f]||(ur.dimension=bo.TwoD,ur.baseArrayLayer=a,ur.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(ur),ur.reset());let p=new _1;p.view=o.viewCache[f],p.depthLoadOp=s.depthLoadOp||Ei.Clear,p.depthStoreOp=s.depthStoreOp||ba.Store,p.depthClearValue=s.depthClearValue||1,e.stencil&&(p.stencilLoadOp=s.stencilLoadOp,p.stencilStoreOp=s.stencilStoreOp,p.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=p}else{let f=new _1;f.view=s.view,f.depthLoadOp=s.depthLoadOp,f.depthStoreOp=s.depthStoreOp,f.depthClearValue=s.depthClearValue,f.depthReadOnly=s.depthReadOnly,f.stencilLoadOp=s.stencilLoadOp,f.stencilStoreOp=s.stencilStoreOp,f.stencilClearValue=s.stencilClearValue,f.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=f}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){let s=t.layerDescriptors[r];if(s.depthStencilAttachment){let o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Ei.Clear):o.depthLoadOp=Ei.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Ei.Clear):o.stencilLoadOp=Ei.Load)}}}finishRender(e){let t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let o=0;o<t.bundleEncoders.length;o++){let a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){let a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){let{x:c,y:u,width:f,height:p,minDepth:x,maxDepth:v}=e.viewportValue;l.setViewport(c,u,f,p,x,v)}if(e.scissor){let{x:c,y:u,width:f,height:p}=e.scissorValue;l.setScissorRect(c,u,f,p)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){let s=n*8,o=this.occludedResolveCache.get(s);o===void 0&&(Tl.size=s,Tl.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(Tl),Tl.reset(),this.occludedResolveCache.set(s,o)),Tl.size=s,Tl.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(Tl);Tl.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(bh(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let o=0;o<s.length;o++){let a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){let s=this.device,o=this.renderer,a=[],l,c,u;if(e){let x=this.getClearColor();Qc.r=x.r,Qc.g=x.g,Qc.b=x.b,Qc.a=x.a}if(r===null){c=o.depth,u=o.stencil;let x=this._getDefaultRenderPassDescriptor();if(e){a=x.colorAttachments;let v=a[0];v.clearValue=Qc,v.loadOp=Ei.Clear,v.storeOp=ba.Store}(c||u)&&(l=x.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let x={loadOp:e?Ei.Clear:Ei.Load,clearValue:e?Qc:void 0};c&&(x.depthLoadOp=t?Ei.Clear:Ei.Load,x.depthClearValue=t?o.getClearDepth():void 0,x.depthStoreOp=ba.Store),u&&(x.stencilLoadOp=n?Ei.Clear:Ei.Load,x.stencilClearValue=n?o.getClearStencil():void 0,x.stencilStoreOp=ba.Store);let v=this._getRenderPassDescriptor(r,x);a=v.colorAttachments,l=v.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Ei.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=ba.Store):(l.depthLoadOp=Ei.Load,l.depthStoreOp=ba.Store)),u&&l&&(n?(l.stencilLoadOp=Ei.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=ba.Store):(l.stencilLoadOp=Ei.Load,l.stencilStoreOp=ba.Store)),va.label="clear";let f=s.createCommandEncoder(va);va.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),bh(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;JE.label=n,va.label=n,this.initTimestampQuery(ec.COMPUTE,this.getTimestampUID(e),JE),t.cmdEncoderGPU=this.device.createCommandEncoder(va),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(JE),t.currentPipeline=null,va.reset(),JE.reset()}compute(e,t,n,r,s=null){let o=this.get(t),a=this.get(e),{passEncoderGPU:l}=a,c=this.get(r).pipeline;a.currentPipeline!==c&&(l.setPipeline(c),a.currentPipeline=c);for(let u=0,f=n.length;u<f;u++){let p=n[u],x=this.get(p);l.setBindGroup(u,x.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;l.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){let u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;let f=t.workgroupSize,p=f[0];for(let w=1;w<f.length;w++)p*=f[w];let x=Math.ceil(u/p),v=this.device.limits.maxComputeWorkgroupsPerDimension;s=[x,1,1],x>v&&(s[0]=Math.min(x,v),s[1]=Math.ceil(x/v)),o.dispatchSize=s}s=o.dispatchSize}l.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),bh(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:p}=e,x=e.getIndex(),v=x!==null;c.pipeline!==r&&(l.setPipeline(r),c.pipeline=r);let w=c.bindingGroups;for(let S=0,T=s.length;S<T;S++){let P=s[S];if(w[S]!==P.id){let R=this.get(P);l.setBindGroup(S,R.group),w[S]=P.id}}if(v===!0&&c.index!==x){let S=this.get(x).buffer,T=x.array instanceof Uint16Array?dC.Uint16:dC.Uint32;l.setIndexBuffer(S,T),c.index=x}for(let S=0,T=o.length;S<T;S++){let P=o[S];if(c.attributes[S]!==P){let R=this.get(P).buffer;l.setVertexBuffer(S,R),c.attributes[S]=P}}if(p.stencil===!0&&f.stencilWrite===!0&&n.currentStencilRef!==f.stencilRef&&(l.setStencilReference(f.stencilRef),n.currentStencilRef=f.stencilRef),u.isBatchedMesh===!0){let S=u._multiDrawStarts,T=u._multiDrawCounts,P=u._multiDrawCount,R=v===!0?x.array.BYTES_PER_ELEMENT:1;f.wireframe&&(R=u.geometry.attributes.position.count>65535?4:2);for(let C=0;C<P;C++)v===!0?l.drawIndexed(T[C],1,S[C]/R,0,C):l.draw(T[C],1,S[C],C),t.update(u,T[C],1)}else if(v===!0){let{vertexCount:S,instanceCount:T,firstVertex:P}=a,R=e.getIndirect();if(R!==null){let C=this.get(R).buffer,L=e.getIndirectOffset(),D=Array.isArray(L)?L:[L];for(let F=0;F<D.length;F++)l.drawIndexedIndirect(C,D[F])}else l.drawIndexed(S,T,P,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:P}=a,R=e.getIndirect();if(R!==null){let C=this.get(R).buffer,L=e.getIndirectOffset(),D=Array.isArray(L)?L:[L];for(let F=0;F<D.length;F++)l.drawIndirect(C,D[F])}else l.draw(S,T,P,0);t.update(u,S,T)}}draw(e,t){let{object:n,context:r,pipeline:s}=e,o=this.get(r),a=this.get(s),l=a.pipeline;if(a.error===!0)return;let c=e.getDrawParameters();if(c===null)return;let u=e.getBindings(),f=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let p=this.get(e.camera),x=e.camera.cameras,v=e.getBindingGroup("cameraIndex");if(p.indexesGPU===void 0||p.indexesGPU.length!==x.length){let S=this.get(v),T=[],P=new Uint32Array([0,0,0,0]);for(let R=0,C=x.length;R<C;R++){P[0]=R;let{layoutGPU:L}=S.layout,D=this.bindingUtils.createBindGroupIndex(P,L);T.push(D)}p.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=x.length;S<T;S++){let P=x[S];if(n.layers.test(P.layers)){let R=P.viewport,C=o.currentPass,L=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let F=o.bundleEncoders[S],N=o.bundleSets[S];C=F,L=N}if(R&&!D&&C.setViewport(Math.floor(R.x*w),Math.floor(R.y*w),Math.floor(R.width*w),Math.floor(R.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),v&&p.indexesGPU){let F=u.indexOf(v);C.setBindGroup(F,p.indexesGPU[S]),L.bindingGroups[F]=v.id}this._draw(e,t,o,l,u,f,c,C,L)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let p=o.lastOcclusionObject;p!==n&&(p!==null&&p.occlusionTest===!0&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),n.occlusionTest===!0&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}this._draw(e,t,o,l,u,f,c,o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),c=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(n,r),f=n.isMesh&&n.matrixWorld.determinantAffine()<0,p=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==c||t.primitiveTopology!==u||t.frontFaceCW!==f||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=c,t.primitiveTopology=u,t.frontFaceCW=f,t.clippingContextCacheKey=e.clippingContextCacheKey,p=!0),p}getRenderCacheKey(e){let{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new QB(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);tM.querySet=r.querySet,tM.beginningOfPassWriteIndex=s,tM.endOfPassWriteIndex=s+1,n.timestampWrites=tM}createNodeBuilder(e,t){return new HB(e,t)}createProgram(e){let t=this.get(e);eM.label=e.stage+(e.name!==""?`_${e.name}`:""),eM.code=e.code,t.module={module:this.device.createShaderModule(eM),entryPoint:"main"},eM.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let n=e.byteLength,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&Ch.VERTEX&&s.push("vertex"),e.visibility&Ch.FRAGMENT&&s.push("fragment"),e.visibility&Ch.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;Tl.label=`bindingBuffer${e.id}_${e.name}_${o}`,Tl.size=n,Tl.usage=r;let a=this.device.createBuffer(Tl);Tl.reset(),t.buffer=a}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return AK[e]!==void 0&&(e=AK[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,c=0,u=0,f=0,p=0,x=e.image.width,v=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,p=n.min.z,x=n.max.x-n.min.x,v=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,x=n.max.x-n.min.x,v=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),va.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(va);va.reset();let T=this.get(e).texture,P=this.get(t).texture;oc.texture=T,oc.mipLevel=s,oc.origin.x=u,oc.origin.y=f,oc.origin.z=p,xh.texture=P,xh.mipLevel=o,xh.origin.x=a,xh.origin.y=l,xh.origin.z=c,qf.width=x,qf.height=v,qf.depthOrArrayLayers=w,S.copyTextureToTexture(oc,xh,qf),oc.reset(),xh.reset(),qf.reset(),bh(this.device,S.finish()),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){let r=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let o=this.get(e).texture;if(s.format!==o.format){Ge("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):(va.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(va),va.reset()),oc.texture=s,oc.origin.x=n.x,oc.origin.y=n.y,xh.texture=o,qf.width=n.z,qf.height=n.w,a.copyTextureToTexture(oc,xh,qf),oc.reset(),xh.reset(),qf.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){let{descriptor:l}=r;for(let c=0;c<l.colorAttachments.length;c++)l.colorAttachments[c].loadOp=Ei.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Ei.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Ei.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else bh(this.device,a.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},n7=class extends TA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},i7=class extends TA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},r7=class extends nC{constructor(){super(),this.addMaterial(MF,"MeshPhongMaterial"),this.addMaterial(DM,"MeshStandardMaterial"),this.addMaterial(FF,"MeshPhysicalMaterial"),this.addMaterial(BF,"MeshToonMaterial"),this.addMaterial(TF,"MeshBasicMaterial"),this.addMaterial(EF,"MeshLambertMaterial"),this.addMaterial(vF,"MeshNormalMaterial"),this.addMaterial(UF,"MeshMatcapMaterial"),this.addMaterial(_F,"LineBasicMaterial"),this.addMaterial(xF,"LineDashedMaterial"),this.addMaterial(GF,"PointsMaterial"),this.addMaterial(FM,"SpriteMaterial"),this.addMaterial(VF,"ShadowMaterial"),this.addLight(NO,qy),this.addLight(nB,EA),this.addLight(aB,Hy),this.addLight(fb,TA),this.addLight(tB,MA),this.addLight(iB,zy),this.addLight(sB,Wy),this.addLight(rB,n7),this.addLight(oB,i7),this.addToneMapping(QJ,l2),this.addToneMapping(JJ,c2),this.addToneMapping(eee,u2),this.addToneMapping(tee,h2),this.addToneMapping(nee,f2),this.addToneMapping(iee,d2)}},D1=class extends mB{constructor(e={}){let t;e.forceWebGL?t=fC:(t=t7,e.getFallback=()=>(je("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new fC(e)));let n=new t(e);super(n,e),this.library=new r7,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var dJe=U.BRDF_GGX,pJe=U.BRDF_Lambert,AJe=U.BasicPointShadowFilter,mJe=U.BasicShadowFilter,gJe=U.Break,_Je=U.Const,xJe=U.Continue,yJe=U.DFGLUT,vJe=U.D_GGX,bJe=U.Discard,wJe=U.EPSILON,SJe=U.F_Schlick,Dee=U.Fn,TJe=U.INFINITY,Fee=U.If,Oee=U.Loop,EJe=U.NodeAccess,MJe=U.NodeShaderStage,CJe=U.NodeType,RJe=U.NodeUpdateType,PJe=U.PCFShadowFilter,IJe=U.PCFSoftShadowFilter,NJe=U.PI,LJe=U.PI2,DJe=U.TWO_PI,FJe=U.HALF_PI,OJe=U.PointShadowFilter,BJe=U.Return,UJe=U.Schlick_to_F0,kJe=U.ShaderNode,GJe=U.Stack,zJe=U.Switch,VJe=U.TBNViewMatrix,qJe=U.VSMShadowFilter,HJe=U.V_GGX_SmithCorrelated,WJe=U.Var,jJe=U.VarIntent,XJe=U.abs,$Je=U.acesFilmicToneMapping,YJe=U.acos,KJe=U.acosh,ZJe=U.add,QJe=U.addMethodChaining,JJe=U.addNodeElement,eet=U.agxToneMapping,tet=U.all,net=U.alphaT,iet=U.ambientOcclusion,ret=U.and,set=U.anisotropy,oet=U.anisotropyB,aet=U.anisotropyT,cet=U.any,uet=U.append,het=U.array,Bee=U.asin,fet=U.asinh,det=U.assign,pet=U.atan,Aet=U.atanh,met=U.atomicAdd,get=U.atomicAnd,_et=U.atomicFunc,xet=U.atomicLoad,yet=U.atomicMax,vet=U.atomicMin,bet=U.atomicOr,wet=U.atomicStore,Tet=U.atomicSub,Eet=U.atomicXor,Met=U.attenuationColor,Cet=U.attenuationDistance,Ret=U.attribute,Pet=U.attributeArray,Iet=U.backgroundBlurriness,Net=U.backgroundIntensity,Let=U.backgroundRotation,Det=U.batch,Fet=U.bentNormalView,Oet=U.billboarding,Bet=U.bitAnd,Uet=U.bitNot,ket=U.bitOr,Get=U.bitXor,zet=U.bitangentGeometry,Vet=U.bitangentLocal,qet=U.bitangentView,Het=U.bitangentWorld,Wet=U.bitcast,jet=U.blendBurn,Xet=U.blendColor,$et=U.blendDodge,Yet=U.blendOverlay,Ket=U.blendScreen,Zet=U.blur,Qet=U.bool,Jet=U.buffer,ett=U.bufferAttribute,ttt=U.bumpMap,ntt=U.builtin,itt=U.builtinAOContext,rtt=U.builtinShadowContext,stt=U.bvec2,ott=U.bvec3,att=U.bvec4,ltt=U.bypass,ctt=U.cache,utt=U.call,htt=U.cameraFar,ftt=U.cameraIndex,dtt=U.cameraNear,ptt=U.cameraNormalMatrix,Att=U.cameraPosition,mtt=U.cameraProjectionMatrix,gtt=U.cameraProjectionMatrixInverse,_tt=U.cameraViewMatrix,xtt=U.cameraViewport,ytt=U.cameraWorldMatrix,vtt=U.cbrt,btt=U.cdl,wtt=U.ceil,Stt=U.checker,Ttt=U.cineonToneMapping,Ett=U.clamp,Mtt=U.clearcoat,Ctt=U.clearcoatNormalView,Rtt=U.clearcoatRoughness,Ptt=U.clipSpace,Itt=U.code,Ntt=U.color,Ltt=U.colorSpaceToWorking,Dtt=U.colorToDirection,Ftt=U.compute,Ott=U.computeKernel,Btt=U.computeSkinning,Utt=U.context,ktt=U.convert,Gtt=U.convertColorSpace,ztt=U.convertToTexture,Vtt=U.countLeadingZeros,qtt=U.countOneBits,Htt=U.countTrailingZeros,Uee=U.cos,Wtt=U.cosh,jtt=U.cross,Xtt=U.cubeTexture,$tt=U.cubeTextureBase,Ytt=U.dFdx,Ktt=U.dFdy,Ztt=U.dashSize,Qtt=U.debug,Jtt=U.decrement,ent=U.decrementBefore,tnt=U.defaultBuildStages,nnt=U.defaultShaderStages,int=U.defined,rnt=U.degrees,snt=U.deltaTime,ont=U.densityFog,ant=U.densityFogFactor,lnt=U.depth,cnt=U.depthPass,unt=U.determinant,hnt=U.difference,fnt=U.diffuseColor,dnt=U.directPointLight,pnt=U.directionToColor,Ant=U.directionToFaceDirection,mnt=U.dispersion,gnt=U.distance,_nt=U.div,xnt=U.dot,ynt=U.drawIndex,vnt=U.dynamicBufferAttribute,bnt=U.element,wnt=U.emissive,Snt=U.equal,Tnt=U.equirectDirection,Ent=U.equirectUV,kee=U.exp,Mnt=U.exp2,Cnt=U.exponentialHeightFogFactor,Rnt=U.expression,Pnt=U.faceDirection,Int=U.faceForward,Nnt=U.faceforward,Gee=U.float,Lnt=U.floatBitsToInt,Dnt=U.floatBitsToUint,Fnt=U.floor,Ont=U.fog,Bnt=U.fract,Unt=U.frameGroup,knt=U.frameId,Gnt=U.frontFacing,znt=U.fwidth,Vnt=U.gain,qnt=U.gapSize,Hnt=U.getConstNodeType,Wnt=U.getCurrentStack,jnt=U.getDirection,Xnt=U.getDistanceAttenuation,$nt=U.getGeometryRoughness,Ynt=U.getNormalFromDepth,Knt=U.interleavedGradientNoise,Znt=U.vogelDiskSample,Qnt=U.getParallaxCorrectNormal,Jnt=U.getRoughness,eit=U.getScreenPosition,tit=U.getShIrradianceAt,nit=U.getShadowMaterial,iit=U.getShadowRenderObjectFunction,rit=U.getTextureIndex,sit=U.getViewPosition,oit=U.globalId,ait=U.glsl,lit=U.glslFn,cit=U.grayscale,uit=U.greaterThan,hit=U.greaterThanEqual,fit=U.hash,dit=U.highpModelNormalViewMatrix,pit=U.highpModelViewMatrix,Ait=U.hue,mit=U.increment,git=U.incrementBefore,_it=U.instance,zee=U.instanceIndex,xit=U.instancedArray,yit=U.instancedBufferAttribute,vit=U.instancedDynamicBufferAttribute,bit=U.instancedMesh,wit=U.int,Sit=U.intBitsToFloat,Tit=U.inverse,Eit=U.inverseSqrt,Mit=U.inversesqrt,Cit=U.invocationLocalIndex,Rit=U.invocationSubgroupIndex,Pit=U.ior,Iit=U.iridescence,Nit=U.iridescenceIOR,Lit=U.iridescenceThickness,Dit=U.ivec2,Fit=U.ivec3,Oit=U.ivec4,Bit=U.js,Uit=U.label,kit=U.length,Git=U.lengthSq,zit=U.lessThan,Vit=U.lessThanEqual,qit=U.lightPosition,Hit=U.lightProjectionUV,Wit=U.lightShadowMatrix,jit=U.lightTargetDirection,Xit=U.lightTargetPosition,$it=U.lightViewPosition,Yit=U.lightingContext,Kit=U.lights,Zit=U.linearDepth,Qit=U.linearToneMapping,Jit=U.localId,ert=U.log,trt=U.log2,nrt=U.logarithmicDepthToViewZ,irt=U.luminance,rrt=U.mat2,srt=U.mat3,ort=U.mat4,art=U.matcapUV,lrt=U.materialAO,crt=U.materialAlphaTest,urt=U.materialAnisotropy,hrt=U.materialAnisotropyVector,frt=U.materialAttenuationColor,drt=U.materialAttenuationDistance,prt=U.materialClearcoat,Art=U.materialClearcoatNormal,mrt=U.materialClearcoatRoughness,grt=U.materialColor,_rt=U.materialDispersion,xrt=U.materialEmissive,yrt=U.materialEnvIntensity,vrt=U.materialEnvRotation,brt=U.materialIOR,wrt=U.materialIridescence,Srt=U.materialIridescenceIOR,Trt=U.materialIridescenceThickness,Ert=U.materialLightMap,Mrt=U.materialLineDashOffset,Crt=U.materialLineDashSize,Rrt=U.materialLineGapSize,Prt=U.materialLineScale,Irt=U.materialLineWidth,Nrt=U.materialMetalness,Lrt=U.materialNormal,Drt=U.materialOpacity,Frt=U.materialPointSize,Ort=U.materialReference,Brt=U.materialReflectivity,Urt=U.materialRefractionRatio,krt=U.materialRotation,Grt=U.materialRoughness,zrt=U.materialSheen,Vrt=U.materialSheenRoughness,qrt=U.materialShininess,Hrt=U.materialSpecular,Wrt=U.materialSpecularColor,jrt=U.materialSpecularIntensity,Xrt=U.materialSpecularStrength,$rt=U.materialThickness,Yrt=U.materialTransmission,Krt=U.max,Zrt=U.maxMipLevel,Qrt=U.mediumpModelViewMatrix,Jrt=U.metalness,est=U.min,tst=U.mix,nst=U.mixElement,ist=U.mod,rst=U.modelDirection,sst=U.modelNormalMatrix,ost=U.modelPosition,ast=U.modelRadius,lst=U.modelScale,cst=U.modelViewMatrix,ust=U.modelViewPosition,hst=U.modelViewProjection,fst=U.modelWorldMatrix,dst=U.modelWorldMatrixInverse,pst=U.morphReference,Ast=U.mrt,mst=U.mul,gst=U.mx_aastep,_st=U.mx_add,xst=U.mx_atan2,yst=U.mx_cell_noise_float,vst=U.mx_contrast,bst=U.mx_divide,wst=U.mx_fractal_noise_float,Sst=U.mx_fractal_noise_vec2,Tst=U.mx_fractal_noise_vec3,Est=U.mx_fractal_noise_vec4,Mst=U.mx_frame,Cst=U.mx_heighttonormal,Rst=U.mx_hsvtorgb,Pst=U.mx_ifequal,Ist=U.mx_ifgreater,Nst=U.mx_ifgreatereq,Lst=U.mx_invert,Dst=U.mx_modulo,Fst=U.mx_multiply,Ost=U.mx_noise_float,Bst=U.mx_noise_vec3,Ust=U.mx_noise_vec4,kst=U.mx_place2d,Gst=U.mx_power,zst=U.mx_ramp4,Vst=U.mx_ramplr,qst=U.mx_ramptb,Hst=U.mx_rgbtohsv,Wst=U.mx_rotate2d,jst=U.mx_rotate3d,Xst=U.mx_safepower,$st=U.mx_separate,Yst=U.mx_splitlr,Kst=U.mx_splittb,Zst=U.mx_srgb_texture_to_lin_rec709,Qst=U.mx_subtract,Jst=U.mx_timer,eot=U.mx_transform_uv,tot=U.mx_unifiednoise2d,not=U.mx_unifiednoise3d,iot=U.mx_worley_noise_float,rot=U.mx_worley_noise_vec2,sot=U.mx_worley_noise_vec3,Vee=U.negate,oot=U.negateOnBackSide,aot=U.neutralToneMapping,lot=U.nodeArray,cot=U.nodeImmutable,uot=U.nodeObject,hot=U.nodeObjectIntent,fot=U.nodeObjects,dot=U.nodeProxy,pot=U.nodeProxyIntent,Aot=U.normalFlat,mot=U.normalGeometry,got=U.normalLocal,_ot=U.normalMap,xot=U.normalView,yot=U.normalViewGeometry,vot=U.normalWorld,bot=U.normalWorldGeometry,wot=U.normalize,Sot=U.not,Tot=U.notEqual,Eot=U.numWorkgroups,Mot=U.objectDirection,Cot=U.objectGroup,Rot=U.objectPosition,Pot=U.objectRadius,Iot=U.objectScale,Not=U.objectViewPosition,Lot=U.objectWorldMatrix,Dot=U.OnBeforeObjectUpdate,Fot=U.OnBeforeMaterialUpdate,Oot=U.OnObjectUpdate,Bot=U.OnMaterialUpdate,Uot=U.oneMinus,kot=U.or,Got=U.orthographicDepthToViewZ,zot=U.oscSawtooth,Vot=U.oscSine,qot=U.oscSquare,Hot=U.oscTriangle,Wot=U.output,jot=U.outputStruct,Xot=U.overloadingFn,$ot=U.overrideNode,Yot=U.overrideNodes,Kot=U.packHalf2x16,Zot=U.packSnorm2x16,Qot=U.packUnorm2x16,Jot=U.packNormalToRGB,eat=U.parabola,tat=U.parallaxDirection,nat=U.parallaxUV,iat=U.parameter,rat=U.pass,sat=U.passTexture,oat=U.pcurve,aat=U.perspectiveDepthToViewZ,lat=U.pmremTexture,cat=U.pointShadow,uat=U.pointUV,hat=U.pointWidth,fat=U.positionGeometry,dat=U.positionLocal,pat=U.positionPrevious,Aat=U.positionView,mat=U.positionViewDirection,gat=U.positionWorld,_at=U.positionWorldDirection,xat=U.posterize,yat=U.pow,vat=U.pow2,bat=U.pow3,wat=U.pow4,Sat=U.premultiplyAlpha,Tat=U.property,Eat=U.radians,Mat=U.rand,Cat=U.range,Rat=U.rangeFog,Pat=U.rangeFogFactor,Iat=U.reciprocal,Nat=U.reference,Lat=U.referenceBuffer,Dat=U.reflect,Fat=U.reflectVector,Oat=U.reflectView,Bat=U.reflector,Uat=U.refract,kat=U.refractVector,Gat=U.refractView,zat=U.reinhardToneMapping,Vat=U.remap,qat=U.remapClamp,Hat=U.renderGroup,Wat=U.renderOutput,jat=U.rendererReference,Xat=U.replaceDefaultUV,$at=U.rotate,Yat=U.rotateUV,Kat=U.roughness,Zat=U.round,Qat=U.rtt,Jat=U.sRGBTransferEOTF,elt=U.sRGBTransferOETF,tlt=U.sample,nlt=U.sampler,ilt=U.samplerComparison,rlt=U.saturate,slt=U.saturation,olt=U.screen,alt=U.screenCoordinate,llt=U.screenDPR,clt=U.screenSize,ult=U.screenUV,hlt=U.select,flt=U.setCurrentStack,dlt=U.setName,plt=U.shaderStages,Alt=U.shadow,mlt=U.shadowPositionWorld,glt=U.shapeCircle,_lt=U.sharedUniformGroup,xlt=U.sheen,ylt=U.sheenRoughness,vlt=U.shiftLeft,blt=U.shiftRight,wlt=U.shininess,Slt=U.sign,qee=U.sin,Tlt=U.sinh,Elt=U.sinc,Mlt=U.skinning,Clt=U.smoothstep,Rlt=U.smoothstepElement,Plt=U.specularColor,Ilt=U.specularF90,Nlt=U.spherizeUV,Llt=U.split,Dlt=U.spritesheetUV,Hee=U.sqrt,Flt=U.stack,Olt=U.step,Blt=U.stepElement,Wee=U.storage,Ult=U.storageBarrier,klt=U.storageTexture,Glt=U.storageTexture3D,zlt=U.struct,Vlt=U.sub,qlt=U.subgroupAdd,Hlt=U.subgroupAll,Wlt=U.subgroupAnd,jlt=U.subgroupAny,Xlt=U.subgroupBallot,$lt=U.subgroupBroadcast,Ylt=U.subgroupBroadcastFirst,Klt=U.subBuild,Zlt=U.subgroupElect,Qlt=U.subgroupExclusiveAdd,Jlt=U.subgroupExclusiveMul,ect=U.subgroupInclusiveAdd,tct=U.subgroupInclusiveMul,nct=U.subgroupIndex,ict=U.subgroupMax,rct=U.subgroupMin,sct=U.subgroupMul,oct=U.subgroupOr,act=U.subgroupShuffle,lct=U.subgroupShuffleDown,cct=U.subgroupShuffleUp,uct=U.subgroupShuffleXor,hct=U.subgroupSize,fct=U.subgroupXor,dct=U.tan,pct=U.tanh,Act=U.tangentGeometry,mct=U.tangentLocal,gct=U.tangentView,_ct=U.tangentWorld,xct=U.texture,yct=U.texture3D,vct=U.textureBarrier,bct=U.textureBicubic,wct=U.textureBicubicLevel,Sct=U.textureCubeUV,Tct=U.textureLoad,Ect=U.textureSize,Mct=U.textureLevel,Cct=U.textureStore,Rct=U.thickness,Pct=U.time,Ict=U.toneMapping,Nct=U.toneMappingExposure,Lct=U.toonOutlinePass,Dct=U.transformDirection,Fct=U.transformNormal,Oct=U.transformNormalByInverseViewMatrix,Bct=U.transformNormalByViewMatrix,Uct=U.transformNormalToView,kct=U.transformedClearcoatNormalView,Gct=U.transformedNormalView,zct=U.transformedNormalWorld,Vct=U.transmission,qct=U.transpose,Hct=U.triNoise3D,Wct=U.triplanarTexture,jct=U.triplanarTextures,Xct=U.trunc,$ct=U.uint,Yct=U.uintBitsToFloat,jee=U.uniform,Kct=U.uniformArray,Zct=U.uniformCubeTexture,Qct=U.uniformGroup,Jct=U.uniformFlow,eut=U.uniformTexture,tut=U.unpackHalf2x16,nut=U.unpackSnorm2x16,iut=U.unpackUnorm2x16,rut=U.unpackRGBToNormal,sut=U.unpremultiplyAlpha,out=U.userData,aut=U.uv,lut=U.uvec2,cut=U.uvec3,uut=U.uvec4,hut=U.varying,fut=U.varyingProperty,dut=U.vec2,put=U.vec3,Aut=U.vec4,mut=U.vectorComponents,gut=U.velocity,_ut=U.vertexColor,xut=U.vertexIndex,yut=U.vertexStage,vut=U.vibrance,but=U.viewZToLogarithmicDepth,wut=U.viewZToOrthographicDepth,Sut=U.viewZToPerspectiveDepth,Tut=U.viewZToReversedOrthographicDepth,Eut=U.viewZToReversedPerspectiveDepth,Mut=U.viewport,Cut=U.viewportCoordinate,Rut=U.viewportDepthTexture,Put=U.viewportLinearDepth,Iut=U.viewportMipTexture,Nut=U.viewportOpaqueMipTexture,Lut=U.viewportResolution,Dut=U.viewportSafeUV,Fut=U.viewportSharedTexture,Out=U.viewportSize,But=U.viewportTexture,Uut=U.viewportUV,kut=U.wgsl,Gut=U.wgslFn,zut=U.workgroupArray,Vut=U.workgroupBarrier,qut=U.workgroupId,Hut=U.workingToColorSpace,Wut=U.xor;var Xee=new ha,KC=new ie,G1=class extends jy{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new kn(e,3)),this.setAttribute("uv",new kn(t,2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Gu(t,6,1);return this.setAttribute("instanceStart",new mo(n,3,0)),this.setAttribute("instanceEnd",new mo(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Gu(t,6,1);return this.setAttribute("instanceColorStart",new mo(n,3,0)),this.setAttribute("instanceColorEnd",new mo(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Ly(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ha);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Xee.setFromBufferAttribute(t),this.boundingBox.union(Xee))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new qa),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)KC.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(KC)),KC.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(KC));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}};Nt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Oe},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};ma.line={uniforms:zA.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`4703+ ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?Ge:je)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===If){let l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,c=e.blendDstAlpha!==null?e.blendDstAlpha:o,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(u)}}else{let l=e.premultipliedAlpha,c=(u,f,p,x)=>{t={srcFactor:u,dstFactor:f,operation:hm.Add},n={srcFactor:p,dstFactor:x,operation:hm.Add}};if(l)switch(r){case ss:c(si.One,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case zu:c(si.One,si.One,si.One,si.One);break;case Vu:c(si.Zero,si.OneMinusSrc,si.Zero,si.One);break;case qu:c(si.Dst,si.OneMinusSrcAlpha,si.Zero,si.One);break}else switch(r){case ss:c(si.SrcAlpha,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case zu:c(si.SrcAlpha,si.One,si.One,si.One);break;case Vu:Ge(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case qu:Ge(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};Ge("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case qc:t=si.Zero;break;case e2:t=si.One;break;case t2:t=si.Src;break;case n2:t=si.OneMinusSrc;break;case Ud:t=si.SrcAlpha;break;case kd:t=si.OneMinusSrcAlpha;break;case s2:t=si.Dst;break;case o2:t=si.OneMinusDst;break;case i2:t=si.DstAlpha;break;case r2:t=si.OneMinusDstAlpha;break;case a2:t=si.SrcAlphaSaturated;break;case I2e:t=si.Constant;break;case N2e:t=si.OneMinusConstant;break;default:Ge("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case oL:t=vo.Never;break;case gy:t=vo.Always;break;case aL:t=vo.Less;break;case cL:t=vo.LessEqual;break;case lL:t=vo.Equal;break;case fL:t=vo.GreaterEqual;break;case uL:t=vo.Greater;break;case hL:t=vo.NotEqual;break;default:Ge("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case yf:t=Vp.Keep;break;case JN:t=Vp.Zero;break;case eL:t=Vp.Replace;break;case sL:t=Vp.Invert;break;case tL:t=Vp.IncrementClamp;break;case nL:t=Vp.DecrementClamp;break;case iL:t=Vp.IncrementWrap;break;case rL:t=Vp.DecrementWrap;break;default:Ge("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Bs:t=hm.Add;break;case Qy:t=hm.Subtract;break;case Jy:t=hm.ReverseSubtract;break;case zT:t=hm.Min;break;case VT:t=hm.Max;break;default:Ge("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){let r={},s=this.backend.utils;r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?dC.Uint16:dC.Uint32);let o=n.side===ui;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?fZ.CW:fZ.CCW,r.cullMode=n.side===ir?dZ.None:dZ.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?pZ.All:pZ.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=vo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?b2[e.depthFunc]:e.depthFunc;switch(n){case lA:t=vo.Never;break;case cA:t=vo.Always;break;case uA:t=vo.Less;break;case Bu:t=vo.LessEqual;break;case hA:t=vo.Equal;break;case fA:t=vo.GreaterEqual;break;case dA:t=vo.Greater;break;case pA:t=vo.NotEqual;break;default:Ge("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},yC=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},_h=new o0,XTe=new Fm,Bv=new yC,JB=class extends hC{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Bv.label=`queryset_global_timestamp_${t}`,Bv.type="timestamp",Bv.count=this.maxQueries,this.querySet=this.device.createQuerySet(Bv),Bv.reset();let r=this.maxQueries*8;_h.label=`buffer_timestamp_resolve_${t}`,_h.size=r,_h.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(_h),_h.reset(),_h.label=`buffer_timestamp_result_${t}`,_h.size=r,_h.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(_h),_h.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Zn(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let r=this.device.createCommandEncoder(XTe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(bh(this.device,s),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;let o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(let[u,f]of e){let p=u.match(/^(.*):f(\d+)$/),x=parseInt(p[2]);l.includes(x)===!1&&l.push(x),a[x]===void 0&&(a[x]=0);let v=o[f],w=o[f+1],S=Number(w-v)/1e6;this.timestamps.set(u,S),a[x]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return Ge("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){Ge("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){Ge("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},e7=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},_1=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},t7=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},Qc={r:0,g:0,b:0,a:1},Tl=new o0,ba=new Fm,JE=new e7,Uv=new yC,eM=new _C,tM=new t7,oc=new L1,xh=new L1,ur=new mb,qf=new xC,n7=class extends uC{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new LB(this),this.attributeUtils=new jB(this),this.bindingUtils=new $B(this),this.capabilities=new YB(this),this.pipelineUtils=new QB(this),this.textureUtils=new zB(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Df.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,n;if(t.device===void 0){let r={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");let o=Object.values(pC),a=[];for(let c of o)s.features.has(c)&&a.push(c);let l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;let s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),n.onuncapturederror=r=>{let s=r.error,o=s&&s.constructor?s.constructor.name:"GPUError",a=s&&s.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:o,message:a,originalEvent:r})},this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(pC.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,n=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:n,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),n=t.context;if(n===void 0){let r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${"185"} webgpu`);let s=r.alpha?"premultiplied":"opaque",o=r.outputType===Li?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return qa}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples,s=n.descriptor;if(s===void 0||n.samples!==r){if(s=new Em,s.colorAttachments.push(new Tm),e.depth===!0||e.stencil===!0){let l=new _1;l.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=l}let a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}let o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let n=0;n<t.length;n++)if(this.get(t[n]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let n=[],r=e.camera;if(t.xrViewDescriptors&&r!==null&&r.isArrayCamera===!0)for(let s=0;s<t.xrViewDescriptors.length;s++)n.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else n.push({view:t.texture.createView({dimension:bo.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return n}_getRenderPassDescriptor(e,t={}){let n=e.renderTarget,r=this.get(n),s=this._hasExternalTexture(e),o=r.descriptors;(o===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples||s)&&(o={},r.descriptors=o);let a=e.getCacheKey(),l=o[a];if(l===void 0||s){let u=e.textures,f=[],p,x=this._isRenderCameraDepthArray(e);for(let w=0;w<u.length;w++){let S=this.get(u[w]);if(S.externalTexture===!0){f.push(...this._createExternalTextureViews(e,S));continue}if(ur.label=`colorAttachment_${w}`,ur.baseMipLevel=e.activeMipmapLevel,ur.mipLevelCount=1,ur.baseArrayLayer=e.activeCubeFace,ur.arrayLayerCount=1,ur.dimension=bo.TwoD,n.isRenderTarget3D)p=e.activeCubeFace,ur.baseArrayLayer=0,ur.dimension=bo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(x===!0){let T=e.camera.cameras;for(let P=0;P<T.length;P++){ur.baseArrayLayer=P,ur.arrayLayerCount=1,ur.dimension=bo.TwoD;let R=S.texture.createView(ur);f.push({view:R,resolveTarget:void 0,depthSlice:void 0})}}else ur.dimension=bo.TwoDArray;if(x!==!0){let T=S.texture.createView(ur),P,R;S.msaaTexture!==void 0?(P=S.msaaTexture.createView(),R=T):(P=T,R=void 0),f.push({view:P,resolveTarget:R,depthSlice:p})}ur.reset()}let v=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Tm;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,v.push(T)}if(l={textureViews:f,colorAttachments:v,descriptor:new Em},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(ur.dimension=bo.TwoD,ur.arrayLayerCount=1,ur.baseArrayLayer=e.activeCubeFace);let S=new _1;S.view=w.texture.createView(ur),l.depthStencilAttachment=S,ur.reset()}o[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}let c=l.descriptor;c.reset();for(let u=0;u<l.colorAttachments.length;u++){let f=l.colorAttachments[u],p={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(p=t.clearValue),f.loadOp=t.loadOp||Ei.Load,f.storeOp=t.storeOp||wa.Store,f.clearValue=p,c.colorAttachments.push(f)}return l.depthStencilAttachment&&(c.depthStencilAttachment=l.depthStencilAttachment),c}beginRender(e){let t=this.get(e),n=this.device,r=e.occlusionQueryCount,s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,Uv.label=`occlusionQuerySet_${e.id}`,Uv.type="occlusion",Uv.count=r,s=n.createQuerySet(Uv),Uv.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Ei.Load}),this.initTimestampQuery(ec.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;let a=o.depthStencilAttachment;if(e.textures!==null){let c=o.colorAttachments;for(let u=0;u<c.length;u++){let f=c[u];e.clearColor?(u===0?f.clearValue=e.clearColorValue:(Qc.r=0,Qc.g=0,Qc.b=0,Qc.a=1,f.clearValue=Qc),f.loadOp=Ei.Clear):f.loadOp=Ei.Load,f.storeOp=wa.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Ei.Clear):c.loadOp=Ei.Load,c.storeOp=wa.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Ei.Clear):a.depthLoadOp=Ei.Load,a.depthStoreOp=wa.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Ei.Clear):a.stencilLoadOp=Ei.Load,a.stencilStoreOp=wa.Store),ba.label="renderContext_"+e.id;let l=n.createCommandEncoder(ba);if(ba.reset(),this._isRenderCameraDepthArray(e)===!0){let c=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==c.length?this._createArrayCameraLayerDescriptors(e,t,o,c):this._updateArrayCameraLayerDescriptors(e,t,c),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u<c.length;u++){let f=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+u),p={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(p)}t.currentPass=null}else{let c=l.beginRenderPass(o);t.currentPass=c,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,n,r){let s=n.depthStencilAttachment;t.layerDescriptors=[];let o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){let l=n.colorAttachments[0],c=new Tm;c.view=n.colorAttachments[a].view,c.depthSlice=l.depthSlice,c.resolveTarget=l.resolveTarget,c.loadOp=l.loadOp,c.storeOp=l.storeOp,c.clearValue=l.clearValue;let u=new Em;if(u.label=n.label,u.occlusionQuerySet=n.occlusionQuerySet,u.timestampWrites=n.timestampWrites,u.colorAttachments.push(c),n.depthStencilAttachment){let f=a;o.viewCache[f]||(ur.dimension=bo.TwoD,ur.baseArrayLayer=a,ur.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(ur),ur.reset());let p=new _1;p.view=o.viewCache[f],p.depthLoadOp=s.depthLoadOp||Ei.Clear,p.depthStoreOp=s.depthStoreOp||wa.Store,p.depthClearValue=s.depthClearValue||1,e.stencil&&(p.stencilLoadOp=s.stencilLoadOp,p.stencilStoreOp=s.stencilStoreOp,p.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=p}else{let f=new _1;f.view=s.view,f.depthLoadOp=s.depthLoadOp,f.depthStoreOp=s.depthStoreOp,f.depthClearValue=s.depthClearValue,f.depthReadOnly=s.depthReadOnly,f.stencilLoadOp=s.stencilLoadOp,f.stencilStoreOp=s.stencilStoreOp,f.stencilClearValue=s.stencilClearValue,f.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=f}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){let s=t.layerDescriptors[r];if(s.depthStencilAttachment){let o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Ei.Clear):o.depthLoadOp=Ei.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Ei.Clear):o.stencilLoadOp=Ei.Load)}}}finishRender(e){let t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let o=0;o<t.bundleEncoders.length;o++){let a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){let a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){let{x:c,y:u,width:f,height:p,minDepth:x,maxDepth:v}=e.viewportValue;l.setViewport(c,u,f,p,x,v)}if(e.scissor){let{x:c,y:u,width:f,height:p}=e.scissorValue;l.setScissorRect(c,u,f,p)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){let s=n*8,o=this.occludedResolveCache.get(s);o===void 0&&(Tl.size=s,Tl.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(Tl),Tl.reset(),this.occludedResolveCache.set(s,o)),Tl.size=s,Tl.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(Tl);Tl.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(bh(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let o=0;o<s.length;o++){let a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){let s=this.device,o=this.renderer,a=[],l,c,u;if(e){let x=this.getClearColor();Qc.r=x.r,Qc.g=x.g,Qc.b=x.b,Qc.a=x.a}if(r===null){c=o.depth,u=o.stencil;let x=this._getDefaultRenderPassDescriptor();if(e){a=x.colorAttachments;let v=a[0];v.clearValue=Qc,v.loadOp=Ei.Clear,v.storeOp=wa.Store}(c||u)&&(l=x.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let x={loadOp:e?Ei.Clear:Ei.Load,clearValue:e?Qc:void 0};c&&(x.depthLoadOp=t?Ei.Clear:Ei.Load,x.depthClearValue=t?o.getClearDepth():void 0,x.depthStoreOp=wa.Store),u&&(x.stencilLoadOp=n?Ei.Clear:Ei.Load,x.stencilClearValue=n?o.getClearStencil():void 0,x.stencilStoreOp=wa.Store);let v=this._getRenderPassDescriptor(r,x);a=v.colorAttachments,l=v.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Ei.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=wa.Store):(l.depthLoadOp=Ei.Load,l.depthStoreOp=wa.Store)),u&&l&&(n?(l.stencilLoadOp=Ei.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=wa.Store):(l.stencilLoadOp=Ei.Load,l.stencilStoreOp=wa.Store)),ba.label="clear";let f=s.createCommandEncoder(ba);ba.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),bh(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;JE.label=n,ba.label=n,this.initTimestampQuery(ec.COMPUTE,this.getTimestampUID(e),JE),t.cmdEncoderGPU=this.device.createCommandEncoder(ba),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(JE),t.currentPipeline=null,ba.reset(),JE.reset()}compute(e,t,n,r,s=null){let o=this.get(t),a=this.get(e),{passEncoderGPU:l}=a,c=this.get(r).pipeline;a.currentPipeline!==c&&(l.setPipeline(c),a.currentPipeline=c);for(let u=0,f=n.length;u<f;u++){let p=n[u],x=this.get(p);l.setBindGroup(u,x.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;l.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){let u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;let f=t.workgroupSize,p=f[0];for(let w=1;w<f.length;w++)p*=f[w];let x=Math.ceil(u/p),v=this.device.limits.maxComputeWorkgroupsPerDimension;s=[x,1,1],x>v&&(s[0]=Math.min(x,v),s[1]=Math.ceil(x/v)),o.dispatchSize=s}s=o.dispatchSize}l.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),bh(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:p}=e,x=e.getIndex(),v=x!==null;c.pipeline!==r&&(l.setPipeline(r),c.pipeline=r);let w=c.bindingGroups;for(let S=0,T=s.length;S<T;S++){let P=s[S];if(w[S]!==P.id){let R=this.get(P);l.setBindGroup(S,R.group),w[S]=P.id}}if(v===!0&&c.index!==x){let S=this.get(x).buffer,T=x.array instanceof Uint16Array?dC.Uint16:dC.Uint32;l.setIndexBuffer(S,T),c.index=x}for(let S=0,T=o.length;S<T;S++){let P=o[S];if(c.attributes[S]!==P){let R=this.get(P).buffer;l.setVertexBuffer(S,R),c.attributes[S]=P}}if(p.stencil===!0&&f.stencilWrite===!0&&n.currentStencilRef!==f.stencilRef&&(l.setStencilReference(f.stencilRef),n.currentStencilRef=f.stencilRef),u.isBatchedMesh===!0){let S=u._multiDrawStarts,T=u._multiDrawCounts,P=u._multiDrawCount,R=v===!0?x.array.BYTES_PER_ELEMENT:1;f.wireframe&&(R=u.geometry.attributes.position.count>65535?4:2);for(let C=0;C<P;C++)v===!0?l.drawIndexed(T[C],1,S[C]/R,0,C):l.draw(T[C],1,S[C],C),t.update(u,T[C],1)}else if(v===!0){let{vertexCount:S,instanceCount:T,firstVertex:P}=a,R=e.getIndirect();if(R!==null){let C=this.get(R).buffer,L=e.getIndirectOffset(),D=Array.isArray(L)?L:[L];for(let F=0;F<D.length;F++)l.drawIndexedIndirect(C,D[F])}else l.drawIndexed(S,T,P,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:P}=a,R=e.getIndirect();if(R!==null){let C=this.get(R).buffer,L=e.getIndirectOffset(),D=Array.isArray(L)?L:[L];for(let F=0;F<D.length;F++)l.drawIndirect(C,D[F])}else l.draw(S,T,P,0);t.update(u,S,T)}}draw(e,t){let{object:n,context:r,pipeline:s}=e,o=this.get(r),a=this.get(s),l=a.pipeline;if(a.error===!0)return;let c=e.getDrawParameters();if(c===null)return;let u=e.getBindings(),f=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let p=this.get(e.camera),x=e.camera.cameras,v=e.getBindingGroup("cameraIndex");if(p.indexesGPU===void 0||p.indexesGPU.length!==x.length){let S=this.get(v),T=[],P=new Uint32Array([0,0,0,0]);for(let R=0,C=x.length;R<C;R++){P[0]=R;let{layoutGPU:L}=S.layout,D=this.bindingUtils.createBindGroupIndex(P,L);T.push(D)}p.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=x.length;S<T;S++){let P=x[S];if(n.layers.test(P.layers)){let R=P.viewport,C=o.currentPass,L=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let F=o.bundleEncoders[S],N=o.bundleSets[S];C=F,L=N}if(R&&!D&&C.setViewport(Math.floor(R.x*w),Math.floor(R.y*w),Math.floor(R.width*w),Math.floor(R.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),v&&p.indexesGPU){let F=u.indexOf(v);C.setBindGroup(F,p.indexesGPU[S]),L.bindingGroups[F]=v.id}this._draw(e,t,o,l,u,f,c,C,L)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let p=o.lastOcclusionObject;p!==n&&(p!==null&&p.occlusionTest===!0&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),n.occlusionTest===!0&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}this._draw(e,t,o,l,u,f,c,o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),c=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(n,r),f=n.isMesh&&n.matrixWorld.determinantAffine()<0,p=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==c||t.primitiveTopology!==u||t.frontFaceCW!==f||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=c,t.primitiveTopology=u,t.frontFaceCW=f,t.clippingContextCacheKey=e.clippingContextCacheKey,p=!0),p}getRenderCacheKey(e){let{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new JB(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);tM.querySet=r.querySet,tM.beginningOfPassWriteIndex=s,tM.endOfPassWriteIndex=s+1,n.timestampWrites=tM}createNodeBuilder(e,t){return new WB(e,t)}createProgram(e){let t=this.get(e);eM.label=e.stage+(e.name!==""?`_${e.name}`:""),eM.code=e.code,t.module={module:this.device.createShaderModule(eM),entryPoint:"main"},eM.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let n=e.byteLength,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&Ch.VERTEX&&s.push("vertex"),e.visibility&Ch.FRAGMENT&&s.push("fragment"),e.visibility&Ch.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;Tl.label=`bindingBuffer${e.id}_${e.name}_${o}`,Tl.size=n,Tl.usage=r;let a=this.device.createBuffer(Tl);Tl.reset(),t.buffer=a}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return gZ[e]!==void 0&&(e=gZ[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,c=0,u=0,f=0,p=0,x=e.image.width,v=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,p=n.min.z,x=n.max.x-n.min.x,v=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,x=n.max.x-n.min.x,v=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),ba.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(ba);ba.reset();let T=this.get(e).texture,P=this.get(t).texture;oc.texture=T,oc.mipLevel=s,oc.origin.x=u,oc.origin.y=f,oc.origin.z=p,xh.texture=P,xh.mipLevel=o,xh.origin.x=a,xh.origin.y=l,xh.origin.z=c,qf.width=x,qf.height=v,qf.depthOrArrayLayers=w,S.copyTextureToTexture(oc,xh,qf),oc.reset(),xh.reset(),qf.reset(),bh(this.device,S.finish()),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){let r=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let o=this.get(e).texture;if(s.format!==o.format){Ge("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):(ba.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(ba),ba.reset()),oc.texture=s,oc.origin.x=n.x,oc.origin.y=n.y,xh.texture=o,qf.width=n.z,qf.height=n.w,a.copyTextureToTexture(oc,xh,qf),oc.reset(),xh.reset(),qf.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){let{descriptor:l}=r;for(let c=0;c<l.colorAttachments.length;c++)l.colorAttachments[c].loadOp=Ei.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Ei.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Ei.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else bh(this.device,a.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},i7=class extends EA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},r7=class extends EA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},s7=class extends nC{constructor(){super(),this.addMaterial(CF,"MeshPhongMaterial"),this.addMaterial(DM,"MeshStandardMaterial"),this.addMaterial(OF,"MeshPhysicalMaterial"),this.addMaterial(UF,"MeshToonMaterial"),this.addMaterial(EF,"MeshBasicMaterial"),this.addMaterial(MF,"MeshLambertMaterial"),this.addMaterial(bF,"MeshNormalMaterial"),this.addMaterial(kF,"MeshMatcapMaterial"),this.addMaterial(xF,"LineBasicMaterial"),this.addMaterial(yF,"LineDashedMaterial"),this.addMaterial(zF,"PointsMaterial"),this.addMaterial(FM,"SpriteMaterial"),this.addMaterial(qF,"ShadowMaterial"),this.addLight(LO,qy),this.addLight(iB,MA),this.addLight(lB,Hy),this.addLight(fb,EA),this.addLight(nB,CA),this.addLight(rB,zy),this.addLight(oB,Wy),this.addLight(sB,i7),this.addLight(aB,r7),this.addToneMapping(eee,l2),this.addToneMapping(tee,c2),this.addToneMapping(nee,u2),this.addToneMapping(iee,h2),this.addToneMapping(ree,f2),this.addToneMapping(see,d2)}},D1=class extends gB{constructor(e={}){let t;e.forceWebGL?t=fC:(t=n7,e.getFallback=()=>(je("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new fC(e)));let n=new t(e);super(n,e),this.library=new s7,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var gJe=U.BRDF_GGX,_Je=U.BRDF_Lambert,xJe=U.BasicPointShadowFilter,yJe=U.BasicShadowFilter,vJe=U.Break,bJe=U.Const,wJe=U.Continue,SJe=U.DFGLUT,TJe=U.D_GGX,EJe=U.Discard,MJe=U.EPSILON,CJe=U.F_Schlick,Oee=U.Fn,RJe=U.INFINITY,Bee=U.If,Uee=U.Loop,PJe=U.NodeAccess,IJe=U.NodeShaderStage,NJe=U.NodeType,LJe=U.NodeUpdateType,DJe=U.PCFShadowFilter,FJe=U.PCFSoftShadowFilter,OJe=U.PI,BJe=U.PI2,UJe=U.TWO_PI,kJe=U.HALF_PI,GJe=U.PointShadowFilter,zJe=U.Return,VJe=U.Schlick_to_F0,qJe=U.ShaderNode,HJe=U.Stack,WJe=U.Switch,jJe=U.TBNViewMatrix,XJe=U.VSMShadowFilter,$Je=U.V_GGX_SmithCorrelated,YJe=U.Var,ZJe=U.VarIntent,KJe=U.abs,QJe=U.acesFilmicToneMapping,JJe=U.acos,eet=U.acosh,tet=U.add,net=U.addMethodChaining,iet=U.addNodeElement,ret=U.agxToneMapping,set=U.all,oet=U.alphaT,aet=U.ambientOcclusion,cet=U.and,uet=U.anisotropy,het=U.anisotropyB,fet=U.anisotropyT,det=U.any,pet=U.append,Aet=U.array,kee=U.asin,met=U.asinh,get=U.assign,_et=U.atan,xet=U.atanh,yet=U.atomicAdd,vet=U.atomicAnd,bet=U.atomicFunc,wet=U.atomicLoad,Tet=U.atomicMax,Eet=U.atomicMin,Met=U.atomicOr,Cet=U.atomicStore,Ret=U.atomicSub,Pet=U.atomicXor,Iet=U.attenuationColor,Net=U.attenuationDistance,Let=U.attribute,Det=U.attributeArray,Fet=U.backgroundBlurriness,Oet=U.backgroundIntensity,Bet=U.backgroundRotation,Uet=U.batch,ket=U.bentNormalView,Get=U.billboarding,zet=U.bitAnd,Vet=U.bitNot,qet=U.bitOr,Het=U.bitXor,Wet=U.bitangentGeometry,jet=U.bitangentLocal,Xet=U.bitangentView,$et=U.bitangentWorld,Yet=U.bitcast,Zet=U.blendBurn,Ket=U.blendColor,Qet=U.blendDodge,Jet=U.blendOverlay,ett=U.blendScreen,ttt=U.blur,ntt=U.bool,itt=U.buffer,rtt=U.bufferAttribute,stt=U.bumpMap,ott=U.builtin,att=U.builtinAOContext,ltt=U.builtinShadowContext,ctt=U.bvec2,utt=U.bvec3,htt=U.bvec4,ftt=U.bypass,dtt=U.cache,ptt=U.call,Att=U.cameraFar,mtt=U.cameraIndex,gtt=U.cameraNear,_tt=U.cameraNormalMatrix,xtt=U.cameraPosition,ytt=U.cameraProjectionMatrix,vtt=U.cameraProjectionMatrixInverse,btt=U.cameraViewMatrix,wtt=U.cameraViewport,Stt=U.cameraWorldMatrix,Ttt=U.cbrt,Ett=U.cdl,Mtt=U.ceil,Ctt=U.checker,Rtt=U.cineonToneMapping,Ptt=U.clamp,Itt=U.clearcoat,Ntt=U.clearcoatNormalView,Ltt=U.clearcoatRoughness,Dtt=U.clipSpace,Ftt=U.code,Ott=U.color,Btt=U.colorSpaceToWorking,Utt=U.colorToDirection,ktt=U.compute,Gtt=U.computeKernel,ztt=U.computeSkinning,Vtt=U.context,qtt=U.convert,Htt=U.convertColorSpace,Wtt=U.convertToTexture,jtt=U.countLeadingZeros,Xtt=U.countOneBits,$tt=U.countTrailingZeros,Gee=U.cos,Ytt=U.cosh,Ztt=U.cross,Ktt=U.cubeTexture,Qtt=U.cubeTextureBase,Jtt=U.dFdx,ent=U.dFdy,tnt=U.dashSize,nnt=U.debug,int=U.decrement,rnt=U.decrementBefore,snt=U.defaultBuildStages,ont=U.defaultShaderStages,ant=U.defined,lnt=U.degrees,cnt=U.deltaTime,unt=U.densityFog,hnt=U.densityFogFactor,fnt=U.depth,dnt=U.depthPass,pnt=U.determinant,Ant=U.difference,mnt=U.diffuseColor,gnt=U.directPointLight,_nt=U.directionToColor,xnt=U.directionToFaceDirection,ynt=U.dispersion,vnt=U.distance,bnt=U.div,wnt=U.dot,Snt=U.drawIndex,Tnt=U.dynamicBufferAttribute,Ent=U.element,Mnt=U.emissive,Cnt=U.equal,Rnt=U.equirectDirection,Pnt=U.equirectUV,zee=U.exp,Int=U.exp2,Nnt=U.exponentialHeightFogFactor,Lnt=U.expression,Dnt=U.faceDirection,Fnt=U.faceForward,Ont=U.faceforward,Vee=U.float,Bnt=U.floatBitsToInt,Unt=U.floatBitsToUint,knt=U.floor,Gnt=U.fog,znt=U.fract,Vnt=U.frameGroup,qnt=U.frameId,Hnt=U.frontFacing,Wnt=U.fwidth,jnt=U.gain,Xnt=U.gapSize,$nt=U.getConstNodeType,Ynt=U.getCurrentStack,Znt=U.getDirection,Knt=U.getDistanceAttenuation,Qnt=U.getGeometryRoughness,Jnt=U.getNormalFromDepth,eit=U.interleavedGradientNoise,tit=U.vogelDiskSample,nit=U.getParallaxCorrectNormal,iit=U.getRoughness,rit=U.getScreenPosition,sit=U.getShIrradianceAt,oit=U.getShadowMaterial,ait=U.getShadowRenderObjectFunction,lit=U.getTextureIndex,cit=U.getViewPosition,uit=U.globalId,hit=U.glsl,fit=U.glslFn,dit=U.grayscale,pit=U.greaterThan,Ait=U.greaterThanEqual,mit=U.hash,git=U.highpModelNormalViewMatrix,_it=U.highpModelViewMatrix,xit=U.hue,yit=U.increment,vit=U.incrementBefore,bit=U.instance,qee=U.instanceIndex,wit=U.instancedArray,Sit=U.instancedBufferAttribute,Tit=U.instancedDynamicBufferAttribute,Eit=U.instancedMesh,Mit=U.int,Cit=U.intBitsToFloat,Rit=U.inverse,Pit=U.inverseSqrt,Iit=U.inversesqrt,Nit=U.invocationLocalIndex,Lit=U.invocationSubgroupIndex,Dit=U.ior,Fit=U.iridescence,Oit=U.iridescenceIOR,Bit=U.iridescenceThickness,Uit=U.ivec2,kit=U.ivec3,Git=U.ivec4,zit=U.js,Vit=U.label,qit=U.length,Hit=U.lengthSq,Wit=U.lessThan,jit=U.lessThanEqual,Xit=U.lightPosition,$it=U.lightProjectionUV,Yit=U.lightShadowMatrix,Zit=U.lightTargetDirection,Kit=U.lightTargetPosition,Qit=U.lightViewPosition,Jit=U.lightingContext,ert=U.lights,trt=U.linearDepth,nrt=U.linearToneMapping,irt=U.localId,rrt=U.log,srt=U.log2,ort=U.logarithmicDepthToViewZ,art=U.luminance,lrt=U.mat2,crt=U.mat3,urt=U.mat4,hrt=U.matcapUV,frt=U.materialAO,drt=U.materialAlphaTest,prt=U.materialAnisotropy,Art=U.materialAnisotropyVector,mrt=U.materialAttenuationColor,grt=U.materialAttenuationDistance,_rt=U.materialClearcoat,xrt=U.materialClearcoatNormal,yrt=U.materialClearcoatRoughness,vrt=U.materialColor,brt=U.materialDispersion,wrt=U.materialEmissive,Srt=U.materialEnvIntensity,Trt=U.materialEnvRotation,Ert=U.materialIOR,Mrt=U.materialIridescence,Crt=U.materialIridescenceIOR,Rrt=U.materialIridescenceThickness,Prt=U.materialLightMap,Irt=U.materialLineDashOffset,Nrt=U.materialLineDashSize,Lrt=U.materialLineGapSize,Drt=U.materialLineScale,Frt=U.materialLineWidth,Ort=U.materialMetalness,Brt=U.materialNormal,Urt=U.materialOpacity,krt=U.materialPointSize,Grt=U.materialReference,zrt=U.materialReflectivity,Vrt=U.materialRefractionRatio,qrt=U.materialRotation,Hrt=U.materialRoughness,Wrt=U.materialSheen,jrt=U.materialSheenRoughness,Xrt=U.materialShininess,$rt=U.materialSpecular,Yrt=U.materialSpecularColor,Zrt=U.materialSpecularIntensity,Krt=U.materialSpecularStrength,Qrt=U.materialThickness,Jrt=U.materialTransmission,est=U.max,tst=U.maxMipLevel,nst=U.mediumpModelViewMatrix,ist=U.metalness,rst=U.min,sst=U.mix,ost=U.mixElement,ast=U.mod,lst=U.modelDirection,cst=U.modelNormalMatrix,ust=U.modelPosition,hst=U.modelRadius,fst=U.modelScale,dst=U.modelViewMatrix,pst=U.modelViewPosition,Ast=U.modelViewProjection,mst=U.modelWorldMatrix,gst=U.modelWorldMatrixInverse,_st=U.morphReference,xst=U.mrt,yst=U.mul,vst=U.mx_aastep,bst=U.mx_add,wst=U.mx_atan2,Sst=U.mx_cell_noise_float,Tst=U.mx_contrast,Est=U.mx_divide,Mst=U.mx_fractal_noise_float,Cst=U.mx_fractal_noise_vec2,Rst=U.mx_fractal_noise_vec3,Pst=U.mx_fractal_noise_vec4,Ist=U.mx_frame,Nst=U.mx_heighttonormal,Lst=U.mx_hsvtorgb,Dst=U.mx_ifequal,Fst=U.mx_ifgreater,Ost=U.mx_ifgreatereq,Bst=U.mx_invert,Ust=U.mx_modulo,kst=U.mx_multiply,Gst=U.mx_noise_float,zst=U.mx_noise_vec3,Vst=U.mx_noise_vec4,qst=U.mx_place2d,Hst=U.mx_power,Wst=U.mx_ramp4,jst=U.mx_ramplr,Xst=U.mx_ramptb,$st=U.mx_rgbtohsv,Yst=U.mx_rotate2d,Zst=U.mx_rotate3d,Kst=U.mx_safepower,Qst=U.mx_separate,Jst=U.mx_splitlr,eot=U.mx_splittb,tot=U.mx_srgb_texture_to_lin_rec709,not=U.mx_subtract,iot=U.mx_timer,rot=U.mx_transform_uv,sot=U.mx_unifiednoise2d,oot=U.mx_unifiednoise3d,aot=U.mx_worley_noise_float,lot=U.mx_worley_noise_vec2,cot=U.mx_worley_noise_vec3,Hee=U.negate,uot=U.negateOnBackSide,hot=U.neutralToneMapping,fot=U.nodeArray,dot=U.nodeImmutable,pot=U.nodeObject,Aot=U.nodeObjectIntent,mot=U.nodeObjects,got=U.nodeProxy,_ot=U.nodeProxyIntent,xot=U.normalFlat,yot=U.normalGeometry,vot=U.normalLocal,bot=U.normalMap,wot=U.normalView,Sot=U.normalViewGeometry,Tot=U.normalWorld,Eot=U.normalWorldGeometry,Mot=U.normalize,Cot=U.not,Rot=U.notEqual,Pot=U.numWorkgroups,Iot=U.objectDirection,Not=U.objectGroup,Lot=U.objectPosition,Dot=U.objectRadius,Fot=U.objectScale,Oot=U.objectViewPosition,Bot=U.objectWorldMatrix,Uot=U.OnBeforeObjectUpdate,kot=U.OnBeforeMaterialUpdate,Got=U.OnObjectUpdate,zot=U.OnMaterialUpdate,Vot=U.oneMinus,qot=U.or,Hot=U.orthographicDepthToViewZ,Wot=U.oscSawtooth,jot=U.oscSine,Xot=U.oscSquare,$ot=U.oscTriangle,Yot=U.output,Zot=U.outputStruct,Kot=U.overloadingFn,Qot=U.overrideNode,Jot=U.overrideNodes,eat=U.packHalf2x16,tat=U.packSnorm2x16,nat=U.packUnorm2x16,iat=U.packNormalToRGB,rat=U.parabola,sat=U.parallaxDirection,oat=U.parallaxUV,aat=U.parameter,lat=U.pass,cat=U.passTexture,uat=U.pcurve,hat=U.perspectiveDepthToViewZ,fat=U.pmremTexture,dat=U.pointShadow,pat=U.pointUV,Aat=U.pointWidth,mat=U.positionGeometry,gat=U.positionLocal,_at=U.positionPrevious,xat=U.positionView,yat=U.positionViewDirection,vat=U.positionWorld,bat=U.positionWorldDirection,wat=U.posterize,Sat=U.pow,Tat=U.pow2,Eat=U.pow3,Mat=U.pow4,Cat=U.premultiplyAlpha,Rat=U.property,Pat=U.radians,Iat=U.rand,Nat=U.range,Lat=U.rangeFog,Dat=U.rangeFogFactor,Fat=U.reciprocal,Oat=U.reference,Bat=U.referenceBuffer,Uat=U.reflect,kat=U.reflectVector,Gat=U.reflectView,zat=U.reflector,Vat=U.refract,qat=U.refractVector,Hat=U.refractView,Wat=U.reinhardToneMapping,jat=U.remap,Xat=U.remapClamp,$at=U.renderGroup,Yat=U.renderOutput,Zat=U.rendererReference,Kat=U.replaceDefaultUV,Qat=U.rotate,Jat=U.rotateUV,elt=U.roughness,tlt=U.round,nlt=U.rtt,ilt=U.sRGBTransferEOTF,rlt=U.sRGBTransferOETF,slt=U.sample,olt=U.sampler,alt=U.samplerComparison,llt=U.saturate,clt=U.saturation,ult=U.screen,hlt=U.screenCoordinate,flt=U.screenDPR,dlt=U.screenSize,plt=U.screenUV,Alt=U.select,mlt=U.setCurrentStack,glt=U.setName,_lt=U.shaderStages,xlt=U.shadow,ylt=U.shadowPositionWorld,vlt=U.shapeCircle,blt=U.sharedUniformGroup,wlt=U.sheen,Slt=U.sheenRoughness,Tlt=U.shiftLeft,Elt=U.shiftRight,Mlt=U.shininess,Clt=U.sign,Wee=U.sin,Rlt=U.sinh,Plt=U.sinc,Ilt=U.skinning,Nlt=U.smoothstep,Llt=U.smoothstepElement,Dlt=U.specularColor,Flt=U.specularF90,Olt=U.spherizeUV,Blt=U.split,Ult=U.spritesheetUV,jee=U.sqrt,klt=U.stack,Glt=U.step,zlt=U.stepElement,Xee=U.storage,Vlt=U.storageBarrier,qlt=U.storageTexture,Hlt=U.storageTexture3D,Wlt=U.struct,jlt=U.sub,Xlt=U.subgroupAdd,$lt=U.subgroupAll,Ylt=U.subgroupAnd,Zlt=U.subgroupAny,Klt=U.subgroupBallot,Qlt=U.subgroupBroadcast,Jlt=U.subgroupBroadcastFirst,ect=U.subBuild,tct=U.subgroupElect,nct=U.subgroupExclusiveAdd,ict=U.subgroupExclusiveMul,rct=U.subgroupInclusiveAdd,sct=U.subgroupInclusiveMul,oct=U.subgroupIndex,act=U.subgroupMax,lct=U.subgroupMin,cct=U.subgroupMul,uct=U.subgroupOr,hct=U.subgroupShuffle,fct=U.subgroupShuffleDown,dct=U.subgroupShuffleUp,pct=U.subgroupShuffleXor,Act=U.subgroupSize,mct=U.subgroupXor,gct=U.tan,_ct=U.tanh,xct=U.tangentGeometry,yct=U.tangentLocal,vct=U.tangentView,bct=U.tangentWorld,wct=U.texture,Sct=U.texture3D,Tct=U.textureBarrier,Ect=U.textureBicubic,Mct=U.textureBicubicLevel,Cct=U.textureCubeUV,Rct=U.textureLoad,Pct=U.textureSize,Ict=U.textureLevel,Nct=U.textureStore,Lct=U.thickness,Dct=U.time,Fct=U.toneMapping,Oct=U.toneMappingExposure,Bct=U.toonOutlinePass,Uct=U.transformDirection,kct=U.transformNormal,Gct=U.transformNormalByInverseViewMatrix,zct=U.transformNormalByViewMatrix,Vct=U.transformNormalToView,qct=U.transformedClearcoatNormalView,Hct=U.transformedNormalView,Wct=U.transformedNormalWorld,jct=U.transmission,Xct=U.transpose,$ct=U.triNoise3D,Yct=U.triplanarTexture,Zct=U.triplanarTextures,Kct=U.trunc,Qct=U.uint,Jct=U.uintBitsToFloat,$ee=U.uniform,eut=U.uniformArray,tut=U.uniformCubeTexture,nut=U.uniformGroup,iut=U.uniformFlow,rut=U.uniformTexture,sut=U.unpackHalf2x16,out=U.unpackSnorm2x16,aut=U.unpackUnorm2x16,lut=U.unpackRGBToNormal,cut=U.unpremultiplyAlpha,uut=U.userData,hut=U.uv,fut=U.uvec2,dut=U.uvec3,put=U.uvec4,Aut=U.varying,mut=U.varyingProperty,gut=U.vec2,_ut=U.vec3,xut=U.vec4,yut=U.vectorComponents,vut=U.velocity,but=U.vertexColor,wut=U.vertexIndex,Sut=U.vertexStage,Tut=U.vibrance,Eut=U.viewZToLogarithmicDepth,Mut=U.viewZToOrthographicDepth,Cut=U.viewZToPerspectiveDepth,Rut=U.viewZToReversedOrthographicDepth,Put=U.viewZToReversedPerspectiveDepth,Iut=U.viewport,Nut=U.viewportCoordinate,Lut=U.viewportDepthTexture,Dut=U.viewportLinearDepth,Fut=U.viewportMipTexture,Out=U.viewportOpaqueMipTexture,But=U.viewportResolution,Uut=U.viewportSafeUV,kut=U.viewportSharedTexture,Gut=U.viewportSize,zut=U.viewportTexture,Vut=U.viewportUV,qut=U.wgsl,Hut=U.wgslFn,Wut=U.workgroupArray,jut=U.workgroupBarrier,Xut=U.workgroupId,$ut=U.workingToColorSpace,Yut=U.xor;var Yee=new fa,ZC=new ie,G1=class extends jy{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new kn(e,3)),this.setAttribute("uv",new kn(t,2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Gu(t,6,1);return this.setAttribute("instanceStart",new mo(n,3,0)),this.setAttribute("instanceEnd",new mo(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Gu(t,6,1);return this.setAttribute("instanceColorStart",new mo(n,3,0)),this.setAttribute("instanceColorEnd",new mo(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Ly(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new fa);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Yee.setFromBufferAttribute(t),this.boundingBox.union(Yee))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ha),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)ZC.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ZC)),ZC.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(ZC));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}};Nt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Oe},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};ga.line={uniforms:VA.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`47044704 #include <common>47054705 #include <color_pars_vertex>47064706 #include <fog_pars_vertex>
@@ -5092,10 +5092,10 @@ var<${n}> ${e} : ${o};`}},jo=new o0,_8=new Dm,Lee=new Map([[Int8Array,["sint8","
50925092 #include <premultiplied_alpha_fragment>50935093 50945094 }5095- `};var h0=class extends jr{constructor(e){super({type:"LineMaterial",uniforms:zA.clone(ma.line.uniforms),vertexShader:ma.line.vertexShader,fragmentShader:ma.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};var LU=new gn,$ee=new ie,Yee=new ie,Mo=new gn,Co=new gn,Oh=new gn,DU=new ie,FU=new on,Ro=new $y,Kee=new ie,ZC=new ha,QC=new qa,Bh=new gn,Uh,Gm;function Zee(i,e,t){return Bh.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Bh.multiplyScalar(1/Bh.w),Bh.x=Gm/t.width,Bh.y=Gm/t.height,Bh.applyMatrix4(i.projectionMatrixInverse),Bh.multiplyScalar(1/Bh.w),Math.abs(Math.max(Bh.x,Bh.y))}function jTe(i,e){let t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){Ro.start.fromBufferAttribute(r,a),Ro.end.fromBufferAttribute(s,a),Ro.applyMatrix4(t);let c=new ie,u=new ie;Uh.distanceSqToSegment(Ro.start,Ro.end,u,c),u.distanceTo(c)<Gm*.5&&e.push({point:u,pointOnLine:c,distance:Uh.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function XTe(i,e,t){let n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),f=-e.near;Uh.at(1,Oh),Oh.w=1,Oh.applyMatrix4(e.matrixWorldInverse),Oh.applyMatrix4(n),Oh.multiplyScalar(1/Oh.w),Oh.x*=s.x/2,Oh.y*=s.y/2,Oh.z=0,DU.copy(Oh),FU.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,x=u;p<x;p++){if(Mo.fromBufferAttribute(l,p),Co.fromBufferAttribute(c,p),Mo.w=1,Co.w=1,Mo.applyMatrix4(FU),Co.applyMatrix4(FU),Mo.z>f&&Co.z>f)continue;if(Mo.z>f){let R=Mo.z-Co.z,C=(Mo.z-f)/R;Mo.lerp(Co,C)}else if(Co.z>f){let R=Co.z-Mo.z,C=(Co.z-f)/R;Co.lerp(Mo,C)}Mo.applyMatrix4(n),Co.applyMatrix4(n),Mo.multiplyScalar(1/Mo.w),Co.multiplyScalar(1/Co.w),Mo.x*=s.x/2,Mo.y*=s.y/2,Co.x*=s.x/2,Co.y*=s.y/2,Ro.start.copy(Mo),Ro.start.z=0,Ro.end.copy(Co),Ro.end.z=0;let w=Ro.closestPointToPointParameter(DU,!0);Ro.at(w,Kee);let S=Wc.lerp(Mo.z,Co.z,w),T=S>=-1&&S<=1,P=DU.distanceTo(Kee)<Gm*.5;if(T&&P){Ro.start.fromBufferAttribute(l,p),Ro.end.fromBufferAttribute(c,p),Ro.start.applyMatrix4(o),Ro.end.applyMatrix4(o);let R=new ie,C=new ie;Uh.distanceSqToSegment(Ro.start,Ro.end,C,R),t.push({point:C,pointOnLine:R,distance:Uh.origin.distanceTo(C),object:i,face:null,faceIndex:p,uv:null,uv1:null})}}}var JC=class extends Hn{constructor(e=new G1,t=new h0({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)$ee.fromBufferAttribute(t,o),Yee.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+$ee.distanceTo(Yee);let s=new Gu(r,2,1);return e.setAttribute("instanceDistanceStart",new mo(s,1,0)),e.setAttribute("instanceDistanceEnd",new mo(s,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),n===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;let s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Uh=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;Gm=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),QC.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=Gm*.5;else{let f=Math.max(r.near,QC.distanceToPoint(Uh.origin));c=Zee(r,f,l.resolution)}if(QC.radius+=c,Uh.intersectsSphere(QC)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),ZC.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=Gm*.5;else{let f=Math.max(r.near,ZC.distanceToPoint(Uh.origin));u=Zee(r,f,l.resolution)}ZC.expandByScalar(u),Uh.intersectsBox(ZC)!==!1&&(n?jTe(this,t):XTe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(LU),this.material.uniforms.resolution.value.set(LU.z,LU.w))}};var z1=class extends G1{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){let t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}};var eR=class extends JC{constructor(e=new z1,t=new h0({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var V1=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=$Te(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function $Te(i,e,t,n){let r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[],l=0,c=0;(n=="rtl"||n=="tb")&&r.reverse();for(let u=0;u<r.length;u++){let f=r[u];if(f===`5096-`)l=0,c-=o;else{let p=YTe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=p.offsetX,a.push(p.path)}}return a}function YTe(i,e,t,n,r){let s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}let o=new Yy,a,l,c,u,f,p,x,v;if(s.o){let w=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,T=w.length;S<T;)switch(w[S++]){case"m":a=w[S++]*e+t,l=w[S++]*e+n,o.moveTo(a,l);break;case"l":a=w[S++]*e+t,l=w[S++]*e+n,o.lineTo(a,l);break;case"q":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,p=w[S++]*e+n,o.quadraticCurveTo(f,p,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,p=w[S++]*e+n,x=w[S++]*e+t,v=w[S++]*e+n,o.bezierCurveTo(f,p,x,v,c,u);break}}return{offsetX:s.ha*e,path:o}}var Sb=class i extends Iy{constructor(e,t={}){let n=t.font;if(n===void 0)super();else{let r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}toJSON(){return super.toJSON()}static fromJSON(e){let t=e.options;return t.font=new V1(t.font.data),new i(t.text,t)}};function GU(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function KTe(i){if(Array.isArray(i))return i}function ZTe(i){if(Array.isArray(i))return GU(i)}function cte(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function QTe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Qee(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,r)}function JTe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Qee(s,n,r,o,a,"next",l)}function a(l){Qee(s,n,r,o,a,"throw",l)}o(void 0)})}}function aR(i,e,t){return e=j1(e),l3e(i,jU()?Reflect.construct(e,t||[],j1(i).constructor):e.apply(i,t))}function e3e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function lR(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Tb(i,e){return i.get(cte(i,e))}function OU(i,e,t){e3e(i,e),e.set(i,t)}function BU(i,e,t){return i.set(cte(i,e),t),t}function WU(i,e,t){if(jU())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function t3e(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,ute(n.key),n)}}function cR(i,e,t){return e&&t3e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function ro(i,e,t){return(e=ute(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function zU(){return zU=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=c3e(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},zU.apply(null,arguments)}function j1(i){return j1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j1(i)}function uR(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&qU(i,e)}function jU(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jU=function(){return!!i})()}function n3e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function i3e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function r3e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5097-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s3e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5098-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jee(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jee(Object(t),!0).forEach(function(n){ro(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Jee(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function o3e(i,e){if(i==null)return{};var t,n,r=a3e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function a3e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function l3e(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return QTe(i)}function VU(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(x,v,w,S){var T=v&&v.prototype instanceof a?v:a,P=Object.create(T.prototype);return Ll(P,"_invoke",(function(R,C,L){var D,F,N,B=0,z=L||[],V=!1,H={p:0,n:0,v:i,a:K,f:K.bind(i,4),d:function(J,j){return D=J,F=0,N=i,H.n=j,o}};function K(J,j){for(F=J,N=j,e=0;!V&&B&&!Z&&e<z.length;e++){var Z,ee=z[e],ae=H.p,ce=ee[2];J>3?(Z=ce===j)&&(N=ee[(F=ee[4])?5:(F=3,3)],ee[4]=ee[5]=i):ee[0]<=ae&&((Z=J<2&&ae<ee[1])?(F=0,H.v=j,H.n=ee[1]):ae<ce&&(Z=J<3||ee[0]>j||j>ce)&&(ee[4]=J,ee[5]=j,H.n=ce,F=0))}if(Z||J>1)return o;throw V=!0,j}return function(J,j,Z){if(B>1)throw TypeError("Generator is already running");for(V&&j===1&&K(j,Z),F=j,N=Z;(e=F<2?i:N)||!V;){D||(F?F<3?(F>1&&(H.n=-1),K(F,N)):H.n=N:H.v=N);try{if(B=2,D){if(F||(J="next"),e=D[J]){if(!(e=e.call(D,N)))throw TypeError("iterator result is not an object");if(!e.done)return e;N=e.value,F<2&&(F=0)}else F===1&&(e=D.return)&&e.call(D),F<2&&(N=TypeError("The iterator does not provide a '"+J+"' method"),F=1);D=i}else if((e=(V=H.n<0)?N:R.call(C,H))!==o)break}catch(ee){D=i,F=1,N=ee}finally{B=1}}return{value:e,done:V}}})(x,w,S),!0),P}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Ll(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function p(x){return Object.setPrototypeOf?Object.setPrototypeOf(x,c):(x.__proto__=c,Ll(x,r,"GeneratorFunction")),x.prototype=Object.create(f),x}return l.prototype=c,Ll(f,"constructor",c),Ll(c,"constructor",l),l.displayName="GeneratorFunction",Ll(c,r,"GeneratorFunction"),Ll(f),Ll(f,r,"Generator"),Ll(f,n,function(){return this}),Ll(f,"toString",function(){return"[object Generator]"}),(VU=function(){return{w:s,m:p}})()}function Ll(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ll=function(s,o,a,l){function c(u,f){Ll(s,u,function(p){return this._invoke(u,f,p)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(c("next",0),c("throw",1),c("return",2))},Ll(i,e,t,n)}function qU(i,e){return qU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},qU(i,e)}function Ar(i,e){return KTe(i)||i3e(i,e)||hte(i,e)||r3e()}function c3e(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=j1(i))!==null;);return i}function UU(i,e,t,n){var r=zU(j1(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function Vi(i){return ZTe(i)||n3e(i)||hte(i)||s3e()}function u3e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function ute(i){var e=u3e(i,"string");return typeof e=="symbol"?e:e+""}function hte(i,e){if(i){if(typeof i=="string")return GU(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?GU(i,e):void 0}}var fte=function(e){e instanceof Array?e.forEach(fte):(e.map&&e.map.dispose(),e.dispose())},p0=function(e){e.geometry&&e.geometry.dispose(),e.material&&fte(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(p0)},Br=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),p0(t)}};function Ca(i,e){var t=new e;return{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var rr=100;function ete(){return rr}function mc(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=rr*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function dte(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/rr-1}}function Vm(i){return i*Math.PI/180}var Mb=window.THREE?window.THREE:{BackSide:ui,BufferAttribute:Ni,Color:Ut,Mesh:Hn,ShaderMaterial:jr},h3e=`5095+ `};var h0=class extends jr{constructor(e){super({type:"LineMaterial",uniforms:VA.clone(ga.line.uniforms),vertexShader:ga.line.vertexShader,fragmentShader:ga.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};var DU=new gn,Zee=new ie,Kee=new ie,Mo=new gn,Co=new gn,Oh=new gn,FU=new ie,OU=new on,Ro=new $y,Qee=new ie,KC=new fa,QC=new Ha,Bh=new gn,Uh,zm;function Jee(i,e,t){return Bh.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Bh.multiplyScalar(1/Bh.w),Bh.x=zm/t.width,Bh.y=zm/t.height,Bh.applyMatrix4(i.projectionMatrixInverse),Bh.multiplyScalar(1/Bh.w),Math.abs(Math.max(Bh.x,Bh.y))}function YTe(i,e){let t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){Ro.start.fromBufferAttribute(r,a),Ro.end.fromBufferAttribute(s,a),Ro.applyMatrix4(t);let c=new ie,u=new ie;Uh.distanceSqToSegment(Ro.start,Ro.end,u,c),u.distanceTo(c)<zm*.5&&e.push({point:u,pointOnLine:c,distance:Uh.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function ZTe(i,e,t){let n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),f=-e.near;Uh.at(1,Oh),Oh.w=1,Oh.applyMatrix4(e.matrixWorldInverse),Oh.applyMatrix4(n),Oh.multiplyScalar(1/Oh.w),Oh.x*=s.x/2,Oh.y*=s.y/2,Oh.z=0,FU.copy(Oh),OU.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,x=u;p<x;p++){if(Mo.fromBufferAttribute(l,p),Co.fromBufferAttribute(c,p),Mo.w=1,Co.w=1,Mo.applyMatrix4(OU),Co.applyMatrix4(OU),Mo.z>f&&Co.z>f)continue;if(Mo.z>f){let R=Mo.z-Co.z,C=(Mo.z-f)/R;Mo.lerp(Co,C)}else if(Co.z>f){let R=Co.z-Mo.z,C=(Co.z-f)/R;Co.lerp(Mo,C)}Mo.applyMatrix4(n),Co.applyMatrix4(n),Mo.multiplyScalar(1/Mo.w),Co.multiplyScalar(1/Co.w),Mo.x*=s.x/2,Mo.y*=s.y/2,Co.x*=s.x/2,Co.y*=s.y/2,Ro.start.copy(Mo),Ro.start.z=0,Ro.end.copy(Co),Ro.end.z=0;let w=Ro.closestPointToPointParameter(FU,!0);Ro.at(w,Qee);let S=Wc.lerp(Mo.z,Co.z,w),T=S>=-1&&S<=1,P=FU.distanceTo(Qee)<zm*.5;if(T&&P){Ro.start.fromBufferAttribute(l,p),Ro.end.fromBufferAttribute(c,p),Ro.start.applyMatrix4(o),Ro.end.applyMatrix4(o);let R=new ie,C=new ie;Uh.distanceSqToSegment(Ro.start,Ro.end,C,R),t.push({point:C,pointOnLine:R,distance:Uh.origin.distanceTo(C),object:i,face:null,faceIndex:p,uv:null,uv1:null})}}}var JC=class extends Hn{constructor(e=new G1,t=new h0({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)Zee.fromBufferAttribute(t,o),Kee.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Zee.distanceTo(Kee);let s=new Gu(r,2,1);return e.setAttribute("instanceDistanceStart",new mo(s,1,0)),e.setAttribute("instanceDistanceEnd",new mo(s,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),n===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;let s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Uh=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;zm=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),QC.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=zm*.5;else{let f=Math.max(r.near,QC.distanceToPoint(Uh.origin));c=Jee(r,f,l.resolution)}if(QC.radius+=c,Uh.intersectsSphere(QC)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),KC.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=zm*.5;else{let f=Math.max(r.near,KC.distanceToPoint(Uh.origin));u=Jee(r,f,l.resolution)}KC.expandByScalar(u),Uh.intersectsBox(KC)!==!1&&(n?YTe(this,t):ZTe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(DU),this.material.uniforms.resolution.value.set(DU.z,DU.w))}};var z1=class extends G1{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){let t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}};var eR=class extends JC{constructor(e=new z1,t=new h0({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var V1=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=KTe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function KTe(i,e,t,n){let r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[],l=0,c=0;(n=="rtl"||n=="tb")&&r.reverse();for(let u=0;u<r.length;u++){let f=r[u];if(f===`5096+`)l=0,c-=o;else{let p=QTe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=p.offsetX,a.push(p.path)}}return a}function QTe(i,e,t,n,r){let s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}let o=new Yy,a,l,c,u,f,p,x,v;if(s.o){let w=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,T=w.length;S<T;)switch(w[S++]){case"m":a=w[S++]*e+t,l=w[S++]*e+n,o.moveTo(a,l);break;case"l":a=w[S++]*e+t,l=w[S++]*e+n,o.lineTo(a,l);break;case"q":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,p=w[S++]*e+n,o.quadraticCurveTo(f,p,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,p=w[S++]*e+n,x=w[S++]*e+t,v=w[S++]*e+n,o.bezierCurveTo(f,p,x,v,c,u);break}}return{offsetX:s.ha*e,path:o}}var Sb=class i extends Iy{constructor(e,t={}){let n=t.font;if(n===void 0)super();else{let r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}toJSON(){return super.toJSON()}static fromJSON(e){let t=e.options;return t.font=new V1(t.font.data),new i(t.text,t)}};function zU(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function JTe(i){if(Array.isArray(i))return i}function e3e(i){if(Array.isArray(i))return zU(i)}function hte(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function t3e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ete(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,r)}function n3e(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){ete(s,n,r,o,a,"next",l)}function a(l){ete(s,n,r,o,a,"throw",l)}o(void 0)})}}function aR(i,e,t){return e=j1(e),h3e(i,XU()?Reflect.construct(e,t||[],j1(i).constructor):e.apply(i,t))}function i3e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function lR(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Tb(i,e){return i.get(hte(i,e))}function BU(i,e,t){i3e(i,e),e.set(i,t)}function UU(i,e,t){return i.set(hte(i,e),t),t}function jU(i,e,t){if(XU())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function r3e(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,fte(n.key),n)}}function cR(i,e,t){return e&&r3e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function ro(i,e,t){return(e=fte(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function VU(){return VU=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=f3e(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},VU.apply(null,arguments)}function j1(i){return j1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j1(i)}function uR(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&HU(i,e)}function XU(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XU=function(){return!!i})()}function s3e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function o3e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function a3e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5097+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l3e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5098+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tte(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tte(Object(t),!0).forEach(function(n){ro(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):tte(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function c3e(i,e){if(i==null)return{};var t,n,r=u3e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function u3e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function h3e(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return t3e(i)}function qU(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(x,v,w,S){var T=v&&v.prototype instanceof a?v:a,P=Object.create(T.prototype);return Ll(P,"_invoke",(function(R,C,L){var D,F,N,B=0,z=L||[],V=!1,H={p:0,n:0,v:i,a:Z,f:Z.bind(i,4),d:function(J,j){return D=J,F=0,N=i,H.n=j,o}};function Z(J,j){for(F=J,N=j,e=0;!V&&B&&!K&&e<z.length;e++){var K,ee=z[e],ae=H.p,ce=ee[2];J>3?(K=ce===j)&&(N=ee[(F=ee[4])?5:(F=3,3)],ee[4]=ee[5]=i):ee[0]<=ae&&((K=J<2&&ae<ee[1])?(F=0,H.v=j,H.n=ee[1]):ae<ce&&(K=J<3||ee[0]>j||j>ce)&&(ee[4]=J,ee[5]=j,H.n=ce,F=0))}if(K||J>1)return o;throw V=!0,j}return function(J,j,K){if(B>1)throw TypeError("Generator is already running");for(V&&j===1&&Z(j,K),F=j,N=K;(e=F<2?i:N)||!V;){D||(F?F<3?(F>1&&(H.n=-1),Z(F,N)):H.n=N:H.v=N);try{if(B=2,D){if(F||(J="next"),e=D[J]){if(!(e=e.call(D,N)))throw TypeError("iterator result is not an object");if(!e.done)return e;N=e.value,F<2&&(F=0)}else F===1&&(e=D.return)&&e.call(D),F<2&&(N=TypeError("The iterator does not provide a '"+J+"' method"),F=1);D=i}else if((e=(V=H.n<0)?N:R.call(C,H))!==o)break}catch(ee){D=i,F=1,N=ee}finally{B=1}}return{value:e,done:V}}})(x,w,S),!0),P}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Ll(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function p(x){return Object.setPrototypeOf?Object.setPrototypeOf(x,c):(x.__proto__=c,Ll(x,r,"GeneratorFunction")),x.prototype=Object.create(f),x}return l.prototype=c,Ll(f,"constructor",c),Ll(c,"constructor",l),l.displayName="GeneratorFunction",Ll(c,r,"GeneratorFunction"),Ll(f),Ll(f,r,"Generator"),Ll(f,n,function(){return this}),Ll(f,"toString",function(){return"[object Generator]"}),(qU=function(){return{w:s,m:p}})()}function Ll(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ll=function(s,o,a,l){function c(u,f){Ll(s,u,function(p){return this._invoke(u,f,p)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(c("next",0),c("throw",1),c("return",2))},Ll(i,e,t,n)}function HU(i,e){return HU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},HU(i,e)}function Ar(i,e){return JTe(i)||o3e(i,e)||dte(i,e)||a3e()}function f3e(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=j1(i))!==null;);return i}function kU(i,e,t,n){var r=VU(j1(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function Vi(i){return e3e(i)||s3e(i)||dte(i)||l3e()}function d3e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function fte(i){var e=d3e(i,"string");return typeof e=="symbol"?e:e+""}function dte(i,e){if(i){if(typeof i=="string")return zU(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?zU(i,e):void 0}}var pte=function(e){e instanceof Array?e.forEach(pte):(e.map&&e.map.dispose(),e.dispose())},p0=function(e){e.geometry&&e.geometry.dispose(),e.material&&pte(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(p0)},Br=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),p0(t)}};function Ra(i,e){var t=new e;return{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var rr=100;function nte(){return rr}function mc(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=rr*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function Ate(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/rr-1}}function qm(i){return i*Math.PI/180}var Mb=window.THREE?window.THREE:{BackSide:ui,BufferAttribute:Ni,Color:Ut,Mesh:Hn,ShaderMaterial:jr},p3e=`50995099 uniform float hollowRadius;51005100 51015101 varying vec3 vVertexWorldPosition;
@@ -5115,7 +5115,7 @@ void main() {
51155115 vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle;51165116 51175117 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);5118-}`,f3e=`5118+}`,A3e=`51195119 uniform vec3 color;51205120 uniform float coefficient;51215121 uniform float power;
@@ -5138,7 +5138,7 @@ void main() {
51385138 power51395139 );51405140 gl_FragColor = vec4(color, intensity);5141-}`;function d3e(i,e,t,n){return new Mb.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:h3e,fragmentShader:f3e,uniforms:{coefficient:{value:i},color:{value:new Mb.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function p3e(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new Mb.BufferAttribute(n,3)),t}var A3e=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,c=r.coefficient,u=c===void 0?.5:c,f=r.power,p=f===void 0?1:f,x=r.hollowRadius,v=x===void 0?0:x,w=r.backside,S=w===void 0?!0:w;lR(this,e),n=aR(this,e);var T=p3e(t,l),P=d3e(u,o,p,v);return S&&(P.side=Mb.BackSide),n.geometry=T,n.material=P,n}return uR(e,i),cR(e)})(Mb.Mesh),kh=window.THREE?window.THREE:{Color:Ut,Group:_s,LineBasicMaterial:kc,LineSegments:d_,Mesh:Hn,MeshPhongMaterial:SA,SphereGeometry:da,SRGBColorSpace:Wr,TextureLoader:zc},pte=Nr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){p0(e.globeObj),p0(e.tileEngine),p0(e.graticulesObj)}},stateInit:function(){var e=new kh.MeshPhongMaterial({color:0}),t=new kh.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new jX(rr),r=new kh.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new kh.LineSegments(new c6(DD(),rr,2),new kh.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){Br(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new kh.SphereGeometry(rr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new kh.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=kh.SRGBColorSpace,(l=n.map)===null||l===void 0||l.dispose(),n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new kh.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new kh.TextureLoader().load(e.bumpImageUrl,function(a){var l;(l=n.bumpMap)===null||l===void 0||l.dispose(),n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),p0(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new A3e(e.globeObj.geometry,{color:e.atmosphereColor,size:rr*e.atmosphereAltitude,hollowRadius:rr,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Gh=function(e){return isNaN(e)?parseInt(dn(e).toHex(),16):e},uu=function(e){return e&&isNaN(e)?Xc(e).opacity:1},A0=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=Ar(a,4),c=l[0],u=l[1],f=l[2],p=l[3];r=new Ut("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+p,1)}else r=new Ut(e);n&&r.convertLinearToSRGB();var x=r.toArray();return t?[].concat(Vi(x),[s]):x};function m3e(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var tte=window.THREE?window.THREE:{BufferAttribute:Ni};function zh(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new tte.BufferAttribute(new t(i),e);for(var n=new tte.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function g3e(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var kU=new WeakMap,tR=new WeakMap,nR=new WeakMap,Ja=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,c=r.removeDelay,u=c===void 0?0:c;return lR(this,e),n=aR(this,e),ro(n,"scene",void 0),OU(n,kU,void 0),OU(n,tR,void 0),OU(n,nR,void 0),n.scene=t,BU(kU,n,o),BU(tR,n,l),BU(nR,n,u),n.onRemoveObj(function(){}),n}return uR(e,i),cR(e,[{key:"onCreateObj",value:function(n){var r=this;return UU(e,"onCreateObj",this)([function(s){var o=n(s);return s[Tb(tR,r)]=o,o[Tb(kU,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return UU(e,"onRemoveObj",this)([function(s,o){var a=UU(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),p0(s),delete a[Tb(tR,r)]};Tb(nR,r)?setTimeout(l,Tb(nR,r)):l()}]),this}}])})(p$),au=window.THREE?window.THREE:{BufferGeometry:Zn,CylinderGeometry:yA,Matrix4:on,Mesh:Hn,MeshLambertMaterial:pa,Object3D:$i,Vector3:ie},nte=Object.assign({},av),ite=nte.BufferGeometryUtils||nte,Ate=Nr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=rt(e.pointLat),r=rt(e.pointLng),s=rt(e.pointAltitude),o=rt(e.pointRadius),a=rt(e.pointColor),l=new au.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new au.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new au.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*rr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&Br(e.scene),e.dataMapper.scene=e.pointsMerge?new au.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(v).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(ite.mergeGeometries||ite.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var P=A0(a(w));return T.setAttribute("color",zh(Array(T.getAttribute("position").count).fill(P),4)),T})):new au.BufferGeometry,p=new au.Mesh(f,new au.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));p.__globeObjType="points",p.__data=e.pointsData,e.dataMapper.clear(),Br(e.scene),e.scene.add(p)}function x(){var w=new au.Mesh(l);return w.__globeObjType="point",w}function v(w,S){var T=function(N){var B=w.__currentTargetD=N,z=B.r,V=B.alt,H=B.lat,K=B.lng;Object.assign(w.position,mc(H,K));var J=e.pointsMerge?new au.Vector3(0,0,0):e.scene.localToWorld(new au.Vector3(0,0,0));w.lookAt(J),w.scale.x=w.scale.y=Math.min(30,z)*c,w.scale.z=Math.max(V*rr,.1)},P={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},R=w.__currentTargetD||Object.assign({},P,{alt:-.001});if(Object.keys(P).some(function(F){return R[F]!==P[F]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(P):e.tweenGroup.add(new Vs(R).to(P,e.pointsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var C=a(S),L=C?uu(C):0,D=!!L;w.visible=D,D&&(u.hasOwnProperty(C)||(u[C]=new au.MeshLambertMaterial({color:Gh(C),transparent:L<1,opacity:L})),w.material=u[C])}}}}),mte=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5141+}`;function m3e(i,e,t,n){return new Mb.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:p3e,fragmentShader:A3e,uniforms:{coefficient:{value:i},color:{value:new Mb.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function g3e(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new Mb.BufferAttribute(n,3)),t}var _3e=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,c=r.coefficient,u=c===void 0?.5:c,f=r.power,p=f===void 0?1:f,x=r.hollowRadius,v=x===void 0?0:x,w=r.backside,S=w===void 0?!0:w;lR(this,e),n=aR(this,e);var T=g3e(t,l),P=m3e(u,o,p,v);return S&&(P.side=Mb.BackSide),n.geometry=T,n.material=P,n}return uR(e,i),cR(e)})(Mb.Mesh),kh=window.THREE?window.THREE:{Color:Ut,Group:xs,LineBasicMaterial:kc,LineSegments:d_,Mesh:Hn,MeshPhongMaterial:TA,SphereGeometry:pa,SRGBColorSpace:Wr,TextureLoader:zc},mte=Nr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){p0(e.globeObj),p0(e.tileEngine),p0(e.graticulesObj)}},stateInit:function(){var e=new kh.MeshPhongMaterial({color:0}),t=new kh.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new $X(rr),r=new kh.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new kh.LineSegments(new u6(FD(),rr,2),new kh.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){Br(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new kh.SphereGeometry(rr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new kh.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=kh.SRGBColorSpace,(l=n.map)===null||l===void 0||l.dispose(),n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new kh.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new kh.TextureLoader().load(e.bumpImageUrl,function(a){var l;(l=n.bumpMap)===null||l===void 0||l.dispose(),n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),p0(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new _3e(e.globeObj.geometry,{color:e.atmosphereColor,size:rr*e.atmosphereAltitude,hollowRadius:rr,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Gh=function(e){return isNaN(e)?parseInt(dn(e).toHex(),16):e},uu=function(e){return e&&isNaN(e)?Xc(e).opacity:1},A0=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=Ar(a,4),c=l[0],u=l[1],f=l[2],p=l[3];r=new Ut("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+p,1)}else r=new Ut(e);n&&r.convertLinearToSRGB();var x=r.toArray();return t?[].concat(Vi(x),[s]):x};function x3e(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var ite=window.THREE?window.THREE:{BufferAttribute:Ni};function zh(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new ite.BufferAttribute(new t(i),e);for(var n=new ite.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function y3e(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var GU=new WeakMap,tR=new WeakMap,nR=new WeakMap,el=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,c=r.removeDelay,u=c===void 0?0:c;return lR(this,e),n=aR(this,e),ro(n,"scene",void 0),BU(n,GU,void 0),BU(n,tR,void 0),BU(n,nR,void 0),n.scene=t,UU(GU,n,o),UU(tR,n,l),UU(nR,n,u),n.onRemoveObj(function(){}),n}return uR(e,i),cR(e,[{key:"onCreateObj",value:function(n){var r=this;return kU(e,"onCreateObj",this)([function(s){var o=n(s);return s[Tb(tR,r)]=o,o[Tb(GU,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return kU(e,"onRemoveObj",this)([function(s,o){var a=kU(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),p0(s),delete a[Tb(tR,r)]};Tb(nR,r)?setTimeout(l,Tb(nR,r)):l()}]),this}}])})(m$),au=window.THREE?window.THREE:{BufferGeometry:Kn,CylinderGeometry:vA,Matrix4:on,Mesh:Hn,MeshLambertMaterial:Aa,Object3D:$i,Vector3:ie},rte=Object.assign({},av),ste=rte.BufferGeometryUtils||rte,gte=Nr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=rt(e.pointLat),r=rt(e.pointLng),s=rt(e.pointAltitude),o=rt(e.pointRadius),a=rt(e.pointColor),l=new au.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new au.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new au.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*rr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&Br(e.scene),e.dataMapper.scene=e.pointsMerge?new au.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(v).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(ste.mergeGeometries||ste.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var P=A0(a(w));return T.setAttribute("color",zh(Array(T.getAttribute("position").count).fill(P),4)),T})):new au.BufferGeometry,p=new au.Mesh(f,new au.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));p.__globeObjType="points",p.__data=e.pointsData,e.dataMapper.clear(),Br(e.scene),e.scene.add(p)}function x(){var w=new au.Mesh(l);return w.__globeObjType="point",w}function v(w,S){var T=function(N){var B=w.__currentTargetD=N,z=B.r,V=B.alt,H=B.lat,Z=B.lng;Object.assign(w.position,mc(H,Z));var J=e.pointsMerge?new au.Vector3(0,0,0):e.scene.localToWorld(new au.Vector3(0,0,0));w.lookAt(J),w.scale.x=w.scale.y=Math.min(30,z)*c,w.scale.z=Math.max(V*rr,.1)},P={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},R=w.__currentTargetD||Object.assign({},P,{alt:-.001});if(Object.keys(P).some(function(F){return R[F]!==P[F]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(P):e.tweenGroup.add(new Vs(R).to(P,e.pointsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var C=a(S),L=C?uu(C):0,D=!!L;w.visible=D,D&&(u.hasOwnProperty(C)||(u[C]=new au.MeshLambertMaterial({color:Gh(C),transparent:L<1,opacity:L})),w.material=u[C])}}}}),_te=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`51425142 `.concat(Fn.common,`51435143 `).concat(Fn.logdepthbuf_pars_vertex,`51445144
@@ -5178,7 +5178,7 @@ void main() {
51785178 51795179 `).concat(Fn.logdepthbuf_fragment,`51805180 }5181- `)}},HU=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;5181+ `)}},WU=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;51825182 varying float vSurfaceRadius;51835183 varying vec3 vPos;51845184 `+e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join(`
@@ -5186,7 +5186,7 @@ varying vec3 vPos;
51865186 varying float vSurfaceRadius;51875187 varying vec3 vPos;51885188 `+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join(`5189-`)),e},_3e=function(e){return e.vertexShader=`5189+`)),e},v3e=function(e){return e.vertexShader=`51905190 attribute float r;51915191 51925192 const float PI = 3.1415926535897932384626433832795;
@@ -5219,7 +5219,7 @@ varying vec3 vPos;
52195219 gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);52205220 }52215221 `),`5222- `),e},XU=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},x3e=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},y3e=["stroke"],lu=window.THREE?window.THREE:{BufferGeometry:Zn,CubicBezierCurve3:g_,Curve:fa,Group:_s,Line:jd,Mesh:Hn,NormalBlending:rs,ShaderMaterial:jr,TubeGeometry:Ny,Vector3:ie},v3e=qm.default.default||qm.default,gte=Nr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new v3e,sharedMaterial:new lu.ShaderMaterial(Oi(Oi({},mte()),{},{transparent:!0,blending:lu.NormalBlending}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new lu.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ar(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=rt(e.arcStartLat),n=rt(e.arcStartLng),r=rt(e.arcStartAltitude),s=rt(e.arcEndLat),o=rt(e.arcEndLng),a=rt(e.arcEndAltitude),l=rt(e.arcAltitude),c=rt(e.arcAltitudeAutoScale),u=rt(e.arcStroke),f=rt(e.arcColor),p=rt(e.arcDashLength),x=rt(e.arcDashGap),v=rt(e.arcDashInitialGap),w=rt(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(R,C){var L=u(C),D=L!=null;if(!R.children.length||D!==(R.children[0].type==="Mesh")){Br(R);var F=D?new lu.Mesh:new lu.Line(new lu.BufferGeometry);F.material=e.sharedMaterial.clone(),R.add(F)}var N=R.children[0];Object.assign(N.material.uniforms,{dashSize:{value:p(C)},gapSize:{value:x(C)},dashOffset:{value:v(C)}});var B=w(C);N.__dashAnimateStep=B>0?1e3/B:0;var z=T(f(C),e.arcCurveResolution,D?e.arcCircularResolution+1:1),V=P(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V);var H=function(Z){var ee=R.__currentTargetD=Z,ae=ee.stroke,ce=o3e(ee,y3e),de=S(ce);D?(N.geometry&&N.geometry.dispose(),N.geometry=new lu.TubeGeometry(de,e.arcCurveResolution,ae/2,e.arcCircularResolution),N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V)):N.geometry.setFromPoints(de.getPoints(e.arcCurveResolution))},K={stroke:L,alt:l(C),altAutoScale:+c(C),startLat:+t(C),startLng:+n(C),startAlt:+r(C),endLat:+s(C),endLng:+o(C),endAlt:+a(C)},J=R.__currentTargetD||Object.assign({},K,{altAutoScale:-.001});Object.keys(K).some(function(j){return J[j]!==K[j]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?H(K):e.tweenGroup.add(new Vs(J).to(K,e.arcsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(R){var C=R.alt,L=R.altAutoScale,D=R.startLat,F=R.startLng,N=R.startAlt,B=R.endLat,z=R.endLng,V=R.endAlt,H=function(Me){var ze=Ar(Me,3),$e=ze[0],Et=ze[1],Tt=ze[2],Ct=mc(Et,$e,Tt),un=Ct.x,Gt=Ct.y,Xe=Ct.z;return new lu.Vector3(un,Gt,Xe)},K=[F,D],J=[z,B],j=C;if(j==null&&(j=$a(K,J)/2*L+Math.max(N,V)),j||N||V){var Z=em(K,J),ee=function(Me,ze){return ze+(ze-Me)*(Me<ze?.5:.25)},ae=[.25,.75].map(function(mt){return[].concat(Vi(Z(mt)),[ee(mt<.5?N:V,j)])}),ce=Ar(ae,2),de=ce[0],ve=ce[1],Ie=WU(lu.CubicBezierCurve3,Vi([[].concat(K,[N]),de,ve,[].concat(J,[V])].map(H)));return Ie}else{var Qe=.001;return Ue.apply(void 0,Vi([[].concat(K,[Qe]),[].concat(J,[Qe])].map(H)))}function Ue(mt,Me){var ze=mt.angleTo(Me),$e=ze===0?function(){return mt.clone()}:function(Tt){return new lu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Tt)*ze)),Me.clone().multiplyScalar(Math.sin(Tt*ze))).divideScalar(Math.sin(ze))},Et=new lu.Curve;return Et.getPoint=$e,Et}}function T(R,C){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=C+1,F;if(R instanceof Array||R instanceof Function){var N=R instanceof Array?ja().domain(R.map(function(j,Z){return Z/(R.length-1)})).range(R):R;F=function(Z){return A0(N(Z),!0,!0)}}else{var B=A0(R,!0,!0);F=function(){return B}}for(var z=[],V=0,H=D;V<H;V++)for(var K=F(V/(H-1)),J=0;J<L;J++)z.push(K);return zh(z,4)}function P(R){for(var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=R+1,F=[],N=0,B=D;N<B;N++)for(var z=N/(B-1),V=0;V<C;V++)F.push(z);return L&&F.reverse(),zh(F,1)}}}),f0=window.THREE?window.THREE:{BufferGeometry:Zn,DoubleSide:ir,Mesh:Hn,MeshLambertMaterial:pa,Object3D:$i},rte=Object.assign({},av),ste=rte.BufferGeometryUtils||rte,_te=Nr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=rt(e.hexBinPointLat),r=rt(e.hexBinPointLng),s=rt(e.hexBinPointWeight),o=rt(e.hexAltitude),a=rt(e.hexTopColor),l=rt(e.hexSideColor),c=rt(e.hexMargin),u=F$(e.hexBinPointsData.map(function(P){return Oi(Oi({},P),{},{h3Idx:$$(n(P),r(P),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(P){var R=Ar(P,2),C=R[0],L=R[1];return{h3Idx:C,points:L,sumWeight:L.reduce(function(D,F){return D+ +s(F)},0)}}),p={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&Br(e.scene),e.dataMapper.scene=e.hexBinMerge?new f0.Object3D:e.scene,e.dataMapper.id(function(P){return P.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var x=f.length?(ste.mergeGeometries||ste.mergeBufferGeometries)(f.map(function(P){var R=e.dataMapper.getObj(P),C=R.geometry.toNonIndexed();R.updateMatrix(),C.applyMatrix4(R.matrix);var L=A0(a(P)),D=A0(l(P)),F=C.getAttribute("position").count,N=C.groups[0].count;return C.setAttribute("color",zh(Vi(new Array(F)).map(function(B,z){return z>=N?L:D}),4)),C})):new f0.BufferGeometry,v=new f0.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:f0.DoubleSide});v.onBeforeCompile=function(P){v.userData.shader=HU(P)};var w=new f0.Mesh(x,v);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),Br(e.scene),e.scene.add(w)}function S(P){var R=new f0.Mesh;R.__hexCenter=I6(P.h3Idx),R.__hexGeoJson=N6(P.h3Idx,!0).reverse();var C=R.__hexCenter[1];return R.__hexGeoJson.forEach(function(L){var D=L[0];Math.abs(C-D)>170&&(L[0]+=C>D?360:-360)}),R.__globeObjType="hexbin",R}function T(P,R){var C=function(ee,ae,ce){return ee-(ee-ae)*ce},L=Math.max(0,Math.min(1,+c(R))),D=Ar(P.__hexCenter,2),F=D[0],N=D[1],B=L===0?P.__hexGeoJson:P.__hexGeoJson.map(function(Z){var ee=Ar(Z,2),ae=ee[0],ce=ee[1];return[[ae,N],[ce,F]].map(function(de){var ve=Ar(de,2),Ie=ve[0],Qe=ve[1];return C(Ie,Qe,L)})}),z=e.hexTopCurvatureResolution;P.geometry&&P.geometry.dispose(),P.geometry=new AE([B],0,rr,!1,!0,!0,z);var V={alt:+o(R)},H=function(ee){var ae=P.__currentTargetD=ee,ce=ae.alt;P.scale.x=P.scale.y=P.scale.z=1+ce;var de=rr/(ce+1);P.geometry.setAttribute("surfaceRadius",zh(Array(P.geometry.getAttribute("position").count).fill(de),1))},K=P.__currentTargetD||Object.assign({},V,{alt:-.001});if(Object.keys(V).some(function(Z){return K[Z]!==V[Z]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?H(V):e.tweenGroup.add(new Vs(K).to(V,e.hexTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var J=l(R),j=a(R);[J,j].forEach(function(Z){if(!p.hasOwnProperty(Z)){var ee=uu(Z);p[Z]=XU(new f0.MeshLambertMaterial({color:Gh(Z),transparent:ee<1,opacity:ee,side:f0.DoubleSide}),HU)}}),P.material=[J,j].map(function(Z){return p[Z]})}}}}),xte=function(e){return e*e},ed=function(e){return e*Math.PI/180};function b3e(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return xte(Math.sin(u/2))},s=ed(i[1]),o=ed(e[1]),a=ed(i[0]),l=ed(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var w3e=Math.sqrt(2*Math.PI);function S3e(i,e){return Math.exp(-xte(i/e)/2)/(e*w3e)}var T3e=function(e){var t=Ar(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,c=o.latAccessor,u=c===void 0?function(S){return S[1]}:c,f=o.weightAccessor,p=f===void 0?function(){return 1}:f,x=o.bandwidth,v=[n,r],w=x*Math.PI/180;return h3(s.map(function(S){var T=p(S);if(!T)return 0;var P=b3e(v,[l(S),u(S)]);return S3e(P,w)*T}))},E3e=(function(){var i=JTe(VU().m(function e(t){var n,r,s,o,a,l,c,u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B,z,V,H,K,J,j,Z,ee,ae,ce,de,ve,Ie,Qe,Ue,mt,Me,ze=arguments,$e,Et,Tt;return VU().w(function(Ct){for(;;)switch(Ct.n){case 0:if(r=ze.length>1&&ze[1]!==void 0?ze[1]:[],s=ze.length>2&&ze[2]!==void 0?ze[2]:{},o=s.lngAccessor,a=o===void 0?function(un){return un[0]}:o,l=s.latAccessor,c=l===void 0?function(un){return un[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,p=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Ct.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Ct.a(2,t.map(function(un){return T3e(un,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:p})}));case 1:return x=4,v=Dee,w=Fee,S=jee,T=Wee,P=Gee,R=zee,C=Oee,L=Hee,D=qee,F=Uee,N=Bee,B=kee,z=Vee,V=T(new Lm(new Float32Array(t.flat().map(ed)),2),"vec2",t.length),H=T(new Lm(new Float32Array(r.map(function(un){return[ed(a(un)),ed(c(un)),f(un)]}).flat()),3),"vec3",r.length),K=new Lm(t.length,1),J=T(K,"float",t.length),j=P(Math.PI),Z=L(j.mul(2)),ee=function(Gt){return Gt.mul(Gt)},ae=function(Gt){return ee(D(Gt.div(2)))},ce=function(Gt,Xe){var st=P(Gt[1]),tt=P(Xe[1]),vt=P(Gt[0]),yt=P(Xe[0]);return P(2).mul(N(L(ae(tt.sub(st)).add(F(st).mul(F(tt)).mul(ae(yt.sub(vt)))))))},de=function(Gt,Xe){return B(z(ee(Gt.div(Xe)).div(2))).div(Xe.mul(Z))},ve=S(ed(p)),Ie=S(ed(p*x)),Qe=S(r.length),Ue=v(function(){var un=V.element(R),Gt=J.element(R);Gt.assign(0),C(Qe,function(Xe){var st=Xe.i,tt=H.element(st),vt=tt.z;w(vt,function(){var yt=ce(tt.xy,un.xy);w(yt&&yt.lessThan(Ie),function(){Gt.addAssign(de(yt,ve).mul(vt))})})})}),mt=Ue().compute(t.length),Me=new D1,Ct.n=2,Me.computeAsync(mt);case 2:return $e=Array,Et=Float32Array,Ct.n=3,Me.getArrayBufferAsync(K);case 3:return Tt=Ct.v,Ct.a(2,$e.from.call($e,new Et(Tt)))}},e)}));return function(t){return i.apply(this,arguments)}})(),iR=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:pa,SphereGeometry:da},M3e=3.5,C3e=.1,ote=100,R3e=function(e){var t=Xc(D6(e));return t.opacity=Math.cbrt(e),t.formatRgb()},yte=Nr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return R3e}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new iR.Mesh(new iR.SphereGeometry(rr),XU(new iR.MeshLambertMaterial({vertexColors:!0,transparent:!0}),_3e));return s.__globeObjType="heatmap",s})},update:function(e){var t=rt(e.heatmapPoints),n=rt(e.heatmapPointLat),r=rt(e.heatmapPointLng),s=rt(e.heatmapPointWeight),o=rt(e.heatmapBandwidth),a=rt(e.heatmapColorFn),l=rt(e.heatmapColorSaturation),c=rt(e.heatmapBaseAltitude),u=rt(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,p){var x=o(p),v=a(p),w=l(p),S=c(p),T=u(p),P=t(p).map(function(F){var N=n(F),B=r(F),z=mc(N,B),V=z.x,H=z.y,K=z.z;return{x:V,y:H,z:K,lat:N,lng:B,weight:s(F)}}),R=Math.max(C3e,x/M3e),C=Math.ceil(360/(R||-1));f.geometry.parameters.widthSegments!==C&&(f.geometry.dispose(),f.geometry=new iR.SphereGeometry(rr,C,C/2));var L=g3e(f.geometry.getAttribute("position")),D=L.map(function(F){var N=Ar(F,3),B=N[0],z=N[1],V=N[2],H=dte({x:B,y:z,z:V}),K=H.lng,J=H.lat;return[K,J]});E3e(D,P,{latAccessor:function(N){return N.lat},lngAccessor:function(N){return N.lng},weightAccessor:function(N){return N.weight},bandwidth:x}).then(function(F){var N=Vi(new Array(ote)).map(function(H,K){return A0(v(K/(ote-1)))}),B=function(K){var J=f.__currentTargetD=K,j=J.kdeVals,Z=J.topAlt,ee=J.saturation,ae=c3(j.map(Math.abs))||1e-15,ce=U2([0,ae/ee],N);f.geometry.setAttribute("color",zh(j.map(function(ve){return ce(Math.abs(ve))}),4));var de=ja([0,ae],[rr*(1+S),rr*(1+(Z||S))]);f.geometry.setAttribute("r",zh(j.map(de)))},z={kdeVals:F,topAlt:T,saturation:w},V=f.__currentTargetD||Object.assign({},z,{kdeVals:F.map(function(){return 0}),topAlt:T&&S,saturation:.5});V.kdeVals.length!==F.length&&(V.kdeVals=F.slice()),Object.keys(z).some(function(H){return V[H]!==z[H]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(z):e.tweenGroup.add(new Vs(V).to(z,e.heatmapsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),d0=window.THREE?window.THREE:{DoubleSide:ir,Group:_s,LineBasicMaterial:kc,LineSegments:d_,Mesh:Hn,MeshBasicMaterial:Us},vte=Nr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new d0.Group;return s.__defaultSideMaterial=XU(new d0.MeshBasicMaterial({side:d0.DoubleSide,depthWrite:!0}),HU),s.__defaultCapMaterial=new d0.MeshBasicMaterial({side:d0.DoubleSide,depthWrite:!0}),s.add(new d0.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new d0.LineSegments(void 0,new d0.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=rt(e.polygonGeoJsonGeometry),n=rt(e.polygonAltitude),r=rt(e.polygonCapCurvatureResolution),s=rt(e.polygonCapColor),o=rt(e.polygonCapMaterial),a=rt(e.polygonSideColor),l=rt(e.polygonSideMaterial),c=rt(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var p={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},x=t(f),v=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=v,x.type==="Polygon"?u.push(Oi({id:"".concat(v,"_0"),coords:x.coordinates},p)):x.type==="MultiPolygon"?u.push.apply(u,Vi(x.coordinates.map(function(w,S){return Oi({id:"".concat(v,"_").concat(S),coords:w},p)}))):console.warn("Unsupported GeoJson geometry type: ".concat(x.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,p){var x=p.coords,v=p.capColor,w=p.capMaterial,S=p.sideColor,T=p.sideMaterial,P=p.strokeColor,R=p.altitude,C=p.capCurvatureResolution,L=Ar(f.children,2),D=L[0],F=L[1],N=!!P;F.visible=N;var B=!!(v||w),z=!!(S||T);P3e(D.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:C,closedTop:B,includeSides:z})||(D.geometry&&D.geometry.dispose(),D.geometry=new AE(x,0,rr,!1,B,z,C)),N&&(!F.geometry.parameters||F.geometry.parameters.geoJson.coordinates!==x||F.geometry.parameters.resolution!==C)&&(F.geometry&&F.geometry.dispose(),F.geometry=new c6({type:"Polygon",coordinates:x},rr,C));var V=z?0:-1,H=B?z?1:0:-1;if(V>=0&&(D.material[V]=T||f.__defaultSideMaterial),H>=0&&(D.material[H]=w||f.__defaultCapMaterial),[[!T&&S,V],[!w&&v,H]].forEach(function(ae){var ce=Ar(ae,2),de=ce[0],ve=ce[1];if(!(!de||ve<0)){var Ie=D.material[ve],Qe=uu(de);Ie.color.set(Gh(de)),Ie.transparent=Qe<1,Ie.opacity=Qe}}),N){var K=F.material,J=uu(P);K.color.set(Gh(P)),K.transparent=J<1,K.opacity=J}var j={alt:R},Z=function(ce){var de=f.__currentTargetD=ce,ve=de.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,N&&(F.scale.x=F.scale.y=F.scale.z=1+ve+1e-4),x3e(f.__defaultSideMaterial,function(Ie){return Ie.uSurfaceRadius.value=rr/(ve+1)})},ee=f.__currentTargetD||Object.assign({},j,{alt:-.001});Object.keys(j).some(function(ae){return ee[ae]!==j[ae]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||ee.alt===j.alt?Z(j):e.tweenGroup.add(new Vs(ee).to(j,e.polygonsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(Z).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function P3e(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=Ar(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var q1=window.THREE?window.THREE:{BufferGeometry:Zn,DoubleSide:ir,Mesh:Hn,MeshLambertMaterial:pa,Vector3:ie},ate=Object.assign({},av),lte=ate.BufferGeometryUtils||ate,bte=Nr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new q1.Mesh(void 0,new q1.MeshLambertMaterial({side:q1.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=rt(e.hexPolygonGeoJsonGeometry),n=rt(e.hexPolygonColor),r=rt(e.hexPolygonAltitude),s=rt(e.hexPolygonResolution),o=rt(e.hexPolygonMargin),a=rt(e.hexPolygonUseDots),l=rt(e.hexPolygonCurvatureResolution),c=rt(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var p=t(f),x=s(f),v=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),P=c(f),R=n(f),C=uu(R);u.material.color.set(Gh(R)),u.material.transparent=C<1,u.material.opacity=C;var L={alt:v,margin:w,curvatureResolution:T},D={geoJson:p,h3Res:x},F=u.__currentTargetD||Object.assign({},L,{alt:-.001}),N=u.__currentMemD||D;if(Object.keys(L).some(function(H){return F[H]!==L[H]})||Object.keys(D).some(function(H){return N[H]!==D[H]})){u.__currentMemD=D;var B=[];p.type==="Polygon"?L6(p.coordinates,x,!0).forEach(function(H){return B.push(H)}):p.type==="MultiPolygon"?p.coordinates.forEach(function(H){return L6(H,x,!0).forEach(function(K){return B.push(K)})}):console.warn("Unsupported GeoJson geometry type: ".concat(p.type,". Skipping geometry..."));var z=B.map(function(H){var K=I6(H),J=N6(H,!0).reverse(),j=K[1];return J.forEach(function(Z){var ee=Z[0];Math.abs(j-ee)>170&&(Z[0]+=j>ee?360:-360)}),{h3Idx:H,hexCenter:K,hexGeoJson:J}}),V=function(K){var J=u.__currentTargetD=K,j=J.alt,Z=J.margin,ee=J.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=z.length?(lte.mergeGeometries||lte.mergeBufferGeometries)(z.map(function(ae){var ce=Ar(ae.hexCenter,2),de=ce[0],ve=ce[1];if(S){var Ie=mc(de,ve,j),Qe=mc(ae.hexGeoJson[0][1],ae.hexGeoJson[0][0],j),Ue=.85*(1-Z)*new q1.Vector3(Ie.x,Ie.y,Ie.z).distanceTo(new q1.Vector3(Qe.x,Qe.y,Qe.z)),mt=new A_(Ue,P);return mt.rotateX(Vm(-de)),mt.rotateY(Vm(ve)),mt.translate(Ie.x,Ie.y,Ie.z),mt}else{var Me=function(Et,Tt,Ct){return Et-(Et-Tt)*Ct},ze=Z===0?ae.hexGeoJson:ae.hexGeoJson.map(function($e){var Et=Ar($e,2),Tt=Et[0],Ct=Et[1];return[[Tt,ve],[Ct,de]].map(function(un){var Gt=Ar(un,2),Xe=Gt[0],st=Gt[1];return Me(Xe,st,Z)})});return new AE([ze],rr,rr*(1+j),!1,!0,!1,ee)}})):new q1.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?V(L):e.tweenGroup.add(new Vs(F).to(L,e.hexPolygonsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(V).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),I3e=window.THREE?window.THREE:{Vector3:ie};function N3e(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(Vi(o),Vi(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=YL.apply(void 0,Vi([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,c=o.z;return[a,l,c]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=Ar(o,3),l=a[0],c=a[1],u=a[2];return new I3e.Vector3(l,c,u)})}}var zm=window.THREE?window.THREE:{BufferGeometry:Zn,Color:Ut,Group:_s,Line:jd,NormalBlending:rs,ShaderMaterial:jr,Vector3:ie},L3e=qm.default.default||qm.default,wte=Nr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new L3e,sharedMaterial:new zm.ShaderMaterial(Oi(Oi({},mte()),{},{transparent:!0,blending:zm.NormalBlending}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new zm.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ar(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var c=o.material.dashOffset-a,u=o.material.dashSize+o.material.gapSize;c<=-u;)c+=u;o.material.dashOffset=c}})})},update:function(e){var t=rt(e.pathPoints),n=rt(e.pathPointLat),r=rt(e.pathPointLng),s=rt(e.pathPointAlt),o=rt(e.pathStroke),a=rt(e.pathColor),l=rt(e.pathDashLength),c=rt(e.pathDashGap),u=rt(e.pathDashInitialGap),f=rt(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var P=o(T),R=P!=null;if(!S.children.length||R===(S.children[0].type==="Line")){Br(S);var C=R?new eR(new z1,new h0):new zm.Line(new zm.BufferGeometry,e.sharedMaterial.clone());S.add(C)}var L=S.children[0],D=x(t(T),n,r,s,e.pathResolution),F=f(T);if(L.__dashAnimateStep=F>0?1e3/F:0,R){L.material.resolution=e.rendererSize;{var z=l(T),V=c(T),H=u(T);L.material.dashed=V>0,L.material.dashed?L.material.defines.USE_DASH="":delete L.material.defines.USE_DASH,L.material.dashed&&(L.material.dashScale=1/p(D),L.material.dashSize=z,L.material.gapSize=V,L.material.dashOffset=-H)}{var K=a(T);if(K instanceof Array){var J=v(a(T),D.length-1,1,!1);L.geometry.setColors(J.array),L.material.vertexColors=!0}else{var j=K,Z=uu(j);L.material.color=new zm.Color(Gh(j)),L.material.transparent=Z<1,L.material.opacity=Z,L.material.vertexColors=!1}}L.material.needsUpdate=!0}else{Object.assign(L.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var N=v(a(T),D.length),B=w(D.length,1,!0);L.geometry.setAttribute("color",N),L.geometry.setAttribute("relDistance",B)}var ee=N3e(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),ae=function(Ie){var Qe=S.__currentTargetD=Ie,Ue=Qe.stroke,mt=Qe.interpolK,Me=S.__currentTargetD.points=ee(mt);if(R){var ze;L.geometry.setPositions((ze=[]).concat.apply(ze,Vi(Me.map(function($e){var Et=$e.x,Tt=$e.y,Ct=$e.z;return[Et,Tt,Ct]})))),L.material.linewidth=Ue,L.material.dashed&&L.computeLineDistances()}else L.geometry.setFromPoints(Me),L.geometry.computeBoundingSphere()},ce={stroke:P,interpolK:1},de=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return de[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?ae(ce):e.tweenGroup.add(new Vs(de).to(ce,e.pathTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(ae).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function p(S){var T=0,P;return S.forEach(function(R){P&&(T+=P.distanceTo(R)),P=R}),T}function x(S,T,P,R,C){var L=function(B,z,V){for(var H=[],K=1;K<=V;K++)H.push(B+(z-B)*K/(V+1));return H},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,V=[],H=null;return B.forEach(function(K){if(H){for(;Math.abs(H[1]-K[1])>180;)H[1]+=360*(H[1]<K[1]?1:-1);var J=Math.sqrt(Math.pow(K[0]-H[0],2)+Math.pow(K[1]-H[1],2));if(J>z)for(var j=Math.floor(J/z),Z=L(H[0],K[0],j),ee=L(H[1],K[1],j),ae=L(H[2],K[2],j),ce=0,de=Z.length;ce<de;ce++)V.push([Z[ce],ee[ce],ae[ce]])}V.push(H=K)}),V},F=function(B){var z=Ar(B,3),V=z[0],H=z[1],K=z[2],J=mc(V,H,K),j=J.x,Z=J.y,ee=J.z;return new zm.Vector3(j,Z,ee)};return D(S.map(function(N){return[T(N),P(N),R(N)]}),C).map(F)}function v(S,T){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,R=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,C=T+1,L;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?ja().domain(S.map(function(K,J){return J/(S.length-1)})).range(S):S;L=function(J){return A0(D(J),R,!0)}}else{var F=A0(S,R,!0);L=function(){return F}}for(var N=[],B=0,z=C;B<z;B++)for(var V=L(B/(z-1)),H=0;H<P;H++)N.push(V);return zh(N,R?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,R=S+1,C=[],L=0,D=R;L<D;L++)for(var F=L/(D-1),N=0;N<T;N++)C.push(F);return P&&C.reverse(),zh(C,1)}}}),rR=window.THREE?window.THREE:{Euler:ua,Mesh:Hn,MeshLambertMaterial:pa,SphereGeometry:da},Ste=Nr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new rR.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new rR.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=rt(e.tileLat),n=rt(e.tileLng),r=rt(e.tileAltitude),s=rt(e.tileWidth),o=rt(e.tileHeight),a=rt(e.tileUseGlobeProjection),l=rt(e.tileMaterial),c=rt(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var p=a(f),x=c(f),v=function(P){var R=u.__currentTargetD=P,C=R.lat,L=R.lng,D=R.alt,F=R.width,N=R.height,B=H1(L),z=H1(-C);u.geometry&&u.geometry.dispose(),u.geometry=new rR.SphereGeometry(rr*(1+D),Math.ceil(F/(x||-1)),Math.ceil(N/(x||-1)),H1(90-F/2)+(p?B:0),H1(F),H1(90-N/2)+(p?z:0),H1(N)),p||u.setRotationFromEuler(new rR.Euler(z,B,0,"YXZ"))},w={lat:+t(f),lng:+n(f),alt:+r(f),width:+s(f),height:+o(f)},S=u.__currentTargetD||Object.assign({},w,{width:0,height:0});Object.keys(w).some(function(T){return S[T]!==w[T]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?v(w):e.tweenGroup.add(new Vs(S).to(w,e.tilesTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(v).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),H1=function(e){return e*Math.PI/180},Eb=window.THREE?window.THREE:{BufferGeometry:Zn,Color:Ut,Points:yy,PointsMaterial:Xd},Tte=Nr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new Eb.Points(new Eb.BufferGeometry,new Eb.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=rt(t.particlesList),o=rt(t.particleLat),a=rt(t.particleLng),l=rt(t.particleAltitude);n.geometry.setAttribute("position",zh(s(r).map(function(c){return Object.values(mc(o(c),a(c),l(c)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=rt(e.particlesColor),r=rt(e.particlesSize),s=rt(e.particlesSizeAttenuation),o=rt(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=Ar(a,2),c=l[0],u=l[1];if(u.material.size=r(c),u.material.sizeAttenuation=s(c),e.particlesTexture)u.material.color=new Eb.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),p=uu(f);u.material.color=new Eb.Color(Gh(f)),u.material.transparent=p<1,u.material.opacity=p,u.material.alphaTest=0}})}}),D3e=window.THREE?window.THREE:{BufferGeometry:Zn},F3e=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;lR(this,e),t=aR(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return uR(e,i),cR(e)})(D3e.BufferGeometry),W1=window.THREE?window.THREE:{Color:Ut,Group:_s,Line:jd,LineBasicMaterial:kc,Vector3:ie},O3e=qm.default.default||qm.default,Ete=Nr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new W1.Group;return s.__globeObjType="ring",s}),t.ticker=new O3e,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=rt(t.ringColor),a=rt(t.ringAltitude),l=rt(t.ringMaxRadius),c=rt(t.ringPropagationSpeed),u=rt(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var p=Ar(f,2),x=p[1];return x}).forEach(function(f){var p=Ar(f,2),x=p[0],v=p[1];if((v.__nextRingTime||0)<=s){var w=u(x)/1e3;v.__nextRingTime=s+(w<=0?1/0:w);var S=new W1.Line(new F3e(1,t.ringResolution),new W1.LineBasicMaterial),T=o(x),P=T instanceof Array||T instanceof Function,R;P?T instanceof Array?(R=ja().domain(T.map(function(V,H){return H/(T.length-1)})).range(T),S.material.transparent=T.some(function(V){return uu(V)<1})):(R=T,S.material.transparent=!0):(S.material.color=new W1.Color(Gh(T)),m3e(S.material,uu(T)));var C=rr*(1+a(x)),L=l(x),D=L*Math.PI/180,F=c(x),N=F<=0,B=function(H){var K=H.t,J=(N?1-K:K)*D;if(S.scale.x=S.scale.y=C*Math.sin(J),S.position.z=C*(1-Math.cos(J)),P){var j=R(K);S.material.color=new W1.Color(Gh(j)),S.material.transparent&&(S.material.opacity=uu(j))}};if(F===0)B({t:0}),v.add(S);else{var z=Math.abs(L/F)*1e3;t.tweenGroup.add(new Vs({t:0}).to({t:1},z).onUpdate(B).onStart(function(){return v.add(S)}).onComplete(function(){t.tweenGroup.remove(this),v.remove(S),p0(S)}).start())}}})}})},update:function(e){var t=rt(e.ringLat),n=rt(e.ringLng),r=rt(e.ringAltitude),s=e.scene.localToWorld(new W1.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,mc(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),B3e={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},\u03BF:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"\xA6":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},\u03A4:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},\u03A0:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},\u0390:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"\xB2":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"\u2013":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},\u039A:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},\u0192:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},\u03CC:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"\xBB":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"\xA9":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},\u03CE:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"\xAB":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"\u2219":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u00FF:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},\u00B5:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},\u0399:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},\u038E:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2019":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u039D:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},\u03C2:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},\u03A8:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},\u03B9:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},\u0386:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},\u03B5:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},\u0394:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"\u2030":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"\u2014":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},\u03C1:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"\xAF":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},\u0397:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u0391:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"\u2026":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u03BD:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"\xB6":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},\u03B2:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},\u039C:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},\u038C:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u0389:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2022":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"\xA5":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},\u03B3:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},\u03B1:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"\xAD":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03A7:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"\u2020":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"\xB0":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},\u039E:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "},"\xA0":{x_min:0,x_max:0,ha:853},\u03AB:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"\u201D":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},\u038A:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},\u0392:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},\u03C5:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},\u03C7:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},\u03AF:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},\u0396:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"\xA8":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\u2039":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\u201E":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},\u03B4:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},\u03AD:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},\u03C9:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"\xB4":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\xB1":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},\u03CB:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"\xA7":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},\u03A9:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},\u03CD:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"\u2122":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},\u03AE:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},\u0398:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"\xAE":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},\u0395:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"\xB3":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},\u03C3:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},\u03B6:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},\u03B8:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},\u039F:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},\u0393:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},\u0388:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u038F:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},\u03AA:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"\xBD":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},\u03A1:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u00AA:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"\u0385":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},\u03A6:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"\u204B":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},\u03A3:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"\u203A":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\xA3":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"\xAC":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},\u03BB:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},\u03C4:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},\u03BE:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},\u039B:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},\u03B0:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"\xB7":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u03A5:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},\u03BC:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03C6:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"\u201C":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"\u2018":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},\u03CA:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},\u03C0:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},\u03AC:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"\xA4":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},\u03BA:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"\u2021":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},\u03C8:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},\u03B7:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},U3e="normal",k3e=1189,G3e=-100,z3e="normal",V3e={yMin:-334,xMin:-111,yMax:1189,xMax:1672},q3e=1e3,H3e={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) \u039Cagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"\u039Cagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r5222+ `),e},$U=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},b3e=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},w3e=["stroke"],lu=window.THREE?window.THREE:{BufferGeometry:Kn,CubicBezierCurve3:g_,Curve:da,Group:xs,Line:jd,Mesh:Hn,NormalBlending:ss,ShaderMaterial:jr,TubeGeometry:Ny,Vector3:ie},S3e=Hm.default.default||Hm.default,xte=Nr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new S3e,sharedMaterial:new lu.ShaderMaterial(Oi(Oi({},_te()),{},{transparent:!0,blending:lu.NormalBlending}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new lu.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ar(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=rt(e.arcStartLat),n=rt(e.arcStartLng),r=rt(e.arcStartAltitude),s=rt(e.arcEndLat),o=rt(e.arcEndLng),a=rt(e.arcEndAltitude),l=rt(e.arcAltitude),c=rt(e.arcAltitudeAutoScale),u=rt(e.arcStroke),f=rt(e.arcColor),p=rt(e.arcDashLength),x=rt(e.arcDashGap),v=rt(e.arcDashInitialGap),w=rt(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(R,C){var L=u(C),D=L!=null;if(!R.children.length||D!==(R.children[0].type==="Mesh")){Br(R);var F=D?new lu.Mesh:new lu.Line(new lu.BufferGeometry);F.material=e.sharedMaterial.clone(),R.add(F)}var N=R.children[0];Object.assign(N.material.uniforms,{dashSize:{value:p(C)},gapSize:{value:x(C)},dashOffset:{value:v(C)}});var B=w(C);N.__dashAnimateStep=B>0?1e3/B:0;var z=T(f(C),e.arcCurveResolution,D?e.arcCircularResolution+1:1),V=P(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V);var H=function(K){var ee=R.__currentTargetD=K,ae=ee.stroke,ce=c3e(ee,w3e),de=S(ce);D?(N.geometry&&N.geometry.dispose(),N.geometry=new lu.TubeGeometry(de,e.arcCurveResolution,ae/2,e.arcCircularResolution),N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V)):N.geometry.setFromPoints(de.getPoints(e.arcCurveResolution))},Z={stroke:L,alt:l(C),altAutoScale:+c(C),startLat:+t(C),startLng:+n(C),startAlt:+r(C),endLat:+s(C),endLng:+o(C),endAlt:+a(C)},J=R.__currentTargetD||Object.assign({},Z,{altAutoScale:-.001});Object.keys(Z).some(function(j){return J[j]!==Z[j]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?H(Z):e.tweenGroup.add(new Vs(J).to(Z,e.arcsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(R){var C=R.alt,L=R.altAutoScale,D=R.startLat,F=R.startLng,N=R.startAlt,B=R.endLat,z=R.endLng,V=R.endAlt,H=function(Me){var ze=Ar(Me,3),$e=ze[0],Et=ze[1],Tt=ze[2],Ct=mc(Et,$e,Tt),un=Ct.x,Gt=Ct.y,Xe=Ct.z;return new lu.Vector3(un,Gt,Xe)},Z=[F,D],J=[z,B],j=C;if(j==null&&(j=Ya(Z,J)/2*L+Math.max(N,V)),j||N||V){var K=tm(Z,J),ee=function(Me,ze){return ze+(ze-Me)*(Me<ze?.5:.25)},ae=[.25,.75].map(function(mt){return[].concat(Vi(K(mt)),[ee(mt<.5?N:V,j)])}),ce=Ar(ae,2),de=ce[0],ve=ce[1],Ie=jU(lu.CubicBezierCurve3,Vi([[].concat(Z,[N]),de,ve,[].concat(J,[V])].map(H)));return Ie}else{var Qe=.001;return Ue.apply(void 0,Vi([[].concat(Z,[Qe]),[].concat(J,[Qe])].map(H)))}function Ue(mt,Me){var ze=mt.angleTo(Me),$e=ze===0?function(){return mt.clone()}:function(Tt){return new lu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Tt)*ze)),Me.clone().multiplyScalar(Math.sin(Tt*ze))).divideScalar(Math.sin(ze))},Et=new lu.Curve;return Et.getPoint=$e,Et}}function T(R,C){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=C+1,F;if(R instanceof Array||R instanceof Function){var N=R instanceof Array?Xa().domain(R.map(function(j,K){return K/(R.length-1)})).range(R):R;F=function(K){return A0(N(K),!0,!0)}}else{var B=A0(R,!0,!0);F=function(){return B}}for(var z=[],V=0,H=D;V<H;V++)for(var Z=F(V/(H-1)),J=0;J<L;J++)z.push(Z);return zh(z,4)}function P(R){for(var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=R+1,F=[],N=0,B=D;N<B;N++)for(var z=N/(B-1),V=0;V<C;V++)F.push(z);return L&&F.reverse(),zh(F,1)}}}),f0=window.THREE?window.THREE:{BufferGeometry:Kn,DoubleSide:ir,Mesh:Hn,MeshLambertMaterial:Aa,Object3D:$i},ote=Object.assign({},av),ate=ote.BufferGeometryUtils||ote,yte=Nr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=rt(e.hexBinPointLat),r=rt(e.hexBinPointLng),s=rt(e.hexBinPointWeight),o=rt(e.hexAltitude),a=rt(e.hexTopColor),l=rt(e.hexSideColor),c=rt(e.hexMargin),u=B$(e.hexBinPointsData.map(function(P){return Oi(Oi({},P),{},{h3Idx:Z$(n(P),r(P),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(P){var R=Ar(P,2),C=R[0],L=R[1];return{h3Idx:C,points:L,sumWeight:L.reduce(function(D,F){return D+ +s(F)},0)}}),p={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&Br(e.scene),e.dataMapper.scene=e.hexBinMerge?new f0.Object3D:e.scene,e.dataMapper.id(function(P){return P.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var x=f.length?(ate.mergeGeometries||ate.mergeBufferGeometries)(f.map(function(P){var R=e.dataMapper.getObj(P),C=R.geometry.toNonIndexed();R.updateMatrix(),C.applyMatrix4(R.matrix);var L=A0(a(P)),D=A0(l(P)),F=C.getAttribute("position").count,N=C.groups[0].count;return C.setAttribute("color",zh(Vi(new Array(F)).map(function(B,z){return z>=N?L:D}),4)),C})):new f0.BufferGeometry,v=new f0.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:f0.DoubleSide});v.onBeforeCompile=function(P){v.userData.shader=WU(P)};var w=new f0.Mesh(x,v);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),Br(e.scene),e.scene.add(w)}function S(P){var R=new f0.Mesh;R.__hexCenter=N6(P.h3Idx),R.__hexGeoJson=L6(P.h3Idx,!0).reverse();var C=R.__hexCenter[1];return R.__hexGeoJson.forEach(function(L){var D=L[0];Math.abs(C-D)>170&&(L[0]+=C>D?360:-360)}),R.__globeObjType="hexbin",R}function T(P,R){var C=function(ee,ae,ce){return ee-(ee-ae)*ce},L=Math.max(0,Math.min(1,+c(R))),D=Ar(P.__hexCenter,2),F=D[0],N=D[1],B=L===0?P.__hexGeoJson:P.__hexGeoJson.map(function(K){var ee=Ar(K,2),ae=ee[0],ce=ee[1];return[[ae,N],[ce,F]].map(function(de){var ve=Ar(de,2),Ie=ve[0],Qe=ve[1];return C(Ie,Qe,L)})}),z=e.hexTopCurvatureResolution;P.geometry&&P.geometry.dispose(),P.geometry=new AE([B],0,rr,!1,!0,!0,z);var V={alt:+o(R)},H=function(ee){var ae=P.__currentTargetD=ee,ce=ae.alt;P.scale.x=P.scale.y=P.scale.z=1+ce;var de=rr/(ce+1);P.geometry.setAttribute("surfaceRadius",zh(Array(P.geometry.getAttribute("position").count).fill(de),1))},Z=P.__currentTargetD||Object.assign({},V,{alt:-.001});if(Object.keys(V).some(function(K){return Z[K]!==V[K]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?H(V):e.tweenGroup.add(new Vs(Z).to(V,e.hexTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var J=l(R),j=a(R);[J,j].forEach(function(K){if(!p.hasOwnProperty(K)){var ee=uu(K);p[K]=$U(new f0.MeshLambertMaterial({color:Gh(K),transparent:ee<1,opacity:ee,side:f0.DoubleSide}),WU)}}),P.material=[J,j].map(function(K){return p[K]})}}}}),vte=function(e){return e*e},ed=function(e){return e*Math.PI/180};function T3e(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return vte(Math.sin(u/2))},s=ed(i[1]),o=ed(e[1]),a=ed(i[0]),l=ed(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var E3e=Math.sqrt(2*Math.PI);function M3e(i,e){return Math.exp(-vte(i/e)/2)/(e*E3e)}var C3e=function(e){var t=Ar(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,c=o.latAccessor,u=c===void 0?function(S){return S[1]}:c,f=o.weightAccessor,p=f===void 0?function(){return 1}:f,x=o.bandwidth,v=[n,r],w=x*Math.PI/180;return h3(s.map(function(S){var T=p(S);if(!T)return 0;var P=T3e(v,[l(S),u(S)]);return M3e(P,w)*T}))},R3e=(function(){var i=n3e(qU().m(function e(t){var n,r,s,o,a,l,c,u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B,z,V,H,Z,J,j,K,ee,ae,ce,de,ve,Ie,Qe,Ue,mt,Me,ze=arguments,$e,Et,Tt;return qU().w(function(Ct){for(;;)switch(Ct.n){case 0:if(r=ze.length>1&&ze[1]!==void 0?ze[1]:[],s=ze.length>2&&ze[2]!==void 0?ze[2]:{},o=s.lngAccessor,a=o===void 0?function(un){return un[0]}:o,l=s.latAccessor,c=l===void 0?function(un){return un[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,p=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Ct.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Ct.a(2,t.map(function(un){return C3e(un,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:p})}));case 1:return x=4,v=Oee,w=Bee,S=$ee,T=Xee,P=Vee,R=qee,C=Uee,L=jee,D=Wee,F=Gee,N=kee,B=zee,z=Hee,V=T(new Dm(new Float32Array(t.flat().map(ed)),2),"vec2",t.length),H=T(new Dm(new Float32Array(r.map(function(un){return[ed(a(un)),ed(c(un)),f(un)]}).flat()),3),"vec3",r.length),Z=new Dm(t.length,1),J=T(Z,"float",t.length),j=P(Math.PI),K=L(j.mul(2)),ee=function(Gt){return Gt.mul(Gt)},ae=function(Gt){return ee(D(Gt.div(2)))},ce=function(Gt,Xe){var st=P(Gt[1]),tt=P(Xe[1]),vt=P(Gt[0]),yt=P(Xe[0]);return P(2).mul(N(L(ae(tt.sub(st)).add(F(st).mul(F(tt)).mul(ae(yt.sub(vt)))))))},de=function(Gt,Xe){return B(z(ee(Gt.div(Xe)).div(2))).div(Xe.mul(K))},ve=S(ed(p)),Ie=S(ed(p*x)),Qe=S(r.length),Ue=v(function(){var un=V.element(R),Gt=J.element(R);Gt.assign(0),C(Qe,function(Xe){var st=Xe.i,tt=H.element(st),vt=tt.z;w(vt,function(){var yt=ce(tt.xy,un.xy);w(yt&&yt.lessThan(Ie),function(){Gt.addAssign(de(yt,ve).mul(vt))})})})}),mt=Ue().compute(t.length),Me=new D1,Ct.n=2,Me.computeAsync(mt);case 2:return $e=Array,Et=Float32Array,Ct.n=3,Me.getArrayBufferAsync(Z);case 3:return Tt=Ct.v,Ct.a(2,$e.from.call($e,new Et(Tt)))}},e)}));return function(t){return i.apply(this,arguments)}})(),iR=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:Aa,SphereGeometry:pa},P3e=3.5,I3e=.1,lte=100,N3e=function(e){var t=Xc(F6(e));return t.opacity=Math.cbrt(e),t.formatRgb()},bte=Nr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return N3e}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new iR.Mesh(new iR.SphereGeometry(rr),$U(new iR.MeshLambertMaterial({vertexColors:!0,transparent:!0}),v3e));return s.__globeObjType="heatmap",s})},update:function(e){var t=rt(e.heatmapPoints),n=rt(e.heatmapPointLat),r=rt(e.heatmapPointLng),s=rt(e.heatmapPointWeight),o=rt(e.heatmapBandwidth),a=rt(e.heatmapColorFn),l=rt(e.heatmapColorSaturation),c=rt(e.heatmapBaseAltitude),u=rt(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,p){var x=o(p),v=a(p),w=l(p),S=c(p),T=u(p),P=t(p).map(function(F){var N=n(F),B=r(F),z=mc(N,B),V=z.x,H=z.y,Z=z.z;return{x:V,y:H,z:Z,lat:N,lng:B,weight:s(F)}}),R=Math.max(I3e,x/P3e),C=Math.ceil(360/(R||-1));f.geometry.parameters.widthSegments!==C&&(f.geometry.dispose(),f.geometry=new iR.SphereGeometry(rr,C,C/2));var L=y3e(f.geometry.getAttribute("position")),D=L.map(function(F){var N=Ar(F,3),B=N[0],z=N[1],V=N[2],H=Ate({x:B,y:z,z:V}),Z=H.lng,J=H.lat;return[Z,J]});R3e(D,P,{latAccessor:function(N){return N.lat},lngAccessor:function(N){return N.lng},weightAccessor:function(N){return N.weight},bandwidth:x}).then(function(F){var N=Vi(new Array(lte)).map(function(H,Z){return A0(v(Z/(lte-1)))}),B=function(Z){var J=f.__currentTargetD=Z,j=J.kdeVals,K=J.topAlt,ee=J.saturation,ae=c3(j.map(Math.abs))||1e-15,ce=U2([0,ae/ee],N);f.geometry.setAttribute("color",zh(j.map(function(ve){return ce(Math.abs(ve))}),4));var de=Xa([0,ae],[rr*(1+S),rr*(1+(K||S))]);f.geometry.setAttribute("r",zh(j.map(de)))},z={kdeVals:F,topAlt:T,saturation:w},V=f.__currentTargetD||Object.assign({},z,{kdeVals:F.map(function(){return 0}),topAlt:T&&S,saturation:.5});V.kdeVals.length!==F.length&&(V.kdeVals=F.slice()),Object.keys(z).some(function(H){return V[H]!==z[H]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(z):e.tweenGroup.add(new Vs(V).to(z,e.heatmapsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),d0=window.THREE?window.THREE:{DoubleSide:ir,Group:xs,LineBasicMaterial:kc,LineSegments:d_,Mesh:Hn,MeshBasicMaterial:Us},wte=Nr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new d0.Group;return s.__defaultSideMaterial=$U(new d0.MeshBasicMaterial({side:d0.DoubleSide,depthWrite:!0}),WU),s.__defaultCapMaterial=new d0.MeshBasicMaterial({side:d0.DoubleSide,depthWrite:!0}),s.add(new d0.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new d0.LineSegments(void 0,new d0.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=rt(e.polygonGeoJsonGeometry),n=rt(e.polygonAltitude),r=rt(e.polygonCapCurvatureResolution),s=rt(e.polygonCapColor),o=rt(e.polygonCapMaterial),a=rt(e.polygonSideColor),l=rt(e.polygonSideMaterial),c=rt(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var p={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},x=t(f),v=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=v,x.type==="Polygon"?u.push(Oi({id:"".concat(v,"_0"),coords:x.coordinates},p)):x.type==="MultiPolygon"?u.push.apply(u,Vi(x.coordinates.map(function(w,S){return Oi({id:"".concat(v,"_").concat(S),coords:w},p)}))):console.warn("Unsupported GeoJson geometry type: ".concat(x.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,p){var x=p.coords,v=p.capColor,w=p.capMaterial,S=p.sideColor,T=p.sideMaterial,P=p.strokeColor,R=p.altitude,C=p.capCurvatureResolution,L=Ar(f.children,2),D=L[0],F=L[1],N=!!P;F.visible=N;var B=!!(v||w),z=!!(S||T);L3e(D.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:C,closedTop:B,includeSides:z})||(D.geometry&&D.geometry.dispose(),D.geometry=new AE(x,0,rr,!1,B,z,C)),N&&(!F.geometry.parameters||F.geometry.parameters.geoJson.coordinates!==x||F.geometry.parameters.resolution!==C)&&(F.geometry&&F.geometry.dispose(),F.geometry=new u6({type:"Polygon",coordinates:x},rr,C));var V=z?0:-1,H=B?z?1:0:-1;if(V>=0&&(D.material[V]=T||f.__defaultSideMaterial),H>=0&&(D.material[H]=w||f.__defaultCapMaterial),[[!T&&S,V],[!w&&v,H]].forEach(function(ae){var ce=Ar(ae,2),de=ce[0],ve=ce[1];if(!(!de||ve<0)){var Ie=D.material[ve],Qe=uu(de);Ie.color.set(Gh(de)),Ie.transparent=Qe<1,Ie.opacity=Qe}}),N){var Z=F.material,J=uu(P);Z.color.set(Gh(P)),Z.transparent=J<1,Z.opacity=J}var j={alt:R},K=function(ce){var de=f.__currentTargetD=ce,ve=de.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,N&&(F.scale.x=F.scale.y=F.scale.z=1+ve+1e-4),b3e(f.__defaultSideMaterial,function(Ie){return Ie.uSurfaceRadius.value=rr/(ve+1)})},ee=f.__currentTargetD||Object.assign({},j,{alt:-.001});Object.keys(j).some(function(ae){return ee[ae]!==j[ae]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||ee.alt===j.alt?K(j):e.tweenGroup.add(new Vs(ee).to(j,e.polygonsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(K).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function L3e(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=Ar(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var q1=window.THREE?window.THREE:{BufferGeometry:Kn,DoubleSide:ir,Mesh:Hn,MeshLambertMaterial:Aa,Vector3:ie},cte=Object.assign({},av),ute=cte.BufferGeometryUtils||cte,Ste=Nr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new q1.Mesh(void 0,new q1.MeshLambertMaterial({side:q1.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=rt(e.hexPolygonGeoJsonGeometry),n=rt(e.hexPolygonColor),r=rt(e.hexPolygonAltitude),s=rt(e.hexPolygonResolution),o=rt(e.hexPolygonMargin),a=rt(e.hexPolygonUseDots),l=rt(e.hexPolygonCurvatureResolution),c=rt(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var p=t(f),x=s(f),v=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),P=c(f),R=n(f),C=uu(R);u.material.color.set(Gh(R)),u.material.transparent=C<1,u.material.opacity=C;var L={alt:v,margin:w,curvatureResolution:T},D={geoJson:p,h3Res:x},F=u.__currentTargetD||Object.assign({},L,{alt:-.001}),N=u.__currentMemD||D;if(Object.keys(L).some(function(H){return F[H]!==L[H]})||Object.keys(D).some(function(H){return N[H]!==D[H]})){u.__currentMemD=D;var B=[];p.type==="Polygon"?D6(p.coordinates,x,!0).forEach(function(H){return B.push(H)}):p.type==="MultiPolygon"?p.coordinates.forEach(function(H){return D6(H,x,!0).forEach(function(Z){return B.push(Z)})}):console.warn("Unsupported GeoJson geometry type: ".concat(p.type,". Skipping geometry..."));var z=B.map(function(H){var Z=N6(H),J=L6(H,!0).reverse(),j=Z[1];return J.forEach(function(K){var ee=K[0];Math.abs(j-ee)>170&&(K[0]+=j>ee?360:-360)}),{h3Idx:H,hexCenter:Z,hexGeoJson:J}}),V=function(Z){var J=u.__currentTargetD=Z,j=J.alt,K=J.margin,ee=J.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=z.length?(ute.mergeGeometries||ute.mergeBufferGeometries)(z.map(function(ae){var ce=Ar(ae.hexCenter,2),de=ce[0],ve=ce[1];if(S){var Ie=mc(de,ve,j),Qe=mc(ae.hexGeoJson[0][1],ae.hexGeoJson[0][0],j),Ue=.85*(1-K)*new q1.Vector3(Ie.x,Ie.y,Ie.z).distanceTo(new q1.Vector3(Qe.x,Qe.y,Qe.z)),mt=new A_(Ue,P);return mt.rotateX(qm(-de)),mt.rotateY(qm(ve)),mt.translate(Ie.x,Ie.y,Ie.z),mt}else{var Me=function(Et,Tt,Ct){return Et-(Et-Tt)*Ct},ze=K===0?ae.hexGeoJson:ae.hexGeoJson.map(function($e){var Et=Ar($e,2),Tt=Et[0],Ct=Et[1];return[[Tt,ve],[Ct,de]].map(function(un){var Gt=Ar(un,2),Xe=Gt[0],st=Gt[1];return Me(Xe,st,K)})});return new AE([ze],rr,rr*(1+j),!1,!0,!1,ee)}})):new q1.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?V(L):e.tweenGroup.add(new Vs(F).to(L,e.hexPolygonsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(V).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),D3e=window.THREE?window.THREE:{Vector3:ie};function F3e(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(Vi(o),Vi(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=ZL.apply(void 0,Vi([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,c=o.z;return[a,l,c]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=Ar(o,3),l=a[0],c=a[1],u=a[2];return new D3e.Vector3(l,c,u)})}}var Vm=window.THREE?window.THREE:{BufferGeometry:Kn,Color:Ut,Group:xs,Line:jd,NormalBlending:ss,ShaderMaterial:jr,Vector3:ie},O3e=Hm.default.default||Hm.default,Tte=Nr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new O3e,sharedMaterial:new Vm.ShaderMaterial(Oi(Oi({},_te()),{},{transparent:!0,blending:Vm.NormalBlending}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Vm.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ar(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var c=o.material.dashOffset-a,u=o.material.dashSize+o.material.gapSize;c<=-u;)c+=u;o.material.dashOffset=c}})})},update:function(e){var t=rt(e.pathPoints),n=rt(e.pathPointLat),r=rt(e.pathPointLng),s=rt(e.pathPointAlt),o=rt(e.pathStroke),a=rt(e.pathColor),l=rt(e.pathDashLength),c=rt(e.pathDashGap),u=rt(e.pathDashInitialGap),f=rt(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var P=o(T),R=P!=null;if(!S.children.length||R===(S.children[0].type==="Line")){Br(S);var C=R?new eR(new z1,new h0):new Vm.Line(new Vm.BufferGeometry,e.sharedMaterial.clone());S.add(C)}var L=S.children[0],D=x(t(T),n,r,s,e.pathResolution),F=f(T);if(L.__dashAnimateStep=F>0?1e3/F:0,R){L.material.resolution=e.rendererSize;{var z=l(T),V=c(T),H=u(T);L.material.dashed=V>0,L.material.dashed?L.material.defines.USE_DASH="":delete L.material.defines.USE_DASH,L.material.dashed&&(L.material.dashScale=1/p(D),L.material.dashSize=z,L.material.gapSize=V,L.material.dashOffset=-H)}{var Z=a(T);if(Z instanceof Array){var J=v(a(T),D.length-1,1,!1);L.geometry.setColors(J.array),L.material.vertexColors=!0}else{var j=Z,K=uu(j);L.material.color=new Vm.Color(Gh(j)),L.material.transparent=K<1,L.material.opacity=K,L.material.vertexColors=!1}}L.material.needsUpdate=!0}else{Object.assign(L.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var N=v(a(T),D.length),B=w(D.length,1,!0);L.geometry.setAttribute("color",N),L.geometry.setAttribute("relDistance",B)}var ee=F3e(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),ae=function(Ie){var Qe=S.__currentTargetD=Ie,Ue=Qe.stroke,mt=Qe.interpolK,Me=S.__currentTargetD.points=ee(mt);if(R){var ze;L.geometry.setPositions((ze=[]).concat.apply(ze,Vi(Me.map(function($e){var Et=$e.x,Tt=$e.y,Ct=$e.z;return[Et,Tt,Ct]})))),L.material.linewidth=Ue,L.material.dashed&&L.computeLineDistances()}else L.geometry.setFromPoints(Me),L.geometry.computeBoundingSphere()},ce={stroke:P,interpolK:1},de=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return de[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?ae(ce):e.tweenGroup.add(new Vs(de).to(ce,e.pathTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(ae).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function p(S){var T=0,P;return S.forEach(function(R){P&&(T+=P.distanceTo(R)),P=R}),T}function x(S,T,P,R,C){var L=function(B,z,V){for(var H=[],Z=1;Z<=V;Z++)H.push(B+(z-B)*Z/(V+1));return H},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,V=[],H=null;return B.forEach(function(Z){if(H){for(;Math.abs(H[1]-Z[1])>180;)H[1]+=360*(H[1]<Z[1]?1:-1);var J=Math.sqrt(Math.pow(Z[0]-H[0],2)+Math.pow(Z[1]-H[1],2));if(J>z)for(var j=Math.floor(J/z),K=L(H[0],Z[0],j),ee=L(H[1],Z[1],j),ae=L(H[2],Z[2],j),ce=0,de=K.length;ce<de;ce++)V.push([K[ce],ee[ce],ae[ce]])}V.push(H=Z)}),V},F=function(B){var z=Ar(B,3),V=z[0],H=z[1],Z=z[2],J=mc(V,H,Z),j=J.x,K=J.y,ee=J.z;return new Vm.Vector3(j,K,ee)};return D(S.map(function(N){return[T(N),P(N),R(N)]}),C).map(F)}function v(S,T){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,R=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,C=T+1,L;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?Xa().domain(S.map(function(Z,J){return J/(S.length-1)})).range(S):S;L=function(J){return A0(D(J),R,!0)}}else{var F=A0(S,R,!0);L=function(){return F}}for(var N=[],B=0,z=C;B<z;B++)for(var V=L(B/(z-1)),H=0;H<P;H++)N.push(V);return zh(N,R?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,R=S+1,C=[],L=0,D=R;L<D;L++)for(var F=L/(D-1),N=0;N<T;N++)C.push(F);return P&&C.reverse(),zh(C,1)}}}),rR=window.THREE?window.THREE:{Euler:ha,Mesh:Hn,MeshLambertMaterial:Aa,SphereGeometry:pa},Ete=Nr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new rR.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new rR.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=rt(e.tileLat),n=rt(e.tileLng),r=rt(e.tileAltitude),s=rt(e.tileWidth),o=rt(e.tileHeight),a=rt(e.tileUseGlobeProjection),l=rt(e.tileMaterial),c=rt(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var p=a(f),x=c(f),v=function(P){var R=u.__currentTargetD=P,C=R.lat,L=R.lng,D=R.alt,F=R.width,N=R.height,B=H1(L),z=H1(-C);u.geometry&&u.geometry.dispose(),u.geometry=new rR.SphereGeometry(rr*(1+D),Math.ceil(F/(x||-1)),Math.ceil(N/(x||-1)),H1(90-F/2)+(p?B:0),H1(F),H1(90-N/2)+(p?z:0),H1(N)),p||u.setRotationFromEuler(new rR.Euler(z,B,0,"YXZ"))},w={lat:+t(f),lng:+n(f),alt:+r(f),width:+s(f),height:+o(f)},S=u.__currentTargetD||Object.assign({},w,{width:0,height:0});Object.keys(w).some(function(T){return S[T]!==w[T]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?v(w):e.tweenGroup.add(new Vs(S).to(w,e.tilesTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(v).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),H1=function(e){return e*Math.PI/180},Eb=window.THREE?window.THREE:{BufferGeometry:Kn,Color:Ut,Points:yy,PointsMaterial:Xd},Mte=Nr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new Eb.Points(new Eb.BufferGeometry,new Eb.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=rt(t.particlesList),o=rt(t.particleLat),a=rt(t.particleLng),l=rt(t.particleAltitude);n.geometry.setAttribute("position",zh(s(r).map(function(c){return Object.values(mc(o(c),a(c),l(c)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=rt(e.particlesColor),r=rt(e.particlesSize),s=rt(e.particlesSizeAttenuation),o=rt(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=Ar(a,2),c=l[0],u=l[1];if(u.material.size=r(c),u.material.sizeAttenuation=s(c),e.particlesTexture)u.material.color=new Eb.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),p=uu(f);u.material.color=new Eb.Color(Gh(f)),u.material.transparent=p<1,u.material.opacity=p,u.material.alphaTest=0}})}}),B3e=window.THREE?window.THREE:{BufferGeometry:Kn},U3e=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;lR(this,e),t=aR(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return uR(e,i),cR(e)})(B3e.BufferGeometry),W1=window.THREE?window.THREE:{Color:Ut,Group:xs,Line:jd,LineBasicMaterial:kc,Vector3:ie},k3e=Hm.default.default||Hm.default,Cte=Nr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new W1.Group;return s.__globeObjType="ring",s}),t.ticker=new k3e,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=rt(t.ringColor),a=rt(t.ringAltitude),l=rt(t.ringMaxRadius),c=rt(t.ringPropagationSpeed),u=rt(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var p=Ar(f,2),x=p[1];return x}).forEach(function(f){var p=Ar(f,2),x=p[0],v=p[1];if((v.__nextRingTime||0)<=s){var w=u(x)/1e3;v.__nextRingTime=s+(w<=0?1/0:w);var S=new W1.Line(new U3e(1,t.ringResolution),new W1.LineBasicMaterial),T=o(x),P=T instanceof Array||T instanceof Function,R;P?T instanceof Array?(R=Xa().domain(T.map(function(V,H){return H/(T.length-1)})).range(T),S.material.transparent=T.some(function(V){return uu(V)<1})):(R=T,S.material.transparent=!0):(S.material.color=new W1.Color(Gh(T)),x3e(S.material,uu(T)));var C=rr*(1+a(x)),L=l(x),D=L*Math.PI/180,F=c(x),N=F<=0,B=function(H){var Z=H.t,J=(N?1-Z:Z)*D;if(S.scale.x=S.scale.y=C*Math.sin(J),S.position.z=C*(1-Math.cos(J)),P){var j=R(Z);S.material.color=new W1.Color(Gh(j)),S.material.transparent&&(S.material.opacity=uu(j))}};if(F===0)B({t:0}),v.add(S);else{var z=Math.abs(L/F)*1e3;t.tweenGroup.add(new Vs({t:0}).to({t:1},z).onUpdate(B).onStart(function(){return v.add(S)}).onComplete(function(){t.tweenGroup.remove(this),v.remove(S),p0(S)}).start())}}})}})},update:function(e){var t=rt(e.ringLat),n=rt(e.ringLng),r=rt(e.ringAltitude),s=e.scene.localToWorld(new W1.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,mc(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),G3e={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},\u03BF:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"\xA6":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},\u03A4:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},\u03A0:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},\u0390:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"\xB2":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"\u2013":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},\u039A:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},\u0192:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},\u03CC:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"\xBB":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"\xA9":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},\u03CE:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"\xAB":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"\u2219":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u00FF:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},\u00B5:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},\u0399:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},\u038E:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2019":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u039D:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},\u03C2:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},\u03A8:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},\u03B9:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},\u0386:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},\u03B5:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},\u0394:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"\u2030":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"\u2014":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},\u03C1:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"\xAF":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},\u0397:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u0391:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"\u2026":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u03BD:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"\xB6":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},\u03B2:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},\u039C:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},\u038C:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u0389:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2022":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"\xA5":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},\u03B3:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},\u03B1:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"\xAD":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03A7:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"\u2020":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"\xB0":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},\u039E:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "},"\xA0":{x_min:0,x_max:0,ha:853},\u03AB:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"\u201D":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},\u038A:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},\u0392:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},\u03C5:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},\u03C7:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},\u03AF:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},\u0396:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"\xA8":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\u2039":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\u201E":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},\u03B4:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},\u03AD:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},\u03C9:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"\xB4":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\xB1":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},\u03CB:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"\xA7":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},\u03A9:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},\u03CD:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"\u2122":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},\u03AE:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},\u0398:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"\xAE":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},\u0395:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"\xB3":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},\u03C3:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},\u03B6:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},\u03B8:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},\u039F:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},\u0393:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},\u0388:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u038F:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},\u03AA:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"\xBD":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},\u03A1:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u00AA:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"\u0385":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},\u03A6:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"\u204B":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},\u03A3:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"\u203A":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\xA3":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"\xAC":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},\u03BB:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},\u03C4:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},\u03BE:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},\u039B:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},\u03B0:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"\xB7":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u03A5:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},\u03BC:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03C6:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"\u201C":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"\u2018":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},\u03CA:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},\u03C0:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},\u03AC:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"\xA4":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},\u03BA:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"\u2021":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},\u03C8:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},\u03B7:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},z3e="normal",V3e=1189,q3e=-100,H3e="normal",W3e={yMin:-334,xMin:-111,yMax:1189,xMax:1672},j3e=1e3,X3e={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) \u039Cagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"\u039Cagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r52235223 \r52245224 Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r52255225 \r
@@ -5231,7 +5231,7 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof
52315231 \r52325232 The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r52335233 \r5234-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"\u039Cagenta ltd",font_sub_family_name:"Regular"},W3e=-334,j3e="Helvetiker",X3e=1522,$3e=50,Y3e={glyphs:B3e,cssFontWeight:U3e,ascender:k3e,underlinePosition:G3e,cssFontStyle:z3e,boundingBox:V3e,resolution:q3e,original_font_information:H3e,descender:W3e,familyName:j3e,lineHeight:X3e,underlineThickness:$3e},cu=Oi(Oi({},window.THREE?window.THREE:{BoxGeometry:Gc,CircleGeometry:A_,DoubleSide:ir,Group:_s,Mesh:Hn,MeshLambertMaterial:pa,TextGeometry:Sb,Vector3:ie}),{},{Font:V1,TextGeometry:Sb}),Mte=Nr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:Y3e,onChange:function(e,t){t.font=new cu.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r;var s=new cu.CircleGeometry(1,32);t.dataMapper=new Ja(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new cu.MeshLambertMaterial;o.side=ir;var a=new cu.Group;a.add(new cu.Mesh(s,o));var l=new cu.Mesh(void 0,o);a.add(l);var c=new cu.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=rt(e.labelLat),n=rt(e.labelLng),r=rt(e.labelAltitude),s=rt(e.labelText),o=rt(e.labelSize),a=rt(e.labelRotation),l=rt(e.labelColor),c=rt(e.labelIncludeDot),u=rt(e.labelDotRadius),f=rt(e.labelDotOrientation),p=new Set(["right","top","bottom"]),x=2*Math.PI*rr/360;e.dataMapper.onUpdateObj(function(v,w){var S=Ar(v.children,2),T=S[0],P=S[1],R=Ar(P.children,1),C=R[0],L=l(w),D=uu(L);P.material.color.set(Gh(L)),P.material.transparent=D<1,P.material.opacity=D;var F=c(w),N=f(w);!F||!p.has(N)&&(N="bottom");var B=F?+u(w)*x:1e-12;T.scale.x=T.scale.y=B;var z=+o(w)*x;if(P.geometry&&P.geometry.dispose(),P.geometry=new cu.TextGeometry(s(w),{font:e.font,size:z,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),C.geometry&&C.geometry.dispose(),P.geometry.computeBoundingBox(),C.geometry=WU(cu.BoxGeometry,Vi(new cu.Vector3().subVectors(P.geometry.boundingBox.max,P.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),N!=="right"&&P.geometry.center(),F){var V=B+z/2;N==="right"&&(P.position.x=V),P.position.y={right:-z/2,top:V+z/2,bottom:-V-z/2}[N]}var H=function(Z){var ee=v.__currentTargetD=Z,ae=ee.lat,ce=ee.lng,de=ee.alt,ve=ee.rot,Ie=ee.scale;Object.assign(v.position,mc(ae,ce,de)),v.lookAt(e.scene.localToWorld(new cu.Vector3(0,0,0))),v.rotateY(Math.PI),v.rotateZ(-ve*Math.PI/180),v.scale.x=v.scale.y=v.scale.z=Ie},K={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},J=v.__currentTargetD||Object.assign({},K,{scale:1e-12});Object.keys(K).some(function(j){return J[j]!==K[j]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?H(K):e.tweenGroup.add(new Vs(J).to(K,e.labelsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),K3e=Oi(Oi({},window.THREE?window.THREE:{}),{},{CSS2DObject:n3}),Cte=Nr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=Ar(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=rt(t.htmlElement)(s),a=new K3e.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=rt(e.htmlLat),s=rt(e.htmlLng),o=rt(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(p){var x=a.__currentTargetD=p,v=x.alt,w=x.lat,S=x.lng;Object.assign(a.position,mc(w,S,v)),n.updateObjVisibility(a)},u={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?c(u):e.tweenGroup.add(new Vs(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),sR=window.THREE?window.THREE:{Group:_s,Mesh:Hn,MeshLambertMaterial:pa,SphereGeometry:da},Rte=Nr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new sR.Mesh(new sR.SphereGeometry(1,16,8),new sR.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=rt(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new sR.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=rt(e.objectLat),r=rt(e.objectLng),s=rt(e.objectAltitude),o=rt(e.objectFacesSurface),a=rt(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),p=+s(c);Object.assign(l.position,mc(u,f,p)),o(c)?l.setRotationFromEuler(new ua(Vm(-u),Vm(f),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],v=a(c);v&&x.setRotationFromEuler(new ua(Vm(v.x||0),Vm(v.y||0),Vm(v.z||0)))}).digest(e.objectsData)}}),Pte=Nr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new Ja(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=rt(t.customThreeObject)(n,rr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||Br(e.scene);var n=rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,rr)}).digest(e.customLayerData)}}),oR=window.THREE?window.THREE:{Camera:Rf,Group:_s,Vector2:Oe,Vector3:ie},Z3e=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Ite=Ca("globeLayer",pte),Q3e=Object.assign.apply(Object,Vi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return ro({},i,Ite.linkProp(i))}))),J3e=Object.assign.apply(Object,Vi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return ro({},i,Ite.linkMethod(i))}))),eEe=Ca("pointsLayer",Ate),tEe=Object.assign.apply(Object,Vi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return ro({},i,eEe.linkProp(i))}))),nEe=Ca("arcsLayer",gte),iEe=Object.assign.apply(Object,Vi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return ro({},i,nEe.linkProp(i))}))),rEe=Ca("hexBinLayer",_te),sEe=Object.assign.apply(Object,Vi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return ro({},i,rEe.linkProp(i))}))),oEe=Ca("heatmapsLayer",yte),aEe=Object.assign.apply(Object,Vi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return ro({},i,oEe.linkProp(i))}))),lEe=Ca("hexedPolygonsLayer",bte),cEe=Object.assign.apply(Object,Vi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return ro({},i,lEe.linkProp(i))}))),uEe=Ca("polygonsLayer",vte),hEe=Object.assign.apply(Object,Vi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return ro({},i,uEe.linkProp(i))}))),fEe=Ca("pathsLayer",wte),dEe=Object.assign.apply(Object,Vi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return ro({},i,fEe.linkProp(i))}))),pEe=Ca("tilesLayer",Ste),AEe=Object.assign.apply(Object,Vi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return ro({},i,pEe.linkProp(i))}))),mEe=Ca("particlesLayer",Tte),gEe=Object.assign.apply(Object,Vi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return ro({},i,mEe.linkProp(i))}))),_Ee=Ca("ringsLayer",Ete),xEe=Object.assign.apply(Object,Vi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return ro({},i,_Ee.linkProp(i))}))),yEe=Ca("labelsLayer",Mte),vEe=Object.assign.apply(Object,Vi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return ro({},i,yEe.linkProp(i))}))),bEe=Ca("htmlElementsLayer",Cte),wEe=Object.assign.apply(Object,Vi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return ro({},i,bEe.linkProp(i))}))),SEe=Ca("objectsLayer",Rte),TEe=Object.assign.apply(Object,Vi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return ro({},i,SEe.linkProp(i))}))),EEe=Ca("customLayer",Pte),MEe=Object.assign.apply(Object,Vi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return ro({},i,EEe.linkProp(i))}))),CEe=Nr({props:Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new oR.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},Q3e),tEe),iEe),sEe),aEe),hEe),cEe),dEe),AEe),gEe),xEe),vEe),wEe),TEe),MEe),methods:Oi({getGlobeRadius:ete,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return mc.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return dte.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof oR.Camera?t.position:t,r=ete(),s=void 0;if(e.scene&&n){var o,a,l,c;s=function(f){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),c===void 0&&(c=Math.acos(l/a));var p=o.distanceTo(f);if(p<l)return!1;var x=f.length(),v=Math.acos((Math.pow(a,2)+Math.pow(p,2)-Math.pow(x,2))/(2*a*p));return v<c}}e.layersThatNeedUpdatePov.forEach(function(u){return u.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(u){return u.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},J3e),stateInit:function(){var e=new HA,t={tweenGroup:e},n={globeLayer:pte(t),pointsLayer:Ate(t),arcsLayer:gte(t),hexBinLayer:_te(t),heatmapsLayer:yte(t),polygonsLayer:vte(t),hexedPolygonsLayer:bte(t),pathsLayer:wte(t),tilesLayer:Ste(t),particlesLayer:Tte(t),ringsLayer:Ete(t),labelsLayer:Mte(t),htmlElementsLayer:Cte(t),objectsLayer:Rte(t),customLayer:Pte(t)};return Oi(Oi({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;Br(e),t.scene=e,t.scene.visible=!1,Z3e.forEach(function(c){var u=new oR.Group;t.scene.add(u),t[c](u)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new Vs({k:1e-6}).to({k:1},600).easing(Lr.Quadratic.Out).onUpdate(function(f){var p=f.k;return t.scene.scale.set(p,p,p)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new oR.Vector3(0,1,0);t.tweenGroup.add(new Vs({rot:Math.PI*2}).to({rot:0},1200).easing(Lr.Quintic.Out).onUpdate(function(f){var p=f.rot;return t.scene.setRotationFromAxisAngle(u,p)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function REe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var o;lR(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=aR(this,s,[].concat(l)),o.__kapsuleInstance=WU(i,[].concat(Vi(t?[o]:[]),l)),o}return uR(s,r),cR(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var PEe=window.THREE?window.THREE:{Group:_s},$U=REe(CEe,PEe.Group,!0);var YU={type:"change"},QU={type:"start"},JU={type:"end"},Nte=1e-6,Pi={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},hR=new Oe,m0=new Oe,IEe=new ie,fR=new ie,KU=new ie,X1=new ys,Lte=new ie,dR=new ie,ZU=new ie,pR=new ie,AR=class extends Pf{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:Aa.ROTATE,MIDDLE:Aa.DOLLY,RIGHT:Aa.PAN},this.target=new ie,this.state=Pi.NONE,this.keyState=Pi.NONE,this._lastPosition=new ie,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new ie,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new ie,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=LEe.bind(this),this._onPointerDown=NEe.bind(this),this._onPointerUp=DEe.bind(this),this._onPointerCancel=FEe.bind(this),this._onContextMenu=VEe.bind(this),this._onMouseWheel=zEe.bind(this),this._onKeyDown=BEe.bind(this),this._onKeyUp=OEe.bind(this),this._onTouchStart=qEe.bind(this),this._onTouchMove=HEe.bind(this),this._onTouchEnd=WEe.bind(this),this._onMouseDown=UEe.bind(this),this._onMouseMove=kEe.bind(this),this._onMouseUp=GEe.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}handleResize(){let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>Nte&&(this.dispatchEvent(YU),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Nte||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(YU),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Pi.NONE,this.keyState=Pi.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(YU),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(m0.copy(this._panEnd).sub(this._panStart),m0.lengthSq()){if(this.object.isOrthographicCamera){let e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;m0.x*=e,m0.y*=t}m0.multiplyScalar(this._eye.length()*this.panSpeed),fR.copy(this._eye).cross(this.object.up).setLength(m0.x),fR.add(IEe.copy(this.object.up).setLength(m0.y)),this.object.position.add(fR),this.target.add(fR),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(m0.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){pR.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=pR.length();e?(this._eye.copy(this.object.position).sub(this.target),Lte.copy(this._eye).normalize(),dR.copy(this.object.up).normalize(),ZU.crossVectors(dR,Lte).normalize(),dR.setLength(this._moveCurr.y-this._movePrev.y),ZU.setLength(this._moveCurr.x-this._movePrev.x),pR.copy(dR.add(ZU)),KU.crossVectors(pR,this._eye).normalize(),e*=this.rotateSpeed,X1.setFromAxisAngle(KU,e),this._eye.applyQuaternion(X1),this.object.up.applyQuaternion(X1),this._lastAxis.copy(KU),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),X1.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(X1),this.object.up.applyQuaternion(X1)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Pi.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Wc.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Wc.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return hR.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),hR}_getMouseOnCircle(e,t){return hR.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),hR}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}};function NEe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function LEe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function DEe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function FEe(i){this._removePointer(i)}function OEe(){this.enabled!==!1&&(this.keyState=Pi.NONE,window.addEventListener("keydown",this._onKeyDown))}function BEe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Pi.NONE&&(i.code===this.keys[Pi.ROTATE]&&!this.noRotate?this.keyState=Pi.ROTATE:i.code===this.keys[Pi.ZOOM]&&!this.noZoom?this.keyState=Pi.ZOOM:i.code===this.keys[Pi.PAN]&&!this.noPan&&(this.keyState=Pi.PAN)))}function UEe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Aa.DOLLY:this.state=Pi.ZOOM;break;case Aa.ROTATE:this.state=Pi.ROTATE;break;case Aa.PAN:this.state=Pi.PAN;break;default:this.state=Pi.NONE}let t=this.keyState!==Pi.NONE?this.keyState:this.state;t===Pi.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Pi.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Pi.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(QU)}function kEe(i){let e=this.keyState!==Pi.NONE?this.keyState:this.state;e===Pi.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Pi.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Pi.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function GEe(){this.state=Pi.NONE,this.dispatchEvent(JU)}function zEe(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent(QU),this.dispatchEvent(JU)}}function VEe(i){this.enabled!==!1&&i.preventDefault()}function qEe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=Pi.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=Pi.TOUCH_ZOOM_PAN;let e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);let n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart)}this.dispatchEvent(QU)}function HEe(i){if(this._trackPointer(i),this._pointers.length===1)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));else{let e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);let r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function WEe(i){switch(this._pointers.length){case 0:this.state=Pi.NONE;break;case 1:this.state=Pi.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Pi.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){let t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(JU)}var Dte={type:"change"},tk={type:"start"},Ote={type:"end"},mR=new Cf,Fte=new oa,jEe=Math.cos(70*Wc.DEG2RAD),qs=new ie,el=2*Math.PI,Ji={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},ek=1e-6,gR=class extends Pf{constructor(e,t=null){super(e,t),this.state=Ji.NONE,this.target=new ie,this.cursor=new ie,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Aa.ROTATE,MIDDLE:Aa.DOLLY,RIGHT:Aa.PAN},this.touches={ONE:Qd.ROTATE,TWO:Qd.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new ie,this._lastQuaternion=new ys,this._lastTargetPosition=new ie,this._quat=new ys().setFromUnitVectors(e.up,new ie(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new b_,this._sphericalDelta=new b_,this._scale=1,this._panOffset=new ie,this._rotateStart=new Oe,this._rotateEnd=new Oe,this._rotateDelta=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._panDelta=new Oe,this._dollyStart=new Oe,this._dollyEnd=new Oe,this._dollyDelta=new Oe,this._dollyDirection=new ie,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=$Ee.bind(this),this._onPointerDown=XEe.bind(this),this._onPointerUp=YEe.bind(this),this._onContextMenu=nMe.bind(this),this._onMouseWheel=QEe.bind(this),this._onKeyDown=JEe.bind(this),this._onTouchStart=eMe.bind(this),this._onTouchMove=tMe.bind(this),this._onMouseDown=KEe.bind(this),this._onMouseMove=ZEe.bind(this),this._interceptControlDown=iMe.bind(this),this._interceptControlUp=rMe.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Dte),this.update(),this.state=Ji.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;qs.copy(t).sub(this.target),qs.applyQuaternion(this._quat),this._spherical.setFromVector3(qs),this.autoRotate&&this.state===Ji.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=el:n>Math.PI&&(n-=el),r<-Math.PI?r+=el:r>Math.PI&&(r-=el),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(qs.setFromSpherical(this._spherical),qs.applyQuaternion(this._quatInverse),t.copy(this.target).add(qs),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=qs.length();o=this._clampDistance(a*this._scale);let l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let a=new ie(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new ie(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=qs.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(mR.origin.copy(this.object.position),mR.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(mR.direction))<jEe?this.object.lookAt(this.target):(Fte.setFromNormalAndCoplanarPoint(this.object.up,this.target),mR.intersectPlane(Fte,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>ek||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ek||this._lastTargetPosition.distanceToSquared(this.target)>ek?(this.dispatchEvent(Dte),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?el/60*this.autoRotateSpeed*e:el/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){qs.setFromMatrixColumn(t,0),qs.multiplyScalar(-e),this._panOffset.add(qs)}_panUp(e,t){this.screenSpacePanning===!0?qs.setFromMatrixColumn(t,1):(qs.setFromMatrixColumn(t,0),qs.crossVectors(this.object.up,qs)),qs.multiplyScalar(e),this._panOffset.add(qs)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;qs.copy(r).sub(this.target);let s=qs.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(el*this._rotateDelta.x/t.clientHeight),this._rotateUp(el*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(el*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-el*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(el*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-el*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(el*this._rotateDelta.x/t.clientHeight),this._rotateUp(el*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function XEe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function $Ee(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function YEe(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Ote),this.state=Ji.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function KEe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Aa.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Ji.DOLLY;break;case Aa.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ji.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ji.ROTATE}break;case Aa.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ji.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ji.PAN}break;default:this.state=Ji.NONE}this.state!==Ji.NONE&&this.dispatchEvent(tk)}function ZEe(i){switch(this.state){case Ji.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Ji.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Ji.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function QEe(i){this.enabled===!1||this.enableZoom===!1||this.state!==Ji.NONE||(i.preventDefault(),this.dispatchEvent(tk),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Ote))}function JEe(i){this.enabled!==!1&&this._handleKeyDown(i)}function eMe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Qd.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Ji.TOUCH_ROTATE;break;case Qd.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Ji.TOUCH_PAN;break;default:this.state=Ji.NONE}break;case 2:switch(this.touches.TWO){case Qd.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Ji.TOUCH_DOLLY_PAN;break;case Qd.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Ji.TOUCH_DOLLY_ROTATE;break;default:this.state=Ji.NONE}break;default:this.state=Ji.NONE}this.state!==Ji.NONE&&this.dispatchEvent(tk)}function tMe(i){switch(this._trackPointer(i),this.state){case Ji.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Ji.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Ji.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Ji.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Ji.NONE}}function nMe(i){this.enabled!==!1&&i.preventDefault()}function iMe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function rMe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var sMe={type:"change"},Bte=1e-6,Ute=new ys,_R=class extends Pf{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new ie(0,0,0),this._rotationVector=new ie(0,0,0),this._lastQuaternion=new ys,this._lastPosition=new ie,this._status=0,this._onKeyDown=oMe.bind(this),this._onKeyUp=aMe.bind(this),this._onPointerMove=cMe.bind(this),this._onPointerDown=lMe.bind(this),this._onPointerUp=uMe.bind(this),this._onPointerCancel=hMe.bind(this),this._onContextMenu=fMe.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;let t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),Ute.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(Ute),(this._lastPosition.distanceToSquared(t.position)>Bte||8*(1-this._lastQuaternion.dot(t.quaternion))>Bte)&&(this.dispatchEvent(sMe),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){let e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}};function oMe(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function aMe(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function lMe(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function cMe(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){let e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function uMe(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function hMe(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function fMe(i){this.enabled!==!1&&i.preventDefault()}var kte={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`5234+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"\u039Cagenta ltd",font_sub_family_name:"Regular"},$3e=-334,Y3e="Helvetiker",Z3e=1522,K3e=50,Q3e={glyphs:G3e,cssFontWeight:z3e,ascender:V3e,underlinePosition:q3e,cssFontStyle:H3e,boundingBox:W3e,resolution:j3e,original_font_information:X3e,descender:$3e,familyName:Y3e,lineHeight:Z3e,underlineThickness:K3e},cu=Oi(Oi({},window.THREE?window.THREE:{BoxGeometry:Gc,CircleGeometry:A_,DoubleSide:ir,Group:xs,Mesh:Hn,MeshLambertMaterial:Aa,TextGeometry:Sb,Vector3:ie}),{},{Font:V1,TextGeometry:Sb}),Rte=Nr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:Q3e,onChange:function(e,t){t.font=new cu.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r;var s=new cu.CircleGeometry(1,32);t.dataMapper=new el(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new cu.MeshLambertMaterial;o.side=ir;var a=new cu.Group;a.add(new cu.Mesh(s,o));var l=new cu.Mesh(void 0,o);a.add(l);var c=new cu.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=rt(e.labelLat),n=rt(e.labelLng),r=rt(e.labelAltitude),s=rt(e.labelText),o=rt(e.labelSize),a=rt(e.labelRotation),l=rt(e.labelColor),c=rt(e.labelIncludeDot),u=rt(e.labelDotRadius),f=rt(e.labelDotOrientation),p=new Set(["right","top","bottom"]),x=2*Math.PI*rr/360;e.dataMapper.onUpdateObj(function(v,w){var S=Ar(v.children,2),T=S[0],P=S[1],R=Ar(P.children,1),C=R[0],L=l(w),D=uu(L);P.material.color.set(Gh(L)),P.material.transparent=D<1,P.material.opacity=D;var F=c(w),N=f(w);!F||!p.has(N)&&(N="bottom");var B=F?+u(w)*x:1e-12;T.scale.x=T.scale.y=B;var z=+o(w)*x;if(P.geometry&&P.geometry.dispose(),P.geometry=new cu.TextGeometry(s(w),{font:e.font,size:z,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),C.geometry&&C.geometry.dispose(),P.geometry.computeBoundingBox(),C.geometry=jU(cu.BoxGeometry,Vi(new cu.Vector3().subVectors(P.geometry.boundingBox.max,P.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),N!=="right"&&P.geometry.center(),F){var V=B+z/2;N==="right"&&(P.position.x=V),P.position.y={right:-z/2,top:V+z/2,bottom:-V-z/2}[N]}var H=function(K){var ee=v.__currentTargetD=K,ae=ee.lat,ce=ee.lng,de=ee.alt,ve=ee.rot,Ie=ee.scale;Object.assign(v.position,mc(ae,ce,de)),v.lookAt(e.scene.localToWorld(new cu.Vector3(0,0,0))),v.rotateY(Math.PI),v.rotateZ(-ve*Math.PI/180),v.scale.x=v.scale.y=v.scale.z=Ie},Z={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},J=v.__currentTargetD||Object.assign({},Z,{scale:1e-12});Object.keys(Z).some(function(j){return J[j]!==Z[j]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?H(Z):e.tweenGroup.add(new Vs(J).to(Z,e.labelsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),J3e=Oi(Oi({},window.THREE?window.THREE:{}),{},{CSS2DObject:n3}),Pte=Nr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=Ar(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=rt(t.htmlElement)(s),a=new J3e.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=rt(e.htmlLat),s=rt(e.htmlLng),o=rt(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(p){var x=a.__currentTargetD=p,v=x.alt,w=x.lat,S=x.lng;Object.assign(a.position,mc(w,S,v)),n.updateObjVisibility(a)},u={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?c(u):e.tweenGroup.add(new Vs(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),sR=window.THREE?window.THREE:{Group:xs,Mesh:Hn,MeshLambertMaterial:Aa,SphereGeometry:pa},Ite=Nr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new sR.Mesh(new sR.SphereGeometry(1,16,8),new sR.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=rt(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new sR.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=rt(e.objectLat),r=rt(e.objectLng),s=rt(e.objectAltitude),o=rt(e.objectFacesSurface),a=rt(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),p=+s(c);Object.assign(l.position,mc(u,f,p)),o(c)?l.setRotationFromEuler(new ha(qm(-u),qm(f),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],v=a(c);v&&x.setRotationFromEuler(new ha(qm(v.x||0),qm(v.y||0),qm(v.z||0)))}).digest(e.objectsData)}}),Nte=Nr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=rt(t.customThreeObject)(n,rr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||Br(e.scene);var n=rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,rr)}).digest(e.customLayerData)}}),oR=window.THREE?window.THREE:{Camera:Rf,Group:xs,Vector2:Oe,Vector3:ie},eEe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Lte=Ra("globeLayer",mte),tEe=Object.assign.apply(Object,Vi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return ro({},i,Lte.linkProp(i))}))),nEe=Object.assign.apply(Object,Vi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return ro({},i,Lte.linkMethod(i))}))),iEe=Ra("pointsLayer",gte),rEe=Object.assign.apply(Object,Vi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return ro({},i,iEe.linkProp(i))}))),sEe=Ra("arcsLayer",xte),oEe=Object.assign.apply(Object,Vi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return ro({},i,sEe.linkProp(i))}))),aEe=Ra("hexBinLayer",yte),lEe=Object.assign.apply(Object,Vi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return ro({},i,aEe.linkProp(i))}))),cEe=Ra("heatmapsLayer",bte),uEe=Object.assign.apply(Object,Vi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return ro({},i,cEe.linkProp(i))}))),hEe=Ra("hexedPolygonsLayer",Ste),fEe=Object.assign.apply(Object,Vi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return ro({},i,hEe.linkProp(i))}))),dEe=Ra("polygonsLayer",wte),pEe=Object.assign.apply(Object,Vi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return ro({},i,dEe.linkProp(i))}))),AEe=Ra("pathsLayer",Tte),mEe=Object.assign.apply(Object,Vi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return ro({},i,AEe.linkProp(i))}))),gEe=Ra("tilesLayer",Ete),_Ee=Object.assign.apply(Object,Vi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return ro({},i,gEe.linkProp(i))}))),xEe=Ra("particlesLayer",Mte),yEe=Object.assign.apply(Object,Vi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return ro({},i,xEe.linkProp(i))}))),vEe=Ra("ringsLayer",Cte),bEe=Object.assign.apply(Object,Vi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return ro({},i,vEe.linkProp(i))}))),wEe=Ra("labelsLayer",Rte),SEe=Object.assign.apply(Object,Vi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return ro({},i,wEe.linkProp(i))}))),TEe=Ra("htmlElementsLayer",Pte),EEe=Object.assign.apply(Object,Vi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return ro({},i,TEe.linkProp(i))}))),MEe=Ra("objectsLayer",Ite),CEe=Object.assign.apply(Object,Vi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return ro({},i,MEe.linkProp(i))}))),REe=Ra("customLayer",Nte),PEe=Object.assign.apply(Object,Vi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return ro({},i,REe.linkProp(i))}))),IEe=Nr({props:Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new oR.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},tEe),rEe),oEe),lEe),uEe),pEe),fEe),mEe),_Ee),yEe),bEe),SEe),EEe),CEe),PEe),methods:Oi({getGlobeRadius:nte,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return mc.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ate.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof oR.Camera?t.position:t,r=nte(),s=void 0;if(e.scene&&n){var o,a,l,c;s=function(f){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),c===void 0&&(c=Math.acos(l/a));var p=o.distanceTo(f);if(p<l)return!1;var x=f.length(),v=Math.acos((Math.pow(a,2)+Math.pow(p,2)-Math.pow(x,2))/(2*a*p));return v<c}}e.layersThatNeedUpdatePov.forEach(function(u){return u.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(u){return u.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},nEe),stateInit:function(){var e=new WA,t={tweenGroup:e},n={globeLayer:mte(t),pointsLayer:gte(t),arcsLayer:xte(t),hexBinLayer:yte(t),heatmapsLayer:bte(t),polygonsLayer:wte(t),hexedPolygonsLayer:Ste(t),pathsLayer:Tte(t),tilesLayer:Ete(t),particlesLayer:Mte(t),ringsLayer:Cte(t),labelsLayer:Rte(t),htmlElementsLayer:Pte(t),objectsLayer:Ite(t),customLayer:Nte(t)};return Oi(Oi({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;Br(e),t.scene=e,t.scene.visible=!1,eEe.forEach(function(c){var u=new oR.Group;t.scene.add(u),t[c](u)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new Vs({k:1e-6}).to({k:1},600).easing(Lr.Quadratic.Out).onUpdate(function(f){var p=f.k;return t.scene.scale.set(p,p,p)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new oR.Vector3(0,1,0);t.tweenGroup.add(new Vs({rot:Math.PI*2}).to({rot:0},1200).easing(Lr.Quintic.Out).onUpdate(function(f){var p=f.rot;return t.scene.setRotationFromAxisAngle(u,p)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function NEe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var o;lR(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=aR(this,s,[].concat(l)),o.__kapsuleInstance=jU(i,[].concat(Vi(t?[o]:[]),l)),o}return uR(s,r),cR(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var LEe=window.THREE?window.THREE:{Group:xs},YU=NEe(IEe,LEe.Group,!0);var ZU={type:"change"},JU={type:"start"},ek={type:"end"},Dte=1e-6,Pi={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},hR=new Oe,m0=new Oe,DEe=new ie,fR=new ie,KU=new ie,X1=new vs,Fte=new ie,dR=new ie,QU=new ie,pR=new ie,AR=class extends Pf{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:ma.ROTATE,MIDDLE:ma.DOLLY,RIGHT:ma.PAN},this.target=new ie,this.state=Pi.NONE,this.keyState=Pi.NONE,this._lastPosition=new ie,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new ie,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new ie,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=OEe.bind(this),this._onPointerDown=FEe.bind(this),this._onPointerUp=BEe.bind(this),this._onPointerCancel=UEe.bind(this),this._onContextMenu=WEe.bind(this),this._onMouseWheel=HEe.bind(this),this._onKeyDown=GEe.bind(this),this._onKeyUp=kEe.bind(this),this._onTouchStart=jEe.bind(this),this._onTouchMove=XEe.bind(this),this._onTouchEnd=$Ee.bind(this),this._onMouseDown=zEe.bind(this),this._onMouseMove=VEe.bind(this),this._onMouseUp=qEe.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}handleResize(){let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>Dte&&(this.dispatchEvent(ZU),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Dte||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(ZU),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Pi.NONE,this.keyState=Pi.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(ZU),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(m0.copy(this._panEnd).sub(this._panStart),m0.lengthSq()){if(this.object.isOrthographicCamera){let e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;m0.x*=e,m0.y*=t}m0.multiplyScalar(this._eye.length()*this.panSpeed),fR.copy(this._eye).cross(this.object.up).setLength(m0.x),fR.add(DEe.copy(this.object.up).setLength(m0.y)),this.object.position.add(fR),this.target.add(fR),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(m0.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){pR.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=pR.length();e?(this._eye.copy(this.object.position).sub(this.target),Fte.copy(this._eye).normalize(),dR.copy(this.object.up).normalize(),QU.crossVectors(dR,Fte).normalize(),dR.setLength(this._moveCurr.y-this._movePrev.y),QU.setLength(this._moveCurr.x-this._movePrev.x),pR.copy(dR.add(QU)),KU.crossVectors(pR,this._eye).normalize(),e*=this.rotateSpeed,X1.setFromAxisAngle(KU,e),this._eye.applyQuaternion(X1),this.object.up.applyQuaternion(X1),this._lastAxis.copy(KU),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),X1.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(X1),this.object.up.applyQuaternion(X1)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Pi.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Wc.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Wc.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return hR.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),hR}_getMouseOnCircle(e,t){return hR.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),hR}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}};function FEe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function OEe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function BEe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function UEe(i){this._removePointer(i)}function kEe(){this.enabled!==!1&&(this.keyState=Pi.NONE,window.addEventListener("keydown",this._onKeyDown))}function GEe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Pi.NONE&&(i.code===this.keys[Pi.ROTATE]&&!this.noRotate?this.keyState=Pi.ROTATE:i.code===this.keys[Pi.ZOOM]&&!this.noZoom?this.keyState=Pi.ZOOM:i.code===this.keys[Pi.PAN]&&!this.noPan&&(this.keyState=Pi.PAN)))}function zEe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case ma.DOLLY:this.state=Pi.ZOOM;break;case ma.ROTATE:this.state=Pi.ROTATE;break;case ma.PAN:this.state=Pi.PAN;break;default:this.state=Pi.NONE}let t=this.keyState!==Pi.NONE?this.keyState:this.state;t===Pi.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Pi.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Pi.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(JU)}function VEe(i){let e=this.keyState!==Pi.NONE?this.keyState:this.state;e===Pi.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Pi.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Pi.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function qEe(){this.state=Pi.NONE,this.dispatchEvent(ek)}function HEe(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent(JU),this.dispatchEvent(ek)}}function WEe(i){this.enabled!==!1&&i.preventDefault()}function jEe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=Pi.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=Pi.TOUCH_ZOOM_PAN;let e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);let n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart)}this.dispatchEvent(JU)}function XEe(i){if(this._trackPointer(i),this._pointers.length===1)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));else{let e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);let r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function $Ee(i){switch(this._pointers.length){case 0:this.state=Pi.NONE;break;case 1:this.state=Pi.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Pi.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){let t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(ek)}var Ote={type:"change"},nk={type:"start"},Ute={type:"end"},mR=new Cf,Bte=new aa,YEe=Math.cos(70*Wc.DEG2RAD),qs=new ie,tl=2*Math.PI,Ji={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},tk=1e-6,gR=class extends Pf{constructor(e,t=null){super(e,t),this.state=Ji.NONE,this.target=new ie,this.cursor=new ie,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ma.ROTATE,MIDDLE:ma.DOLLY,RIGHT:ma.PAN},this.touches={ONE:Qd.ROTATE,TWO:Qd.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new ie,this._lastQuaternion=new vs,this._lastTargetPosition=new ie,this._quat=new vs().setFromUnitVectors(e.up,new ie(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new b_,this._sphericalDelta=new b_,this._scale=1,this._panOffset=new ie,this._rotateStart=new Oe,this._rotateEnd=new Oe,this._rotateDelta=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._panDelta=new Oe,this._dollyStart=new Oe,this._dollyEnd=new Oe,this._dollyDelta=new Oe,this._dollyDirection=new ie,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=KEe.bind(this),this._onPointerDown=ZEe.bind(this),this._onPointerUp=QEe.bind(this),this._onContextMenu=sMe.bind(this),this._onMouseWheel=tMe.bind(this),this._onKeyDown=nMe.bind(this),this._onTouchStart=iMe.bind(this),this._onTouchMove=rMe.bind(this),this._onMouseDown=JEe.bind(this),this._onMouseMove=eMe.bind(this),this._interceptControlDown=oMe.bind(this),this._interceptControlUp=aMe.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Ote),this.update(),this.state=Ji.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;qs.copy(t).sub(this.target),qs.applyQuaternion(this._quat),this._spherical.setFromVector3(qs),this.autoRotate&&this.state===Ji.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=tl:n>Math.PI&&(n-=tl),r<-Math.PI?r+=tl:r>Math.PI&&(r-=tl),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(qs.setFromSpherical(this._spherical),qs.applyQuaternion(this._quatInverse),t.copy(this.target).add(qs),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=qs.length();o=this._clampDistance(a*this._scale);let l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let a=new ie(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new ie(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=qs.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(mR.origin.copy(this.object.position),mR.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(mR.direction))<YEe?this.object.lookAt(this.target):(Bte.setFromNormalAndCoplanarPoint(this.object.up,this.target),mR.intersectPlane(Bte,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>tk||8*(1-this._lastQuaternion.dot(this.object.quaternion))>tk||this._lastTargetPosition.distanceToSquared(this.target)>tk?(this.dispatchEvent(Ote),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?tl/60*this.autoRotateSpeed*e:tl/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){qs.setFromMatrixColumn(t,0),qs.multiplyScalar(-e),this._panOffset.add(qs)}_panUp(e,t){this.screenSpacePanning===!0?qs.setFromMatrixColumn(t,1):(qs.setFromMatrixColumn(t,0),qs.crossVectors(this.object.up,qs)),qs.multiplyScalar(e),this._panOffset.add(qs)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;qs.copy(r).sub(this.target);let s=qs.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(tl*this._rotateDelta.x/t.clientHeight),this._rotateUp(tl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(tl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-tl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(tl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-tl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(tl*this._rotateDelta.x/t.clientHeight),this._rotateUp(tl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function ZEe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function KEe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function QEe(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Ute),this.state=Ji.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function JEe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case ma.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Ji.DOLLY;break;case ma.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ji.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ji.ROTATE}break;case ma.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ji.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ji.PAN}break;default:this.state=Ji.NONE}this.state!==Ji.NONE&&this.dispatchEvent(nk)}function eMe(i){switch(this.state){case Ji.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Ji.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Ji.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function tMe(i){this.enabled===!1||this.enableZoom===!1||this.state!==Ji.NONE||(i.preventDefault(),this.dispatchEvent(nk),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Ute))}function nMe(i){this.enabled!==!1&&this._handleKeyDown(i)}function iMe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Qd.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Ji.TOUCH_ROTATE;break;case Qd.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Ji.TOUCH_PAN;break;default:this.state=Ji.NONE}break;case 2:switch(this.touches.TWO){case Qd.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Ji.TOUCH_DOLLY_PAN;break;case Qd.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Ji.TOUCH_DOLLY_ROTATE;break;default:this.state=Ji.NONE}break;default:this.state=Ji.NONE}this.state!==Ji.NONE&&this.dispatchEvent(nk)}function rMe(i){switch(this._trackPointer(i),this.state){case Ji.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Ji.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Ji.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Ji.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Ji.NONE}}function sMe(i){this.enabled!==!1&&i.preventDefault()}function oMe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function aMe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var lMe={type:"change"},kte=1e-6,Gte=new vs,_R=class extends Pf{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new ie(0,0,0),this._rotationVector=new ie(0,0,0),this._lastQuaternion=new vs,this._lastPosition=new ie,this._status=0,this._onKeyDown=cMe.bind(this),this._onKeyUp=uMe.bind(this),this._onPointerMove=fMe.bind(this),this._onPointerDown=hMe.bind(this),this._onPointerUp=dMe.bind(this),this._onPointerCancel=pMe.bind(this),this._onContextMenu=AMe.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;let t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),Gte.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(Gte),(this._lastPosition.distanceToSquared(t.position)>kte||8*(1-this._lastQuaternion.dot(t.quaternion))>kte)&&(this.dispatchEvent(lMe),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){let e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}};function cMe(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function uMe(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function hMe(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function fMe(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){let e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function dMe(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function pMe(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function AMe(i){this.enabled!==!1&&i.preventDefault()}var zte={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`52355235 52365236 varying vec2 vUv;52375237
@@ -5254,8 +5254,8 @@ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52545254 gl_FragColor = opacity * texel;52555255 52565256 5257- }`};var td=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}},dMe=new Vc(-1,1,1,-1,0,1),nk=class extends Zn{constructor(){super(),this.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new kn([0,2,0,0,2,0],2))}},pMe=new nk,xR=class{constructor(e){this._mesh=new Hn(pMe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,dMe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var yR=class extends td{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof jr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=zA.clone(e.uniforms),this.material=new jr({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new xR(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};var Cb=class extends td{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}},vR=class extends td{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var bR=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new Oe);this._width=n.width,this._height=n.height,t=new ca(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Li}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new yR(kte),this.copyPass.material.blending=Xr,this.timer=new CA}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let r=0,s=this.passes.length;r<s;r++){let o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){let a=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}Cb!==void 0&&(o instanceof Cb?n=!0:o instanceof vR&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new Oe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};var wR=class extends td{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new Ut}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=r}};function Ra(){return Ra=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Ra.apply(null,arguments)}function Gte(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function g0(i,e){return g0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},g0(i,e)}function zte(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,g0(i,e)}function SR(i){return SR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},SR(i)}function Vte(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function ik(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ik=function(){return!!i})()}function qte(i,e,t){if(ik())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&g0(r,t.prototype),r}function TR(i){var e=typeof Map=="function"?new Map:void 0;return TR=function(n){if(n===null||!Vte(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return qte(n,arguments,SR(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),g0(r,n)},TR(i)}var tl=(function(i){zte(e,i);function e(t){var n;if(1)n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else for(var r,s,o;o<r;o++);return Gte(n)}return e})(TR(Error));function Hte(i,e){return i.substr(-e.length)===e}var AMe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Wte(i){if(typeof i!="string")return i;var e=i.match(AMe);return e?parseFloat(i):i}var mMe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!Hte(t,"px"))throw new tl(69,e,t);r=Wte(t)}if(typeof n=="string"){if(!Hte(n,"px"))throw new tl(70,e,n);s=Wte(n)}if(typeof r=="string")throw new tl(71,t,e);if(typeof s=="string")throw new tl(72,n,e);return""+r/s+e}},Xte=mMe,Mft=Xte("em");var Cft=Xte("rem");function rk(i){return Math.round(i*255)}function gMe(i,e,t){return rk(i)+","+rk(e)+","+rk(t)}function Rb(i,e,t,n){if(n===void 0&&(n=gMe),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,o=s*(1-Math.abs(r%2-1)),a=0,l=0,c=0;r>=0&&r<1?(a=s,l=o):r>=1&&r<2?(a=o,l=s):r>=2&&r<3?(l=s,c=o):r>=3&&r<4?(l=o,c=s):r>=4&&r<5?(a=o,c=s):r>=5&&r<6&&(a=s,c=o);var u=t-s/2,f=a+u,p=l+u,x=c+u;return n(f,p,x)}var jte={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function _Me(i){if(typeof i!="string")return i;var e=i.toLowerCase();return jte[e]?"#"+jte[e]:i}var xMe=/^#[a-fA-F0-9]{6}$/,yMe=/^#[a-fA-F0-9]{8}$/,vMe=/^#[a-fA-F0-9]{3}$/,bMe=/^#[a-fA-F0-9]{4}$/,sk=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,wMe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,SMe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,TMe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function _0(i){if(typeof i!="string")throw new tl(3);var e=_Me(i);if(e.match(xMe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(yMe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(vMe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(bMe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=sk.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=wMe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var o=SMe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+Rb(a,l,c)+")",f=sk.exec(u);if(!f)throw new tl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var p=TMe.exec(e.substring(0,50));if(p){var x=parseInt(""+p[1],10),v=parseInt(""+p[2],10)/100,w=parseInt(""+p[3],10)/100,S="rgb("+Rb(x,v,w)+")",T=sk.exec(S);if(!T)throw new tl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+p[4])>1?parseFloat(""+p[4])/100:parseFloat(""+p[4])}}throw new tl(5)}function EMe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),o=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:i.alpha}:{hue:0,saturation:0,lightness:o};var a,l=r-s,c=o>.5?l/(2-r-s):l/(r+s);switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;default:a=(e-t)/l+4;break}return a*=60,i.alpha!==void 0?{hue:a,saturation:c,lightness:o,alpha:i.alpha}:{hue:a,saturation:c,lightness:o}}function x0(i){return EMe(_0(i))}var MMe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},ak=MMe;function Hm(i){var e=i.toString(16);return e.length===1?"0"+e:e}function ok(i){return Hm(Math.round(i*255))}function CMe(i,e,t){return ak("#"+ok(i)+ok(e)+ok(t))}function ER(i,e,t){return Rb(i,e,t,CMe)}function RMe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return ER(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return ER(i.hue,i.saturation,i.lightness);throw new tl(1)}function PMe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?ER(i,e,t):"rgba("+Rb(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?ER(i.hue,i.saturation,i.lightness):"rgba("+Rb(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new tl(2)}function lk(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return ak("#"+Hm(i)+Hm(e)+Hm(t));if(typeof i=="object"&&e===void 0&&t===void 0)return ak("#"+Hm(i.red)+Hm(i.green)+Hm(i.blue));throw new tl(6)}function MR(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=_0(i);return"rgba("+r.red+","+r.green+","+r.blue+","+e+")"}else{if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?lk(i,e,t):"rgba("+i+","+e+","+t+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?lk(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new tl(7)}var IMe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},NMe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},LMe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},DMe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function y0(i){if(typeof i!="object")throw new tl(8);if(NMe(i))return MR(i);if(IMe(i))return lk(i);if(DMe(i))return PMe(i);if(LMe(i))return RMe(i);throw new tl(8)}function $te(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):$te(i,e,r)}}function Dl(i){return $te(i,i.length,[])}function FMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Ra({},t,{hue:t.hue+parseFloat(i)}))}var Rft=Dl(FMe);function $1(i,e,t){return Math.max(i,Math.min(e,t))}function OMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Ra({},t,{lightness:$1(0,1,t.lightness-parseFloat(i))}))}var Pft=Dl(OMe);function BMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Ra({},t,{saturation:$1(0,1,t.saturation-parseFloat(i))}))}var Ift=Dl(BMe);function UMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Ra({},t,{lightness:$1(0,1,t.lightness+parseFloat(i))}))}var Nft=Dl(UMe);function kMe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=_0(e),r=Ra({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=_0(t),o=Ra({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),a=r.alpha-o.alpha,l=parseFloat(i)*2-1,c=l*a===-1?l:l+a,u=1+l*a,f=(c/u+1)/2,p=1-f,x={red:Math.floor(r.red*f+o.red*p),green:Math.floor(r.green*f+o.green*p),blue:Math.floor(r.blue*f+o.blue*p),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return MR(x)}var GMe=Dl(kMe),Yte=GMe;function zMe(i,e){if(e==="transparent")return e;var t=_0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Ra({},t,{alpha:$1(0,1,(n*100+parseFloat(i)*100)/100)});return MR(r)}var VMe=Dl(zMe),Kte=VMe;function qMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Ra({},t,{saturation:$1(0,1,t.saturation+parseFloat(i))}))}var Lft=Dl(qMe);function HMe(i,e){return e==="transparent"?e:y0(Ra({},x0(e),{hue:parseFloat(i)}))}var Dft=Dl(HMe);function WMe(i,e){return e==="transparent"?e:y0(Ra({},x0(e),{lightness:parseFloat(i)}))}var Fft=Dl(WMe);function jMe(i,e){return e==="transparent"?e:y0(Ra({},x0(e),{saturation:parseFloat(i)}))}var Oft=Dl(jMe);function XMe(i,e){return e==="transparent"?e:Yte(parseFloat(i),"rgb(0, 0, 0)",e)}var Bft=Dl(XMe);function $Me(i,e){return e==="transparent"?e:Yte(parseFloat(i),"rgb(255, 255, 255)",e)}var Uft=Dl($Me);function YMe(i,e){if(e==="transparent")return e;var t=_0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Ra({},t,{alpha:$1(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return MR(r)}var kft=Dl(YMe);var CR="http://www.w3.org/1999/xhtml",ck={svg:"http://www.w3.org/2000/svg",xhtml:CR,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function RR(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),ck.hasOwnProperty(e)?{space:ck[e],local:i}:i}function KMe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===CR&&e.documentElement.namespaceURI===CR?e.createElement(i):e.createElementNS(t,i)}}function ZMe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function PR(i){var e=RR(i);return(e.local?ZMe:KMe)(e)}function QMe(){}function IR(i){return i==null?QMe:function(){return this.querySelector(i)}}function Zte(i){typeof i!="function"&&(i=IR(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=i.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new es(n,this._parents)}function uk(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function JMe(){return[]}function Qte(i){return i==null?JMe:function(){return this.querySelectorAll(i)}}function eCe(i){return function(){return uk(i.apply(this,arguments))}}function Jte(i){typeof i=="function"?i=eCe(i):i=Qte(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(i.call(l,l.__data__,c,o)),r.push(l));return new es(n,r)}function ene(i){return function(){return this.matches(i)}}function NR(i){return function(e){return e.matches(i)}}var tCe=Array.prototype.find;function nCe(i){return function(){return tCe.call(this.children,i)}}function iCe(){return this.firstElementChild}function tne(i){return this.select(i==null?iCe:nCe(typeof i=="function"?i:NR(i)))}var rCe=Array.prototype.filter;function sCe(){return Array.from(this.children)}function oCe(i){return function(){return rCe.call(this.children,i)}}function nne(i){return this.selectAll(i==null?sCe:oCe(typeof i=="function"?i:NR(i)))}function ine(i){typeof i!="function"&&(i=ene(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=[],l,c=0;c<o;++c)(l=s[c])&&i.call(l,l.__data__,c,s)&&a.push(l);return new es(n,this._parents)}function LR(i){return new Array(i.length)}function rne(){return new es(this._enter||this._groups.map(LR),this._parents)}function Pb(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}Pb.prototype={constructor:Pb,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function sne(i){return function(){return i}}function aCe(i,e,t,n,r,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):t[o]=new Pb(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function lCe(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,p=new Array(u),x;for(a=0;a<u;++a)(l=e[a])&&(p[a]=x=o.call(l,l.__data__,a,e)+"",c.has(x)?r[a]=l:c.set(x,l));for(a=0;a<f;++a)x=o.call(i,s[a],a,s)+"",(l=c.get(x))?(n[a]=l,l.__data__=s[a],c.delete(x)):t[a]=new Pb(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(r[a]=l)}function cCe(i){return i.__data__}function one(i,e){if(!arguments.length)return Array.from(this,cCe);var t=e?lCe:aCe,n=this._parents,r=this._groups;typeof i!="function"&&(i=sne(i));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],f=r[c],p=f.length,x=uCe(i.call(u,u&&u.__data__,c,n)),v=x.length,w=a[c]=new Array(v),S=o[c]=new Array(v),T=l[c]=new Array(p);t(u,f,w,S,T,x,e);for(var P=0,R=0,C,L;P<v;++P)if(C=w[P]){for(P>=R&&(R=P+1);!(L=S[R])&&++R<v;);C._next=L||null}}return o=new es(o,n),o._enter=a,o._exit=l,o}function uCe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function ane(){return new es(this._exit||this._groups.map(LR),this._parents)}function lne(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function cne(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],f=c.length,p=a[l]=new Array(f),x,v=0;v<f;++v)(x=c[v]||u[v])&&(p[v]=x);for(;l<r;++l)a[l]=t[l];return new es(a,this._parents)}function une(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],o;--r>=0;)(o=n[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function hne(i){i||(i=hCe);function e(f,p){return f&&p?i(f.__data__,p.__data__):!f-!p}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new es(r,this._parents).order()}function hCe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function fne(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function dne(){return Array.from(this)}function pne(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var o=n[r];if(o)return o}return null}function Ane(){let i=0;for(let e of this)++i;return i}function mne(){return!this.node()}function gne(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&i.call(a,a.__data__,s,r);return this}function fCe(i){return function(){this.removeAttribute(i)}}function dCe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function pCe(i,e){return function(){this.setAttribute(i,e)}}function ACe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function mCe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function gCe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function _ne(i,e){var t=RR(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?dCe:fCe:typeof e=="function"?t.local?gCe:mCe:t.local?ACe:pCe)(t,e))}function DR(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function _Ce(i){return function(){this.style.removeProperty(i)}}function xCe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function yCe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function xne(i,e,t){return arguments.length>1?this.each((e==null?_Ce:typeof e=="function"?yCe:xCe)(i,e,t??"")):vCe(this.node(),i)}function vCe(i,e){return i.style.getPropertyValue(e)||DR(i).getComputedStyle(i,null).getPropertyValue(e)}function bCe(i){return function(){delete this[i]}}function wCe(i,e){return function(){this[i]=e}}function SCe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function yne(i,e){return arguments.length>1?this.each((e==null?bCe:typeof e=="function"?SCe:wCe)(i,e)):this.node()[i]}function vne(i){return i.trim().split(/^|\s+/)}function hk(i){return i.classList||new bne(i)}function bne(i){this._node=i,this._names=vne(i.getAttribute("class")||"")}bne.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function wne(i,e){for(var t=hk(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Sne(i,e){for(var t=hk(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function TCe(i){return function(){wne(this,i)}}function ECe(i){return function(){Sne(this,i)}}function MCe(i,e){return function(){(e.apply(this,arguments)?wne:Sne)(this,i)}}function Tne(i,e){var t=vne(i+"");if(arguments.length<2){for(var n=hk(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?MCe:e?TCe:ECe)(t,e))}function CCe(){this.textContent=""}function RCe(i){return function(){this.textContent=i}}function PCe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Ene(i){return arguments.length?this.each(i==null?CCe:(typeof i=="function"?PCe:RCe)(i)):this.node().textContent}function ICe(){this.innerHTML=""}function NCe(i){return function(){this.innerHTML=i}}function LCe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function Mne(i){return arguments.length?this.each(i==null?ICe:(typeof i=="function"?LCe:NCe)(i)):this.node().innerHTML}function DCe(){this.nextSibling&&this.parentNode.appendChild(this)}function Cne(){return this.each(DCe)}function FCe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Rne(){return this.each(FCe)}function Pne(i){var e=typeof i=="function"?i:PR(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function OCe(){return null}function Ine(i,e){var t=typeof i=="function"?i:PR(i),n=e==null?OCe:typeof e=="function"?e:IR(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function BCe(){var i=this.parentNode;i&&i.removeChild(this)}function Nne(){return this.each(BCe)}function UCe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function kCe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function Lne(i){return this.select(i?kCe:UCe)}function Dne(i){return arguments.length?this.property("__data__",i):this.node().__data__}function GCe(i){return function(e){i.call(this,e,this.__data__)}}function zCe(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function VCe(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function qCe(i,e,t){return function(){var n=this.__on,r,s=GCe(e);if(n){for(var o=0,a=n.length;o<a;++o)if((r=n[o]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function Fne(i,e,t){var n=zCe(i+""),r,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((o=n[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?qCe:VCe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function One(i,e,t){var n=DR(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function HCe(i,e){return function(){return One(this,i,e)}}function WCe(i,e){return function(){return One(this,i,e.apply(this,arguments))}}function Bne(i,e){return this.each((typeof e=="function"?WCe:HCe)(i,e))}function*Une(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,o;r<s;++r)(o=n[r])&&(yield o)}var fk=[null];function es(i,e){this._groups=i,this._parents=e}function jCe(){return new es([[document.documentElement]],fk)}function XCe(){return this}es.prototype=jCe.prototype={constructor:es,select:Zte,selectAll:Jte,selectChild:tne,selectChildren:nne,filter:ine,data:one,enter:rne,exit:ane,join:lne,merge:cne,selection:XCe,order:une,sort:hne,call:fne,nodes:dne,node:pne,size:Ane,empty:mne,each:gne,attr:_ne,style:xne,property:yne,classed:Tne,text:Ene,html:Mne,raise:Cne,lower:Rne,append:Pne,insert:Ine,remove:Nne,clone:Lne,datum:Dne,on:Fne,dispatch:Bne,[Symbol.iterator]:Une};function dk(i){return typeof i=="string"?new es([[document.querySelector(i)]],[document.documentElement]):new es([[i]],fk)}function kne(i){let e;for(;e=i.sourceEvent;)i=e;return i}function pk(i,e){if(i=kne(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var Lb,wr,Hne,_k,v0,Gne,Wne,jne,Ak,OR,Ib,Xne,xk,mk,gk,$Ce,UR={},kR=[],YCe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zR=Array.isArray;function Vh(i,e){for(var t in e)i[t]=e[t];return i}function yk(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function KCe(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Lb.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return Nb(i,o,n,r,null)}function Nb(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Hne,__i:-1,__u:0};return r==null&&wr.vnode!=null&&wr.vnode(s),s}function VR(i){return i.children}function BR(i,e){this.props=i,this.context=e}function Wm(i,e){if(e==null)return i.__?Wm(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Wm(i):null}function ZCe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Vh({},e);s.__v=e.__v+1,wr.vnode&&wr.vnode(s),vk(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??Wm(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,Qne(n,s,r),e.__e=e.__=null,s.__e!=t&&$ne(s)}}function $ne(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),$ne(i)}function zne(i){(!i.__d&&(i.__d=!0)&&v0.push(i)&&!GR.__r++||Gne!=wr.debounceRendering)&&((Gne=wr.debounceRendering)||Wne)(GR)}function GR(){try{for(var i,e=1;v0.length;)v0.length>e&&v0.sort(jne),i=v0.shift(),e=v0.length,ZCe(i)}finally{v0.length=GR.__r=0}}function Yne(i,e,t,n,r,s,o,a,l,c,u){var f,p,x,v,w,S,T=n&&n.__k||kR,P=e.length;for(l=QCe(t,e,T,l,P),f=0;f<P;f++)(x=t.__k[f])!=null&&(p=x.__i!=-1&&T[x.__i]||UR,x.__i=f,S=vk(i,x,p,r,s,o,a,l,c,u),v=x.__e,x.ref&&p.ref!=x.ref&&(p.ref&&bk(p.ref,null,x),u.push(x.ref,x.__c||v,x)),w==null&&v!=null&&(w=v),4&x.__u?(l=Kne(x,l,i),p.__e&&(p.__e=null)):typeof x.type=="function"&&S!==void 0?l=S:v&&(l=v.nextSibling),x.__u&=-7);return t.__e=w,l}function QCe(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,p=0;for(i.__k=new Array(r),s=0;s<r;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[s]=Nb(null,o,null,null,null):zR(o)?o=i.__k[s]=Nb(VR,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=Nb(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+p,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=JCe(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?p--:r<u&&p++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,o.__u|=4))):i.__k[s]=null;if(f)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=Wm(a)),eie(a,a));return n}function Kne(i,e,t){var n,r;if(typeof i.type=="function"){for(n=i.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=i,e=Kne(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=Wm(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function JCe(i,e,t,n){var r,s,o,a=i.key,l=i.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(n>(u?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((c=e[o=r>=0?r--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return o}return-1}function Vne(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||YCe.test(e)?t:t+"px"}function FR(i,e,t,n,r){var s,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||Vne(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||Vne(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Xne,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t[Ib]=n[Ib]:(t[Ib]=xk,i.addEventListener(e,s?gk:mk,s)):i.removeEventListener(e,s?gk:mk,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function qne(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[OR]==null)e[OR]=xk++;else if(e[OR]<t[Ib])return;return t(wr.event?wr.event(e):e)}}}function vk(i,e,t,n,r,s,o,a,l,c){var u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B,z=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=wr.__b)&&u(e);e:if(typeof z=="function"){f=o.length;try{if(P=e.props,R=z.prototype&&z.prototype.render,C=(u=z.contextType)&&n[u.__c],L=u?C?C.props.value:u.__:n,t.__c?T=(p=e.__c=t.__c).__=p.__E:(R?e.__c=p=new z(P,L):(e.__c=p=new BR(P,L),p.constructor=z,p.render=tRe),C&&C.sub(p),p.state||(p.state={}),p.__n=n,x=p.__d=!0,p.__h=[],p._sb=[]),R&&p.__s==null&&(p.__s=p.state),R&&z.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Vh({},p.__s)),Vh(p.__s,z.getDerivedStateFromProps(P,p.__s))),v=p.props,w=p.state,p.__v=e,x)R&&z.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),R&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(R&&z.getDerivedStateFromProps==null&&P!==v&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(P,L),e.__v==t.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(P,p.__s,L)===!1){e.__v!=t.__v&&(p.props=P,p.state=p.__s,p.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(V){V&&(V.__=e)}),kR.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&o.push(p),a=Wm(t);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(P,p.__s,L),R&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(v,w,S)})}if(p.context=L,p.props=P,p.__P=i,p.__e=!1,D=wr.__r,F=0,R)p.state=p.__s,p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),kR.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++F<25);p.state=p.__s,p.getChildContext!=null&&(n=Vh(Vh({},n),p.getChildContext())),R&&!x&&p.getSnapshotBeforeUpdate!=null&&(S=p.getSnapshotBeforeUpdate(v,w)),N=u!=null&&u.type===VR&&u.key==null?Jne(u.props.children):u,a=Yne(i,zR(N)?N:[N],e,t,n,r,s,o,a,l,c),p.base=e.__e,e.__u&=-161,p.__h.length&&o.push(p),T&&(p.__E=p.__=null)}catch(V){if(o.length=f,e.__v=null,l||s!=null){if(V.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s!=null&&(s[s.indexOf(a)]=null),e.__e=a}else if(s!=null)for(B=s.length;B--;)yk(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),V.then||Zne(e),wr.__e(V,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=eRe(t.__e,e,t,n,r,s,o,l,c);return(u=wr.diffed)&&u(e),128&e.__u?void 0:a}function Zne(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Zne))}function Qne(i,e,t){for(var n=0;n<t.length;n++)bk(t[n],t[++n],t[++n]);wr.__c&&wr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){wr.__e(s,r.__v)}})}function Jne(i){return typeof i!="object"||i==null||i.__b>0?i:zR(i)?i.map(Jne):i.constructor!==void 0?null:Vh({},i)}function eRe(i,e,t,n,r,s,o,a,l){var c,u,f,p,x,v,w,S=t.props||UR,T=e.props,P=e.type;if(P=="svg"?r="http://www.w3.org/2000/svg":P=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((x=s[c])&&"setAttribute"in x==!!P&&(P?x.localName==P:x.nodeType==3)){i=x,s[c]=null;break}}if(i==null){if(P==null)return document.createTextNode(T);i=document.createElementNS(r,P,T.is&&T),a&&(wr.__m&&wr.__m(e,s),a=!1),s=null}if(P==null)S===T||a&&i.data==T||(i.data=T);else{if(s=P=="textarea"&&T.defaultValue!=null?null:s&&Lb.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(x=i.attributes[c]).name]=x.value;for(c in S)x=S[c],c=="dangerouslySetInnerHTML"?f=x:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||FR(i,c,null,x,r);for(c in T)x=T[c],c=="children"?p=x:c=="dangerouslySetInnerHTML"?u=x:c=="value"?v=x:c=="checked"?w=x:a&&typeof x!="function"||S[c]===x||FR(i,c,x,S[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==i.innerHTML)||(i.innerHTML=u.__html),e.__k=[];else if(f&&(i.innerHTML=""),Yne(e.type=="template"?i.content:i,zR(p)?p:[p],e,t,n,P=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&Wm(t,0),a,l),s!=null)for(c=s.length;c--;)yk(s[c]);a&&P!="textarea"||(c="value",P=="progress"&&v==null?i.removeAttribute("value"):v!=null&&(v!==i[c]||P=="progress"&&!v||P=="option"&&v!=S[c])&&FR(i,c,v,S[c],r),c="checked",w!=null&&w!=i[c]&&FR(i,c,w,S[c],r))}return i}function bk(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){wr.__e(r,t)}}function eie(i,e,t){var n,r;if(wr.unmount&&wr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||bk(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){wr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&eie(n[r],e,t||typeof i.type!="function");t||yk(i.__e),i.__c=i.__=i.__e=void 0}function tRe(i,e,t){return this.constructor(i,t)}function tie(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),wr.__&&wr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],vk(e,i=(!n&&t||e).__k=KCe(VR,null,[i]),r||UR,UR,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?Lb.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),Qne(s,i,o),i.props.children=null}function wk(i,e,t){var n,r,s,o,a=Vh({},i.props);for(s in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s]===void 0&&o!=null?o[s]:e[s];return arguments.length>2&&(a.children=arguments.length>3?Lb.call(arguments,2):t),Nb(i.type,a,n||i.key,r||i.ref,null)}Lb=kR.slice,wr={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(a){i=a}throw i}},Hne=0,_k=function(i){return i!=null&&i.constructor===void 0},BR.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Vh({},this.state),typeof i=="function"&&(i=i(Vh({},t),this.props)),i&&Vh(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),zne(this))},BR.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),zne(this))},BR.prototype.render=VR,v0=[],Wne=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jne=function(i,e){return i.__v.__b-e.__v.__b},GR.__r=0,Ak=Math.random().toString(8),OR="__d"+Ak,Ib="__a"+Ak,Xne=/(PointerCapture)$|Capture$/i,xk=0,mk=qne(!1),gk=qne(!0),$Ce=0;function nie(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function nRe(i){if(Array.isArray(i))return i}function iRe(i,e,t){return(e=cRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function rRe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function sRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5258-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iie(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function oRe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?iie(Object(t),!0).forEach(function(n){iRe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):iie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function aRe(i,e){return nRe(i)||rRe(i,e)||uRe(i,e)||sRe()}function lRe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function cRe(i){var e=lRe(i,"string");return typeof e=="symbol"?e:e+""}function qR(i){"@babel/helpers - typeof";return qR=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qR(i)}function uRe(i,e){if(i){if(typeof i=="string")return nie(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?nie(i,e):void 0}}var Sk=function(e){if(qR(e)!=="object")return e;var t=wk(e);if(t.props){var n;t.props=oRe({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(Sk):Sk(t.props.children))}return t},hRe=function(e){return _k(wk(e))},fRe=function(e,t){delete t.__k,tie(Sk(e),t)};function dRe(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var pRe=`.float-tooltip-kap {5257+ }`};var td=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}},mMe=new Vc(-1,1,1,-1,0,1),ik=class extends Kn{constructor(){super(),this.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new kn([0,2,0,0,2,0],2))}},gMe=new ik,xR=class{constructor(e){this._mesh=new Hn(gMe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,mMe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var yR=class extends td{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof jr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=VA.clone(e.uniforms),this.material=new jr({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new xR(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};var Cb=class extends td{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}},vR=class extends td{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var bR=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new Oe);this._width=n.width,this._height=n.height,t=new ua(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Li}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new yR(zte),this.copyPass.material.blending=Xr,this.timer=new RA}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let r=0,s=this.passes.length;r<s;r++){let o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){let a=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}Cb!==void 0&&(o instanceof Cb?n=!0:o instanceof vR&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new Oe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};var wR=class extends td{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new Ut}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=r}};function Pa(){return Pa=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Pa.apply(null,arguments)}function Vte(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function g0(i,e){return g0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},g0(i,e)}function qte(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,g0(i,e)}function SR(i){return SR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},SR(i)}function Hte(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function rk(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rk=function(){return!!i})()}function Wte(i,e,t){if(rk())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&g0(r,t.prototype),r}function TR(i){var e=typeof Map=="function"?new Map:void 0;return TR=function(n){if(n===null||!Hte(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return Wte(n,arguments,SR(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),g0(r,n)},TR(i)}var nl=(function(i){qte(e,i);function e(t){var n;if(1)n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else for(var r,s,o;o<r;o++);return Vte(n)}return e})(TR(Error));function jte(i,e){return i.substr(-e.length)===e}var _Me=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Xte(i){if(typeof i!="string")return i;var e=i.match(_Me);return e?parseFloat(i):i}var xMe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!jte(t,"px"))throw new nl(69,e,t);r=Xte(t)}if(typeof n=="string"){if(!jte(n,"px"))throw new nl(70,e,n);s=Xte(n)}if(typeof r=="string")throw new nl(71,t,e);if(typeof s=="string")throw new nl(72,n,e);return""+r/s+e}},Yte=xMe,Ift=Yte("em");var Nft=Yte("rem");function sk(i){return Math.round(i*255)}function yMe(i,e,t){return sk(i)+","+sk(e)+","+sk(t)}function Rb(i,e,t,n){if(n===void 0&&(n=yMe),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,o=s*(1-Math.abs(r%2-1)),a=0,l=0,c=0;r>=0&&r<1?(a=s,l=o):r>=1&&r<2?(a=o,l=s):r>=2&&r<3?(l=s,c=o):r>=3&&r<4?(l=o,c=s):r>=4&&r<5?(a=o,c=s):r>=5&&r<6&&(a=s,c=o);var u=t-s/2,f=a+u,p=l+u,x=c+u;return n(f,p,x)}var $te={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function vMe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return $te[e]?"#"+$te[e]:i}var bMe=/^#[a-fA-F0-9]{6}$/,wMe=/^#[a-fA-F0-9]{8}$/,SMe=/^#[a-fA-F0-9]{3}$/,TMe=/^#[a-fA-F0-9]{4}$/,ok=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,EMe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,MMe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,CMe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function _0(i){if(typeof i!="string")throw new nl(3);var e=vMe(i);if(e.match(bMe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(wMe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(SMe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(TMe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=ok.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=EMe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var o=MMe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+Rb(a,l,c)+")",f=ok.exec(u);if(!f)throw new nl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var p=CMe.exec(e.substring(0,50));if(p){var x=parseInt(""+p[1],10),v=parseInt(""+p[2],10)/100,w=parseInt(""+p[3],10)/100,S="rgb("+Rb(x,v,w)+")",T=ok.exec(S);if(!T)throw new nl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+p[4])>1?parseFloat(""+p[4])/100:parseFloat(""+p[4])}}throw new nl(5)}function RMe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),o=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:i.alpha}:{hue:0,saturation:0,lightness:o};var a,l=r-s,c=o>.5?l/(2-r-s):l/(r+s);switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;default:a=(e-t)/l+4;break}return a*=60,i.alpha!==void 0?{hue:a,saturation:c,lightness:o,alpha:i.alpha}:{hue:a,saturation:c,lightness:o}}function x0(i){return RMe(_0(i))}var PMe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},lk=PMe;function Wm(i){var e=i.toString(16);return e.length===1?"0"+e:e}function ak(i){return Wm(Math.round(i*255))}function IMe(i,e,t){return lk("#"+ak(i)+ak(e)+ak(t))}function ER(i,e,t){return Rb(i,e,t,IMe)}function NMe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return ER(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return ER(i.hue,i.saturation,i.lightness);throw new nl(1)}function LMe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?ER(i,e,t):"rgba("+Rb(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?ER(i.hue,i.saturation,i.lightness):"rgba("+Rb(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new nl(2)}function ck(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return lk("#"+Wm(i)+Wm(e)+Wm(t));if(typeof i=="object"&&e===void 0&&t===void 0)return lk("#"+Wm(i.red)+Wm(i.green)+Wm(i.blue));throw new nl(6)}function MR(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=_0(i);return"rgba("+r.red+","+r.green+","+r.blue+","+e+")"}else{if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?ck(i,e,t):"rgba("+i+","+e+","+t+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?ck(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new nl(7)}var DMe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},FMe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},OMe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},BMe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function y0(i){if(typeof i!="object")throw new nl(8);if(FMe(i))return MR(i);if(DMe(i))return ck(i);if(BMe(i))return LMe(i);if(OMe(i))return NMe(i);throw new nl(8)}function Zte(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Zte(i,e,r)}}function Dl(i){return Zte(i,i.length,[])}function UMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{hue:t.hue+parseFloat(i)}))}var Lft=Dl(UMe);function $1(i,e,t){return Math.max(i,Math.min(e,t))}function kMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{lightness:$1(0,1,t.lightness-parseFloat(i))}))}var Dft=Dl(kMe);function GMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{saturation:$1(0,1,t.saturation-parseFloat(i))}))}var Fft=Dl(GMe);function zMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{lightness:$1(0,1,t.lightness+parseFloat(i))}))}var Oft=Dl(zMe);function VMe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=_0(e),r=Pa({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=_0(t),o=Pa({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),a=r.alpha-o.alpha,l=parseFloat(i)*2-1,c=l*a===-1?l:l+a,u=1+l*a,f=(c/u+1)/2,p=1-f,x={red:Math.floor(r.red*f+o.red*p),green:Math.floor(r.green*f+o.green*p),blue:Math.floor(r.blue*f+o.blue*p),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return MR(x)}var qMe=Dl(VMe),Kte=qMe;function HMe(i,e){if(e==="transparent")return e;var t=_0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Pa({},t,{alpha:$1(0,1,(n*100+parseFloat(i)*100)/100)});return MR(r)}var WMe=Dl(HMe),Qte=WMe;function jMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{saturation:$1(0,1,t.saturation+parseFloat(i))}))}var Bft=Dl(jMe);function XMe(i,e){return e==="transparent"?e:y0(Pa({},x0(e),{hue:parseFloat(i)}))}var Uft=Dl(XMe);function $Me(i,e){return e==="transparent"?e:y0(Pa({},x0(e),{lightness:parseFloat(i)}))}var kft=Dl($Me);function YMe(i,e){return e==="transparent"?e:y0(Pa({},x0(e),{saturation:parseFloat(i)}))}var Gft=Dl(YMe);function ZMe(i,e){return e==="transparent"?e:Kte(parseFloat(i),"rgb(0, 0, 0)",e)}var zft=Dl(ZMe);function KMe(i,e){return e==="transparent"?e:Kte(parseFloat(i),"rgb(255, 255, 255)",e)}var Vft=Dl(KMe);function QMe(i,e){if(e==="transparent")return e;var t=_0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Pa({},t,{alpha:$1(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return MR(r)}var qft=Dl(QMe);var CR="http://www.w3.org/1999/xhtml",uk={svg:"http://www.w3.org/2000/svg",xhtml:CR,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function RR(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),uk.hasOwnProperty(e)?{space:uk[e],local:i}:i}function JMe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===CR&&e.documentElement.namespaceURI===CR?e.createElement(i):e.createElementNS(t,i)}}function eCe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function PR(i){var e=RR(i);return(e.local?eCe:JMe)(e)}function tCe(){}function IR(i){return i==null?tCe:function(){return this.querySelector(i)}}function Jte(i){typeof i!="function"&&(i=IR(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=i.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new es(n,this._parents)}function hk(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function nCe(){return[]}function ene(i){return i==null?nCe:function(){return this.querySelectorAll(i)}}function iCe(i){return function(){return hk(i.apply(this,arguments))}}function tne(i){typeof i=="function"?i=iCe(i):i=ene(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(i.call(l,l.__data__,c,o)),r.push(l));return new es(n,r)}function nne(i){return function(){return this.matches(i)}}function NR(i){return function(e){return e.matches(i)}}var rCe=Array.prototype.find;function sCe(i){return function(){return rCe.call(this.children,i)}}function oCe(){return this.firstElementChild}function ine(i){return this.select(i==null?oCe:sCe(typeof i=="function"?i:NR(i)))}var aCe=Array.prototype.filter;function lCe(){return Array.from(this.children)}function cCe(i){return function(){return aCe.call(this.children,i)}}function rne(i){return this.selectAll(i==null?lCe:cCe(typeof i=="function"?i:NR(i)))}function sne(i){typeof i!="function"&&(i=nne(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=[],l,c=0;c<o;++c)(l=s[c])&&i.call(l,l.__data__,c,s)&&a.push(l);return new es(n,this._parents)}function LR(i){return new Array(i.length)}function one(){return new es(this._enter||this._groups.map(LR),this._parents)}function Pb(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}Pb.prototype={constructor:Pb,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function ane(i){return function(){return i}}function uCe(i,e,t,n,r,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):t[o]=new Pb(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function hCe(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,p=new Array(u),x;for(a=0;a<u;++a)(l=e[a])&&(p[a]=x=o.call(l,l.__data__,a,e)+"",c.has(x)?r[a]=l:c.set(x,l));for(a=0;a<f;++a)x=o.call(i,s[a],a,s)+"",(l=c.get(x))?(n[a]=l,l.__data__=s[a],c.delete(x)):t[a]=new Pb(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(r[a]=l)}function fCe(i){return i.__data__}function lne(i,e){if(!arguments.length)return Array.from(this,fCe);var t=e?hCe:uCe,n=this._parents,r=this._groups;typeof i!="function"&&(i=ane(i));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],f=r[c],p=f.length,x=dCe(i.call(u,u&&u.__data__,c,n)),v=x.length,w=a[c]=new Array(v),S=o[c]=new Array(v),T=l[c]=new Array(p);t(u,f,w,S,T,x,e);for(var P=0,R=0,C,L;P<v;++P)if(C=w[P]){for(P>=R&&(R=P+1);!(L=S[R])&&++R<v;);C._next=L||null}}return o=new es(o,n),o._enter=a,o._exit=l,o}function dCe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function cne(){return new es(this._exit||this._groups.map(LR),this._parents)}function une(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function hne(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],f=c.length,p=a[l]=new Array(f),x,v=0;v<f;++v)(x=c[v]||u[v])&&(p[v]=x);for(;l<r;++l)a[l]=t[l];return new es(a,this._parents)}function fne(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],o;--r>=0;)(o=n[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function dne(i){i||(i=pCe);function e(f,p){return f&&p?i(f.__data__,p.__data__):!f-!p}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new es(r,this._parents).order()}function pCe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function pne(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Ane(){return Array.from(this)}function mne(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var o=n[r];if(o)return o}return null}function gne(){let i=0;for(let e of this)++i;return i}function _ne(){return!this.node()}function xne(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&i.call(a,a.__data__,s,r);return this}function ACe(i){return function(){this.removeAttribute(i)}}function mCe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function gCe(i,e){return function(){this.setAttribute(i,e)}}function _Ce(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function xCe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function yCe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function yne(i,e){var t=RR(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?mCe:ACe:typeof e=="function"?t.local?yCe:xCe:t.local?_Ce:gCe)(t,e))}function DR(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function vCe(i){return function(){this.style.removeProperty(i)}}function bCe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function wCe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function vne(i,e,t){return arguments.length>1?this.each((e==null?vCe:typeof e=="function"?wCe:bCe)(i,e,t??"")):SCe(this.node(),i)}function SCe(i,e){return i.style.getPropertyValue(e)||DR(i).getComputedStyle(i,null).getPropertyValue(e)}function TCe(i){return function(){delete this[i]}}function ECe(i,e){return function(){this[i]=e}}function MCe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function bne(i,e){return arguments.length>1?this.each((e==null?TCe:typeof e=="function"?MCe:ECe)(i,e)):this.node()[i]}function wne(i){return i.trim().split(/^|\s+/)}function fk(i){return i.classList||new Sne(i)}function Sne(i){this._node=i,this._names=wne(i.getAttribute("class")||"")}Sne.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function Tne(i,e){for(var t=fk(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Ene(i,e){for(var t=fk(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function CCe(i){return function(){Tne(this,i)}}function RCe(i){return function(){Ene(this,i)}}function PCe(i,e){return function(){(e.apply(this,arguments)?Tne:Ene)(this,i)}}function Mne(i,e){var t=wne(i+"");if(arguments.length<2){for(var n=fk(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?PCe:e?CCe:RCe)(t,e))}function ICe(){this.textContent=""}function NCe(i){return function(){this.textContent=i}}function LCe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Cne(i){return arguments.length?this.each(i==null?ICe:(typeof i=="function"?LCe:NCe)(i)):this.node().textContent}function DCe(){this.innerHTML=""}function FCe(i){return function(){this.innerHTML=i}}function OCe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function Rne(i){return arguments.length?this.each(i==null?DCe:(typeof i=="function"?OCe:FCe)(i)):this.node().innerHTML}function BCe(){this.nextSibling&&this.parentNode.appendChild(this)}function Pne(){return this.each(BCe)}function UCe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ine(){return this.each(UCe)}function Nne(i){var e=typeof i=="function"?i:PR(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function kCe(){return null}function Lne(i,e){var t=typeof i=="function"?i:PR(i),n=e==null?kCe:typeof e=="function"?e:IR(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function GCe(){var i=this.parentNode;i&&i.removeChild(this)}function Dne(){return this.each(GCe)}function zCe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function VCe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function Fne(i){return this.select(i?VCe:zCe)}function One(i){return arguments.length?this.property("__data__",i):this.node().__data__}function qCe(i){return function(e){i.call(this,e,this.__data__)}}function HCe(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function WCe(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function jCe(i,e,t){return function(){var n=this.__on,r,s=qCe(e);if(n){for(var o=0,a=n.length;o<a;++o)if((r=n[o]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function Bne(i,e,t){var n=HCe(i+""),r,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((o=n[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?jCe:WCe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function Une(i,e,t){var n=DR(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function XCe(i,e){return function(){return Une(this,i,e)}}function $Ce(i,e){return function(){return Une(this,i,e.apply(this,arguments))}}function kne(i,e){return this.each((typeof e=="function"?$Ce:XCe)(i,e))}function*Gne(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,o;r<s;++r)(o=n[r])&&(yield o)}var dk=[null];function es(i,e){this._groups=i,this._parents=e}function YCe(){return new es([[document.documentElement]],dk)}function ZCe(){return this}es.prototype=YCe.prototype={constructor:es,select:Jte,selectAll:tne,selectChild:ine,selectChildren:rne,filter:sne,data:lne,enter:one,exit:cne,join:une,merge:hne,selection:ZCe,order:fne,sort:dne,call:pne,nodes:Ane,node:mne,size:gne,empty:_ne,each:xne,attr:yne,style:vne,property:bne,classed:Mne,text:Cne,html:Rne,raise:Pne,lower:Ine,append:Nne,insert:Lne,remove:Dne,clone:Fne,datum:One,on:Bne,dispatch:kne,[Symbol.iterator]:Gne};function pk(i){return typeof i=="string"?new es([[document.querySelector(i)]],[document.documentElement]):new es([[i]],dk)}function zne(i){let e;for(;e=i.sourceEvent;)i=e;return i}function Ak(i,e){if(i=zne(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var Lb,wr,jne,xk,v0,Vne,Xne,$ne,mk,OR,Ib,Yne,yk,gk,_k,KCe,UR={},kR=[],QCe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zR=Array.isArray;function Vh(i,e){for(var t in e)i[t]=e[t];return i}function vk(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function JCe(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Lb.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return Nb(i,o,n,r,null)}function Nb(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++jne,__i:-1,__u:0};return r==null&&wr.vnode!=null&&wr.vnode(s),s}function VR(i){return i.children}function BR(i,e){this.props=i,this.context=e}function jm(i,e){if(e==null)return i.__?jm(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?jm(i):null}function eRe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Vh({},e);s.__v=e.__v+1,wr.vnode&&wr.vnode(s),bk(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??jm(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,eie(n,s,r),e.__e=e.__=null,s.__e!=t&&Zne(s)}}function Zne(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),Zne(i)}function qne(i){(!i.__d&&(i.__d=!0)&&v0.push(i)&&!GR.__r++||Vne!=wr.debounceRendering)&&((Vne=wr.debounceRendering)||Xne)(GR)}function GR(){try{for(var i,e=1;v0.length;)v0.length>e&&v0.sort($ne),i=v0.shift(),e=v0.length,eRe(i)}finally{v0.length=GR.__r=0}}function Kne(i,e,t,n,r,s,o,a,l,c,u){var f,p,x,v,w,S,T=n&&n.__k||kR,P=e.length;for(l=tRe(t,e,T,l,P),f=0;f<P;f++)(x=t.__k[f])!=null&&(p=x.__i!=-1&&T[x.__i]||UR,x.__i=f,S=bk(i,x,p,r,s,o,a,l,c,u),v=x.__e,x.ref&&p.ref!=x.ref&&(p.ref&&wk(p.ref,null,x),u.push(x.ref,x.__c||v,x)),w==null&&v!=null&&(w=v),4&x.__u?(l=Qne(x,l,i),p.__e&&(p.__e=null)):typeof x.type=="function"&&S!==void 0?l=S:v&&(l=v.nextSibling),x.__u&=-7);return t.__e=w,l}function tRe(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,p=0;for(i.__k=new Array(r),s=0;s<r;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[s]=Nb(null,o,null,null,null):zR(o)?o=i.__k[s]=Nb(VR,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=Nb(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+p,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=nRe(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?p--:r<u&&p++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,o.__u|=4))):i.__k[s]=null;if(f)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=jm(a)),nie(a,a));return n}function Qne(i,e,t){var n,r;if(typeof i.type=="function"){for(n=i.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=i,e=Qne(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=jm(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function nRe(i,e,t,n){var r,s,o,a=i.key,l=i.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(n>(u?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((c=e[o=r>=0?r--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return o}return-1}function Hne(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||QCe.test(e)?t:t+"px"}function FR(i,e,t,n,r){var s,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||Hne(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||Hne(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Yne,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t[Ib]=n[Ib]:(t[Ib]=yk,i.addEventListener(e,s?_k:gk,s)):i.removeEventListener(e,s?_k:gk,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Wne(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[OR]==null)e[OR]=yk++;else if(e[OR]<t[Ib])return;return t(wr.event?wr.event(e):e)}}}function bk(i,e,t,n,r,s,o,a,l,c){var u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B,z=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=wr.__b)&&u(e);e:if(typeof z=="function"){f=o.length;try{if(P=e.props,R=z.prototype&&z.prototype.render,C=(u=z.contextType)&&n[u.__c],L=u?C?C.props.value:u.__:n,t.__c?T=(p=e.__c=t.__c).__=p.__E:(R?e.__c=p=new z(P,L):(e.__c=p=new BR(P,L),p.constructor=z,p.render=rRe),C&&C.sub(p),p.state||(p.state={}),p.__n=n,x=p.__d=!0,p.__h=[],p._sb=[]),R&&p.__s==null&&(p.__s=p.state),R&&z.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Vh({},p.__s)),Vh(p.__s,z.getDerivedStateFromProps(P,p.__s))),v=p.props,w=p.state,p.__v=e,x)R&&z.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),R&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(R&&z.getDerivedStateFromProps==null&&P!==v&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(P,L),e.__v==t.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(P,p.__s,L)===!1){e.__v!=t.__v&&(p.props=P,p.state=p.__s,p.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(V){V&&(V.__=e)}),kR.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&o.push(p),a=jm(t);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(P,p.__s,L),R&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(v,w,S)})}if(p.context=L,p.props=P,p.__P=i,p.__e=!1,D=wr.__r,F=0,R)p.state=p.__s,p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),kR.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++F<25);p.state=p.__s,p.getChildContext!=null&&(n=Vh(Vh({},n),p.getChildContext())),R&&!x&&p.getSnapshotBeforeUpdate!=null&&(S=p.getSnapshotBeforeUpdate(v,w)),N=u!=null&&u.type===VR&&u.key==null?tie(u.props.children):u,a=Kne(i,zR(N)?N:[N],e,t,n,r,s,o,a,l,c),p.base=e.__e,e.__u&=-161,p.__h.length&&o.push(p),T&&(p.__E=p.__=null)}catch(V){if(o.length=f,e.__v=null,l||s!=null){if(V.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s!=null&&(s[s.indexOf(a)]=null),e.__e=a}else if(s!=null)for(B=s.length;B--;)vk(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),V.then||Jne(e),wr.__e(V,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=iRe(t.__e,e,t,n,r,s,o,l,c);return(u=wr.diffed)&&u(e),128&e.__u?void 0:a}function Jne(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Jne))}function eie(i,e,t){for(var n=0;n<t.length;n++)wk(t[n],t[++n],t[++n]);wr.__c&&wr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){wr.__e(s,r.__v)}})}function tie(i){return typeof i!="object"||i==null||i.__b>0?i:zR(i)?i.map(tie):i.constructor!==void 0?null:Vh({},i)}function iRe(i,e,t,n,r,s,o,a,l){var c,u,f,p,x,v,w,S=t.props||UR,T=e.props,P=e.type;if(P=="svg"?r="http://www.w3.org/2000/svg":P=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((x=s[c])&&"setAttribute"in x==!!P&&(P?x.localName==P:x.nodeType==3)){i=x,s[c]=null;break}}if(i==null){if(P==null)return document.createTextNode(T);i=document.createElementNS(r,P,T.is&&T),a&&(wr.__m&&wr.__m(e,s),a=!1),s=null}if(P==null)S===T||a&&i.data==T||(i.data=T);else{if(s=P=="textarea"&&T.defaultValue!=null?null:s&&Lb.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(x=i.attributes[c]).name]=x.value;for(c in S)x=S[c],c=="dangerouslySetInnerHTML"?f=x:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||FR(i,c,null,x,r);for(c in T)x=T[c],c=="children"?p=x:c=="dangerouslySetInnerHTML"?u=x:c=="value"?v=x:c=="checked"?w=x:a&&typeof x!="function"||S[c]===x||FR(i,c,x,S[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==i.innerHTML)||(i.innerHTML=u.__html),e.__k=[];else if(f&&(i.innerHTML=""),Kne(e.type=="template"?i.content:i,zR(p)?p:[p],e,t,n,P=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&jm(t,0),a,l),s!=null)for(c=s.length;c--;)vk(s[c]);a&&P!="textarea"||(c="value",P=="progress"&&v==null?i.removeAttribute("value"):v!=null&&(v!==i[c]||P=="progress"&&!v||P=="option"&&v!=S[c])&&FR(i,c,v,S[c],r),c="checked",w!=null&&w!=i[c]&&FR(i,c,w,S[c],r))}return i}function wk(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){wr.__e(r,t)}}function nie(i,e,t){var n,r;if(wr.unmount&&wr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||wk(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){wr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&nie(n[r],e,t||typeof i.type!="function");t||vk(i.__e),i.__c=i.__=i.__e=void 0}function rRe(i,e,t){return this.constructor(i,t)}function iie(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),wr.__&&wr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],bk(e,i=(!n&&t||e).__k=JCe(VR,null,[i]),r||UR,UR,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?Lb.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),eie(s,i,o),i.props.children=null}function Sk(i,e,t){var n,r,s,o,a=Vh({},i.props);for(s in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s]===void 0&&o!=null?o[s]:e[s];return arguments.length>2&&(a.children=arguments.length>3?Lb.call(arguments,2):t),Nb(i.type,a,n||i.key,r||i.ref,null)}Lb=kR.slice,wr={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(a){i=a}throw i}},jne=0,xk=function(i){return i!=null&&i.constructor===void 0},BR.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Vh({},this.state),typeof i=="function"&&(i=i(Vh({},t),this.props)),i&&Vh(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),qne(this))},BR.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),qne(this))},BR.prototype.render=VR,v0=[],Xne=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$ne=function(i,e){return i.__v.__b-e.__v.__b},GR.__r=0,mk=Math.random().toString(8),OR="__d"+mk,Ib="__a"+mk,Yne=/(PointerCapture)$|Capture$/i,yk=0,gk=Wne(!1),_k=Wne(!0),KCe=0;function rie(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function sRe(i){if(Array.isArray(i))return i}function oRe(i,e,t){return(e=fRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function aRe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function lRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5258+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sie(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function cRe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sie(Object(t),!0).forEach(function(n){oRe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):sie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function uRe(i,e){return sRe(i)||aRe(i,e)||dRe(i,e)||lRe()}function hRe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function fRe(i){var e=hRe(i,"string");return typeof e=="symbol"?e:e+""}function qR(i){"@babel/helpers - typeof";return qR=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qR(i)}function dRe(i,e){if(i){if(typeof i=="string")return rie(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?rie(i,e):void 0}}var Tk=function(e){if(qR(e)!=="object")return e;var t=Sk(e);if(t.props){var n;t.props=cRe({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(Tk):Tk(t.props.children))}return t},pRe=function(e){return xk(Sk(e))},ARe=function(e,t){delete t.__k,iie(Tk(e),t)};function mRe(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var gRe=`.float-tooltip-kap {52595259 position: absolute;52605260 width: max-content; /* prevent shrinking near right edge */52615261 max-width: max(50%, 150px);
@@ -5266,7 +5266,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52665266 background: rgba(0,0,0,0.6);52675267 pointer-events: none;52685268 }5269-`;dRe(pRe);var rie=Nr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,o=!!e&&qR(e)==="object"&&!!e.node&&typeof e.node=="function",a=dk(o?e.node():e);a.style("position")==="static"&&a.style("position","relative"),t.tooltipEl=a.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(c){var u=aRe(c,2),f=u[0],p=u[1];return t.tooltipEl.style(f,p)}),t.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,a.on("mousemove.".concat(l),function(c){t.mouseInside=!0;var u=pk(c),f=a.node(),p=f.offsetWidth,x=f.offsetHeight,v=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/p*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?x>130&&x-u[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",u[0]+"px").style("top",u[1]+"px").style("transform","translate(".concat(v.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseover.".concat(l),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseout.".concat(l),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):hRe(e.content)?(e.tooltipEl.text(""),fRe(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function ARe(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var mRe=`.scene-nav-info {5269+`;mRe(gRe);var oie=Nr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,o=!!e&&qR(e)==="object"&&!!e.node&&typeof e.node=="function",a=pk(o?e.node():e);a.style("position")==="static"&&a.style("position","relative"),t.tooltipEl=a.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(c){var u=uRe(c,2),f=u[0],p=u[1];return t.tooltipEl.style(f,p)}),t.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,a.on("mousemove.".concat(l),function(c){t.mouseInside=!0;var u=Ak(c),f=a.node(),p=f.offsetWidth,x=f.offsetHeight,v=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/p*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?x>130&&x-u[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",u[0]+"px").style("top",u[1]+"px").style("transform","translate(".concat(v.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseover.".concat(l),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseout.".concat(l),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):pRe(e.content)?(e.tooltipEl.text(""),ARe(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function _Re(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var xRe=`.scene-nav-info {52705270 position: absolute;52715271 bottom: 5px;52725272 width: 100%;
@@ -5281,9 +5281,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52815281 52825282 .scene-container canvas:focus {52835283 outline: none;5284-}`;ARe(mRe);function Tk(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function gRe(i){if(Array.isArray(i))return i}function _Re(i){if(Array.isArray(i))return Tk(i)}function xRe(i,e,t){return(e=ERe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function yRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function vRe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function bRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5285-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wRe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5286-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SRe(i,e){return gRe(i)||vRe(i,e)||sie(i,e)||bRe()}function jm(i){return _Re(i)||yRe(i)||sie(i)||wRe()}function TRe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function ERe(i){var e=TRe(i,"string");return typeof e=="symbol"?e:e+""}function sie(i,e){if(i){if(typeof i=="string")return Tk(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Tk(i,e):void 0}}var oie=function(e){e instanceof Array?e.forEach(oie):(e.map&&e.map.dispose(),e.dispose())},aie=function(e){e.geometry&&e.geometry.dispose(),e.material&&oie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(aie)},MRe=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),aie(t)}},Sr=window.THREE?window.THREE:{WebGLRenderer:JT,Scene:Hd,PerspectiveCamera:Rr,Raycaster:Xy,SRGBColorSpace:Wr,TextureLoader:zc,Vector2:Oe,Vector3:ie,Box3:ha,Color:Ut,Mesh:Hn,SphereGeometry:da,MeshBasicMaterial:Us,BackSide:ui,Timer:CA},Ek=Nr({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&rt(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)p(l),x(c);else{var u=Object.assign({},s.position),f=v();e.tweenGroup.add(e.povPosTween=new Vs(u).to(l,r).easing(Lr.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Vs(f).to(c,r/3).easing(Lr.Quadratic.Out).onUpdate(x).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:v()});function p(w){var S=w.x,T=w.y,P=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),P!==void 0&&(s.position.z=P)}function x(w){var S=new Sr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function v(){return Object.assign(new Sr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),o=3;o<r;o++)s[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var o=new Sr.Vector3(0,0,0),a=Math.max.apply(Math,jm(Object.entries(t).map(function(x){var v=SRe(x,2),w=v[0],S=v[1];return Math.max.apply(Math,jm(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var p=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(p,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Sr.Box3(new Sr.Vector3(0,0,0),new Sr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,jm(["x","y","z"].map(function(s){return xRe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Sr.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new Sr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Sr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Sr.Vector3))},intersectingObjects:function(e,t,n){var r=new Sr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Sr.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls},_destructor:function(e){var t,n,r;MRe(e.scene),(t=e.controls)===null||t===void 0||t.dispose(),(n=e.renderer)===null||n===void 0||n.dispose(),(r=e.postProcessingComposer)===null||r===void 0||r.dispose()}},stateInit:function(){return{scene:new Sr.Scene,camera:new Sr.PerspectiveCamera,timer:new Sr.Timer,tweenGroup:new HA,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,p=n.waitForLoadComplete,x=p===void 0?!0:p;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new rie(t.container),t.pointerPos=new Sr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(v){return t.container.addEventListener(v,function(w){if(v==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(P){return Math.abs(P)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var S=T(t.container);t.pointerPos.x=w.pageX-S.left,t.pointerPos.y=w.pageY-S.top}function T(P){var R=P.getBoundingClientRect(),C=window.pageXOffset||document.documentElement.scrollLeft,L=window.pageYOffset||document.documentElement.scrollTop;return{top:R.top+L,left:R.left+C}}},{passive:!0})}),t.container.addEventListener("pointerup",function(v){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){v.button===0&&t.onClick(t.hoverObj||null,v,t.intersection),v.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,v,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(v){t.onRightClick&&v.preventDefault()}),t.renderer=new(a?D1:Sr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(v){v.domElement.style.position="absolute",v.domElement.style.top="0px",v.domElement.style.pointerEvents="none",t.container.appendChild(v.domElement)}),t.postProcessingComposer=new bR(t.renderer),t.postProcessingComposer.addPass(new wR(t.scene,t.camera)),t.controls=new{trackball:AR,orbit:gR,fly:_R}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(jm(t.extraRenderers)).forEach(function(v){return v.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Sr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!x,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(jm(e.extraRenderers)).forEach(function(x){return x.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(x){return x})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(jm(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(x){return x})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(jm(u),[l,c])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new Sr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=_0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Sr.Color(Kte(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Sr.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Sr.SRGBColorSpace,e.skysphere.material=new Sr.MeshBasicMaterial({map:x,side:Sr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&p()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&p())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(x){return e.scene.remove(x)}),e.lights.forEach(function(x){return e.scene.add(x)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(x){return e.scene.remove(x)}),e.objects.forEach(function(x){return e.scene.add(x)}));function p(){e.loadComplete=e.scene.visible=!0}}});function CRe(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var RRe=`.scene-container .clickable {5284+}`;_Re(xRe);function Ek(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function yRe(i){if(Array.isArray(i))return i}function vRe(i){if(Array.isArray(i))return Ek(i)}function bRe(i,e,t){return(e=RRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function wRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function SRe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function TRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5285+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ERe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5286+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MRe(i,e){return yRe(i)||SRe(i,e)||aie(i,e)||TRe()}function Xm(i){return vRe(i)||wRe(i)||aie(i)||ERe()}function CRe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function RRe(i){var e=CRe(i,"string");return typeof e=="symbol"?e:e+""}function aie(i,e){if(i){if(typeof i=="string")return Ek(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ek(i,e):void 0}}var lie=function(e){e instanceof Array?e.forEach(lie):(e.map&&e.map.dispose(),e.dispose())},cie=function(e){e.geometry&&e.geometry.dispose(),e.material&&lie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(cie)},PRe=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),cie(t)}},Sr=window.THREE?window.THREE:{WebGLRenderer:JT,Scene:Hd,PerspectiveCamera:Rr,Raycaster:Xy,SRGBColorSpace:Wr,TextureLoader:zc,Vector2:Oe,Vector3:ie,Box3:fa,Color:Ut,Mesh:Hn,SphereGeometry:pa,MeshBasicMaterial:Us,BackSide:ui,Timer:RA},Mk=Nr({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&rt(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)p(l),x(c);else{var u=Object.assign({},s.position),f=v();e.tweenGroup.add(e.povPosTween=new Vs(u).to(l,r).easing(Lr.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Vs(f).to(c,r/3).easing(Lr.Quadratic.Out).onUpdate(x).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:v()});function p(w){var S=w.x,T=w.y,P=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),P!==void 0&&(s.position.z=P)}function x(w){var S=new Sr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function v(){return Object.assign(new Sr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),o=3;o<r;o++)s[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var o=new Sr.Vector3(0,0,0),a=Math.max.apply(Math,Xm(Object.entries(t).map(function(x){var v=MRe(x,2),w=v[0],S=v[1];return Math.max.apply(Math,Xm(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var p=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(p,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Sr.Box3(new Sr.Vector3(0,0,0),new Sr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,Xm(["x","y","z"].map(function(s){return bRe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Sr.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new Sr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Sr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Sr.Vector3))},intersectingObjects:function(e,t,n){var r=new Sr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Sr.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls},_destructor:function(e){var t,n,r;PRe(e.scene),(t=e.controls)===null||t===void 0||t.dispose(),(n=e.renderer)===null||n===void 0||n.dispose(),(r=e.postProcessingComposer)===null||r===void 0||r.dispose()}},stateInit:function(){return{scene:new Sr.Scene,camera:new Sr.PerspectiveCamera,timer:new Sr.Timer,tweenGroup:new WA,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,p=n.waitForLoadComplete,x=p===void 0?!0:p;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new oie(t.container),t.pointerPos=new Sr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(v){return t.container.addEventListener(v,function(w){if(v==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(P){return Math.abs(P)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var S=T(t.container);t.pointerPos.x=w.pageX-S.left,t.pointerPos.y=w.pageY-S.top}function T(P){var R=P.getBoundingClientRect(),C=window.pageXOffset||document.documentElement.scrollLeft,L=window.pageYOffset||document.documentElement.scrollTop;return{top:R.top+L,left:R.left+C}}},{passive:!0})}),t.container.addEventListener("pointerup",function(v){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){v.button===0&&t.onClick(t.hoverObj||null,v,t.intersection),v.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,v,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(v){t.onRightClick&&v.preventDefault()}),t.renderer=new(a?D1:Sr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(v){v.domElement.style.position="absolute",v.domElement.style.top="0px",v.domElement.style.pointerEvents="none",t.container.appendChild(v.domElement)}),t.postProcessingComposer=new bR(t.renderer),t.postProcessingComposer.addPass(new wR(t.scene,t.camera)),t.controls=new{trackball:AR,orbit:gR,fly:_R}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(Xm(t.extraRenderers)).forEach(function(v){return v.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Sr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!x,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(Xm(e.extraRenderers)).forEach(function(x){return x.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(x){return x})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(Xm(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(x){return x})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(Xm(u),[l,c])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new Sr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=_0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Sr.Color(Qte(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Sr.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Sr.SRGBColorSpace,e.skysphere.material=new Sr.MeshBasicMaterial({map:x,side:Sr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&p()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&p())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(x){return e.scene.remove(x)}),e.lights.forEach(function(x){return e.scene.add(x)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(x){return e.scene.remove(x)}),e.objects.forEach(function(x){return e.scene.add(x)}));function p(){e.loadComplete=e.scene.visible=!0}}});function IRe(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var NRe=`.scene-container .clickable {52875287 cursor: pointer;5288-}`;CRe(RRe);function Mk(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function PRe(i){if(Array.isArray(i))return Mk(i)}function Fb(i,e,t){return(e=ORe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function IRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function NRe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5289-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lie(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Xm(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lie(Object(t),!0).forEach(function(n){Fb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):lie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function LRe(i,e){if(i==null)return{};var t,n,r=DRe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function DRe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function HR(i){return PRe(i)||IRe(i)||BRe(i)||NRe()}function FRe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function ORe(i){var e=FRe(i,"string");return typeof e=="symbol"?e:e+""}function BRe(i,e){if(i){if(typeof i=="string")return Mk(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Mk(i,e):void 0}}function cie(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var URe=["rendererConfig","waitForGlobeReady"],Db=Xm(Xm({},window.THREE?window.THREE:{AmbientLight:MA,DirectionalLight:EA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:i3}),uie=cie("globe",$U),kRe=Object.assign.apply(Object,HR(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Fb({},i,uie.linkProp(i))}))),GRe=Object.assign.apply(Object,HR(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return Fb({},i,uie.linkMethod(i))}))),hie=cie("renderObjs",Ek),zRe=Object.assign.apply(Object,HR(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return Fb({},i,hie.linkProp(i))}))),VRe=Object.assign.apply(Object,HR(["lights","postProcessingComposer"].map(function(i){return Fb({},i,hie.linkMethod(i))}))),fie=Nr({props:Xm(Xm({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},kRe),zRe),methods:Xm(Xm({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new Vs(r).to(o,n).easing(Lr.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,p=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,p)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},GRe),VRe),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=LRe(e,URe),o=new $U(Xm({waitForGlobeReady:r},s));return{globe:o,renderObjs:Ek({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Db.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Db.AmbientLight(13421772,Math.PI),new Db.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new HA}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new Db.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};Db.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var p=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(x){return x===f})&&Array.isArray(p)?!1:t.pointerEventsFilter(u,p)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},p=a(c),x=p&&p.__globeObjType;return p&&x&&f.hasOwnProperty(x)&&l.hasOwnProperty(x)&&rt(f[x])(l[x](p.__data,u))||""}).onHover(function(c,u,f){var p={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},v=a(c);if(v&&!p.hasOwnProperty(v.__globeObjType)&&(v=null),v!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,P=v?v.__globeObjType:null,R=(w=v)!==null&&w!==void 0&&w.__data?l[P](v.__data,f):null;S&&S!==P&&p[S]&&p[S](null,T||null),P&&p[P]&&p[P](R,S===P?T:null),t.renderObjs.renderer().domElement.classList[P&&x[P]&&rt(t.showPointerCursor)(P,R)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=R}}).onClick(function(c,u,f){if(c){var p={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}).onRightClick(function(c,u,f){if(c){var p={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var qRe=4,Cs=null,WR="",jR=new Map,Ck=new Map,die=new Map;function Aie(){let i=Cz(k.map)==="sphere"&&Tg(k.map)!==null;we.globeToggle.hidden=!i,mie(),!i&&Cs&&(Cs._destructor(),Cs=null,WR="",we.globe.replaceChildren())}function Rk(){k.globeActive?mie():xie()}function mie(){k.globeActive=!1,we.globe.hidden=!0,we.globeToggle.setAttribute("aria-pressed","false"),we.viewport.hidden=!1,k.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function gie(){if(!Cs||!k.globeActive)return null;let i=Cs.pointOfView();return{lat:i.lat,lng:i.lng}}function _ie(i,e,t){if(!Cs)return;let n=Cs.pointOfView().altitude;Cs.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function xie(){let i=Tg(k.map);if(!i)return;k.globeActive=!0,we.viewport.hidden=!0,we.globe.hidden=!1,we.globeToggle.setAttribute("aria-pressed","true"),k.overviewKey="",Cs||(Cs=fie({animateIn:!1})(we.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(n=>n.lat).objectLng(n=>n.lng).objectAltitude(n=>n.pin===k.selectedPin?.03:.014).objectThreeObject(n=>WRe(n.pin)).objectLabel(n=>n.pin.location.title).onObjectClick(n=>Ex(n.pin)).onObjectHover(n=>{we.globe.style.cursor=n?"pointer":""}).onZoom(()=>document.dispatchEvent(new Event("atlas:globe-camera"))),Cs.pointOfView({lat:10,lng:0,altitude:2.2}),document.addEventListener("atlas:selection",HRe),document.addEventListener("atlas:filters",pie)),Pk();let e=k.variant||k.map.variants[0],t=`${k.game.stamp}:${k.map.slug}:${e.tiles}`;if(WR!==t){WR=t;let n=await XRe(e);n&&WR===t&&Cs.globeImageUrl(n)}jR.clear(),Ck.clear(),Cs.objectsData(jRe(i)),pie(),document.dispatchEvent(new Event("atlas:globe-camera"))}function HRe(){if(!Cs||!k.globeActive)return;for(let[e,t]of jR){let n=e===k.selectedPin;t.material=yie(e.category,n);let r=n?9:5;t.scale.set(r,r,1)}Cs.objectAltitude(e=>e.pin===k.selectedPin?.03:.014);let i=Ck.get(k.selectedPin);if(i){let e=Cs.pointOfView().altitude;Cs.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function pie(){if(!(!Cs||!k.globeActive))for(let[i,e]of jR)e.visible=!i.filteredHidden&&!k.hiddenCategories.has(i.category.id)}function WRe(i){let e=new _y(yie(i.category,i===k.selectedPin)),t=i===k.selectedPin?9:5;return e.scale.set(t,t,1),jR.set(i,e),e}function yie(i,e){let t=`${Ox(i)}:${e?"ringed":"plain"}`,n=die.get(t);if(n)return n;n=new Wd({depthWrite:!1}),die.set(t,n);let r=k.markerIcons.get(Ox(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=H0(),l.strokeText(Pc(i.title),40,41),l.fillStyle=W0(i),l.fillText(Pc(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new zc().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function vie(){k.globeActive&&xie()}function Pk(){!Cs||we.globe.hidden||Cs.width(we.globe.clientWidth).height(we.globe.clientHeight)}function jRe(i){let e=[];for(let t of k.pins){let[n,r]=Cg(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),Ck.set(t,{lat:s,lng:o})}return e}async function XRe(i){let e=Math.min(qRe,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${k.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push($Re(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function $Re(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function bie(){let i=k.variant,e=we.overviewCanvas,t=e.getContext("2d"),n=Su(),r=k.game.tileGrid.size,s=k.game.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++k.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),v=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=v;S<w;S++)for(let T=p;T<x;T++){if(!f||!$R(i,l,T,S))continue;let P=new Image;P.onload=()=>{k.overviewRun===u&&t.drawImage(P,T*s-n[0]*c,S*s+n[3]*c,s,s)},P.src=`${k.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}Y1()}function Y1(){let i=gie();if(i){let w=Tg(k.map);if(!w||!k.variant)return;let S=Su(),[T,P]=w.toWorld(i.lat,i.lng),R=we.overviewCanvas,C=cl((T-S[0])/(S[2]-S[0]),0,1),L=cl((P+S[3])/(S[3]-S[1]),0,1);k.overviewKey="",we.overviewShelf.hidden=!1;let D=we.overviewViewport.style,F=22;D.left=`${C*R.width-F/2}px`,D.top=`${L*R.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=k.engine?.getView();if(!e||!k.variant)return;let t=Su(),n=e.calculateExtent(k.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===k.overviewKey||(k.overviewKey=l,we.overviewShelf.hidden=a,a))return;let c=we.overviewCanvas,u=cl((n[0]-t[0])/r,0,1),f=cl((n[2]-t[0])/r,0,1),p=cl((t[3]-n[3])/s,0,1),x=cl((t[3]-n[1])/s,0,1),v=we.overviewViewport.style;v.left=`${u*c.width}px`,v.top=`${p*c.height}px`,v.width=`${Math.max(8,(f-u)*c.width)}px`,v.height=`${Math.max(8,(x-p)*c.height)}px`}function XR(i,e=!0){k.overviewDocked=i,i&&k.overviewPointer!==null&&(k.overviewPointer=null,K1()),we.overviewShelf.classList.toggle("is-docked",i),we.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";we.overviewDock.setAttribute("aria-label",t),we.overviewDock.title=t,e&&Cc()}function Ik(i,e){let t=we.overviewCanvas.getBoundingClientRect(),n=Su(),r=(a,l,c)=>cl((a-l)/(c-l),0,1);if(k.globeActive){let a=Tg(k.map);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);_ie(u,f,e);return}let s=k.engine?.getView();if(!s||!k.variant)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function Fl(i){return new Xq({updateWhileAnimating:!0,...i})}function wie(){let i=k.game.tileGrid.size,e=[0,-i,i,0];k.projection=new ud({code:"ATLAS:PIXELS",units:"pixels",extent:e}),k.sources={grid:new pf({wrapX:!1}),gridContext:new pf({wrapX:!1}),zoneScrim:new pf({wrapX:!1}),zones:new pf({wrapX:!1}),zoneTitles:new pf({wrapX:!1}),text:new pf({wrapX:!1}),pins:new pf({wrapX:!1}),priority:new pf({wrapX:!1})},k.layers={raster:new P5({zIndex:0}),rasterDetail:new P5({zIndex:1}),grid:Fl({source:k.sources.grid,style:fI,renderOrder:jl,renderBuffer:40,zIndex:5}),zoneScrim:Fl({source:k.sources.zoneScrim,style:nV,zIndex:6}),zones:Fl({source:k.sources.zones,style:iV,renderBuffer:32,zIndex:10}),zoneTitles:Fl({source:k.sources.zoneTitles,style:rV,renderOrder:jl,renderBuffer:160,zIndex:20}),zoneTitleDetail:Fl({source:k.sources.zoneTitles,style:sV,renderOrder:jl,renderBuffer:160,zIndex:44}),text:Fl({source:k.sources.text,style:Kz,renderOrder:jl,renderBuffer:220,zIndex:30}),textDetail:Fl({source:k.sources.text,style:Zz,renderOrder:jl,renderBuffer:220,zIndex:45}),zoneText:Fl({source:k.sources.text,style:Qz,renderOrder:jl,renderBuffer:220,zIndex:41}),pins:Fl({source:k.sources.pins,style:Xz,renderOrder:jl,renderBuffer:48,zIndex:40}),zonePins:Fl({source:k.sources.pins,style:$z,renderOrder:jl,renderBuffer:48,zIndex:42}),pinLabels:Fl({source:k.sources.pins,style:Yz,renderOrder:jl,renderBuffer:180,zIndex:45}),gridContext:Fl({source:k.sources.gridContext,style:fI,renderOrder:jl,renderBuffer:40,zIndex:48}),priority:Fl({source:k.sources.priority,style:Jz,renderOrder:jl,renderBuffer:220,zIndex:50})},k.engine=new xq({target:we.viewport,layers:Object.values(k.layers),controls:rS({attribution:!1,rotate:!1,zoom:!1}),interactions:uS({onFocusOnly:!1}),view:Nk(5)}),k.engine.on("movestart",()=>{k.engine.getViewport().classList.add("is-dragging")}),k.engine.on("moveend",()=>{k.engine.getViewport().classList.remove("is-dragging"),k.overviewPointer===null&&K1()}),k.engine.on("postrender",Y1),we.viewport.addEventListener("wheel",()=>{document.activeElement!==we.viewport&&we.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),k.engine.on("singleclick",t=>{if(k.gridEnabled){let r=k.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===k.layers.grid||s===k.layers.gridContext});if(r){Tx(r.hash);return}}let n=k.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>YR(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:YR});n&&Ex(n)}),k.engine.on("pointermove",t=>{if(t.dragging){Rg(null);return}let n=k.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>YR(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:YR}),r=n&&Tu(n.category)==="text"?null:n;Rg(r||null);let s=k.gridEnabled&&k.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===k.layers.grid||o===k.layers.gridContext});k.engine.getTargetElement().style.cursor=n||s?"pointer":""}),k.engine.getViewport().addEventListener("pointerleave",()=>Rg(null))}function YR(i){return i===k.layers.pins||i===k.layers.zonePins||i===k.layers.pinLabels||i===k.layers.priority||i===k.layers.text||i===k.layers.textDetail||i===k.layers.zoneText}function Nk(i){let e=k.game.tileGrid.size;return new ul({projection:k.projection,center:[e/2,-e/2],resolutions:Lk(i),minZoom:0,maxZoom:i,extent:[0,-e,e,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function Lk(i){let e=k.game.tileGrid.size/k.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function of(i,e){k.game=k.catalog.games.find(r=>r.slug===i)||k.catalog.games[0],k.engine||wie(),!e&&!k.restore&&(k.restore=_g(k.game.slug)),we.game.value=k.game.slug,R0(we.map,k.game.maps,"title"),we.map.disabled=k.game.maps.length===1,we.map.title=we.map.disabled?"This game has one map":"Choose a map";let t=k.restore?.game===k.game.slug?k.restore:null,n=e&&k.game.maps.find(r=>r.slug===e)||t&&k.game.maps.find(r=>r.slug===t.map);await Dk((n||k.game.maps[0]).slug)}async function Dk(i){let e=k.game.maps.find(s=>s.slug===i)||k.game.maps[0],t=++k.mapRun;we.loading.hidden=!1;let n;try{n=await bV(e)}catch{k.mapRun===t&&(we.loading.hidden=!0,K0());return}if(k.mapRun!==t)return;k.settling=!0,k.map=n,document.documentElement.style.setProperty("--icon-outset-color",H0()),we.map.value=k.map.slug,R0(we.variant,k.map.variants,"name"),we.variantField.hidden=k.map.variants.length<2,k.styleCache.clear(),Rg(null),k.gridPrefix="",k.hiddenCategories.clear(),k.collapsedSections.clear(),k.collapsedSections.add("zones");for(let s of k.map.groups)for(let o of s.categories)o.visible||k.hiddenCategories.add(o.id);let r=k.restore?.map===k.map.slug?k.restore:null;r&&(k.hiddenCategories=new Set(r.hidden),k.collapsedSections=new Set(r.collapsed)),XR(!!k.restore?.overviewDocked,!1),zw(k.restore?!!k.restore.dockFolded:!0,!1),k.dockDismissed=!!k.restore?.dockDismissed,k.search="",we.search.value="",we.dock.hidden=!1,Rc(),_V(),AI(),mV(),Fk(r?cl(r.variant,0,k.map.variants.length-1):0,!0),Aie(),k.restore=null,we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"),tz(),k.settling=!1,Cc()}function Fk(i,e=!1){let t=k.variant;k.variant=k.map.variants[i]||k.map.variants[0];let n=k.variant,r=e?null:QRe(t,n),s=wu(n);we.variant.value=String(k.map.variants.indexOf(k.variant)),e?k.engine.setView(Nk(s)):(k.engine.getView().setMinZoom(n.minZoom),k.engine.getView().setMaxZoom(s));let o=++k.tileRun,a=0;k.tileStats={requested:0,loaded:0,errors:0,peakPending:0},we.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{k.tileRun===o&&(a++,k.tileStats.requested++,k.tileStats.peakPending=Math.max(k.tileStats.peakPending,a))});let S=T=>{k.tileRun===o&&(a=Math.max(0,a-1),T?k.tileStats.errors++:k.tileStats.loaded++,a===0&&k.tileStats.loaded>0&&(we.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new JG({projection:k.projection,tileGrid:new gx({extent:[0,-k.game.tileGrid.size,k.game.tileGrid.size,0],origin:[0,0],resolutions:Lk(w),tileSize:k.game.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,P,R])=>{let C=n.formats[T];if(!(!C||P<0||R<0||!S(T,P,R)))return`${k.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${P}/${R}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>$R(n,w,S,T)),p=k.layers.raster.getSource();k.layers.raster.setSource(f),k.layers.raster.setExtent(Su()),k.layers.raster.setBackground(n.background||void 0),p?.clear();let x=k.layers.rasterDetail.getSource();n.maxZoom>u?(k.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&$R(n,w,S,T))),k.layers.rasterDetail.setExtent(Su()),k.layers.rasterDetail.setVisible(!0)):k.layers.rasterDetail.setVisible(!1),x?.clear(),Bw(),k.gridEnabled&&(bu(),k.layers.pins.changed(),k.layers.text.changed(),k.layers.priority.changed()),k.overviewKey="",bie();let v=e&&k.restore?.map===k.map.slug?k.restore:null;if(k.renderedShard!==(n.shard||0)&&(AI(),Hl()),v?.center&&Number.isFinite(v.zoom)){let w=k.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),k.fitZoom=v.zoom,Y0()}else e?requestAnimationFrame(JRe):(r&&k.engine.getView().animate({center:r,duration:200}),Y0());Cc()}function $R(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=ZRe(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function ZRe(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function wu(i){return i.maxZoom+2}function K1(){Y0(),Cc()}function QRe(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=k.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+cl(r,0,1)*e.bounds.width,-(e.bounds.y+cl(s,0,1)*e.bounds.height)]}function Sie(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");we.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>k.engine?.updateSize())}function Su(){let i=k.game.tileGrid.size,e=k.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function JRe(){if(!k.engine||!k.variant)return;let i=k.engine.getView();i.fit(Su(),{size:k.engine.getSize(),padding:[36,36,36,36],maxZoom:k.variant.maxZoom,duration:0}),k.fitZoom=i.getZoom()||0,Y0()}function Ob(i){let e=k.engine.getView(),t=e.getZoom()||0;e.animate({zoom:cl(t+i,k.variant.minZoom,wu(k.variant)),duration:140})}function Y0(){let i=k.engine?.getView().getZoom();if(we.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!k.engine||!k.pins.length){we.visibleCount.textContent="0 locations visible";return}let e=k.engine.getView().calculateExtent(k.engine.getSize()),t=0;for(let n of k.pins){if(Xl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}we.visibleCount.textContent=`${Ic(k.eligibleLocations)} enabled \xB7 ${Ic(t)} in view`}function Tie(){we.game.addEventListener("change",()=>{of(we.game.value)}),we.map.addEventListener("change",()=>{Dk(we.map.value)}),we.addBundles.addEventListener("click",()=>{vI()}),we.emptyOpen.addEventListener("click",()=>{vI()}),we.variant.addEventListener("change",()=>{Fk(Number(we.variant.value)),vie()}),we.globeToggle.addEventListener("click",()=>Rk()),we.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){yV(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?k.hiddenCategories.delete(s):k.hiddenCategories.add(s),Hl(),yd()});let i=null,e=()=>{for(let s of we.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&we.layers.contains(r)&&r.classList.add("is-hovered")};we.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),we.layers.addEventListener("pointerleave",()=>{i=null,e()}),we.layers.addEventListener("scroll",e,{passive:!0}),we.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),vV(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;k.collapsedSections.has(o)?k.collapsedSections.delete(o):k.collapsedSections.add(o),tS()}),we.soloChip.addEventListener("click",()=>Ux(!0)),nn("#expand-all").addEventListener("click",()=>xI(!1)),nn("#collapse-all").addEventListener("click",()=>xI(!0)),nn("#show-all").addEventListener("click",()=>Ux(!0)),nn("#hide-all").addEventListener("click",()=>Ux(!1)),we.zoneToggle.addEventListener("change",()=>{Jw(we.zoneToggle.checked)}),we.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&dV(Number(r.dataset.zone))}),we.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),pV(Number(r.dataset.zone)))}),we.search.addEventListener("input",()=>{k.search=we.search.value.trim().toLocaleLowerCase(),Hl(),k.search&&Gw()}),we.dockFold.addEventListener("click",()=>{VP(!k.dockFolded)}),we.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=k.pinByID.get(Number(r.dataset.location));s&&qP(s)}),we.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=k.pinByID.get(Number(r.dataset.location));s&&qP(s)}),nn("#close-detail").addEventListener("click",Rc),nn("#zoom-in").addEventListener("click",()=>Ob(1)),nn("#zoom-out").addEventListener("click",()=>Ob(-1)),we.gridBack.addEventListener("click",kP),we.gridInput.addEventListener("input",()=>{let n=q0(),r=[...we.gridInput.value.toLocaleLowerCase()].filter(s=>Gl.includes(s)).slice(0,n).join("");we.gridInput.value=r,Tx(r)}),we.subgridToggle.addEventListener("click",()=>{Sx(!k.subgridVisible),we.viewport.focus({preventScroll:!0})}),we.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Sx(!k.subgridVisible);return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),we.viewport.focus({preventScroll:!0}))}),we.viewport.addEventListener("keydown",n=>{if(!kw(n.target)){if(n.key==="+"||n.key==="=")Ob(1);else if(n.key==="-")Ob(-1);else if(n.key==="Escape")Rc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{kw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!kw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){we.globeToggle.hidden||(n.preventDefault(),Rk());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),we.search.focus(),we.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),we.dock.hidden||VP(!k.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Sie();return}yz(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||eS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&eS(!1)}),window.addEventListener("blur",()=>eS(!1)),window.addEventListener("hashchange",()=>{let n=xg();n.game===k.game?.slug&&n.map===k.map?.slug||(k.restore=null,of(n.game||k.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{k.engine?.updateSize(),Y1(),Pk()}),document.addEventListener("atlas:globe-camera",()=>Y1()),we.overview.addEventListener("pointerdown",n=>{k.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),we.overview.setPointerCapture(n.pointerId),k.overviewPointer=n.pointerId,Ik(n,!0))}),we.overview.addEventListener("pointermove",n=>{k.overviewPointer===n.pointerId&&(n.preventDefault(),Ik(n,!1))});let t=n=>{k.overviewPointer===n.pointerId&&(k.overviewPointer=null,K1())};we.overview.addEventListener("pointerup",t),we.overview.addEventListener("pointercancel",t),we.overviewDock.addEventListener("click",()=>{XR(!k.overviewDocked),we.viewport.focus({preventScroll:!0})}),we.mobileLegend.addEventListener("click",()=>{let n=we.sidebar.classList.toggle("is-open");we.mobileLegend.setAttribute("aria-expanded",String(n))})}function Eie(){let i=()=>({game:k.game?.title,map:k.map?.title,variant:k.variant?.name,zoom:k.engine?.getView().getZoom(),center:k.engine?.getView().getCenter(),resolution:k.engine?.getView().getResolution(),nativeMaxZoom:k.variant?.maxZoom,maxZoom:k.variant?wu(k.variant):null,interpolate:k.variant?.interpolate,tileStats:{...k.tileStats},pins:k.pins.length,eligibleLocations:k.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:k.labelsHeld,hoveredPin:k.hoveredPin?.location.title||null,selectedPin:k.selectedPin?.location.title||null,fitZoom:k.fitZoom,filters:{hiddenCategories:[...k.hiddenCategories].sort(),collapsedSections:[...k.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!we.detail.hidden,detailTitle:we.detail.hidden?null:we.detailTitle.textContent||null,searchQuery:k.search,searchResultsVisible:!we.searchResults.hidden,soloChip:we.soloChip.hidden?null:we.soloChip.textContent,visibleCountText:we.visibleCount.textContent,overviewDocked:k.overviewDocked,dockFolded:k.dockFolded,dockDismissed:k.dockDismissed,subgridVisible:k.subgridVisible},zones:{visible:k.zonesVisible,count:k.zoneRecords.size,focused:k.zoneRecords.get(k.focusedZoneID)?.zone.title||null,highlighted:[...k.highlightedZones].map(e=>k.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:k.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:k.gridEnabled,prefix:k.gridPrefix,maximumDepth:q0(),extent:k.gridEnabled?vg():null,cells:[...k.sources.grid.getFeatures(),...k.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:k.gridPrefix?k.pins.filter(e=>!e.filteredHidden&&bg(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>k.layers[e]?.setVisible(t),refreshCatalog:K0},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>k.engine?.renderSync()}async function Mie(){Tie();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(k.catalog=await i.json(),R0(we.game,k.catalog.games,"title"),yI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{K0()}),k.catalog.games.length){let e=xg(),t=_g(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);k.restore=n?t:null,await of(e.game||t?.game||k.catalog.games[0].slug,e.map||t?.map),k.restore=null}else we.loading.hidden=!0;Eie(),requestAnimationFrame(()=>we.viewport.focus({preventScroll:!0}))}catch(i){we.loading.hidden=!0,we.fatalMessage.textContent=i instanceof Error?i.message:String(i),we.fatal.hidden=!1}}Mie();})();5288+}`;IRe(NRe);function Ck(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function LRe(i){if(Array.isArray(i))return Ck(i)}function Fb(i,e,t){return(e=kRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function DRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function FRe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5289+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uie(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function $m(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uie(Object(t),!0).forEach(function(n){Fb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):uie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function ORe(i,e){if(i==null)return{};var t,n,r=BRe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function BRe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function HR(i){return LRe(i)||DRe(i)||GRe(i)||FRe()}function URe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function kRe(i){var e=URe(i,"string");return typeof e=="symbol"?e:e+""}function GRe(i,e){if(i){if(typeof i=="string")return Ck(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ck(i,e):void 0}}function hie(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var zRe=["rendererConfig","waitForGlobeReady"],Db=$m($m({},window.THREE?window.THREE:{AmbientLight:CA,DirectionalLight:MA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:i3}),fie=hie("globe",YU),VRe=Object.assign.apply(Object,HR(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Fb({},i,fie.linkProp(i))}))),qRe=Object.assign.apply(Object,HR(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return Fb({},i,fie.linkMethod(i))}))),die=hie("renderObjs",Mk),HRe=Object.assign.apply(Object,HR(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return Fb({},i,die.linkProp(i))}))),WRe=Object.assign.apply(Object,HR(["lights","postProcessingComposer"].map(function(i){return Fb({},i,die.linkMethod(i))}))),pie=Nr({props:$m($m({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},VRe),HRe),methods:$m($m({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new Vs(r).to(o,n).easing(Lr.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,p=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,p)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},qRe),WRe),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=ORe(e,zRe),o=new YU($m({waitForGlobeReady:r},s));return{globe:o,renderObjs:Mk({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Db.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Db.AmbientLight(13421772,Math.PI),new Db.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new WA}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new Db.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};Db.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var p=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(x){return x===f})&&Array.isArray(p)?!1:t.pointerEventsFilter(u,p)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},p=a(c),x=p&&p.__globeObjType;return p&&x&&f.hasOwnProperty(x)&&l.hasOwnProperty(x)&&rt(f[x])(l[x](p.__data,u))||""}).onHover(function(c,u,f){var p={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},v=a(c);if(v&&!p.hasOwnProperty(v.__globeObjType)&&(v=null),v!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,P=v?v.__globeObjType:null,R=(w=v)!==null&&w!==void 0&&w.__data?l[P](v.__data,f):null;S&&S!==P&&p[S]&&p[S](null,T||null),P&&p[P]&&p[P](R,S===P?T:null),t.renderObjs.renderer().domElement.classList[P&&x[P]&&rt(t.showPointerCursor)(P,R)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=R}}).onClick(function(c,u,f){if(c){var p={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}).onRightClick(function(c,u,f){if(c){var p={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var jRe=4,ts=null,WR="",XR=new Map,Pk=new Map,Aie=new Map;function gie(){let i=Pz(k.map)==="sphere"&&j0(k.map)!==null;we.globeToggle.hidden=!i,xie(),!i&&ts&&(ts._destructor(),ts=null,WR="",we.globe.replaceChildren())}function Ik(){k.globeActive?xie():bie()}var _ie=2.5,jR=2;function XRe(i){return No(_ie/2**(i-jR),.08,4)}function $Re(i){let e=(k.variant?.maxZoom??jR)+2;return No(jR+Math.log2(_ie/i),0,e)}function xie(){let i=j0(k.map),e=k.engine?.getView();if(ts&&k.globeActive&&i&&e){let t=ts.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom($Re(t.altitude))}k.globeActive=!1,we.globe.hidden=!0,we.globeToggle.setAttribute("aria-pressed","false"),we.viewport.hidden=!1,k.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function yie(){if(!ts||!k.globeActive)return null;let i=ts.pointOfView();return{lat:i.lat,lng:i.lng}}function vie(i,e,t){if(!ts)return;let n=ts.pointOfView().altitude;ts.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function bie(){let i=j0(k.map);if(!i)return;k.globeActive=!0,we.viewport.hidden=!0,we.globe.hidden=!1,we.globeToggle.setAttribute("aria-pressed","true"),k.overviewKey="",ts||(ts=pie({animateIn:!1})(we.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(s=>s.lat).objectLng(s=>s.lng).objectAltitude(s=>s.pin===k.selectedPin?.03:.014).objectThreeObject(s=>ZRe(s.pin)).objectLabel(s=>s.pin.location.title).onObjectClick(s=>Ex(s.pin)).onObjectHover(s=>{we.globe.style.cursor=s?"pointer":""}).onZoom(()=>document.dispatchEvent(new Event("atlas:globe-camera"))),document.addEventListener("atlas:selection",YRe),document.addEventListener("atlas:filters",mie)),Nk();let e=k.engine?.getView(),t=e?.getCenter();if(t){let[s,o]=i.toLatLng(t[0],-t[1]);ts.pointOfView({lat:s,lng:o,altitude:XRe(e.getZoom()??jR)})}let n=k.variant||k.map.variants[0],r=`${k.game.stamp}:${k.map.slug}:${n.tiles}`;if(WR!==r){WR=r;let s=await QRe(n);s&&WR===r&&ts.globeImageUrl(s)}XR.clear(),Pk.clear(),ts.objectsData(KRe(i)),mie(),document.dispatchEvent(new Event("atlas:globe-camera"))}function YRe(){if(!ts||!k.globeActive)return;for(let[e,t]of XR){let n=e===k.selectedPin;t.material=wie(e.category,n);let r=n?9:5;t.scale.set(r,r,1)}ts.objectAltitude(e=>e.pin===k.selectedPin?.03:.014);let i=Pk.get(k.selectedPin);if(i){let e=ts.pointOfView().altitude;ts.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function mie(){if(!(!ts||!k.globeActive))for(let[i,e]of XR)e.visible=!i.filteredHidden&&!k.hiddenCategories.has(i.category.id)}function ZRe(i){let e=new _y(wie(i.category,i===k.selectedPin)),t=i===k.selectedPin?9:5;return e.scale.set(t,t,1),XR.set(i,e),e}function wie(i,e){let t=`${Ox(i)}:${e?"ringed":"plain"}`,n=Aie.get(t);if(n)return n;n=new Wd({depthWrite:!1}),Aie.set(t,n);let r=k.markerIcons.get(Ox(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=H0(),l.strokeText(Pc(i.title),40,41),l.fillStyle=W0(i),l.fillText(Pc(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new zc().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function Sie(){k.globeActive&&bie()}function Nk(){!ts||we.globe.hidden||ts.width(we.globe.clientWidth).height(we.globe.clientHeight)}function KRe(i){let e=[];for(let t of k.pins){let[n,r]=Cg(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),Pk.set(t,{lat:s,lng:o})}return e}async function QRe(i){let e=Math.min(jRe,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${k.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(JRe(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function JRe(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Tie(){let i=k.variant,e=we.overviewCanvas,t=e.getContext("2d"),n=Su(),r=k.game.tileGrid.size,s=k.game.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++k.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),v=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=v;S<w;S++)for(let T=p;T<x;T++){if(!f||!YR(i,l,T,S))continue;let P=new Image;P.onload=()=>{k.overviewRun===u&&t.drawImage(P,T*s-n[0]*c,S*s+n[3]*c,s,s)},P.src=`${k.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}Y1()}function Y1(){let i=yie();if(i){let w=j0(k.map);if(!w||!k.variant)return;let S=Su(),[T,P]=w.toWorld(i.lat,i.lng),R=we.overviewCanvas,C=No((T-S[0])/(S[2]-S[0]),0,1),L=No((P+S[3])/(S[3]-S[1]),0,1);k.overviewKey="",we.overviewShelf.hidden=!1;let D=we.overviewViewport.style,F=22;D.left=`${C*R.width-F/2}px`,D.top=`${L*R.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=k.engine?.getView();if(!e||!k.variant)return;let t=Su(),n=e.calculateExtent(k.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===k.overviewKey||(k.overviewKey=l,we.overviewShelf.hidden=a,a))return;let c=we.overviewCanvas,u=No((n[0]-t[0])/r,0,1),f=No((n[2]-t[0])/r,0,1),p=No((t[3]-n[3])/s,0,1),x=No((t[3]-n[1])/s,0,1),v=we.overviewViewport.style;v.left=`${u*c.width}px`,v.top=`${p*c.height}px`,v.width=`${Math.max(8,(f-u)*c.width)}px`,v.height=`${Math.max(8,(x-p)*c.height)}px`}function $R(i,e=!0){k.overviewDocked=i,i&&k.overviewPointer!==null&&(k.overviewPointer=null,Z1()),we.overviewShelf.classList.toggle("is-docked",i),we.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";we.overviewDock.setAttribute("aria-label",t),we.overviewDock.title=t,e&&Cc()}function Lk(i,e){let t=we.overviewCanvas.getBoundingClientRect(),n=Su(),r=(a,l,c)=>No((a-l)/(c-l),0,1);if(k.globeActive){let a=j0(k.map);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);vie(u,f,e);return}let s=k.engine?.getView();if(!s||!k.variant)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function Fl(i){return new Yq({updateWhileAnimating:!0,...i})}function Eie(){let i=k.game.tileGrid.size,e=[0,-i,i,0];k.projection=new ud({code:"ATLAS:PIXELS",units:"pixels",extent:e}),k.sources={grid:new pf({wrapX:!1}),gridContext:new pf({wrapX:!1}),zoneScrim:new pf({wrapX:!1}),zones:new pf({wrapX:!1}),zoneTitles:new pf({wrapX:!1}),text:new pf({wrapX:!1}),pins:new pf({wrapX:!1}),priority:new pf({wrapX:!1})},k.layers={raster:new I5({zIndex:0}),rasterDetail:new I5({zIndex:1}),grid:Fl({source:k.sources.grid,style:dI,renderOrder:jl,renderBuffer:40,zIndex:5}),zoneScrim:Fl({source:k.sources.zoneScrim,style:rV,zIndex:6}),zones:Fl({source:k.sources.zones,style:sV,renderBuffer:32,zIndex:10}),zoneTitles:Fl({source:k.sources.zoneTitles,style:oV,renderOrder:jl,renderBuffer:160,zIndex:20}),zoneTitleDetail:Fl({source:k.sources.zoneTitles,style:aV,renderOrder:jl,renderBuffer:160,zIndex:44}),text:Fl({source:k.sources.text,style:Qz,renderOrder:jl,renderBuffer:220,zIndex:30}),textDetail:Fl({source:k.sources.text,style:Jz,renderOrder:jl,renderBuffer:220,zIndex:45}),zoneText:Fl({source:k.sources.text,style:eV,renderOrder:jl,renderBuffer:220,zIndex:41}),pins:Fl({source:k.sources.pins,style:Yz,renderOrder:jl,renderBuffer:48,zIndex:40}),zonePins:Fl({source:k.sources.pins,style:Zz,renderOrder:jl,renderBuffer:48,zIndex:42}),pinLabels:Fl({source:k.sources.pins,style:Kz,renderOrder:jl,renderBuffer:180,zIndex:45}),gridContext:Fl({source:k.sources.gridContext,style:dI,renderOrder:jl,renderBuffer:40,zIndex:48}),priority:Fl({source:k.sources.priority,style:tV,renderOrder:jl,renderBuffer:220,zIndex:50})},k.engine=new vq({target:we.viewport,layers:Object.values(k.layers),controls:rS({attribution:!1,rotate:!1,zoom:!1}),interactions:uS({onFocusOnly:!1}),view:Dk(5)}),k.engine.on("movestart",()=>{k.engine.getViewport().classList.add("is-dragging")}),k.engine.on("moveend",()=>{k.engine.getViewport().classList.remove("is-dragging"),k.overviewPointer===null&&Z1()}),k.engine.on("postrender",Y1),we.viewport.addEventListener("wheel",()=>{document.activeElement!==we.viewport&&we.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),k.engine.on("singleclick",t=>{if(k.gridEnabled){let r=k.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===k.layers.grid||s===k.layers.gridContext});if(r){Tx(r.hash);return}}let n=k.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>ZR(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:ZR});n&&Ex(n)}),k.engine.on("pointermove",t=>{if(t.dragging){Rg(null);return}let n=k.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>ZR(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:ZR}),r=n&&Tu(n.category)==="text"?null:n;Rg(r||null);let s=k.gridEnabled&&k.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===k.layers.grid||o===k.layers.gridContext});k.engine.getTargetElement().style.cursor=n||s?"pointer":""}),k.engine.getViewport().addEventListener("pointerleave",()=>Rg(null))}function ZR(i){return i===k.layers.pins||i===k.layers.zonePins||i===k.layers.pinLabels||i===k.layers.priority||i===k.layers.text||i===k.layers.textDetail||i===k.layers.zoneText}function Dk(i){let e=k.game.tileGrid.size;return new ul({projection:k.projection,center:[e/2,-e/2],resolutions:Fk(i),minZoom:0,maxZoom:i,extent:[0,-e,e,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function Fk(i){let e=k.game.tileGrid.size/k.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function of(i,e){k.game=k.catalog.games.find(r=>r.slug===i)||k.catalog.games[0],k.engine||Eie(),!e&&!k.restore&&(k.restore=xg(k.game.slug)),we.game.value=k.game.slug,R0(we.map,k.game.maps,"title"),we.map.disabled=k.game.maps.length===1,we.map.title=we.map.disabled?"This game has one map":"Choose a map";let t=k.restore?.game===k.game.slug?k.restore:null,n=e&&k.game.maps.find(r=>r.slug===e)||t&&k.game.maps.find(r=>r.slug===t.map);await Ok((n||k.game.maps[0]).slug)}async function Ok(i){let e=k.game.maps.find(s=>s.slug===i)||k.game.maps[0],t=++k.mapRun;we.loading.hidden=!1;let n;try{n=await SV(e)}catch{k.mapRun===t&&(we.loading.hidden=!0,K0());return}if(k.mapRun!==t)return;k.settling=!0,k.map=n,document.documentElement.style.setProperty("--icon-outset-color",H0()),we.map.value=k.map.slug,R0(we.variant,k.map.variants,"name"),we.variantField.hidden=k.map.variants.length<2,k.styleCache.clear(),Rg(null),k.gridPrefix="",k.hiddenCategories.clear(),k.collapsedSections.clear(),k.collapsedSections.add("zones");for(let s of k.map.groups)for(let o of s.categories)o.visible||k.hiddenCategories.add(o.id);let r=k.restore?.map===k.map.slug?k.restore:null;r&&(k.hiddenCategories=new Set(r.hidden),k.collapsedSections=new Set(r.collapsed)),$R(!!k.restore?.overviewDocked,!1),zw(k.restore?!!k.restore.dockFolded:!0,!1),k.dockDismissed=!!k.restore?.dockDismissed,k.search="",we.search.value="",we.dock.hidden=!1,Rc(),yV(),mI(),_V(),Bk(r?No(r.variant,0,k.map.variants.length-1):0,!0),gie(),k.restore=null,we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"),iz(),k.settling=!1,Cc()}function Bk(i,e=!1){let t=k.variant;k.variant=k.map.variants[i]||k.map.variants[0];let n=k.variant,r=e?null:n4e(t,n),s=wu(n);we.variant.value=String(k.map.variants.indexOf(k.variant)),e?k.engine.setView(Dk(s)):(k.engine.getView().setMinZoom(n.minZoom),k.engine.getView().setMaxZoom(s));let o=++k.tileRun,a=0;k.tileStats={requested:0,loaded:0,errors:0,peakPending:0},we.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{k.tileRun===o&&(a++,k.tileStats.requested++,k.tileStats.peakPending=Math.max(k.tileStats.peakPending,a))});let S=T=>{k.tileRun===o&&(a=Math.max(0,a-1),T?k.tileStats.errors++:k.tileStats.loaded++,a===0&&k.tileStats.loaded>0&&(we.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new tz({projection:k.projection,tileGrid:new gx({extent:[0,-k.game.tileGrid.size,k.game.tileGrid.size,0],origin:[0,0],resolutions:Fk(w),tileSize:k.game.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,P,R])=>{let C=n.formats[T];if(!(!C||P<0||R<0||!S(T,P,R)))return`${k.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${P}/${R}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>YR(n,w,S,T)),p=k.layers.raster.getSource();k.layers.raster.setSource(f),k.layers.raster.setExtent(Su()),k.layers.raster.setBackground(n.background||void 0),p?.clear();let x=k.layers.rasterDetail.getSource();n.maxZoom>u?(k.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&YR(n,w,S,T))),k.layers.rasterDetail.setExtent(Su()),k.layers.rasterDetail.setVisible(!0)):k.layers.rasterDetail.setVisible(!1),x?.clear(),Bw(),k.gridEnabled&&(bu(),k.layers.pins.changed(),k.layers.text.changed(),k.layers.priority.changed()),k.overviewKey="",Tie();let v=e&&k.restore?.map===k.map.slug?k.restore:null;if(k.renderedShard!==(n.shard||0)&&(mI(),Hl()),v?.center&&Number.isFinite(v.zoom)){let w=k.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),k.fitZoom=v.zoom,Z0()}else e?requestAnimationFrame(i4e):(r&&k.engine.getView().animate({center:r,duration:200}),Z0());Cc()}function YR(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=t4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function t4e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function wu(i){return i.maxZoom+2}function Z1(){Z0(),Cc()}function n4e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=k.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+No(r,0,1)*e.bounds.width,-(e.bounds.y+No(s,0,1)*e.bounds.height)]}function Mie(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");we.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>k.engine?.updateSize())}function Su(){let i=k.game.tileGrid.size,e=k.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function i4e(){if(!k.engine||!k.variant)return;let i=k.engine.getView();i.fit(Su(),{size:k.engine.getSize(),padding:[36,36,36,36],maxZoom:k.variant.maxZoom,duration:0}),k.fitZoom=i.getZoom()||0,Z0()}function Ob(i){let e=k.engine.getView(),t=e.getZoom()||0;e.animate({zoom:No(t+i,k.variant.minZoom,wu(k.variant)),duration:140})}function Z0(){let i=k.engine?.getView().getZoom();if(we.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!k.engine||!k.pins.length){we.visibleCount.textContent="0 locations visible";return}let e=k.engine.getView().calculateExtent(k.engine.getSize()),t=0;for(let n of k.pins){if(Xl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}we.visibleCount.textContent=`${Ic(k.eligibleLocations)} enabled \xB7 ${Ic(t)} in view`}function Cie(){we.game.addEventListener("change",()=>{of(we.game.value)}),we.map.addEventListener("change",()=>{Ok(we.map.value)}),we.addBundles.addEventListener("click",()=>{bI()}),we.emptyOpen.addEventListener("click",()=>{bI()}),we.variant.addEventListener("change",()=>{Bk(Number(we.variant.value)),Sie()}),we.globeToggle.addEventListener("click",()=>Ik()),we.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){bV(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?k.hiddenCategories.delete(s):k.hiddenCategories.add(s),Hl(),yd()});let i=null,e=()=>{for(let s of we.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&we.layers.contains(r)&&r.classList.add("is-hovered")};we.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),we.layers.addEventListener("pointerleave",()=>{i=null,e()}),we.layers.addEventListener("scroll",e,{passive:!0}),we.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),wV(r.dataset.onlyCategory?{category:Number(r.dataset.onlyCategory)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-section]");if(!s)return;let o=s.dataset.section;k.collapsedSections.has(o)?k.collapsedSections.delete(o):k.collapsedSections.add(o),tS()}),we.soloChip.addEventListener("click",()=>Ux(!0)),nn("#expand-all").addEventListener("click",()=>yI(!1)),nn("#collapse-all").addEventListener("click",()=>yI(!0)),nn("#show-all").addEventListener("click",()=>Ux(!0)),nn("#hide-all").addEventListener("click",()=>Ux(!1)),we.zoneToggle.addEventListener("change",()=>{Jw(we.zoneToggle.checked)}),we.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&AV(Number(r.dataset.zone))}),we.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),mV(Number(r.dataset.zone)))}),we.search.addEventListener("input",()=>{k.search=we.search.value.trim().toLocaleLowerCase(),Hl(),k.search&&Gw()}),we.dockFold.addEventListener("click",()=>{qP(!k.dockFolded)}),we.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=k.pinByID.get(Number(r.dataset.location));s&&HP(s)}),we.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=k.pinByID.get(Number(r.dataset.location));s&&HP(s)}),nn("#close-detail").addEventListener("click",Rc),nn("#zoom-in").addEventListener("click",()=>Ob(1)),nn("#zoom-out").addEventListener("click",()=>Ob(-1)),we.gridBack.addEventListener("click",GP),we.gridInput.addEventListener("input",()=>{let n=q0(),r=[...we.gridInput.value.toLocaleLowerCase()].filter(s=>Gl.includes(s)).slice(0,n).join("");we.gridInput.value=r,Tx(r)}),we.subgridToggle.addEventListener("click",()=>{Sx(!k.subgridVisible),we.viewport.focus({preventScroll:!0})}),we.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Sx(!k.subgridVisible);return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),we.viewport.focus({preventScroll:!0}))}),we.viewport.addEventListener("keydown",n=>{if(!kw(n.target)){if(n.key==="+"||n.key==="=")Ob(1);else if(n.key==="-")Ob(-1);else if(n.key==="Escape")Rc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{kw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!kw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){we.globeToggle.hidden||(n.preventDefault(),Ik());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),we.search.focus(),we.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),we.dock.hidden||qP(!k.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Mie();return}bz(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||eS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&eS(!1)}),window.addEventListener("blur",()=>eS(!1)),window.addEventListener("hashchange",()=>{let n=yg();n.game===k.game?.slug&&n.map===k.map?.slug||(k.restore=null,of(n.game||k.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{k.engine?.updateSize(),Y1(),Nk()}),document.addEventListener("atlas:globe-camera",()=>Y1()),we.overview.addEventListener("pointerdown",n=>{k.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),we.overview.setPointerCapture(n.pointerId),k.overviewPointer=n.pointerId,Lk(n,!0))}),we.overview.addEventListener("pointermove",n=>{k.overviewPointer===n.pointerId&&(n.preventDefault(),Lk(n,!1))});let t=n=>{k.overviewPointer===n.pointerId&&(k.overviewPointer=null,Z1())};we.overview.addEventListener("pointerup",t),we.overview.addEventListener("pointercancel",t),we.overviewDock.addEventListener("click",()=>{$R(!k.overviewDocked),we.viewport.focus({preventScroll:!0})}),we.mobileLegend.addEventListener("click",()=>{let n=we.sidebar.classList.toggle("is-open");we.mobileLegend.setAttribute("aria-expanded",String(n))})}function Rie(){let i=()=>({game:k.game?.title,map:k.map?.title,variant:k.variant?.name,zoom:k.engine?.getView().getZoom(),center:k.engine?.getView().getCenter(),resolution:k.engine?.getView().getResolution(),nativeMaxZoom:k.variant?.maxZoom,maxZoom:k.variant?wu(k.variant):null,interpolate:k.variant?.interpolate,tileStats:{...k.tileStats},pins:k.pins.length,eligibleLocations:k.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:k.labelsHeld,hoveredPin:k.hoveredPin?.location.title||null,selectedPin:k.selectedPin?.location.title||null,fitZoom:k.fitZoom,filters:{hiddenCategories:[...k.hiddenCategories].sort(),collapsedSections:[...k.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!we.detail.hidden,detailTitle:we.detail.hidden?null:we.detailTitle.textContent||null,searchQuery:k.search,searchResultsVisible:!we.searchResults.hidden,soloChip:we.soloChip.hidden?null:we.soloChip.textContent,visibleCountText:we.visibleCount.textContent,overviewDocked:k.overviewDocked,dockFolded:k.dockFolded,dockDismissed:k.dockDismissed,subgridVisible:k.subgridVisible},zones:{visible:k.zonesVisible,count:k.zoneRecords.size,focused:k.zoneRecords.get(k.focusedZoneID)?.zone.title||null,highlighted:[...k.highlightedZones].map(e=>k.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:k.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:k.gridEnabled,prefix:k.gridPrefix,maximumDepth:q0(),extent:k.gridEnabled?bg():null,cells:[...k.sources.grid.getFeatures(),...k.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:k.gridPrefix?k.pins.filter(e=>!e.filteredHidden&&wg(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>k.layers[e]?.setVisible(t),refreshCatalog:K0},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>k.engine?.renderSync()}async function Pie(){Cie();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(k.catalog=await i.json(),R0(we.game,k.catalog.games,"title"),vI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{K0()}),k.catalog.games.length){let e=yg(),t=xg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);k.restore=n?t:null,await of(e.game||t?.game||k.catalog.games[0].slug,e.map||t?.map),k.restore=null}else we.loading.hidden=!0;Rie(),requestAnimationFrame(()=>we.viewport.focus({preventScroll:!0}))}catch(i){we.loading.hidden=!0,we.fatalMessage.textContent=i instanceof Error?i.message:String(i),we.fatal.hidden=!1}}Pie();})();
M frontend/src/globe.js +41 -1
@@ -12,12 +12,14 @@
1212 import Globe from "globe.gl";1313 import { Sprite, SpriteMaterial, TextureLoader } from "three";1414 15+import { overzoomLevels } from "./constants.js";1516 import { showPin } from "./detail.js";1617 import { elements } from "./dom.js";1718 import { equirectMapping, mapSurface } from "./semconv.js";1819 import { state } from "./state.js";1920 import { markerIconKey } from "./styles.js";2021 import { categoryColor, iconOutsetColor, initials } from "./theme.js";22+import { clamp } from "./util.js";2123 import { project } from "./zones.js";2224 2325 // textureZoom picks the pyramid level the sphere wears: deep enough to read,
@@ -54,7 +56,37 @@ export function toggleGlobe() {
5456 else void enterGlobe();5557 }5658 59+// The two cameras answer to one another through the declared mapping, so60+// flipping panes keeps the reader's place: the point faced and roughly how61+// close. The scale pairing is a rule of thumb -- the whole disc at altitude62+// 2.5 reads like the whole chart at zoom 2, and each halving of altitude63+// reads like one more zoom -- which is all "the same spot" needs.64+const wholeDiscAltitude = 2.5;65+const wholeChartZoom = 2;66+67+function altitudeForZoom(zoom) {68+ return clamp(wholeDiscAltitude / 2 ** (zoom - wholeChartZoom), 0.08, 4);69+}70+71+function zoomForAltitude(altitude) {72+ const ceiling = (state.variant?.maxZoom ?? wholeChartZoom) + overzoomLevels;73+ return clamp(wholeChartZoom + Math.log2(wholeDiscAltitude / altitude), 0, ceiling);74+}75+5776 function leaveGlobe() {77+ // Whatever the globe was facing, the chart opens on: the same place at a78+ // comparable closeness, so the flip reads as turning a page, not losing79+ // one. A map change lands here too, but its mapping no longer answers80+ // and the new map's view is left alone.81+ const mapping = equirectMapping(state.map);82+ const view = state.engine?.getView();83+ if (globe && state.globeActive && mapping && view) {84+ const pov = globe.pointOfView();85+ const [worldX, worldY] = mapping.toWorld(pov.lat, pov.lng);86+ view.cancelAnimations();87+ view.setCenter([worldX, -worldY]);88+ view.setZoom(zoomForAltitude(pov.altitude));89+ }5890 state.globeActive = false;5991 elements.globe.hidden = true;6092 elements.globeToggle.setAttribute("aria-pressed", "false");
@@ -105,12 +137,20 @@ async function enterGlobe() {
105137 elements.globe.style.cursor = point ? "pointer" : "";106138 })107139 .onZoom(() => document.dispatchEvent(new Event("atlas:globe-camera")));108- globe.pointOfView({ lat: 10, lng: 0, altitude: 2.2 });109140 document.addEventListener("atlas:selection", syncSelection);110141 document.addEventListener("atlas:filters", syncFilters);111142 }112143 resizeGlobe();113144 145+ // The globe opens facing what the chart was showing, as close as the146+ // chart was: the flip keeps the reader's place in both directions.147+ const view = state.engine?.getView();148+ const center = view?.getCenter();149+ if (center) {150+ const [lat, lng] = mapping.toLatLng(center[0], -center[1]);151+ globe.pointOfView({ lat, lng, altitude: altitudeForZoom(view.getZoom() ?? wholeChartZoom) });152+ }153+114154 const variant = state.variant || state.map.variants[0];115155 const key = `${state.game.stamp}:${state.map.slug}:${variant.tiles}`;116156 if (texturedFor !== key) {